@paged-media/plugin-sdk 0.2.12-canary.0 → 0.2.14-canary.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/index.d.ts +12 -6
- package/dist/index.js +27 -8
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -460,13 +460,19 @@ declare function loadBundle(getEditor: () => PagedEditor, bundle: PagedBundle, o
|
|
|
460
460
|
* KEEP IN SYNC with plugin-cli's WASM_MAX_* and the schema's `maxBytes`
|
|
461
461
|
* maximum — the CLI hand-mirrors the contract. */
|
|
462
462
|
declare const WASM_BUDGETS: {
|
|
463
|
-
/** Hard per-artifact byte ceiling. A
|
|
464
|
-
* engine (Blitz-class) lands in the
|
|
465
|
-
* rejects an accidentally-bundled debug
|
|
466
|
-
* for one real engine. A manifest
|
|
463
|
+
/** Hard per-artifact byte ceiling for layout/codec/compute. A
|
|
464
|
+
* release-optimised wasm layout engine (Blitz-class) lands in the
|
|
465
|
+
* low-single-digit MiB; 8 MiB rejects an accidentally-bundled debug
|
|
466
|
+
* build while leaving headroom for one real engine. A manifest
|
|
467
|
+
* `maxBytes` may only TIGHTEN this. */
|
|
467
468
|
readonly maxArtifactBytes: number;
|
|
468
|
-
/**
|
|
469
|
-
*
|
|
469
|
+
/** D-07b — the governed HIGHER ceiling for `purpose: "engine"` (a
|
|
470
|
+
* vendored DB/query engine like DuckDB-WASM ≈ 36 MiB). 64 MiB fits the
|
|
471
|
+
* real artifacts with headroom; still a hard cap a manifest may only
|
|
472
|
+
* tighten. Only the `engine` purpose earns it. */
|
|
473
|
+
readonly maxEngineArtifactBytes: number;
|
|
474
|
+
/** Total declared wasm across one bundle. Sized so one `engine`
|
|
475
|
+
* artifact + a codec fit. */
|
|
470
476
|
readonly maxTotalBytes: number;
|
|
471
477
|
/** Wall-clock budget for fetch + compile + instantiate. Protects the
|
|
472
478
|
* editor's main flow from a pathological module; advisory, the loader
|
package/dist/index.js
CHANGED
|
@@ -129,6 +129,7 @@ var HOST_FEATURES = [
|
|
|
129
129
|
"document.hitTest@1",
|
|
130
130
|
"document.elementGeometry@1",
|
|
131
131
|
"document.elementProperties@1",
|
|
132
|
+
"document.placeholders@1",
|
|
132
133
|
"document.tree@1",
|
|
133
134
|
"document.onDidChange@1",
|
|
134
135
|
"document.getMetadata@1",
|
|
@@ -600,6 +601,17 @@ function createBundleHost(getEditor, manifest, options) {
|
|
|
600
601
|
requireDocRead("document.elementGeometry");
|
|
601
602
|
return getEditor().client.elementGeometry(ids);
|
|
602
603
|
},
|
|
604
|
+
async placeholders() {
|
|
605
|
+
requireDocRead("document.placeholders");
|
|
606
|
+
try {
|
|
607
|
+
const reply = await getEditor().client.send({
|
|
608
|
+
kind: "requestDocumentPlaceholders"
|
|
609
|
+
});
|
|
610
|
+
return reply.kind === "documentPlaceholders" ? reply.payload.items : [];
|
|
611
|
+
} catch {
|
|
612
|
+
return [];
|
|
613
|
+
}
|
|
614
|
+
},
|
|
603
615
|
async elementProperties(id) {
|
|
604
616
|
requireDocRead("document.elementProperties");
|
|
605
617
|
try {
|
|
@@ -1660,14 +1672,20 @@ function loadBundle(getEditor, bundle, options) {
|
|
|
1660
1672
|
|
|
1661
1673
|
// src/wasm-bundle-loader.ts
|
|
1662
1674
|
var WASM_BUDGETS = {
|
|
1663
|
-
/** Hard per-artifact byte ceiling. A
|
|
1664
|
-
* engine (Blitz-class) lands in the
|
|
1665
|
-
* rejects an accidentally-bundled debug
|
|
1666
|
-
* for one real engine. A manifest
|
|
1675
|
+
/** Hard per-artifact byte ceiling for layout/codec/compute. A
|
|
1676
|
+
* release-optimised wasm layout engine (Blitz-class) lands in the
|
|
1677
|
+
* low-single-digit MiB; 8 MiB rejects an accidentally-bundled debug
|
|
1678
|
+
* build while leaving headroom for one real engine. A manifest
|
|
1679
|
+
* `maxBytes` may only TIGHTEN this. */
|
|
1667
1680
|
maxArtifactBytes: 8 * 1024 * 1024,
|
|
1668
|
-
/**
|
|
1669
|
-
*
|
|
1670
|
-
|
|
1681
|
+
/** D-07b — the governed HIGHER ceiling for `purpose: "engine"` (a
|
|
1682
|
+
* vendored DB/query engine like DuckDB-WASM ≈ 36 MiB). 64 MiB fits the
|
|
1683
|
+
* real artifacts with headroom; still a hard cap a manifest may only
|
|
1684
|
+
* tighten. Only the `engine` purpose earns it. */
|
|
1685
|
+
maxEngineArtifactBytes: 64 * 1024 * 1024,
|
|
1686
|
+
/** Total declared wasm across one bundle. Sized so one `engine`
|
|
1687
|
+
* artifact + a codec fit. */
|
|
1688
|
+
maxTotalBytes: 80 * 1024 * 1024,
|
|
1671
1689
|
/** Wall-clock budget for fetch + compile + instantiate. Protects the
|
|
1672
1690
|
* editor's main flow from a pathological module; advisory, the loader
|
|
1673
1691
|
* aborts with a clear error when exceeded. */
|
|
@@ -1712,7 +1730,8 @@ async function loadBundleWasm(bundle, name, options) {
|
|
|
1712
1730
|
const src = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
1713
1731
|
const view = new Uint8Array(src.byteLength);
|
|
1714
1732
|
view.set(src);
|
|
1715
|
-
const
|
|
1733
|
+
const hostCeiling = artifact.purpose === "engine" ? WASM_BUDGETS.maxEngineArtifactBytes : WASM_BUDGETS.maxArtifactBytes;
|
|
1734
|
+
const ceiling = typeof artifact.maxBytes === "number" && artifact.maxBytes > 0 ? Math.min(artifact.maxBytes, hostCeiling) : hostCeiling;
|
|
1716
1735
|
if (view.byteLength > ceiling) {
|
|
1717
1736
|
throw new Error(
|
|
1718
1737
|
`loadBundleWasm: "${name}" of ${id} is ${view.byteLength} bytes, over its ${ceiling}-byte ceiling.`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paged-media/plugin-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14-canary.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@paged-media/plugin-api": "0.2.
|
|
14
|
+
"@paged-media/plugin-api": "0.2.14-canary.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": "^18.3.0"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@paged-media/canvas-wasm": "0.
|
|
25
|
+
"@paged-media/canvas-wasm": "0.43.0",
|
|
26
26
|
"@types/node": "20.19.39",
|
|
27
27
|
"@types/react": "^18.3.12",
|
|
28
28
|
"react": "^18.3.0",
|