poe-code 11.0.13 → 11.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -118889,6 +118889,12 @@ var init_error_codes21 = __esm({
118889
118889
  });
118890
118890
 
118891
118891
  // packages/safejs/src/parse/bindings.ts
118892
+ function getFunctionLength(params) {
118893
+ const firstOptional = params.findIndex(
118894
+ (param) => param.type === "AssignmentPattern" || param.type === "RestElement"
118895
+ );
118896
+ return firstOptional === -1 ? params.length : firstOptional;
118897
+ }
118892
118898
  function* boundIdentifiers(pattern) {
118893
118899
  switch (pattern.type) {
118894
118900
  case "Identifier":
@@ -139889,6 +139895,9 @@ function createSandboxClosure(input) {
139889
139895
  if (input.sandbox === true) {
139890
139896
  Object.defineProperty(closure, "sandbox", { value: true });
139891
139897
  }
139898
+ if (input.length !== void 0) {
139899
+ Object.defineProperty(closure, "length", { value: input.length });
139900
+ }
139892
139901
  if (input.boundTarget !== void 0) {
139893
139902
  Object.defineProperty(closure, "boundTarget", { value: input.boundTarget });
139894
139903
  }
@@ -141148,6 +141157,7 @@ function createInterpretedClosure(node, context, evaluateNode3) {
141148
141157
  } : void 0;
141149
141158
  return createSandboxClosure({
141150
141159
  sandbox: true,
141160
+ length: getFunctionLength(node.params),
141151
141161
  ...node.async ? { async: true } : {},
141152
141162
  ...node.type === "FunctionDeclaration" || node.type === "FunctionExpression" ? node.id === void 0 ? {} : { name: node.id.name } : {},
141153
141163
  ...construct === void 0 ? {} : { construct },
@@ -141199,6 +141209,7 @@ function createInterpretedClosure(node, context, evaluateNode3) {
141199
141209
  function createGeneratorClosure(node, context, evaluateNode3) {
141200
141210
  return createSandboxClosure({
141201
141211
  sandbox: true,
141212
+ length: getFunctionLength(node.params),
141202
141213
  ...node.id === void 0 ? {} : { name: node.id.name },
141203
141214
  retainedValues: () => context.scope.retainedValues(),
141204
141215
  call: async (args, callContext) => {
@@ -143660,6 +143671,9 @@ function getFunctionMember(target, property, options) {
143660
143671
  if (propertyValue !== void 0 || Object.hasOwn(target.properties ?? {}, String(property))) {
143661
143672
  return propertyValue;
143662
143673
  }
143674
+ if (property === "length") {
143675
+ return target.length;
143676
+ }
143663
143677
  if (!isFunctionMethodName(property)) {
143664
143678
  return void 0;
143665
143679
  }
@@ -143679,6 +143693,7 @@ function callFunctionMethod(target, methodName, args, options, stack) {
143679
143693
  return createSandboxClosure({
143680
143694
  sandbox: true,
143681
143695
  name: `bound ${target.name ?? ""}`,
143696
+ length: target.length === void 0 ? void 0 : Math.max(0, target.length - boundArgs.length),
143682
143697
  boundTarget: target,
143683
143698
  retainedValues: () => [target, thisValue, ...boundArgs],
143684
143699
  call: (callArgs, context) => options.callClosure(target, [...boundArgs, ...callArgs], context?.stack ?? [], thisValue),
@@ -144180,7 +144195,7 @@ function toMatchArray(match, input) {
144180
144195
  return null;
144181
144196
  }
144182
144197
  const result = [match.text, ...match.captures];
144183
- Object.assign(result, { groups: void 0, index: match.index, input });
144198
+ Object.assign(result, { index: match.index, input, groups: void 0 });
144184
144199
  return result;
144185
144200
  }
144186
144201
  var regexMethodNames;
@@ -155614,7 +155629,7 @@ var init_package2 = __esm({
155614
155629
  "package.json"() {
155615
155630
  package_default2 = {
155616
155631
  name: "poe-code",
155617
- version: "11.0.13",
155632
+ version: "11.0.15",
155618
155633
  description: "CLI tool to configure Poe API for developer workflows.",
155619
155634
  license: "MIT",
155620
155635
  type: "module",