poe-code 11.0.8 → 11.0.10

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-TVZKHJOO.js";
30
+ } from "./chunk-BESE73VB.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-776EUEUM.js.map
8058
+ //# sourceMappingURL=chunk-DF7PY5YX.js.map
@@ -20,7 +20,7 @@ import {
20
20
  parseMcpConfig,
21
21
  splitFrontmatter,
22
22
  withBrokenPipeGuard
23
- } from "./chunks/chunk-776EUEUM.js";
23
+ } from "./chunks/chunk-DF7PY5YX.js";
24
24
  import {
25
25
  Budget,
26
26
  SandboxError,
@@ -32,7 +32,7 @@ import {
32
32
  replaceErrorStack,
33
33
  restore,
34
34
  run
35
- } from "./chunks/chunk-TVZKHJOO.js";
35
+ } from "./chunks/chunk-BESE73VB.js";
36
36
  import "./chunks/chunk-4YIDX44G.js";
37
37
 
38
38
  // packages/safejs/src/cli.ts
@@ -3,7 +3,7 @@ import {
3
3
  createReplayableRandom,
4
4
  lint,
5
5
  run
6
- } from "./chunks/chunk-TVZKHJOO.js";
6
+ } from "./chunks/chunk-BESE73VB.js";
7
7
  import "./chunks/chunk-4YIDX44G.js";
8
8
  export {
9
9
  Budget,
@@ -27,7 +27,7 @@ import {
27
27
  runWithSpawnUsageAccumulator,
28
28
  splitFrontmatter,
29
29
  supportsSpawnMode
30
- } from "./chunks/chunk-776EUEUM.js";
30
+ } from "./chunks/chunk-DF7PY5YX.js";
31
31
  import {
32
32
  Budget,
33
33
  FileSnapshotBackend,
@@ -49,7 +49,7 @@ import {
49
49
  registerPendingHostCallPolicy,
50
50
  restore,
51
51
  run
52
- } from "./chunks/chunk-TVZKHJOO.js";
52
+ } from "./chunks/chunk-BESE73VB.js";
53
53
  import "./chunks/chunk-4YIDX44G.js";
54
54
 
55
55
  // packages/safejs/src/runner/run-harness.ts
