@manifest-configuration-language/browser 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -22,12 +22,12 @@ Pass an `AbortSignal` through the final options argument to cancel an operation.
22
22
 
23
23
  Project files can be UTF-8 strings or `Uint8Array` values. UTF-8 files remain inline in the JSON request. The Browser SDK copies each `Uint8Array` and transfers its buffer to the Worker; the Worker sends only `{ "encoding": "binary" }` metadata in the request JSON and passes a path-to-`Uint8Array` map as the second argument to `mclWasm.run(requestJSON, binaryFiles)`. The Go runtime copies those bytes into its project filesystem. The SDK-owned and caller-owned arrays remain reusable after each operation.
24
24
 
25
+ The package exports `maxSourceBytes`, `maxProjectFiles`, `maxProjectFileBytes`, and `maxProjectBytes` so browser interfaces can display the same limits enforced by the runtime.
26
+
25
27
  MCL decodes the request into a root-relative `io/fs` filesystem for project files, module imports, schemas, resource catalogs, and dependency locks. The runtime limits are defined in the [protocol schema](https://github.com/manifest-configuration-language/mcl/blob/main/cmd/mcl-wasm/protocol.schema.json). The worker blocks `fetch` after loading the WASM runtime assets, so MCL project evaluation cannot make external network requests.
26
28
 
27
29
  The wire format is described in [`protocol.schema.json`](https://github.com/manifest-configuration-language/mcl/blob/main/cmd/mcl-wasm/protocol.schema.json). Go protocol models are generated with `go generate ./cmd/mcl-wasm`, and the browser package declarations are generated with `npm run generate:protocol`. The browser API declarations reuse the generated operation, diagnostic, and result types. MCL decodes each request into a root-relative `io/fs` project filesystem. Kustomize project overlays and locked Git archives use kyaml's in-memory filesystem, and Helm source loading accepts an `io/fs` filesystem. The Go `wasm_exec.js` runtime supplies its standard browser fallbacks for process, path, and stdout APIs; the Browser SDK does not provide a Node-style project filesystem or require Node polyfills in Vite.
28
30
 
29
- `npm run test:browser` records WASM transfer size, initialization, render, cancellation, and linear-memory use in Chromium, Firefox, and WebKit. Chromium also loads and renders a 32 MiB project. [The performance baseline](https://github.com/manifest-configuration-language/mcl/blob/main/packages/browser/performance-baseline.json) records one local reference run. [The performance budget](https://github.com/manifest-configuration-language/mcl/blob/main/packages/browser/performance-budget.json) limits WASM size growth, linear memory to 192 MiB, initialization to 10 seconds, single-operation rendering and cancellation to 1 second, and Chromium's 32 MiB project load and render to 2 and 5 seconds.
30
-
31
31
  `MclRuntimeError` and lint diagnostics report project-relative paths with UTF-16 start and end positions. Evaluation errors also include related source locations when the Go engine provides them, such as the schema declaration associated with a resource validation error.
32
32
 
33
33
  The [WebAssembly code size profile](https://github.com/manifest-configuration-language/mcl/blob/main/packages/browser/performance-profile.md) records package-level function body sizes and explains which WebAssembly sections it excludes.
package/dist/mcl.wasm CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/mcl.wasm
3
3
  size: 95920350 bytes
4
- sha256: ef4594badda1f51ed39b2ecc391a7b964db6dde5c290b9e09c7684b7113a198f
4
+ sha256: 3723f11f7acbd32086281639d28c5d0c25e7f1b9f0593b251876f2c60d1d5f2f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-configuration-language/browser",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Run MCL projects in a browser Web Worker using the Go WebAssembly runtime.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,18 +23,14 @@
23
23
  "scripts": {
24
24
  "build:wasm": "node ./scripts/build-wasm.mjs",
25
25
  "generate:protocol": "node ./scripts/generate-protocol.mjs",
26
- "test:browser": "npm run build:wasm && node ./scripts/smoke-browser.mjs",
27
- "test:browser:built": "node ./scripts/smoke-browser.mjs",
28
- "test:browser:installed": "node ./scripts/smoke-browser.mjs --package-smoke",
26
+ "test:unit": "node --test ./test/runtime-lifecycle.test.mjs",
29
27
  "prepack": "npm run build:wasm"
30
28
  },
31
29
  "engines": {
32
30
  "node": ">=20.19"
33
31
  },
34
32
  "devDependencies": {
35
- "json-schema-to-typescript": "16.0.0",
36
- "playwright": "1.64.1",
37
- "vite": "8.3.4"
33
+ "json-schema-to-typescript": "16.0.0"
38
34
  },
39
35
  "publishConfig": {
40
36
  "access": "public"
package/src/index.d.ts CHANGED
@@ -12,6 +12,11 @@ import type {
12
12
 
13
13
  export type MclOperation = WasmRequest["operation"];
14
14
 
15
+ export declare const maxSourceBytes: number;
16
+ export declare const maxProjectFiles: number;
17
+ export declare const maxProjectFileBytes: number;
18
+ export declare const maxProjectBytes: number;
19
+
15
20
  /** Root-relative project files passed to MCL's per-request filesystem. Uint8Array values are copied before transfer so callers can reuse them. */
16
21
  export type ProjectFile = string | Uint8Array;
17
22
  export type ProjectFiles = Readonly<Record<string, ProjectFile>>;
package/src/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { maxProjectBytes, maxProjectFileBytes, maxProjectFiles, maxSourceBytes } from "./limits.js";
2
2
 
3
+ export { maxProjectBytes, maxProjectFileBytes, maxProjectFiles, maxSourceBytes };
4
+
3
5
  const defaultInitializationTimeoutMs = 30_000;
4
6
  const defaultOperationTimeoutMs = 10_000;
5
7
  const wasmURL = new URL("../dist/mcl.wasm", import.meta.url).href;