@execbox/quickjs 0.2.1 → 0.4.0
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 +18 -4
- package/dist/index.cjs +543 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +543 -3
- package/dist/index.js.map +1 -1
- package/dist/processEntry.cjs +17 -0
- package/dist/processEntry.cjs.map +1 -0
- package/dist/processEntry.d.cts +5 -0
- package/dist/processEntry.d.ts +5 -0
- package/dist/processEntry.js +18 -0
- package/dist/processEntry.js.map +1 -0
- package/dist/protocolEndpoint-DGOUVf6J.cjs +147 -0
- package/dist/protocolEndpoint-DGOUVf6J.cjs.map +1 -0
- package/dist/protocolEndpoint-T_JEz8YY.js +142 -0
- package/dist/protocolEndpoint-T_JEz8YY.js.map +1 -0
- package/dist/runner/index.cjs +1 -1
- package/dist/runner/index.d.cts +10 -3
- package/dist/runner/index.d.cts.map +1 -1
- package/dist/runner/index.d.ts +10 -3
- package/dist/runner/index.d.ts.map +1 -1
- package/dist/runner/index.js +1 -1
- package/dist/runner/protocolEndpoint.cjs +3 -141
- package/dist/runner/protocolEndpoint.d.cts +1 -1
- package/dist/runner/protocolEndpoint.d.ts +1 -1
- package/dist/runner/protocolEndpoint.js +3 -141
- package/dist/{runner-CVaY4RVQ.js → runner-CteKTaPD.js} +28 -10
- package/dist/runner-CteKTaPD.js.map +1 -0
- package/dist/{runner-BqkDnP0t.cjs → runner-DRt0kpEk.cjs} +33 -9
- package/dist/{runner-CVaY4RVQ.js.map → runner-DRt0kpEk.cjs.map} +1 -1
- package/dist/types-BeVqrcj8.d.ts +71 -0
- package/dist/types-BeVqrcj8.d.ts.map +1 -0
- package/dist/types-CnNmLawC.d.cts +71 -0
- package/dist/types-CnNmLawC.d.cts.map +1 -0
- package/dist/workerEntry.cjs +19 -0
- package/dist/workerEntry.cjs.map +1 -0
- package/dist/workerEntry.d.cts +5 -0
- package/dist/workerEntry.d.ts +5 -0
- package/dist/workerEntry.js +20 -0
- package/dist/workerEntry.js.map +1 -0
- package/package.json +3 -4
- package/dist/runner/protocolEndpoint.cjs.map +0 -1
- package/dist/runner/protocolEndpoint.js.map +0 -1
- package/dist/runner-BqkDnP0t.cjs.map +0 -1
- package/dist/types-BXi8Lqtk.d.ts +0 -18
- package/dist/types-BXi8Lqtk.d.ts.map +0 -1
- package/dist/types-CVE2n2LY.d.cts +0 -18
- package/dist/types-CVE2n2LY.d.cts.map +0 -1
|
@@ -5288,6 +5288,30 @@ function isJsonSerializable(value, active = /* @__PURE__ */ new Set(), memo = /*
|
|
|
5288
5288
|
return false;
|
|
5289
5289
|
}
|
|
5290
5290
|
|
|
5291
|
+
//#endregion
|
|
5292
|
+
//#region ../core/src/runtimeOptions.ts
|
|
5293
|
+
/**
|
|
5294
|
+
* Default runtime limits shared across the built-in executor implementations.
|
|
5295
|
+
*/
|
|
5296
|
+
const DEFAULT_EXECUTOR_RUNTIME_OPTIONS = {
|
|
5297
|
+
maxLogChars: 64e3,
|
|
5298
|
+
maxLogLines: 100,
|
|
5299
|
+
memoryLimitBytes: 64 * 1024 * 1024,
|
|
5300
|
+
timeoutMs: 5e3
|
|
5301
|
+
};
|
|
5302
|
+
/**
|
|
5303
|
+
* Resolves executor runtime limits by applying explicit overrides on top of a
|
|
5304
|
+
* base options object and finally the shared defaults.
|
|
5305
|
+
*/
|
|
5306
|
+
function resolveExecutorRuntimeOptions(options = {}, overrides = {}) {
|
|
5307
|
+
return {
|
|
5308
|
+
maxLogChars: overrides.maxLogChars ?? options.maxLogChars ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogChars,
|
|
5309
|
+
maxLogLines: overrides.maxLogLines ?? options.maxLogLines ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.maxLogLines,
|
|
5310
|
+
memoryLimitBytes: overrides.memoryLimitBytes ?? options.memoryLimitBytes ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.memoryLimitBytes,
|
|
5311
|
+
timeoutMs: overrides.timeoutMs ?? options.timeoutMs ?? DEFAULT_EXECUTOR_RUNTIME_OPTIONS.timeoutMs
|
|
5312
|
+
};
|
|
5313
|
+
}
|
|
5314
|
+
|
|
5291
5315
|
//#endregion
|
|
5292
5316
|
//#region src/quickjsBridge.ts
|
|
5293
5317
|
/**
|
|
@@ -5347,10 +5371,6 @@ function toGuestHandle(context, value) {
|
|
|
5347
5371
|
* @packageDocumentation
|
|
5348
5372
|
* Public API for the `@execbox/quickjs/runner` entrypoint.
|
|
5349
5373
|
*/
|
|
5350
|
-
const DEFAULT_MEMORY_LIMIT_BYTES = 64 * 1024 * 1024;
|
|
5351
|
-
const DEFAULT_TIMEOUT_MS = 5e3;
|
|
5352
|
-
const DEFAULT_MAX_LOG_LINES = 100;
|
|
5353
|
-
const DEFAULT_MAX_LOG_CHARS = 64e3;
|
|
5354
5374
|
const loadDefaultModule = (0, quickjs_emscripten.memoizePromiseFactory)(() => (0, quickjs_emscripten.newQuickJSWASMModule)(quickjs_emscripten.RELEASE_SYNC));
|
|
5355
5375
|
/**
|
|
5356
5376
|
* Converts unexpected executor failures into stable public result errors.
|
|
@@ -5544,14 +5564,12 @@ function createToolHandle(context, providerName, safeToolName, signal, trustedHo
|
|
|
5544
5564
|
* Runs one QuickJS-backed execution session using a transport-neutral tool callback.
|
|
5545
5565
|
*/
|
|
5546
5566
|
async function runQuickJsSession(request, options = {}) {
|
|
5567
|
+
const runtimeOptions = resolveExecutorRuntimeOptions(options);
|
|
5547
5568
|
const loadModule = async () => {
|
|
5548
5569
|
if (options.module) return options.module;
|
|
5549
5570
|
return options.loadModule ? await options.loadModule() : await loadDefaultModule();
|
|
5550
5571
|
};
|
|
5551
|
-
const maxLogChars
|
|
5552
|
-
const maxLogLines = options.maxLogLines ?? DEFAULT_MAX_LOG_LINES;
|
|
5553
|
-
const memoryLimitBytes = options.memoryLimitBytes ?? DEFAULT_MEMORY_LIMIT_BYTES;
|
|
5554
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
5572
|
+
const { maxLogChars, maxLogLines, memoryLimitBytes, timeoutMs } = runtimeOptions;
|
|
5555
5573
|
const startedAt = Date.now();
|
|
5556
5574
|
const logs = [];
|
|
5557
5575
|
const abortController = new AbortController();
|
|
@@ -5674,10 +5692,16 @@ Object.defineProperty(exports, 'normalizeThrownMessage', {
|
|
|
5674
5692
|
return normalizeThrownMessage;
|
|
5675
5693
|
}
|
|
5676
5694
|
});
|
|
5695
|
+
Object.defineProperty(exports, 'resolveExecutorRuntimeOptions', {
|
|
5696
|
+
enumerable: true,
|
|
5697
|
+
get: function () {
|
|
5698
|
+
return resolveExecutorRuntimeOptions;
|
|
5699
|
+
}
|
|
5700
|
+
});
|
|
5677
5701
|
Object.defineProperty(exports, 'runQuickJsSession', {
|
|
5678
5702
|
enumerable: true,
|
|
5679
5703
|
get: function () {
|
|
5680
5704
|
return runQuickJsSession;
|
|
5681
5705
|
}
|
|
5682
5706
|
});
|
|
5683
|
-
//# sourceMappingURL=runner-
|
|
5707
|
+
//# sourceMappingURL=runner-DRt0kpEk.cjs.map
|