poe-code 14.0.44 → 14.0.45
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 +43 -22
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-bash/dist/browser.js +72 -25
- package/packages/safe-bash/dist/browser.js.map +3 -3
- package/packages/safe-bash/dist/shell/parser.d.ts +3 -2
- package/packages/safe-bash/dist/shell/parser.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/parser.js +18 -21
- package/packages/safe-bash/dist/shell/parser.js.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.js +14 -6
- package/packages/safe-bash/dist/shell/runtime.js.map +1 -1
- package/packages/safe-bash/dist/shell/shell.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/shell.js +4 -2
- package/packages/safe-bash/dist/shell/shell.js.map +1 -1
- package/packages/safe-bash/dist/shell/source-line-index.d.ts +10 -0
- package/packages/safe-bash/dist/shell/source-line-index.d.ts.map +1 -0
- package/packages/safe-bash/dist/shell/source-line-index.js +41 -0
- package/packages/safe-bash/dist/shell/source-line-index.js.map +1 -0
- package/packages/safe-js/dist/chunks/{chunk-JZXAWFPL.js → chunk-T3NC5O24.js} +43 -23
- package/packages/safe-js/dist/chunks/chunk-T3NC5O24.js.map +7 -0
- package/packages/safe-js/dist/chunks/{chunk-2GJ635AB.js → chunk-WQQANSWB.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/exceptions.d.ts +1 -0
- package/packages/safe-js/dist/interp/exceptions.js +11 -11
- package/packages/safe-js/dist/interp/interpreter.js +2 -1
- package/packages/safe-js/dist/interp/patterns.js +2 -4
- package/packages/safe-js/dist/interp/values.d.ts +1 -1
- package/packages/safe-js/dist/interp/values.js +9 -4
- package/packages/safe-js/dist/chunks/chunk-JZXAWFPL.js.map +0 -7
- /package/packages/safe-js/dist/chunks/{chunk-2GJ635AB.js.map → chunk-WQQANSWB.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-T3NC5O24.js";
|
|
31
31
|
import {
|
|
32
32
|
createFileSystem,
|
|
33
33
|
createNodeFileSystemAdapterRegistry,
|
|
@@ -8245,4 +8245,4 @@ export {
|
|
|
8245
8245
|
parseMcpConfig,
|
|
8246
8246
|
makeMcpModule
|
|
8247
8247
|
};
|
|
8248
|
-
//# sourceMappingURL=chunk-
|
|
8248
|
+
//# sourceMappingURL=chunk-WQQANSWB.js.map
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveFsConfig,
|
|
23
23
|
splitFrontmatter,
|
|
24
24
|
withBrokenPipeGuard
|
|
25
|
-
} from "./chunks/chunk-
|
|
25
|
+
} from "./chunks/chunk-WQQANSWB.js";
|
|
26
26
|
import {
|
|
27
27
|
Budget,
|
|
28
28
|
SandboxError,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
replaceErrorStack,
|
|
35
35
|
restore,
|
|
36
36
|
run
|
|
37
|
-
} from "./chunks/chunk-
|
|
37
|
+
} from "./chunks/chunk-T3NC5O24.js";
|
|
38
38
|
import "./chunks/chunk-UXMKEUH3.js";
|
|
39
39
|
import "./chunks/chunk-5DYEOCT5.js";
|
|
40
40
|
import "./chunks/chunk-4YIDX44G.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runWithSpawnUsageAccumulator,
|
|
27
27
|
splitFrontmatter,
|
|
28
28
|
supportsSpawnMode
|
|
29
|
-
} from "./chunks/chunk-
|
|
29
|
+
} from "./chunks/chunk-WQQANSWB.js";
|
|
30
30
|
import {
|
|
31
31
|
Budget,
|
|
32
32
|
FileSnapshotBackend,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
registerPendingHostCallPolicy,
|
|
51
51
|
restore,
|
|
52
52
|
run
|
|
53
|
-
} from "./chunks/chunk-
|
|
53
|
+
} from "./chunks/chunk-T3NC5O24.js";
|
|
54
54
|
import "./chunks/chunk-UXMKEUH3.js";
|
|
55
55
|
import "./chunks/chunk-5DYEOCT5.js";
|
|
56
56
|
import "./chunks/chunk-4YIDX44G.js";
|
|
@@ -30,6 +30,7 @@ type ExceptionContext = {
|
|
|
30
30
|
callStack: readonly string[];
|
|
31
31
|
scope: Scope;
|
|
32
32
|
toPropertyKey?: (value: SandboxValue) => Promise<string>;
|
|
33
|
+
getProperty?: (value: SandboxValue, key: string | number) => SandboxValue;
|
|
33
34
|
};
|
|
34
35
|
type EvaluateExceptionNode<TContext, TError> = (node: ParseResult, context: TContext) => Promise<EvaluationResult<TError>>;
|
|
35
36
|
export declare function evaluateThrowStatement<TContext extends ExceptionContext, TError>(node: ThrowStatement, context: TContext, evaluateNode: EvaluateExceptionNode<TContext, TError>): Promise<EvaluationResult<TError>>;
|
|
@@ -2,7 +2,8 @@ import { attachErrorSpan, attachWrappedErrorCause, describeThrownValue, formatEr
|
|
|
2
2
|
import { SandboxError } from "./budget.js";
|
|
3
3
|
import { HostCallResumabilityError } from "./host-call.js";
|
|
4
4
|
import { withFatalPromiseCleanup } from "./promise-tracker.js";
|
|
5
|
-
import { deepCopyToSandbox } from "./values.js";
|
|
5
|
+
import { deepCopyToSandbox, ownEnumerableSandboxEntries } from "./values.js";
|
|
6
|
+
import { getSandboxDataProperty } from "./object-model.js";
|
|
6
7
|
import { toPropertyKey } from "./property-key.js";
|
|
7
8
|
const capturedExceptionBrand = Symbol("CapturedException");
|
|
8
9
|
export async function evaluateThrowStatement(node, context, evaluateNode) {
|
|
@@ -240,6 +241,9 @@ async function evaluateCatchClause(node, thrownValue, context, evaluateNode) {
|
|
|
240
241
|
scope
|
|
241
242
|
};
|
|
242
243
|
if (node.param !== undefined) {
|
|
244
|
+
for (const name of getPatternBindingNames(node.param)) {
|
|
245
|
+
scope.predeclare(name, "let");
|
|
246
|
+
}
|
|
243
247
|
const binding = await bindPattern(node.param, thrownValue, catchContext, evaluateNode);
|
|
244
248
|
if (!binding.ok) {
|
|
245
249
|
return binding.result;
|
|
@@ -351,8 +355,8 @@ async function bindArrayPattern(pattern, value, context, evaluateNode) {
|
|
|
351
355
|
return { ok: true };
|
|
352
356
|
}
|
|
353
357
|
async function bindObjectPattern(pattern, value, context, evaluateNode) {
|
|
354
|
-
if (
|
|
355
|
-
throw new TypeError("Object catch bindings require a non-
|
|
358
|
+
if (value === null || value === undefined) {
|
|
359
|
+
throw new TypeError("Object catch bindings require a non-nullish value.");
|
|
356
360
|
}
|
|
357
361
|
const excludedKeys = new Set();
|
|
358
362
|
for (const property of pattern.properties) {
|
|
@@ -369,7 +373,9 @@ async function bindObjectPattern(pattern, value, context, evaluateNode) {
|
|
|
369
373
|
return key;
|
|
370
374
|
}
|
|
371
375
|
excludedKeys.add(String(key.value));
|
|
372
|
-
const binding = await bindPattern(property.value,
|
|
376
|
+
const binding = await bindPattern(property.value, context.getProperty === undefined
|
|
377
|
+
? getSandboxDataProperty(value, key.value, context.budget)
|
|
378
|
+
: context.getProperty(value, key.value), context, evaluateNode);
|
|
373
379
|
if (!binding.ok) {
|
|
374
380
|
return binding;
|
|
375
381
|
}
|
|
@@ -406,15 +412,9 @@ function getStaticPropertyKey(property) {
|
|
|
406
412
|
throw new TypeError(`Unsupported catch binding property key '${property.type}'.`);
|
|
407
413
|
}
|
|
408
414
|
}
|
|
409
|
-
function getObjectPatternValue(value, key) {
|
|
410
|
-
return value[key];
|
|
411
|
-
}
|
|
412
415
|
function copyObjectRest(value, excludedKeys) {
|
|
413
416
|
const rest = Object.create(null);
|
|
414
|
-
for (const [key, entryValue] of
|
|
415
|
-
if (excludedKeys.has(key)) {
|
|
416
|
-
continue;
|
|
417
|
-
}
|
|
417
|
+
for (const [key, entryValue] of ownEnumerableSandboxEntries(value, excludedKeys)) {
|
|
418
418
|
rest[key] = entryValue;
|
|
419
419
|
}
|
|
420
420
|
return rest;
|
|
@@ -1537,7 +1537,8 @@ async function evaluateThrowStatement(node, context) {
|
|
|
1537
1537
|
async function evaluateTryStatement(node, context) {
|
|
1538
1538
|
return evaluateTryStatementResult(node, {
|
|
1539
1539
|
...context,
|
|
1540
|
-
toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(context))
|
|
1540
|
+
toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(context)),
|
|
1541
|
+
getProperty: (value, key) => getPropertyValue(value, key, context)
|
|
1541
1542
|
}, evaluateNode);
|
|
1542
1543
|
}
|
|
1543
1544
|
async function evaluateUnaryExpression(node, context) {
|
|
@@ -161,10 +161,8 @@ function describeRuntimeValue(value) {
|
|
|
161
161
|
}
|
|
162
162
|
function copyObjectRestValue(value, excludedKeys) {
|
|
163
163
|
const rest = Object.create(null);
|
|
164
|
-
for (const [key, entryValue] of ownEnumerableSandboxEntries(value)) {
|
|
165
|
-
|
|
166
|
-
defineProperty(rest, key, entryValue);
|
|
167
|
-
}
|
|
164
|
+
for (const [key, entryValue] of ownEnumerableSandboxEntries(value, excludedKeys)) {
|
|
165
|
+
defineProperty(rest, key, entryValue);
|
|
168
166
|
}
|
|
169
167
|
return rest;
|
|
170
168
|
}
|
|
@@ -104,7 +104,7 @@ export declare function createSandboxClosure(input: {
|
|
|
104
104
|
properties?: SandboxObject | ((closure: SandboxClosure) => SandboxObject);
|
|
105
105
|
retainedValues?: () => Iterable<SandboxValue>;
|
|
106
106
|
}): SandboxClosure;
|
|
107
|
-
export declare function ownEnumerableSandboxEntries(value: SandboxValue): Array<[string, SandboxValue]>;
|
|
107
|
+
export declare function ownEnumerableSandboxEntries(value: SandboxValue, excludedKeys?: ReadonlySet<string>): Array<[string, SandboxValue]>;
|
|
108
108
|
export declare function createSandboxPromise(promise: Promise<SandboxValue>, metadata?: {
|
|
109
109
|
trackReplay?: boolean;
|
|
110
110
|
synchronousPrefix?: Promise<void>;
|
|
@@ -73,10 +73,12 @@ export function createSandboxClosure(input) {
|
|
|
73
73
|
}
|
|
74
74
|
return Object.freeze(closure);
|
|
75
75
|
}
|
|
76
|
-
export function ownEnumerableSandboxEntries(value) {
|
|
76
|
+
export function ownEnumerableSandboxEntries(value, excludedKeys) {
|
|
77
77
|
if (isGuestHostObject(value)) {
|
|
78
78
|
const entries = [];
|
|
79
79
|
for (const key of getHostObjectKeys(value)) {
|
|
80
|
+
if (excludedKeys?.has(key))
|
|
81
|
+
continue;
|
|
80
82
|
if (hasHostObjectMember(value, key, true))
|
|
81
83
|
entries.push([key, getHostObjectMember(value, key)]);
|
|
82
84
|
}
|
|
@@ -84,11 +86,14 @@ export function ownEnumerableSandboxEntries(value) {
|
|
|
84
86
|
}
|
|
85
87
|
if (value === null || value === undefined)
|
|
86
88
|
throw new TypeError("Cannot convert undefined or null to object.");
|
|
89
|
+
let entries;
|
|
87
90
|
if (isGuestClosure(value))
|
|
88
|
-
|
|
89
|
-
if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value))
|
|
91
|
+
entries = Object.entries(value.properties ?? {});
|
|
92
|
+
else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value))
|
|
90
93
|
return [];
|
|
91
|
-
|
|
94
|
+
else
|
|
95
|
+
entries = Object.entries(Object(value));
|
|
96
|
+
return excludedKeys === undefined ? entries : entries.filter(([key]) => !excludedKeys.has(key));
|
|
92
97
|
}
|
|
93
98
|
export function createSandboxPromise(promise, metadata = {}) {
|
|
94
99
|
const original = metadata.trackReplay === false
|