@ai-ecoverse/slicc-kernel 1.164.4 → 1.164.5
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 +2 -2
- package/dist/kernel-worker.js +1 -1
- package/dist/node-driver-worker.js +13 -2
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +14 -3
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +1 -1
- package/dist/process-worker.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -424,10 +424,10 @@ The module's default export (or its `main` export) is called with a context and
|
|
|
424
424
|
- `sync.promiseState(promise)` (#1531, slicc-jsh#974) tells a native promise's state synchronously, as Node's `util.inspect` does: `{ state: 'pending' | 'fulfilled' | 'rejected', value }`. `value` is the very fulfillment value or rejection reason (`undefined` while pending), and probing doesn't handle a rejection. On the Node entry it reads the promise through an inspector session the process worker opens on first use, one per process and per thread; the probe runs no program code. Anything that isn't a native promise (a thenable, a proxy) is a `TypeError`. It answers `undefined` in a browser, where a worker has no inspector, on a Node built without one, once a program has changed `Object.prototype` or put a `toJSON` on a built-in prototype, and when the global object can't take a new property (`Object.preventExtensions(globalThis)`, or a frozen global).
|
|
425
425
|
- `sync.setStackFormatter(fn | null)` (#1612, slicc-jsh#1091) is Node only, so check it with `typeof ctx.sync.setStackFormatter === 'function'`. It returns the previous formatter, and `null` removes it.
|
|
426
426
|
- **When `fn` runs:** it formats an error's `.stack` the way V8's prepare-stack-trace callback does, as `fn(error, callSites)` returning the string. It runs only when no own `Error.prepareStackTrace` function is set, as in Node, so `Error.prepareStackTrace` stays an ordinary property: after `delete` it's `undefined`, `Object.getPrototypeOf(Error)` stays `Function.prototype`, and an assignment to a frozen subclass throws in strict mode.
|
|
427
|
-
- **What `fn` gets:** a fresh array of V8 CallSites holding only the program's own frames (its modules, `data:` imports, `sync.runScript` scripts
|
|
427
|
+
- **What `fn` gets:** a fresh array of V8 CallSites holding only the program's own frames (its modules, `data:` imports, `sync.runScript` scripts, code they `eval`, and `new Function` or `eval` code named by `//# sourceURL`, #1632), `node:` frames and native frames. Kernel frames are dropped by script identity, so a script named like a kernel file doesn't let them through, and so are host files. A program's strict frames give `getFunction()` and `getThis()` as `undefined`.
|
|
428
428
|
- **Fallback:** if `fn` throws or returns a non-string, or an error is formatted while `fn` runs, the default stack is used.
|
|
429
429
|
- **How it works:** process workers start with `--expose-internals`, so the worker can install the formatter before the lockdown. Host flags a worker refuses are dropped. If the worker still can't start with the flag, the method is absent. Every `internal/*` and `node:internal/*` module stays refused to programs, as do `node:module` and `node:worker_threads`.
|
|
430
|
-
- `sync.errorSource(error)` (#1610, slicc-jsh#1082) is Node only, so check it with `typeof ctx.sync.errorSource === 'function'`. It gives `{ sourceLine, lineNumber, startColumn }` (null-prototype and frozen), the source line Node prints over an uncaught error, for an error in the program's own code. The kernel takes V8's position while the stack is formatted (#1633), so this also works after `.stack` was read, and for a call of a non-function, a ReferenceError, a TDZ error or a thrown `Error`. That includes a direct `eval` of a value that isn't a string literal (`const s = 'null.d'; eval(s)` gives `null.d` and line 1) and a `sync.runScript` script.
|
|
430
|
+
- `sync.errorSource(error)` (#1610, slicc-jsh#1082) is Node only, so check it with `typeof ctx.sync.errorSource === 'function'`. It gives `{ sourceLine, lineNumber, startColumn }` (null-prototype and frozen), the source line Node prints over an uncaught error, for an error in the program's own code. The kernel takes V8's position while the stack is formatted (#1633), so this also works after `.stack` was read, and for a call of a non-function, a ReferenceError, a TDZ error or a thrown `Error`. For code named by `//# sourceURL` it matches on that name (#1632). That includes a direct `eval` of a value that isn't a string literal (`const s = 'null.d'; eval(s)` gives `null.d` and line 1) and a `sync.runScript` script.
|
|
431
431
|
- **Only the program's own code:** it answers only when the error's top frame is a program frame and the position V8 kept is in that same script and line.
|
|
432
432
|
- **`undefined` cases:** kernel-made errors; values that aren't native errors; a script that borrows the kernel worker's name; and an error an own `Error.prepareStackTrace` formats.
|
|
433
433
|
- **How it works:** it reads V8's message through Node's internal errors binding, which the worker loads at start-up through the same `--expose-internals` as `setStackFormatter`. It prints no warning and needs no inspector.
|
package/dist/kernel-worker.js
CHANGED
|
@@ -8440,7 +8440,7 @@ function satisfies(version, range2) {
|
|
|
8440
8440
|
}
|
|
8441
8441
|
|
|
8442
8442
|
// src/version.ts
|
|
8443
|
-
var KERNEL_VERSION = true ? "1.164.
|
|
8443
|
+
var KERNEL_VERSION = true ? "1.164.5" : "0.0.0-dev";
|
|
8444
8444
|
var OS_RELEASE = "6.0.0-slicc";
|
|
8445
8445
|
function procVersion() {
|
|
8446
8446
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -1498,6 +1498,7 @@ var hashOf = proto.getScriptHash;
|
|
|
1498
1498
|
var isEval = proto.isEval;
|
|
1499
1499
|
var originOf = proto.getEvalOrigin;
|
|
1500
1500
|
var lineOf = proto.getLineNumber;
|
|
1501
|
+
var nameOf = proto.getScriptNameOrSourceURL;
|
|
1501
1502
|
var ownNames = /* @__PURE__ */ new Set([
|
|
1502
1503
|
apply(fileOf, self, []),
|
|
1503
1504
|
apply(proto.getScriptNameOrSourceURL, self, [])
|
|
@@ -1531,12 +1532,22 @@ function rootOrigin(origin) {
|
|
|
1531
1532
|
}
|
|
1532
1533
|
return apply(slice, at, [0, end]);
|
|
1533
1534
|
}
|
|
1535
|
+
function evalAt(origin) {
|
|
1536
|
+
return apply(startsWith, origin, ["eval at "]) === true;
|
|
1537
|
+
}
|
|
1538
|
+
function scriptOf(site) {
|
|
1539
|
+
if (apply(isEval, site, []) !== true) return apply(fileOf, site, []);
|
|
1540
|
+
const origin = apply(originOf, site, []);
|
|
1541
|
+
if (typeof origin !== "string" || evalAt(origin)) return void 0;
|
|
1542
|
+
return apply(nameOf, site, []);
|
|
1543
|
+
}
|
|
1534
1544
|
function keptFrame(site) {
|
|
1535
1545
|
const hash = apply(hashOf, site, []);
|
|
1536
1546
|
if (hash === ownHash) return false;
|
|
1537
1547
|
if (apply(isEval, site, []) === true) {
|
|
1538
1548
|
const origin = apply(originOf, site, []);
|
|
1539
|
-
|
|
1549
|
+
if (typeof origin !== "string") return false;
|
|
1550
|
+
return !evalAt(origin) || programName(rootOrigin(origin));
|
|
1540
1551
|
}
|
|
1541
1552
|
const file = apply(fileOf, site, []);
|
|
1542
1553
|
if (typeof file !== "string") return true;
|
|
@@ -1596,7 +1607,7 @@ function errorSourceOf(error) {
|
|
|
1596
1607
|
if (!at || typeof at.sourceLine !== "string" || typeof at.lineNumber !== "number")
|
|
1597
1608
|
return void 0;
|
|
1598
1609
|
if (apply(setHas, ownNames, [at.scriptResourceName]) === true) return void 0;
|
|
1599
|
-
const file =
|
|
1610
|
+
const file = scriptOf(site);
|
|
1600
1611
|
if (at.scriptResourceName !== file || apply(lineOf, site, []) !== at.lineNumber) return void 0;
|
|
1601
1612
|
const out = blank(null);
|
|
1602
1613
|
out.sourceLine = at.sourceLine;
|