@manifest-configuration-language/browser 0.3.23 → 0.3.26

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/mcl.wasm CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/mcl.wasm
3
- size: 97176173 bytes
4
- sha256: a72c3a90d2ef8199ae2d365a2038ff67344a114b74ac34b42f7d6ac9b6285cab
3
+ size: 97266980 bytes
4
+ sha256: 0267dca496d698bffbe5ce70ab2ed27793a606155f54155b9a9b492e23dbe706
package/dist/project.d.ts CHANGED
@@ -45,7 +45,7 @@ export interface RequestOptions {
45
45
  }
46
46
  export interface ProjectOperationOptions extends RequestOptions {
47
47
  entrypoint?: string;
48
- parameters?: Record<string, string>;
48
+ parameters?: Record<string, unknown>;
49
49
  }
50
50
  export interface PositionOptions {
51
51
  line: number;
@@ -8,12 +8,7 @@ export type Request = {
8
8
  oldPath?: ProjectPath;
9
9
  newPath?: ProjectPath;
10
10
  entrypoint?: ProjectPath2;
11
- /**
12
- * Runtime evaluation parameters. Only check, evaluate, and render operations accept parameters.
13
- */
14
- parameters?: {
15
- [k: string]: string;
16
- };
11
+ parameters?: RequestParameters;
17
12
  /**
18
13
  * UTF-8 entrypoint source, limited by the runtime.
19
14
  */
@@ -43,6 +38,12 @@ export interface CompletionPosition {
43
38
  line: number;
44
39
  character: number;
45
40
  }
41
+ /**
42
+ * Typed JSON runtime parameter values. Only check, evaluate, and render operations accept parameters.
43
+ */
44
+ export interface RequestParameters {
45
+ [k: string]: unknown;
46
+ }
46
47
  export interface Response {
47
48
  requestId: number;
48
49
  revision?: number;
package/dist/runtime.js CHANGED
@@ -1,6 +1,27 @@
1
1
  import PQueue from "p-queue";
2
2
  import * as Comlink from "comlink";
3
3
  import { createProjectSnapshot, computeProjectDelta, isValidProjectPath, operationPriorities, latestOnlyOperations, requestPriorities, maxSourceBytes, } from "./project.js";
4
+ function isJSONValue(value, ancestors = new Set()) {
5
+ if (value === null || typeof value === "string" || typeof value === "boolean")
6
+ return true;
7
+ if (typeof value === "number")
8
+ return Number.isFinite(value);
9
+ if (typeof value !== "object" || ancestors.has(value))
10
+ return false;
11
+ if (!Array.isArray(value)) {
12
+ const prototype = Object.getPrototypeOf(value);
13
+ if (prototype !== Object.prototype && prototype !== null)
14
+ return false;
15
+ if (Object.getOwnPropertySymbols(value).length > 0)
16
+ return false;
17
+ }
18
+ ancestors.add(value);
19
+ const valid = Array.isArray(value)
20
+ ? value.every((item) => isJSONValue(item, ancestors))
21
+ : Object.values(value).every((item) => isJSONValue(item, ancestors));
22
+ ancestors.delete(value);
23
+ return valid;
24
+ }
4
25
  // ---------------------------------------------------------------------------
5
26
  // Error class
6
27
  // ---------------------------------------------------------------------------
@@ -380,8 +401,10 @@ export function createMclRuntime(options = {}) {
380
401
  const previousSnapshot = workerProjectId === projectId ? workerSnapshot : undefined;
381
402
  const reset = workerProjectId !== projectId;
382
403
  const result = computeProjectDelta(snapshot, previousSnapshot, reset);
383
- if (result === null)
384
- return; // nothing changed
404
+ if (result === null) {
405
+ workerSnapshot = snapshot;
406
+ return;
407
+ }
385
408
  const { delta, binaryFiles, transferables } = result;
386
409
  const updateJSON = JSON.stringify(delta);
387
410
  // Transfer binary buffers to avoid copying.
@@ -405,11 +428,11 @@ export function createMclRuntime(options = {}) {
405
428
  }
406
429
  const parameters = requestOptions.parameters;
407
430
  if (parameters === null || typeof parameters !== "object" || Array.isArray(parameters)) {
408
- throw new TypeError("parameters must be an object with string values");
431
+ throw new TypeError("parameters must be an object with JSON values");
409
432
  }
410
433
  for (const value of Object.values(parameters)) {
411
- if (typeof value !== "string") {
412
- throw new TypeError("parameters must be an object with string values");
434
+ if (!isJSONValue(value)) {
435
+ throw new TypeError("parameters must be an object with JSON values");
413
436
  }
414
437
  }
415
438
  }
@@ -445,15 +468,10 @@ export function createMclRuntime(options = {}) {
445
468
  try {
446
469
  if (timeoutMs <= 0)
447
470
  throw timeoutError;
448
- timer = setTimeout(() => {
449
- if (stopCurrent)
450
- stopCurrent(timeoutError);
451
- else
452
- stopInitialization?.(timeoutError);
453
- }, timeoutMs);
454
471
  await waitUntilReady(signal);
455
472
  if (signal?.aborted)
456
473
  throw new DOMException("The operation was aborted", "AbortError");
474
+ timer = setTimeout(() => stopCurrent?.(timeoutError), timeoutMs);
457
475
  const currentApi = workerApi;
458
476
  const currentGeneration = workerGeneration;
459
477
  operationWorkerGeneration = currentGeneration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-configuration-language/browser",
3
- "version": "0.3.23",
3
+ "version": "0.3.26",
4
4
  "description": "Run MCL projects in a browser Web Worker using the Go WebAssembly runtime.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "typescript": "^7.0.2"
34
34
  },
35
35
  "engines": {
36
- "node": ">=26.13.0"
36
+ "node": ">=24.22.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build:wasm": "node ./scripts/build-wasm.mjs",