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
+7 -4
View File
@@ -3,7 +3,10 @@
"version": "3.10.3-12",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"sideEffects": false,
"sideEffects": [
"./detectPackage.js",
"./detectPackage.mjs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -12,11 +15,11 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.13.7",
"@babel/runtime": "^7.13.8",
"@polkadot/api": "3.10.3-12",
"@polkadot/types": "3.10.3-12",
"@polkadot/util": "^5.8.1",
"@polkadot/x-rxjs": "^5.8.1",
"@polkadot/util": "^5.8.2-5",
"@polkadot/x-rxjs": "^5.8.2-5",
"bn.js": "^4.11.9"
}
}
@@ -0,0 +1,10 @@
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as apiInfo } from '@polkadot/api/packageInfo';
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [apiInfo, typesInfo]);
+4 -1
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
export { Abi } from './Abi';
export { Blueprint as BlueprintRx, Code as CodeRx, Contract as ContractRx } from './rx';
export { packageInfo } from './packageInfo';
export { Blueprint as BlueprintPromise, Code as CodePromise, Contract as ContractPromise } from './promise';
export { Blueprint as BlueprintRx, Code as CodeRx, Contract as ContractRx } from './rx';
+9 -6
View File
@@ -3,7 +3,10 @@
"version": "3.10.3-12",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"sideEffects": false,
"sideEffects": [
"./detectPackage.js",
"./detectPackage.mjs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -12,17 +15,17 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.13.7",
"@babel/runtime": "^7.13.8",
"@polkadot/api": "3.10.3-12",
"@polkadot/rpc-core": "3.10.3-12",
"@polkadot/types": "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"
},
"devDependencies": {
"@polkadot/keyring": "^5.8.1",
"@polkadot/keyring": "^5.8.2-5",
"@polkadot/rpc-provider": "3.10.3-12"
}
}
+11
View File
@@ -0,0 +1,11 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as apiInfo } from '@polkadot/api/packageInfo';
import { packageInfo as coreInfo } from '@polkadot/rpc-core/packageInfo';
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [apiInfo, coreInfo, typesInfo]);
+3
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AnyFunction } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
@@ -22,6 +24,7 @@ import * as technicalCommittee from './technicalCommittee';
import * as treasury from './treasury';
import * as tx from './tx';
export { packageInfo } from './packageInfo';
export * from './type';
export const derive = { accounts, balances, bounties, chain, contracts, council, democracy, elections, imOnline, parachains, session, society, staking, technicalCommittee, treasury, tx };
+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';
+4 -4
View File
@@ -15,14 +15,14 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.13.7",
"@babel/runtime": "^7.13.8",
"@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/util": "^5.8.2-5",
"@polkadot/util-crypto": "^5.8.2-5",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^5.8.1"
"@polkadot/keyring": "^5.8.2-5"
}
}
+3 -16
View File
@@ -1,23 +1,10 @@
// Copyright 2017-2021 @polkadot/metadata 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 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, [typesInfo, knownInfo]);
+1
View File
@@ -5,3 +5,4 @@ import './detectPackage';
export { Metadata } from './Metadata';
export { decorateConstants, decorateExtrinsics, decorateStorage, expandMetadata } from './decorate';
export { packageInfo } from './packageInfo';
+8 -5
View File
@@ -3,7 +3,10 @@
"version": "3.10.3-12",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"sideEffects": false,
"sideEffects": [
"./detectPackage.js",
"./detectPackage.mjs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -12,14 +15,14 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.13.7",
"@babel/runtime": "^7.13.8",
"@polkadot/metadata": "3.10.3-12",
"@polkadot/rpc-provider": "3.10.3-12",
"@polkadot/types": "3.10.3-12",
"@polkadot/util": "^5.8.1",
"@polkadot/x-rxjs": "^5.8.1"
"@polkadot/util": "^5.8.2-5",
"@polkadot/x-rxjs": "^5.8.2-5"
},
"devDependencies": {
"@polkadot/keyring": "^5.8.1"
"@polkadot/keyring": "^5.8.2-5"
}
}
+11
View File
@@ -0,0 +1,11 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as metaInfo } from '@polkadot/metadata/packageInfo';
import { packageInfo as providerInfo } from '@polkadot/rpc-provider/packageInfo';
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [metaInfo, providerInfo, typesInfo]);
+4
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import type { ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types';
import type { StorageKey, Vec } from '@polkadot/types';
import type { Hash } from '@polkadot/types/interfaces';
@@ -18,6 +20,8 @@ import { publishReplay, refCount } from '@polkadot/x-rxjs/operators';
import { drr, refCountDelay } from './util';
export { packageInfo } from './packageInfo';
interface StorageChangeSetJSON {
block: string;
changes: [string, string | null][];
+12 -9
View File
@@ -3,7 +3,10 @@
"version": "3.10.3-12",
"description": "Transport providers for the API",
"main": "index.js",
"sideEffects": false,
"sideEffects": [
"./detectPackage.js",
"./detectPackage.mjs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -12,20 +15,20 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.13.7",
"@babel/runtime": "^7.13.8",
"@polkadot/types": "3.10.3-12",
"@polkadot/util": "^5.8.1",
"@polkadot/util-crypto": "^5.8.1",
"@polkadot/x-fetch": "^5.8.1",
"@polkadot/x-global": "^5.8.1",
"@polkadot/x-ws": "^5.8.1",
"@polkadot/util": "^5.8.2-5",
"@polkadot/util-crypto": "^5.8.2-5",
"@polkadot/x-fetch": "^5.8.2-5",
"@polkadot/x-global": "^5.8.2-5",
"@polkadot/x-ws": "^5.8.2-5",
"bn.js": "^4.11.9",
"eventemitter3": "^4.0.7"
},
"devDependencies": {
"@polkadot/keyring": "^5.8.1",
"@polkadot/keyring": "^5.8.2-5",
"@polkadot/metadata": "3.10.3-12",
"mock-socket": "^9.0.3",
"nock": "^13.0.8"
"nock": "^13.0.9"
}
}
@@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [typesInfo]);
+3
View File
@@ -1,5 +1,8 @@
// Copyright 2017-2021 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
export { HttpProvider } from './http';
export { packageInfo } from './packageInfo';
export { WsProvider } from './ws';
+8 -5
View File
@@ -3,7 +3,10 @@
"version": "3.10.3-12",
"description": "Type generation scripts",
"main": "index.js",
"sideEffects": false,
"sideEffects": [
"./detectPackage.js",
"./detectPackage.mjs"
],
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.js",
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.js",
@@ -19,14 +22,14 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"dependencies": {
"@babel/core": "^7.13.1",
"@babel/register": "^7.13.0",
"@babel/runtime": "^7.13.7",
"@babel/core": "^7.13.8",
"@babel/register": "^7.13.8",
"@babel/runtime": "^7.13.8",
"@polkadot/api": "3.10.3-12",
"@polkadot/metadata": "3.10.3-12",
"@polkadot/rpc-provider": "3.10.3-12",
"@polkadot/types": "3.10.3-12",
"@polkadot/util": "^5.8.1",
"@polkadot/util": "^5.8.2-5",
"handlebars": "^4.7.7",
"websocket": "^1.0.33",
"yargs": "^16.2.0"
+12
View File
@@ -0,0 +1,12 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as apiInfo } from '@polkadot/api/packageInfo';
import { packageInfo as metaInfo } from '@polkadot/metadata/packageInfo';
import { packageInfo as providerInfo } from '@polkadot/rpc-provider/packageInfo';
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [apiInfo, metaInfo, providerInfo, typesInfo]);
+3
View File
@@ -1,4 +1,7 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
export { packageInfo } from './packageInfo';
export { formatType } from './util/formatting';
+7 -4
View File
@@ -3,7 +3,10 @@
"version": "3.10.3-12",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"sideEffects": false,
"sideEffects": [
"./detectPackage.js",
"./detectPackage.mjs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -12,10 +15,10 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.13.7",
"@polkadot/networks": "^5.8.1",
"@babel/runtime": "^7.13.8",
"@polkadot/networks": "^5.8.2-5",
"@polkadot/types": "3.10.3-12",
"@polkadot/util": "^5.8.1",
"@polkadot/util": "^5.8.2-5",
"bn.js": "^4.11.9"
},
"devDependencies": {
@@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [typesInfo]);
+4
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2021 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import type BN from 'bn.js';
import type { Text } from '@polkadot/types';
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
@@ -14,6 +16,8 @@ import typesModules from './modules';
import typesSpec from './spec';
import upgrades from './upgrades';
export { packageInfo } from './packageInfo';
// flatten a VersionedType[] into a Record<string, string>
/** @internal */
function filterVersions (versions: OverrideVersionedType[] = [], specVersion: number): RegistryTypes {
+5 -5
View File
@@ -15,15 +15,15 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.13.7",
"@babel/runtime": "^7.13.8",
"@polkadot/metadata": "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",
"@types/bn.js": "^4.11.6",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^5.8.1"
"@polkadot/keyring": "^5.8.2-5"
}
}
+2 -16
View File
@@ -1,23 +1,9 @@
// Copyright 2017-2021 @polkadot/types 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 metaInfo } from '@polkadot/metadata/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [metaInfo]);
+1
View File
@@ -6,3 +6,4 @@ import './detectPackage';
export * from './codec';
export * from './create';
export * from './index.types';
export { packageInfo } from './packageInfo';