@@ -1758,7 +1758,9 @@ async function evaluateMemberCallExpression(node, context) {
1758
1758
  if (typeof member.object === "number" && isNumberMethodName(member.property)) {
1759
1759
  return evaluateNumberMethodCall(node, member.object, member.property, context);
1760
1760
  }
1761
- if (Array.isArray(member.object) && isArrayMethodName(member.property)) {
1761
+ if (Array.isArray(member.object) &&
1762
+ isArrayMethodName(member.property) &&
1763
+ !Object.hasOwn(member.object, member.property)) {
1762
1764
  return evaluateArrayMethodCall(node, member.object, member.property, context);
1763
1765
  }
1764
1766
  if (isSandboxMap(member.object) && isMapMethodName(member.property)) {
@@ -1773,7 +1775,7 @@ async function evaluateMemberCallExpression(node, context) {
1773
1775
  if (typeof member.object === "number") {
1774
1776
  return evaluatePrimitiveMemberCall(node, "Number", member.property, getNumberMember(member.object, member.property, context.budget), context);
1775
1777
  }
1776
- if (Array.isArray(member.object)) {
1778
+ if (Array.isArray(member.object) && !Object.hasOwn(member.object, member.property)) {
1777
1779
  return evaluatePrimitiveMemberCall(node, "Array", member.property, getArrayMemberValue(member.object, member.property, context), context);
1778
1780
  }
1779
1781
  if (isSandboxMap(member.object)) {
@@ -2200,7 +2202,7 @@ function getMemberValue(target, property, context) {
2200
2202
  return Object.hasOwn(target, String(property)) ? target[String(property)] : undefined;
2201
2203
  }
2202
2204
  function getArrayMemberValue(target, property, context) {
2203
- if (property === "raw") {
2205
+ if (property === "raw" && taggedTemplateRawArrays.has(target)) {
2204
2206
  return taggedTemplateRawArrays.get(target);
2205
2207
  }
2206
2208
  return getArrayMember(target, property, createArrayMethodOptions(context));
@@ -2242,23 +2244,20 @@ function getClosureMemberValue(target, property, context) {
2242
2244
  return getFunctionMember(target, property, createFunctionMethodOptions(context));
2243
2245
  }
2244
2246
  async function evaluateResolvedCallExpression(node, callee, context, thisValue = undefined) {
2245
- if (callee === null || callee === undefined) {
2246
- if (node.optional) {
2247
- return {
2248
- kind: "normal",
2249
- hasValue: true,
2250
- value: undefined
2251
- };
2252
- }
2253
- throw new TypeError("Attempted to call a non-function value.");
2254
- }
2255
- if (!isSandboxClosure(callee)) {
2256
- throw new TypeError("Attempted to call a non-function value.");
2247
+ if ((callee === null || callee === undefined) && node.optional) {
2248
+ return {
2249
+ kind: "normal",
2250
+ hasValue: true,
2251
+ value: undefined
2252
+ };
2257
2253
  }
2258
2254
  const args = await evaluateCallArguments(node.arguments, context);
2259
2255
  if (!args.ok) {
2260
2256
  return args.result;
2261
2257
  }
2258
+ if (!isSandboxClosure(callee)) {
2259
+ throw new TypeError("Attempted to call a non-function value.");
2260
+ }
2262
2261
  return {
2263
2262
  kind: "normal",
2264
2263
  hasValue: true,
@@ -43,6 +43,9 @@ export function getArrayMember(value, property, options) {
43
43
  if (property === "length") {
44
44
  return value.length;
45
45
  }
46
+ if (Object.hasOwn(value, property)) {
47
+ return value[String(property)];
48
+ }
46
49
  if (isArrayMethodName(property)) {
47
50
  return createSandboxClosure({
48
51
  sandbox: true,
@@ -1966,24 +1966,35 @@ class Parser {
1966
1966
  }
1967
1967
  if (this.currentToken().type === "identifier" &&
1968
1968
  (this.currentToken().value === "get" || this.currentToken().value === "set") &&
1969
- this.isObjectAccessorShorthandStart()) {
1969
+ this.isObjectMethodStart()) {
1970
1970
  const token = this.currentToken();
1971
1971
  const syntax = token.value === "get" ? "Getter" : "Setter";
1972
1972
  throw new Error(`${syntax} shorthand methods are not supported at line ${token.start.line}, column ${token.start.column}.`);
1973
1973
  }
1974
+ const modifierToken = this.currentToken();
1975
+ const asyncToken = modifierToken.type === "keyword" &&
1976
+ modifierToken.value === "async" &&
1977
+ modifierToken.end.offset - modifierToken.start.offset === modifierToken.value.length &&
1978
+ this.isObjectMethodStart() &&
1979
+ !hasLineBreakBetween(modifierToken, this.peekToken(1))
1980
+ ? modifierToken
1981
+ : undefined;
1982
+ if (asyncToken !== undefined) {
1983
+ this.index += 1;
1984
+ }
1974
1985
  if (this.consumePunctuator("[") !== undefined) {
1975
1986
  const propertyStart = this.previousToken();
1976
1987
  const key = this.parseExpression();
1977
1988
  this.expectPunctuator("]");
1978
1989
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
1979
- const value = this.parseObjectMethod(undefined, propertyStart.start);
1990
+ const value = this.parseObjectMethod(asyncToken, propertyStart.start);
1980
1991
  return {
1981
1992
  type: "Property",
1982
1993
  computed: true,
1983
1994
  shorthand: false,
1984
1995
  key: key.node,
1985
1996
  value,
1986
- span: createSpan(propertyStart.start, value.span.end)
1997
+ span: createSpan(asyncToken?.start ?? propertyStart.start, value.span.end)
1987
1998
  };
1988
1999
  }
1989
2000
  this.expectPunctuator(":");
@@ -1997,19 +2008,11 @@ class Parser {
1997
2008
  span: createSpan(propertyStart.start, value.node.span.end)
1998
2009
  };
1999
2010
  }
2000
- const asyncToken = this.currentToken().type === "keyword" &&
2001
- this.currentToken().value === "async" &&
2002
- isIdentifierLikeToken(this.peekToken(1)) &&
2003
- this.peekToken(2).type === "punctuator" &&
2004
- this.peekToken(2).value === "(" &&
2005
- !hasLineBreakBetween(this.currentToken(), this.peekToken(1))
2006
- ? this.currentToken()
2007
- : undefined;
2008
- if (asyncToken !== undefined) {
2009
- this.index += 1;
2010
- }
2011
2011
  const token = this.currentToken();
2012
- if (isIdentifierLikeToken(token)) {
2012
+ if (isIdentifierLikeToken(token) ||
2013
+ (token.type === "keyword" &&
2014
+ this.peekToken(1).type === "punctuator" &&
2015
+ this.peekToken(1).value === "(")) {
2013
2016
  this.index += 1;
2014
2017
  const key = createIdentifier(token);
2015
2018
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
@@ -2048,14 +2051,14 @@ class Parser {
2048
2051
  this.index += 1;
2049
2052
  const key = createLiteralFromToken(token);
2050
2053
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
2051
- const value = this.parseObjectMethod(undefined, key.span.start);
2054
+ const value = this.parseObjectMethod(asyncToken, key.span.start);
2052
2055
  return {
2053
2056
  type: "Property",
2054
2057
  computed: false,
2055
2058
  shorthand: false,
2056
2059
  key,
2057
2060
  value,
2058
- span: createSpan(key.span.start, value.span.end)
2061
+ span: createSpan(asyncToken?.start ?? key.span.start, value.span.end)
2059
2062
  };
2060
2063
  }
2061
2064
  this.expectPunctuator(":");
@@ -2071,7 +2074,7 @@ class Parser {
2071
2074
  }
2072
2075
  throw unexpectedTokenError(token);
2073
2076
  }
2074
- isObjectAccessorShorthandStart() {
2077
+ isObjectMethodStart() {
2075
2078
  const propertyToken = this.peekToken(1);
2076
2079
  if (propertyToken.type === "punctuator" && propertyToken.value === "[") {
2077
2080
  let depth = 0;
@@ -2094,7 +2097,8 @@ class Parser {
2094
2097
  offset += 1;
2095
2098
  }
2096
2099
  }
2097
- return ((isIdentifierLikeToken(propertyToken) ||
2100
+ return ((propertyToken.type === "identifier" ||
2101
+ propertyToken.type === "keyword" ||
2098
2102
  propertyToken.type === "numeric" ||
2099
2103
  propertyToken.type === "string") &&
2100
2104
  this.peekToken(2).type === "punctuator" &&