Adjust detectPackage for direct dependencies (#3227)

* Dependency detection

* packageInfo imports

* Dependency array

* Bump common

* Remove detectPackage comments (available in util)

* Bump
This commit is contained in:
Jaco Greeff
2021-02-27 15:25:05 +01:00
committed by GitHub
parent 7d11e6f9a5
commit 3ebf7eb424
29 changed files with 310 additions and 243 deletions
+5 -5
View File
@@ -15,17 +15,17 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.13.7",
"@babel/runtime": "^7.13.8",
"@polkadot/api-derive": "3.10.3-12",
"@polkadot/keyring": "^5.8.1",
"@polkadot/keyring": "^5.8.2-5",
"@polkadot/metadata": "3.10.3-12",
"@polkadot/rpc-core": "3.10.3-12",
"@polkadot/rpc-provider": "3.10.3-12",
"@polkadot/types": "3.10.3-12",
"@polkadot/types-known": "3.10.3-12",
"@polkadot/util": "^5.8.1",
"@polkadot/util-crypto": "^5.8.1",
"@polkadot/x-rxjs": "^5.8.1",
"@polkadot/util": "^5.8.2-5",
"@polkadot/util-crypto": "^5.8.2-5",
"@polkadot/x-rxjs": "^5.8.2-5",
"bn.js": "^4.11.9",
"eventemitter3": "^4.0.7"
}
+7 -16
View File
@@ -1,23 +1,14 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
// For esm, this should be import.meta.url or to get the same behavior as __dirname, we can use
//
// new URL(import.meta.url).pathname)
//
// The issue is the WP4 has "some" issues with import.meta.url. So because of bundlers, we can't have
// nice things... In this case it is even worse since import.meta.url won't even make it compile, so
// there is a complete dead end with usage thereof
//
// When that is fixed, a solution is to have both .js & .mjs files, with the following content -
//
// cjs: util.detectPackage(packageInfo, () => __dirname);
// esm: detectPackage(packageInfo, () => import.meta.url);
//
// With the above we additionally need a .d.ts to just export the packageInfo
import { packageInfo as deriveInfo } from '@polkadot/api-derive/packageInfo';
import { packageInfo as metaInfo } from '@polkadot/metadata/packageInfo';
import { packageInfo as coreInfo } from '@polkadot/rpc-core/packageInfo';
import { packageInfo as providerInfo } from '@polkadot/rpc-provider/packageInfo';
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { packageInfo as knownInfo } from '@polkadot/types-known/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [deriveInfo, metaInfo, coreInfo, providerInfo, typesInfo, knownInfo]);
+1
View File
@@ -6,6 +6,7 @@ import './detectPackage';
export { Keyring } from '@polkadot/keyring';
export { WsProvider } from '@polkadot/rpc-provider/ws';
export { packageInfo } from './packageInfo';
export { ApiPromise } from './promise';
export { SubmittableResult } from './submittable';
export { ApiRx } from './rx';