@xeonr/renderer-sdk 1.6.0 → 1.8.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/worker-renderer.d.ts +18 -2
- package/dist/worker-renderer.d.ts.map +1 -1
- package/dist/worker-renderer.js +45 -19
- package/dist/worker-renderer.js.map +1 -1
- package/dist/worker.d.ts +60 -3
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +75 -5
- package/dist/worker.js.map +1 -1
- package/package.json +90 -89
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
|
-
import { type WorkerContext } from './worker.js';
|
|
2
|
+
import { type WorkerContext, type WorkerManifest } from './worker.js';
|
|
3
|
+
/**
|
|
4
|
+
* The canonical output contract for every renderer that uses
|
|
5
|
+
* defineRendererWorker — both thumbnails are required, image/png.
|
|
6
|
+
* Surfaced as a named export so renderers can drop a one-liner
|
|
7
|
+
* worker.manifest.yaml referring back to it (or skip the YAML entirely
|
|
8
|
+
* and let the SDK self-enforce). The vite plugin reads either form;
|
|
9
|
+
* having the constant here keeps the source of truth in one place.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_RENDERER_WORKER_MANIFEST: WorkerManifest;
|
|
3
12
|
export interface RendererWorkerOptions {
|
|
4
13
|
/** Rendered container size in CSS pixels. Defaults to 1024×768 —
|
|
5
14
|
* matches what the old default-workers renderer pool drew at and
|
|
@@ -19,6 +28,13 @@ export type RendererWorkerRenderFn = (args: {
|
|
|
19
28
|
ctx: WorkerContext;
|
|
20
29
|
}) => ReactElement;
|
|
21
30
|
/** Register a renderer worker entry. Mounts the passed React element
|
|
22
|
-
* twice (light + dark) and ships each capture as a thumbnail.
|
|
31
|
+
* twice (light + dark) and ships each capture as a thumbnail.
|
|
32
|
+
*
|
|
33
|
+
* Both outputs are declared in DEFAULT_RENDERER_WORKER_MANIFEST and
|
|
34
|
+
* passed through to defineWorker so the SDK enforces required-output
|
|
35
|
+
* presence at handler exit — a renderer that crashes between the two
|
|
36
|
+
* captures fails the run with MissingOutputError rather than silently
|
|
37
|
+
* shipping only the light thumbnail.
|
|
38
|
+
*/
|
|
23
39
|
export declare function defineRendererWorker(render: RendererWorkerRenderFn, options?: RendererWorkerOptions): void;
|
|
24
40
|
//# sourceMappingURL=worker-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-renderer.d.ts","sourceRoot":"","sources":["../src/worker-renderer.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"worker-renderer.d.ts","sourceRoot":"","sources":["../src/worker-renderer.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAgB,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGpF;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,EAAE,cAO9C,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACrC;;mEAE+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;4EACwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;+BAE2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAC3C,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,GAAG,EAAE,aAAa,CAAC;CACnB,KAAK,YAAY,CAAC;AAEnB;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,GAAE,qBAA0B,GACjC,IAAI,CAyBN"}
|
package/dist/worker-renderer.js
CHANGED
|
@@ -27,27 +27,53 @@ import { createRoot } from 'react-dom/client';
|
|
|
27
27
|
import { StrictMode } from 'react';
|
|
28
28
|
import { defineWorker } from './worker.js';
|
|
29
29
|
import { WorkerRendererProvider } from './react/worker.js';
|
|
30
|
+
/**
|
|
31
|
+
* The canonical output contract for every renderer that uses
|
|
32
|
+
* defineRendererWorker — both thumbnails are required, image/png.
|
|
33
|
+
* Surfaced as a named export so renderers can drop a one-liner
|
|
34
|
+
* worker.manifest.yaml referring back to it (or skip the YAML entirely
|
|
35
|
+
* and let the SDK self-enforce). The vite plugin reads either form;
|
|
36
|
+
* having the constant here keeps the source of truth in one place.
|
|
37
|
+
*/
|
|
38
|
+
export const DEFAULT_RENDERER_WORKER_MANIFEST = {
|
|
39
|
+
outputs: [
|
|
40
|
+
{ slot: 'common:thumbnail_light', kind: 'blob', required: true, mimeHint: 'image/png',
|
|
41
|
+
description: 'Light-theme captured thumbnail.' },
|
|
42
|
+
{ slot: 'common:thumbnail_dark', kind: 'blob', required: true, mimeHint: 'image/png',
|
|
43
|
+
description: 'Dark-theme captured thumbnail.' },
|
|
44
|
+
],
|
|
45
|
+
};
|
|
30
46
|
/** Register a renderer worker entry. Mounts the passed React element
|
|
31
|
-
* twice (light + dark) and ships each capture as a thumbnail.
|
|
47
|
+
* twice (light + dark) and ships each capture as a thumbnail.
|
|
48
|
+
*
|
|
49
|
+
* Both outputs are declared in DEFAULT_RENDERER_WORKER_MANIFEST and
|
|
50
|
+
* passed through to defineWorker so the SDK enforces required-output
|
|
51
|
+
* presence at handler exit — a renderer that crashes between the two
|
|
52
|
+
* captures fails the run with MissingOutputError rather than silently
|
|
53
|
+
* shipping only the light thumbnail.
|
|
54
|
+
*/
|
|
32
55
|
export function defineRendererWorker(render, options = {}) {
|
|
33
|
-
defineWorker(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
render
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
defineWorker({
|
|
57
|
+
manifest: DEFAULT_RENDERER_WORKER_MANIFEST,
|
|
58
|
+
handler: async (ctx) => {
|
|
59
|
+
const width = options.width ?? 1024;
|
|
60
|
+
const height = options.height ?? 768;
|
|
61
|
+
const pixelRatio = options.pixelRatio ?? 2;
|
|
62
|
+
const settleMs = options.settleMs ?? 500;
|
|
63
|
+
// html-to-image is a 30KB+ dep — lazy-load so portal/dashboard
|
|
64
|
+
// bundles don't pull it.
|
|
65
|
+
const { toPng } = await import('html-to-image');
|
|
66
|
+
for (const theme of ['light', 'dark']) {
|
|
67
|
+
ctx.log.info('render.theme.start', { theme });
|
|
68
|
+
const png = await renderAndCapture({
|
|
69
|
+
render: () => render({ theme, ctx }),
|
|
70
|
+
ctx, theme, width, height, pixelRatio, settleMs, toPng,
|
|
71
|
+
});
|
|
72
|
+
const outputName = theme === 'light' ? 'common:thumbnail_light' : 'common:thumbnail_dark';
|
|
73
|
+
await ctx.outputBlob(outputName, png, 'image/png');
|
|
74
|
+
ctx.log.info('render.theme.done', { theme, bytes: png.byteLength });
|
|
75
|
+
}
|
|
76
|
+
},
|
|
51
77
|
});
|
|
52
78
|
}
|
|
53
79
|
async function renderAndCapture(args) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-renderer.js","sourceRoot":"","sources":["../src/worker-renderer.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,qEAAqE;AACrE,qDAAqD;AACrD,EAAE;AACF,oDAAoD;AACpD,EAAE;AACF,gFAAgF;AAChF,2CAA2C;AAC3C,EAAE;AACF,4EAA4E;AAC5E,EAAE;AACF,6DAA6D;AAC7D,4BAA4B;AAC5B,sEAAsE;AACtE,kEAAkE;AAClE,mBAAmB;AACnB,qEAAqE;AACrE,oEAAoE;AACpE,EAAE;AACF,oEA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AAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9D,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CACF,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACtC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,KAAK,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC3F,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/dist/worker.d.ts
CHANGED
|
@@ -86,12 +86,69 @@ interface DefineWorkerOptions {
|
|
|
86
86
|
/** Override the bridge — only used by the dev harness to inject the
|
|
87
87
|
* mock. Production code never sets this. */
|
|
88
88
|
bridge?: WorkerBridge;
|
|
89
|
+
/** Worker output declarations (forwarded from the call-site
|
|
90
|
+
* defineWorker({manifest, handler}) form). Used to enforce required-
|
|
91
|
+
* output presence and reject undeclared slots. */
|
|
92
|
+
manifest?: WorkerManifest;
|
|
89
93
|
}
|
|
90
94
|
type WorkerHandler = (ctx: WorkerContext) => Promise<void> | void;
|
|
91
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Output declaration for a single slot the worker emits. Together with
|
|
97
|
+
* the handler, the WorkerManifest lets the pipeline runner cross-check
|
|
98
|
+
* the puppeteer step's OutputBinding[] slot names at publish time and
|
|
99
|
+
* at run end — `MissingOutputError` if a required slot wasn't emitted,
|
|
100
|
+
* `SchemaValidationError` if the worker emits an undeclared slot.
|
|
101
|
+
*
|
|
102
|
+
* The vite plugin extracts this declaration from the worker entry's
|
|
103
|
+
* AST at build time and writes it into the renderer archive's
|
|
104
|
+
* `config.json` under `worker.outputs[]` so the controller can read it
|
|
105
|
+
* without executing the bundle.
|
|
106
|
+
*/
|
|
107
|
+
export interface WorkerOutputDecl {
|
|
108
|
+
/** Slot name. Stable across rebuilds; matched by puppeteer
|
|
109
|
+
* PipelineStep spec's OutputBinding.slot. */
|
|
110
|
+
slot: string;
|
|
111
|
+
/** What kind of output the worker emits at this slot:
|
|
112
|
+
* - `blob` → ctx.outputBlob(slot, body, mime)
|
|
113
|
+
* - `kv` → ctx.output(slot, value)
|
|
114
|
+
* The runner uses this to gate bridge calls. */
|
|
115
|
+
kind: 'blob' | 'kv';
|
|
116
|
+
/** Required (default) or optional. Required + not-emitted = MissingOutputError. */
|
|
117
|
+
required?: boolean;
|
|
118
|
+
/** For blob slots: a default mime hint the controller can fall
|
|
119
|
+
* back to when the worker doesn't set Content-Type explicitly. */
|
|
120
|
+
mimeHint?: string;
|
|
121
|
+
/** Authoring-time docstring shown in the admin UI's step picker. */
|
|
122
|
+
description?: string;
|
|
123
|
+
}
|
|
124
|
+
export interface WorkerManifest {
|
|
125
|
+
outputs: WorkerOutputDecl[];
|
|
126
|
+
}
|
|
127
|
+
interface DefineWorkerArgs extends DefineWorkerOptions {
|
|
128
|
+
/** The worker's declared output surface. When provided, the SDK
|
|
129
|
+
* enforces at run end that every required slot was emitted and
|
|
130
|
+
* rejects emissions of undeclared slots up-front. Optional — older
|
|
131
|
+
* workers that pre-date the spec model still work without it (gates
|
|
132
|
+
* only enforce what's declared). */
|
|
133
|
+
manifest?: WorkerManifest;
|
|
134
|
+
handler: WorkerHandler;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Register the worker handler. Call once at module top level — the SDK
|
|
92
138
|
* waits for the bridge to be ready, runs the handler, captures any
|
|
93
|
-
* thrown error, and reports outcome to the controller.
|
|
94
|
-
|
|
139
|
+
* thrown error, and reports outcome to the controller.
|
|
140
|
+
*
|
|
141
|
+
* Two signatures:
|
|
142
|
+
* defineWorker(async (ctx) => { … }) // handler only
|
|
143
|
+
* defineWorker({ manifest: {...}, handler: async (...) }) // with outputs
|
|
144
|
+
*
|
|
145
|
+
* The object form is preferred for new workers — its `manifest.outputs`
|
|
146
|
+
* is the contract the puppeteer step's `OutputBinding[]` slots bind
|
|
147
|
+
* against. The vite plugin (renderer-plugin-vite) reads the manifest
|
|
148
|
+
* at build time and writes it into `config.json` so the runner can
|
|
149
|
+
* cross-check it without loading the bundle.
|
|
150
|
+
*/
|
|
151
|
+
export declare function defineWorker(handlerOrArgs: WorkerHandler | DefineWorkerArgs, options?: DefineWorkerOptions): void;
|
|
95
152
|
/** Install an in-page mock bridge backed by static fixtures. The Vite
|
|
96
153
|
* plugin injects a `<script>` that calls this before the user's
|
|
97
154
|
* `worker.tsx` loads, so `pnpm dev` runs the handler against
|
package/dist/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;+DAI+D;AAC/D,UAAU,YAAY;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,SAAS,CAAC,IA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,WAAW,cAAc;IAC9B,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,UAAU,gBAAiB,SAAQ,mBAAmB;IACrD;;;;wCAIoC;IACpC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC;CACvB;AAID;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC3B,aAAa,EAAE,aAAa,GAAG,gBAAgB,EAC/C,OAAO,GAAE,mBAAwB,GAC/B,IAAI,CAkBN;AA8ID;;;sEAGsE;AACtE,MAAM,WAAW,iBAAiB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE,4CAA4C;IAC5C,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CAC9E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,GAAE,iBAAsB,GAAG,IAAI,CAgCvE"}
|
package/dist/worker.js
CHANGED
|
@@ -29,21 +29,39 @@
|
|
|
29
29
|
* outputs are written).
|
|
30
30
|
*/
|
|
31
31
|
let installed = false;
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Register the worker handler. Call once at module top level — the SDK
|
|
33
34
|
* waits for the bridge to be ready, runs the handler, captures any
|
|
34
|
-
* thrown error, and reports outcome to the controller.
|
|
35
|
-
|
|
35
|
+
* thrown error, and reports outcome to the controller.
|
|
36
|
+
*
|
|
37
|
+
* Two signatures:
|
|
38
|
+
* defineWorker(async (ctx) => { … }) // handler only
|
|
39
|
+
* defineWorker({ manifest: {...}, handler: async (...) }) // with outputs
|
|
40
|
+
*
|
|
41
|
+
* The object form is preferred for new workers — its `manifest.outputs`
|
|
42
|
+
* is the contract the puppeteer step's `OutputBinding[]` slots bind
|
|
43
|
+
* against. The vite plugin (renderer-plugin-vite) reads the manifest
|
|
44
|
+
* at build time and writes it into `config.json` so the runner can
|
|
45
|
+
* cross-check it without loading the bundle.
|
|
46
|
+
*/
|
|
47
|
+
export function defineWorker(handlerOrArgs, options = {}) {
|
|
36
48
|
if (installed) {
|
|
37
49
|
throw new Error('[uplim:worker] defineWorker called twice — only one handler per worker entry.');
|
|
38
50
|
}
|
|
39
51
|
installed = true;
|
|
52
|
+
const args = typeof handlerOrArgs === 'function'
|
|
53
|
+
? { handler: handlerOrArgs, ...options }
|
|
54
|
+
: handlerOrArgs;
|
|
40
55
|
if (typeof window === 'undefined') {
|
|
41
56
|
// Worker entry imported in a non-browser context (SSR test, type
|
|
42
57
|
// resolution). Skip registration silently — the handler will
|
|
43
58
|
// re-register when the bundle actually loads in headless Chrome.
|
|
44
59
|
return;
|
|
45
60
|
}
|
|
46
|
-
void runWorker(handler,
|
|
61
|
+
void runWorker(args.handler, {
|
|
62
|
+
bridge: args.bridge,
|
|
63
|
+
manifest: args.manifest,
|
|
64
|
+
});
|
|
47
65
|
}
|
|
48
66
|
async function runWorker(handler, options) {
|
|
49
67
|
const bridge = options.bridge ?? (await waitForBridge());
|
|
@@ -51,7 +69,17 @@ async function runWorker(handler, options) {
|
|
|
51
69
|
console.error('[uplim:worker] No bridge available. In production this means the puppeteer controller never connected; in dev, install the Vite worker harness.');
|
|
52
70
|
return;
|
|
53
71
|
}
|
|
54
|
-
|
|
72
|
+
// Manifest-aware bridge wrapper: track every slot the handler emits
|
|
73
|
+
// so we can enforce required-output presence at handler exit. Also
|
|
74
|
+
// rejects emissions of undeclared slots up-front when a manifest is
|
|
75
|
+
// supplied (worker code can't write outputs the manifest didn't
|
|
76
|
+
// declare — keeps the contract honest at run time too, not just at
|
|
77
|
+
// publish time).
|
|
78
|
+
const emitted = new Set();
|
|
79
|
+
const guardedBridge = options.manifest
|
|
80
|
+
? wrapBridgeWithManifest(bridge, options.manifest, emitted)
|
|
81
|
+
: bridge;
|
|
82
|
+
const ctx = makeContext(guardedBridge);
|
|
55
83
|
// Surface uncaught errors as fail() so a malformed handler doesn't
|
|
56
84
|
// leave the controller waiting on a ready that never comes.
|
|
57
85
|
const onError = (ev) => {
|
|
@@ -64,6 +92,15 @@ async function runWorker(handler, options) {
|
|
|
64
92
|
window.addEventListener('unhandledrejection', onRejection);
|
|
65
93
|
try {
|
|
66
94
|
await handler(ctx);
|
|
95
|
+
if (options.manifest) {
|
|
96
|
+
const missing = options.manifest.outputs
|
|
97
|
+
.filter((o) => o.required !== false && !emitted.has(o.slot))
|
|
98
|
+
.map((o) => o.slot);
|
|
99
|
+
if (missing.length > 0) {
|
|
100
|
+
await bridge.fail(`MissingOutputError: required worker outputs not emitted: ${missing.join(', ')}`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
67
104
|
await bridge.ready();
|
|
68
105
|
}
|
|
69
106
|
catch (e) {
|
|
@@ -74,6 +111,39 @@ async function runWorker(handler, options) {
|
|
|
74
111
|
window.removeEventListener('unhandledrejection', onRejection);
|
|
75
112
|
}
|
|
76
113
|
}
|
|
114
|
+
/** wrapBridgeWithManifest intercepts setOutput / mintBlobOutputUrl /
|
|
115
|
+
* commitBlobOutput to (a) reject emissions of slots the manifest didn't
|
|
116
|
+
* declare, (b) record which slots were emitted for the post-handler
|
|
117
|
+
* required-output check. The bridge object itself is unwrapped — calls
|
|
118
|
+
* still hit the underlying controller; this layer only validates. */
|
|
119
|
+
function wrapBridgeWithManifest(bridge, manifest, emitted) {
|
|
120
|
+
const declared = new Map(manifest.outputs.map((o) => [o.slot, o]));
|
|
121
|
+
const ensureDeclared = (slot, kind) => {
|
|
122
|
+
const decl = declared.get(slot);
|
|
123
|
+
if (!decl) {
|
|
124
|
+
throw new Error(`SchemaValidationError: worker output "${slot}" not declared in worker manifest`);
|
|
125
|
+
}
|
|
126
|
+
if (decl.kind !== kind) {
|
|
127
|
+
throw new Error(`SchemaValidationError: worker output "${slot}" declared as ${decl.kind}, emitted as ${kind}`);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
...bridge,
|
|
132
|
+
setOutput: async (name, value) => {
|
|
133
|
+
ensureDeclared(name, 'kv');
|
|
134
|
+
emitted.add(name);
|
|
135
|
+
return bridge.setOutput(name, value);
|
|
136
|
+
},
|
|
137
|
+
mintBlobOutputUrl: async (name, contentType) => {
|
|
138
|
+
ensureDeclared(name, 'blob');
|
|
139
|
+
return bridge.mintBlobOutputUrl(name, contentType);
|
|
140
|
+
},
|
|
141
|
+
commitBlobOutput: async (name, contentType, sizeBytes) => {
|
|
142
|
+
emitted.add(name);
|
|
143
|
+
return bridge.commitBlobOutput(name, contentType, sizeBytes);
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
77
147
|
/** Poll for `window.__uplWorkerBridge` (the controller installs it via
|
|
78
148
|
* page.exposeFunction during page navigation, which races handler load).
|
|
79
149
|
* Bounded to 30s — beyond that something is wrong with the controller. */
|
package/dist/worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAuHH,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,Y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
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
2
|
+
"name": "@xeonr/renderer-sdk",
|
|
3
|
+
"version": "1.8.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"description": "SDK for building custom renderers for upl.im integrations",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"renderer.css"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"prepare": "tsc"
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"default": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./react": {
|
|
23
|
+
"default": "./dist/react/index.js",
|
|
24
|
+
"types": "./dist/react/index.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./react/dom": {
|
|
27
|
+
"default": "./dist/react/dom.js",
|
|
28
|
+
"types": "./dist/react/dom.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./react/worker": {
|
|
31
|
+
"default": "./dist/react/worker.js",
|
|
32
|
+
"types": "./dist/react/worker.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./protocol": {
|
|
35
|
+
"default": "./dist/protocol.js",
|
|
36
|
+
"types": "./dist/protocol.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./worker": {
|
|
39
|
+
"default": "./dist/worker.js",
|
|
40
|
+
"types": "./dist/worker.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"./worker-renderer": {
|
|
43
|
+
"default": "./dist/worker-renderer.js",
|
|
44
|
+
"types": "./dist/worker-renderer.d.ts"
|
|
45
|
+
},
|
|
46
|
+
"./renderer.css": "./renderer.css",
|
|
47
|
+
"./*": {
|
|
48
|
+
"default": "./dist/*.js",
|
|
49
|
+
"types": "./dist/*.d.ts"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": ">=18.0.0",
|
|
54
|
+
"react-dom": ">=18.0.0",
|
|
55
|
+
"@bufbuild/protobuf": ">=2.0.0",
|
|
56
|
+
"@xeonr/uploads-protocol": "*",
|
|
57
|
+
"@xeonr/uploads-sdk": "*",
|
|
58
|
+
"html-to-image": "^1.11.13"
|
|
59
|
+
},
|
|
60
|
+
"peerDependenciesMeta": {
|
|
61
|
+
"react": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"react-dom": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"@bufbuild/protobuf": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"@xeonr/uploads-protocol": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@xeonr/uploads-sdk": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"html-to-image": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@types/react": "^19.0.0",
|
|
82
|
+
"@types/react-dom": "^19.0.0",
|
|
83
|
+
"@bufbuild/protobuf": "^2.0.0",
|
|
84
|
+
"@xeonr/uploads-protocol": "workspace:*",
|
|
85
|
+
"@xeonr/uploads-sdk": "workspace:*",
|
|
86
|
+
"html-to-image": "^1.11.13",
|
|
87
|
+
"react": "^19.0.0",
|
|
88
|
+
"react-dom": "^19.0.0",
|
|
89
|
+
"typescript": "^5.8.3"
|
|
90
|
+
}
|
|
91
|
+
}
|