@rcrsr/rill-cli 0.18.1 → 0.18.2

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.
@@ -59,14 +59,31 @@ export const CLOSURE_BARE_DOLLAR = {
59
59
  */
60
60
  function containsBareReference(node) {
61
61
  let found = false;
62
+ let scopeDepth = 0;
63
+ const scopeTypes = new Set([
64
+ 'Closure',
65
+ 'FilterExpr',
66
+ 'MapExpr',
67
+ 'EachExpr',
68
+ ]);
62
69
  const ctx = {};
63
70
  visitNode(node, ctx, {
64
71
  enter(n) {
72
+ if (scopeTypes.has(n.type)) {
73
+ scopeDepth++;
74
+ return;
75
+ }
76
+ if (scopeDepth > 0)
77
+ return;
65
78
  if (n.type === 'Variable' && n.isPipeVar) {
66
79
  found = true;
67
80
  }
68
81
  },
69
- exit() { },
82
+ exit(n) {
83
+ if (scopeTypes.has(n.type)) {
84
+ scopeDepth--;
85
+ }
86
+ },
70
87
  });
71
88
  return found;
72
89
  }
package/dist/cli-run.js CHANGED
@@ -269,9 +269,16 @@ export async function main() {
269
269
  throw err;
270
270
  }
271
271
  ctx.pipeValue = handlerArgs;
272
+ // Map handler args to positional args in param order so marshalArgs
273
+ // can bind them to the closure's declared parameters.
274
+ // Omitted optional params stay undefined so closure defaults hydrate.
275
+ // pipeValue is kept for zero-param closures that access $ directly.
276
+ const positionalArgs = introspection.params.map((p) => (Object.prototype.hasOwnProperty.call(handlerArgs, p.name)
277
+ ? handlerArgs[p.name]
278
+ : undefined));
272
279
  let handlerResult;
273
280
  try {
274
- handlerResult = await invokeCallable(handlerValue, [], ctx);
281
+ handlerResult = await invokeCallable(handlerValue, positionalArgs, ctx);
275
282
  }
276
283
  catch (err) {
277
284
  const message = err instanceof Error ? err.message : String(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcrsr/rill-cli",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "CLI tools for the rill scripting language",
5
5
  "license": "MIT",
6
6
  "author": "Andre Bremer",
@@ -21,8 +21,8 @@
21
21
  "dependencies": {
22
22
  "dotenv": "^16.0.0",
23
23
  "yaml": "^2.8.2",
24
- "@rcrsr/rill-config": "^0.18.1",
25
- "@rcrsr/rill": "^0.18.0"
24
+ "@rcrsr/rill": "^0.18.2",
25
+ "@rcrsr/rill-config": "^0.18.1"
26
26
  },
27
27
  "files": [
28
28
  "dist"