@poe-platform/safe-js 0.1.142 → 0.1.144

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-YKISHTWT.js";
30
+ } from "./chunk-MOVL45AH.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8249,4 +8249,4 @@ export {
8249
8249
  parseMcpConfig,
8250
8250
  makeMcpModule
8251
8251
  };
8252
- //# sourceMappingURL=chunk-KZ6SIA7S.js.map
8252
+ //# sourceMappingURL=chunk-2MIT6YAQ.js.map
@@ -4619,20 +4619,24 @@ var Parser = class {
4619
4619
  }
4620
4620
  parseObjectProperty() {
4621
4621
  const generatorToken = this.currentToken().type === "punctuator" && this.currentToken().value === "*" ? this.currentToken() : this.currentToken().type === "keyword" && this.currentToken().value === "async" && this.peekToken(1).type === "punctuator" && this.peekToken(1).value === "*" ? this.peekToken(1) : void 0;
4622
- if (generatorToken !== void 0) {
4622
+ if (generatorToken !== void 0 && this.currentToken().value !== "*") {
4623
4623
  throw new Error(
4624
4624
  `Generator shorthand methods are not supported at line ${generatorToken.start.line}, column ${generatorToken.start.column}.`
4625
4625
  );
4626
4626
  }
4627
- if (this.currentToken().type === "identifier" && (this.currentToken().value === "get" || this.currentToken().value === "set") && this.isObjectMethodStart()) {
4627
+ if (generatorToken !== void 0) this.index++;
4628
+ let accessor;
4629
+ let accessorStart;
4630
+ if (generatorToken === void 0 && this.currentToken().type === "identifier" && (this.currentToken().value === "get" || this.currentToken().value === "set") && this.isObjectMethodStart()) {
4628
4631
  const token2 = this.currentToken();
4629
- const syntax = token2.value === "get" ? "Getter" : "Setter";
4630
- throw new Error(
4631
- `${syntax} shorthand methods are not supported at line ${token2.start.line}, column ${token2.start.column}.`
4632
- );
4632
+ if (token2.end.offset - token2.start.offset !== token2.value.length)
4633
+ throw unexpectedTokenError(token2);
4634
+ accessor = token2.value === "get" ? "get" : "set";
4635
+ accessorStart = token2.start;
4636
+ this.index++;
4633
4637
  }
4634
4638
  const modifierToken = this.currentToken();
4635
- 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;
4639
+ const asyncToken = generatorToken === void 0 && 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;
4636
4640
  if (asyncToken !== void 0) {
4637
4641
  this.index += 1;
4638
4642
  }
@@ -4641,16 +4645,18 @@ var Parser = class {
4641
4645
  const key = this.parseExpression();
4642
4646
  this.expectPunctuator("]");
4643
4647
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
4644
- const value2 = this.parseObjectMethod(asyncToken, propertyStart.start);
4648
+ const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? propertyStart.start, accessor, generatorToken);
4645
4649
  return {
4646
4650
  type: "Property",
4651
+ ...accessor === void 0 ? {} : { kind: accessor },
4647
4652
  computed: true,
4648
4653
  shorthand: false,
4649
4654
  key: key.node,
4650
4655
  value: value2,
4651
- span: createSpan2(asyncToken?.start ?? propertyStart.start, value2.span.end)
4656
+ span: createSpan2(value2.span.start, value2.span.end)
4652
4657
  };
4653
4658
  }
4659
+ if (generatorToken !== void 0) throw unexpectedTokenError(this.currentToken());
4654
4660
  this.expectPunctuator(":");
4655
4661
  const value = this.parseExpression();
4656
4662
  return {
@@ -4667,16 +4673,18 @@ var Parser = class {
4667
4673
  this.index += 1;
4668
4674
  const key = createIdentifierName(token);
4669
4675
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
4670
- const value2 = this.parseObjectMethod(asyncToken, key.span.start);
4676
+ const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? key.span.start, accessor, generatorToken);
4671
4677
  return {
4672
4678
  type: "Property",
4679
+ ...accessor === void 0 ? {} : { kind: accessor },
4673
4680
  computed: false,
4674
4681
  shorthand: false,
4675
4682
  key,
4676
4683
  value: value2,
4677
- span: createSpan2(asyncToken?.start ?? key.span.start, value2.span.end)
4684
+ span: createSpan2(value2.span.start, value2.span.end)
4678
4685
  };
4679
4686
  }
4687
+ if (generatorToken !== void 0) throw unexpectedTokenError(this.currentToken());
4680
4688
  if (this.consumePunctuator(":") === void 0) {
4681
4689
  if (!isIdentifierLikeToken(token)) throw unexpectedTokenError(token);
4682
4690
  assertAllowedIdentifierReference(token);
@@ -4703,16 +4711,18 @@ var Parser = class {
4703
4711
  this.index += 1;
4704
4712
  const key = createLiteralFromToken(token);
4705
4713
  if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
4706
- const value2 = this.parseObjectMethod(asyncToken, key.span.start);
4714
+ const value2 = this.parseObjectMethod(asyncToken, accessorStart ?? key.span.start, accessor, generatorToken);
4707
4715
  return {
4708
4716
  type: "Property",
4717
+ ...accessor === void 0 ? {} : { kind: accessor },
4709
4718
  computed: false,
4710
4719
  shorthand: false,
4711
4720
  key,
4712
4721
  value: value2,
4713
- span: createSpan2(asyncToken?.start ?? key.span.start, value2.span.end)
4722
+ span: createSpan2(value2.span.start, value2.span.end)
4714
4723
  };
4715
4724
  }
4725
+ if (generatorToken !== void 0) throw unexpectedTokenError(this.currentToken());
4716
4726
  this.expectPunctuator(":");
4717
4727
  const value = this.parseExpression();
4718
4728
  return {
@@ -4750,20 +4760,21 @@ var Parser = class {
4750
4760
  }
4751
4761
  return (propertyToken.type === "identifier" || propertyToken.type === "keyword" || propertyToken.type === "numeric" || propertyToken.type === "string") && this.peekToken(2).type === "punctuator" && this.peekToken(2).value === "(";
4752
4762
  }
4753
- parseObjectMethod(asyncToken, methodStart) {
4754
- const { params, body } = this.parseFunctionParts(false, {
4763
+ parseObjectMethod(asyncToken, methodStart, accessor, generatorToken) {
4764
+ const { params, body } = this.parseFunctionParts(generatorToken !== void 0, {
4755
4765
  ...ordinaryFunctionContext,
4756
- superProperty: true
4757
- });
4766
+ superProperty: true,
4767
+ ...accessor === void 0 ? {} : { await: false, strictAwait: true }
4768
+ }, accessor);
4758
4769
  return this.withFunctionSource({
4759
4770
  type: "FunctionExpression",
4760
4771
  async: asyncToken !== void 0,
4761
4772
  body,
4762
- generator: false,
4773
+ generator: generatorToken !== void 0,
4763
4774
  id: void 0,
4764
4775
  method: true,
4765
4776
  params,
4766
- span: createSpan2(asyncToken?.start ?? methodStart, body.span.end)
4777
+ span: createSpan2(asyncToken?.start ?? generatorToken?.start ?? methodStart, body.span.end)
4767
4778
  });
4768
4779
  }
4769
4780
  parseIdentifierName() {
@@ -13484,7 +13495,7 @@ var AS001Scanner = class {
13484
13495
  previousToken = token;
13485
13496
  continue;
13486
13497
  }
13487
- if (token.type === "punctuator" && token.value === "*" && isGeneratorMemberToken(previousToken, previousPreviousToken, braceContextStack)) {
13498
+ if (token.type === "punctuator" && token.value === "*" && previousToken?.value === "async" && isGeneratorMemberToken(previousToken, previousPreviousToken, braceContextStack)) {
13488
13499
  this.report("generator", token.start, token.end);
13489
13500
  }
13490
13501
  lastClosedControlParenthesis = token.type === "punctuator" ? updateGroupingState2(groupingStack, previousToken, token.value) : false;
@@ -28974,6 +28985,18 @@ async function evaluateObjectExpression(node, context) {
28974
28985
  if (value.kind !== "normal") {
28975
28986
  return value;
28976
28987
  }
28988
+ if (property.kind !== void 0) {
28989
+ if (!isSandboxClosure(value.value)) throw new TypeError("An accessor must be callable.");
28990
+ Object.defineProperty(materializeFunctionProperties(value.value), "name", {
28991
+ value: `${property.kind} ${String(key.value)}`
28992
+ });
28993
+ defineDataProperty(object, String(key.value), {
28994
+ [property.kind]: accessorAdapter(value.value, property.kind),
28995
+ configurable: true,
28996
+ enumerable: true
28997
+ }, context.budget);
28998
+ continue;
28999
+ }
28977
29000
  if (isObjectPrototypeSetterProperty(property, key.value)) {
28978
29001
  if (value.value === null || typeof value.value === "object") {
28979
29002
  setSandboxPrototype(object, value.value, context.budget);
@@ -35511,4 +35534,4 @@ export {
35511
35534
  FileSnapshotBackend,
35512
35535
  run
35513
35536
  };
35514
- //# sourceMappingURL=chunk-YKISHTWT.js.map
35537
+ //# sourceMappingURL=chunk-MOVL45AH.js.map