@vielzeug/sandbox 2.0.0 → 2.1.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.
Files changed (46) hide show
  1. package/dist/_document.cjs +3 -3
  2. package/dist/_document.cjs.map +1 -1
  3. package/dist/_document.d.ts +2 -2
  4. package/dist/_document.d.ts.map +1 -1
  5. package/dist/_document.js +9 -12
  6. package/dist/_document.js.map +1 -1
  7. package/dist/_policy.cjs +1 -1
  8. package/dist/_policy.cjs.map +1 -1
  9. package/dist/_policy.d.ts +1 -0
  10. package/dist/_policy.d.ts.map +1 -1
  11. package/dist/_policy.js +4 -1
  12. package/dist/_policy.js.map +1 -1
  13. package/dist/_runtime.cjs +1 -1
  14. package/dist/_runtime.cjs.map +1 -1
  15. package/dist/_runtime.d.ts.map +1 -1
  16. package/dist/_runtime.js +1 -1
  17. package/dist/_runtime.js.map +1 -1
  18. package/dist/errors.cjs +1 -1
  19. package/dist/errors.cjs.map +1 -1
  20. package/dist/errors.d.ts +0 -1
  21. package/dist/errors.d.ts.map +1 -1
  22. package/dist/errors.js +1 -4
  23. package/dist/errors.js.map +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.d.ts +3 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +4 -4
  28. package/dist/sandbox.cjs +14 -14
  29. package/dist/sandbox.cjs.map +1 -1
  30. package/dist/sandbox.iife.js +13 -13
  31. package/dist/sandbox.iife.js.map +1 -1
  32. package/dist/sandbox.js +14 -14
  33. package/dist/sandbox.js.map +1 -1
  34. package/dist/testing.cjs.map +1 -1
  35. package/dist/testing.d.ts +4 -4
  36. package/dist/testing.d.ts.map +1 -1
  37. package/dist/testing.js.map +1 -1
  38. package/dist/types.d.ts +25 -25
  39. package/dist/types.d.ts.map +1 -1
  40. package/package.json +28 -23
  41. package/dist/_sandbox.cjs +0 -2
  42. package/dist/_sandbox.cjs.map +0 -1
  43. package/dist/_sandbox.d.ts +0 -5
  44. package/dist/_sandbox.d.ts.map +0 -1
  45. package/dist/_sandbox.js +0 -11
  46. package/dist/_sandbox.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"testing.js","names":[],"sources":["../src/testing.ts"],"sourcesContent":["/**\n * Test utilities for code that integrates with @vielzeug/sandbox.\n *\n * Import from '@vielzeug/sandbox/testing' — not the main entry point.\n * These helpers encapsulate the postMessage protocol so tests don't\n * need to know internal message shapes.\n */\n\n/** Helpers for simulating sandbox→host messages in tests. */\nexport interface SandboxTestHelpers {\n /** Fire a 'ready' signal as if the bridge script executed. */\n fireReady(): void;\n /** Fire a 'custom' event as if sandbox code called window.__sandbox__.emit(). */\n fireCustom(event: string, detail?: unknown): void;\n /** Fire a 'resize' message as if the bridge ResizeObserver fired. */\n fireResize(height: number): void;\n /** Fire an 'error' message as if the sandbox caught an uncaught error. */\n fireError(message: string, stack?: string): void;\n}\n\n/**\n * Create test helpers bound to a specific sandbox container's iframe.\n *\n * @example\n * ```ts\n * const container = document.createElement('div');\n * document.body.appendChild(container);\n * const sandbox = createSandbox(container);\n * const helpers = createSandboxTestHelpers(container);\n *\n * sandbox.render('<p>test</p>');\n * helpers.fireReady();\n * await sandbox.ready;\n * ```\n */\nexport function createSandboxTestHelpers(container: HTMLElement): SandboxTestHelpers {\n function getIframe(): HTMLIFrameElement | null {\n return container.querySelector('iframe');\n }\n\n function fire(data: Record<string, unknown>): void {\n const iframe = getIframe();\n const channel = iframe?.dataset.sandboxChannel;\n const generation = Number(iframe?.dataset.sandboxGeneration);\n\n if (!iframe || !channel || !Number.isInteger(generation)) {\n throw new Error('createSandboxTestHelpers requires a rendered sandbox.');\n }\n\n window.dispatchEvent(\n new MessageEvent('message', { data: { ...data, channel, generation }, source: iframe.contentWindow }),\n );\n }\n\n return {\n fireCustom: (event, detail = undefined) => fire({ detail, event, type: 'custom' }),\n fireError: (message, stack) => fire({ message, type: 'error', ...(stack !== undefined ? { stack } : {}) }),\n fireReady: () => fire({ type: 'ready' }),\n fireResize: (height) => fire({ height, type: 'resize' }),\n };\n}\n"],"mappings":";AAmCA,SAAgB,EAAyB,GAA4C;CACnF,SAAS,IAAsC;EAC7C,OAAO,EAAU,cAAc,QAAQ;CACzC;CAEA,SAAS,EAAK,GAAqC;EACjD,IAAM,IAAS,EAAU,GACnB,IAAU,GAAQ,QAAQ,gBAC1B,IAAa,OAAO,GAAQ,QAAQ,iBAAiB;EAE3D,IAAI,CAAC,KAAU,CAAC,KAAW,CAAC,OAAO,UAAU,CAAU,GACrD,MAAU,MAAM,uDAAuD;EAGzE,OAAO,cACL,IAAI,aAAa,WAAW;GAAE,MAAM;IAAE,GAAG;IAAM;IAAS;GAAW;GAAG,QAAQ,EAAO;EAAc,CAAC,CACtG;CACF;CAEA,OAAO;EACL,aAAa,GAAO,IAAS,KAAA,MAAc,EAAK;GAAE;GAAQ;GAAO,MAAM;EAAS,CAAC;EACjF,YAAY,GAAS,MAAU,EAAK;GAAE;GAAS,MAAM;GAAS,GAAI,MAAU,KAAA,IAAwB,CAAC,IAAb,EAAE,SAAM;EAAQ,CAAC;EACzG,iBAAiB,EAAK,EAAE,MAAM,QAAQ,CAAC;EACvC,aAAa,MAAW,EAAK;GAAE;GAAQ,MAAM;EAAS,CAAC;CACzD;AACF"}
