@ai-ecoverse/slicc-kernel 1.166.1 → 1.166.3
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 +1 -1
- package/dist/kernel-worker.js +1 -1
- package/dist/node-driver-worker.js +1 -1
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.cjs +20492 -0
- package/dist/node-process-worker.cjs.map +7 -0
- package/dist/node-process-worker.js +2 -2
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +92 -5
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/types/node/worker-boot.d.ts +15 -0
- package/dist/types/node.d.ts +1 -1
- package/package.json +3 -2
package/dist/node.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
import { lstatSync, mkdirSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { isAbsolute, join } from "node:path";
|
|
6
|
-
import { MessageChannel as
|
|
6
|
+
import { MessageChannel as MessageChannel3 } from "node:worker_threads";
|
|
7
7
|
|
|
8
8
|
// src/bytes.ts
|
|
9
9
|
function fresh(bytes, start2 = 0, end = bytes.length) {
|
|
@@ -3684,7 +3684,7 @@ function satisfies(version, range2) {
|
|
|
3684
3684
|
}
|
|
3685
3685
|
|
|
3686
3686
|
// src/version.ts
|
|
3687
|
-
var KERNEL_VERSION = true ? "1.166.
|
|
3687
|
+
var KERNEL_VERSION = true ? "1.166.3" : "0.0.0-dev";
|
|
3688
3688
|
var OS_RELEASE = "6.0.0-slicc";
|
|
3689
3689
|
function procVersion() {
|
|
3690
3690
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -34284,6 +34284,89 @@ function isMemoryRoot(handle) {
|
|
|
34284
34284
|
return handle instanceof MemoryDirectory;
|
|
34285
34285
|
}
|
|
34286
34286
|
|
|
34287
|
+
// src/node/worker-boot.ts
|
|
34288
|
+
import { readFileSync } from "node:fs";
|
|
34289
|
+
import { MessageChannel as MessageChannel2, Worker } from "node:worker_threads";
|
|
34290
|
+
var PROCESS_BOOT = `(async () => {
|
|
34291
|
+
'use strict';
|
|
34292
|
+
const { workerData } = require('node:worker_threads');
|
|
34293
|
+
const { compileFunction, constants } = require('node:vm');
|
|
34294
|
+
const { createRequire } = require('node:module');
|
|
34295
|
+
const loader = constants.USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
34296
|
+
const prime = () => {
|
|
34297
|
+
const emit = process.emitWarning;
|
|
34298
|
+
process.emitWarning = function (message, ...args) {
|
|
34299
|
+
if (message === 'vm.USE_MAIN_CONTEXT_DEFAULT_LOADER is an experimental feature and might change at any time' && args[0] === 'ExperimentalWarning') return;
|
|
34300
|
+
return Reflect.apply(emit, this, [message, ...args]);
|
|
34301
|
+
};
|
|
34302
|
+
try {
|
|
34303
|
+
return compileFunction('return import("node:vm")', [], { importModuleDynamically: loader })();
|
|
34304
|
+
} finally {
|
|
34305
|
+
process.emitWarning = emit;
|
|
34306
|
+
}
|
|
34307
|
+
};
|
|
34308
|
+
const { runEntryPointWithESMLoader } = require('internal/modules/run_main');
|
|
34309
|
+
await runEntryPointWithESMLoader(async () => { await prime(); });
|
|
34310
|
+
const { source: bytes, cachedData, port } = workerData.boot;
|
|
34311
|
+
delete workerData.boot;
|
|
34312
|
+
const source = new TextDecoder().decode(bytes);
|
|
34313
|
+
const run = compileFunction(source, ['require', 'importMetaUrl'], {
|
|
34314
|
+
filename: 'slicc-kernel:/node-process-worker.js',
|
|
34315
|
+
importModuleDynamically: loader,
|
|
34316
|
+
cachedData,
|
|
34317
|
+
produceCachedData: cachedData === undefined,
|
|
34318
|
+
});
|
|
34319
|
+
port.postMessage({ cachedData: run.cachedData, rejected: run.cachedDataRejected === true });
|
|
34320
|
+
port.close();
|
|
34321
|
+
run(createRequire('/slicc-kernel/node-process-worker.js'), '/slicc-kernel/node-process-worker.js');
|
|
34322
|
+
})();`;
|
|
34323
|
+
var bundles = /* @__PURE__ */ new Map();
|
|
34324
|
+
function bootCache(file, read = readFileSync) {
|
|
34325
|
+
let cache = bundles.get(file.href);
|
|
34326
|
+
if (!cache) {
|
|
34327
|
+
cache = {
|
|
34328
|
+
source: new TextEncoder().encode(read(file, "utf8")),
|
|
34329
|
+
attempts: 0,
|
|
34330
|
+
rejected: 0
|
|
34331
|
+
};
|
|
34332
|
+
bundles.set(file.href, cache);
|
|
34333
|
+
}
|
|
34334
|
+
return cache;
|
|
34335
|
+
}
|
|
34336
|
+
function cachedBoot(cache, data) {
|
|
34337
|
+
if (data.rejected) cache.rejected++;
|
|
34338
|
+
if (data.cachedData) cache.cachedData = data.cachedData;
|
|
34339
|
+
else if (data.rejected) cache.cachedData = void 0;
|
|
34340
|
+
}
|
|
34341
|
+
function bootWorker(file, options, bundle, make = (entry, init) => new Worker(entry, init), read = readFileSync) {
|
|
34342
|
+
if (!(file instanceof URL) || file.href !== bundle.href) return make(file, options);
|
|
34343
|
+
const cache = bootCache(file, read);
|
|
34344
|
+
const { port1, port2 } = new MessageChannel2();
|
|
34345
|
+
port1.once("message", (data) => {
|
|
34346
|
+
cachedBoot(cache, data);
|
|
34347
|
+
port1.close();
|
|
34348
|
+
});
|
|
34349
|
+
port1.unref();
|
|
34350
|
+
if (cache.cachedData) cache.attempts++;
|
|
34351
|
+
try {
|
|
34352
|
+
const worker = make(PROCESS_BOOT, {
|
|
34353
|
+
...options,
|
|
34354
|
+
eval: true,
|
|
34355
|
+
workerData: {
|
|
34356
|
+
...options.workerData,
|
|
34357
|
+
boot: { source: cache.source, cachedData: cache.cachedData, port: port2 }
|
|
34358
|
+
},
|
|
34359
|
+
transferList: [port2]
|
|
34360
|
+
});
|
|
34361
|
+
worker.once("exit", () => port1.close());
|
|
34362
|
+
return worker;
|
|
34363
|
+
} catch (err) {
|
|
34364
|
+
port1.close();
|
|
34365
|
+
port2.close();
|
|
34366
|
+
throw err;
|
|
34367
|
+
}
|
|
34368
|
+
}
|
|
34369
|
+
|
|
34287
34370
|
// src/node/ws-diagnose.ts
|
|
34288
34371
|
import { lookup as lookup3 } from "node:dns/promises";
|
|
34289
34372
|
import { isIP as isIP4, connect as tcp } from "node:net";
|
|
@@ -35383,7 +35466,11 @@ function resetInternalArgv() {
|
|
|
35383
35466
|
internalArgv = void 0;
|
|
35384
35467
|
}
|
|
35385
35468
|
function processWorker(file, workerData, internals = false) {
|
|
35386
|
-
const make = (execArgv) =>
|
|
35469
|
+
const make = (execArgv) => bootWorker(
|
|
35470
|
+
file,
|
|
35471
|
+
{ env: workerEnv(), ...workerData ? { workerData } : {}, execArgv },
|
|
35472
|
+
new URL("./node-process-worker.cjs", import.meta.url)
|
|
35473
|
+
);
|
|
35387
35474
|
return internals ? internalsWorker(make) : make();
|
|
35388
35475
|
}
|
|
35389
35476
|
function sourceModule(source) {
|
|
@@ -35544,7 +35631,7 @@ function pidAlive(pid) {
|
|
|
35544
35631
|
var nodeSessions = 0;
|
|
35545
35632
|
function nodeClient(launcher, clients, { user, tag, requests }) {
|
|
35546
35633
|
tagOption(tag);
|
|
35547
|
-
const { port1, port2 } = new
|
|
35634
|
+
const { port1, port2 } = new MessageChannel3();
|
|
35548
35635
|
const session = ++nodeSessions;
|
|
35549
35636
|
const served2 = serveClient(port1, {
|
|
35550
35637
|
launcher: async () => launcher,
|
|
@@ -35574,7 +35661,7 @@ async function createNodeKernel(options = {}) {
|
|
|
35574
35661
|
const pending = /* @__PURE__ */ new Set();
|
|
35575
35662
|
const clients = /* @__PURE__ */ new Set();
|
|
35576
35663
|
let terminated = false;
|
|
35577
|
-
const file = options.worker ?? new URL("./node-process-worker.
|
|
35664
|
+
const file = options.worker ?? new URL("./node-process-worker.cjs", import.meta.url);
|
|
35578
35665
|
const cache = cacheDirOf(options.compileCache);
|
|
35579
35666
|
const workerData = cacheData(cache);
|
|
35580
35667
|
const warm = warmPoolOf(options, file, workerData, live);
|