Add detectPackage for extension-* (#946)

* Bump deps

* Add detectPackage for extension-*

* Add missing util deps
This commit is contained in:
Jaco 2021-12-27 14:25:44 +01:00 committed by GitHub
parent c3003c11a3
commit 52c9666dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 92 additions and 5 deletions

View File

@ -12,7 +12,10 @@
"type": "git", "type": "git",
"url": "https://github.com/polkadot-js/extension.git" "url": "https://github.com/polkadot-js/extension.git"
}, },
"sideEffects": false, "sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"type": "module", "type": "module",
"version": "0.42.4", "version": "0.42.4",
"main": "index.js", "main": "index.js",

View File

@ -0,0 +1,11 @@
// Copyright 2017-2021 @polkadot/extension-base authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as chainsInfo } from '@polkadot/extension-chains/packageInfo';
import { packageInfo as dappInfo } from '@polkadot/extension-dapp/packageInfo';
import { packageInfo as injectInfo } from '@polkadot/extension-inject/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [chainsInfo, dappInfo, injectInfo]);

View File

@ -1,4 +1,6 @@
// Copyright 2019-2021 @polkadot/extension-base authors & contributors // Copyright 2019-2021 @polkadot/extension-base authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// no direct exports import './detectPackage';
export { packageInfo } from './packageInfo';

View File

@ -12,7 +12,10 @@
"type": "git", "type": "git",
"url": "https://github.com/polkadot-js/extension.git" "url": "https://github.com/polkadot-js/extension.git"
}, },
"sideEffects": false, "sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"type": "module", "type": "module",
"version": "0.42.4", "version": "0.42.4",
"main": "index.js", "main": "index.js",
@ -20,6 +23,7 @@
"@babel/runtime": "^7.16.5", "@babel/runtime": "^7.16.5",
"@polkadot/extension-inject": "^0.42.4", "@polkadot/extension-inject": "^0.42.4",
"@polkadot/networks": "^8.2.2", "@polkadot/networks": "^8.2.2",
"@polkadot/util": "^8.2.2",
"@polkadot/util-crypto": "^8.2.2" "@polkadot/util-crypto": "^8.2.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/extension-chains authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as injectInfo } from '@polkadot/extension-inject/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [injectInfo]);

View File

@ -1,6 +1,8 @@
// Copyright 2019-2021 @polkadot/extension-chains authors & contributors // Copyright 2019-2021 @polkadot/extension-chains authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import type { MetadataDef } from '@polkadot/extension-inject/types'; import type { MetadataDef } from '@polkadot/extension-inject/types';
import type { ChainProperties } from '@polkadot/types/interfaces'; import type { ChainProperties } from '@polkadot/types/interfaces';
import type { Chain } from './types'; import type { Chain } from './types';
@ -8,6 +10,8 @@ import type { Chain } from './types';
import { Metadata, TypeRegistry } from '@polkadot/types'; import { Metadata, TypeRegistry } from '@polkadot/types';
import { base64Decode } from '@polkadot/util-crypto'; import { base64Decode } from '@polkadot/util-crypto';
export { packageInfo } from './packageInfo';
// imports chain details, generally metadata. For the generation of these, // imports chain details, generally metadata. For the generation of these,
// inside the api, run `yarn chain:info --ws <url>` // inside the api, run `yarn chain:info --ws <url>`

View File

@ -12,7 +12,10 @@
"type": "git", "type": "git",
"url": "https://github.com/polkadot-js/extension.git" "url": "https://github.com/polkadot-js/extension.git"
}, },
"sideEffects": false, "sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"type": "module", "type": "module",
"version": "0.42.4", "version": "0.42.4",
"main": "index.js", "main": "index.js",

View File

@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/extension-chains authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as injectInfo } from '@polkadot/extension-inject/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [injectInfo]);

View File

@ -1,6 +1,8 @@
// Copyright 2019-2020 @polkadot/extension-compat-metamask authors & contributors // Copyright 2019-2020 @polkadot/extension-compat-metamask authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import type { Injected, InjectedAccount, InjectedWindow } from '@polkadot/extension-inject/types'; import type { Injected, InjectedAccount, InjectedWindow } from '@polkadot/extension-inject/types';
import type { SignerPayloadRaw, SignerResult } from '@polkadot/types/types'; import type { SignerPayloadRaw, SignerResult } from '@polkadot/types/types';
import type { HexString } from '@polkadot/util/types'; import type { HexString } from '@polkadot/util/types';
@ -10,6 +12,8 @@ import Web3 from 'web3';
import { assert } from '@polkadot/util'; import { assert } from '@polkadot/util';
export { packageInfo } from './packageInfo';
interface RequestArguments { interface RequestArguments {
method: string; method: string;
params?: unknown[]; params?: unknown[];

View File

@ -12,7 +12,10 @@
"type": "git", "type": "git",
"url": "https://github.com/polkadot-js/extension.git" "url": "https://github.com/polkadot-js/extension.git"
}, },
"sideEffects": false, "sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"type": "module", "type": "module",
"version": "0.42.4", "version": "0.42.4",
"main": "index.js", "main": "index.js",

