poe-code 11.0.11 → 11.0.13
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.js +61 -12
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-2M5F6OIT.js → chunk-EV4BL6HH.js} +2 -2
- package/packages/safejs/dist/chunks/{chunk-QWNCR7EZ.js → chunk-GTX2EXKD.js} +61 -11
- package/packages/safejs/dist/chunks/{chunk-QWNCR7EZ.js.map → chunk-GTX2EXKD.js.map} +2 -2
- package/packages/safejs/dist/cli.js +2 -2
- package/packages/safejs/dist/core.js +1 -1
- package/packages/safejs/dist/index.js +2 -2
- package/packages/safejs/dist/interp/globals/object-array.js +45 -1
- package/packages/safejs/dist/interp/methods/string.js +15 -8
- /package/packages/safejs/dist/chunks/{chunk-2M5F6OIT.js.map → chunk-EV4BL6HH.js.map} +0 -0
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GTX2EXKD.js";
|
|
31
31
|
|
|
32
32
|
// packages/safejs/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8055,4 +8055,4 @@ export {
|
|
|
8055
8055
|
parseMcpConfig,
|
|
8056
8056
|
makeMcpModule
|
|
8057
8057
|
};
|
|
8058
|
-
//# sourceMappingURL=chunk-
|
|
8058
|
+
//# sourceMappingURL=chunk-EV4BL6HH.js.map
|
|
@@ -23673,10 +23673,22 @@ function createObjectArrayGlobals(options) {
|
|
|
23673
23673
|
}),
|
|
23674
23674
|
fromEntries: createSandboxClosure({
|
|
23675
23675
|
sandbox: true,
|
|
23676
|
-
call: ([value]) =>
|
|
23677
|
-
|
|
23678
|
-
|
|
23679
|
-
|
|
23676
|
+
call: ([value]) => {
|
|
23677
|
+
const iterator = getSandboxIterator(value);
|
|
23678
|
+
if (iterator === void 0) {
|
|
23679
|
+
throw new TypeError("Object.fromEntries requires an iterable.");
|
|
23680
|
+
}
|
|
23681
|
+
if (!iterator.generator) {
|
|
23682
|
+
return allocateProducedSandboxValue(
|
|
23683
|
+
Object.setPrototypeOf(
|
|
23684
|
+
Reflect.apply(Object.fromEntries, Object, [{ [Symbol.iterator]: () => iterator }]),
|
|
23685
|
+
null
|
|
23686
|
+
),
|
|
23687
|
+
options.budget
|
|
23688
|
+
);
|
|
23689
|
+
}
|
|
23690
|
+
return objectFromSandboxEntries(iterator, options.budget);
|
|
23691
|
+
},
|
|
23680
23692
|
name: "fromEntries"
|
|
23681
23693
|
}),
|
|
23682
23694
|
freeze: createSandboxClosure({
|
|
@@ -23797,6 +23809,38 @@ function createObjectArrayGlobals(options) {
|
|
|
23797
23809
|
})
|
|
23798
23810
|
};
|
|
23799
23811
|
}
|
|
23812
|
+
async function objectFromSandboxEntries(iterator, budget) {
|
|
23813
|
+
const object = /* @__PURE__ */ Object.create(null);
|
|
23814
|
+
try {
|
|
23815
|
+
while (true) {
|
|
23816
|
+
const result = await iterator.next();
|
|
23817
|
+
if (typeof result !== "object" && typeof result !== "function" || result === null) {
|
|
23818
|
+
throw new TypeError("Iterator result must be an object.");
|
|
23819
|
+
}
|
|
23820
|
+
if (result.done) break;
|
|
23821
|
+
const entry = result.value;
|
|
23822
|
+
if (typeof entry !== "object" && typeof entry !== "function" || entry === null) {
|
|
23823
|
+
throw new TypeError("Object.fromEntries requires entry objects.");
|
|
23824
|
+
}
|
|
23825
|
+
const key = entry[0];
|
|
23826
|
+
const value = entry[1];
|
|
23827
|
+
Object.defineProperty(object, key, {
|
|
23828
|
+
configurable: true,
|
|
23829
|
+
enumerable: true,
|
|
23830
|
+
value,
|
|
23831
|
+
writable: true
|
|
23832
|
+
});
|
|
23833
|
+
}
|
|
23834
|
+
} catch (error) {
|
|
23835
|
+
try {
|
|
23836
|
+
await iterator.return?.();
|
|
23837
|
+
} catch {
|
|
23838
|
+
throw error;
|
|
23839
|
+
}
|
|
23840
|
+
throw error;
|
|
23841
|
+
}
|
|
23842
|
+
return allocateProducedSandboxValue(object, budget);
|
|
23843
|
+
}
|
|
23800
23844
|
function assignSandboxValues(target, sources) {
|
|
23801
23845
|
if (target === null || target === void 0) {
|
|
23802
23846
|
throw new TypeError("Object.assign(target, ...sources) requires a non-null target.");
|
|
@@ -25135,6 +25179,7 @@ function callReplaceLikeMethod(value, methodName, args, budget, callClosure) {
|
|
|
25135
25179
|
);
|
|
25136
25180
|
}
|
|
25137
25181
|
async function replaceRegex(value, regex, replacement, replaceAll, budget, callClosure) {
|
|
25182
|
+
if (regex.flags.includes("g")) regex.lastIndex = 0;
|
|
25138
25183
|
const matches = collectRegexMatches(regex, value, replaceAll || regex.flags.includes("g"));
|
|
25139
25184
|
let result = "";
|
|
25140
25185
|
let copiedThrough = 0;
|
|
@@ -25223,11 +25268,16 @@ function callSplit(value, args, budget) {
|
|
|
25223
25268
|
if (args.some(isSandboxClosure))
|
|
25224
25269
|
throw new TypeError("String#split does not support function arguments.");
|
|
25225
25270
|
if (isSandboxRegex(args[0])) {
|
|
25271
|
+
const regex = args[0];
|
|
25272
|
+
const splitter = createSandboxRegex(
|
|
25273
|
+
regex.source,
|
|
25274
|
+
regex.flags.includes("g") ? regex.flags : `${regex.flags}g`
|
|
25275
|
+
);
|
|
25226
25276
|
const limit2 = asNumberOrUndefined(args[1]) ?? 2 ** 32 - 1;
|
|
25227
25277
|
const result2 = [];
|
|
25228
25278
|
let copiedThrough = 0;
|
|
25229
25279
|
let endedWithZeroWidthMatch = false;
|
|
25230
|
-
for (const match of collectRegexMatches(
|
|
25280
|
+
for (const match of collectRegexMatches(splitter, value, true)) {
|
|
25231
25281
|
endedWithZeroWidthMatch = match.text.length === 0 && match.index === value.length;
|
|
25232
25282
|
if (match.text.length === 0 && match.index === 0) continue;
|
|
25233
25283
|
if (result2.length >= limit2) break;
|
|
@@ -25265,18 +25315,18 @@ function callMatchLikeMethod(value, methodName, args) {
|
|
|
25265
25315
|
throw new TypeError("String#matchAll requires a global regex.");
|
|
25266
25316
|
if (methodName === "match" && !regex.flags.includes("g"))
|
|
25267
25317
|
return toMatchArray(executeRegex(regex, value), value);
|
|
25268
|
-
|
|
25318
|
+
if (methodName === "match") regex.lastIndex = 0;
|
|
25319
|
+
const matcher = methodName === "matchAll" ? createSandboxRegex(regex.source, regex.flags, regex.lastIndex) : regex;
|
|
25320
|
+
const matches = collectRegexMatches(matcher, value, true);
|
|
25269
25321
|
return methodName === "match" ? matches.map((match) => match.text) : matches.map((match) => toMatchArray(match, value));
|
|
25270
25322
|
}
|
|
25271
25323
|
function collectRegexMatches(regex, value, all) {
|
|
25272
25324
|
const matches = [];
|
|
25273
|
-
const pattern = getSandboxRegexPattern(regex);
|
|
25274
|
-
let startIndex = 0;
|
|
25275
25325
|
do {
|
|
25276
|
-
const match =
|
|
25326
|
+
const match = executeRegex(regex, value);
|
|
25277
25327
|
if (match === null) break;
|
|
25278
25328
|
matches.push(match);
|
|
25279
|
-
|
|
25329
|
+
if (all && match.text.length === 0) regex.lastIndex += 1;
|
|
25280
25330
|
} while (all);
|
|
25281
25331
|
return matches;
|
|
25282
25332
|
}
|
|
@@ -28987,4 +29037,4 @@ export {
|
|
|
28987
29037
|
FileSnapshotBackend,
|
|
28988
29038
|
run
|
|
28989
29039
|
};
|
|
28990
|
-
//# sourceMappingURL=chunk-
|
|
29040
|
+
//# sourceMappingURL=chunk-GTX2EXKD.js.map
|