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 +29 -28
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-TVZKHJOO.js → chunk-BESE73VB.js} +29 -28
- package/packages/safejs/dist/chunks/chunk-BESE73VB.js.map +7 -0
- package/packages/safejs/dist/chunks/{chunk-776EUEUM.js → chunk-DF7PY5YX.js} +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/interpreter.js +14 -15
- package/packages/safejs/dist/interp/methods/array.js +3 -0
- package/packages/safejs/dist/parse/parser.js +23 -19
- package/packages/safejs/dist/chunks/chunk-TVZKHJOO.js.map +0 -7
- /package/packages/safejs/dist/chunks/{chunk-776EUEUM.js.map → chunk-DF7PY5YX.js.map} +0 -0
package/package.json
CHANGED
|
@@ -3767,26 +3767,31 @@ var Parser = class {
|
|
|
3767
3767
|
`Generator shorthand methods are not supported at line ${generatorToken.start.line}, column ${generatorToken.start.column}.`
|
|
3768
3768
|
);
|
|
3769
3769
|
}
|
|
3770
|
-
if (this.currentToken().type === "identifier" && (this.currentToken().value === "get" || this.currentToken().value === "set") && this.
|
|
3770
|
+
if (this.currentToken().type === "identifier" && (this.currentToken().value === "get" || this.currentToken().value === "set") && this.isObjectMethodStart()) {
|
|
3771
3771
|
const token2 = this.currentToken();
|
|
3772
3772
|
const syntax = token2.value === "get" ? "Getter" : "Setter";
|
|
3773
3773
|
throw new Error(
|
|
3774
3774
|
`${syntax} shorthand methods are not supported at line ${token2.start.line}, column ${token2.start.column}.`
|
|
3775
3775
|
);
|
|
3776
3776
|
}
|
|
3777
|
+
const modifierToken = this.currentToken();
|
|
3778
|
+
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;
|
|
3779
|
+
if (asyncToken !== void 0) {
|
|
3780
|
+
this.index += 1;
|
|
3781
|
+
}
|
|
3777
3782
|
if (this.consumePunctuator("[") !== void 0) {
|
|
3778
3783
|
const propertyStart = this.previousToken();
|
|
3779
3784
|
const key = this.parseExpression();
|
|
3780
3785
|
this.expectPunctuator("]");
|
|
3781
3786
|
if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
|
|
3782
|
-
const value2 = this.parseObjectMethod(
|
|
3787
|
+
const value2 = this.parseObjectMethod(asyncToken, propertyStart.start);
|
|
3783
3788
|
return {
|
|
3784
3789
|
type: "Property",
|
|
3785
3790
|
computed: true,
|
|
3786
3791
|
shorthand: false,
|
|
3787
3792
|
key: key.node,
|
|
3788
3793
|
value: value2,
|
|
3789
|
-
span: createSpan2(propertyStart.start, value2.span.end)
|
|
3794
|
+
span: createSpan2(asyncToken?.start ?? propertyStart.start, value2.span.end)
|
|
3790
3795
|
};
|
|
3791
3796
|
}
|
|
3792
3797
|
this.expectPunctuator(":");
|
|
@@ -3800,12 +3805,8 @@ var Parser = class {
|
|
|
3800
3805
|
span: createSpan2(propertyStart.start, value.node.span.end)
|
|
3801
3806
|
};
|
|
3802
3807
|
}
|
|
3803
|
-
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;
|
|
3804
|
-
if (asyncToken !== void 0) {
|
|
3805
|
-
this.index += 1;
|
|
3806
|
-
}
|
|
3807
3808
|
const token = this.currentToken();
|
|
3808
|
-
if (isIdentifierLikeToken(token)) {
|
|
3809
|
+
if (isIdentifierLikeToken(token) || token.type === "keyword" && this.peekToken(1).type === "punctuator" && this.peekToken(1).value === "(") {
|
|
3809
3810
|
this.index += 1;
|
|
3810
3811
|
const key = createIdentifier2(token);
|
|
3811
3812
|
if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
|
|
@@ -3844,14 +3845,14 @@ var Parser = class {
|
|
|
3844
3845
|
this.index += 1;
|
|
3845
3846
|
const key = createLiteralFromToken(token);
|
|
3846
3847
|
if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
|
|
3847
|
-
const value2 = this.parseObjectMethod(
|
|
3848
|
+
const value2 = this.parseObjectMethod(asyncToken, key.span.start);
|
|
3848
3849
|
return {
|
|
3849
3850
|
type: "Property",
|
|
3850
3851
|
computed: false,
|
|
3851
3852
|
shorthand: false,
|
|
3852
3853
|
key,
|
|
3853
3854
|
value: value2,
|
|
3854
|
-
span: createSpan2(key.span.start, value2.span.end)
|
|
3855
|
+
span: createSpan2(asyncToken?.start ?? key.span.start, value2.span.end)
|
|
3855
3856
|
};
|
|
3856
3857
|
}
|
|
3857
3858
|
this.expectPunctuator(":");
|
|
@@ -3867,7 +3868,7 @@ var Parser = class {
|
|
|
3867
3868
|
}
|
|
3868
3869
|
throw unexpectedTokenError(token);
|
|
3869
3870
|
}
|
|
3870
|
-
|
|
3871
|
+
isObjectMethodStart() {
|
|
3871
3872
|
const propertyToken = this.peekToken(1);
|
|
3872
3873
|
if (propertyToken.type === "punctuator" && propertyToken.value === "[") {
|
|
3873
3874
|
let depth = 0;
|
|
@@ -3889,7 +3890,7 @@ var Parser = class {
|
|
|
3889
3890
|
offset += 1;
|
|
3890
3891
|
}
|
|
3891
3892
|
}
|
|
3892
|
-
return (
|
|
3893
|
+
return (propertyToken.type === "identifier" || propertyToken.type === "keyword" || propertyToken.type === "numeric" || propertyToken.type === "string") && this.peekToken(2).type === "punctuator" && this.peekToken(2).value === "(";
|
|
3893
3894
|
}
|
|
3894
3895
|
parseObjectMethod(asyncToken, methodStart) {
|
|
3895
3896
|
const params = this.withScope(() => {
|
|
@@ -23946,6 +23947,9 @@ function getArrayMember(value, property, options) {
|
|
|
23946
23947
|
if (property === "length") {
|
|
23947
23948
|
return value.length;
|
|
23948
23949
|
}
|
|
23950
|
+
if (Object.hasOwn(value, property)) {
|
|
23951
|
+
return value[String(property)];
|
|
23952
|
+
}
|
|
23949
23953
|
if (isArrayMethodName(property)) {
|
|
23950
23954
|
return createSandboxClosure({
|
|
23951
23955
|
sandbox: true,
|
|
@@ -27336,7 +27340,7 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
27336
27340
|
if (typeof member.object === "number" && isNumberMethodName(member.property)) {
|
|
27337
27341
|
return evaluateNumberMethodCall(node, member.object, member.property, context);
|
|
27338
27342
|
}
|
|
27339
|
-
if (Array.isArray(member.object) && isArrayMethodName(member.property)) {
|
|
27343
|
+
if (Array.isArray(member.object) && isArrayMethodName(member.property) && !Object.hasOwn(member.object, member.property)) {
|
|
27340
27344
|
return evaluateArrayMethodCall(node, member.object, member.property, context);
|
|
27341
27345
|
}
|
|
27342
27346
|
if (isSandboxMap(member.object) && isMapMethodName(member.property)) {
|
|
@@ -27363,7 +27367,7 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
27363
27367
|
context
|
|
27364
27368
|
);
|
|
27365
27369
|
}
|
|
27366
|
-
if (Array.isArray(member.object)) {
|
|
27370
|
+
if (Array.isArray(member.object) && !Object.hasOwn(member.object, member.property)) {
|
|
27367
27371
|
return evaluatePrimitiveMemberCall(
|
|
27368
27372
|
node,
|
|
27369
27373
|
"Array",
|
|
@@ -27835,7 +27839,7 @@ function getMemberValue(target, property, context) {
|
|
|
27835
27839
|
return Object.hasOwn(target, String(property)) ? target[String(property)] : void 0;
|
|
27836
27840
|
}
|
|
27837
27841
|
function getArrayMemberValue(target, property, context) {
|
|
27838
|
-
if (property === "raw") {
|
|
27842
|
+
if (property === "raw" && taggedTemplateRawArrays.has(target)) {
|
|
27839
27843
|
return taggedTemplateRawArrays.get(target);
|
|
27840
27844
|
}
|
|
27841
27845
|
return getArrayMember(target, property, createArrayMethodOptions(context));
|
|
@@ -27876,23 +27880,20 @@ function getClosureMemberValue(target, property, context) {
|
|
|
27876
27880
|
return getFunctionMember(target, property, createFunctionMethodOptions(context));
|
|
27877
27881
|
}
|
|
27878
27882
|
async function evaluateResolvedCallExpression(node, callee, context, thisValue = void 0) {
|
|
27879
|
-
if (callee === null || callee === void 0) {
|
|
27880
|
-
|
|
27881
|
-
|
|
27882
|
-
|
|
27883
|
-
|
|
27884
|
-
|
|
27885
|
-
};
|
|
27886
|
-
}
|
|
27887
|
-
throw new TypeError("Attempted to call a non-function value.");
|
|
27888
|
-
}
|
|
27889
|
-
if (!isSandboxClosure(callee)) {
|
|
27890
|
-
throw new TypeError("Attempted to call a non-function value.");
|
|
27883
|
+
if ((callee === null || callee === void 0) && node.optional) {
|
|
27884
|
+
return {
|
|
27885
|
+
kind: "normal",
|
|
27886
|
+
hasValue: true,
|
|
27887
|
+
value: void 0
|
|
27888
|
+
};
|
|
27891
27889
|
}
|
|
27892
27890
|
const args = await evaluateCallArguments(node.arguments, context);
|
|
27893
27891
|
if (!args.ok) {
|
|
27894
27892
|
return args.result;
|
|
27895
27893
|
}
|
|
27894
|
+
if (!isSandboxClosure(callee)) {
|
|
27895
|
+
throw new TypeError("Attempted to call a non-function value.");
|
|
27896
|
+
}
|
|
27896
27897
|
return {
|
|
27897
27898
|
kind: "normal",
|
|
27898
27899
|
hasValue: true,
|
|
@@ -28984,4 +28985,4 @@ export {
|
|
|
28984
28985
|
FileSnapshotBackend,
|
|
28985
28986
|
run
|
|
28986
28987
|
};
|
|
28987
|
-
//# sourceMappingURL=chunk-
|
|
28988
|
+
//# sourceMappingURL=chunk-BESE73VB.js.map
|