View File

@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/extension-dapp authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as injectInfo } from '@polkadot/extension-inject/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [injectInfo]);

View File

@ -1,6 +1,8 @@
// Copyright 2019-2021 @polkadot/extension-dapp authors & contributors // Copyright 2019-2021 @polkadot/extension-dapp authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import type { Injected, InjectedAccount, InjectedAccountWithMeta, InjectedExtension, InjectedExtensionInfo, InjectedProviderWithMeta, InjectedWindow, ProviderList, Unsubcall, Web3AccountsOptions } from '@polkadot/extension-inject/types'; import type { Injected, InjectedAccount, InjectedAccountWithMeta, InjectedExtension, InjectedExtensionInfo, InjectedProviderWithMeta, InjectedWindow, ProviderList, Unsubcall, Web3AccountsOptions } from '@polkadot/extension-inject/types';
import { u8aEq } from '@polkadot/util'; import { u8aEq } from '@polkadot/util';
@ -9,6 +11,7 @@ import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
import { documentReadyPromise } from './util'; import { documentReadyPromise } from './util';
// expose utility functions // expose utility functions
export { packageInfo } from './packageInfo';
export { unwrapBytes, wrapBytes } from './wrapBytes'; export { unwrapBytes, wrapBytes } from './wrapBytes';
// just a helper (otherwise we cast all-over, so shorter and more readable) // just a helper (otherwise we cast all-over, so shorter and more readable)

View File

@ -20,6 +20,7 @@
"@babel/runtime": "^7.16.5", "@babel/runtime": "^7.16.5",
"@polkadot/rpc-provider": "^7.1.1", "@polkadot/rpc-provider": "^7.1.1",
"@polkadot/types": "^7.1.1", "@polkadot/types": "^7.1.1",
"@polkadot/util": "^8.2.2",
"@polkadot/util-crypto": "^8.2.2" "@polkadot/util-crypto": "^8.2.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -0,0 +1,8 @@
// Copyright 2017-2021 @polkadot/extension-inject authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, []);

View File

@ -1,8 +1,12 @@
// Copyright 2019-2021 @polkadot/extension-inject authors & contributors // Copyright 2019-2021 @polkadot/extension-inject authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import type { Injected, InjectedWindow, InjectOptions } from './types'; import type { Injected, InjectedWindow, InjectOptions } from './types';
export { packageInfo } from './packageInfo';
// It is recommended to always use the function below to shield the extension and dapp from // It is recommended to always use the function below to shield the extension and dapp from
// any future changes. The exposed interface will manage access between the 2 environments, // any future changes. The exposed interface will manage access between the 2 environments,
// be it via window (current), postMessage (under consideration) or any other mechanism // be it via window (current), postMessage (under consideration) or any other mechanism

View File

@ -0,0 +1,8 @@
// Copyright 2017-2021 @polkadot/extension authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, []);

View File

@ -2505,6 +2505,7 @@ __metadata:
"@babel/runtime": ^7.16.5 "@babel/runtime": ^7.16.5
"@polkadot/extension-inject": ^0.42.4 "@polkadot/extension-inject": ^0.42.4
"@polkadot/networks": ^8.2.2 "@polkadot/networks": ^8.2.2
"@polkadot/util": ^8.2.2
"@polkadot/util-crypto": ^8.2.2 "@polkadot/util-crypto": ^8.2.2
peerDependencies: peerDependencies:
"@polkadot/api": "*" "@polkadot/api": "*"
@ -2549,6 +2550,7 @@ __metadata:
"@babel/runtime": ^7.16.5 "@babel/runtime": ^7.16.5
"@polkadot/rpc-provider": ^7.1.1 "@polkadot/rpc-provider": ^7.1.1
"@polkadot/types": ^7.1.1 "@polkadot/types": ^7.1.1
"@polkadot/util": ^8.2.2
"@polkadot/util-crypto": ^8.2.2 "@polkadot/util-crypto": ^8.2.2
"@types/chrome": ^0.0.173 "@types/chrome": ^0.0.173
"@types/firefox-webext-browser": ^94.0.0 "@types/firefox-webext-browser": ^94.0.0