poe-code 4.0.58 → 4.0.60

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.
Files changed (50) hide show
  1. package/dist/cli/commands/models.js +8 -6
  2. package/dist/cli/commands/models.js.map +1 -1
  3. package/dist/cli/program.js +2 -1
  4. package/dist/cli/program.js.map +1 -1
  5. package/dist/index.js +503 -454
  6. package/dist/index.js.map +4 -4
  7. package/dist/metafile.json +1 -1
  8. package/package.json +1 -1
  9. package/packages/safejs/dist/graph-depth.js +4 -0
  10. package/packages/safejs/dist/interp/arguments.d.ts +10 -0
  11. package/packages/safejs/dist/interp/arguments.js +44 -0
  12. package/packages/safejs/dist/interp/async.js +3 -1
  13. package/packages/safejs/dist/interp/values.d.ts +1 -1
  14. package/packages/safejs/dist/interp/values.js +27 -2
  15. package/packages/safejs/dist/lint/index.js +0 -2
  16. package/packages/safejs/dist/lint/rules/AS-async-not-needed.d.ts +1 -1
  17. package/packages/safejs/dist/lint/rules/AS-async-not-needed.js +15 -3
  18. package/packages/safejs/dist/lint/rules/AS-await-non-promise.js +10 -0
  19. package/packages/safejs/dist/lint/rules/AS-destructure-null-default.js +9 -0
  20. package/packages/safejs/dist/lint/rules/AS-export-import-meta.js +17 -0
  21. package/packages/safejs/dist/lint/rules/AS-floating-promise.js +23 -2
  22. package/packages/safejs/dist/lint/rules/AS-frontmatter-field-unused.js +9 -0
  23. package/packages/safejs/dist/lint/rules/AS-jsdoc-type.js +10 -0
  24. package/packages/safejs/dist/lint/rules/AS-large-literal.js +9 -0
  25. package/packages/safejs/dist/lint/rules/AS-missing-async.d.ts +1 -1
  26. package/packages/safejs/dist/lint/rules/AS-missing-async.js +9 -1
  27. package/packages/safejs/dist/lint/rules/AS-mutating-frozen.js +9 -0
  28. package/packages/safejs/dist/lint/rules/AS-needless-template.js +9 -0
  29. package/packages/safejs/dist/lint/rules/AS-shadow-global.js +12 -0
  30. package/packages/safejs/dist/lint/rules/AS-unbounded-loop.js +9 -0
  31. package/packages/safejs/dist/lint/rules/AS-unreachable.js +9 -1
  32. package/packages/safejs/dist/lint/rules/AS-unused-import.js +22 -0
  33. package/packages/safejs/dist/lint/rules/AS001.js +0 -6
  34. package/packages/safejs/dist/lint/rules/AS003.js +22 -0
  35. package/packages/safejs/dist/lint/rules/AS006-007.js +19 -0
  36. package/packages/safejs/dist/lint/rules/AS008.js +9 -0
  37. package/packages/safejs/dist/lint/rules/AS009.js +9 -0
  38. package/packages/safejs/dist/lint/rules/AS010.js +9 -0
  39. package/packages/safejs/dist/lint/rules/AS011.js +9 -0
  40. package/packages/safejs/dist/lint/rules/AS015.js +9 -0
  41. package/packages/safejs/dist/parse/parser.d.ts +1 -0
  42. package/packages/safejs/dist/snapshot/arguments.d.ts +17 -0
  43. package/packages/safejs/dist/snapshot/arguments.js +34 -0
  44. package/packages/safejs/dist/snapshot/dump-format.js +15 -3
  45. package/packages/safejs/dist/snapshot/restore.js +27 -1
  46. package/packages/safejs/dist/snapshot/serialize.d.ts +2 -1
  47. package/packages/safejs/dist/snapshot/serialize.js +20 -10
  48. package/packages/safejs/dist/snapshot/validation.js +50 -1
  49. package/packages/safejs/dist/lint/rules/AS012.d.ts +0 -13
  50. package/packages/safejs/dist/lint/rules/AS012.js +0 -384
package/dist/index.js CHANGED
@@ -107181,6 +107181,13 @@ function registerModelsCommand(program, container) {
107181
107181
  );
107182
107182
  return;
107183
107183
  }
107184
+ if (commandOptions.view === "parameters") {
107185
+ filtered = filtered.filter((model) => model.parameters.length > 0);
107186
+ if (filtered.length === 0) {
107187
+ resources.logger.info("No models with parameters match the given filters.");
107188
+ return;
107189
+ }
107190
+ }
107184
107191
  filtered.sort((a, b) => b.created - a.created);
107185
107192
  const matchCount = filtered.length;
107186
107193
  filtered = filtered.slice(0, limit);
