@onekeyfe/extension-bridge-hosted 0.0.7 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { IOptionsWithDebugLogger } from '@onekeyfe/cross-inpage-provider-types';
|
|
2
|
-
declare function inject(
|
|
2
|
+
declare function inject({ file, code, remove, }: {
|
|
3
|
+
file?: string;
|
|
4
|
+
code?: string;
|
|
5
|
+
remove?: boolean;
|
|
6
|
+
}): void;
|
|
3
7
|
declare function setupMessagePort(options?: IOptionsWithDebugLogger): void;
|
|
4
8
|
declare const _default: {
|
|
5
9
|
inject: typeof inject;
|
|
@@ -2,18 +2,21 @@ import { consts, isLegacyExtMessage, appDebugLogger, injectedFactory, } from '@o
|
|
|
2
2
|
import messagePort from '../extensionMessagePort';
|
|
3
3
|
const { EXT_PORT_CS_TO_BG, JS_BRIDGE_MESSAGE_DIRECTION, JS_BRIDGE_MESSAGE_EXT_CHANNEL } = consts;
|
|
4
4
|
// TODO one-time only
|
|
5
|
-
function inject(
|
|
5
|
+
function inject({ file, code, remove = true, }) {
|
|
6
6
|
// Manifest V2 Only
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
if (code) {
|
|
8
|
+
injectedFactory.injectCodeWithScriptTag({
|
|
9
|
+
code,
|
|
10
|
+
remove,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
12
13
|
// Manifest V3 & V2
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (file) {
|
|
15
|
+
injectedFactory.injectCodeWithScriptTag({
|
|
16
|
+
file: chrome.runtime.getURL(file),
|
|
17
|
+
remove,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
// TODO one-time only
|
|
19
22
|
function setupMessagePort(options = {}) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export declare const bridgeSetup: {
|
|
2
2
|
contentScript: {
|
|
3
|
-
inject: (
|
|
3
|
+
inject: ({ file, code, remove, }: {
|
|
4
|
+
file?: string | undefined;
|
|
5
|
+
code?: string | undefined;
|
|
6
|
+
remove?: boolean | undefined;
|
|
7
|
+
}) => void;
|
|
4
8
|
setupMessagePort: (options?: import("@onekeyfe/cross-inpage-provider-types").IOptionsWithDebugLogger) => void;
|
|
5
9
|
};
|
|
6
10
|
ui: {
|
|
@@ -7,18 +7,21 @@ const cross_inpage_provider_core_1 = require("@onekeyfe/cross-inpage-provider-co
|
|
|
7
7
|
const extensionMessagePort_1 = __importDefault(require("../extensionMessagePort"));
|
|
8
8
|
const { EXT_PORT_CS_TO_BG, JS_BRIDGE_MESSAGE_DIRECTION, JS_BRIDGE_MESSAGE_EXT_CHANNEL } = cross_inpage_provider_core_1.consts;
|
|
9
9
|
// TODO one-time only
|
|
10
|
-
function inject(
|
|
10
|
+
function inject({ file, code, remove = true, }) {
|
|
11
11
|
// Manifest V2 Only
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
if (code) {
|
|
13
|
+
cross_inpage_provider_core_1.injectedFactory.injectCodeWithScriptTag({
|
|
14
|
+
code,
|
|
15
|
+
remove,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
17
18
|
// Manifest V3 & V2
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (file) {
|
|
20
|
+
cross_inpage_provider_core_1.injectedFactory.injectCodeWithScriptTag({
|
|
21
|
+
file: chrome.runtime.getURL(file),
|
|
22
|
+
remove,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
// TODO one-time only
|
|
24
27
|
function setupMessagePort(options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/extension-bridge-hosted",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"start": "tsc --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@onekeyfe/cross-inpage-provider-core": "^0.0.
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-types": "^0.0.
|
|
31
|
+
"@onekeyfe/cross-inpage-provider-core": "^0.0.10",
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-types": "^0.0.10"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "3aee90f0d27a9e231176d5b6568ac6012282a6e1"
|
|
35
35
|
}
|