1
+ {"version":3,"file":"testing.js","names":[],"sources":["../src/testing.ts"],"sourcesContent":["/**\n * Test utilities for code that integrates with @vielzeug/sandbox.\n *\n * Import from '@vielzeug/sandbox/testing' — not the main entry point.\n * These helpers encapsulate the postMessage protocol so tests don't\n * need to know internal message shapes.\n */\n\n/** Helpers for simulating sandbox→host messages in tests. */\nexport interface SandboxTestHelpers {\n /** Fire a 'custom' event as if sandbox code called window.__sandbox__.emit(). */\n fireCustom(event: string, detail?: unknown): void;\n /** Fire an 'error' message as if the sandbox caught an uncaught error. */\n fireError(message: string, stack?: string): void;\n /** Fire a 'ready' signal as if the bridge script executed. */\n fireReady(): void;\n /** Fire a 'resize' message as if the bridge ResizeObserver fired. */\n fireResize(height: number): void;\n}\n\n/**\n * Create test helpers bound to a specific sandbox container's iframe.\n *\n * @example\n * ```ts\n * const container = document.createElement('div');\n * document.body.appendChild(container);\n * const sandbox = createSandbox(container);\n * const helpers = createSandboxTestHelpers(container);\n *\n * sandbox.render('<p>test</p>');\n * helpers.fireReady();\n * await sandbox.ready;\n * ```\n */\nexport function createSandboxTestHelpers(container: HTMLElement): SandboxTestHelpers {\n function getIframe(): HTMLIFrameElement | null {\n return container.querySelector('iframe');\n }\n\n function fire(data: Record<string, unknown>): void {\n const iframe = getIframe();\n const channel = iframe?.dataset.sandboxChannel;\n const generation = Number(iframe?.dataset.sandboxGeneration);\n\n if (!iframe || !channel || !Number.isInteger(generation)) {\n throw new Error('createSandboxTestHelpers requires a rendered sandbox.');\n }\n\n window.dispatchEvent(\n new MessageEvent('message', { data: { ...data, channel, generation }, source: iframe.contentWindow }),\n );\n }\n\n return {\n fireCustom: (event, detail = undefined) => fire({ detail, event, type: 'custom' }),\n fireError: (message, stack) => fire({ message, type: 'error', ...(stack !== undefined ? { stack } : {}) }),\n fireReady: () => fire({ type: 'ready' }),\n fireResize: (height) => fire({ height, type: 'resize' }),\n };\n}\n"],"mappings":";AAmCA,SAAgB,EAAyB,GAA4C;CACnF,SAAS,IAAsC;EAC7C,OAAO,EAAU,cAAc,QAAQ;CACzC;CAEA,SAAS,EAAK,GAAqC;EACjD,IAAM,IAAS,EAAU,GACnB,IAAU,GAAQ,QAAQ,gBAC1B,IAAa,OAAO,GAAQ,QAAQ,iBAAiB;EAE3D,IAAI,CAAC,KAAU,CAAC,KAAW,CAAC,OAAO,UAAU,CAAU,GACrD,MAAU,MAAM,uDAAuD;EAGzE,OAAO,cACL,IAAI,aAAa,WAAW;GAAE,MAAM;IAAE,GAAG;IAAM;IAAS;GAAW;GAAG,QAAQ,EAAO;EAAc,CAAC,CACtG;CACF;CAEA,OAAO;EACL,aAAa,GAAO,IAAS,KAAA,MAAc,EAAK;GAAE;GAAQ;GAAO,MAAM;EAAS,CAAC;EACjF,YAAY,GAAS,MAAU,EAAK;GAAE;GAAS,MAAM;GAAS,GAAI,MAAU,KAAA,IAAwB,CAAC,IAAb,EAAE,SAAM;EAAQ,CAAC;EACzG,iBAAiB,EAAK,EAAE,MAAM,QAAQ,CAAC;EACvC,aAAa,MAAW,EAAK;GAAE;GAAQ,MAAM;EAAS,CAAC;CACzD;AACF"}
package/dist/types.d.ts CHANGED
@@ -102,13 +102,13 @@ export interface SandboxStateUpdateDetail {
102
102
  * Never evaluate or execute message content on the host.
103
103
  */
104
104
  export type SandboxMessage = {
105
- type: 'error';
105
+ detail: unknown;
106
+ event: string;
107
+ type: 'custom';
108
+ } | {
106
109
  message: string;
107
110
  stack?: string;
108
- } | {
109
- type: 'custom';
110
- event: string;
111
- detail: unknown;
111
+ type: 'error';
112
112
  } | {
113
113
  height: number;
114
114
  type: 'resize';
@@ -117,18 +117,10 @@ export type SandboxMessage = {
117
117
  export interface SandboxHandle {
118
118
  /** `AbortSignal` aborted when `dispose()` is called. Use to tie async operations to this sandbox's lifetime. */
119
119
  readonly disposalSignal: AbortSignal;
120
- /** True once dispose() has been called. */
121
- readonly disposed: boolean;
122
- /**
123
- * Resolves when the first sandbox document signals it is ready.
124
- * Also resolves if the sandbox is disposed before the first render — check
125
- * `sandbox.disposed` afterward if you need to distinguish the two cases.
126
- * Does not reset on re-renders; use the Promise returned by render() for
127
- * subsequent renders.
128
- */
129
- readonly ready: Promise<void>;
130
120
  /** Tear down the sandbox — removes the iframe from the DOM and clears all listeners. */
131
121
  dispose(): void;
122
+ /** True once dispose() has been called. */
123
+ readonly disposed: boolean;
132
124
  /**
133
125
  * Subscribe to application-level messages from the sandboxed document.
134
126
  * Receives 'error', 'custom', and 'resize' messages. The 'ready' lifecycle
@@ -137,13 +129,13 @@ export interface SandboxHandle {
137
129
  */
138
130
  onMessage(handler: (msg: SandboxMessage) => void): Unsubscribe;
139
131
  /**
140
- * Replace the live document body without navigating the iframe. Document/window listeners,
141
- * head scripts, and named styles remain; body descendants, their listeners, references, and
142
- * form state are replaced. Scripts included in `html` do not execute through innerHTML.
143
- *
144
- * Call after `render()` resolves — warns in dev if the bridge is not ready. No-ops if disposed.
132
+ * Resolves when the first sandbox document signals it is ready.
133
+ * Also resolves if the sandbox is disposed before the first render — check
134
+ * `sandbox.disposed` afterward if you need to distinguish the two cases.
135
+ * Does not reset on re-renders; use the Promise returned by render() for
136
+ * subsequent renders.
145
137
  */
146
- replaceBody(html: string): void;
138
+ readonly ready: Promise<void>;
147
139
  /**
148
140
  * Replace the entire sandbox document (full page reset). Creates the iframe lazily
149
141
  * on the first call — no DOM is created until render() is invoked.
@@ -159,17 +151,25 @@ export interface SandboxHandle {
159
151
  signal?: AbortSignal;
160
152
  }): Promise<void>;
161
153
  /**
162
- * Push multiple state values into the sandbox in a single postMessage.
163
- * More efficient than calling setState() repeatedly for initial state setup.
164
- * Warns in dev if called before render() resolves.
154
+ * Replace the live document body without navigating the iframe. Document/window listeners,
155
+ * head scripts, and named styles remain; body descendants, their listeners, references, and
156
+ * form state are replaced. Scripts included in `html` do not execute through innerHTML.
157
+ *
158
+ * Call after `render()` resolves — warns in dev if the bridge is not ready. No-ops if disposed.
165
159
  */
166
- setStateAll(record: Record<string, unknown>): void;
160
+ replaceBody(html: string): void;
167
161
  /**
168
162
  * Push a state value into the sandbox without re-rendering.
169
163
  * Dispatches a `sandbox:state-update` CustomEvent on `document` inside the sandbox.
170
164
  * Warns in dev if called before render() resolves.
171
165
  */
172
166
  setState(key: string, value: unknown): void;
167
+ /**
168
+ * Push multiple state values into the sandbox in a single postMessage.
169
+ * More efficient than calling setState() repeatedly for initial state setup.
170
+ * Warns in dev if called before render() resolves.
171
+ */
172
+ setStateAll(record: Record<string, unknown>): void;
173
173
  /**
174
174
  * Replace the CSS for a named style block without a full re-render.
175
175
  * `id` must match a key in the `namedStyles` option passed to `createSandbox`.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.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AAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAClD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvC,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,gHAAgH;IAChH,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;IACrC,wFAAwF;IACxF,OAAO,IAAI,IAAI,CAAC;IAChB,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,GAAG,WAAW,CAAC;IAC/D;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5C;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACnD;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B"}
package/package.json CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "name": "@vielzeug/sandbox",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Sandboxed iframe runtime with a typed postMessage state bridge for safe execution of AI-generated UI",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/helmuthdu/vielzeug",
8
+ "directory": "packages/sandbox"
9
+ },
5
10
  "type": "module",
11
+ "engines": {
12
+ "node": ">=22"
13
+ },
6
14
  "files": [
7
15
  "dist"
8
16
  ],
@@ -11,44 +19,41 @@
11
19
  "types": "dist/index.d.ts",
12
20
  "exports": {
13
21
  ".": {
14
- "types": "./dist/index.d.ts",
15
22
  "import": "./dist/index.js",
16
- "require": "./dist/index.cjs"
23
+ "require": "./dist/index.cjs",
24
+ "types": "./dist/index.d.ts"
17
25
  },
18
26
  "./testing": {
19
- "types": "./dist/testing.d.ts",
20
27
  "import": "./dist/testing.js",
21
- "require": "./dist/testing.cjs"
28
+ "require": "./dist/testing.cjs",
29
+ "types": "./dist/testing.d.ts"
22
30
  }
23
31
  },
32
+ "typesVersions": {
33
+ "*": {
34
+ "testing": [
35
+ "dist/testing.d.ts"
36
+ ]
37
+ }
38
+ },
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "registry": "https://registry.npmjs.org/"
42
+ },
24
43
  "scripts": {
25
44
  "build": "vite build && pnpm run build:bundle && pnpm run build:types",
26
45
  "build:bundle": "vite build --config vite.bundle.config.ts",
27
46
  "build:types": "tsc -p tsconfig.declarations.json",
28
- "fix": "eslint --fix src",
29
- "lint": "eslint src",
47
+ "fix": "biome check --write src",
48
+ "lint": "biome ci src",
30
49
  "prepublishOnly": "pnpm run build",
31
50
  "test": "vitest"
32
51
  },
33
- "publishConfig": {
34
- "access": "public",
35
- "registry": "https://registry.npmjs.org/"
36
- },
37
- "engines": {
38
- "node": ">=22"
39
- },
40
52
  "devDependencies": {
41
- "@types/node": "^26.1.2",
53
+ "@types/node": "^26.2.0",
42
54
  "jsdom": "^30.0.1",
43
55
  "typescript": "^6.0.3",
44
- "vite": "^8.2.0",
56
+ "vite": "^8.2.1",
45
57
  "vitest": "^4.1.10"
46
- },
47
- "typesVersions": {
48
- "*": {
49
- "testing": [
50
- "dist/testing.d.ts"
51
- ]
52
- }
53
58
  }
54
59
  }
package/dist/_sandbox.cjs DELETED
@@ -1,2 +0,0 @@
1
- const e=require("./_policy.cjs"),t=require("./_document.cjs"),n=require("./_runtime.cjs");function r(t={}){return e.buildCspFromOptions(e.normalizeSandboxOptions(t))}exports.buildCsp=r,exports.buildDocument=t.buildDocument,exports.createSandbox=n.createSandbox;
2
- //# sourceMappingURL=_sandbox.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_sandbox.cjs","names":[],"sources":["../src/_sandbox.ts"],"sourcesContent":["import type { SandboxOptions } from './types.js';\n\nimport { buildCspFromOptions, normalizeSandboxOptions } from './_policy.js';\n\nexport { buildDocument } from './_document.js';\nexport { createSandbox } from './_runtime.js';\n\nexport function buildCsp(options: SandboxOptions = {}): string {\n return buildCspFromOptions(normalizeSandboxOptions(options));\n}\n"],"mappings":"0FAOA,SAAgB,EAAS,EAA0B,CAAC,EAAW,CAC7D,OAAO,EAAA,oBAAoB,EAAA,wBAAwB,CAAO,CAAC,CAC7D"}
@@ -1,5 +0,0 @@
1
- import type { SandboxOptions } from './types.js';
2
- export { buildDocument } from './_document.js';
3
- export { createSandbox } from './_runtime.js';
4
- export declare function buildCsp(options?: SandboxOptions): string;
5
- //# sourceMappingURL=_sandbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_sandbox.d.ts","sourceRoot":"","sources":["../src/_sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,wBAAgB,QAAQ,CAAC,OAAO,GAAE,cAAmB,GAAG,MAAM,CAE7D"}
package/dist/_sandbox.js DELETED
@@ -1,11 +0,0 @@
1
- import { buildCspFromOptions as e, normalizeSandboxOptions as t } from "./_policy.js";
2
- import { buildDocument as n } from "./_document.js";
3
- import { createSandbox as r } from "./_runtime.js";
4
- //#region src/_sandbox.ts
5
- function i(n = {}) {
6
- return e(t(n));
7
- }
8
- //#endregion
9
- export { i as buildCsp, n as buildDocument, r as createSandbox };
10
-
11
- //# sourceMappingURL=_sandbox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_sandbox.js","names":[],"sources":["../src/_sandbox.ts"],"sourcesContent":["import type { SandboxOptions } from './types.js';\n\nimport { buildCspFromOptions, normalizeSandboxOptions } from './_policy.js';\n\nexport { buildDocument } from './_document.js';\nexport { createSandbox } from './_runtime.js';\n\nexport function buildCsp(options: SandboxOptions = {}): string {\n return buildCspFromOptions(normalizeSandboxOptions(options));\n}\n"],"mappings":";;;;AAOA,SAAgB,EAAS,IAA0B,CAAC,GAAW;CAC7D,OAAO,EAAoB,EAAwB,CAAO,CAAC;AAC7D"}