@@ -107192,11 +107199,6 @@ function registerModelsCommand(program, container) {
107192
107199
  let columns5;
107193
107200
  let rows;
107194
107201
  if (commandOptions.view === "parameters") {
107195
- const withParams = filtered.filter((m) => m.parameters.length > 0);
107196
- if (withParams.length === 0) {
107197
- resources.logger.info("No models with parameters match the given filters.");
107198
- return;
107199
- }
107200
107202
  columns5 = [
107201
107203
  { name: "Model", title: "Model", alignment: "left", maxLen: 35 },
107202
107204
  { name: "Parameter", title: "Parameter", alignment: "left", maxLen: 28 },
@@ -107205,7 +107207,7 @@ function registerModelsCommand(program, container) {
107205
107207
  { name: "Values", title: "Values/Range", alignment: "left", maxLen: 35 }
107206
107208
  ];
107207
107209
  rows = [];
107208
- for (const model of withParams) {
107210
+ for (const model of filtered) {
107209
107211
  const modelLabel = theme.accent(`${model.owned_by.toLowerCase()}/${model.id}`);
107210
107212
  rows.push({ Model: modelLabel, Parameter: "", Type: "", Default: "", Values: "" });
107211
107213
  for (const param of model.parameters) {
@@ -124066,11 +124068,6 @@ var init_AS001 = __esm({
124066
124068
  pendingClassBody = true;
124067
124069
  }
124068
124070
  }
124069
- if (token.value === "function" && nextSignificantChar === "*") {
124070
- const generatorStart = this.positionWithinSource(this.skipTriviaFrom(this.index));
124071
- const generatorEnd = this.positionWithinSource(this.skipTriviaFrom(this.index) + 1);
124072
- this.report("generator", generatorStart, generatorEnd);
124073
- }
124074
124071
  }
124075
124072
  const isStatementBrace = token.type === "punctuator" && token.value === "{" && canStartStatement;
124076
124073
  if (token.type === "punctuator" && token.value === "{") {
@@ -124116,7 +124113,6 @@ var init_AS001 = __esm({
124116
124113
  switch (token.value) {
124117
124114
  case "class":
124118
124115
  case "eval":
124119
- case "function":
124120
124116
  case "Function":
124121
124117
  case "switch":
124122
124118
  case "this":
@@ -124532,6 +124528,9 @@ var init_AS003 = __esm({
124532
124528
  }
124533
124529
  visitStatement(node) {
124534
124530
  switch (node.type) {
124531
+ case "FunctionDeclaration":
124532
+ this.visitArrowFunction(node);
124533
+ return;
124535
124534
  case "BlockStatement":
124536
124535
  this.visitBlock(node);
124537
124536
  return;
@@ -124663,9 +124662,15 @@ var init_AS003 = __esm({
124663
124662
  }
124664
124663
  visitExpression(node) {
124665
124664
  switch (node.type) {
124665
+ case "YieldExpression":
124666
+ if (node.argument !== void 0) {
124667
+ this.visitExpression(node.argument);
124668
+ }
124669
+ return;
124666
124670
  case "Identifier":
124667
124671
  this.visitIdentifier(node);
124668
124672
  return;
124673
+ case "FunctionExpression":
124669
124674
  case "ArrowFunctionExpression":
124670
124675
  this.visitArrowFunction(node);
124671
124676
  return;
@@ -124935,6 +124940,10 @@ var init_AS003 = __esm({
124935
124940
  bindings.push(...this.collectImportBindings(statement));
124936
124941
  continue;
124937
124942
  }
124943
+ if (statement.type === "FunctionDeclaration") {
124944
+ bindings.push({ kind: "let", name: statement.id.name });
124945
+ continue;
124946
+ }
124938
124947
  if (statement.type === "VariableDeclaration") {
124939
124948
  bindings.push(...this.collectDeclarationBindings(statement));
124940
124949
  continue;
@@ -124948,6 +124957,9 @@ var init_AS003 = __esm({
124948
124957
  collectBlockBindings(body) {
124949
124958
  const bindings = [];
124950
124959
  for (const statement of body) {
124960
+ if (statement.type === "FunctionDeclaration") {
124961
+ bindings.push({ kind: "let", name: statement.id.name });
124962
+ }
124951
124963
  if (statement.type === "VariableDeclaration") {
124952
124964
  bindings.push(...this.collectDeclarationBindings(statement));
124953
124965
  }
@@ -124956,6 +124968,12 @@ var init_AS003 = __esm({
124956
124968
  }
124957
124969
  collectParameterBindings(node) {
124958
124970
  const bindings = [];
124971
+ if (node.type !== "ArrowFunctionExpression") {
124972
+ bindings.push({ kind: "let", name: "arguments" });
124973
+ if (node.type === "FunctionExpression" && node.id !== void 0) {
124974
+ bindings.push({ kind: "const", name: node.id.name });
124975
+ }
124976
+ }
124959
124977
  for (const parameter of node.params) {
124960
124978
  this.collectBindingNamesFromElement(parameter, "param", bindings);
124961
124979
  }
@@ -125239,6 +125257,9 @@ var init_AS006_007 = __esm({
125239
125257
  }
125240
125258
  visitStatement(node) {
125241
125259
  switch (node.type) {
125260
+ case "FunctionDeclaration":
125261
+ this.visitArrowFunction(node);
125262
+ return;
125242
125263
  case "ExportNamedDeclaration":
125243
125264
  this.visitVariableDeclaration(node.declaration);
125244
125265
  return;
@@ -125370,9 +125391,15 @@ var init_AS006_007 = __esm({
125370
125391
  }
125371
125392
  visitExpression(node) {
125372
125393
  switch (node.type) {
125394
+ case "YieldExpression":
125395
+ if (node.argument !== void 0) {
125396
+ this.visitExpression(node.argument);
125397
+ }
125398
+ return;
125373
125399
  case "Identifier":
125374
125400
  this.markRead(node);
125375
125401
  return;
125402
+ case "FunctionExpression":
125376
125403
  case "ArrowFunctionExpression":
125377
125404
  this.visitArrowFunction(node);
125378
125405
  return;
@@ -125646,6 +125673,10 @@ var init_AS006_007 = __esm({
125646
125673
  bindings.push(...this.collectImportBindings(statement));
125647
125674
  continue;
125648
125675
  }
125676
+ if (statement.type === "FunctionDeclaration") {
125677
+ bindings.push(this.createBinding(statement.id, "let"));
125678
+ continue;
125679
+ }
125649
125680
  if (statement.type === "VariableDeclaration") {
125650
125681
  bindings.push(...this.collectDeclarationBindings(statement));
125651
125682
  continue;
@@ -125659,6 +125690,9 @@ var init_AS006_007 = __esm({
125659
125690
  collectBlockBindings(body) {
125660
125691
  const bindings = [];
125661
125692
  for (const statement of body) {
125693
+ if (statement.type === "FunctionDeclaration") {
125694
+ bindings.push(this.createBinding(statement.id, "let"));
125695
+ }
125662
125696
  if (statement.type === "VariableDeclaration") {
125663
125697
  bindings.push(...this.collectDeclarationBindings(statement));
125664
125698
  }
@@ -125667,6 +125701,9 @@ var init_AS006_007 = __esm({
125667
125701
  }
125668
125702
  collectParameterBindings(node) {
125669
125703
  const bindings = [];
125704
+ if (node.type === "FunctionExpression" && node.id !== void 0) {
125705
+ bindings.push(this.createBinding(node.id, "param"));
125706
+ }
125670
125707
  for (const parameter of node.params) {
125671
125708
  this.collectBindingNamesFromElement(parameter, "param", bindings);
125672
125709
  }
@@ -125841,6 +125878,9 @@ var init_AS008 = __esm({
125841
125878
  }
125842
125879
  visitStatement(node) {
125843
125880
  switch (node.type) {
125881
+ case "FunctionDeclaration":
125882
+ this.visitArrowFunction(node);
125883
+ return;
125844
125884
  case "BlockStatement":
125845
125885
  this.withNestedScope(() => {
125846
125886
  this.visitBlock(node);
@@ -125957,6 +125997,12 @@ var init_AS008 = __esm({
125957
125997
  }
125958
125998
  visitExpression(node) {
125959
125999
  switch (node.type) {
126000
+ case "YieldExpression":
126001
+ if (node.argument !== void 0) {
126002
+ this.visitExpression(node.argument);
126003
+ }
126004
+ return;
126005
+ case "FunctionExpression":
125960
126006
  case "ArrowFunctionExpression":
125961
126007
  this.visitArrowFunction(node);
125962
126008
  return;
@@ -126227,6 +126273,9 @@ var init_AS009 = __esm({
126227
126273
  }
126228
126274
  visitStatement(node) {
126229
126275
  switch (node.type) {
126276
+ case "FunctionDeclaration":
126277
+ this.visitArrowFunction(node);
126278
+ return;
126230
126279
  case "BlockStatement":
126231
126280
  this.visitBlockStatement(node.body);
126232
126281
  return;
@@ -126354,6 +126403,12 @@ var init_AS009 = __esm({
126354
126403
  }
126355
126404
  visitExpression(node) {
126356
126405
  switch (node.type) {
126406
+ case "YieldExpression":
126407
+ if (node.argument !== void 0) {
126408
+ this.visitExpression(node.argument);
126409
+ }
126410
+ return;
126411
+ case "FunctionExpression":
126357
126412
  case "ArrowFunctionExpression":
126358
126413
  this.visitArrowFunction(node);
126359
126414
  return;
@@ -126713,6 +126768,9 @@ var init_AS010 = __esm({
126713
126768
  }
126714
126769
  visitStatement(node) {
126715
126770
  switch (node.type) {
126771
+ case "FunctionDeclaration":
126772
+ this.visitArrowFunction(node);
126773
+ return;
126716
126774
  case "BlockStatement":
126717
126775
  this.visitBlock(node);
126718
126776
  return;
@@ -126845,9 +126903,15 @@ var init_AS010 = __esm({
126845
126903
  }
126846
126904
  visitExpression(node) {
126847
126905
  switch (node.type) {
126906
+ case "YieldExpression":
126907
+ if (node.argument !== void 0) {
126908
+ this.visitExpression(node.argument);
126909
+ }
126910
+ return;
126848
126911
  case "Identifier":
126849
126912
  this.markRead(node);
126850
126913
  return;
126914
+ case "FunctionExpression":
126851
126915
  case "ArrowFunctionExpression":
126852
126916
  this.visitArrowFunction(node);
126853
126917
  return;
@@ -127353,6 +127417,9 @@ var init_AS011 = __esm({
127353
127417
  }
127354
127418
  visitStatement(node) {
127355
127419
  switch (node.type) {
127420
+ case "FunctionDeclaration":
127421
+ this.visitArrowFunction(node);
127422
+ return;
127356
127423
  case "BlockStatement":
127357
127424
  for (const statement of node.body) {
127358
127425
  this.visitStatement(statement);
@@ -127468,6 +127535,12 @@ var init_AS011 = __esm({
127468
127535
  }
127469
127536
  visitExpression(node) {
127470
127537
  switch (node.type) {
127538
+ case "YieldExpression":
127539
+ if (node.argument !== void 0) {
127540
+ this.visitExpression(node.argument);
127541
+ }
127542
+ return;
127543
+ case "FunctionExpression":
127471
127544
  case "ArrowFunctionExpression":
127472
127545
  this.visitArrowFunction(node);
127473
127546
  return;
@@ -127564,423 +127637,31 @@ var init_AS011 = __esm({
127564
127637
  }
127565
127638
  visitMemberExpression(node) {
127566
127639
  this.visitExpression(node.object);
127567
- if (this.isForbiddenMemberProperty(node)) {
127568
- this.report(node.property.span);
127569
- }
127570
- this.visitExpression(node.property);
127571
- }
127572
- visitAssignmentExpression(node) {
127573
- this.visitAssignmentTarget(node.left);
127574
- this.visitExpression(node.right);
127575
- }
127576
- visitCallExpression(node) {
127577
- this.visitExpression(node.callee);
127578
- for (const argument of node.arguments) {
127579
- if (argument.type === "SpreadElement") {
127580
- this.visitExpression(argument.argument);
127581
- continue;
127582
- }
127583
- this.visitExpression(argument);
127584
- }
127585
- }
127586
- visitTemplateLiteral(node) {
127587
- for (const expression of node.expressions) {
127588
- this.visitExpression(expression);
127589
- }
127590
- }
127591
- visitAssignmentTarget(node) {
127592
- switch (node.type) {
127593
- case "Identifier":
127594
- case "MetaProperty":
127595
- return;
127596
- case "MemberExpression":
127597
- this.visitMemberExpression(node);
127598
- return;
127599
- case "AssignmentPattern":
127600
- this.visitAssignmentTarget(node.left);
127601
- this.visitExpression(node.right);
127602
- return;
127603
- case "RestElement":
127604
- this.visitAssignmentTarget(node.argument);
127605
- return;
127606
- case "ArrayPattern":
127607
- for (const element of node.elements) {
127608
- if (element !== null) {
127609
- this.visitAssignmentTarget(element);
127610
- }
127611
- }
127612
- return;
127613
- case "ObjectPattern":
127614
- for (const property of node.properties) {
127615
- if (property.type === "RestElement") {
127616
- this.visitAssignmentTarget(property.argument);
127617
- continue;
127618
- }
127619
- if (property.computed) {
127620
- this.visitExpression(property.key);
127621
- }
127622
- this.visitAssignmentTarget(property.value);
127623
- }
127624
- return;
127625
- }
127626
- }
127627
- visitBindingTarget(node) {
127628
- switch (node.type) {
127629
- case "AssignmentPattern":
127630
- this.visitBindingTarget(node.left);
127631
- this.visitExpression(node.right);
127632
- return;
127633
- case "RestElement":
127634
- this.visitBindingTarget(node.argument);
127635
- return;
127636
- default:
127637
- this.visitAssignmentTarget(node);
127638
- return;
127639
- }
127640
- }
127641
- isForbiddenMemberProperty(node) {
127642
- if (!node.computed) {
127643
- return node.property.type === "Identifier" && FORBIDDEN_PROPERTY_NAMES.has(node.property.name);
127644
- }
127645
- return node.property.type === "StringLiteral" && FORBIDDEN_PROPERTY_NAMES.has(node.property.value);
127646
- }
127647
- report(span) {
127648
- this.diagnostics.push({
127649
- code: "AS011",
127650
- severity: "error",
127651
- message: MESSAGE3,
127652
- filename: this.filename,
127653
- line: span.start.line,
127654
- column: span.start.column,
127655
- span
127656
- });
127657
- }
127658
- };
127659
- }
127660
- });
127661
-
127662
- // packages/safejs/src/lint/rules/AS012.ts
127663
- function AS012(source, options = {}) {
127664
- return new AS012Scanner(options.filename ?? "<input>").scan(source);
127665
- }
127666
- function getMemberPropertyName(node) {
127667
- if (node.type !== "MemberExpression") {
127668
- return void 0;
127669
- }
127670
- if (!node.computed && node.property.type === "Identifier") {
127671
- return node.property.name;
127672
- }
127673
- if (node.computed && node.property.type === "StringLiteral") {
127674
- return node.property.value;
127675
- }
127676
- return void 0;
127677
- }
127678
- function isSupportedSortComparator(node) {
127679
- return node.type === "ArrowFunctionExpression" && !node.async && isNumberReturningArrow(node);
127680
- }
127681
- function isNumberReturningArrow(node) {
127682
- if (node.body.type === "BlockStatement") {
127683
- return false;
127684
- }
127685
- return isClearlyNumberExpression(node.body);
127686
- }
127687
- function isClearlyNumberExpression(node) {
127688
- switch (node.type) {
127689
- case "NumericLiteral":
127690
- return true;
127691
- case "RegexLiteral":
127692
- return false;
127693
- case "UnaryExpression":
127694
- return (node.operator === "+" || node.operator === "-" || node.operator === "~") && isClearlyNumberExpression(node.argument);
127695
- case "BinaryExpression":
127696
- return NUMBER_RETURNING_BINARY_OPERATORS.has(node.operator);
127697
- case "ConditionalExpression":
127698
- return isClearlyNumberExpression(node.consequent) && isClearlyNumberExpression(node.alternate);
127699
- case "CallExpression":
127700
- return isLocaleCompareCall(node);
127701
- default:
127702
- return false;
127703
- }
127704
- }
127705
- function isLocaleCompareCall(node) {
127706
- return getMemberPropertyName(node.callee) === "localeCompare";
127707
- }
127708
- var SORT_MESSAGE, NUMBER_RETURNING_BINARY_OPERATORS, AS012Scanner;
127709
- var init_AS012 = __esm({
127710
- "packages/safejs/src/lint/rules/AS012.ts"() {
127711
- "use strict";
127712
- init_parser3();
127713
- SORT_MESSAGE = "Array#sort only supports comparators that are arrows returning a number.";
127714
- NUMBER_RETURNING_BINARY_OPERATORS = /* @__PURE__ */ new Set([
127715
- "%",
127716
- "*",
127717
- "**",
127718
- "-",
127719
- "/",
127720
- "<<",
127721
- ">>",
127722
- ">>>",
127723
- "&",
127724
- "^",
127725
- "|"
127726
- ]);
127727
- AS012Scanner = class {
127728
- constructor(filename) {
127729
- this.filename = filename;
127730
- }
127731
- filename;
127732
- diagnostics = [];
127733
- scan(source) {
127734
- this.visitModule(parseModule(source, this.filename));
127735
- return this.diagnostics;
127736
- }
127737
- visitModule(node) {
127738
- for (const statement of node.body) {
127739
- this.visitStatement(statement);
127740
- }
127741
- }
127742
- visitStatement(node) {
127743
- switch (node.type) {
127744
- case "BlockStatement":
127745
- for (const statement of node.body) {
127746
- this.visitStatement(statement);
127747
- }
127748
- return;
127749
- case "ExpressionStatement":
127750
- this.visitExpression(node.expression);
127751
- return;
127752
- case "IfStatement":
127753
- this.visitIfStatement(node);
127754
- return;
127755
- case "ForStatement":
127756
- this.visitForStatement(node);
127757
- return;
127758
- case "ForInStatement":
127759
- case "ForOfStatement":
127760
- this.visitForOfStatement(node);
127761
- return;
127762
- case "WhileStatement":
127763
- case "DoWhileStatement":
127764
- this.visitWhileStatement(node);
127765
- return;
127766
- case "TryStatement":
127767
- this.visitTryStatement(node);
127768
- return;
127769
- case "VariableDeclaration":
127770
- this.visitVariableDeclaration(node);
127771
- return;
127772
- case "ReturnStatement":
127773
- this.visitReturnStatement(node);
127774
- return;
127775
- case "ThrowStatement":
127776
- this.visitThrowStatement(node);
127777
- return;
127778
- case "ExportNamedDeclaration":
127779
- this.visitVariableDeclaration(node.declaration);
127780
- return;
127781
- case "ExportDefaultDeclaration":
127782
- this.visitExpression(node.declaration);
127783
- return;
127784
- case "ImportDeclaration":
127785
- case "BreakStatement":
127786
- case "ContinueStatement":
127787
- return;
127788
- }
127789
- }
127790
- visitIfStatement(node) {
127791
- this.visitExpression(node.test);
127792
- this.visitStatement(node.consequent);
127793
- if (node.alternate !== void 0) {
127794
- this.visitStatement(node.alternate);
127795
- }
127796
- }
127797
- visitForStatement(node) {
127798
- if (node.init !== void 0) {
127799
- if (node.init.type === "VariableDeclaration") {
127800
- this.visitVariableDeclaration(node.init);
127801
- } else {
127802
- this.visitExpression(node.init);
127803
- }
127804
- }
127805
- if (node.test !== void 0) {
127806
- this.visitExpression(node.test);
127807
- }
127808
- if (node.update !== void 0) {
127809
- this.visitExpression(node.update);
127810
- }
127811
- this.visitStatement(node.body);
127812
- }
127813
- visitForOfStatement(node) {
127814
- if (node.left.type === "VariableDeclaration") {
127815
- this.visitVariableDeclaration(node.left);
127816
- } else {
127817
- this.visitPattern(node.left);
127818
- }
127819
- this.visitExpression(node.right);
127820
- this.visitStatement(node.body);
127821
- }
127822
- visitWhileStatement(node) {
127823
- this.visitExpression(node.test);
127824
- this.visitStatement(node.body);
127825
- }
127826
- visitTryStatement(node) {
127827
- this.visitStatement(node.block);
127828
- if (node.handler !== void 0) {
127829
- this.visitCatchClause(node.handler);
127830
- }
127831
- if (node.finalizer !== void 0) {
127832
- this.visitStatement(node.finalizer);
127833
- }
127834
- }
127835
- visitCatchClause(node) {
127836
- if (node.param !== void 0) {
127837
- this.visitPattern(node.param);
127838
- }
127839
- this.visitStatement(node.body);
127840
- }
127841
- visitVariableDeclaration(node) {
127842
- for (const declarator of node.declarations) {
127843
- this.visitVariableDeclarator(declarator);
127844
- }
127845
- }
127846
- visitVariableDeclarator(node) {
127847
- this.visitPattern(node.id);
127848
- if (node.init !== void 0) {
127849
- this.visitExpression(node.init);
127850
- }
127851
- }
127852
- visitReturnStatement(node) {
127853
- if (node.argument !== void 0) {
127854
- this.visitExpression(node.argument);
127855
- }
127856
- }
127857
- visitThrowStatement(node) {
127858
- this.visitExpression(node.argument);
127859
- }
127860
- visitExpression(node) {
127861
- switch (node.type) {
127862
- case "ArrowFunctionExpression":
127863
- this.visitArrowFunction(node);
127864
- return;
127865
- case "AwaitExpression":
127866
- this.visitExpression(node.argument);
127867
- return;
127868
- case "ArrayExpression":
127869
- this.visitArrayExpression(node);
127870
- return;
127871
- case "ObjectExpression":
127872
- this.visitObjectExpression(node);
127873
- return;
127874
- case "UnaryExpression":
127875
- this.visitUnaryExpression(node);
127876
- return;
127877
- case "BinaryExpression":
127878
- case "LogicalExpression":
127879
- this.visitBinaryLikeExpression(node);
127880
- return;
127881
- case "ConditionalExpression":
127882
- this.visitConditionalExpression(node);
127883
- return;
127884
- case "MemberExpression":
127885
- this.visitMemberExpression(node);
127886
- return;
127887
- case "AssignmentExpression":
127888
- this.visitAssignmentExpression(node);
127889
- return;
127890
- case "CallExpression":
127891
- this.visitCallExpression(node);
127892
- return;
127893
- case "TemplateLiteral":
127894
- this.visitTemplateLiteral(node);
127895
- return;
127896
- case "Identifier":
127897
- case "BooleanLiteral":
127898
- case "NullLiteral":
127899
- case "NumericLiteral":
127900
- case "RegexLiteral":
127901
- case "StringLiteral":
127902
- case "UndefinedLiteral":
127903
- return;
127904
- }
127905
- }
127906
- visitArrowFunction(node) {
127907
- for (const parameter of node.params) {
127908
- this.visitPattern(parameter);
127909
- }
127910
- if (node.body.type === "BlockStatement") {
127911
- for (const statement of node.body.body) {
127912
- this.visitStatement(statement);
127913
- }
127914
- return;
127915
- }
127916
- this.visitExpression(node.body);
127917
- }
127918
- visitArrayExpression(node) {
127919
- for (const element of node.elements) {
127920
- if (element.type === "SpreadElement") {
127921
- this.visitExpression(element.argument);
127922
- continue;
127923
- }
127924
- this.visitExpression(element);
127925
- }
127926
- }
127927
- visitObjectExpression(node) {
127928
- for (const property of node.properties) {
127929
- if (property.type === "SpreadElement") {
127930
- this.visitExpression(property.argument);
127931
- continue;
127932
- }
127933
- this.visitProperty(property);
127934
- }
127935
- }
127936
- visitProperty(node) {
127937
- if (node.computed) {
127938
- this.visitExpression(node.key);
127939
- }
127940
- this.visitExpression(node.value);
127941
- }
127942
- visitUnaryExpression(node) {
127943
- this.visitExpression(node.argument);
127944
- }
127945
- visitBinaryLikeExpression(node) {
127946
- this.visitExpression(node.left);
127947
- this.visitExpression(node.right);
127948
- }
127949
- visitConditionalExpression(node) {
127950
- this.visitExpression(node.test);
127951
- this.visitExpression(node.consequent);
127952
- this.visitExpression(node.alternate);
127953
- }
127954
- visitMemberExpression(node) {
127955
- this.visitExpression(node.object);
127956
- if (node.computed) {
127957
- this.visitExpression(node.property);
127640
+ if (this.isForbiddenMemberProperty(node)) {
127641
+ this.report(node.property.span);
127958
127642
  }
127643
+ this.visitExpression(node.property);
127959
127644
  }
127960
127645
  visitAssignmentExpression(node) {
127961
- this.visitPattern(node.left);
127646
+ this.visitAssignmentTarget(node.left);
127962
127647
  this.visitExpression(node.right);
127963
127648
  }
127964
127649
  visitCallExpression(node) {
127965
127650
  this.visitExpression(node.callee);
127966
- this.reportUnsupportedMethodArgs(node);
127967
127651
  for (const argument of node.arguments) {
127968
- this.visitCallArgument(argument);
127969
- }
127970
- }
127971
- visitCallArgument(node) {
127972
- if (node.type === "SpreadElement") {
127973
- this.visitExpression(node.argument);
127974
- return;
127652
+ if (argument.type === "SpreadElement") {
127653
+ this.visitExpression(argument.argument);
127654
+ continue;
127655
+ }
127656
+ this.visitExpression(argument);
127975
127657
  }
127976
- this.visitExpression(node);
127977
127658
  }
127978
127659
  visitTemplateLiteral(node) {
127979
127660
  for (const expression of node.expressions) {
127980
127661
  this.visitExpression(expression);
127981
127662
  }
127982
127663
  }
127983
- visitPattern(node) {
127664
+ visitAssignmentTarget(node) {
127984
127665
  switch (node.type) {
127985
127666
  case "Identifier":
127986
127667
  case "MetaProperty":
@@ -127988,56 +127669,59 @@ var init_AS012 = __esm({
127988
127669
  case "MemberExpression":
127989
127670
  this.visitMemberExpression(node);
127990
127671
  return;
127672
+ case "AssignmentPattern":
127673
+ this.visitAssignmentTarget(node.left);
127674
+ this.visitExpression(node.right);
127675
+ return;
127676
+ case "RestElement":
127677
+ this.visitAssignmentTarget(node.argument);
127678
+ return;
127991
127679
  case "ArrayPattern":
127992
127680
  for (const element of node.elements) {
127993
- if (element === null) {
127994
- continue;
127681
+ if (element !== null) {
127682
+ this.visitAssignmentTarget(element);
127995
127683
  }
127996
- this.visitPattern(element);
127997
127684
  }
127998
127685
  return;
127999
127686
  case "ObjectPattern":
128000
127687
  for (const property of node.properties) {
128001
127688
  if (property.type === "RestElement") {
128002
- this.visitPattern(property);
127689
+ this.visitAssignmentTarget(property.argument);
128003
127690
  continue;
128004
127691
  }
128005
127692
  if (property.computed) {
128006
127693
  this.visitExpression(property.key);
128007
127694
  }
128008
- this.visitPattern(property.value);
127695
+ this.visitAssignmentTarget(property.value);
128009
127696
  }
128010
127697
  return;
127698
+ }
127699
+ }
127700
+ visitBindingTarget(node) {
127701
+ switch (node.type) {
128011
127702
  case "AssignmentPattern":
128012
- this.visitPattern(node.left);
127703
+ this.visitBindingTarget(node.left);
128013
127704
  this.visitExpression(node.right);
128014
127705
  return;
128015
127706
  case "RestElement":
128016
- this.visitPattern(node.argument);
127707
+ this.visitBindingTarget(node.argument);
127708
+ return;
127709
+ default:
127710
+ this.visitAssignmentTarget(node);
128017
127711
  return;
128018
127712
  }
128019
127713
  }
128020
- reportUnsupportedMethodArgs(node) {
128021
- const methodName = getMemberPropertyName(node.callee);
128022
- if (methodName === void 0) {
128023
- return;
128024
- }
128025
- if (methodName !== "sort") {
128026
- return;
128027
- }
128028
- const comparator = node.arguments[0];
128029
- if (comparator === void 0 || comparator.type === "SpreadElement") {
128030
- return;
128031
- }
128032
- if (!isSupportedSortComparator(comparator)) {
128033
- this.report(comparator.span, SORT_MESSAGE);
127714
+ isForbiddenMemberProperty(node) {
127715
+ if (!node.computed) {
127716
+ return node.property.type === "Identifier" && FORBIDDEN_PROPERTY_NAMES.has(node.property.name);
128034
127717
  }
127718
+ return node.property.type === "StringLiteral" && FORBIDDEN_PROPERTY_NAMES.has(node.property.value);
128035
127719
  }
128036
- report(span, message2) {
127720
+ report(span) {
128037
127721
  this.diagnostics.push({
128038
- code: "AS012",
127722
+ code: "AS011",
128039
127723
  severity: "error",
128040
- message: message2,
127724
+ message: MESSAGE3,
128041
127725
  filename: this.filename,
128042
127726
  line: span.start.line,
128043
127727
  column: span.start.column,
@@ -128176,6 +127860,9 @@ var init_AS015 = __esm({
128176
127860
  }
128177
127861
  visitStatement(node) {
128178
127862
  switch (node.type) {
127863
+ case "FunctionDeclaration":
127864
+ this.visitArrowFunction(node);
127865
+ return;
128179
127866
  case "BlockStatement":
128180
127867
  for (const statement of node.body) {
128181
127868
  this.visitStatement(statement);
@@ -128292,6 +127979,12 @@ var init_AS015 = __esm({
128292
127979
  }
128293
127980
  visitExpression(node) {
128294
127981
  switch (node.type) {
127982
+ case "YieldExpression":
127983
+ if (node.argument !== void 0) {
127984
+ this.visitExpression(node.argument);
127985
+ }
127986
+ return;
127987
+ case "FunctionExpression":
128295
127988
  case "ArrowFunctionExpression":
128296
127989
  this.visitArrowFunction(node);
128297
127990
  return;
@@ -128634,7 +128327,7 @@ var init_AS_async_not_needed = __esm({
128634
128327
  "packages/safejs/src/lint/rules/AS-async-not-needed.ts"() {
128635
128328
  "use strict";
128636
128329
  init_parser3();
128637
- AS_ASYNC_NOT_NEEDED_MESSAGE = "Async arrow functions without await should remove the async keyword.";
128330
+ AS_ASYNC_NOT_NEEDED_MESSAGE = "Async functions without await should remove the async keyword.";
128638
128331
  ASAsyncNotNeededScanner = class {
128639
128332
  constructor(source, filename) {
128640
128333
  this.source = source;
@@ -128654,6 +128347,9 @@ var init_AS_async_not_needed = __esm({
128654
128347
  }
128655
128348
  visitStatement(node) {
128656
128349
  switch (node.type) {
128350
+ case "FunctionDeclaration":
128351
+ this.visitFunctionExpression(node);
128352
+ return;
128657
128353
  case "BlockStatement":
128658
128354
  this.visitBlockStatement(node);
128659
128355
  return;
@@ -128694,6 +128390,10 @@ var init_AS_async_not_needed = __esm({
128694
128390
  this.visitArrowFunction(node.declaration, true);
128695
128391
  return;
128696
128392
  }
128393
+ if (node.declaration.type === "FunctionExpression") {
128394
+ this.visitFunctionExpression(node.declaration, true);
128395
+ return;
128396
+ }
128697
128397
  this.visitExpression(node.declaration);
128698
128398
  return;
128699
128399
  case "ImportDeclaration":
@@ -128779,6 +128479,11 @@ var init_AS_async_not_needed = __esm({
128779
128479
  }
128780
128480
  visitExpression(node) {
128781
128481
  switch (node.type) {
128482
+ case "YieldExpression":
128483
+ if (node.argument !== void 0) {
128484
+ this.visitExpression(node.argument);
128485
+ }
128486
+ return;
128782
128487
  case "ArrowFunctionExpression":
128783
128488
  this.visitArrowFunction(node, false);
128784
128489
  return;
@@ -128843,8 +128548,8 @@ var init_AS_async_not_needed = __esm({
128843
128548
  }
128844
128549
  this.visitExpression(node.body);
128845
128550
  }
128846
- visitFunctionExpression(node) {
128847
- if (node.async && !bodyContainsAwait(node.body)) {
128551
+ visitFunctionExpression(node, isDefaultExport = false) {
128552
+ if (node.async && !isDefaultExport && !bodyContainsAwait(node.body)) {
128848
128553
  this.report(createAsyncKeywordSpan(node.span));
128849
128554
  }
128850
128555
  for (const param of node.params) {
@@ -129000,6 +128705,7 @@ function AS_AWAIT_NON_PROMISE(source, options = {}) {
129000
128705
  }
129001
128706
  function isKnownNonPromiseExpression(node) {
129002
128707
  switch (node.type) {
128708
+ case "FunctionExpression":
129003
128709
  case "ArrowFunctionExpression":
129004
128710
  case "ArrayExpression":
129005
128711
  case "BinaryExpression":
@@ -129037,6 +128743,9 @@ var init_AS_await_non_promise = __esm({
129037
128743
  }
129038
128744
  visitStatement(node) {
129039
128745
  switch (node.type) {
128746
+ case "FunctionDeclaration":
128747
+ this.visitArrowFunction(node);
128748
+ return;
129040
128749
  case "BlockStatement":
129041
128750
  this.visitBlockStatement(node);
129042
128751
  return;
@@ -129152,6 +128861,12 @@ var init_AS_await_non_promise = __esm({
129152
128861
  }
129153
128862
  visitExpression(node) {
129154
128863
  switch (node.type) {
128864
+ case "YieldExpression":
128865
+ if (node.argument !== void 0) {
128866
+ this.visitExpression(node.argument);
128867
+ }
128868
+ return;
128869
+ case "FunctionExpression":
129155
128870
  case "ArrowFunctionExpression":
129156
128871
  this.visitArrowFunction(node);
129157
128872
  return;
@@ -129359,6 +129074,9 @@ var init_AS_destructure_null_default = __esm({
129359
129074
  }
129360
129075
  visitStatement(node) {
129361
129076
  switch (node.type) {
129077
+ case "FunctionDeclaration":
129078
+ this.visitArrowFunction(node);
129079
+ return;
129362
129080
  case "BlockStatement":
129363
129081
  this.visitBlockStatement(node);
129364
129082
  return;
@@ -129480,6 +129198,12 @@ var init_AS_destructure_null_default = __esm({
129480
129198
  }
129481
129199
  visitExpression(node) {
129482
129200
  switch (node.type) {
129201
+ case "YieldExpression":
129202
+ if (node.argument !== void 0) {
129203
+ this.visitExpression(node.argument);
129204
+ }
129205
+ return;
129206
+ case "FunctionExpression":
129483
129207
  case "ArrowFunctionExpression":
129484
129208
  this.visitArrowFunction(node);
129485
129209
  return;
@@ -129838,6 +129562,12 @@ var init_AS_export_import_meta = __esm({
129838
129562
  }
129839
129563
  visitStatement(node) {
129840
129564
  switch (node.type) {
129565
+ case "FunctionDeclaration":
129566
+ for (const param of node.params) {
129567
+ this.visitAssignmentTarget(param);
129568
+ }
129569
+ this.visitStatement(node.body);
129570
+ return;
129841
129571
  case "ExportNamedDeclaration":
129842
129572
  this.visitExportNamedDeclaration(node.declaration);
129843
129573
  return;
@@ -129990,7 +129720,15 @@ var init_AS_export_import_meta = __esm({
129990
129720
  }
129991
129721
  visitExpression(node) {
129992
129722
  switch (node.type) {
129723
+ case "YieldExpression":
129724
+ if (node.argument !== void 0) {
129725
+ this.visitExpression(node.argument);
129726
+ }
129727
+ return;
129993
129728
  case "ArrowFunctionExpression":
129729
+ for (const param of node.params) {
129730
+ this.visitAssignmentTarget(param);
129731
+ }
129994
129732
  if (node.body.type === "BlockStatement") {
129995
129733
  this.visitStatement(node.body);
129996
129734
  } else {
@@ -129998,6 +129736,9 @@ var init_AS_export_import_meta = __esm({
129998
129736
  }
129999
129737
  return;
130000
129738
  case "FunctionExpression":
129739
+ for (const param of node.params) {
129740
+ this.visitAssignmentTarget(param);
129741
+ }
130001
129742
  this.visitStatement(node.body);
130002
129743
  return;
130003
129744
  case "AwaitExpression":
@@ -130194,6 +129935,9 @@ var init_AS_floating_promise = __esm({
130194
129935
  }
130195
129936
  visitStatement(node) {
130196
129937
  switch (node.type) {
129938
+ case "FunctionDeclaration":
129939
+ this.visitArrowFunction(node);
129940
+ return;
130197
129941
  case "BlockStatement":
130198
129942
  this.visitBlockStatement(node);
130199
129943
  return;
@@ -130324,6 +130068,12 @@ var init_AS_floating_promise = __esm({
130324
130068
  }
130325
130069
  visitExpression(node) {
130326
130070
  switch (node.type) {
130071
+ case "YieldExpression":
130072
+ if (node.argument !== void 0) {
130073
+ this.visitExpression(node.argument);
130074
+ }
130075
+ return;
130076
+ case "FunctionExpression":
130327
130077
  case "ArrowFunctionExpression":
130328
130078
  this.visitArrowFunction(node);
130329
130079
  return;
@@ -130532,6 +130282,7 @@ var init_AS_floating_promise = __esm({
130532
130282
  this.reportUnhandledLikelyPromiseStatementExpression(node.alternate);
130533
130283
  return;
130534
130284
  case "CallExpression":
130285
+ case "FunctionExpression":
130535
130286
  case "ArrowFunctionExpression":
130536
130287
  case "AwaitExpression":
130537
130288
  case "ArrayExpression":
@@ -130630,6 +130381,11 @@ var init_AS_floating_promise = __esm({
130630
130381
  }
130631
130382
  collectBlockBindings(statements) {
130632
130383
  return statements.flatMap((statement) => {
130384
+ if (statement.type === "FunctionDeclaration") {
130385
+ return [
130386
+ { async: statement.async && !statement.generator, kind: "local", name: statement.id.name }
130387
+ ];
130388
+ }
130633
130389
  if (statement.type === "VariableDeclaration") {
130634
130390
  return this.collectDeclarationBindings(statement);
130635
130391
  }
@@ -130642,7 +130398,7 @@ var init_AS_floating_promise = __esm({
130642
130398
  collectDeclarationBindings(node) {
130643
130399
  return node.declarations.flatMap(
130644
130400
  (declarator) => this.collectDeclaratorBindings(declarator).map((name) => ({
130645
- async: declarator.init?.type === "ArrowFunctionExpression" && declarator.init.async,
130401
+ async: (declarator.init?.type === "ArrowFunctionExpression" || declarator.init?.type === "FunctionExpression" && !declarator.init.generator) && declarator.init.async,
130646
130402
  kind: "local",
130647
130403
  name
130648
130404
  }))
@@ -130652,13 +130408,17 @@ var init_AS_floating_promise = __esm({
130652
130408
  return this.collectPatternBindingNames(node.id);
130653
130409
  }
130654
130410
  collectArrowFunctionBindings(node) {
130655
- return node.params.flatMap(
130411
+ const bindings = node.params.flatMap(
130656
130412
  (param) => this.collectParameterBindingNames(param).map((name) => ({
130657
130413
  async: false,
130658
130414
  kind: "local",
130659
130415
  name
130660
130416
  }))
130661
130417
  );
130418
+ if (node.type === "FunctionExpression" && node.id !== void 0) {
130419
+ bindings.unshift({ async: node.async && !node.generator, kind: "local", name: node.id.name });
130420
+ }
130421
+ return bindings;
130662
130422
  }
130663
130423
  collectPatternBindings(node) {
130664
130424
  return this.collectPatternBindingNames(node).map((name) => ({
@@ -130807,6 +130567,9 @@ var init_AS_frontmatter_field_unused = __esm({
130807
130567
  }
130808
130568
  visitStatement(node) {
130809
130569
  switch (node.type) {
130570
+ case "FunctionDeclaration":
130571
+ this.visitArrowFunction(node);
130572
+ return;
130810
130573
  case "BlockStatement":
130811
130574
  this.visitBlockStatement(node);
130812
130575
  return;
@@ -130929,6 +130692,12 @@ var init_AS_frontmatter_field_unused = __esm({
130929
130692
  }
130930
130693
  visitExpression(node) {
130931
130694
  switch (node.type) {
130695
+ case "YieldExpression":
130696
+ if (node.argument !== void 0) {
130697
+ this.visitExpression(node.argument);
130698
+ }
130699
+ return;
130700
+ case "FunctionExpression":
130932
130701
  case "ArrowFunctionExpression":
130933
130702
  this.visitArrowFunction(node);
130934
130703
  return;
@@ -131517,6 +131286,7 @@ function inferExpressionKind(expression) {
131517
131286
  return "boolean";
131518
131287
  }
131519
131288
  return void 0;
131289
+ case "FunctionExpression":
131520
131290
  case "ArrowFunctionExpression":
131521
131291
  case "AssignmentExpression":
131522
131292
  case "AwaitExpression":
@@ -131635,6 +131405,9 @@ var init_AS_jsdoc_type = __esm({
131635
131405
  }
131636
131406
  visitStatement(node) {
131637
131407
  switch (node.type) {
131408
+ case "FunctionDeclaration":
131409
+ this.visitArrowFunction(node);
131410
+ return;
131638
131411
  case "BlockStatement":
131639
131412
  this.visitBlockStatement(node);
131640
131413
  return;
@@ -131781,6 +131554,12 @@ var init_AS_jsdoc_type = __esm({
131781
131554
  }
131782
131555
  visitExpression(node) {
131783
131556
  switch (node.type) {
131557
+ case "YieldExpression":
131558
+ if (node.argument !== void 0) {
131559
+ this.visitExpression(node.argument);
131560
+ }
131561
+ return;
131562
+ case "FunctionExpression":
131784
131563
  case "ArrowFunctionExpression":
131785
131564
  this.visitArrowFunction(node);
131786
131565
  return;
@@ -132035,6 +131814,9 @@ var init_AS_large_literal = __esm({
132035
131814
  }
132036
131815
  visitStatement(node) {
132037
131816
  switch (node.type) {
131817
+ case "FunctionDeclaration":
131818
+ this.visitArrowFunction(node);
131819
+ return;
132038
131820
  case "BlockStatement":
132039
131821
  this.visitBlockStatement(node);
132040
131822
  return;
@@ -132153,6 +131935,12 @@ var init_AS_large_literal = __esm({
132153
131935
  }
132154
131936
  visitExpression(node) {
132155
131937
  switch (node.type) {
131938
+ case "YieldExpression":
131939
+ if (node.argument !== void 0) {
131940
+ this.visitExpression(node.argument);
131941
+ }
131942
+ return;
131943
+ case "FunctionExpression":
132156
131944
  case "ArrowFunctionExpression":
132157
131945
  this.visitArrowFunction(node);
132158
131946
  return;
@@ -132531,7 +132319,7 @@ var init_AS_missing_async = __esm({
132531
132319
  "packages/safejs/src/lint/rules/AS-missing-async.ts"() {
132532
132320
  "use strict";
132533
132321
  init_parser3();
132534
- AS_MISSING_ASYNC_MESSAGE = "Arrow functions that contain await must be marked async.";
132322
+ AS_MISSING_ASYNC_MESSAGE = "Functions that contain await must be marked async.";
132535
132323
  ASMissingAsyncScanner = class {
132536
132324
  constructor(filename) {
132537
132325
  this.filename = filename;
@@ -132549,6 +132337,9 @@ var init_AS_missing_async = __esm({
132549
132337
  }
132550
132338
  visitStatement(node) {
132551
132339
  switch (node.type) {
132340
+ case "FunctionDeclaration":
132341
+ this.visitFunctionExpression(node);
132342
+ return;
132552
132343
  case "BlockStatement":
132553
132344
  this.visitBlockStatement(node);
132554
132345
  return;
@@ -132668,6 +132459,11 @@ var init_AS_missing_async = __esm({
132668
132459
  }
132669
132460
  visitExpression(node) {
132670
132461
  switch (node.type) {
132462
+ case "YieldExpression":
132463
+ if (node.argument !== void 0) {
132464
+ this.visitExpression(node.argument);
132465
+ }
132466
+ return;
132671
132467
  case "ArrowFunctionExpression":
132672
132468
  this.visitArrowFunction(node);
132673
132469
  return;
@@ -132955,6 +132751,9 @@ var init_AS_mutating_frozen = __esm({
132955
132751
  }
132956
132752
  visitStatement(node) {
132957
132753
  switch (node.type) {
132754
+ case "FunctionDeclaration":
132755
+ this.visitArrowFunction(node);
132756
+ return;
132958
132757
  case "BlockStatement":
132959
132758
  this.visitBlockStatement(node);
132960
132759
  return;
@@ -133095,6 +132894,12 @@ var init_AS_mutating_frozen = __esm({
133095
132894
  }
133096
132895
  visitExpression(node) {
133097
132896
  switch (node.type) {
132897
+ case "YieldExpression":
132898
+ if (node.argument !== void 0) {
132899
+ this.visitExpression(node.argument);
132900
+ }
132901
+ return;
132902
+ case "FunctionExpression":
133098
132903
  case "ArrowFunctionExpression":
133099
132904
  this.visitArrowFunction(node);
133100
132905
  return;
@@ -133450,6 +133255,9 @@ var init_AS_needless_template = __esm({
133450
133255
  }
133451
133256
  visitStatement(node) {
133452
133257
  switch (node.type) {
133258
+ case "FunctionDeclaration":
133259
+ this.visitArrowFunction(node);
133260
+ return;
133453
133261
  case "BlockStatement":
133454
133262
  this.visitBlockStatement(node);
133455
133263
  return;
@@ -133571,6 +133379,12 @@ var init_AS_needless_template = __esm({
133571
133379
  }
133572
133380
  visitExpression(node) {
133573
133381
  switch (node.type) {
133382
+ case "YieldExpression":
133383
+ if (node.argument !== void 0) {
133384
+ this.visitExpression(node.argument);
133385
+ }
133386
+ return;
133387
+ case "FunctionExpression":
133574
133388
  case "ArrowFunctionExpression":
133575
133389
  this.visitArrowFunction(node);
133576
133390
  return;
@@ -133814,6 +133628,9 @@ var init_AS_shadow_global = __esm({
133814
133628
  }
133815
133629
  visitStatement(node) {
133816
133630
  switch (node.type) {
133631
+ case "FunctionDeclaration":
133632
+ this.visitArrowFunctionExpression(node);
133633
+ return;
133817
133634
  case "BlockStatement":
133818
133635
  this.visitBlockStatement(node);
133819
133636
  return;
@@ -133935,6 +133752,12 @@ var init_AS_shadow_global = __esm({
133935
133752
  }
133936
133753
  visitExpression(node) {
133937
133754
  switch (node.type) {
133755
+ case "YieldExpression":
133756
+ if (node.argument !== void 0) {
133757
+ this.visitExpression(node.argument);
133758
+ }
133759
+ return;
133760
+ case "FunctionExpression":
133938
133761
  case "ArrowFunctionExpression":
133939
133762
  this.visitArrowFunctionExpression(node);
133940
133763
  return;
@@ -133986,6 +133809,9 @@ var init_AS_shadow_global = __esm({
133986
133809
  }
133987
133810
  }
133988
133811
  visitArrowFunctionExpression(node) {
133812
+ if (node.type !== "ArrowFunctionExpression" && node.id !== void 0) {
133813
+ this.reportIfGlobalShadow(node.id);
133814
+ }
133989
133815
  for (const parameter of node.params) {
133990
133816
  this.visitBindingElement(parameter);
133991
133817
  }
@@ -134262,6 +134088,9 @@ var init_AS_unbounded_loop = __esm({
134262
134088
  }
134263
134089
  visitStatement(node) {
134264
134090
  switch (node.type) {
134091
+ case "FunctionDeclaration":
134092
+ this.visitArrowFunction(node);
134093
+ return;
134265
134094
  case "BlockStatement":
134266
134095
  this.visitBlockStatement(node);
134267
134096
  return;
@@ -134397,6 +134226,12 @@ var init_AS_unbounded_loop = __esm({
134397
134226
  }
134398
134227
  visitExpression(node) {
134399
134228
  switch (node.type) {
134229
+ case "YieldExpression":
134230
+ if (node.argument !== void 0) {
134231
+ this.visitExpression(node.argument);
134232
+ }
134233
+ return;
134234
+ case "FunctionExpression":
134400
134235
  case "ArrowFunctionExpression":
134401
134236
  this.visitArrowFunction(node);
134402
134237
  return;
@@ -134584,6 +134419,9 @@ var init_AS_unreachable = __esm({
134584
134419
  }
134585
134420
  visitStatement(node) {
134586
134421
  switch (node.type) {
134422
+ case "FunctionDeclaration":
134423
+ this.visitArrowFunction(node);
134424
+ return false;
134587
134425
  case "BlockStatement":
134588
134426
  return this.visitBlock(node);
134589
134427
  case "ExpressionStatement":
@@ -134628,7 +134466,6 @@ var init_AS_unreachable = __esm({
134628
134466
  this.visitExpression(node.declaration);
134629
134467
  return false;
134630
134468
  case "ImportDeclaration":
134631
- case "FunctionDeclaration":
134632
134469
  case "EmptyStatement":
134633
134470
  return false;
134634
134471
  }
@@ -134708,6 +134545,12 @@ var init_AS_unreachable = __esm({
134708
134545
  }
134709
134546
  visitExpression(node) {
134710
134547
  switch (node.type) {
134548
+ case "YieldExpression":
134549
+ if (node.argument !== void 0) {
134550
+ this.visitExpression(node.argument);
134551
+ }
134552
+ return;
134553
+ case "FunctionExpression":
134711
134554
  case "ArrowFunctionExpression":
134712
134555
  this.visitArrowFunction(node);
134713
134556
  return;
@@ -134973,6 +134816,9 @@ var init_AS_unused_import = __esm({
134973
134816
  }
134974
134817
  visitStatement(node) {
134975
134818
  switch (node.type) {
134819
+ case "FunctionDeclaration":
134820
+ this.visitArrowFunction(node);
134821
+ return;
134976
134822
  case "ExportNamedDeclaration":
134977
134823
  this.visitVariableDeclaration(node.declaration);
134978
134824
  return;
@@ -135098,9 +134944,15 @@ var init_AS_unused_import = __esm({
135098
134944
  }
135099
134945
  visitExpression(node) {
135100
134946
  switch (node.type) {
134947
+ case "YieldExpression":
134948
+ if (node.argument !== void 0) {
134949
+ this.visitExpression(node.argument);
134950
+ }
134951
+ return;
135101
134952
  case "Identifier":
135102
134953
  this.markRead(node);
135103
134954
  return;
134955
+ case "FunctionExpression":
135104
134956
  case "ArrowFunctionExpression":
135105
134957
  this.visitArrowFunction(node);
135106
134958
  return;
@@ -135333,6 +135185,10 @@ var init_AS_unused_import = __esm({
135333
135185
  bindings.push(...this.collectImportBindings(statement));
135334
135186
  continue;
135335
135187
  }
135188
+ if (statement.type === "FunctionDeclaration") {
135189
+ bindings.push({ kind: "let", name: statement.id.name });
135190
+ continue;
135191
+ }
135336
135192
  if (statement.type === "VariableDeclaration") {
135337
135193
  bindings.push(...this.collectDeclarationBindings(statement));
135338
135194
  continue;
@@ -135346,6 +135202,9 @@ var init_AS_unused_import = __esm({
135346
135202
  collectBlockBindings(body) {
135347
135203
  const bindings = [];
135348
135204
  for (const statement of body) {
135205
+ if (statement.type === "FunctionDeclaration") {
135206
+ bindings.push({ kind: "let", name: statement.id.name });
135207
+ }
135349
135208
  if (statement.type === "VariableDeclaration") {
135350
135209
  bindings.push(...this.collectDeclarationBindings(statement));
135351
135210
  }
@@ -135354,6 +135213,12 @@ var init_AS_unused_import = __esm({
135354
135213
  }
135355
135214
  collectParameterBindings(node) {
135356
135215
  const bindings = [];
135216
+ if (node.type !== "ArrowFunctionExpression") {
135217
+ bindings.push({ kind: "param", name: "arguments" });
135218
+ if (node.type === "FunctionExpression" && node.id !== void 0) {
135219
+ bindings.push({ kind: "param", name: node.id.name });
135220
+ }
135221
+ }
135357
135222
  for (const parameter of node.params) {
135358
135223
  this.collectBindingNamesFromElement(parameter, "param", bindings);
135359
135224
  }
@@ -135772,7 +135637,6 @@ var init_lint3 = __esm({
135772
135637
  init_AS009();
135773
135638
  init_AS010();
135774
135639
  init_AS011();
135775
- init_AS012();
135776
135640
  init_AS013();
135777
135641
  init_AS015();
135778
135642
  init_AS_async_not_needed();
@@ -135805,7 +135669,6 @@ var init_lint3 = __esm({
135805
135669
  AS009,
135806
135670
  AS010,
135807
135671
  AS011,
135808
- AS012,
135809
135672
  AS013,
135810
135673
  AS015,
135811
135674
  AS_IMPORT_CYCLE,
@@ -136193,6 +136056,57 @@ var init_budget2 = __esm({
136193
136056
  }
136194
136057
  });
136195
136058
 
136059
+ // packages/safejs/src/interp/arguments.ts
136060
+ function createSandboxArguments(values) {
136061
+ const result = /* @__PURE__ */ (function() {
136062
+ return arguments;
136063
+ })();
136064
+ for (let index = 0; index < values.length; index += 1) {
136065
+ result[index] = values[index];
136066
+ }
136067
+ result.length = values.length;
136068
+ Object.defineProperty(result, sandboxArgumentsBrand, { value: true });
136069
+ return result;
136070
+ }
136071
+ function isSandboxArguments(value) {
136072
+ return typeof value === "object" && value !== null && Object.hasOwn(value, sandboxArgumentsBrand);
136073
+ }
136074
+ function getSandboxArgumentEntries(value) {
136075
+ return Object.entries(Object.getOwnPropertyDescriptors(value)).flatMap(
136076
+ ([key3, descriptor]) => "value" in descriptor ? [[key3, descriptor.value]] : []
136077
+ );
136078
+ }
136079
+ function copySandboxArgumentProperties(source, target, copyValue) {
136080
+ const names = Object.getOwnPropertyNames(source);
136081
+ if (!names.includes("length") || names.indexOf("length") > names.indexOf("callee")) {
136082
+ Reflect.deleteProperty(target, "length");
136083
+ }
136084
+ for (const [key3, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(source))) {
136085
+ if (!("value" in descriptor)) {
136086
+ if (key3 !== "callee") throw new TypeError(`Cannot copy arguments accessor '${key3}'.`);
136087
+ continue;
136088
+ }
136089
+ Object.defineProperty(target, key3, { ...descriptor, value: copyValue(descriptor.value, key3) });
136090
+ }
136091
+ const iterator = Object.getOwnPropertyDescriptor(source, Symbol.iterator);
136092
+ if (iterator === void 0) {
136093
+ Reflect.deleteProperty(target, Symbol.iterator);
136094
+ } else {
136095
+ if (iterator.value !== Array.prototype.values) {
136096
+ throw new TypeError("Cannot copy a replaced arguments iterator.");
136097
+ }
136098
+ Object.defineProperty(target, Symbol.iterator, iterator);
136099
+ }
136100
+ if (!Object.isExtensible(source)) Object.preventExtensions(target);
136101
+ }
136102
+ var sandboxArgumentsBrand;
136103
+ var init_arguments = __esm({
136104
+ "packages/safejs/src/interp/arguments.ts"() {
136105
+ "use strict";
136106
+ sandboxArgumentsBrand = /* @__PURE__ */ Symbol("SandboxArguments");
136107
+ }
136108
+ });
136109
+
136196
136110
  // packages/safejs/src/graph-depth.ts
136197
136111
  function assertSandboxDataDepth(depth) {
136198
136112
  if (depth > MAX_DATA_DEPTH) {
@@ -136235,6 +136149,9 @@ function walkGraphDepth(root, rootPath, assertDepth) {
136235
136149
  }
136236
136150
  }
136237
136151
  function graphEntries(value) {
136152
+ if (isSandboxArguments(value)) {
136153
+ return getSandboxArgumentEntries(value).map(([key3, entry]) => [`.${key3}`, entry]);
136154
+ }
136238
136155
  if (Array.isArray(value)) return value.map((entry, index) => [`[${index}]`, entry]);
136239
136156
  if (value instanceof Map) {
136240
136157
  return [...value.entries()].flatMap(([key3, entry], index) => [
@@ -136259,6 +136176,7 @@ var init_graph_depth = __esm({
136259
136176
  "use strict";
136260
136177
  init_shape();
136261
136178
  init_budget2();
136179
+ init_arguments();
136262
136180
  MAX_DATA_DEPTH = 1024;
136263
136181
  SnapshotBudgetError = class extends Error {
136264
136182
  code = "budgetExceeded";
@@ -136278,6 +136196,44 @@ var init_graph_depth = __esm({
136278
136196
  }
136279
136197
  });
136280
136198
 
136199
+ // packages/safejs/src/snapshot/arguments.ts
136200
+ function serializeArguments(value, serializeValue) {
136201
+ const properties = /* @__PURE__ */ Object.create(null);
136202
+ for (const [key3, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
136203
+ if (!("value" in descriptor)) {
136204
+ if (key3 !== "callee") throw new TypeError(`Cannot snapshot arguments accessor '${key3}'.`);
136205
+ continue;
136206
+ }
136207
+ properties[key3] = {
136208
+ value: serializeValue(descriptor.value, key3),
136209
+ configurable: descriptor.configurable === true,
136210
+ enumerable: descriptor.enumerable === true,
136211
+ writable: descriptor.writable === true
136212
+ };
136213
+ }
136214
+ const iterator = Object.getOwnPropertyDescriptor(value, Symbol.iterator);
136215
+ if (iterator !== void 0 && iterator.value !== Array.prototype.values) {
136216
+ throw new TypeError("Cannot snapshot a replaced arguments iterator.");
136217
+ }
136218
+ const names = Object.getOwnPropertyNames(value);
136219
+ return {
136220
+ kind: "arguments",
136221
+ extensible: Object.isExtensible(value),
136222
+ lengthBeforeCallee: names.includes("length") && names.indexOf("length") < names.indexOf("callee"),
136223
+ iterator: iterator === void 0 ? null : {
136224
+ configurable: iterator.configurable === true,
136225
+ enumerable: iterator.enumerable === true,
136226
+ writable: iterator.writable === true
136227
+ },
136228
+ properties
136229
+ };
136230
+ }
136231
+ var init_arguments2 = __esm({
136232
+ "packages/safejs/src/snapshot/arguments.ts"() {
136233
+ "use strict";
136234
+ }
136235
+ });
136236
+
136281
136237
  // packages/safejs/src/snapshot/dump-format.ts
136282
136238
  function serializeSafeJSSnapshot(snapshot2) {
136283
136239
  for (const [key3, value] of getEnumerableDataEntries(snapshot2)) {
@@ -136350,7 +136306,12 @@ function serializeHeapReference(value, path189, state) {
136350
136306
  }
136351
136307
  if (!state.serializedHeapIds.has(id)) {
136352
136308
  state.serializedHeapIds.add(id);
136353
- if (Array.isArray(value)) {
136309
+ if (isSandboxArguments(value)) {
136310
+ state.heap[String(id)] = serializeArguments(value, (entry, key3) => {
136311
+ const serialized = serializeDumpValue(entry, `${path189}.${key3}`, state);
136312
+ return serialized === SKIP_VALUE ? { kind: "undefined" } : serialized;
136313
+ });
136314
+ } else if (Array.isArray(value)) {
136354
136315
  state.heap[String(id)] = {
136355
136316
  kind: "array",
136356
136317
  items: serializeArrayItems(value, path189, state)
@@ -136389,7 +136350,7 @@ function indexHeapContainers(snapshot2) {
136389
136350
  const heapIds = /* @__PURE__ */ new WeakMap();
136390
136351
  let nextId = 1;
136391
136352
  for (const [value, stat36] of stats2.entries()) {
136392
- if (stat36.count > 1 || stat36.cyclic) {
136353
+ if (stat36.count > 1 || stat36.cyclic || isSandboxArguments(value)) {
136393
136354
  heapIds.set(value, nextId);
136394
136355
  nextId += 1;
136395
136356
  }
@@ -136422,7 +136383,7 @@ function collectContainerStats(value, stats2, ancestors) {
136422
136383
  }
136423
136384
  stat36.expanded = true;
136424
136385
  ancestors.add(value);
136425
- const entries = Array.isArray(value) ? getArrayDataItems(value) : getEnumerableDataValues(value);
136386
+ const entries = isSandboxArguments(value) ? getSandboxArgumentEntries(value).map(([, entry]) => entry) : Array.isArray(value) ? getArrayDataItems(value) : getEnumerableDataValues(value);
136426
136387
  for (const entry of entries) {
136427
136388
  collectContainerStats(entry, stats2, ancestors);
136428
136389
  }
@@ -136464,6 +136425,8 @@ var init_dump_format = __esm({
136464
136425
  "packages/safejs/src/snapshot/dump-format.ts"() {
136465
136426
  "use strict";
136466
136427
  init_graph_depth();
136428
+ init_arguments();
136429
+ init_arguments2();
136467
136430
  DUMP_FORMAT_VERSION = 1;
136468
136431
  SKIP_VALUE = /* @__PURE__ */ Symbol("SafeJS.skip-dump-value");
136469
136432
  }
@@ -136497,6 +136460,10 @@ function validateDumpHeap(root, state) {
136497
136460
  const id = parseHeapId(key3, path189);
136498
136461
  addUnique2(heapIds, id, path189);
136499
136462
  const entry = requireRecord3(value, path189);
136463
+ if (entry.kind === "arguments") {
136464
+ validateArgumentsProperties(entry, path189);
136465
+ continue;
136466
+ }
136500
136467
  if (entry.kind === "array") {
136501
136468
  requireArray(entry.items, `${path189}.items`, state);
136502
136469
  continue;
@@ -136601,6 +136568,7 @@ function validateTaggedValue(record, path189, state) {
136601
136568
  requireSafeInteger(record.lastIndex, `${path189}.lastIndex`, 0);
136602
136569
  return;
136603
136570
  case "array":
136571
+ case "arguments":
136604
136572
  case "object":
136605
136573
  case "map":
136606
136574
  case "set":
@@ -136641,6 +136609,55 @@ function validateGeneratorShape(record, path189, state) {
136641
136609
  }
136642
136610
  });
136643
136611
  }
136612
+ function validateArgumentsProperties(record, path189) {
136613
+ if (typeof record.extensible !== "boolean") {
136614
+ fail2("invalidType", `${path189}.extensible`, "expected boolean");
136615
+ }
136616
+ if (typeof record.lengthBeforeCallee !== "boolean") {
136617
+ fail2("invalidType", `${path189}.lengthBeforeCallee`, "expected boolean");
136618
+ }
136619
+ const properties = requireRecord3(record.properties, `${path189}.properties`);
136620
+ if (record.iterator !== null) {
136621
+ const iterator = requireRecord3(record.iterator, `${path189}.iterator`);
136622
+ for (const key3 of Object.keys(iterator)) {
136623
+ if (!["configurable", "enumerable", "writable"].includes(key3)) {
136624
+ fail2(
136625
+ "invalidValue",
136626
+ `${path189}.iterator${formatKey(key3)}`,
136627
+ "unknown iterator descriptor field"
136628
+ );
136629
+ }
136630
+ }
136631
+ for (const flag of ["configurable", "enumerable", "writable"]) {
136632
+ if (typeof iterator[flag] !== "boolean")
136633
+ fail2("invalidType", `${path189}.iterator.${flag}`, "expected boolean");
136634
+ }
136635
+ }
136636
+ if (record.lengthBeforeCallee && !Object.hasOwn(properties, "length")) {
136637
+ fail2("invalidValue", `${path189}.properties`, "initial length property is required");
136638
+ }
136639
+ for (const [key3, value] of Object.entries(properties)) {
136640
+ const propertyPath = `${path189}.properties${formatKey(key3)}`;
136641
+ if (key3 === "callee")
136642
+ fail2("invalidValue", propertyPath, "strict callee accessor cannot be replaced");
136643
+ const descriptor = requireRecord3(value, propertyPath);
136644
+ for (const field of Object.keys(descriptor)) {
136645
+ if (!["value", "configurable", "enumerable", "writable"].includes(field)) {
136646
+ fail2(
136647
+ "invalidValue",
136648
+ `${propertyPath}${formatKey(field)}`,
136649
+ "unknown property descriptor field"
136650
+ );
136651
+ }
136652
+ }
136653
+ if (!Object.hasOwn(descriptor, "value"))
136654
+ fail2("invalidValue", propertyPath, "property value is required");
136655
+ for (const flag of ["configurable", "enumerable", "writable"]) {
136656
+ if (typeof descriptor[flag] !== "boolean")
136657
+ fail2("invalidType", `${propertyPath}.${flag}`, "expected boolean");
136658
+ }
136659
+ }
136660
+ }
136644
136661
  function validateGenericValue(value, path189, depth, state) {
136645
136662
  if (depth > state.limits.maxDepth)
136646
136663
  fail2("budgetExceeded", path189, `exceeds nesting limit ${state.limits.maxDepth}`);
@@ -136752,6 +136769,7 @@ var init_validation = __esm({
136752
136769
  DEFAULT_MAX_STRING_LENGTH = 1e6;
136753
136770
  DEFAULT_MAX_DATA_SIZE = 16e6;
136754
136771
  TAGGED_VALUE_KINDS = /* @__PURE__ */ new Set([
136772
+ "arguments",
136755
136773
  "array",
136756
136774
  "fn",
136757
136775
  "generator",
@@ -137214,7 +137232,7 @@ function measureSandboxData(values) {
137214
137232
  usage += value.source.length + value.flags.length;
137215
137233
  return;
137216
137234
  }
137217
- const entries = Object.entries(value);
137235
+ const entries = isSandboxArguments(value) ? getSandboxArgumentEntries(value) : Object.entries(value);
137218
137236
  usage += entries.length;
137219
137237
  for (const [key3, entry] of entries) {
137220
137238
  usage += key3.length;
@@ -137331,6 +137349,18 @@ function copyToSandbox(value, state, path189 = "<root>", cloneSandboxCollections
137331
137349
  }
137332
137350
  return copy;
137333
137351
  }
137352
+ if (isSandboxArguments(value)) {
137353
+ const existing = state.seen.get(value);
137354
+ if (existing !== void 0) return existing;
137355
+ const copy = createSandboxArguments([]);
137356
+ state.seen.set(value, copy);
137357
+ copySandboxArgumentProperties(
137358
+ value,
137359
+ copy,
137360
+ (entry, key3) => copyToSandbox(entry, state, joinPath(path189, key3), cloneSandboxCollections, depth + 1)
137361
+ );
137362
+ return copy;
137363
+ }
137334
137364
  if (isPlainObject10(value)) {
137335
137365
  const existing = state.seen.get(value);
137336
137366
  if (existing !== void 0) {
@@ -137433,6 +137463,18 @@ function copyFromSandbox(value, state, path189 = "<root>", options, depth = 0) {
137433
137463
  }
137434
137464
  return copy;
137435
137465
  }
137466
+ if (isSandboxArguments(value)) {
137467
+ const existing = state.seen.get(value);
137468
+ if (existing !== void 0) return existing;
137469
+ const copy = createSandboxArguments([]);
137470
+ state.seen.set(value, copy);
137471
+ copySandboxArgumentProperties(
137472
+ value,
137473
+ copy,
137474
+ (entry, key3) => copyFromSandbox(entry, state, joinPath(path189, key3), options, depth + 1)
137475
+ );
137476
+ return copy;
137477
+ }
137436
137478
  if (isPlainObject10(value)) {
137437
137479
  const existing = state.seen.get(value);
137438
137480
  if (existing !== void 0) {
@@ -137503,7 +137545,8 @@ function allocateSandboxValue(value, budget, seen) {
137503
137545
  return;
137504
137546
  }
137505
137547
  seen.add(value);
137506
- for (const entry of Object.values(value)) {
137548
+ const entries = isSandboxArguments(value) ? getSandboxArgumentEntries(value).map(([, entry]) => entry) : Object.values(value);
137549
+ for (const entry of entries) {
137507
137550
  allocateSandboxValue(entry, budget, seen);
137508
137551
  }
137509
137552
  }
@@ -137598,6 +137641,8 @@ var init_values = __esm({
137598
137641
  init_promise_tracker();
137599
137642
  init_parse5();
137600
137643
  init_graph_depth();
137644
+ init_arguments();
137645
+ init_arguments();
137601
137646
  sandboxClosureBrand = /* @__PURE__ */ Symbol("SandboxClosure");
137602
137647
  sandboxGeneratorBrand = /* @__PURE__ */ Symbol("SandboxGenerator");
137603
137648
  sandboxMapBrand = /* @__PURE__ */ Symbol("SandboxMap");
@@ -140400,6 +140445,8 @@ async function createClosureScope(node, args, thisValue, context, evaluateNode3)
140400
140445
  const scope = context.scope.child({}, { functionBoundary: true });
140401
140446
  if (node.type !== "ArrowFunctionExpression") {
140402
140447
  scope.declare("this", "const", thisValue);
140448
+ context.budget.allocateArrayLength(args.length);
140449
+ scope.declare("arguments", "let", createSandboxArguments(args));
140403
140450
  }
140404
140451
  await bindParameters(node.params, args, scope, context, evaluateNode3);
140405
140452
  hoistVarDeclarations(node.body, scope);
@@ -145910,6 +145957,7 @@ var init_serialize = __esm({
145910
145957
  "use strict";
145911
145958
  init_hash();
145912
145959
  init_graph_depth();
145960
+ init_arguments2();
145913
145961
  init_values();
145914
145962
  UnsnapshotableValueError = class extends Error {
145915
145963
  path;
@@ -152180,7 +152228,7 @@ var init_package2 = __esm({
152180
152228
  "package.json"() {
152181
152229
  package_default2 = {
152182
152230
  name: "poe-code",
152183
- version: "4.0.58",
152231
+ version: "4.0.60",
152184
152232
  description: "CLI tool to configure Poe API for developer workflows.",
152185
152233
  license: "MIT",
152186
152234
  type: "module",
@@ -152655,7 +152703,8 @@ function formatHelpText(input) {
152655
152703
  `${text.muted("Run")} ${text.usageCommand(input.helpCommand)} ${text.muted("for command options.")}`,
152656
152704
  "",
152657
152705
  `${text.muted("Learn more about Poe:")} ${text.link("https://poe.com/api")}`,
152658
- `${text.muted("GitHub:")} ${text.link("https://github.com/poe-platform/poe-code")}`
152706
+ `${text.muted("GitHub:")} ${text.link("https://github.com/poe-platform/poe-code")}`,
152707
+ ""
152659
152708
  ].join("\n");
152660
152709
  }
152661
152710
  function formatSubcommandHelp(cmd, helper) {