chrome-in-iframe 1.0.0
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.
- package/README.md +226 -0
- package/README.zh-CN.md +225 -0
- package/dist/api.d.ts +35 -0
- package/dist/channel/channel.d.ts +3 -0
- package/dist/channel/deserializer.d.ts +2 -0
- package/dist/channel/listener.d.ts +3 -0
- package/dist/channel/path.d.ts +10 -0
- package/dist/channel/sender.d.ts +2 -0
- package/dist/channel/serializer.d.ts +2 -0
- package/dist/channel/types.d.ts +93 -0
- package/dist/channel/utils.d.ts +5 -0
- package/dist/client/context.d.ts +6 -0
- package/dist/client/endpoint.d.ts +12 -0
- package/dist/client/proxy.d.ts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1011 -0
- package/dist/processor/accessProperty.d.ts +10 -0
- package/dist/processor/invoke.d.ts +11 -0
- package/dist/processor/invokeCallback.d.ts +11 -0
- package/dist/processor/readProperty.d.ts +2 -0
- package/dist/processor/registry.d.ts +6 -0
- package/package.json +54 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClientContext, MessageValue, PathKey, RequestId, SerializedError } from '../channel/types';
|
|
2
|
+
export declare function handleAccessPropertyRequest(data: {
|
|
3
|
+
id: RequestId;
|
|
4
|
+
path: PathKey[];
|
|
5
|
+
}, ctx: ClientContext): void;
|
|
6
|
+
export declare function handleAccessPropertyResponse(data: {
|
|
7
|
+
id: RequestId;
|
|
8
|
+
data?: MessageValue;
|
|
9
|
+
error?: SerializedError;
|
|
10
|
+
}, ctx: ClientContext): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClientContext, MessageValue, PathKey, RequestId, SerializedError } from '../channel/types';
|
|
2
|
+
export declare function handleInvokeRequest(data: {
|
|
3
|
+
id: RequestId;
|
|
4
|
+
path: PathKey[];
|
|
5
|
+
args: MessageValue[];
|
|
6
|
+
}, ctx: ClientContext): void;
|
|
7
|
+
export declare function handleInvokeResponse(data: {
|
|
8
|
+
id: RequestId;
|
|
9
|
+
data?: MessageValue;
|
|
10
|
+
error?: SerializedError;
|
|
11
|
+
}, ctx: ClientContext): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClientContext, MessageValue, RequestId, SerializedError } from '../channel/types';
|
|
2
|
+
export declare function handleCallbackInvoke(data: {
|
|
3
|
+
id: string;
|
|
4
|
+
callId: RequestId;
|
|
5
|
+
args: MessageValue[];
|
|
6
|
+
}, ctx: ClientContext): void;
|
|
7
|
+
export declare function handleCallbackInvokeResponse(data: {
|
|
8
|
+
id: RequestId;
|
|
9
|
+
data?: MessageValue;
|
|
10
|
+
error?: SerializedError;
|
|
11
|
+
}, ctx: ClientContext): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MessageType, RequestHandler } from '../channel/types';
|
|
2
|
+
export declare function createProcessorRegistry(): {
|
|
3
|
+
register<K extends MessageType>(type: K, handler: RequestHandler<K>): void;
|
|
4
|
+
get<K extends MessageType>(type: MessageType): RequestHandler<K> | undefined;
|
|
5
|
+
};
|
|
6
|
+
export type ProcessorRegistry = ReturnType<typeof createProcessorRegistry>;
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chrome-in-iframe",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Bridge library that allows iframes in Chrome extension pages to call Chrome extension APIs",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "GumerLee",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"chrome-extension",
|
|
20
|
+
"iframe",
|
|
21
|
+
"bridge"
|
|
22
|
+
],
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rollup -c",
|
|
28
|
+
"dev": "rollup -c -w",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest",
|
|
31
|
+
"lint": "eslint src",
|
|
32
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"lru-cache": "^11.3.6",
|
|
38
|
+
"nanoid": "^3.3.12"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@eslint/js": "^9.39.4",
|
|
42
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
43
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
44
|
+
"@types/chrome": "^0.1.42",
|
|
45
|
+
"eslint": "^9.39.4",
|
|
46
|
+
"jsdom": "^29.1.1",
|
|
47
|
+
"prettier": "^3.8.3",
|
|
48
|
+
"rollup": "^4.60.4",
|
|
49
|
+
"tslib": "^2.8.1",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"typescript-eslint": "^8.59.3",
|
|
52
|
+
"vitest": "^3.2.4"
|
|
53
|
+
}
|
|
54
|
+
}
|