adnbn 0.6.0 → 0.7.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/dist/cli/builders/csp/AbstractCsp.d.ts +9 -0
- package/dist/cli/builders/csp/AbstractCsp.js +26 -0
- package/dist/cli/builders/csp/AbstractCsp.js.map +1 -0
- package/dist/cli/builders/csp/Csp.d.ts +8 -0
- package/dist/cli/builders/csp/Csp.js +39 -0
- package/dist/cli/builders/csp/Csp.js.map +1 -0
- package/dist/cli/builders/csp/SandboxCsp.d.ts +11 -0
- package/dist/cli/builders/csp/SandboxCsp.js +62 -0
- package/dist/cli/builders/csp/SandboxCsp.js.map +1 -0
- package/dist/cli/builders/csp/index.d.ts +3 -0
- package/dist/cli/builders/csp/index.js +7 -0
- package/dist/cli/builders/csp/index.js.map +1 -0
- package/dist/cli/builders/csp/types.d.ts +4 -0
- package/dist/cli/builders/csp/types.js +1 -0
- package/dist/cli/builders/csp/types.js.map +1 -0
- package/dist/cli/builders/manifest/ManifestBase.d.ts +16 -1
- package/dist/cli/builders/manifest/ManifestBase.js +49 -0
- package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestV2.d.ts +2 -0
- package/dist/cli/builders/manifest/ManifestV2.js +31 -1
- package/dist/cli/builders/manifest/ManifestV2.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestV3.d.ts +2 -0
- package/dist/cli/builders/manifest/ManifestV3.js +67 -0
- package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
- package/dist/cli/entrypoint/file/injectors/core.js +26 -0
- package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/TypeResolver.d.ts +4 -0
- package/dist/cli/entrypoint/file/parsers/TypeResolver.js +7 -1
- package/dist/cli/entrypoint/file/parsers/TypeResolver.js.map +1 -1
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +1 -1
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
- package/dist/cli/entrypoint/finder/OffscreenViewFinder.d.ts +2 -2
- package/dist/cli/entrypoint/finder/OffscreenViewFinder.js +2 -2
- package/dist/cli/entrypoint/finder/OffscreenViewFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/PageFinder.d.ts +2 -2
- package/dist/cli/entrypoint/finder/PageFinder.js +3 -3
- package/dist/cli/entrypoint/finder/PageFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/PopupFinder.d.ts +2 -2
- package/dist/cli/entrypoint/finder/PopupFinder.js +2 -2
- package/dist/cli/entrypoint/finder/PopupFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/SandboxFinder.d.ts +11 -0
- package/dist/cli/entrypoint/finder/SandboxFinder.js +25 -0
- package/dist/cli/entrypoint/finder/SandboxFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/SandboxViewFinder.d.ts +15 -0
- package/dist/cli/entrypoint/finder/SandboxViewFinder.js +33 -0
- package/dist/cli/entrypoint/finder/SandboxViewFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/SidebarFinder.d.ts +2 -2
- package/dist/cli/entrypoint/finder/SidebarFinder.js +2 -2
- package/dist/cli/entrypoint/finder/SidebarFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/ViewCspFinder.d.ts +11 -0
- package/dist/cli/entrypoint/finder/ViewCspFinder.js +24 -0
- package/dist/cli/entrypoint/finder/ViewCspFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/index.d.ts +3 -0
- package/dist/cli/entrypoint/finder/index.js +34 -28
- package/dist/cli/entrypoint/finder/index.js.map +1 -1
- package/dist/cli/entrypoint/parser/OffscreenParser.d.ts +2 -2
- package/dist/cli/entrypoint/parser/OffscreenParser.js +2 -2
- package/dist/cli/entrypoint/parser/OffscreenParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/PageParser.d.ts +2 -2
- package/dist/cli/entrypoint/parser/PageParser.js +2 -2
- package/dist/cli/entrypoint/parser/PageParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/PopupParser.d.ts +2 -2
- package/dist/cli/entrypoint/parser/PopupParser.js +2 -2
- package/dist/cli/entrypoint/parser/PopupParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/SandboxParser.d.ts +7 -0
- package/dist/cli/entrypoint/parser/SandboxParser.js +42 -0
- package/dist/cli/entrypoint/parser/SandboxParser.js.map +1 -0
- package/dist/cli/entrypoint/parser/SidebarParser.d.ts +2 -2
- package/dist/cli/entrypoint/parser/SidebarParser.js +2 -2
- package/dist/cli/entrypoint/parser/SidebarParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/ViewCspParser.d.ts +9 -0
- package/dist/cli/entrypoint/parser/ViewCspParser.js +26 -0
- package/dist/cli/entrypoint/parser/ViewCspParser.js.map +1 -0
- package/dist/cli/entrypoint/parser/ViewParser.d.ts +80 -80
- package/dist/cli/entrypoint/parser/index.d.ts +1 -0
- package/dist/cli/entrypoint/parser/index.js +8 -6
- package/dist/cli/entrypoint/parser/index.js.map +1 -1
- package/dist/cli/plugins/index.d.ts +2 -1
- package/dist/cli/plugins/index.js +14 -12
- package/dist/cli/plugins/index.js.map +1 -1
- package/dist/cli/plugins/offscreen/index.js +1 -0
- package/dist/cli/plugins/offscreen/index.js.map +1 -1
- package/dist/cli/plugins/page/index.js +1 -1
- package/dist/cli/plugins/page/index.js.map +1 -1
- package/dist/cli/plugins/popup/index.js +1 -1
- package/dist/cli/plugins/popup/index.js.map +1 -1
- package/dist/cli/plugins/sandbox/Sandbox.d.ts +15 -0
- package/dist/cli/plugins/sandbox/Sandbox.js +52 -0
- package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -0
- package/dist/cli/plugins/sandbox/SandboxDeclaration.d.ts +5 -0
- package/dist/cli/plugins/sandbox/SandboxDeclaration.js +10 -0
- package/dist/cli/plugins/sandbox/SandboxDeclaration.js.map +1 -0
- package/dist/cli/plugins/sandbox/index.d.ts +2 -0
- package/dist/cli/plugins/sandbox/index.js +63 -0
- package/dist/cli/plugins/sandbox/index.js.map +1 -0
- package/dist/cli/plugins/sidebar/index.js +1 -0
- package/dist/cli/plugins/sidebar/index.js.map +1 -1
- package/dist/cli/plugins/style/index.d.ts +2 -0
- package/dist/cli/plugins/{style.js → style/index.js} +18 -21
- package/dist/cli/plugins/style/index.js.map +1 -0
- package/dist/cli/plugins/style/utils.d.ts +1 -0
- package/dist/cli/plugins/style/utils.js +86 -0
- package/dist/cli/plugins/style/utils.js.map +1 -0
- package/dist/cli/plugins/typescript/declaration/transport/TransportDeclaration.d.ts +2 -1
- package/dist/cli/plugins/typescript/declaration/transport/TransportDeclaration.js +2 -3
- package/dist/cli/plugins/typescript/declaration/transport/TransportDeclaration.js.map +1 -1
- package/dist/cli/plugins/typescript/declaration/transport/transport.d.ts +5 -11
- package/dist/cli/resolvers/config.js +4 -0
- package/dist/cli/resolvers/config.js.map +1 -1
- package/dist/cli/virtual/index.d.ts +1 -0
- package/dist/cli/virtual/index.js +8 -1
- package/dist/cli/virtual/sandbox.d.ts +1 -0
- package/dist/cli/virtual/virtual.d.ts +27 -0
- package/dist/entry/sandbox/Builder.d.ts +15 -0
- package/dist/entry/sandbox/Builder.js +51 -0
- package/dist/entry/sandbox/Builder.js.map +1 -0
- package/dist/entry/sandbox/TransportBuilder.d.ts +8 -0
- package/dist/entry/sandbox/TransportBuilder.js +15 -0
- package/dist/entry/sandbox/TransportBuilder.js.map +1 -0
- package/dist/entry/sandbox/index.d.ts +2 -0
- package/dist/entry/sandbox/index.js +7 -0
- package/dist/entry/sandbox/index.js.map +1 -0
- package/dist/frame/ReadyFrame.d.ts +25 -0
- package/dist/frame/ReadyFrame.js +86 -0
- package/dist/frame/ReadyFrame.js.map +1 -0
- package/dist/frame/index.d.ts +2 -0
- package/dist/frame/index.js +5 -0
- package/dist/frame/index.js.map +1 -0
- package/dist/main/csp.d.ts +2 -0
- package/dist/main/csp.js +5 -0
- package/dist/main/csp.js.map +1 -0
- package/dist/main/index.d.ts +2 -0
- package/dist/main/index.js +2 -0
- package/dist/main/index.js.map +1 -1
- package/dist/main/offscreen.d.ts +3 -3
- package/dist/main/offscreen.js.map +1 -1
- package/dist/main/relay.d.ts +3 -3
- package/dist/main/relay.js.map +1 -1
- package/dist/main/sandbox.d.ts +9 -0
- package/dist/main/sandbox.js +29 -0
- package/dist/main/sandbox.js.map +1 -0
- package/dist/main/service.d.ts +3 -3
- package/dist/main/service.js.map +1 -1
- package/dist/message/MessageManager.d.ts +2 -0
- package/dist/message/MessageManager.js +21 -5
- package/dist/message/MessageManager.js.map +1 -1
- package/dist/message/error.d.ts +12 -0
- package/dist/message/error.js +55 -0
- package/dist/message/error.js.map +1 -0
- package/dist/message/providers/Message.d.ts +5 -0
- package/dist/message/providers/Message.js +44 -12
- package/dist/message/providers/Message.js.map +1 -1
- package/dist/offscreen/OffscreenBridge.d.ts +1 -3
- package/dist/offscreen/OffscreenBridge.js +12 -56
- package/dist/offscreen/OffscreenBridge.js.map +1 -1
- package/dist/offscreen/index.d.ts +8 -3
- package/dist/offscreen/index.js.map +1 -1
- package/dist/relay/index.d.ts +8 -3
- package/dist/relay/index.js.map +1 -1
- package/dist/sandbox/SandboxFrame.d.ts +6 -0
- package/dist/sandbox/SandboxFrame.js +31 -0
- package/dist/sandbox/SandboxFrame.js.map +1 -0
- package/dist/sandbox/SandboxManager.d.ts +5 -0
- package/dist/sandbox/SandboxManager.js +12 -0
- package/dist/sandbox/SandboxManager.js.map +1 -0
- package/dist/sandbox/SandboxMessage.d.ts +30 -0
- package/dist/sandbox/SandboxMessage.js +127 -0
- package/dist/sandbox/SandboxMessage.js.map +1 -0
- package/dist/sandbox/index.d.ts +7 -0
- package/dist/sandbox/index.js +6 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/ports/SandboxHost.d.ts +21 -0
- package/dist/sandbox/ports/SandboxHost.js +58 -0
- package/dist/sandbox/ports/SandboxHost.js.map +1 -0
- package/dist/sandbox/ports/SandboxInner.d.ts +17 -0
- package/dist/sandbox/ports/SandboxInner.js +45 -0
- package/dist/sandbox/ports/SandboxInner.js.map +1 -0
- package/dist/sandbox/ports/SandboxMemory.d.ts +4 -0
- package/dist/sandbox/ports/SandboxMemory.js +42 -0
- package/dist/sandbox/ports/SandboxMemory.js.map +1 -0
- package/dist/sandbox/ports/index.d.ts +3 -0
- package/dist/sandbox/ports/index.js +9 -0
- package/dist/sandbox/ports/index.js.map +1 -0
- package/dist/sandbox/providers/ProxySandbox.d.ts +10 -0
- package/dist/sandbox/providers/ProxySandbox.js +20 -0
- package/dist/sandbox/providers/ProxySandbox.js.map +1 -0
- package/dist/sandbox/providers/RegisterSandbox.d.ts +9 -0
- package/dist/sandbox/providers/RegisterSandbox.js +28 -0
- package/dist/sandbox/providers/RegisterSandbox.js.map +1 -0
- package/dist/sandbox/providers/index.d.ts +2 -0
- package/dist/sandbox/providers/index.js +7 -0
- package/dist/sandbox/providers/index.js.map +1 -0
- package/dist/sandbox/utils.d.ts +4 -0
- package/dist/sandbox/utils.js +10 -0
- package/dist/sandbox/utils.js.map +1 -0
- package/dist/service/index.d.ts +8 -3
- package/dist/service/index.js.map +1 -1
- package/dist/transport/RegisterTransport.d.ts +4 -2
- package/dist/transport/RegisterTransport.js +8 -1
- package/dist/transport/RegisterTransport.js.map +1 -1
- package/dist/transport/TransportMessage.d.ts +1 -1
- package/dist/transport/TransportMessage.js +1 -1
- package/dist/transport/TransportMessage.js.map +1 -1
- package/dist/transport/index.d.ts +4 -1
- package/dist/types/config.d.ts +7 -0
- package/dist/types/csp.d.ts +34 -0
- package/dist/types/csp.js +12 -0
- package/dist/types/csp.js.map +1 -0
- package/dist/types/entrypoint.d.ts +2 -1
- package/dist/types/entrypoint.js +1 -0
- package/dist/types/entrypoint.js.map +1 -1
- package/dist/types/manifest.d.ts +10 -0
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/message.d.ts +15 -0
- package/dist/types/message.js +2 -0
- package/dist/types/message.js.map +1 -1
- package/dist/types/offscreen.d.ts +2 -1
- package/dist/types/offscreen.js.map +1 -1
- package/dist/types/page.d.ts +2 -1
- package/dist/types/plugin.d.ts +2 -1
- package/dist/types/popup.d.ts +2 -1
- package/dist/types/sandbox.d.ts +97 -0
- package/dist/types/sandbox.js +34 -0
- package/dist/types/sandbox.js.map +1 -0
- package/dist/types/sidebar.d.ts +2 -1
- package/dist/types/sidebar.js.map +1 -1
- package/dist/types/transport.d.ts +6 -2
- package/package.json +7 -1
- package/dist/cli/plugins/style.d.ts +0 -2
- package/dist/cli/plugins/style.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SandboxEnvelope, SandboxParameters, SandboxPort } from "../../types/sandbox.js";
|
|
2
|
+
import type { MessageSender } from "../../types/message.js";
|
|
3
|
+
/**
|
|
4
|
+
* Host-side `SandboxPort`: runs in an extension page, owns the sandbox iframe.
|
|
5
|
+
* `connect` creates the iframe and awaits its ready handshake (via `SandboxFrame`);
|
|
6
|
+
* `post` targets the iframe's `contentWindow`; `subscribe` attaches a single `message`
|
|
7
|
+
* listener filtered to that frame.
|
|
8
|
+
*/
|
|
9
|
+
export default class SandboxHost implements SandboxPort {
|
|
10
|
+
private readonly name;
|
|
11
|
+
private readonly parameters;
|
|
12
|
+
private readonly frames;
|
|
13
|
+
private readonly channel;
|
|
14
|
+
private frame?;
|
|
15
|
+
private unsubscribe?;
|
|
16
|
+
constructor(name: string, parameters: SandboxParameters);
|
|
17
|
+
connect(): Promise<void>;
|
|
18
|
+
post(message: SandboxEnvelope): void;
|
|
19
|
+
subscribe(onMessage: (message: SandboxEnvelope, sender: MessageSender) => void): () => void;
|
|
20
|
+
dispose(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { sandboxChannel, sandboxSender } from "../utils.js";
|
|
2
|
+
import SandboxFrame from "../SandboxFrame.js";
|
|
3
|
+
class SandboxHost {
|
|
4
|
+
constructor(name, parameters) {
|
|
5
|
+
this.name = name;
|
|
6
|
+
this.parameters = parameters;
|
|
7
|
+
this.channel = sandboxChannel(name);
|
|
8
|
+
}
|
|
9
|
+
name;
|
|
10
|
+
parameters;
|
|
11
|
+
frames = new SandboxFrame();
|
|
12
|
+
channel;
|
|
13
|
+
frame;
|
|
14
|
+
unsubscribe;
|
|
15
|
+
async connect() {
|
|
16
|
+
this.frame = await this.frames.make(this.name, this.parameters);
|
|
17
|
+
}
|
|
18
|
+
post(message) {
|
|
19
|
+
var _a;
|
|
20
|
+
const target = (_a = this.frame) == null ? void 0 : _a.contentWindow;
|
|
21
|
+
if (!target) {
|
|
22
|
+
throw new Error(`Sandbox "${this.name}" is not available.`);
|
|
23
|
+
}
|
|
24
|
+
target.postMessage(message, "*");
|
|
25
|
+
}
|
|
26
|
+
subscribe(onMessage) {
|
|
27
|
+
if (this.unsubscribe) {
|
|
28
|
+
return this.unsubscribe;
|
|
29
|
+
}
|
|
30
|
+
const listener = (event) => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (event.source !== ((_a = this.frame) == null ? void 0 : _a.contentWindow)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const data = event.data;
|
|
36
|
+
if ((data == null ? void 0 : data.channel) !== this.channel || data.name !== this.name) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
onMessage(data, sandboxSender());
|
|
40
|
+
};
|
|
41
|
+
window.addEventListener("message", listener);
|
|
42
|
+
this.unsubscribe = () => {
|
|
43
|
+
window.removeEventListener("message", listener);
|
|
44
|
+
this.unsubscribe = void 0;
|
|
45
|
+
};
|
|
46
|
+
return this.unsubscribe;
|
|
47
|
+
}
|
|
48
|
+
dispose() {
|
|
49
|
+
var _a;
|
|
50
|
+
(_a = this.unsubscribe) == null ? void 0 : _a.call(this);
|
|
51
|
+
this.frames.remove(this.name);
|
|
52
|
+
this.frame = void 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
SandboxHost as default
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=SandboxHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/sandbox/ports/SandboxHost.ts"],"sourcesContent":["import {sandboxChannel, sandboxSender} from \"../utils\";\nimport SandboxFrame from \"../SandboxFrame\";\n\nimport type {SandboxEnvelope, SandboxParameters, SandboxPort} from \"@typing/sandbox\";\nimport type {MessageSender} from \"@typing/message\";\n\n/**\n * Host-side `SandboxPort`: runs in an extension page, owns the sandbox iframe.\n * `connect` creates the iframe and awaits its ready handshake (via `SandboxFrame`);\n * `post` targets the iframe's `contentWindow`; `subscribe` attaches a single `message`\n * listener filtered to that frame.\n */\nexport default class SandboxHost implements SandboxPort {\n private readonly frames = new SandboxFrame();\n\n private readonly channel: string;\n\n private frame?: HTMLIFrameElement;\n\n private unsubscribe?: () => void;\n\n constructor(\n private readonly name: string,\n private readonly parameters: SandboxParameters\n ) {\n this.channel = sandboxChannel(name);\n }\n\n public async connect(): Promise<void> {\n this.frame = await this.frames.make(this.name, this.parameters);\n }\n\n public post(message: SandboxEnvelope): void {\n const target = this.frame?.contentWindow;\n\n if (!target) {\n throw new Error(`Sandbox \"${this.name}\" is not available.`);\n }\n\n // Sandboxed iframes have an opaque origin, so no concrete targetOrigin is possible.\n // Inbound messages are trusted by channel + name + requestId, never by origin.\n target.postMessage(message, \"*\");\n }\n\n public subscribe(onMessage: (message: SandboxEnvelope, sender: MessageSender) => void): () => void {\n if (this.unsubscribe) {\n return this.unsubscribe;\n }\n\n const listener = (event: MessageEvent) => {\n if (event.source !== this.frame?.contentWindow) {\n return;\n }\n\n const data = event.data as Partial<SandboxEnvelope>;\n\n if (data?.channel !== this.channel || data.name !== this.name) {\n return;\n }\n\n onMessage(data as SandboxEnvelope, sandboxSender());\n };\n\n window.addEventListener(\"message\", listener);\n\n this.unsubscribe = () => {\n window.removeEventListener(\"message\", listener);\n this.unsubscribe = undefined;\n };\n\n return this.unsubscribe;\n }\n\n public dispose(): void {\n this.unsubscribe?.();\n this.frames.remove(this.name);\n this.frame = undefined;\n }\n}\n"],"mappings":"AAAA,SAAQ,gBAAgB,qBAAoB;AAC5C,OAAO,kBAAkB;AAWzB,MAAO,YAAiD;AAAA,EASpD,YACqB,MACA,YACnB;AAFmB;AACA;AAEjB,SAAK,UAAU,eAAe,IAAI;AAAA,EACtC;AAAA,EAJqB;AAAA,EACA;AAAA,EAVJ,SAAS,IAAI,aAAa;AAAA,EAE1B;AAAA,EAET;AAAA,EAEA;AAAA,EASR,MAAa,UAAyB;AAClC,SAAK,QAAQ,MAAM,KAAK,OAAO,KAAK,KAAK,MAAM,KAAK,UAAU;AAAA,EAClE;AAAA,EAEO,KAAK,SAAgC;AAhChD;AAiCQ,UAAM,UAAS,UAAK,UAAL,mBAAY;AAE3B,QAAI,CAAC,QAAQ;AACT,YAAM,IAAI,MAAM,YAAY,KAAK,IAAI,qBAAqB;AAAA,IAC9D;AAIA,WAAO,YAAY,SAAS,GAAG;AAAA,EACnC;AAAA,EAEO,UAAU,WAAkF;AAC/F,QAAI,KAAK,aAAa;AAClB,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,WAAW,CAAC,UAAwB;AAjDlD;AAkDY,UAAI,MAAM,aAAW,UAAK,UAAL,mBAAY,gBAAe;AAC5C;AAAA,MACJ;AAEA,YAAM,OAAO,MAAM;AAEnB,WAAI,6BAAM,aAAY,KAAK,WAAW,KAAK,SAAS,KAAK,MAAM;AAC3D;AAAA,MACJ;AAEA,gBAAU,MAAyB,cAAc,CAAC;AAAA,IACtD;AAEA,WAAO,iBAAiB,WAAW,QAAQ;AAE3C,SAAK,cAAc,MAAM;AACrB,aAAO,oBAAoB,WAAW,QAAQ;AAC9C,WAAK,cAAc;AAAA,IACvB;AAEA,WAAO,KAAK;AAAA,EAChB;AAAA,EAEO,UAAgB;AAzE3B;AA0EQ,eAAK,gBAAL;AACA,SAAK,OAAO,OAAO,KAAK,IAAI;AAC5B,SAAK,QAAQ;AAAA,EACjB;AACJ;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SandboxEnvelope, SandboxPort } from "../../types/sandbox.js";
|
|
2
|
+
import type { MessageSender } from "../../types/message.js";
|
|
3
|
+
/**
|
|
4
|
+
* Sandbox-side `SandboxPort`: runs inside the iframe. There is no frame to create, so
|
|
5
|
+
* `connect` resolves immediately (the ready handshake is posted by the sandbox builder);
|
|
6
|
+
* `post` targets `window.parent`; `subscribe` listens for messages from the parent.
|
|
7
|
+
*/
|
|
8
|
+
export default class SandboxInner implements SandboxPort {
|
|
9
|
+
private readonly name;
|
|
10
|
+
private readonly channel;
|
|
11
|
+
private unsubscribe?;
|
|
12
|
+
constructor(name: string);
|
|
13
|
+
connect(): Promise<void>;
|
|
14
|
+
post(message: SandboxEnvelope): void;
|
|
15
|
+
subscribe(onMessage: (message: SandboxEnvelope, sender: MessageSender) => void): () => void;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { sandboxChannel, sandboxSender } from "../utils.js";
|
|
2
|
+
class SandboxInner {
|
|
3
|
+
constructor(name) {
|
|
4
|
+
this.name = name;
|
|
5
|
+
this.channel = sandboxChannel(name);
|
|
6
|
+
}
|
|
7
|
+
name;
|
|
8
|
+
channel;
|
|
9
|
+
unsubscribe;
|
|
10
|
+
connect() {
|
|
11
|
+
return Promise.resolve();
|
|
12
|
+
}
|
|
13
|
+
post(message) {
|
|
14
|
+
window.parent.postMessage(message, "*");
|
|
15
|
+
}
|
|
16
|
+
subscribe(onMessage) {
|
|
17
|
+
if (this.unsubscribe) {
|
|
18
|
+
return this.unsubscribe;
|
|
19
|
+
}
|
|
20
|
+
const listener = (event) => {
|
|
21
|
+
if (event.source !== window.parent) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const data = event.data;
|
|
25
|
+
if ((data == null ? void 0 : data.channel) !== this.channel || data.name !== this.name) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
onMessage(data, sandboxSender());
|
|
29
|
+
};
|
|
30
|
+
window.addEventListener("message", listener);
|
|
31
|
+
this.unsubscribe = () => {
|
|
32
|
+
window.removeEventListener("message", listener);
|
|
33
|
+
this.unsubscribe = void 0;
|
|
34
|
+
};
|
|
35
|
+
return this.unsubscribe;
|
|
36
|
+
}
|
|
37
|
+
dispose() {
|
|
38
|
+
var _a;
|
|
39
|
+
(_a = this.unsubscribe) == null ? void 0 : _a.call(this);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
SandboxInner as default
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=SandboxInner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/sandbox/ports/SandboxInner.ts"],"sourcesContent":["import {sandboxChannel, sandboxSender} from \"../utils\";\n\nimport type {SandboxEnvelope, SandboxPort} from \"@typing/sandbox\";\nimport type {MessageSender} from \"@typing/message\";\n\n/**\n * Sandbox-side `SandboxPort`: runs inside the iframe. There is no frame to create, so\n * `connect` resolves immediately (the ready handshake is posted by the sandbox builder);\n * `post` targets `window.parent`; `subscribe` listens for messages from the parent.\n */\nexport default class SandboxInner implements SandboxPort {\n private readonly channel: string;\n\n private unsubscribe?: () => void;\n\n constructor(private readonly name: string) {\n this.channel = sandboxChannel(name);\n }\n\n public connect(): Promise<void> {\n return Promise.resolve();\n }\n\n public post(message: SandboxEnvelope): void {\n // Opaque sandbox origin: no concrete targetOrigin is possible; the host trusts\n // messages by channel + name + requestId, never by origin.\n window.parent.postMessage(message, \"*\");\n }\n\n public subscribe(onMessage: (message: SandboxEnvelope, sender: MessageSender) => void): () => void {\n if (this.unsubscribe) {\n return this.unsubscribe;\n }\n\n const listener = (event: MessageEvent) => {\n if (event.source !== window.parent) {\n return;\n }\n\n const data = event.data as Partial<SandboxEnvelope>;\n\n if (data?.channel !== this.channel || data.name !== this.name) {\n return;\n }\n\n onMessage(data as SandboxEnvelope, sandboxSender());\n };\n\n window.addEventListener(\"message\", listener);\n\n this.unsubscribe = () => {\n window.removeEventListener(\"message\", listener);\n this.unsubscribe = undefined;\n };\n\n return this.unsubscribe;\n }\n\n public dispose(): void {\n this.unsubscribe?.();\n }\n}\n"],"mappings":"AAAA,SAAQ,gBAAgB,qBAAoB;AAU5C,MAAO,aAAkD;AAAA,EAKrD,YAA6B,MAAc;AAAd;AACzB,SAAK,UAAU,eAAe,IAAI;AAAA,EACtC;AAAA,EAF6B;AAAA,EAJZ;AAAA,EAET;AAAA,EAMD,UAAyB;AAC5B,WAAO,QAAQ,QAAQ;AAAA,EAC3B;AAAA,EAEO,KAAK,SAAgC;AAGxC,WAAO,OAAO,YAAY,SAAS,GAAG;AAAA,EAC1C;AAAA,EAEO,UAAU,WAAkF;AAC/F,QAAI,KAAK,aAAa;AAClB,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,WAAW,CAAC,UAAwB;AACtC,UAAI,MAAM,WAAW,OAAO,QAAQ;AAChC;AAAA,MACJ;AAEA,YAAM,OAAO,MAAM;AAEnB,WAAI,6BAAM,aAAY,KAAK,WAAW,KAAK,SAAS,KAAK,MAAM;AAC3D;AAAA,MACJ;AAEA,gBAAU,MAAyB,cAAc,CAAC;AAAA,IACtD;AAEA,WAAO,iBAAiB,WAAW,QAAQ;AAE3C,SAAK,cAAc,MAAM;AACrB,aAAO,oBAAoB,WAAW,QAAQ;AAC9C,WAAK,cAAc;AAAA,IACvB;AAEA,WAAO,KAAK;AAAA,EAChB;AAAA,EAEO,UAAgB;AA1D3B;AA2DQ,eAAK,gBAAL;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const MemorySender = { url: "memory:", origin: "memory:" };
|
|
2
|
+
class MemoryPort {
|
|
3
|
+
peer;
|
|
4
|
+
listeners = /* @__PURE__ */ new Set();
|
|
5
|
+
link(peer) {
|
|
6
|
+
this.peer = peer;
|
|
7
|
+
}
|
|
8
|
+
connect() {
|
|
9
|
+
return Promise.resolve();
|
|
10
|
+
}
|
|
11
|
+
post(message) {
|
|
12
|
+
const peer = this.peer;
|
|
13
|
+
if (!peer) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
queueMicrotask(() => {
|
|
17
|
+
for (const listener of peer.listeners) {
|
|
18
|
+
listener(message, MemorySender);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
subscribe(onMessage) {
|
|
23
|
+
this.listeners.add(onMessage);
|
|
24
|
+
return () => this.listeners.delete(onMessage);
|
|
25
|
+
}
|
|
26
|
+
dispose() {
|
|
27
|
+
this.listeners.clear();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
class SandboxMemory {
|
|
31
|
+
static pair() {
|
|
32
|
+
const host = new MemoryPort();
|
|
33
|
+
const guest = new MemoryPort();
|
|
34
|
+
host.link(guest);
|
|
35
|
+
guest.link(host);
|
|
36
|
+
return [host, guest];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
SandboxMemory as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=SandboxMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/sandbox/ports/SandboxMemory.ts"],"sourcesContent":["import type {SandboxEnvelope, SandboxPort} from \"@typing/sandbox\";\nimport type {MessageSender} from \"@typing/message\";\n\nconst MemorySender = {url: \"memory:\", origin: \"memory:\"} as MessageSender;\n\n/**\n * In-memory `SandboxPort` used in tests. A linked pair of endpoints delivers each posted\n * envelope to the other end asynchronously (microtask), mimicking `postMessage` without a\n * DOM. Lets `SandboxMessage`'s correlation be tested end-to-end and deterministically.\n */\nclass MemoryPort implements SandboxPort {\n private peer?: MemoryPort;\n\n private readonly listeners: Set<(message: SandboxEnvelope, sender: MessageSender) => void> = new Set();\n\n public link(peer: MemoryPort): void {\n this.peer = peer;\n }\n\n public connect(): Promise<void> {\n return Promise.resolve();\n }\n\n public post(message: SandboxEnvelope): void {\n const peer = this.peer;\n\n if (!peer) {\n return;\n }\n\n queueMicrotask(() => {\n for (const listener of peer.listeners) {\n listener(message, MemorySender);\n }\n });\n }\n\n public subscribe(onMessage: (message: SandboxEnvelope, sender: MessageSender) => void): () => void {\n this.listeners.add(onMessage);\n\n return () => this.listeners.delete(onMessage);\n }\n\n public dispose(): void {\n this.listeners.clear();\n }\n}\n\nexport default class SandboxMemory {\n public static pair(): [SandboxPort, SandboxPort] {\n const host = new MemoryPort();\n const guest = new MemoryPort();\n\n host.link(guest);\n guest.link(host);\n\n return [host, guest];\n }\n}\n"],"mappings":"AAGA,MAAM,eAAe,EAAC,KAAK,WAAW,QAAQ,UAAS;AAOvD,MAAM,WAAkC;AAAA,EAC5B;AAAA,EAES,YAA4E,oBAAI,IAAI;AAAA,EAE9F,KAAK,MAAwB;AAChC,SAAK,OAAO;AAAA,EAChB;AAAA,EAEO,UAAyB;AAC5B,WAAO,QAAQ,QAAQ;AAAA,EAC3B;AAAA,EAEO,KAAK,SAAgC;AACxC,UAAM,OAAO,KAAK;AAElB,QAAI,CAAC,MAAM;AACP;AAAA,IACJ;AAEA,mBAAe,MAAM;AACjB,iBAAW,YAAY,KAAK,WAAW;AACnC,iBAAS,SAAS,YAAY;AAAA,MAClC;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEO,UAAU,WAAkF;AAC/F,SAAK,UAAU,IAAI,SAAS;AAE5B,WAAO,MAAM,KAAK,UAAU,OAAO,SAAS;AAAA,EAChD;AAAA,EAEO,UAAgB;AACnB,SAAK,UAAU,MAAM;AAAA,EACzB;AACJ;AAEA,MAAO,cAA4B;AAAA,EAC/B,OAAc,OAAmC;AAC7C,UAAM,OAAO,IAAI,WAAW;AAC5B,UAAM,QAAQ,IAAI,WAAW;AAE7B,SAAK,KAAK,KAAK;AACf,UAAM,KAAK,IAAI;AAEf,WAAO,CAAC,MAAM,KAAK;AAAA,EACvB;AACJ;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as default2 } from "./SandboxHost.js";
|
|
2
|
+
import { default as default3 } from "./SandboxInner.js";
|
|
3
|
+
import { default as default4 } from "./SandboxMemory.js";
|
|
4
|
+
export {
|
|
5
|
+
default2 as SandboxHost,
|
|
6
|
+
default3 as SandboxInner,
|
|
7
|
+
default4 as SandboxMemory
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/sandbox/ports/index.ts"],"sourcesContent":["export {default as SandboxHost} from \"./SandboxHost\";\nexport {default as SandboxInner} from \"./SandboxInner\";\nexport {default as SandboxMemory} from \"./SandboxMemory\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAA6B;AACrC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAA+B;","names":["default"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ProxyTransport from "../../transport/ProxyTransport.js";
|
|
2
|
+
import type { DeepAsyncProxy } from "../../types/helpers.js";
|
|
3
|
+
import type { SandboxParameters } from "../../types/sandbox.js";
|
|
4
|
+
import type { TransportDictionary, TransportManager, TransportName } from "../../types/transport.js";
|
|
5
|
+
export default class<N extends TransportName, T = DeepAsyncProxy<TransportDictionary[N]>> extends ProxyTransport<N, T> {
|
|
6
|
+
private readonly parameters;
|
|
7
|
+
constructor(name: N, parameters: SandboxParameters);
|
|
8
|
+
protected manager(): TransportManager;
|
|
9
|
+
protected apply(args: any[], path?: string): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ProxyTransport from "./../../transport/ProxyTransport.js";
|
|
2
|
+
import SandboxManager from "../SandboxManager.js";
|
|
3
|
+
import SandboxMessage from "../SandboxMessage.js";
|
|
4
|
+
class ProxySandbox_default extends ProxyTransport {
|
|
5
|
+
constructor(name, parameters) {
|
|
6
|
+
super(name);
|
|
7
|
+
this.parameters = parameters;
|
|
8
|
+
}
|
|
9
|
+
parameters;
|
|
10
|
+
manager() {
|
|
11
|
+
return SandboxManager.getInstance();
|
|
12
|
+
}
|
|
13
|
+
apply(args, path) {
|
|
14
|
+
return SandboxMessage.for(this.name, this.parameters).send({ path, args });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
ProxySandbox_default as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=ProxySandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/sandbox/providers/ProxySandbox.ts"],"sourcesContent":["import ProxyTransport from \"@transport/ProxyTransport\";\n\nimport SandboxManager from \"../SandboxManager\";\nimport SandboxMessage from \"../SandboxMessage\";\n\nimport type {DeepAsyncProxy} from \"@typing/helpers\";\nimport type {SandboxParameters} from \"@typing/sandbox\";\nimport type {TransportDictionary, TransportManager, TransportName} from \"@typing/transport\";\n\nexport default class<N extends TransportName, T = DeepAsyncProxy<TransportDictionary[N]>> extends ProxyTransport<N, T> {\n constructor(\n name: N,\n private readonly parameters: SandboxParameters\n ) {\n super(name);\n }\n\n protected manager(): TransportManager {\n return SandboxManager.getInstance();\n }\n\n protected apply(args: any[], path?: string): Promise<any> {\n return SandboxMessage.for(this.name, this.parameters).send({path, args});\n }\n}\n"],"mappings":"AAAA,OAAO,oBAAoB;AAE3B,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAM3B,MAAO,6BAA2F,eAAqB;AAAA,EACnH,YACI,MACiB,YACnB;AACE,UAAM,IAAI;AAFO;AAAA,EAGrB;AAAA,EAHqB;AAAA,EAKX,UAA4B;AAClC,WAAO,eAAe,YAAY;AAAA,EACtC;AAAA,EAEU,MAAM,MAAa,MAA6B;AACtD,WAAO,eAAe,IAAI,KAAK,MAAM,KAAK,UAAU,EAAE,KAAK,EAAC,MAAM,KAAI,CAAC;AAAA,EAC3E;AACJ;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import RegisterTransport from "../../transport/RegisterTransport.js";
|
|
2
|
+
import type { TransportDictionary, TransportName, TransportReceiver } from "../../types/transport.js";
|
|
3
|
+
export default class<N extends TransportName, T extends object = TransportDictionary[N], A extends any[] = []> extends RegisterTransport<N, T, A> {
|
|
4
|
+
protected readonly init: (...args: A) => T;
|
|
5
|
+
constructor(name: N, init: (...args: A) => T);
|
|
6
|
+
protected message(): TransportReceiver;
|
|
7
|
+
protected manager(): import("../../types/transport.js").TransportManager;
|
|
8
|
+
get(): T;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import RegisterTransport from "./../../transport/RegisterTransport.js";
|
|
2
|
+
import { isSandbox } from "../utils.js";
|
|
3
|
+
import SandboxManager from "../SandboxManager.js";
|
|
4
|
+
import SandboxMessage from "../SandboxMessage.js";
|
|
5
|
+
import { SandboxInner } from "../ports/index.js";
|
|
6
|
+
class RegisterSandbox_default extends RegisterTransport {
|
|
7
|
+
constructor(name, init) {
|
|
8
|
+
super(name, init);
|
|
9
|
+
this.init = init;
|
|
10
|
+
}
|
|
11
|
+
init;
|
|
12
|
+
message() {
|
|
13
|
+
return new SandboxMessage(this.name, new SandboxInner(this.name));
|
|
14
|
+
}
|
|
15
|
+
manager() {
|
|
16
|
+
return SandboxManager.getInstance();
|
|
17
|
+
}
|
|
18
|
+
get() {
|
|
19
|
+
if (!isSandbox()) {
|
|
20
|
+
throw new Error(`Sandbox "${this.name}" can be getting only from sandbox context.`);
|
|
21
|
+
}
|
|
22
|
+
return super.get();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
RegisterSandbox_default as default
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=RegisterSandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/sandbox/providers/RegisterSandbox.ts"],"sourcesContent":["import RegisterTransport from \"@transport/RegisterTransport\";\n\nimport {isSandbox} from \"../utils\";\nimport SandboxManager from \"../SandboxManager\";\nimport SandboxMessage from \"../SandboxMessage\";\nimport {SandboxInner} from \"../ports\";\n\nimport type {TransportDictionary, TransportName, TransportReceiver} from \"@typing/transport\";\n\nexport default class<\n N extends TransportName,\n T extends object = TransportDictionary[N],\n A extends any[] = [],\n> extends RegisterTransport<N, T, A> {\n constructor(\n name: N,\n protected readonly init: (...args: A) => T\n ) {\n super(name, init);\n }\n\n protected message(): TransportReceiver {\n return new SandboxMessage(this.name, new SandboxInner(this.name));\n }\n\n protected manager() {\n return SandboxManager.getInstance();\n }\n\n public get(): T {\n if (!isSandbox()) {\n throw new Error(`Sandbox \"${this.name}\" can be getting only from sandbox context.`);\n }\n\n return super.get();\n }\n}\n"],"mappings":"AAAA,OAAO,uBAAuB;AAE9B,SAAQ,iBAAgB;AACxB,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAC3B,SAAQ,oBAAmB;AAI3B,MAAO,gCAIG,kBAA2B;AAAA,EACjC,YACI,MACmB,MACrB;AACE,UAAM,MAAM,IAAI;AAFG;AAAA,EAGvB;AAAA,EAHuB;AAAA,EAKb,UAA6B;AACnC,WAAO,IAAI,eAAe,KAAK,MAAM,IAAI,aAAa,KAAK,IAAI,CAAC;AAAA,EACpE;AAAA,EAEU,UAAU;AAChB,WAAO,eAAe,YAAY;AAAA,EACtC;AAAA,EAEO,MAAS;AACZ,QAAI,CAAC,UAAU,GAAG;AACd,YAAM,IAAI,MAAM,YAAY,KAAK,IAAI,6CAA6C;AAAA,IACtF;AAEA,WAAO,MAAM,IAAI;AAAA,EACrB;AACJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/sandbox/providers/index.ts"],"sourcesContent":["export {default as ProxySandbox} from \"./ProxySandbox\";\nexport {default as RegisterSandbox} from \"./RegisterSandbox\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAAiC;","names":["default"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SandboxGlobalAccess, SandboxNamespace } from "./../types/sandbox.js";
|
|
2
|
+
const isSandbox = () => globalThis[SandboxGlobalAccess] === true;
|
|
3
|
+
const sandboxChannel = (name) => `${SandboxNamespace}:${name}`;
|
|
4
|
+
const sandboxSender = () => ({ url: document.location.href, origin: document.location.origin });
|
|
5
|
+
export {
|
|
6
|
+
isSandbox,
|
|
7
|
+
sandboxChannel,
|
|
8
|
+
sandboxSender
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/sandbox/utils.ts"],"sourcesContent":["import {SandboxGlobalAccess, SandboxNamespace} from \"@typing/sandbox\";\nimport type {MessageSender} from \"@typing/message\";\n\nexport const isSandbox = (): boolean => globalThis[SandboxGlobalAccess] === true;\n\nexport const sandboxChannel = (name: string): string => `${SandboxNamespace}:${name}`;\n\nexport const sandboxSender = (): MessageSender =>\n ({url: document.location.href, origin: document.location.origin}) as MessageSender;\n"],"mappings":"AAAA,SAAQ,qBAAqB,wBAAuB;AAG7C,MAAM,YAAY,MAAe,WAAW,mBAAmB,MAAM;AAErE,MAAM,iBAAiB,CAAC,SAAyB,GAAG,gBAAgB,IAAI,IAAI;AAE5E,MAAM,gBAAgB,OACxB,EAAC,KAAK,SAAS,SAAS,MAAM,QAAQ,SAAS,SAAS,OAAM;","names":[]}
|
package/dist/service/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { ProxyService, RegisterService } from "./providers/index.js";
|
|
2
|
-
import type {
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
2
|
+
import type { TransportProxyTarget, TransportTarget } from "../transport/index.js";
|
|
3
|
+
export { ProxyService, RegisterService };
|
|
4
|
+
export interface ServiceRegistry {
|
|
5
|
+
}
|
|
6
|
+
export type ServiceName = Extract<keyof ServiceRegistry, string>;
|
|
7
|
+
export type ServiceTarget<N extends keyof ServiceRegistry> = TransportTarget<ServiceRegistry, N>;
|
|
8
|
+
export type ServiceProxyTarget<N extends keyof ServiceRegistry> = TransportProxyTarget<ServiceRegistry, N>;
|
|
9
|
+
export declare const getService: <N extends ServiceName>(name: N) => ServiceTarget<N>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service/index.ts"],"sourcesContent":["import {ProxyService, RegisterService, Service} from \"./providers\";\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../src/service/index.ts"],"sourcesContent":["import {ProxyService, RegisterService, Service} from \"./providers\";\n\nimport type {TransportProxyTarget, TransportTarget} from \"@transport/index\";\n\nexport {ProxyService, RegisterService};\n\nexport interface ServiceRegistry {}\n\nexport type ServiceName = Extract<keyof ServiceRegistry, string>;\n\nexport type ServiceTarget<N extends keyof ServiceRegistry> = TransportTarget<ServiceRegistry, N>;\n\nexport type ServiceProxyTarget<N extends keyof ServiceRegistry> = TransportProxyTarget<ServiceRegistry, N>;\n\nexport const getService = <N extends ServiceName>(name: N): ServiceTarget<N> => {\n return new Service<N>(name).get();\n};\n"],"mappings":"AAAA,SAAQ,cAAc,iBAAiB,eAAc;AAc9C,MAAM,aAAa,CAAwB,SAA8B;AAC5E,SAAO,IAAI,QAAW,IAAI,EAAE,IAAI;AACpC;","names":[]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import BaseTransport from "./BaseTransport.js";
|
|
2
|
-
import { TransportDictionary,
|
|
2
|
+
import { TransportDictionary, TransportName, TransportReceiver, TransportRegister } from "../types/transport.js";
|
|
3
3
|
export default abstract class<N extends TransportName, T extends object = TransportDictionary[N], A extends any[] = []> extends BaseTransport<N, T> implements TransportRegister<T, A> {
|
|
4
4
|
protected readonly init: (...args: A) => T;
|
|
5
|
+
private unwatch?;
|
|
5
6
|
protected constructor(name: N, init: (...args: A) => T);
|
|
6
|
-
protected abstract message():
|
|
7
|
+
protected abstract message(): TransportReceiver;
|
|
7
8
|
register(...args: A): T;
|
|
9
|
+
destroy(): void;
|
|
8
10
|
private withSender;
|
|
9
11
|
}
|
|
@@ -7,13 +7,14 @@ class RegisterTransport_default extends BaseTransport {
|
|
|
7
7
|
this.init = init;
|
|
8
8
|
}
|
|
9
9
|
init;
|
|
10
|
+
unwatch;
|
|
10
11
|
register(...args) {
|
|
11
12
|
if (this.manager().has(this.name)) {
|
|
12
13
|
throw new Error(`A instance with name "${this.name}" already exists. The name must be unique.`);
|
|
13
14
|
}
|
|
14
15
|
const instance = this.init(...args);
|
|
15
16
|
this.manager().add(this.name, instance);
|
|
16
|
-
this.message().watch(async ({ path, args: args2 }, sender) => {
|
|
17
|
+
this.unwatch = this.message().watch(async ({ path, args: args2 }, sender) => {
|
|
17
18
|
try {
|
|
18
19
|
const context = this.withSender(instance, sender);
|
|
19
20
|
const property = path == null ? context : get(context, path);
|
|
@@ -34,6 +35,12 @@ class RegisterTransport_default extends BaseTransport {
|
|
|
34
35
|
});
|
|
35
36
|
return instance;
|
|
36
37
|
}
|
|
38
|
+
destroy() {
|
|
39
|
+
var _a;
|
|
40
|
+
(_a = this.unwatch) == null ? void 0 : _a.call(this);
|
|
41
|
+
this.unwatch = void 0;
|
|
42
|
+
super.destroy();
|
|
43
|
+
}
|
|
37
44
|
withSender(instance, sender) {
|
|
38
45
|
return new Proxy(instance, {
|
|
39
46
|
get(target, property, receiver) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transport/RegisterTransport.ts"],"sourcesContent":["import get from \"get-value\";\n\nimport BaseTransport from \"./BaseTransport\";\n\nimport {TransportDictionary,
|
|
1
|
+
{"version":3,"sources":["../../src/transport/RegisterTransport.ts"],"sourcesContent":["import get from \"get-value\";\n\nimport BaseTransport from \"./BaseTransport\";\n\nimport {TransportDictionary, TransportName, TransportReceiver, TransportRegister} from \"@typing/transport\";\nimport {MessageSender, MessageSenderProperty} from \"@typing/message\";\n\n// prettier-ignore\nexport default abstract class<\n N extends TransportName,\n T extends object = TransportDictionary[N],\n A extends any[] = []\n> extends BaseTransport<N, T> implements TransportRegister<T, A> {\n private unwatch?: () => void;\n\n protected constructor(\n name: N,\n protected readonly init: (...args: A) => T\n ) {\n super(name);\n }\n\n protected abstract message(): TransportReceiver;\n\n public register(...args: A): T {\n if (this.manager().has(this.name)) {\n throw new Error(`A instance with name \"${this.name}\" already exists. The name must be unique.`);\n }\n\n const instance = this.init(...args);\n\n this.manager().add(this.name, instance);\n\n this.unwatch = this.message().watch(async ({path, args}, sender) => {\n try {\n const context = this.withSender(instance, sender);\n\n const property = path == null ? context : get(context, path);\n\n if (property === undefined) {\n throw new Error(`Property not found at path \"${path}\" in \"${this.name}\"`);\n }\n\n let result: any;\n\n if (typeof property === \"function\") {\n result = await property.apply(context, args);\n } else {\n result = property;\n }\n\n return result;\n } catch (error) {\n console.error(`Error during message handler registration for transport \"${this.name}\"`, error);\n\n throw error;\n }\n });\n\n return instance;\n }\n\n public destroy(): void {\n this.unwatch?.();\n this.unwatch = undefined;\n\n super.destroy();\n }\n\n private withSender(instance: T, sender: MessageSender): T {\n return new Proxy(instance, {\n get(target, property, receiver) {\n if (property === MessageSenderProperty) {\n return sender;\n }\n\n return Reflect.get(target, property, receiver);\n },\n });\n }\n}\n"],"mappings":"AAAA,OAAO,SAAS;AAEhB,OAAO,mBAAmB;AAG1B,SAAuB,6BAA4B;AAGnD,MAAO,kCAIG,cAAuD;AAAA,EAGnD,YACN,MACmB,MACrB;AACE,UAAM,IAAI;AAFS;AAAA,EAGvB;AAAA,EAHuB;AAAA,EAJf;AAAA,EAWD,YAAY,MAAY;AAC3B,QAAI,KAAK,QAAQ,EAAE,IAAI,KAAK,IAAI,GAAG;AAC/B,YAAM,IAAI,MAAM,yBAAyB,KAAK,IAAI,4CAA4C;AAAA,IAClG;AAEA,UAAM,WAAW,KAAK,KAAK,GAAG,IAAI;AAElC,SAAK,QAAQ,EAAE,IAAI,KAAK,MAAM,QAAQ;AAEtC,SAAK,UAAU,KAAK,QAAQ,EAAE,MAAM,OAAO,EAAC,MAAM,MAAAA,MAAI,GAAG,WAAW;AAChE,UAAI;AACA,cAAM,UAAU,KAAK,WAAW,UAAU,MAAM;AAEhD,cAAM,WAAW,QAAQ,OAAO,UAAU,IAAI,SAAS,IAAI;AAE3D,YAAI,aAAa,QAAW;AACxB,gBAAM,IAAI,MAAM,+BAA+B,IAAI,SAAS,KAAK,IAAI,GAAG;AAAA,QAC5E;AAEA,YAAI;AAEJ,YAAI,OAAO,aAAa,YAAY;AAChC,mBAAS,MAAM,SAAS,MAAM,SAASA,KAAI;AAAA,QAC/C,OAAO;AACH,mBAAS;AAAA,QACb;AAEA,eAAO;AAAA,MACX,SAAS,OAAO;AACZ,gBAAQ,MAAM,4DAA4D,KAAK,IAAI,KAAK,KAAK;AAE7F,cAAM;AAAA,MACV;AAAA,IACJ,CAAC;AAED,WAAO;AAAA,EACX;AAAA,EAEO,UAAgB;AA9D3B;AA+DQ,eAAK,YAAL;AACA,SAAK,UAAU;AAEf,UAAM,QAAQ;AAAA,EAClB;AAAA,EAEQ,WAAW,UAAa,QAA0B;AACtD,WAAO,IAAI,MAAM,UAAU;AAAA,MACvB,IAAI,QAAQ,UAAU,UAAU;AAC5B,YAAI,aAAa,uBAAuB;AACpC,iBAAO;AAAA,QACX;AAEA,eAAO,QAAQ,IAAI,QAAQ,UAAU,QAAQ;AAAA,MACjD;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":["args"]}
|
|
@@ -4,5 +4,5 @@ export default abstract class TransportMessage implements TransportMessageContra
|
|
|
4
4
|
protected message: MessageProvider<MessageDictionary, MessageSendOptions>;
|
|
5
5
|
protected abstract readonly key: string;
|
|
6
6
|
send(data: TransportMessageData, options?: MessageSendOptions): Promise<any>;
|
|
7
|
-
watch(handler: (data: TransportMessageData, sender: MessageSender) => any): void;
|
|
7
|
+
watch(handler: (data: TransportMessageData, sender: MessageSender) => any): () => void;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transport/TransportMessage.ts"],"sourcesContent":["import {Message} from \"@message/providers\";\n\nimport {MessageDictionary, MessageProvider, MessageSender, MessageSendOptions} from \"@typing/message\";\nimport type {TransportMessage as TransportMessageContract, TransportMessageData} from \"@typing/transport\";\n\nexport default abstract class TransportMessage implements TransportMessageContract {\n protected message: MessageProvider<MessageDictionary, MessageSendOptions> = new Message();\n\n protected abstract readonly key: string;\n\n public async send(data: TransportMessageData, options?: MessageSendOptions) {\n return this.message.send(this.key, data, options);\n }\n\n public watch(handler: (data: TransportMessageData, sender: MessageSender) => any): void {\n this.message.watch(this.key, handler);\n }\n}\n"],"mappings":"AAAA,SAAQ,eAAc;AAKtB,MAAO,iBAA4E;AAAA,EACrE,UAAkE,IAAI,QAAQ;AAAA,EAIxF,MAAa,KAAK,MAA4B,SAA8B;AACxE,WAAO,KAAK,QAAQ,KAAK,KAAK,KAAK,MAAM,OAAO;AAAA,EACpD;AAAA,EAEO,MAAM,
|
|
1
|
+
{"version":3,"sources":["../../src/transport/TransportMessage.ts"],"sourcesContent":["import {Message} from \"@message/providers\";\n\nimport {MessageDictionary, MessageProvider, MessageSender, MessageSendOptions} from \"@typing/message\";\nimport type {TransportMessage as TransportMessageContract, TransportMessageData} from \"@typing/transport\";\n\nexport default abstract class TransportMessage implements TransportMessageContract {\n protected message: MessageProvider<MessageDictionary, MessageSendOptions> = new Message();\n\n protected abstract readonly key: string;\n\n public async send(data: TransportMessageData, options?: MessageSendOptions) {\n return this.message.send(this.key, data, options);\n }\n\n public watch(handler: (data: TransportMessageData, sender: MessageSender) => any): () => void {\n return this.message.watch(this.key, handler);\n }\n}\n"],"mappings":"AAAA,SAAQ,eAAc;AAKtB,MAAO,iBAA4E;AAAA,EACrE,UAAkE,IAAI,QAAQ;AAAA,EAIxF,MAAa,KAAK,MAA4B,SAA8B;AACxE,WAAO,KAAK,QAAQ,KAAK,KAAK,KAAK,MAAM,OAAO;AAAA,EACpD;AAAA,EAEO,MAAM,SAAiF;AAC1F,WAAO,KAAK,QAAQ,MAAM,KAAK,KAAK,OAAO;AAAA,EAC/C;AACJ;","names":[]}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DeepAsyncProxy } from "../types/helpers.js";
|
|
2
|
+
export type TransportTarget<T extends object, K extends keyof T> = T[K];
|
|
3
|
+
export type TransportProxyTarget<T extends object, K extends keyof T> = DeepAsyncProxy<T[K]>;
|
|
4
|
+
export type { TransportDefinition, TransportResolvedDefinition, TransportUnresolvedDefinition, TransportType, TransportOptions, } from "../types/transport.js";
|
package/dist/types/config.d.ts
CHANGED
|
@@ -484,6 +484,13 @@ export interface Config {
|
|
|
484
484
|
* @default false
|
|
485
485
|
*/
|
|
486
486
|
mergeOffscreen: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* Flag indicating whether to merge sandbox files from App and Shared directories.
|
|
489
|
+
* When `true`, sandbox files from both directories will be combined.
|
|
490
|
+
*
|
|
491
|
+
* @default false
|
|
492
|
+
*/
|
|
493
|
+
mergeSandbox: boolean;
|
|
487
494
|
/**
|
|
488
495
|
* Path to the directory containing public assets to be copied into the build output.
|
|
489
496
|
* Must be relative to the project root and cannot be "." (the project root itself).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare enum CspSource {
|
|
2
|
+
Self = "'self'",
|
|
3
|
+
None = "'none'",
|
|
4
|
+
Data = "data:",
|
|
5
|
+
Blob = "blob:",
|
|
6
|
+
UnsafeInline = "'unsafe-inline'"
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Source expression for a CSP directive.
|
|
10
|
+
*
|
|
11
|
+
* Use `CspSource` or its string values for framework-known keywords and schemes
|
|
12
|
+
* such as `'self'`, `'none'`, `data:`, or `blob:`. The open string branch is for
|
|
13
|
+
* concrete CSP source expressions that cannot be enumerated ahead of time, such
|
|
14
|
+
* as `https://api.example.com`, `wss://socket.example.com`, `https:`, `nonce-...`,
|
|
15
|
+
* or `sha256-...`. It does not mean an empty string is useful or valid.
|
|
16
|
+
*/
|
|
17
|
+
export type CspSourceValue = CspSource | `${CspSource}` | (string & Record<never, never>);
|
|
18
|
+
export interface CspSources {
|
|
19
|
+
connect?: CspSourceValue[];
|
|
20
|
+
image?: CspSourceValue[];
|
|
21
|
+
style?: CspSourceValue[];
|
|
22
|
+
font?: CspSourceValue[];
|
|
23
|
+
media?: CspSourceValue[];
|
|
24
|
+
worker?: CspSourceValue[];
|
|
25
|
+
child?: CspSourceValue[];
|
|
26
|
+
frame?: CspSourceValue[];
|
|
27
|
+
}
|
|
28
|
+
export interface CspConfig {
|
|
29
|
+
wasm?: boolean;
|
|
30
|
+
sources?: CspSources;
|
|
31
|
+
}
|
|
32
|
+
export interface CspOptions {
|
|
33
|
+
csp?: CspConfig;
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var CspSource = /* @__PURE__ */ ((CspSource2) => {
|
|
2
|
+
CspSource2["Self"] = "'self'";
|
|
3
|
+
CspSource2["None"] = "'none'";
|
|
4
|
+
CspSource2["Data"] = "data:";
|
|
5
|
+
CspSource2["Blob"] = "blob:";
|
|
6
|
+
CspSource2["UnsafeInline"] = "'unsafe-inline'";
|
|
7
|
+
return CspSource2;
|
|
8
|
+
})(CspSource || {});
|
|
9
|
+
export {
|
|
10
|
+
CspSource
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=csp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/csp.ts"],"sourcesContent":["export enum CspSource {\n Self = \"'self'\",\n None = \"'none'\",\n Data = \"data:\",\n Blob = \"blob:\",\n UnsafeInline = \"'unsafe-inline'\",\n}\n\n/**\n * Source expression for a CSP directive.\n *\n * Use `CspSource` or its string values for framework-known keywords and schemes\n * such as `'self'`, `'none'`, `data:`, or `blob:`. The open string branch is for\n * concrete CSP source expressions that cannot be enumerated ahead of time, such\n * as `https://api.example.com`, `wss://socket.example.com`, `https:`, `nonce-...`,\n * or `sha256-...`. It does not mean an empty string is useful or valid.\n */\nexport type CspSourceValue = CspSource | `${CspSource}` | (string & Record<never, never>);\n\nexport interface CspSources {\n connect?: CspSourceValue[];\n image?: CspSourceValue[];\n style?: CspSourceValue[];\n font?: CspSourceValue[];\n media?: CspSourceValue[];\n worker?: CspSourceValue[];\n child?: CspSourceValue[];\n frame?: CspSourceValue[];\n}\n\nexport interface CspConfig {\n wasm?: boolean;\n sources?: CspSources;\n}\n\nexport interface CspOptions {\n csp?: CspConfig;\n}\n"],"mappings":"AAAO,IAAK,YAAL,kBAAKA,eAAL;AACH,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,kBAAe;AALP,SAAAA;AAAA,GAAA;","names":["CspSource"]}
|
package/dist/types/entrypoint.js
CHANGED
|
@@ -10,6 +10,7 @@ var EntrypointType = /* @__PURE__ */ ((EntrypointType2) => {
|
|
|
10
10
|
EntrypointType2["Popup"] = "popup";
|
|
11
11
|
EntrypointType2["Sidebar"] = "sidebar";
|
|
12
12
|
EntrypointType2["Offscreen"] = "offscreen";
|
|
13
|
+
EntrypointType2["Sandbox"] = "sandbox";
|
|
13
14
|
return EntrypointType2;
|
|
14
15
|
})(EntrypointType || {});
|
|
15
16
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/entrypoint.ts"],"sourcesContent":["import {Mode} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {ManifestVersion} from \"@typing/manifest\";\n\nexport const EntrypointFileExtensions: ReadonlySet<string> = new Set([\"ts\", \"tsx\", \"js\", \"jsx\", \"vue\", \"svelte\"]);\n\nexport enum EntrypointType {\n Background = \"background\",\n Command = \"command\",\n ContentScript = \"content\",\n Page = \"page\",\n Service = \"service\",\n Relay = \"relay\",\n Options = \"options\",\n Popup = \"popup\",\n Sidebar = \"sidebar\",\n Offscreen = \"offscreen\",\n}\n\nexport interface EntrypointOptions {\n /**\n * List of target browsers to include this entrypoint in. Defaults to being included in all\n * builds.\n *\n * @default undefined\n */\n includeBrowser?: `${Browser}`[] | Browser[];\n\n /**\n * List of target browsers to exclude this entrypoint from.\n *\n * @default undefined\n */\n excludeBrowser?: `${Browser}`[] | Browser[];\n\n /**\n * List of target apps to include this entrypoint in. Defaults to being included in all builds.\n *\n * @default undefined\n */\n excludeApp?: string[];\n\n /**\n * List of target apps to exclude this entrypoint from.\n *\n * @default undefined\n */\n includeApp?: string[];\n\n /**\n * Build mode for filtering entry points. Entry point will be included only\n * if it matches the current build mode (Production or Development).\n *\n * @default undefined\n */\n mode?: `${Exclude<Mode, Mode.None>}` | Exclude<Mode, Mode.None>;\n\n /**\n * Manifest version constraint for this entry point. Entry point will be included\n * only if it matches the target manifest version.\n *\n * @default undefined\n */\n manifestVersion?: ManifestVersion;\n\n /**\n * Debug mode flag. If true, entry point will be included only when building\n * with DEBUG flag enabled.\n *\n * @default undefined\n */\n debug?: boolean;\n}\n\nexport interface EntrypointFile {\n file: string;\n import: string;\n external?: string;\n}\n\n/**\n * Dictionary of entrypoint for the build configuration.\n *\n * @key {string} - The name of the entrypoint that will be used in the bundler configuration.\n * @value {EntrypointFile[]} - Array of files that will be included in this entrypoint.\n * These files will be compiled and bundled together as part of the specified entrypoint.\n */\nexport type EntrypointEntries = Map<string, Set<EntrypointFile>>;\n\nexport interface EntrypointParser<O extends EntrypointOptions> {\n options(file: EntrypointFile): O;\n\n contract(file: EntrypointFile): string | undefined;\n}\n\nexport interface EntrypointFinder {\n files(): Promise<Set<EntrypointFile>>;\n\n empty(): Promise<boolean>;\n\n exists(): Promise<boolean>;\n\n clear(): this;\n\n holds(file: EntrypointFile): boolean;\n}\n\nexport interface EntrypointOptionsFinder<O extends EntrypointOptions> extends EntrypointFinder {\n type(): EntrypointType;\n\n options(): Promise<Map<EntrypointFile, O>>;\n\n contracts(): Promise<Map<EntrypointFile, string | undefined>>;\n}\n\nexport interface EntrypointNameGenerator {\n reserve(name: string): this;\n\n name(name: string): string;\n\n file(file: EntrypointFile): string;\n\n likely(name?: string): boolean;\n\n has(name: string): boolean;\n\n reset(): this;\n}\n\nexport interface EntrypointBuilder {\n build(): Promise<void>;\n\n destroy(): Promise<void>;\n}\n\nexport type EntrypointConstructorParameter<T> = T extends new (arg: infer P) => any ? P : never;\n"],"mappings":"AAIO,MAAM,2BAAgD,oBAAI,IAAI,CAAC,MAAM,OAAO,MAAM,OAAO,OAAO,QAAQ,CAAC;AAEzG,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,mBAAgB;AAChB,EAAAA,gBAAA,UAAO;AACP,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,eAAY;
|
|
1
|
+
{"version":3,"sources":["../../src/types/entrypoint.ts"],"sourcesContent":["import {Mode} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {ManifestVersion} from \"@typing/manifest\";\n\nexport const EntrypointFileExtensions: ReadonlySet<string> = new Set([\"ts\", \"tsx\", \"js\", \"jsx\", \"vue\", \"svelte\"]);\n\nexport enum EntrypointType {\n Background = \"background\",\n Command = \"command\",\n ContentScript = \"content\",\n Page = \"page\",\n Service = \"service\",\n Relay = \"relay\",\n Options = \"options\",\n Popup = \"popup\",\n Sidebar = \"sidebar\",\n Offscreen = \"offscreen\",\n Sandbox = \"sandbox\",\n}\n\nexport interface EntrypointOptions {\n /**\n * List of target browsers to include this entrypoint in. Defaults to being included in all\n * builds.\n *\n * @default undefined\n */\n includeBrowser?: `${Browser}`[] | Browser[];\n\n /**\n * List of target browsers to exclude this entrypoint from.\n *\n * @default undefined\n */\n excludeBrowser?: `${Browser}`[] | Browser[];\n\n /**\n * List of target apps to include this entrypoint in. Defaults to being included in all builds.\n *\n * @default undefined\n */\n excludeApp?: string[];\n\n /**\n * List of target apps to exclude this entrypoint from.\n *\n * @default undefined\n */\n includeApp?: string[];\n\n /**\n * Build mode for filtering entry points. Entry point will be included only\n * if it matches the current build mode (Production or Development).\n *\n * @default undefined\n */\n mode?: `${Exclude<Mode, Mode.None>}` | Exclude<Mode, Mode.None>;\n\n /**\n * Manifest version constraint for this entry point. Entry point will be included\n * only if it matches the target manifest version.\n *\n * @default undefined\n */\n manifestVersion?: ManifestVersion;\n\n /**\n * Debug mode flag. If true, entry point will be included only when building\n * with DEBUG flag enabled.\n *\n * @default undefined\n */\n debug?: boolean;\n}\n\nexport interface EntrypointFile {\n file: string;\n import: string;\n external?: string;\n}\n\n/**\n * Dictionary of entrypoint for the build configuration.\n *\n * @key {string} - The name of the entrypoint that will be used in the bundler configuration.\n * @value {EntrypointFile[]} - Array of files that will be included in this entrypoint.\n * These files will be compiled and bundled together as part of the specified entrypoint.\n */\nexport type EntrypointEntries = Map<string, Set<EntrypointFile>>;\n\nexport interface EntrypointParser<O extends EntrypointOptions> {\n options(file: EntrypointFile): O;\n\n contract(file: EntrypointFile): string | undefined;\n}\n\nexport interface EntrypointFinder {\n files(): Promise<Set<EntrypointFile>>;\n\n empty(): Promise<boolean>;\n\n exists(): Promise<boolean>;\n\n clear(): this;\n\n holds(file: EntrypointFile): boolean;\n}\n\nexport interface EntrypointOptionsFinder<O extends EntrypointOptions> extends EntrypointFinder {\n type(): EntrypointType;\n\n options(): Promise<Map<EntrypointFile, O>>;\n\n contracts(): Promise<Map<EntrypointFile, string | undefined>>;\n}\n\nexport interface EntrypointNameGenerator {\n reserve(name: string): this;\n\n name(name: string): string;\n\n file(file: EntrypointFile): string;\n\n likely(name?: string): boolean;\n\n has(name: string): boolean;\n\n reset(): this;\n}\n\nexport interface EntrypointBuilder {\n build(): Promise<void>;\n\n destroy(): Promise<void>;\n}\n\nexport type EntrypointConstructorParameter<T> = T extends new (arg: infer P) => any ? P : never;\n"],"mappings":"AAIO,MAAM,2BAAgD,oBAAI,IAAI,CAAC,MAAM,OAAO,MAAM,OAAO,OAAO,QAAQ,CAAC;AAEzG,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,mBAAgB;AAChB,EAAAA,gBAAA,UAAO;AACP,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,aAAU;AAXF,SAAAA;AAAA,GAAA;","names":["EntrypointType"]}
|