poe-code 13.0.1 → 13.0.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 +26 -5
- package/dist/index.js +236 -99
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-js/dist/chunks/{chunk-DALBPQDZ.js → chunk-73LWNNUG.js} +227 -98
- package/packages/safe-js/dist/chunks/{chunk-DALBPQDZ.js.map → chunk-73LWNNUG.js.map} +4 -4
- package/packages/safe-js/dist/chunks/{chunk-EL23VF23.js → chunk-QCJ7UAMC.js} +2 -2
- package/packages/safe-js/dist/cli.js +2 -2
- package/packages/safe-js/dist/core.js +1 -1
- package/packages/safe-js/dist/index.js +2 -2
- package/packages/safe-js/dist/interp/globals/object-array.js +2 -7
- package/packages/safe-js/dist/interp/interpreter.js +1 -0
- package/packages/safe-js/dist/interp/methods/array.js +136 -71
- package/packages/safe-js/dist/interp/string-coercion.d.ts +3 -0
- package/packages/safe-js/dist/interp/string-coercion.js +89 -0
- package/packages/safe-js/dist/interp/values.d.ts +1 -0
- /package/packages/safe-js/dist/chunks/{chunk-EL23VF23.js.map → chunk-QCJ7UAMC.js.map} +0 -0
package/README.md
CHANGED
|
@@ -263,9 +263,9 @@ Uses `POE_API_KEY` or the stored credential and honors `POE_BASE_URL`. Throws an
|
|
|
263
263
|
|
|
264
264
|
### Shared filesystem foundation
|
|
265
265
|
|
|
266
|
-
`poe-code@
|
|
266
|
+
`poe-code@13.0.0` publishes the Node.js foundation at `poe-code/safe-fs`
|
|
267
267
|
and shared filesystem integration for the SafeJS SDK and both CLIs.
|
|
268
|
-
The installed release was verified on Node 18.18.2, 18.20.8, 20.20.0,
|
|
268
|
+
The installed release was verified on Node 18.18.2, 18.20.8, 20.19.2, 20.20.0,
|
|
269
269
|
22.22.2 and 24.14.0, including public runtime and TypeScript consumers.
|
|
270
270
|
`@poe-code/safe-fs` is the private workspace name, not a public npm import.
|
|
271
271
|
|
|
@@ -280,8 +280,8 @@ const filesystem = new MemoryFileSystem();
|
|
|
280
280
|
await filesystem.writeFile("/note", new TextEncoder().encode("hello"));
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
Canonical SafeJS names shipped in `poe-code@12.0.8` and were reverified in
|
|
284
|
+
`13.0.0`. SafeJS accepts these adapters through
|
|
285
285
|
`makeFsModule({ adapter, root?, cwd?, signal? })`
|
|
286
286
|
from `poe-code/safe-js`. The legacy `poe-code/safejs` routes and `poe-safejs` binary
|
|
287
287
|
remain aliases to the identical canonical artifacts. Both `poe-safe-js` and `poe-code harness run` accept
|
|
@@ -290,7 +290,7 @@ legacy `--fs` and `--fs-root` options retain their Node-backed behavior.
|
|
|
290
290
|
|
|
291
291
|
The default public entries target Node.js. Full browser runtime support,
|
|
292
292
|
safe-bash runtime migration and removal of legacy adapter copies remain pending. Canonical and legacy
|
|
293
|
-
SafeJS names share
|
|
293
|
+
SafeJS names share the same published artifacts.
|
|
294
294
|
The host-directory adapter is not race-proof OS isolation. See the
|
|
295
295
|
[foundation documentation](packages/safe-fs/README.md) for configuration,
|
|
296
296
|
capabilities and backend limitations.
|
|
@@ -318,6 +318,27 @@ in both pages and module workers on Chromium 149.0.7827.55, Firefox 150.0.2 and
|
|
|
318
318
|
Playwright WebKit 26.4: 102 checks total, plus 11 negative browser-graph cases
|
|
319
319
|
and 20 strict browser type profiles. This is FS-only coverage, not Safari
|
|
320
320
|
certification, browser SafeJS execution or coverage of unreleased guest codecs.
|
|
321
|
+
Those earlier checks did not establish WebDAV request-stream transport support.
|
|
322
|
+
|
|
323
|
+
#### WebDAV streaming migration in 13.0.0
|
|
324
|
+
|
|
325
|
+
Custom or bound Fetch functions must now declare `requestStreamSupport`:
|
|
326
|
+
`"native"` for faithful current-realm native delegation, `true` for a trusted
|
|
327
|
+
custom transport that preserves and consumes stream bodies, or `false` to
|
|
328
|
+
disable streaming. Exact `globalThis.fetch` is probed automatically. Unknown
|
|
329
|
+
transports reject with `ENOTSUP` before source acquisition or any DAV I/O;
|
|
330
|
+
ordinary byte writes are unchanged. This is a programmatic adapter option,
|
|
331
|
+
not a new environment variable, CLI flag or JSON configuration field. `true`
|
|
332
|
+
is a host assertion, not protection against a dishonest transport.
|
|
333
|
+
|
|
334
|
+
The actual `13.0.0` registry artifact passed 50 native Node HTTP controls and
|
|
335
|
+
390 browser assertions across Chromium, Firefox and WebKit pages and workers,
|
|
336
|
+
including 134 zero-source/no-I/O cases. Native Firefox/WebKit streaming safely
|
|
337
|
+
rejects; genuine Chromium HTTP/2 streaming passes in the exercised deployment.
|
|
338
|
+
Native Chromium HTTP/1 streaming remains unsupported. These are bounded FS
|
|
339
|
+
transport results, not certification of every server or a browser SafeJS SDK.
|
|
340
|
+
See the [WebDAV contract](packages/safe-fs/README.md#breaking-change-declare-custom-request-stream-support)
|
|
341
|
+
and [release record](docs/plans/webdav-stream-capability-fix.md#verified-1300-publication--august-30-2026).
|
|
321
342
|
|
|
322
343
|
Full browser SafeJS SDK/runtime support remains pending. Guest codec integration,
|
|
323
344
|
portable SDK declaration closure and shared host-call policy/replay metadata
|
package/dist/index.js
CHANGED
|
@@ -138898,14 +138898,6 @@ function enterRunningState(object) {
|
|
|
138898
138898
|
runningObjects.delete(object);
|
|
138899
138899
|
};
|
|
138900
138900
|
}
|
|
138901
|
-
function enterCollectionCallback(object) {
|
|
138902
|
-
const leaveRunning = enterRunningState(object);
|
|
138903
|
-
lockedCollections.add(object);
|
|
138904
|
-
return () => {
|
|
138905
|
-
lockedCollections.delete(object);
|
|
138906
|
-
leaveRunning();
|
|
138907
|
-
};
|
|
138908
|
-
}
|
|
138909
138901
|
function assertCollectionMutable(object) {
|
|
138910
138902
|
if (lockedCollections.has(object)) {
|
|
138911
138903
|
throw new SandboxError("reentry");
|
|
@@ -143225,6 +143217,93 @@ var init_misc = __esm({
|
|
|
143225
143217
|
}
|
|
143226
143218
|
});
|
|
143227
143219
|
|
|
143220
|
+
// packages/safe-js/src/interp/string-coercion.ts
|
|
143221
|
+
function sandboxString(value, budget, context, joining = /* @__PURE__ */ new Set()) {
|
|
143222
|
+
if (value === null || typeof value !== "object") {
|
|
143223
|
+
if (typeof value === "function") throw new TypeError("Expected a sandbox value.");
|
|
143224
|
+
return budget.allocateString(String(value));
|
|
143225
|
+
}
|
|
143226
|
+
return stringifyObject2(value, budget, context, joining);
|
|
143227
|
+
}
|
|
143228
|
+
async function stringifyObject2(value, budget, context, joining) {
|
|
143229
|
+
const leaveCall = budget.enterCall();
|
|
143230
|
+
try {
|
|
143231
|
+
budget.visitNode();
|
|
143232
|
+
for (const name of ["toString", "valueOf"]) {
|
|
143233
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, name);
|
|
143234
|
+
let result;
|
|
143235
|
+
if (descriptor === void 0) {
|
|
143236
|
+
if (name === "valueOf") continue;
|
|
143237
|
+
result = await defaultToString(value, budget, context, joining);
|
|
143238
|
+
} else {
|
|
143239
|
+
const hook = ownDataValue(value, name);
|
|
143240
|
+
if (!isSandboxClosure(hook)) continue;
|
|
143241
|
+
if (context?.invokeClosure === void 0) {
|
|
143242
|
+
throw new TypeError("String hooks require a sandbox call context.");
|
|
143243
|
+
}
|
|
143244
|
+
result = await context.invokeClosure(hook, [], value);
|
|
143245
|
+
}
|
|
143246
|
+
if (result === null || typeof result !== "object") {
|
|
143247
|
+
return sandboxString(result, budget, context, joining);
|
|
143248
|
+
}
|
|
143249
|
+
}
|
|
143250
|
+
throw new TypeError("Cannot convert object to primitive value");
|
|
143251
|
+
} finally {
|
|
143252
|
+
leaveCall();
|
|
143253
|
+
}
|
|
143254
|
+
}
|
|
143255
|
+
async function defaultToString(value, budget, context, joining) {
|
|
143256
|
+
if (Array.isArray(value) || isFloat32Array(value)) {
|
|
143257
|
+
if (Object.hasOwn(value, "join")) {
|
|
143258
|
+
const join21 = ownDataValue(value, "join");
|
|
143259
|
+
if (!isSandboxClosure(join21))
|
|
143260
|
+
return isFloat32Array(value) ? "[object Float32Array]" : "[object Array]";
|
|
143261
|
+
if (context?.invokeClosure === void 0) {
|
|
143262
|
+
throw new TypeError("String hooks require a sandbox call context.");
|
|
143263
|
+
}
|
|
143264
|
+
return context.invokeClosure(join21, [], value);
|
|
143265
|
+
}
|
|
143266
|
+
if (joining.has(value)) return "";
|
|
143267
|
+
joining.add(value);
|
|
143268
|
+
try {
|
|
143269
|
+
const length = isFloat32Array(value) ? float32Storage(value).length : value.length;
|
|
143270
|
+
let text5 = "";
|
|
143271
|
+
for (let index = 0; index < length; index++) {
|
|
143272
|
+
budget.visitNode();
|
|
143273
|
+
const element = ownDataValue(value, String(index));
|
|
143274
|
+
const part = element === null || element === void 0 ? "" : await sandboxString(element, budget, context, joining);
|
|
143275
|
+
text5 = budget.allocateString(text5 + (index === 0 ? "" : ",") + part);
|
|
143276
|
+
}
|
|
143277
|
+
return text5;
|
|
143278
|
+
} finally {
|
|
143279
|
+
joining.delete(value);
|
|
143280
|
+
}
|
|
143281
|
+
}
|
|
143282
|
+
if (sandboxErrorTypes.has(value)) {
|
|
143283
|
+
const nameValue = ownDataValue(value, "name");
|
|
143284
|
+
const name = nameValue === void 0 ? "Error" : await sandboxString(nameValue, budget, context, joining);
|
|
143285
|
+
const messageValue2 = ownDataValue(value, "message");
|
|
143286
|
+
const message2 = messageValue2 === void 0 ? "" : await sandboxString(messageValue2, budget, context, joining);
|
|
143287
|
+
return name === "" ? message2 : message2 === "" ? name : `${name}: ${message2}`;
|
|
143288
|
+
}
|
|
143289
|
+
return isSandboxPromise(value) ? "[object Promise]" : "[object Object]";
|
|
143290
|
+
}
|
|
143291
|
+
function ownDataValue(value, name) {
|
|
143292
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, name);
|
|
143293
|
+
if (descriptor !== void 0 && !Object.hasOwn(descriptor, "value")) {
|
|
143294
|
+
throw new TypeError("String conversion requires sandbox data properties.");
|
|
143295
|
+
}
|
|
143296
|
+
return descriptor?.value;
|
|
143297
|
+
}
|
|
143298
|
+
var init_string_coercion = __esm({
|
|
143299
|
+
"packages/safe-js/src/interp/string-coercion.ts"() {
|
|
143300
|
+
"use strict";
|
|
143301
|
+
init_shape();
|
|
143302
|
+
init_float32();
|
|
143303
|
+
init_values();
|
|
143304
|
+
}
|
|
143305
|
+
});
|
|
143306
|
+
|
|
143228
143307
|
// packages/safe-js/src/interp/globals/object-array.ts
|
|
143229
143308
|
function createObjectArrayGlobals(options) {
|
|
143230
143309
|
return {
|
|
@@ -143320,9 +143399,7 @@ function createObjectArrayGlobals(options) {
|
|
|
143320
143399
|
}),
|
|
143321
143400
|
String: createSandboxClosure({
|
|
143322
143401
|
sandbox: true,
|
|
143323
|
-
call: (
|
|
143324
|
-
typeof value === "object" && value !== null && sandboxErrorTypes.has(value) && !Object.hasOwn(value, "toString") ? Error.prototype.toString.call(value) : String(value)
|
|
143325
|
-
),
|
|
143402
|
+
call: (args, context) => sandboxString(args.length === 0 ? "" : args[0], options.budget, context),
|
|
143326
143403
|
name: "String",
|
|
143327
143404
|
properties: {
|
|
143328
143405
|
raw: createSandboxClosure({
|
|
@@ -143538,10 +143615,10 @@ function getTemplateRawParts(template2) {
|
|
|
143538
143615
|
var init_object_array = __esm({
|
|
143539
143616
|
"packages/safe-js/src/interp/globals/object-array.ts"() {
|
|
143540
143617
|
"use strict";
|
|
143541
|
-
init_shape();
|
|
143542
143618
|
init_float32();
|
|
143543
143619
|
init_float32array2();
|
|
143544
143620
|
init_iteration();
|
|
143621
|
+
init_string_coercion();
|
|
143545
143622
|
init_values();
|
|
143546
143623
|
}
|
|
143547
143624
|
});
|
|
@@ -143584,7 +143661,7 @@ async function callArrayMethod(value, methodName, args, options, stack = []) {
|
|
|
143584
143661
|
if (isCallbackArrayMethod(methodName)) {
|
|
143585
143662
|
let callbackState = activeArrayCallbacks.get(value);
|
|
143586
143663
|
if (callbackState === void 0) {
|
|
143587
|
-
callbackState = { depth: 0, leave:
|
|
143664
|
+
callbackState = { depth: 0, leave: enterRunningState(value) };
|
|
143588
143665
|
activeArrayCallbacks.set(value, callbackState);
|
|
143589
143666
|
}
|
|
143590
143667
|
callbackState.depth += 1;
|
|
@@ -143835,42 +143912,63 @@ function getRequiredCallback(methodName, value) {
|
|
|
143835
143912
|
async function mapArray(value, callback, options, stack, thisValue) {
|
|
143836
143913
|
const length = value.length;
|
|
143837
143914
|
const result = new Array(length);
|
|
143838
|
-
|
|
143839
|
-
|
|
143840
|
-
|
|
143915
|
+
options.budget.setRetainedValues(result, () => [result]);
|
|
143916
|
+
try {
|
|
143917
|
+
for (let index = 0; index < length; index += 1) {
|
|
143918
|
+
options.budget.visitNode();
|
|
143919
|
+
if (!(index in value)) {
|
|
143920
|
+
continue;
|
|
143921
|
+
}
|
|
143922
|
+
result[index] = await callArrayCallback(
|
|
143923
|
+
callback,
|
|
143924
|
+
value[index],
|
|
143925
|
+
index,
|
|
143926
|
+
value,
|
|
143927
|
+
options,
|
|
143928
|
+
stack,
|
|
143929
|
+
thisValue
|
|
143930
|
+
);
|
|
143841
143931
|
}
|
|
143842
|
-
result
|
|
143843
|
-
|
|
143844
|
-
|
|
143845
|
-
index,
|
|
143846
|
-
value,
|
|
143847
|
-
options,
|
|
143848
|
-
stack,
|
|
143849
|
-
thisValue
|
|
143850
|
-
);
|
|
143932
|
+
return result;
|
|
143933
|
+
} finally {
|
|
143934
|
+
options.budget.setRetainedValues(result, void 0);
|
|
143851
143935
|
}
|
|
143852
|
-
return result;
|
|
143853
143936
|
}
|
|
143854
143937
|
async function filterArray(value, callback, options, stack, thisValue) {
|
|
143855
143938
|
const length = value.length;
|
|
143856
143939
|
const result = [];
|
|
143857
|
-
|
|
143858
|
-
|
|
143859
|
-
|
|
143860
|
-
|
|
143861
|
-
|
|
143862
|
-
|
|
143940
|
+
options.budget.setRetainedValues(result, () => [result]);
|
|
143941
|
+
try {
|
|
143942
|
+
for (let index = 0; index < length; index += 1) {
|
|
143943
|
+
options.budget.visitNode();
|
|
143944
|
+
if (!(index in value)) {
|
|
143945
|
+
continue;
|
|
143946
|
+
}
|
|
143947
|
+
const entry = value[index];
|
|
143948
|
+
if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
|
|
143949
|
+
result.push(entry);
|
|
143950
|
+
}
|
|
143863
143951
|
}
|
|
143952
|
+
return result;
|
|
143953
|
+
} finally {
|
|
143954
|
+
options.budget.setRetainedValues(result, void 0);
|
|
143864
143955
|
}
|
|
143865
|
-
return result;
|
|
143866
143956
|
}
|
|
143867
143957
|
async function findInArray(value, callback, options, stack, thisValue) {
|
|
143868
|
-
const
|
|
143869
|
-
|
|
143958
|
+
const length = value.length;
|
|
143959
|
+
for (let index = 0; index < length; index += 1) {
|
|
143960
|
+
options.budget.visitNode();
|
|
143961
|
+
const entry = index in value ? value[index] : void 0;
|
|
143962
|
+
if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
|
|
143963
|
+
return entry;
|
|
143964
|
+
}
|
|
143965
|
+
}
|
|
143966
|
+
return void 0;
|
|
143870
143967
|
}
|
|
143871
143968
|
async function findIndexInArray(value, callback, options, stack, thisValue) {
|
|
143872
143969
|
const length = value.length;
|
|
143873
143970
|
for (let index = 0; index < length; index += 1) {
|
|
143971
|
+
options.budget.visitNode();
|
|
143874
143972
|
const entry = index in value ? value[index] : void 0;
|
|
143875
143973
|
if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
|
|
143876
143974
|
return index;
|
|
@@ -143881,6 +143979,7 @@ async function findIndexInArray(value, callback, options, stack, thisValue) {
|
|
|
143881
143979
|
async function findLastInArray(value, callback, options, stack, thisValue) {
|
|
143882
143980
|
const length = value.length;
|
|
143883
143981
|
for (let index = length - 1; index >= 0; index -= 1) {
|
|
143982
|
+
options.budget.visitNode();
|
|
143884
143983
|
const entry = index in value ? value[index] : void 0;
|
|
143885
143984
|
if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
|
|
143886
143985
|
return entry;
|
|
@@ -143891,6 +143990,7 @@ async function findLastInArray(value, callback, options, stack, thisValue) {
|
|
|
143891
143990
|
async function findLastIndexInArray(value, callback, options, stack, thisValue) {
|
|
143892
143991
|
const length = value.length;
|
|
143893
143992
|
for (let index = length - 1; index >= 0; index -= 1) {
|
|
143993
|
+
options.budget.visitNode();
|
|
143894
143994
|
const entry = index in value ? value[index] : void 0;
|
|
143895
143995
|
if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
|
|
143896
143996
|
return index;
|
|
@@ -143901,6 +144001,7 @@ async function findLastIndexInArray(value, callback, options, stack, thisValue)
|
|
|
143901
144001
|
async function someInArray(value, callback, options, stack, thisValue) {
|
|
143902
144002
|
const length = value.length;
|
|
143903
144003
|
for (let index = 0; index < length; index += 1) {
|
|
144004
|
+
options.budget.visitNode();
|
|
143904
144005
|
if (!(index in value)) {
|
|
143905
144006
|
continue;
|
|
143906
144007
|
}
|
|
@@ -143913,6 +144014,7 @@ async function someInArray(value, callback, options, stack, thisValue) {
|
|
|
143913
144014
|
async function everyInArray(value, callback, options, stack, thisValue) {
|
|
143914
144015
|
const length = value.length;
|
|
143915
144016
|
for (let index = 0; index < length; index += 1) {
|
|
144017
|
+
options.budget.visitNode();
|
|
143916
144018
|
if (!(index in value)) {
|
|
143917
144019
|
continue;
|
|
143918
144020
|
}
|
|
@@ -143924,10 +144026,10 @@ async function everyInArray(value, callback, options, stack, thisValue) {
|
|
|
143924
144026
|
}
|
|
143925
144027
|
async function reduceArray(value, callback, hasInitialValue, initialValue, options, stack) {
|
|
143926
144028
|
const length = value.length;
|
|
143927
|
-
const start = findNextDefinedIndex(value, 0, 1, length);
|
|
143928
144029
|
if (hasInitialValue) {
|
|
143929
|
-
return reduceFromLeft(value, callback, initialValue,
|
|
144030
|
+
return reduceFromLeft(value, callback, initialValue, 0, length, options, stack);
|
|
143930
144031
|
}
|
|
144032
|
+
const start = findNextDefinedIndex(value, 0, 1, length, options.budget);
|
|
143931
144033
|
if (start < 0) {
|
|
143932
144034
|
throw new TypeError("Reduce of empty array with no initial value.");
|
|
143933
144035
|
}
|
|
@@ -143935,10 +144037,10 @@ async function reduceArray(value, callback, hasInitialValue, initialValue, optio
|
|
|
143935
144037
|
}
|
|
143936
144038
|
async function reduceRightArray(value, callback, hasInitialValue, initialValue, options, stack) {
|
|
143937
144039
|
const length = value.length;
|
|
143938
|
-
const start = findNextDefinedIndex(value, length - 1, -1, length);
|
|
143939
144040
|
if (hasInitialValue) {
|
|
143940
|
-
return reduceFromRight(value, callback, initialValue,
|
|
144041
|
+
return reduceFromRight(value, callback, initialValue, length - 1, length, options, stack);
|
|
143941
144042
|
}
|
|
144043
|
+
const start = findNextDefinedIndex(value, length - 1, -1, length, options.budget);
|
|
143942
144044
|
if (start < 0) {
|
|
143943
144045
|
throw new TypeError("Reduce of empty array with no initial value.");
|
|
143944
144046
|
}
|
|
@@ -143946,27 +144048,42 @@ async function reduceRightArray(value, callback, hasInitialValue, initialValue,
|
|
|
143946
144048
|
}
|
|
143947
144049
|
async function reduceFromLeft(value, callback, accumulator, startIndex, length, options, stack) {
|
|
143948
144050
|
let current = accumulator;
|
|
143949
|
-
|
|
143950
|
-
|
|
143951
|
-
|
|
144051
|
+
const retainedAccumulator = {};
|
|
144052
|
+
options.budget.setRetainedValues(retainedAccumulator, () => [current]);
|
|
144053
|
+
try {
|
|
144054
|
+
for (let index = startIndex; index < length; index += 1) {
|
|
144055
|
+
options.budget.visitNode();
|
|
144056
|
+
if (!(index in value)) {
|
|
144057
|
+
continue;
|
|
144058
|
+
}
|
|
144059
|
+
current = await options.callClosure(callback, [current, value[index], index, value], stack);
|
|
143952
144060
|
}
|
|
143953
|
-
|
|
144061
|
+
return current;
|
|
144062
|
+
} finally {
|
|
144063
|
+
options.budget.setRetainedValues(retainedAccumulator, void 0);
|
|
143954
144064
|
}
|
|
143955
|
-
return current;
|
|
143956
144065
|
}
|
|
143957
144066
|
async function reduceFromRight(value, callback, accumulator, startIndex, length, options, stack) {
|
|
143958
144067
|
let current = accumulator;
|
|
143959
|
-
|
|
143960
|
-
|
|
143961
|
-
|
|
144068
|
+
const retainedAccumulator = {};
|
|
144069
|
+
options.budget.setRetainedValues(retainedAccumulator, () => [current]);
|
|
144070
|
+
try {
|
|
144071
|
+
for (let index = Math.min(startIndex, length - 1); index >= 0; index -= 1) {
|
|
144072
|
+
options.budget.visitNode();
|
|
144073
|
+
if (!(index in value)) {
|
|
144074
|
+
continue;
|
|
144075
|
+
}
|
|
144076
|
+
current = await options.callClosure(callback, [current, value[index], index, value], stack);
|
|
143962
144077
|
}
|
|
143963
|
-
|
|
144078
|
+
return current;
|
|
144079
|
+
} finally {
|
|
144080
|
+
options.budget.setRetainedValues(retainedAccumulator, void 0);
|
|
143964
144081
|
}
|
|
143965
|
-
return current;
|
|
143966
144082
|
}
|
|
143967
144083
|
async function forEachArray(value, callback, options, stack, thisValue) {
|
|
143968
144084
|
const length = value.length;
|
|
143969
144085
|
for (let index = 0; index < length; index += 1) {
|
|
144086
|
+
options.budget.visitNode();
|
|
143970
144087
|
if (!(index in value)) {
|
|
143971
144088
|
continue;
|
|
143972
144089
|
}
|
|
@@ -143976,33 +144093,40 @@ async function forEachArray(value, callback, options, stack, thisValue) {
|
|
|
143976
144093
|
async function flatMapArray(value, callback, options, stack, thisValue) {
|
|
143977
144094
|
const length = value.length;
|
|
143978
144095
|
const result = [];
|
|
143979
|
-
|
|
143980
|
-
|
|
143981
|
-
|
|
143982
|
-
|
|
143983
|
-
|
|
143984
|
-
|
|
143985
|
-
|
|
143986
|
-
|
|
143987
|
-
|
|
143988
|
-
|
|
143989
|
-
|
|
143990
|
-
|
|
143991
|
-
|
|
143992
|
-
|
|
143993
|
-
|
|
143994
|
-
|
|
143995
|
-
|
|
144096
|
+
options.budget.setRetainedValues(result, () => [result]);
|
|
144097
|
+
try {
|
|
144098
|
+
for (let index = 0; index < length; index += 1) {
|
|
144099
|
+
options.budget.visitNode();
|
|
144100
|
+
if (!(index in value)) {
|
|
144101
|
+
continue;
|
|
144102
|
+
}
|
|
144103
|
+
const mapped = await callArrayCallback(
|
|
144104
|
+
callback,
|
|
144105
|
+
value[index],
|
|
144106
|
+
index,
|
|
144107
|
+
value,
|
|
144108
|
+
options,
|
|
144109
|
+
stack,
|
|
144110
|
+
thisValue
|
|
144111
|
+
);
|
|
144112
|
+
if (Array.isArray(mapped)) {
|
|
144113
|
+
for (let mappedIndex = 0; mappedIndex < mapped.length; mappedIndex += 1) {
|
|
144114
|
+
options.budget.visitNode();
|
|
144115
|
+
if (!(mappedIndex in mapped)) {
|
|
144116
|
+
continue;
|
|
144117
|
+
}
|
|
144118
|
+
result.push(mapped[mappedIndex]);
|
|
144119
|
+
options.budget.allocateArrayLength(result.length);
|
|
143996
144120
|
}
|
|
143997
|
-
|
|
143998
|
-
options.budget.allocateArrayLength(result.length);
|
|
144121
|
+
continue;
|
|
143999
144122
|
}
|
|
144000
|
-
|
|
144123
|
+
result.push(mapped);
|
|
144124
|
+
options.budget.allocateArrayLength(result.length);
|
|
144001
144125
|
}
|
|
144002
|
-
result
|
|
144003
|
-
|
|
144126
|
+
return result;
|
|
144127
|
+
} finally {
|
|
144128
|
+
options.budget.setRetainedValues(result, void 0);
|
|
144004
144129
|
}
|
|
144005
|
-
return result;
|
|
144006
144130
|
}
|
|
144007
144131
|
function flattenArray(value, depth, budget) {
|
|
144008
144132
|
const result = [];
|
|
@@ -144024,47 +144148,59 @@ function appendFlattenedEntries(value, depth, result, budget) {
|
|
|
144024
144148
|
}
|
|
144025
144149
|
}
|
|
144026
144150
|
async function sortArray(value, comparator, options, stack) {
|
|
144151
|
+
const length = value.length;
|
|
144027
144152
|
const definedValues = [];
|
|
144028
144153
|
let undefinedCount = 0;
|
|
144029
|
-
|
|
144030
|
-
|
|
144031
|
-
|
|
144154
|
+
let currentEntry;
|
|
144155
|
+
options.budget.setRetainedValues(definedValues, () => [definedValues, currentEntry]);
|
|
144156
|
+
try {
|
|
144157
|
+
for (let index = 0; index < length; index += 1) {
|
|
144158
|
+
options.budget.visitNode();
|
|
144159
|
+
if (!(index in value)) {
|
|
144160
|
+
continue;
|
|
144161
|
+
}
|
|
144162
|
+
const entry = value[index];
|
|
144163
|
+
if (entry === void 0) {
|
|
144164
|
+
undefinedCount += 1;
|
|
144165
|
+
continue;
|
|
144166
|
+
}
|
|
144167
|
+
definedValues.push(entry);
|
|
144032
144168
|
}
|
|
144033
|
-
|
|
144034
|
-
|
|
144035
|
-
|
|
144036
|
-
|
|
144169
|
+
for (let index = 1; index < definedValues.length; index += 1) {
|
|
144170
|
+
currentEntry = definedValues[index];
|
|
144171
|
+
let cursor2 = index - 1;
|
|
144172
|
+
while (cursor2 >= 0 && await compareEntries(definedValues[cursor2], currentEntry, comparator, options, stack) > 0) {
|
|
144173
|
+
definedValues[cursor2 + 1] = definedValues[cursor2];
|
|
144174
|
+
cursor2 -= 1;
|
|
144175
|
+
}
|
|
144176
|
+
definedValues[cursor2 + 1] = currentEntry;
|
|
144037
144177
|
}
|
|
144038
|
-
|
|
144039
|
-
|
|
144040
|
-
|
|
144041
|
-
const entry = definedValues[index];
|
|
144042
|
-
let cursor2 = index - 1;
|
|
144043
|
-
while (cursor2 >= 0 && await compareEntries(definedValues[cursor2], entry, comparator, options, stack) > 0) {
|
|
144044
|
-
definedValues[cursor2 + 1] = definedValues[cursor2];
|
|
144045
|
-
cursor2 -= 1;
|
|
144178
|
+
currentEntry = void 0;
|
|
144179
|
+
for (let index = 0; index < definedValues.length; index += 1) {
|
|
144180
|
+
value[index] = definedValues[index];
|
|
144046
144181
|
}
|
|
144047
|
-
|
|
144048
|
-
|
|
144049
|
-
|
|
144050
|
-
|
|
144051
|
-
|
|
144052
|
-
|
|
144053
|
-
|
|
144054
|
-
}
|
|
144055
|
-
|
|
144056
|
-
delete value[index];
|
|
144182
|
+
for (let index = 0; index < undefinedCount; index += 1) {
|
|
144183
|
+
value[definedValues.length + index] = void 0;
|
|
144184
|
+
}
|
|
144185
|
+
for (let index = definedValues.length + undefinedCount; index < length; index += 1) {
|
|
144186
|
+
options.budget.visitNode();
|
|
144187
|
+
delete value[index];
|
|
144188
|
+
}
|
|
144189
|
+
} finally {
|
|
144190
|
+
options.budget.setRetainedValues(definedValues, void 0);
|
|
144057
144191
|
}
|
|
144058
144192
|
}
|
|
144059
144193
|
async function compareEntries(left, right, comparator, options, stack) {
|
|
144194
|
+
options.budget.visitNode();
|
|
144060
144195
|
const result = Number(await options.callClosure(comparator, [left, right], stack));
|
|
144061
144196
|
return Number.isNaN(result) ? 0 : result;
|
|
144062
144197
|
}
|
|
144063
144198
|
async function callArrayCallback(callback, value, index, array, options, stack, thisValue) {
|
|
144064
144199
|
return options.callClosure(callback, [value, index, array], stack, thisValue);
|
|
144065
144200
|
}
|
|
144066
|
-
function findNextDefinedIndex(value, startIndex, direction, length) {
|
|
144201
|
+
function findNextDefinedIndex(value, startIndex, direction, length, budget) {
|
|
144067
144202
|
for (let index = startIndex; direction > 0 ? index < length : index >= 0; index += direction) {
|
|
144203
|
+
budget.visitNode();
|
|
144068
144204
|
if (index in value) {
|
|
144069
144205
|
return index;
|
|
144070
144206
|
}
|
|
@@ -147823,6 +147959,7 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
|
|
|
147823
147959
|
{
|
|
147824
147960
|
stack,
|
|
147825
147961
|
thisValue,
|
|
147962
|
+
invokeClosure: (closure, argumentsList, receiver) => invokeSandboxClosure(closure, argumentsList, context, stack, span, receiver),
|
|
147826
147963
|
...span === void 0 ? {} : { span }
|
|
147827
147964
|
}
|
|
147828
147965
|
]);
|
|
@@ -156468,7 +156605,7 @@ var init_package2 = __esm({
|
|
|
156468
156605
|
"package.json"() {
|
|
156469
156606
|
package_default2 = {
|
|
156470
156607
|
name: "poe-code",
|
|
156471
|
-
version: "13.0.
|
|
156608
|
+
version: "13.0.3",
|
|
156472
156609
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
156473
156610
|
license: "MIT",
|
|
156474
156611
|
type: "module",
|