@poe-platform/safe-js 0.1.153 → 0.1.154
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/safe-js/chunks/{chunk-WL74XSIE.js → chunk-KHKBLB42.js} +108 -95
- package/dist/safe-js/chunks/chunk-KHKBLB42.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-45U4DCFW.js → chunk-OKUSX6EN.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/interp/async.d.ts +1 -0
- package/dist/safe-js/interp/interpreter.d.ts +1 -0
- package/dist/safe-js/interp/iteration.d.ts +2 -1
- package/dist/safe-js/interp/values.d.ts +4 -2
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-WL74XSIE.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-45U4DCFW.js.map → chunk-OKUSX6EN.js.map} +0 -0
|
@@ -3355,15 +3355,10 @@ var Parser = class {
|
|
|
3355
3355
|
const asyncToken = this.consumeKeyword("async");
|
|
3356
3356
|
const functionToken = this.expectKeyword("function");
|
|
3357
3357
|
const generatorToken = this.consumePunctuator("*");
|
|
3358
|
-
if (asyncToken !== void 0 && generatorToken !== void 0) {
|
|
3359
|
-
throw new Error(
|
|
3360
|
-
`async function* is not supported at line ${asyncToken.start.line}, column ${asyncToken.start.column}.`
|
|
3361
|
-
);
|
|
3362
|
-
}
|
|
3363
3358
|
const id = defaultExport && this.currentToken().value === "(" ? void 0 : this.parseBindingIdentifier();
|
|
3364
3359
|
if (id !== void 0) this.declareBinding(id, defaultExport ? "lexical" : "function");
|
|
3365
3360
|
const generator = generatorToken !== void 0;
|
|
3366
|
-
const { params, body } = this.parseFunctionParts(generator, ordinaryFunctionContext);
|
|
3361
|
+
const { params, body } = this.parseFunctionParts(generator, ordinaryFunctionContext, void 0, asyncToken !== void 0);
|
|
3367
3362
|
return this.withFunctionSource({
|
|
3368
3363
|
type: "FunctionDeclaration",
|
|
3369
3364
|
async: asyncToken !== void 0,
|
|
@@ -3409,7 +3404,7 @@ var Parser = class {
|
|
|
3409
3404
|
});
|
|
3410
3405
|
});
|
|
3411
3406
|
}
|
|
3412
|
-
parseFunctionParts(generator, lexicalContext, accessor) {
|
|
3407
|
+
parseFunctionParts(generator, lexicalContext, accessor, async = false) {
|
|
3413
3408
|
return this.withLexicalContext(lexicalContext, () => {
|
|
3414
3409
|
const params = this.withScope(() => {
|
|
3415
3410
|
const parsed = this.parseArrowParameters();
|
|
@@ -3422,7 +3417,7 @@ var Parser = class {
|
|
|
3422
3417
|
if (accessor === "set" && (params.length !== 1 || params[0]?.type === "RestElement"))
|
|
3423
3418
|
throw new Error("A setter must have exactly one non-rest parameter.");
|
|
3424
3419
|
const bodyTokenIndex = this.index;
|
|
3425
|
-
const body = this.withFunctionContext(generator ? "generator" : "normal", () => this.parseBlockStatement(params));
|
|
3420
|
+
const body = this.withFunctionContext(generator ? async ? "async-generator" : "generator" : "normal", () => this.parseBlockStatement(params));
|
|
3426
3421
|
if (accessor === "set" && params[0]?.type !== "Identifier") {
|
|
3427
3422
|
let directiveTokenIndex = bodyTokenIndex + 1;
|
|
3428
3423
|
for (const statement of body.body) {
|
|
@@ -3464,7 +3459,6 @@ var Parser = class {
|
|
|
3464
3459
|
async = true;
|
|
3465
3460
|
}
|
|
3466
3461
|
const generator = this.consumePunctuator("*") !== void 0;
|
|
3467
|
-
if (async && generator) throw new DisallowedSyntaxError("async generator", methodStart.start);
|
|
3468
3462
|
let accessor;
|
|
3469
3463
|
const modifier = this.currentToken();
|
|
3470
3464
|
if ((modifier.value === "get" || modifier.value === "set") && this.isObjectMethodStart()) {
|
|
@@ -3489,7 +3483,7 @@ var Parser = class {
|
|
|
3489
3483
|
return: true,
|
|
3490
3484
|
await: async,
|
|
3491
3485
|
strictAwait: true
|
|
3492
|
-
}, accessor);
|
|
3486
|
+
}, accessor, async);
|
|
3493
3487
|
const value2 = this.withFunctionSource({
|
|
3494
3488
|
type: "FunctionExpression",
|
|
3495
3489
|
async,
|
|
@@ -4130,7 +4124,7 @@ var Parser = class {
|
|
|
4130
4124
|
};
|
|
4131
4125
|
}
|
|
4132
4126
|
if (token.type === "keyword" && token.value === "yield") {
|
|
4133
|
-
if (this.functionContext !== "generator") {
|
|
4127
|
+
if (this.functionContext !== "generator" && this.functionContext !== "async-generator") {
|
|
4134
4128
|
throw new Error(
|
|
4135
4129
|
`yield is only valid inside a generator body at line ${token.start.line}, column ${token.start.column}.`
|
|
4136
4130
|
);
|
|
@@ -4510,14 +4504,9 @@ var Parser = class {
|
|
|
4510
4504
|
const asyncToken = this.consumeKeyword("async");
|
|
4511
4505
|
const functionToken = this.expectKeyword("function");
|
|
4512
4506
|
const generatorToken = this.consumePunctuator("*");
|
|
4513
|
-
if (asyncToken !== void 0 && generatorToken !== void 0) {
|
|
4514
|
-
throw new Error(
|
|
4515
|
-
`async function* is not supported at line ${asyncToken.start.line}, column ${asyncToken.start.column}.`
|
|
4516
|
-
);
|
|
4517
|
-
}
|
|
4518
4507
|
const id = isIdentifierLikeToken(this.currentToken()) ? this.parseBindingIdentifier() : void 0;
|
|
4519
4508
|
const generator = generatorToken !== void 0;
|
|
4520
|
-
const { params, body } = this.parseFunctionParts(generator, ordinaryFunctionContext);
|
|
4509
|
+
const { params, body } = this.parseFunctionParts(generator, ordinaryFunctionContext, void 0, asyncToken !== void 0);
|
|
4521
4510
|
return this.withFunctionSource({
|
|
4522
4511
|
type: "FunctionExpression",
|
|
4523
4512
|
async: asyncToken !== void 0,
|
|
@@ -4620,10 +4609,10 @@ var Parser = class {
|
|
|
4620
4609
|
}
|
|
4621
4610
|
parseObjectProperty() {
|
|
4622
4611
|
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;
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4612
|
+
const asyncGeneratorToken = generatorToken !== void 0 && this.currentToken().value === "async" ? this.currentToken() : void 0;
|
|
4613
|
+
if (asyncGeneratorToken !== void 0) {
|
|
4614
|
+
if (hasLineBreakBetween(asyncGeneratorToken, generatorToken)) throw unexpectedTokenError(generatorToken);
|
|
4615
|
+
this.index++;
|
|
4627
4616
|
}
|
|
4628
4617
|
if (generatorToken !== void 0) this.index++;
|
|
4629
4618
|
let accessor;
|
|
@@ -4637,8 +4626,8 @@ var Parser = class {
|
|
|
4637
4626
|
this.index++;
|
|
4638
4627
|
}
|
|
4639
4628
|
const modifierToken = this.currentToken();
|
|
4640
|
-
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;
|
|
4641
|
-
if (asyncToken !== void 0) {
|
|
4629
|
+
const asyncToken = asyncGeneratorToken ?? (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);
|
|
4630
|
+
if (asyncToken !== void 0 && asyncGeneratorToken === void 0) {
|
|
4642
4631
|
this.index += 1;
|
|
4643
4632
|
}
|
|
4644
4633
|
if (this.consumePunctuator("[") !== void 0) {
|
|
@@ -4766,7 +4755,7 @@ var Parser = class {
|
|
|
4766
4755
|
...ordinaryFunctionContext,
|
|
4767
4756
|
superProperty: true,
|
|
4768
4757
|
...accessor === void 0 ? {} : { await: false, strictAwait: true }
|
|
4769
|
-
}, accessor);
|
|
4758
|
+
}, accessor, asyncToken !== void 0);
|
|
4770
4759
|
return this.withFunctionSource({
|
|
4771
4760
|
type: "FunctionExpression",
|
|
4772
4761
|
async: asyncToken !== void 0,
|
|
@@ -8096,6 +8085,9 @@ function validateTaggedValue(record2, path, state) {
|
|
|
8096
8085
|
}
|
|
8097
8086
|
}
|
|
8098
8087
|
function validateGeneratorShape(record2, path, state) {
|
|
8088
|
+
if (record2.async !== void 0 && typeof record2.async !== "boolean") {
|
|
8089
|
+
fail("invalidType", `${path}.async`, "generator async flag must be a boolean");
|
|
8090
|
+
}
|
|
8099
8091
|
if (!["start", "suspended", "done"].includes(String(record2.state))) {
|
|
8100
8092
|
fail("invalidState", `${path}.state`, "unknown generator state");
|
|
8101
8093
|
}
|
|
@@ -9956,7 +9948,7 @@ function getSandboxIterator(value, budget, context) {
|
|
|
9956
9948
|
return syncIterator(Float32Array.prototype.values.call(value));
|
|
9957
9949
|
}
|
|
9958
9950
|
if (isSandboxGenerator(value)) {
|
|
9959
|
-
return generatorIterator(value);
|
|
9951
|
+
return value.async ? void 0 : generatorIterator(value);
|
|
9960
9952
|
}
|
|
9961
9953
|
if (typeof value === "string") {
|
|
9962
9954
|
return syncIterator(value[Symbol.iterator]());
|
|
@@ -10011,11 +10003,17 @@ function collectionIterator(collection) {
|
|
|
10011
10003
|
}
|
|
10012
10004
|
};
|
|
10013
10005
|
}
|
|
10014
|
-
|
|
10006
|
+
var asyncGeneratorRequests = /* @__PURE__ */ new WeakMap();
|
|
10007
|
+
function generatorIterator(generator, budget) {
|
|
10015
10008
|
const invoke = async (method, value) => {
|
|
10016
10009
|
const leaveRunning = enterRunningState(generator);
|
|
10010
|
+
const initialState = generator.state;
|
|
10017
10011
|
generator.state = "running";
|
|
10018
10012
|
try {
|
|
10013
|
+
if (generator.async && method === "return" && (initialState === "start" || initialState === "done")) {
|
|
10014
|
+
if (initialState === "start") await generator.channel.return();
|
|
10015
|
+
value = await awaitSandboxValue(value, void 0, budget);
|
|
10016
|
+
}
|
|
10019
10017
|
const result = await generator.channel[method](value);
|
|
10020
10018
|
generator.state = result.done ? "done" : "suspended";
|
|
10021
10019
|
return result;
|
|
@@ -10026,11 +10024,18 @@ function generatorIterator(generator) {
|
|
|
10026
10024
|
leaveRunning();
|
|
10027
10025
|
}
|
|
10028
10026
|
};
|
|
10027
|
+
const request = (method, value) => {
|
|
10028
|
+
if (!generator.async) return invoke(method, value);
|
|
10029
|
+
const previous = asyncGeneratorRequests.get(generator) ?? Promise.resolve();
|
|
10030
|
+
const result = previous.then(() => invoke(method, value));
|
|
10031
|
+
asyncGeneratorRequests.set(generator, result.catch(() => void 0));
|
|
10032
|
+
return result;
|
|
10033
|
+
};
|
|
10029
10034
|
return {
|
|
10030
10035
|
generator: true,
|
|
10031
|
-
next: (value) =>
|
|
10032
|
-
return: (value) =>
|
|
10033
|
-
throw: (error) =>
|
|
10036
|
+
next: (value) => request("next", value),
|
|
10037
|
+
return: (value) => request("return", value),
|
|
10038
|
+
throw: (error) => request("throw", error)
|
|
10034
10039
|
};
|
|
10035
10040
|
}
|
|
10036
10041
|
function syncIterator(iterator) {
|
|
@@ -13496,9 +13501,6 @@ var AS001Scanner = class {
|
|
|
13496
13501
|
previousToken = token;
|
|
13497
13502
|
continue;
|
|
13498
13503
|
}
|
|
13499
|
-
if (token.type === "punctuator" && token.value === "*" && previousToken?.value === "async" && isGeneratorMemberToken(previousToken, previousPreviousToken, braceContextStack)) {
|
|
13500
|
-
this.report("generator", token.start, token.end);
|
|
13501
|
-
}
|
|
13502
13504
|
lastClosedControlParenthesis = token.type === "punctuator" ? updateGroupingState2(groupingStack, previousToken, token.value) : false;
|
|
13503
13505
|
canStartStatement = updateStatementStart(
|
|
13504
13506
|
token,
|
|
@@ -13842,19 +13844,6 @@ function isMemberNameToken(token, previousToken, previousPreviousToken, braceCon
|
|
|
13842
13844
|
}
|
|
13843
13845
|
return previousToken?.type === "punctuator" && previousToken.value === "*";
|
|
13844
13846
|
}
|
|
13845
|
-
function isGeneratorMemberToken(previousToken, previousPreviousToken, braceContextStack) {
|
|
13846
|
-
const memberContext = braceContextStack.at(-1);
|
|
13847
|
-
if (memberContext === void 0) {
|
|
13848
|
-
return false;
|
|
13849
|
-
}
|
|
13850
|
-
if (memberContext.kind !== "class" && memberContext.kind !== "object") {
|
|
13851
|
-
return false;
|
|
13852
|
-
}
|
|
13853
|
-
if (isMemberEntryStart(previousToken, memberContext.kind)) {
|
|
13854
|
-
return true;
|
|
13855
|
-
}
|
|
13856
|
-
return isMemberModifierToken(previousToken) && isMemberEntryStart(previousPreviousToken, memberContext.kind);
|
|
13857
|
-
}
|
|
13858
13847
|
function isMemberEntryStart(token, kind) {
|
|
13859
13848
|
if (token?.type !== "punctuator") {
|
|
13860
13849
|
return false;
|
|
@@ -17645,7 +17634,7 @@ var ASAsyncNotNeededScanner = class {
|
|
|
17645
17634
|
this.visitExpression(node.body);
|
|
17646
17635
|
}
|
|
17647
17636
|
visitFunctionExpression(node, isDefaultExport = false) {
|
|
17648
|
-
if (node.async && !isDefaultExport && !bodyContainsAwait(node.body)) {
|
|
17637
|
+
if (node.async && !node.generator && !isDefaultExport && !bodyContainsAwait(node.body)) {
|
|
17649
17638
|
this.report(createAsyncKeywordSpan(node.span));
|
|
17650
17639
|
}
|
|
17651
17640
|
for (const param of node.params) {
|
|
@@ -28011,13 +28000,13 @@ function getGeneratorMember(target, property, budget) {
|
|
|
28011
28000
|
return createSandboxClosure({
|
|
28012
28001
|
sandbox: true,
|
|
28013
28002
|
name: property,
|
|
28014
|
-
call:
|
|
28015
|
-
const iterator =
|
|
28016
|
-
const result =
|
|
28017
|
-
|
|
28018
|
-
{ value: result.value, done: result.done === true },
|
|
28003
|
+
call: ([value]) => {
|
|
28004
|
+
const iterator = generatorIterator(target, budget);
|
|
28005
|
+
const result = Promise.resolve(iterator[property](value)).then((result2) => allocateProducedSandboxValue(
|
|
28006
|
+
{ value: result2.value, done: result2.done === true },
|
|
28019
28007
|
budget
|
|
28020
|
-
);
|
|
28008
|
+
));
|
|
28009
|
+
return target.async ? createSandboxPromise(result) : result;
|
|
28021
28010
|
}
|
|
28022
28011
|
});
|
|
28023
28012
|
}
|
|
@@ -28775,6 +28764,7 @@ async function interpret(node, options = {}) {
|
|
|
28775
28764
|
),
|
|
28776
28765
|
generatorResume: options.generatorResume,
|
|
28777
28766
|
generatorYield: options.generatorYield,
|
|
28767
|
+
asyncGenerator: options.asyncGenerator,
|
|
28778
28768
|
resumeTarget: { nodeId: options.snapshot?.resumeNodeId }
|
|
28779
28769
|
};
|
|
28780
28770
|
const evaluation = await withCancellationSignal(
|
|
@@ -30232,7 +30222,7 @@ async function evaluateReturnStatement(node, context) {
|
|
|
30232
30222
|
return {
|
|
30233
30223
|
kind: "return",
|
|
30234
30224
|
hasValue: argument.hasValue,
|
|
30235
|
-
value: argument.value
|
|
30225
|
+
value: context.asyncGenerator ? await suspendJob(awaitSandboxValue(argument.value, context.signal, context.budget)) : argument.value
|
|
30236
30226
|
};
|
|
30237
30227
|
}
|
|
30238
30228
|
async function evaluateYieldExpression(node, context) {
|
|
@@ -30249,25 +30239,35 @@ async function evaluateYieldExpression(node, context) {
|
|
|
30249
30239
|
if (argument.kind !== "normal") {
|
|
30250
30240
|
return argument;
|
|
30251
30241
|
}
|
|
30252
|
-
const
|
|
30253
|
-
|
|
30254
|
-
|
|
30255
|
-
|
|
30242
|
+
const completion = await yieldGeneratorValue(argument.value, node, context);
|
|
30243
|
+
context.generatorResume = void 0;
|
|
30244
|
+
return generatorCompletionResult(completion);
|
|
30245
|
+
}
|
|
30246
|
+
async function yieldGeneratorValue(value, node, context) {
|
|
30247
|
+
if (context.asyncGenerator) value = await suspendJob(awaitSandboxValue(value, context.signal, context.budget));
|
|
30248
|
+
const completionPromise = context.generatorYield(allocateProducedSandboxValue(value, context.budget), node.nodeId);
|
|
30256
30249
|
emitResumeBreakpoint(context, {
|
|
30257
30250
|
kind: "generator-yield",
|
|
30258
30251
|
nodeId: node.nodeId,
|
|
30259
30252
|
span: node.span
|
|
30260
30253
|
});
|
|
30261
|
-
const completion = await completionPromise;
|
|
30262
|
-
context.
|
|
30263
|
-
|
|
30254
|
+
const completion = await (context.asyncGenerator ? suspendJob(completionPromise) : completionPromise);
|
|
30255
|
+
if (context.asyncGenerator && completion.type === "return") {
|
|
30256
|
+
try {
|
|
30257
|
+
return { type: "return", value: await suspendJob(awaitSandboxValue(completion.value, context.signal, context.budget)) };
|
|
30258
|
+
} catch (error) {
|
|
30259
|
+
return { type: "throw", value: error };
|
|
30260
|
+
}
|
|
30261
|
+
}
|
|
30262
|
+
return completion;
|
|
30264
30263
|
}
|
|
30265
30264
|
async function evaluateYieldDelegate(node, context) {
|
|
30266
30265
|
const argument = await evaluateNode(node.argument, context);
|
|
30267
30266
|
if (argument.kind !== "normal") {
|
|
30268
30267
|
return argument;
|
|
30269
30268
|
}
|
|
30270
|
-
const
|
|
30269
|
+
const asyncDelegate = context.asyncGenerator && isSandboxGenerator(argument.value) && argument.value.async ? argument.value : void 0;
|
|
30270
|
+
const iterator = asyncDelegate ? generatorIterator(asyncDelegate, context.budget) : getSandboxIterator(
|
|
30271
30271
|
argument.value,
|
|
30272
30272
|
context.budget,
|
|
30273
30273
|
createCoercionContext(context)
|
|
@@ -30291,19 +30291,35 @@ async function evaluateYieldDelegate(node, context) {
|
|
|
30291
30291
|
const iteratorMethod = iterator[method];
|
|
30292
30292
|
if (iteratorMethod === void 0) {
|
|
30293
30293
|
if (completion.type === "throw") {
|
|
30294
|
-
|
|
30294
|
+
await closeIterator(iterator);
|
|
30295
|
+
throw new TypeError("Delegated iterator does not provide a throw method.");
|
|
30295
30296
|
}
|
|
30296
30297
|
return generatorCompletionResult(completion);
|
|
30297
30298
|
}
|
|
30298
|
-
const
|
|
30299
|
-
|
|
30299
|
+
const pendingResult = Promise.resolve(iteratorMethod(completion.value));
|
|
30300
|
+
const result = await (context.asyncGenerator ? suspendJob(pendingResult) : pendingResult);
|
|
30301
|
+
if (typeof result !== "object" && typeof result !== "function" || result === null) {
|
|
30302
|
+
throw new TypeError("Iterator result must be an object.");
|
|
30303
|
+
}
|
|
30304
|
+
const done = result.done;
|
|
30305
|
+
let value = result.value;
|
|
30306
|
+
if (context.asyncGenerator) {
|
|
30307
|
+
try {
|
|
30308
|
+
value = await suspendJob(awaitSandboxValue(value, context.signal, context.budget));
|
|
30309
|
+
} catch (error) {
|
|
30310
|
+
if (isFatalSandboxError(error) || error instanceof HostCallResumabilityError) throw error;
|
|
30311
|
+
if (!asyncDelegate && !done && method !== "return") await closeIterator(iterator, true);
|
|
30312
|
+
throw error;
|
|
30313
|
+
}
|
|
30314
|
+
}
|
|
30315
|
+
if (done) {
|
|
30300
30316
|
if (completion.type === "return") {
|
|
30301
|
-
return generatorCompletionResult({ type: "return", value
|
|
30317
|
+
return generatorCompletionResult({ type: "return", value });
|
|
30302
30318
|
}
|
|
30303
30319
|
return {
|
|
30304
30320
|
kind: "normal",
|
|
30305
30321
|
hasValue: true,
|
|
30306
|
-
value
|
|
30322
|
+
value
|
|
30307
30323
|
};
|
|
30308
30324
|
}
|
|
30309
30325
|
if (replayIndex < replay.length - 1) {
|
|
@@ -30311,16 +30327,7 @@ async function evaluateYieldDelegate(node, context) {
|
|
|
30311
30327
|
replayIndex += 1;
|
|
30312
30328
|
continue;
|
|
30313
30329
|
}
|
|
30314
|
-
|
|
30315
|
-
allocateProducedSandboxValue(result.value, context.budget),
|
|
30316
|
-
node.nodeId
|
|
30317
|
-
);
|
|
30318
|
-
emitResumeBreakpoint(context, {
|
|
30319
|
-
kind: "generator-yield",
|
|
30320
|
-
nodeId: node.nodeId,
|
|
30321
|
-
span: node.span
|
|
30322
|
-
});
|
|
30323
|
-
completion = await completionPromise;
|
|
30330
|
+
completion = await yieldGeneratorValue(value, node, context);
|
|
30324
30331
|
context.generatorResume = void 0;
|
|
30325
30332
|
}
|
|
30326
30333
|
} finally {
|
|
@@ -31792,25 +31799,30 @@ function createGeneratorClosure(node, context, evaluateNode2) {
|
|
|
31792
31799
|
closureContext,
|
|
31793
31800
|
evaluateNode2
|
|
31794
31801
|
);
|
|
31795
|
-
const channel = createGeneratorChannel(
|
|
31796
|
-
const
|
|
31797
|
-
|
|
31798
|
-
|
|
31799
|
-
|
|
31800
|
-
|
|
31801
|
-
|
|
31802
|
-
|
|
31803
|
-
|
|
31804
|
-
|
|
31805
|
-
|
|
31806
|
-
|
|
31807
|
-
|
|
31808
|
-
|
|
31809
|
-
|
|
31810
|
-
|
|
31811
|
-
|
|
31802
|
+
const channel = createGeneratorChannel((generatorYield) => {
|
|
31803
|
+
const execute = async () => {
|
|
31804
|
+
const result = await evaluateNode2(node.body, {
|
|
31805
|
+
...closureContext,
|
|
31806
|
+
functionBody: node.body,
|
|
31807
|
+
asyncGenerator: node.async,
|
|
31808
|
+
generatorYield: (value2, yieldNodeId) => {
|
|
31809
|
+
generator.state = "suspended";
|
|
31810
|
+
return generatorYield(value2, yieldNodeId);
|
|
31811
|
+
},
|
|
31812
|
+
scope
|
|
31813
|
+
});
|
|
31814
|
+
if (result.kind === "error") {
|
|
31815
|
+
throw result.error;
|
|
31816
|
+
}
|
|
31817
|
+
if (result.kind === "throw") {
|
|
31818
|
+
throw result.value;
|
|
31819
|
+
}
|
|
31820
|
+
const value = result.hasValue ? result.value : void 0;
|
|
31821
|
+
return node.async ? awaitSandboxValue(value, context.signal, context.budget) : value;
|
|
31822
|
+
};
|
|
31823
|
+
return node.async ? runAsyncPrefix(execute) : execute();
|
|
31812
31824
|
});
|
|
31813
|
-
const generator = createSandboxGenerator(channel);
|
|
31825
|
+
const generator = createSandboxGenerator(channel, { async: node.async });
|
|
31814
31826
|
return generator;
|
|
31815
31827
|
}
|
|
31816
31828
|
});
|
|
@@ -31852,6 +31864,7 @@ async function executeClosure(node, args, thisValue, context, evaluateNode2) {
|
|
|
31852
31864
|
const scope = await createClosureScope(node, args, thisValue, context, evaluateNode2);
|
|
31853
31865
|
const result = await evaluateNode2(node.body, {
|
|
31854
31866
|
...context,
|
|
31867
|
+
asyncGenerator: false,
|
|
31855
31868
|
functionBody: node.body.type === "BlockStatement" ? node.body : void 0,
|
|
31856
31869
|
scope
|
|
31857
31870
|
});
|
|
@@ -35597,4 +35610,4 @@ export {
|
|
|
35597
35610
|
FileSnapshotBackend,
|
|
35598
35611
|
run
|
|
35599
35612
|
};
|
|
35600
|
-
//# sourceMappingURL=chunk-
|
|
35613
|
+
//# sourceMappingURL=chunk-KHKBLB42.js.map
|