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.
package/dist/index.js CHANGED
@@ -123520,26 +123520,31 @@ var init_parser3 = __esm({
123520
123520
  `Generator shorthand methods are not supported at line ${generatorToken.start.line}, column ${generatorToken.start.column}.`
123521
123521
  );
123522
123522
  }
123523
- if (this.currentToken().type === "identifier" && (this.currentToken().value === "get" || this.currentToken().value === "set") && this.isObjectAccessorShorthandStart()) {
123523
+ if (this.currentToken().type === "identifier" && (this.currentToken().value === "get" || this.currentToken().value === "set") && this.isObjectMethodStart()) {
123524
123524
  const token2 = this.currentToken();
123525
123525
  const syntax = token2.value === "get" ? "Getter" : "Setter";
123526
123526
  throw new Error(
123527
123527
  `${syntax} shorthand methods are not supported at line ${token2.start.line}, column ${token2.start.column}.`
123528
123528
  );
123529
123529
  }
123530
+ const modifierToken = this.currentToken();
123531
+ const asyncToken = modifierToken.type === "keyword" && modifierToken.value === "async" && modifierToken.end.offset - modifierToken.start.offset === modifierToken.value.length && this.isObjectMethodStart() && !hasLineBreakBetween(modifierToken, this.peekToken(1)) ? modifierToken : void 0;
123532
+ if (asyncToken !== void 0) {
123533
+ this.index += 1;
123534
+ }
123530
123535
  if (this.consumePunctuator("[") !== void 0) {
123531
123536
  const propertyStart = this.previousToken();
123532
123537
  const key3 = this.parseExpression();
123533
123538
  this.expectPunctuator("]");
123534
123539
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
123535
- const value2 = this.parseObjectMethod(void 0, propertyStart.start);
123540
+ const value2 = this.parseObjectMethod(asyncToken, propertyStart.start);
123536
123541
  return {
123537
123542
  type: "Property",
123538
123543
  computed: true,
123539
123544
  shorthand: false,
123540
123545
  key: key3.node,
123541
123546
  value: value2,
123542
- span: createSpan2(propertyStart.start, value2.span.end)
123547
+ span: createSpan2(asyncToken?.start ?? propertyStart.start, value2.span.end)
123543
123548
  };
123544
123549
  }
123545
123550
  this.expectPunctuator(":");
@@ -123553,12 +123558,8 @@ var init_parser3 = __esm({
123553
123558
  span: createSpan2(propertyStart.start, value.node.span.end)
123554
123559
  };
123555
123560
  }
123556
- const asyncToken = this.currentToken().type === "keyword" && this.currentToken().value === "async" && isIdentifierLikeToken(this.peekToken(1)) && this.peekToken(2).type === "punctuator" && this.peekToken(2).value === "(" && !hasLineBreakBetween(this.currentToken(), this.peekToken(1)) ? this.currentToken() : void 0;
123557
- if (asyncToken !== void 0) {
123558
- this.index += 1;
123559
- }
123560
123561
  const token = this.currentToken();
123561
- if (isIdentifierLikeToken(token)) {
123562
+ if (isIdentifierLikeToken(token) || token.type === "keyword" && this.peekToken(1).type === "punctuator" && this.peekToken(1).value === "(") {
123562
123563
  this.index += 1;
123563
123564
  const key3 = createIdentifier2(token);
123564
123565
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
@@ -123597,14 +123598,14 @@ var init_parser3 = __esm({
123597
123598
  this.index += 1;
123598
123599
  const key3 = createLiteralFromToken(token);
123599
123600
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
123600
- const value2 = this.parseObjectMethod(void 0, key3.span.start);
123601
+ const value2 = this.parseObjectMethod(asyncToken, key3.span.start);
123601
123602
  return {
123602
123603
  type: "Property",
123603
123604
  computed: false,
123604
123605
  shorthand: false,
123605
123606
  key: key3,
123606
123607
  value: value2,
123607
- span: createSpan2(key3.span.start, value2.span.end)
123608
+ span: createSpan2(asyncToken?.start ?? key3.span.start, value2.span.end)
123608
123609
  };
123609
123610
  }
123610
123611
  this.expectPunctuator(":");
@@ -123620,7 +123621,7 @@ var init_parser3 = __esm({
123620
123621
  }
123621
123622
  throw unexpectedTokenError(token);
123622
123623
  }
123623
- isObjectAccessorShorthandStart() {
123624
+ isObjectMethodStart() {
123624
123625
  const propertyToken = this.peekToken(1);
123625
123626
  if (propertyToken.type === "punctuator" && propertyToken.value === "[") {
123626
123627
  let depth = 0;
@@ -123642,7 +123643,7 @@ var init_parser3 = __esm({
123642
123643
  offset += 1;
123643
123644
  }
123644
123645
  }
123645
- return (isIdentifierLikeToken(propertyToken) || propertyToken.type === "numeric" || propertyToken.type === "string") && this.peekToken(2).type === "punctuator" && this.peekToken(2).value === "(";
123646
+ return (propertyToken.type === "identifier" || propertyToken.type === "keyword" || propertyToken.type === "numeric" || propertyToken.type === "string") && this.peekToken(2).type === "punctuator" && this.peekToken(2).value === "(";
123646
123647
  }
123647
123648
  parseObjectMethod(asyncToken, methodStart) {
123648
123649
  const params = this.withScope(() => {
@@ -143036,6 +143037,9 @@ function getArrayMember(value, property, options) {
143036
143037
  if (property === "length") {
143037
143038
  return value.length;
143038
143039
  }
143040
+ if (Object.hasOwn(value, property)) {
143041
+ return value[String(property)];
143042
+ }
143039
143043
  if (isArrayMethodName(property)) {
143040
143044
  return createSandboxClosure({
143041
143045
  sandbox: true,
@@ -146487,7 +146491,7 @@ async function evaluateMemberCallExpression(node, context) {
146487
146491
  if (typeof member.object === "number" && isNumberMethodName(member.property)) {
146488
146492
  return evaluateNumberMethodCall(node, member.object, member.property, context);
146489
146493
  }
146490
- if (Array.isArray(member.object) && isArrayMethodName(member.property)) {
146494
+ if (Array.isArray(member.object) && isArrayMethodName(member.property) && !Object.hasOwn(member.object, member.property)) {
146491
146495
  return evaluateArrayMethodCall(node, member.object, member.property, context);
146492
146496
  }
146493
146497
  if (isSandboxMap(member.object) && isMapMethodName(member.property)) {
@@ -146514,7 +146518,7 @@ async function evaluateMemberCallExpression(node, context) {
146514
146518
  context
146515
146519
  );
146516
146520
  }
146517
- if (Array.isArray(member.object)) {
146521
+ if (Array.isArray(member.object) && !Object.hasOwn(member.object, member.property)) {
146518
146522
  return evaluatePrimitiveMemberCall(
146519
146523
  node,
146520
146524
  "Array",
@@ -146986,7 +146990,7 @@ function getMemberValue(target, property, context) {
146986
146990
  return Object.hasOwn(target, String(property)) ? target[String(property)] : void 0;
146987
146991
  }
146988
146992
  function getArrayMemberValue(target, property, context) {
146989
- if (property === "raw") {
146993
+ if (property === "raw" && taggedTemplateRawArrays.has(target)) {
146990
146994
  return taggedTemplateRawArrays.get(target);
146991
146995
  }
146992
146996
  return getArrayMember(target, property, createArrayMethodOptions(context));
@@ -147027,23 +147031,20 @@ function getClosureMemberValue(target, property, context) {
147027
147031
  return getFunctionMember(target, property, createFunctionMethodOptions(context));
147028
147032
  }
147029
147033
  async function evaluateResolvedCallExpression(node, callee, context, thisValue = void 0) {
147030
- if (callee === null || callee === void 0) {
147031
- if (node.optional) {
147032
- return {
147033
- kind: "normal",
147034
- hasValue: true,
147035
- value: void 0
147036
- };
147037
- }
147038
- throw new TypeError("Attempted to call a non-function value.");
147039
- }
147040
- if (!isSandboxClosure(callee)) {
147041
- throw new TypeError("Attempted to call a non-function value.");
147034
+ if ((callee === null || callee === void 0) && node.optional) {
147035
+ return {
147036
+ kind: "normal",
147037
+ hasValue: true,
147038
+ value: void 0
147039
+ };
147042
147040
  }
147043
147041
  const args = await evaluateCallArguments(node.arguments, context);
147044
147042
  if (!args.ok) {
147045
147043
  return args.result;
147046
147044
  }
147045
+ if (!isSandboxClosure(callee)) {
147046
+ throw new TypeError("Attempted to call a non-function value.");
147047
+ }
147047
147048
  return {
147048
147049
  kind: "normal",
147049
147050
  hasValue: true,
@@ -155562,7 +155563,7 @@ var init_package2 = __esm({
155562
155563
  "package.json"() {
155563
155564
  package_default2 = {
155564
155565
  name: "poe-code",
155565
- version: "11.0.8",
155566
+ version: "11.0.10",
155566
155567
  description: "CLI tool to configure Poe API for developer workflows.",
155567
155568
  license: "MIT",
155568
155569
  type: "module",