@paged-media/plugin-sdk 0.2.13-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 +15 -8
- package/package.json +2 -2
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
|
@@ -1672,14 +1672,20 @@ function loadBundle(getEditor, bundle, options) {
|
|
|
1672
1672
|
|
|
1673
1673
|
// src/wasm-bundle-loader.ts
|
|
1674
1674
|
var WASM_BUDGETS = {
|
|
1675
|
-
/** Hard per-artifact byte ceiling. A
|
|
1676
|
-
* engine (Blitz-class) lands in the
|
|
1677
|
-
* rejects an accidentally-bundled debug
|
|
1678
|
-
* 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. */
|
|
1679
1680
|
maxArtifactBytes: 8 * 1024 * 1024,
|
|
1680
|
-
/**
|
|
1681
|
-
*
|
|
1682
|
-
|
|
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,
|
|
1683
1689
|
/** Wall-clock budget for fetch + compile + instantiate. Protects the
|
|
1684
1690
|
* editor's main flow from a pathological module; advisory, the loader
|
|
1685
1691
|
* aborts with a clear error when exceeded. */
|
|
@@ -1724,7 +1730,8 @@ async function loadBundleWasm(bundle, name, options) {
|
|
|
1724
1730
|
const src = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
1725
1731
|
const view = new Uint8Array(src.byteLength);
|
|
1726
1732
|
view.set(src);
|
|
1727
|
-
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;
|
|
1728
1735
|
if (view.byteLength > ceiling) {
|
|
1729
1736
|
throw new Error(
|
|
1730
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"
|