chrome-in-iframe 1.0.1 → 2.0.1

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/dist/log.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type Logger = (scope: string, ...args: unknown[]) => void;
2
+ export declare function setLogger(logger: Logger | null): void;
3
+ export declare function warn(scope: string, ...args: unknown[]): void;
@@ -1,10 +1,10 @@
1
- import type { ClientContext, MessageValue, PathKey, RequestId, SerializedError } from '../channel/types';
1
+ import type { ClientContext, MessageMeta, MessageValue, PathKey, RequestId, SerializedError } from '../channel/types';
2
2
  export declare function handleAccessPropertyRequest(data: {
3
3
  id: RequestId;
4
4
  path: PathKey[];
5
- }, ctx: ClientContext): void;
5
+ }, ctx: ClientContext, meta: MessageMeta): void;
6
6
  export declare function handleAccessPropertyResponse(data: {
7
7
  id: RequestId;
8
8
  data?: MessageValue;
9
9
  error?: SerializedError;
10
- }, ctx: ClientContext): void;
10
+ }, ctx: ClientContext, meta: MessageMeta): void;
@@ -1,11 +1,11 @@
1
- import type { ClientContext, MessageValue, PathKey, RequestId, SerializedError } from '../channel/types';
1
+ import type { ClientContext, MessageMeta, MessageValue, PathKey, RequestId, SerializedError } from '../channel/types';
2
2
  export declare function handleInvokeRequest(data: {
3
3
  id: RequestId;
4
4
  path: PathKey[];
5
5
  args: MessageValue[];
6
- }, ctx: ClientContext): void;
6
+ }, ctx: ClientContext, meta: MessageMeta): void;
7
7
  export declare function handleInvokeResponse(data: {
8
8
  id: RequestId;
9
9
  data?: MessageValue;
10
10
  error?: SerializedError;
11
- }, ctx: ClientContext): void;
11
+ }, ctx: ClientContext, meta: MessageMeta): void;
@@ -1,11 +1,11 @@
1
- import type { ClientContext, MessageValue, RequestId, SerializedError } from '../channel/types';
1
+ import type { ClientContext, MessageMeta, MessageValue, RequestId, SerializedError } from '../channel/types';
2
2
  export declare function handleCallbackInvoke(data: {
3
3
  id: string;
4
4
  callId: RequestId;
5
5
  args: MessageValue[];
6
- }, ctx: ClientContext): void;
6
+ }, ctx: ClientContext, meta: MessageMeta): void;
7
7
  export declare function handleCallbackInvokeResponse(data: {
8
8
  id: RequestId;
9
9
  data?: MessageValue;
10
10
  error?: SerializedError;
11
- }, ctx: ClientContext): void;
11
+ }, ctx: ClientContext, meta: MessageMeta): void;
@@ -0,0 +1,3 @@
1
+ import type { ClientContext, MessageMeta, Messages } from '../channel/types';
2
+ export declare function handleReleaseCallbacks(data: Messages['releaseCallbacks'], ctx: ClientContext, meta: MessageMeta): void;
3
+ export declare function handleDestroyEndpoint(_data: Messages['destroyEndpoint'], ctx: ClientContext, meta: MessageMeta): void;
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "chrome-in-iframe",
3
- "version": "1.0.1",
3
+ "version": "2.0.1",
4
4
  "description": "Bridge library that allows iframes in Chrome extension pages to call Chrome extension APIs",
5
5
  "license": "ISC",
6
6
  "author": "GumerLee",
7
7
  "type": "module",
8
8
  "main": "./dist/index.js",
9
9
  "types": "./dist/index.d.ts",
10
+ "sideEffects": false,
10
11
  "exports": {
11
12
  ".": {
12
- "import": {
13
- "types": "./dist/index.d.ts",
14
- "default": "./dist/index.js"
15
- }
16
- }
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./package.json": "./package.json"
17
18
  },
18
19
  "keywords": [
19
20
  "chrome-extension",
@@ -21,17 +22,24 @@
21
22
  "bridge"
22
23
  ],
23
24
  "files": [
24
- "dist"
25
+ "dist",
26
+ "README.md",
27
+ "README.zh-CN.md",
28
+ "CHANGELOG.md",
29
+ "CHANGELOG.zh-CN.md",
30
+ "LICENSE"
25
31
  ],
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
26
35
  "scripts": {
27
36
  "build": "rollup -c",
28
37
  "dev": "rollup -c -w",
29
38
  "test": "vitest run",
30
- "test:watch": "vitest",
31
- "lint": "eslint src",
32
- "format": "prettier --write \"src/**/*.ts\"",
39
+ "lint": "eslint src test",
40
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
33
41
  "typecheck": "tsc --noEmit",
34
- "prepublishOnly": "npm run build"
42
+ "prepublishOnly": "npm run typecheck && npm test && npm run build"
35
43
  },
36
44
  "dependencies": {
37
45
  "lru-cache": "^11.3.6",