poe-code 11.0.13 → 11.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "11.0.13",
3
+ "version": "11.0.14",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -139,6 +139,12 @@ function findSourceOffset(source, line, column) {
139
139
  }
140
140
 
141
141
  // packages/safejs/src/parse/bindings.ts
142
+ function getFunctionLength(params) {
143
+ const firstOptional = params.findIndex(
144
+ (param) => param.type === "AssignmentPattern" || param.type === "RestElement"
145
+ );
146
+ return firstOptional === -1 ? params.length : firstOptional;
147
+ }
142
148
  function* boundIdentifiers(pattern) {
143
149
  switch (pattern.type) {
144
150
  case "Identifier":
@@ -19632,6 +19638,9 @@ function createSandboxClosure(input) {
19632
19638
  if (input.sandbox === true) {
19633
19639
  Object.defineProperty(closure, "sandbox", { value: true });
19634
19640
  }
19641
+ if (input.length !== void 0) {
19642
+ Object.defineProperty(closure, "length", { value: input.length });
19643
+ }
19635
19644
  if (input.boundTarget !== void 0) {
19636
19645
  Object.defineProperty(closure, "boundTarget", { value: input.boundTarget });
19637
19646
  }
@@ -21722,6 +21731,7 @@ function createInterpretedClosure(node, context, evaluateNode2) {
21722
21731
  } : void 0;
21723
21732
  return createSandboxClosure({
21724
21733
  sandbox: true,
21734
+ length: getFunctionLength(node.params),
21725
21735
  ...node.async ? { async: true } : {},
21726
21736
  ...node.type === "FunctionDeclaration" || node.type === "FunctionExpression" ? node.id === void 0 ? {} : { name: node.id.name } : {},
21727
21737
  ...construct === void 0 ? {} : { construct },
@@ -21773,6 +21783,7 @@ function createInterpretedClosure(node, context, evaluateNode2) {
21773
21783
  function createGeneratorClosure(node, context, evaluateNode2) {
21774
21784
  return createSandboxClosure({
21775
21785
  sandbox: true,
21786
+ length: getFunctionLength(node.params),
21776
21787
  ...node.id === void 0 ? {} : { name: node.id.name },
21777
21788
  retainedValues: () => context.scope.retainedValues(),
21778
21789
  call: async (args, callContext) => {
@@ -24528,6 +24539,9 @@ function getFunctionMember(target, property, options) {
24528
24539
  if (propertyValue !== void 0 || Object.hasOwn(target.properties ?? {}, String(property))) {
24529
24540
  return propertyValue;
24530
24541
  }
24542
+ if (property === "length") {
24543
+ return target.length;
24544
+ }
24531
24545
  if (!isFunctionMethodName(property)) {
24532
24546
  return void 0;
24533
24547
  }
@@ -24547,6 +24561,7 @@ function callFunctionMethod(target, methodName, args, options, stack) {
24547
24561
  return createSandboxClosure({
24548
24562
  sandbox: true,
24549
24563
  name: `bound ${target.name ?? ""}`,
24564
+ length: target.length === void 0 ? void 0 : Math.max(0, target.length - boundArgs.length),
24550
24565
  boundTarget: target,
24551
24566
  retainedValues: () => [target, thisValue, ...boundArgs],
24552
24567
  call: (callArgs, context) => options.callClosure(target, [...boundArgs, ...callArgs], context?.stack ?? [], thisValue),
@@ -29037,4 +29052,4 @@ export {
29037
29052
  FileSnapshotBackend,
29038
29053
  run
29039
29054
  };
29040
- //# sourceMappingURL=chunk-GTX2EXKD.js.map
29055
+ //# sourceMappingURL=chunk-DZH7JZC4.js.map