@manifest-configuration-language/browser 0.3.27 → 0.3.29
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 +2 -2
- package/dist/runtime.js +25 -10
- package/package.json +1 -1
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:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 104766871 bytes
|
|
4
|
+
sha256: cb49976b17aa433a7741f69aa5d85aff8febf009f269650faae5db10784decc5
|
package/dist/runtime.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
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
|
-
|
|
4
|
+
const maxParameterBytes = 1_048_576;
|
|
5
|
+
const maxParameterDepth = 64;
|
|
6
|
+
function isJSONValue(value, ancestors = new Set(), depth = 0) {
|
|
5
7
|
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
6
8
|
return true;
|
|
7
9
|
if (typeof value === "number")
|
|
8
10
|
return Number.isFinite(value);
|
|
9
|
-
if (typeof value !== "object" || ancestors.has(value))
|
|
11
|
+
if (typeof value !== "object" || ancestors.has(value) || depth >= maxParameterDepth)
|
|
10
12
|
return false;
|
|
11
13
|
if (!Array.isArray(value)) {
|
|
12
14
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -16,9 +18,19 @@ function isJSONValue(value, ancestors = new Set()) {
|
|
|
16
18
|
return false;
|
|
17
19
|
}
|
|
18
20
|
ancestors.add(value);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
let valid;
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
valid = true;
|
|
24
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
25
|
+
if (!Object.hasOwn(value, index) || !isJSONValue(value[index], ancestors, depth + 1)) {
|
|
26
|
+
valid = false;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
valid = Object.values(value).every((item) => isJSONValue(item, ancestors, depth + 1));
|
|
33
|
+
}
|
|
22
34
|
ancestors.delete(value);
|
|
23
35
|
return valid;
|
|
24
36
|
}
|
|
@@ -241,7 +253,6 @@ export function createMclRuntime(options = {}) {
|
|
|
241
253
|
else if (data?.type === "fatal") {
|
|
242
254
|
const error = new Error(typeof data.message === "string" ? data.message : "MCL WebAssembly exited unexpectedly");
|
|
243
255
|
if (initialized) {
|
|
244
|
-
emitStatus("error");
|
|
245
256
|
terminateWorker(error);
|
|
246
257
|
}
|
|
247
258
|
else
|
|
@@ -255,7 +266,6 @@ export function createMclRuntime(options = {}) {
|
|
|
255
266
|
return;
|
|
256
267
|
const error = new Error(event.message || "MCL worker failed");
|
|
257
268
|
if (initialized) {
|
|
258
|
-
emitStatus("error");
|
|
259
269
|
terminateWorker(error);
|
|
260
270
|
}
|
|
261
271
|
else
|
|
@@ -268,7 +278,6 @@ export function createMclRuntime(options = {}) {
|
|
|
268
278
|
return;
|
|
269
279
|
const error = new Error("MCL worker sent a malformed message");
|
|
270
280
|
if (initialized) {
|
|
271
|
-
emitStatus("error");
|
|
272
281
|
terminateWorker(error);
|
|
273
282
|
}
|
|
274
283
|
else
|
|
@@ -288,8 +297,6 @@ export function createMclRuntime(options = {}) {
|
|
|
288
297
|
function fail(error) {
|
|
289
298
|
if (rawWorker !== currentRawWorker)
|
|
290
299
|
return;
|
|
291
|
-
if (!initialized)
|
|
292
|
-
reportStatus("error");
|
|
293
300
|
clearTimeout(timer);
|
|
294
301
|
if (stopInitialization === fail)
|
|
295
302
|
stopInitialization = undefined;
|
|
@@ -317,6 +324,8 @@ export function createMclRuntime(options = {}) {
|
|
|
317
324
|
}
|
|
318
325
|
function terminateWorker(error) {
|
|
319
326
|
const currentWorker = rawWorker;
|
|
327
|
+
if (!currentWorker)
|
|
328
|
+
return;
|
|
320
329
|
const currentApi = workerApi;
|
|
321
330
|
const currentStop = stopCurrent;
|
|
322
331
|
const cleanup = cleanupWorkerListeners;
|
|
@@ -327,6 +336,8 @@ export function createMclRuntime(options = {}) {
|
|
|
327
336
|
workerProjectId = undefined;
|
|
328
337
|
workerSnapshot = undefined;
|
|
329
338
|
stopCurrent = undefined;
|
|
339
|
+
if (!disposed && error.name !== "AbortError")
|
|
340
|
+
emitStatus("error");
|
|
330
341
|
cleanup?.();
|
|
331
342
|
currentWorker?.terminate();
|
|
332
343
|
currentApi?.[Comlink.releaseProxy]();
|
|
@@ -433,6 +444,10 @@ export function createMclRuntime(options = {}) {
|
|
|
433
444
|
!isJSONValue(parameters)) {
|
|
434
445
|
throw new TypeError("parameters must be an object with JSON values");
|
|
435
446
|
}
|
|
447
|
+
const serializedParameters = JSON.stringify(parameters);
|
|
448
|
+
if (new TextEncoder().encode(serializedParameters).byteLength > maxParameterBytes) {
|
|
449
|
+
throw new RangeError(`parameters exceed the ${maxParameterBytes}-byte limit`);
|
|
450
|
+
}
|
|
436
451
|
}
|
|
437
452
|
// Validate renameFileImports paths eagerly so we never spin up a Worker.
|
|
438
453
|
if (operation === "renameFileImports") {
|
package/package.json
CHANGED