@listen-fire/movement-lang 0.15.0 → 0.15.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/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/language_version_value.d.ts +1 -1
- package/dist/language_version_value.js +1 -1
- package/dist/wasm/loader.d.ts +9 -0
- package/dist/wasm/loader.js +43 -7
- package/dist/wasm/movement.wasm +0 -0
- package/dist/wasm/movement_parser.wasm +0 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from './parser/ast';
|
|
|
3
3
|
export * from './parser/await_words';
|
|
4
4
|
export * from './parser/scan';
|
|
5
5
|
export * from './parser/parse';
|
|
6
|
-
export { MovementParserNotReady, assertParserReady, callJudgeArrival, callLandingMisfits, callLandingNode, callListenIdentity, initEngine, initParser, isParserReady, openEngineSegment, type EngineSegment, } from './wasm/loader';
|
|
6
|
+
export { MovementParserNotReady, assertParserReady, callJudgeArrival, callLandingMisfits, callLandingNode, callListenIdentity, EngineStackRanOut, initEngine, initParser, isParserReady, openEngineSegment, type EngineSegment, } from './wasm/loader';
|
|
7
7
|
export * from './expression/bridge';
|
|
8
8
|
export * from './expression/chunk';
|
|
9
9
|
export * from './expression/file_value';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.openEngineSegment = exports.isParserReady = exports.initParser = exports.initEngine = exports.callListenIdentity = exports.callLandingNode = exports.callLandingMisfits = exports.callJudgeArrival = exports.assertParserReady = exports.MovementParserNotReady = void 0;
|
|
17
|
+
exports.openEngineSegment = exports.isParserReady = exports.initParser = exports.initEngine = exports.EngineStackRanOut = exports.callListenIdentity = exports.callLandingNode = exports.callLandingMisfits = exports.callJudgeArrival = exports.assertParserReady = exports.MovementParserNotReady = void 0;
|
|
18
18
|
__exportStar(require("./never"), exports);
|
|
19
19
|
__exportStar(require("./parser/ast"), exports);
|
|
20
20
|
__exportStar(require("./parser/await_words"), exports);
|
|
@@ -27,6 +27,7 @@ Object.defineProperty(exports, "callJudgeArrival", { enumerable: true, get: func
|
|
|
27
27
|
Object.defineProperty(exports, "callLandingMisfits", { enumerable: true, get: function () { return loader_1.callLandingMisfits; } });
|
|
28
28
|
Object.defineProperty(exports, "callLandingNode", { enumerable: true, get: function () { return loader_1.callLandingNode; } });
|
|
29
29
|
Object.defineProperty(exports, "callListenIdentity", { enumerable: true, get: function () { return loader_1.callListenIdentity; } });
|
|
30
|
+
Object.defineProperty(exports, "EngineStackRanOut", { enumerable: true, get: function () { return loader_1.EngineStackRanOut; } });
|
|
30
31
|
Object.defineProperty(exports, "initEngine", { enumerable: true, get: function () { return loader_1.initEngine; } });
|
|
31
32
|
Object.defineProperty(exports, "initParser", { enumerable: true, get: function () { return loader_1.initParser; } });
|
|
32
33
|
Object.defineProperty(exports, "isParserReady", { enumerable: true, get: function () { return loader_1.isParserReady; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "0.15.
|
|
1
|
+
export declare const PACKAGE_VERSION = "0.15.2";
|
|
@@ -5,4 +5,4 @@ exports.PACKAGE_VERSION = void 0;
|
|
|
5
5
|
// scripts/build-packages.cjs (a source and its build sit at different depths
|
|
6
6
|
// beside package.json, so neither can require it by one relative path).
|
|
7
7
|
// __test__/language_version.unit.test.ts holds it equal to package.json.
|
|
8
|
-
exports.PACKAGE_VERSION = '0.15.
|
|
8
|
+
exports.PACKAGE_VERSION = '0.15.2';
|
package/dist/wasm/loader.d.ts
CHANGED
|
@@ -202,6 +202,15 @@ export declare function callLandingMisfits(inputJson: string): {
|
|
|
202
202
|
ok: boolean;
|
|
203
203
|
json: unknown;
|
|
204
204
|
};
|
|
205
|
+
/**
|
|
206
|
+
* An engine segment ended by V8's stack running out under it, which is not the
|
|
207
|
+
* engine crashing: nothing in it went wrong but how deep the movement went. The
|
|
208
|
+
* instance goes with it, as with a trap.
|
|
209
|
+
*/
|
|
210
|
+
export declare class EngineStackRanOut extends Error {
|
|
211
|
+
readonly call: string;
|
|
212
|
+
constructor(call: string);
|
|
213
|
+
}
|
|
205
214
|
/**
|
|
206
215
|
* One engine segment's conversation (crates/movement-engine/src/abi.rs):
|
|
207
216
|
* `start` and `answer` each return the next step as `{ok: true, json}` —
|
package/dist/wasm/loader.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
// Every instance imports `movement_env.call`: the environment services the
|
|
21
21
|
// engine asks JavaScript for mid-evaluation (env_services.ts).
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.MovementParserNotReady = void 0;
|
|
23
|
+
exports.EngineStackRanOut = exports.MovementParserNotReady = void 0;
|
|
24
24
|
exports.initParser = initParser;
|
|
25
25
|
exports.isParserReady = isParserReady;
|
|
26
26
|
exports.assertParserReady = assertParserReady;
|
|
@@ -295,6 +295,26 @@ function call(fn, inputs, extra) {
|
|
|
295
295
|
}
|
|
296
296
|
return statusReply(reply, `movement parser returned unknown status %s from ${fn}`);
|
|
297
297
|
}
|
|
298
|
+
/** What V8 throws through an instance when its own stack runs out. By its
|
|
299
|
+
* message, since the class is another realm's where a test runner's is (and
|
|
300
|
+
* an engine that words it otherwise, as Bun's does, reads as a crash). */
|
|
301
|
+
function isStackOverflow(error) {
|
|
302
|
+
return error instanceof Error && error.name === 'RangeError' && error.message === 'Maximum call stack size exceeded';
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* An engine segment ended by V8's stack running out under it, which is not the
|
|
306
|
+
* engine crashing: nothing in it went wrong but how deep the movement went. The
|
|
307
|
+
* instance goes with it, as with a trap.
|
|
308
|
+
*/
|
|
309
|
+
class EngineStackRanOut extends Error {
|
|
310
|
+
call;
|
|
311
|
+
constructor(call) {
|
|
312
|
+
super(`the movement engine ran out of stack in ${call}`);
|
|
313
|
+
this.call = call;
|
|
314
|
+
this.name = 'EngineStackRanOut';
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
exports.EngineStackRanOut = EngineStackRanOut;
|
|
298
318
|
/** A call that trapped; `detail` is the trap and the panic message, if any. */
|
|
299
319
|
class WasmTrap extends Error {
|
|
300
320
|
trapped;
|
|
@@ -382,6 +402,8 @@ function openEngineSegment() {
|
|
|
382
402
|
if (!(trap instanceof WasmTrap))
|
|
383
403
|
throw trap;
|
|
384
404
|
state = 'trapped';
|
|
405
|
+
if (isStackOverflow(trap.trapped))
|
|
406
|
+
throw new EngineStackRanOut(fn);
|
|
385
407
|
throw new Error(`movement engine crashed in ${fn}: ${trap.detail}`, { cause: trap.trapped });
|
|
386
408
|
}
|
|
387
409
|
};
|
|
@@ -389,9 +411,19 @@ function openEngineSegment() {
|
|
|
389
411
|
start: inputJson => step('engine_start', inputJson, (pairs, slots) => exports.start(...pairs, slots, slots + 4)),
|
|
390
412
|
answer: (id, answerJson) => step('engine_answer', answerJson, (pairs, slots) => exports.answer(id, ...pairs, slots, slots + 4)),
|
|
391
413
|
finish: () => {
|
|
392
|
-
|
|
393
|
-
exports.finish();
|
|
414
|
+
const open = state === 'open';
|
|
394
415
|
state = 'finished';
|
|
416
|
+
if (!open)
|
|
417
|
+
return;
|
|
418
|
+
try {
|
|
419
|
+
exports.finish();
|
|
420
|
+
}
|
|
421
|
+
catch (error) {
|
|
422
|
+
// Letting go of calls open as deep as the stack held. The instance is
|
|
423
|
+
// never used again, so what it did not get to goes with its memory.
|
|
424
|
+
if (!isStackOverflow(error))
|
|
425
|
+
throw error;
|
|
426
|
+
}
|
|
395
427
|
},
|
|
396
428
|
};
|
|
397
429
|
}
|
|
@@ -438,16 +470,20 @@ function newInstance(module) {
|
|
|
438
470
|
read ??= exportReader(raw, 'movement engine');
|
|
439
471
|
const exports = read;
|
|
440
472
|
let status = OK;
|
|
441
|
-
let
|
|
473
|
+
let bytes;
|
|
442
474
|
try {
|
|
443
475
|
const request = JSON.parse(decoder.decode(memoryBytes(exports).slice(requestPtr, requestPtr + requestLen)));
|
|
444
|
-
|
|
476
|
+
bytes = encoder.encode(JSON.stringify((0, env_services_1.answerEnvRequest)(request)));
|
|
445
477
|
}
|
|
446
478
|
catch (error) {
|
|
479
|
+
// Whatever the host's answer throws, its own stack overflow included
|
|
480
|
+
// (a service recursing on a deep value), is a failed answer. From in
|
|
481
|
+
// here the host's recursion cannot be told from the engine's frames
|
|
482
|
+
// having filled V8's stack; the engine's running out surfaces from its
|
|
483
|
+
// call, at the next frame that needs stack.
|
|
447
484
|
status = ERROR;
|
|
448
|
-
|
|
485
|
+
bytes = encoder.encode(JSON.stringify({ error: { message: error instanceof Error ? error.message : String(error) } }));
|
|
449
486
|
}
|
|
450
|
-
const bytes = encoder.encode(JSON.stringify(reply));
|
|
451
487
|
const ptr = exports.buffers.alloc(bytes.length);
|
|
452
488
|
memoryBytes(exports).set(bytes, ptr);
|
|
453
489
|
const view = new DataView(memoryBuffer(exports));
|
package/dist/wasm/movement.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@listen-fire/movement-lang",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.2",
|
|
5
5
|
"description": "The data-movement language: the wasm parser, checker and engine with their loader and bindings, the version rule, the expression AST and the types the contracts name",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=22.23.4 <23"
|