@swmansion/argent 0.33.1-next.12 → 0.33.1-next.13

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/cli-cmds.mjs CHANGED
@@ -10204,7 +10204,7 @@ import { basename, extname } from "node:path";
10204
10204
  var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
10205
10205
  var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
10206
10206
  var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
10207
- var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts"];
10207
+ var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
10208
10208
  var SCRIPT_FILE_NAME_PATTERN = new RegExp(
10209
10209
  `^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
10210
10210
  );
@@ -35877,7 +35877,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
35877
35877
  var SESSION_ID2 = randomUUID5();
35878
35878
  function readCliVersion() {
35879
35879
  if (true) {
35880
- return "0.33.1-next.12";
35880
+ return "0.33.1-next.13";
35881
35881
  }
35882
35882
  return "0.0.0";
35883
35883
  }
package/dist/client.js CHANGED
@@ -8780,7 +8780,7 @@ import { basename, extname } from "node:path";
8780
8780
  var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
8781
8781
  var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
8782
8782
  var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
8783
- var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts"];
8783
+ var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
8784
8784
  var SCRIPT_FILE_NAME_PATTERN = new RegExp(
8785
8785
  `^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
8786
8786
  );
@@ -2,6 +2,9 @@
2
2
  // next to the compiled executor and resolves its watchdogs against its own URL.
3
3
 
4
4
  import fs from "node:fs";
5
+ import { Module } from "node:module";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
5
8
  import { isMainThread, Worker } from "node:worker_threads";
6
9
 
7
10
  const LIFELINE_WATCHDOG = "flow-script-watchdog-lifeline.mjs";
@@ -20,6 +23,7 @@ let finished = false;
20
23
  let maxOutputBytes = 0;
21
24
 
22
25
  let probing = false;
26
+ let entryThrew = false;
23
27
 
24
28
  let idleResources = [];
25
29
 
@@ -65,10 +69,12 @@ const decodeJson = JSON.parse;
65
69
 
66
70
  const runnerListeners = [];
67
71
 
68
- if (isMainThread && process.env[ACTIVATION_ENV] === "1") {
69
- delete process.env[ACTIVATION_ENV];
70
- await prepare();
71
- }
72
+ /**
73
+ * The CommonJS loader's entry point, which is how plain `node` starts a main
74
+ * module. Node's types do not carry it, and a Node without it leaves the entry
75
+ * to Node. See `loadEntryAsPlainNodeDoes`.
76
+ */
77
+ const commonJsLoad = /** @type {{ _load?: unknown }} */ (/** @type {unknown} */ (Module))._load;
72
78
 
73
79
  async function prepare() {
74
80
  const raw = await nextRequest();
@@ -129,6 +135,8 @@ async function prepare() {
129
135
  });
130
136
 
131
137
  closeChannelToScript();
138
+ const commonJsLoaderEntry = entryForCommonJsLoader(request.scriptUrl);
139
+ if (commonJsLoaderEntry === undefined) claimMainModuleIdentity(request.scriptUrl);
132
140
 
133
141
  // Registered here rather than at module scope: Node references the IPC
134
142
  // channel while a `message` or `disconnect` listener exists, and in the
@@ -151,6 +159,8 @@ async function prepare() {
151
159
  // Read last, so it is the loop as the script inherits it. Node awaits this
152
160
  // module before it loads the entry, so there is no later point that holds.
153
161
  idleResources = process.getActiveResourcesInfo();
162
+
163
+ if (commonJsLoaderEntry !== undefined) return loadEntryAsPlainNodeDoes(commonJsLoaderEntry);
154
164
  }
155
165
 
156
166
  /**
@@ -209,7 +219,133 @@ function reportWhenEntrySettled(scriptUrl) {
209
219
  : { type: "result", outputJson: encoded.json }
210
220
  );
211
221
  };
212
- import(scriptUrl).then(report, report);
222
+ // An entry that threw in `loadEntryAsPlainNodeDoes` left no module behind, so
223
+ // an import here would run the script a second time.
224
+ (entryThrew ? Promise.resolve() : import(scriptUrl)).then(report, report);
225
+ }
226
+
227
+ /**
228
+ * The path of a `.ts` entry that Node may run as CommonJS, which this preload
229
+ * then loads itself (see {@link loadEntryAsPlainNodeDoes}); undefined for every
230
+ * other entry.
231
+ *
232
+ * `.mts` cannot be CommonJS, and neither can a `.ts` file under
233
+ * `"type": "module"`. A `.js` entry stays with Node: its `require` is whole
234
+ * either way, and `claimMainModuleIdentity` covers what differs.
235
+ */
236
+ function entryForCommonJsLoader(scriptUrl) {
237
+ if (typeof commonJsLoad !== "function") return undefined;
238
+ let entryPath;
239
+ try {
240
+ entryPath = fileURLToPath(scriptUrl);
241
+ } catch {
242
+ return undefined;
243
+ }
244
+ if (!entryPath.endsWith(".ts")) return undefined;
245
+ return nearestPackageType(entryPath) === "module" ? undefined : entryPath;
246
+ }
247
+
248
+ /**
249
+ * The `type` of the `package.json` nearest to `file`, as Node looks it up: the
250
+ * first one found going up, and never past a `node_modules` directory. A file
251
+ * that will not read or parse counts as no answer: Node then decides, and
252
+ * reports that file itself.
253
+ */
254
+ function nearestPackageType(file) {
255
+ let dir = path.dirname(file);
256
+ for (;;) {
257
+ if (path.basename(dir) === "node_modules") return undefined;
258
+ try {
259
+ return decodeJson(fs.readFileSync(path.join(dir, "package.json"), "utf8"))?.type;
260
+ } catch (err) {
261
+ if (err?.code !== "ENOENT") return undefined;
262
+ }
263
+ const parent = path.dirname(dir);
264
+ if (parent === dir) return undefined;
265
+ dir = parent;
266
+ }
267
+ }
268
+
269
+ /**
270
+ * Loads the entry through the CommonJS loader, which is where plain `node`
271
+ * starts a `.ts` file outside `"type": "module"`. Node decides the module type
272
+ * there as it does with no preload: a file with ES module syntax goes on to
273
+ * the ESM loader, and anything else runs as CommonJS, as the main module.
274
+ *
275
+ * Left to Node, the `--import` that carries this preload sends the entry
276
+ * through the ESM loader instead, and on Node 22, 24.0 to 24.17 and 25 that
277
+ * loader gives a CommonJS TypeScript file a reduced `require`: no
278
+ * `require.cache`, no `require.extensions`, and an undefined `module.parent`
279
+ * in every module the script loads. Node still imports the entry after this
280
+ * preload, and finds the module this call left in its cache, so the script
281
+ * runs once.
282
+ *
283
+ * A script that throws leaves no module in that cache, and Node would run it
284
+ * again. So the preload never settles, which keeps Node from the entry, and
285
+ * the error goes where plain `node` sends it: to `uncaughtException`.
286
+ */
287
+ function loadEntryAsPlainNodeDoes(entryPath) {
288
+ try {
289
+ /** @type {Function} */ (commonJsLoad).call(Module, entryPath, null, true);
290
+ } catch (err) {
291
+ entryThrew = true;
292
+ queueMicrotask(() => {
293
+ throw err;
294
+ });
295
+ return never();
296
+ }
297
+ return undefined;
298
+ }
299
+
300
+ /**
301
+ * Under plain `node` a CommonJS entry is the main module three ways:
302
+ * `require.main === module`, `module.id === "."` and `module.parent === null`.
303
+ * This preload rides in on `--import`, which sends the entry through the ESM
304
+ * loader, and there Node sets only the first: `id` is the file's path and
305
+ * `parent` is `undefined`. A script that guards its body with either of the
306
+ * other two would skip it, and the step would pass having done nothing.
307
+ *
308
+ * Node builds the entry's module object and runs the script with no hook in
309
+ * between, so the values go in from inside the constructor: its first statement
310
+ * is `this.id = id`, which a setter on the prototype receives. `parent` is an
311
+ * accessor on that same prototype, so an own property answers for it.
312
+ *
313
+ * The setter is spent on the first module built, whichever it is. For a
314
+ * CommonJS entry that is the entry. An ES module entry never builds one for
315
+ * itself, so the first is some dependency's and comes out as Node made it —
316
+ * unless the script calls `createRequire` on its own path first, whose hidden
317
+ * parent module then carries the entry's identity, which is what it stands for.
318
+ *
319
+ * `.mjs` and `.mts` are skipped: neither can be CommonJS. A `.ts` entry that
320
+ * may be CommonJS does not come here at all: `loadEntryAsPlainNodeDoes` makes
321
+ * it the main module the way Node does.
322
+ */
323
+ function claimMainModuleIdentity(scriptUrl) {
324
+ let entryPath;
325
+ try {
326
+ entryPath = fileURLToPath(scriptUrl);
327
+ } catch {
328
+ return;
329
+ }
330
+ if (/\.m[jt]s$/.test(entryPath)) return;
331
+ const own = (target, key, value, enumerable) =>
332
+ Object.defineProperty(target, key, { value, writable: true, enumerable, configurable: true });
333
+ Object.defineProperty(Module.prototype, "id", {
334
+ configurable: true,
335
+ enumerable: false,
336
+ get() {
337
+ return undefined;
338
+ },
339
+ set(value) {
340
+ delete Module.prototype.id;
341
+ if (value !== entryPath) {
342
+ this.id = value;
343
+ return;
344
+ }
345
+ own(this, "id", ".", true);
346
+ own(this, "parent", null, false);
347
+ },
348
+ });
213
349
  }
214
350
 
215
351
  function keepListener(event, handler) {
@@ -794,3 +930,10 @@ function sendToParent(message, callback) {
794
930
  runnerIsSending = false;
795
931
  }
796
932
  }
933
+
934
+ // Last in the file: `prepare` may never settle, and a handler that runs while
935
+ // this module is parked there reads the constants declared above.
936
+ if (isMainThread && process.env[ACTIVATION_ENV] === "1") {
937
+ delete process.env[ACTIVATION_ENV];
938
+ await prepare();
939
+ }
@@ -15735,7 +15735,7 @@ import { basename, extname } from "node:path";
15735
15735
  var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
15736
15736
  var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
15737
15737
  var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
15738
- var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts"];
15738
+ var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
15739
15739
  var SCRIPT_FILE_NAME_PATTERN = new RegExp(
15740
15740
  `^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
15741
15741
  );
@@ -16986,7 +16986,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16986
16986
  var SESSION_ID = randomUUID4();
16987
16987
  function readCliVersion() {
16988
16988
  if (true) {
16989
- return "0.33.1-next.12";
16989
+ return "0.33.1-next.13";
16990
16990
  }
16991
16991
  return "0.0.0";
16992
16992
  }
@@ -25490,7 +25490,7 @@ import { basename, extname } from "node:path";
25490
25490
  var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
25491
25491
  var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
25492
25492
  var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
25493
- var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts"];
25493
+ var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
25494
25494
  var SCRIPT_FILE_NAME_PATTERN = new RegExp(
25495
25495
  `^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
25496
25496
  );
@@ -209,7 +209,7 @@ export interface ArgentToolArgs {
209
209
  name: string;
210
210
  /** Absolute project root passed to e2e-start-recording. */
211
211
  project_root: string;
212
- /** Path to the .mjs or .mts file, relative to the e2e test YAML. For example: "../../scripts/seed-order.mjs". */
212
+ /** Path to the script file (.mjs, .mts, .js or .ts), relative to the e2e test YAML. For example: "../../scripts/seed-order.mjs". */
213
213
  path: string;
214
214
  /** Time limit in milliseconds. The default is 30000 and the minimum is 100. */
215
215
  timeout?: number;
@@ -1252,7 +1252,7 @@ var init_file_inputs = __esm({
1252
1252
  FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
1253
1253
  FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
1254
1254
  FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
1255
- SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts"];
1255
+ SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
1256
1256
  SCRIPT_FILE_NAME_PATTERN = new RegExp(
1257
1257
  `^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
1258
1258
  );
@@ -75582,7 +75582,7 @@ var require_send = __commonJS({
75582
75582
  var join68 = path63.join;
75583
75583
  var normalize = path63.normalize;
75584
75584
  var resolve19 = path63.resolve;
75585
- var sep10 = path63.sep;
75585
+ var sep11 = path63.sep;
75586
75586
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
75587
75587
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
75588
75588
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
@@ -75743,14 +75743,14 @@ var require_send = __commonJS({
75743
75743
  var parts2;
75744
75744
  if (root !== null) {
75745
75745
  if (path64) {
75746
- path64 = normalize("." + sep10 + path64);
75746
+ path64 = normalize("." + sep11 + path64);
75747
75747
  }
75748
75748
  if (UP_PATH_REGEXP.test(path64)) {
75749
75749
  debug('malicious path "%s"', path64);
75750
75750
  this.error(403);
75751
75751
  return res;
75752
75752
  }
75753
- parts2 = path64.split(sep10);
75753
+ parts2 = path64.split(sep11);
75754
75754
  path64 = normalize(join68(root, path64));
75755
75755
  } else {
75756
75756
  if (UP_PATH_REGEXP.test(path64)) {
@@ -75758,7 +75758,7 @@ var require_send = __commonJS({
75758
75758
  this.error(403);
75759
75759
  return res;
75760
75760
  }
75761
- parts2 = normalize(path64).split(sep10);
75761
+ parts2 = normalize(path64).split(sep11);
75762
75762
  path64 = resolve19(path64);
75763
75763
  }
75764
75764
  if (containsDotFile(parts2)) {
@@ -75852,7 +75852,7 @@ var require_send = __commonJS({
75852
75852
  var self2 = this;
75853
75853
  debug('stat "%s"', path64);
75854
75854
  fs78.stat(path64, function onstat(err, stat10) {
75855
- var pathEndsWithSep = path64[path64.length - 1] === sep10;
75855
+ var pathEndsWithSep = path64[path64.length - 1] === sep11;
75856
75856
  if (err && err.code === "ENOENT" && !extname7(path64) && !pathEndsWithSep) {
75857
75857
  return next(err);
75858
75858
  }
@@ -94348,10 +94348,10 @@ var require_resolve_block_map = __commonJS({
94348
94348
  let offset = bm.offset;
94349
94349
  let commentEnd = null;
94350
94350
  for (const collItem of bm.items) {
94351
- const { start: start2, key: key2, sep: sep10, value } = collItem;
94351
+ const { start: start2, key: key2, sep: sep11, value } = collItem;
94352
94352
  const keyProps = resolveProps.resolveProps(start2, {
94353
94353
  indicator: "explicit-key-ind",
94354
- next: key2 ?? sep10?.[0],
94354
+ next: key2 ?? sep11?.[0],
94355
94355
  offset,
94356
94356
  onError,
94357
94357
  parentIndent: bm.indent,
@@ -94365,7 +94365,7 @@ var require_resolve_block_map = __commonJS({
94365
94365
  else if ("indent" in key2 && key2.indent !== bm.indent)
94366
94366
  onError(offset, "BAD_INDENT", startColMsg);
94367
94367
  }
94368
- if (!keyProps.anchor && !keyProps.tag && !sep10) {
94368
+ if (!keyProps.anchor && !keyProps.tag && !sep11) {
94369
94369
  commentEnd = keyProps.end;
94370
94370
  if (keyProps.comment) {
94371
94371
  if (map2.comment)
@@ -94389,7 +94389,7 @@ var require_resolve_block_map = __commonJS({
94389
94389
  ctx.atKey = false;
94390
94390
  if (utilMapIncludes.mapIncludes(ctx, map2.items, keyNode))
94391
94391
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
94392
- const valueProps = resolveProps.resolveProps(sep10 ?? [], {
94392
+ const valueProps = resolveProps.resolveProps(sep11 ?? [], {
94393
94393
  indicator: "map-value-ind",
94394
94394
  next: value,
94395
94395
  offset: keyNode.range[2],
@@ -94405,7 +94405,7 @@ var require_resolve_block_map = __commonJS({
94405
94405
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
94406
94406
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
94407
94407
  }
94408
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep10, null, valueProps, onError);
94408
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep11, null, valueProps, onError);
94409
94409
  if (ctx.schema.compat)
94410
94410
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
94411
94411
  offset = valueNode.range[2];
@@ -94496,7 +94496,7 @@ var require_resolve_end = __commonJS({
94496
94496
  let comment = "";
94497
94497
  if (end) {
94498
94498
  let hasSpace = false;
94499
- let sep10 = "";
94499
+ let sep11 = "";
94500
94500
  for (const token of end) {
94501
94501
  const { source, type } = token;
94502
94502
  switch (type) {
@@ -94510,13 +94510,13 @@ var require_resolve_end = __commonJS({
94510
94510
  if (!comment)
94511
94511
  comment = cb;
94512
94512
  else
94513
- comment += sep10 + cb;
94514
- sep10 = "";
94513
+ comment += sep11 + cb;
94514
+ sep11 = "";
94515
94515
  break;
94516
94516
  }
94517
94517
  case "newline":
94518
94518
  if (comment)
94519
- sep10 += source;
94519
+ sep11 += source;
94520
94520
  hasSpace = true;
94521
94521
  break;
94522
94522
  default:
@@ -94559,18 +94559,18 @@ var require_resolve_flow_collection = __commonJS({
94559
94559
  let offset = fc.offset + fc.start.source.length;
94560
94560
  for (let i = 0; i < fc.items.length; ++i) {
94561
94561
  const collItem = fc.items[i];
94562
- const { start: start2, key: key2, sep: sep10, value } = collItem;
94562
+ const { start: start2, key: key2, sep: sep11, value } = collItem;
94563
94563
  const props = resolveProps.resolveProps(start2, {
94564
94564
  flow: fcName,
94565
94565
  indicator: "explicit-key-ind",
94566
- next: key2 ?? sep10?.[0],
94566
+ next: key2 ?? sep11?.[0],
94567
94567
  offset,
94568
94568
  onError,
94569
94569
  parentIndent: fc.indent,
94570
94570
  startOnNewline: false
94571
94571
  });
94572
94572
  if (!props.found) {
94573
- if (!props.anchor && !props.tag && !sep10 && !value) {
94573
+ if (!props.anchor && !props.tag && !sep11 && !value) {
94574
94574
  if (i === 0 && props.comma)
94575
94575
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
94576
94576
  else if (i < fc.items.length - 1)
@@ -94624,8 +94624,8 @@ var require_resolve_flow_collection = __commonJS({
94624
94624
  }
94625
94625
  }
94626
94626
  }
94627
- if (!isMap && !sep10 && !props.found) {
94628
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep10, null, props, onError);
94627
+ if (!isMap && !sep11 && !props.found) {
94628
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep11, null, props, onError);
94629
94629
  coll.items.push(valueNode);
94630
94630
  offset = valueNode.range[2];
94631
94631
  if (isBlock(value))
@@ -94637,7 +94637,7 @@ var require_resolve_flow_collection = __commonJS({
94637
94637
  if (isBlock(key2))
94638
94638
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
94639
94639
  ctx.atKey = false;
94640
- const valueProps = resolveProps.resolveProps(sep10 ?? [], {
94640
+ const valueProps = resolveProps.resolveProps(sep11 ?? [], {
94641
94641
  flow: fcName,
94642
94642
  indicator: "map-value-ind",
94643
94643
  next: value,
@@ -94648,8 +94648,8 @@ var require_resolve_flow_collection = __commonJS({
94648
94648
  });
94649
94649
  if (valueProps.found) {
94650
94650
  if (!isMap && !props.found && ctx.options.strict) {
94651
- if (sep10)
94652
- for (const st of sep10) {
94651
+ if (sep11)
94652
+ for (const st of sep11) {
94653
94653
  if (st === valueProps.found)
94654
94654
  break;
94655
94655
  if (st.type === "newline") {
@@ -94666,7 +94666,7 @@ var require_resolve_flow_collection = __commonJS({
94666
94666
  else
94667
94667
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
94668
94668
  }
94669
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep10, null, valueProps, onError) : null;
94669
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep11, null, valueProps, onError) : null;
94670
94670
  if (valueNode) {
94671
94671
  if (isBlock(value))
94672
94672
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -94846,7 +94846,7 @@ var require_resolve_block_scalar = __commonJS({
94846
94846
  chompStart = i + 1;
94847
94847
  }
94848
94848
  let value = "";
94849
- let sep10 = "";
94849
+ let sep11 = "";
94850
94850
  let prevMoreIndented = false;
94851
94851
  for (let i = 0; i < contentStart; ++i)
94852
94852
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -94863,24 +94863,24 @@ var require_resolve_block_scalar = __commonJS({
94863
94863
  indent = "";
94864
94864
  }
94865
94865
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
94866
- value += sep10 + indent.slice(trimIndent) + content;
94867
- sep10 = "\n";
94866
+ value += sep11 + indent.slice(trimIndent) + content;
94867
+ sep11 = "\n";
94868
94868
  } else if (indent.length > trimIndent || content[0] === " ") {
94869
- if (sep10 === " ")
94870
- sep10 = "\n";
94871
- else if (!prevMoreIndented && sep10 === "\n")
94872
- sep10 = "\n\n";
94873
- value += sep10 + indent.slice(trimIndent) + content;
94874
- sep10 = "\n";
94869
+ if (sep11 === " ")
94870
+ sep11 = "\n";
94871
+ else if (!prevMoreIndented && sep11 === "\n")
94872
+ sep11 = "\n\n";
94873
+ value += sep11 + indent.slice(trimIndent) + content;
94874
+ sep11 = "\n";
94875
94875
  prevMoreIndented = true;
94876
94876
  } else if (content === "") {
94877
- if (sep10 === "\n")
94877
+ if (sep11 === "\n")
94878
94878
  value += "\n";
94879
94879
  else
94880
- sep10 = "\n";
94880
+ sep11 = "\n";
94881
94881
  } else {
94882
- value += sep10 + content;
94883
- sep10 = " ";
94882
+ value += sep11 + content;
94883
+ sep11 = " ";
94884
94884
  prevMoreIndented = false;
94885
94885
  }
94886
94886
  }
@@ -95063,25 +95063,25 @@ var require_resolve_flow_scalar = __commonJS({
95063
95063
  trimBoth = /^[ \t]+|[ \t]+$/g;
95064
95064
  }
95065
95065
  let res = match[1].replace(trimEnd, "");
95066
- let sep10 = " ";
95066
+ let sep11 = " ";
95067
95067
  let pos = line.lastIndex;
95068
95068
  while (match = line.exec(source)) {
95069
95069
  const lm = match[1].replace(trimBoth, "");
95070
95070
  if (lm === "") {
95071
- if (sep10 === "\n")
95072
- res += sep10;
95071
+ if (sep11 === "\n")
95072
+ res += sep11;
95073
95073
  else
95074
- sep10 = "\n";
95074
+ sep11 = "\n";
95075
95075
  } else {
95076
- res += sep10 + lm;
95077
- sep10 = " ";
95076
+ res += sep11 + lm;
95077
+ sep11 = " ";
95078
95078
  }
95079
95079
  pos = line.lastIndex;
95080
95080
  }
95081
95081
  const last = /[ \t]*(.*)/sy;
95082
95082
  last.lastIndex = pos;
95083
95083
  match = last.exec(source);
95084
- return res + sep10 + (match?.[1] ?? "");
95084
+ return res + sep11 + (match?.[1] ?? "");
95085
95085
  }
95086
95086
  function doubleQuotedValue(source, onError) {
95087
95087
  let res = "";
@@ -95891,14 +95891,14 @@ var require_cst_stringify = __commonJS({
95891
95891
  }
95892
95892
  }
95893
95893
  }
95894
- function stringifyItem({ start: start2, key: key2, sep: sep10, value }) {
95894
+ function stringifyItem({ start: start2, key: key2, sep: sep11, value }) {
95895
95895
  let res = "";
95896
95896
  for (const st of start2)
95897
95897
  res += st.source;
95898
95898
  if (key2)
95899
95899
  res += stringifyToken(key2);
95900
- if (sep10)
95901
- for (const st of sep10)
95900
+ if (sep11)
95901
+ for (const st of sep11)
95902
95902
  res += st.source;
95903
95903
  if (value)
95904
95904
  res += stringifyToken(value);
@@ -97065,18 +97065,18 @@ var require_parser2 = __commonJS({
97065
97065
  if (this.type === "map-value-ind") {
97066
97066
  const prev = getPrevProps(this.peek(2));
97067
97067
  const start2 = getFirstKeyStartProps(prev);
97068
- let sep10;
97068
+ let sep11;
97069
97069
  if (scalar.end) {
97070
- sep10 = scalar.end;
97071
- sep10.push(this.sourceToken);
97070
+ sep11 = scalar.end;
97071
+ sep11.push(this.sourceToken);
97072
97072
  delete scalar.end;
97073
97073
  } else
97074
- sep10 = [this.sourceToken];
97074
+ sep11 = [this.sourceToken];
97075
97075
  const map2 = {
97076
97076
  type: "block-map",
97077
97077
  offset: scalar.offset,
97078
97078
  indent: scalar.indent,
97079
- items: [{ start: start2, key: scalar, sep: sep10 }]
97079
+ items: [{ start: start2, key: scalar, sep: sep11 }]
97080
97080
  };
97081
97081
  this.onKeyLine = true;
97082
97082
  this.stack[this.stack.length - 1] = map2;
@@ -97229,15 +97229,15 @@ var require_parser2 = __commonJS({
97229
97229
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
97230
97230
  const start3 = getFirstKeyStartProps(it.start);
97231
97231
  const key2 = it.key;
97232
- const sep10 = it.sep;
97233
- sep10.push(this.sourceToken);
97232
+ const sep11 = it.sep;
97233
+ sep11.push(this.sourceToken);
97234
97234
  delete it.key;
97235
97235
  delete it.sep;
97236
97236
  this.stack.push({
97237
97237
  type: "block-map",
97238
97238
  offset: this.offset,
97239
97239
  indent: this.indent,
97240
- items: [{ start: start3, key: key2, sep: sep10 }]
97240
+ items: [{ start: start3, key: key2, sep: sep11 }]
97241
97241
  });
97242
97242
  } else if (start2.length > 0) {
97243
97243
  it.sep = it.sep.concat(start2, this.sourceToken);
@@ -97431,13 +97431,13 @@ var require_parser2 = __commonJS({
97431
97431
  const prev = getPrevProps(parent);
97432
97432
  const start2 = getFirstKeyStartProps(prev);
97433
97433
  fixFlowSeqItems(fc);
97434
- const sep10 = fc.end.splice(1, fc.end.length);
97435
- sep10.push(this.sourceToken);
97434
+ const sep11 = fc.end.splice(1, fc.end.length);
97435
+ sep11.push(this.sourceToken);
97436
97436
  const map2 = {
97437
97437
  type: "block-map",
97438
97438
  offset: fc.offset,
97439
97439
  indent: fc.indent,
97440
- items: [{ start: start2, key: fc, sep: sep10 }]
97440
+ items: [{ start: start2, key: fc, sep: sep11 }]
97441
97441
  };
97442
97442
  this.onKeyLine = true;
97443
97443
  this.stack[this.stack.length - 1] = map2;
@@ -101278,7 +101278,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
101278
101278
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101279
101279
  function readCliVersion() {
101280
101280
  if (true) {
101281
- return "0.33.1-next.12";
101281
+ return "0.33.1-next.13";
101282
101282
  }
101283
101283
  return "0.0.0";
101284
101284
  }
@@ -128112,11 +128112,11 @@ function parseVegaDeviceList(stdout) {
128112
128112
  const devices = [];
128113
128113
  for (const raw of stdout.split("\n")) {
128114
128114
  const line = raw.trim();
128115
- const sep10 = line.indexOf(" : ");
128116
- if (sep10 < 0) continue;
128117
- const type = line.slice(0, sep10).trim();
128115
+ const sep11 = line.indexOf(" : ");
128116
+ if (sep11 < 0) continue;
128117
+ const type = line.slice(0, sep11).trim();
128118
128118
  if (!/^[A-Za-z]+$/.test(type)) continue;
128119
- const rhs = line.slice(sep10 + 3).trim();
128119
+ const rhs = line.slice(sep11 + 3).trim();
128120
128120
  const parts2 = rhs.split(/\s+-\s+/);
128121
128121
  const serial = parts2[parts2.length - 1]?.trim();
128122
128122
  if (!serial) continue;
@@ -138273,21 +138273,21 @@ var Matcher = class {
138273
138273
  * @returns {string}
138274
138274
  */
138275
138275
  toString(separator, includeNamespace = true) {
138276
- const sep10 = separator || this.separator;
138277
- const isDefault = sep10 === this.separator && includeNamespace === true;
138276
+ const sep11 = separator || this.separator;
138277
+ const isDefault = sep11 === this.separator && includeNamespace === true;
138278
138278
  if (isDefault) {
138279
138279
  if (this._pathStringCache !== null) {
138280
138280
  return this._pathStringCache;
138281
138281
  }
138282
138282
  const result = this.path.map(
138283
138283
  (n) => n.namespace ? `${n.namespace}:${n.tag}` : n.tag
138284
- ).join(sep10);
138284
+ ).join(sep11);
138285
138285
  this._pathStringCache = result;
138286
138286
  return result;
138287
138287
  }
138288
138288
  return this.path.map(
138289
138289
  (n) => includeNamespace && n.namespace ? `${n.namespace}:${n.tag}` : n.tag
138290
- ).join(sep10);
138290
+ ).join(sep11);
138291
138291
  }
138292
138292
  /**
138293
138293
  * Get path as array of tag names.
@@ -165456,11 +165456,11 @@ function buildHotspots(nodes, samples, timeDeltas, topN2, reactOnly) {
165456
165456
  function renderMarkdownTable(entries) {
165457
165457
  if (entries.length === 0) return "_No hotspots found._";
165458
165458
  const header = "| Function | Location | Self (ms) | Total (ms) | Self % |";
165459
- const sep10 = "|---|---|---|---|---|";
165459
+ const sep11 = "|---|---|---|---|---|";
165460
165460
  const rows = entries.map(
165461
165461
  (e) => `| \`${e.function}\` | ${e.url || "\u2014"} | ${e.self_ms} | ${e.total_ms} | ${e.self_pct} |`
165462
165462
  );
165463
- return [header, sep10, ...rows].join("\n");
165463
+ return [header, sep11, ...rows].join("\n");
165464
165464
  }
165465
165465
  var zodSchema50 = external_exports.object({
165466
165466
  port: metroPortField,
@@ -165578,11 +165578,11 @@ function renderMarkdownTable2(entries) {
165578
165578
  if (entries.length === 0)
165579
165579
  return "_No render data found. Ensure React DevTools global hook is present._";
165580
165580
  const header = "| Component | Instances | Total (ms) | Self Base (ms) |";
165581
- const sep10 = "|---|---|---|---|";
165581
+ const sep11 = "|---|---|---|---|";
165582
165582
  const rows = entries.map(
165583
165583
  (e) => `| \`${e.component}\` | ${e.renderCount} | ${e.totalActualDuration_ms.toFixed(2)} | ${e.selfBaseDuration_ms.toFixed(2)} |`
165584
165584
  );
165585
- return [header, sep10, ...rows].join("\n");
165585
+ return [header, sep11, ...rows].join("\n");
165586
165586
  }
165587
165587
  var zodSchema51 = external_exports.object({
165588
165588
  port: metroPortField,
@@ -171958,7 +171958,7 @@ function renderTopFunctions(index, topN2, startMs, endMs, reactOnly = false) {
171958
171958
  return `_No function sampled in ${windowStart.toFixed(1)}\u2013${windowEnd.toFixed(1)}ms has a PascalCase (React component) name. Query again without react_only to see the JS work._`;
171959
171959
  }
171960
171960
  const header = "| Function | Self (ms) | Self % | Total (ms) | Location |";
171961
- const sep10 = "|---|---|---|---|---|";
171961
+ const sep11 = "|---|---|---|---|---|";
171962
171962
  const rows = hotspots.map((hs) => {
171963
171963
  const loc = hs.url ? `${shortenUrl(hs.url)}${hs.lineNumber != null ? `:${hs.lineNumber}` : ""}` : "\u2014";
171964
171964
  const selfPct = res.coveredMs > 0 ? `${(hs.selfMs / res.coveredMs * 100).toFixed(1)}%` : "\u2014";
@@ -171969,7 +171969,7 @@ function renderTopFunctions(index, topN2, startMs, endMs, reactOnly = false) {
171969
171969
  ${coverageNote(res, windowStart, windowEnd, reactOnly)}
171970
171970
 
171971
171971
  ${header}
171972
- ${sep10}
171972
+ ${sep11}
171973
171973
  ${rows.join("\n")}`;
171974
171974
  }
171975
171975
  function renderCallTree(index, functionName, topN2, includeCallers) {
@@ -175477,9 +175477,16 @@ function parseScriptPath(raw, value) {
175477
175477
  if (miscased) {
175478
175478
  badEntry(raw, `a \`script\` path must use the lowercase ${miscased} extension`);
175479
175479
  }
175480
+ const commonJsOnly = COMMONJS_ONLY_EXTENSIONS.find((extension2) => lower.endsWith(extension2));
175481
+ if (commonJsOnly) {
175482
+ badEntry(
175483
+ raw,
175484
+ `a \`script\` path must end in ${SCRIPT_EXTENSIONS_FOR_MESSAGE}, and ${commonJsOnly} is not accepted \u2014 where the project's package.json sets "type": "module", use \`import\` in the script in place of \`require\``
175485
+ );
175486
+ }
175480
175487
  badEntry(
175481
175488
  raw,
175482
- `a \`script\` path must end in ${SCRIPT_EXTENSIONS_FOR_MESSAGE} \u2014 the extension pins the module type whatever the project's package.json says`
175489
+ `a \`script\` path must end in ${SCRIPT_EXTENSIONS_FOR_MESSAGE} \u2014 a JavaScript or TypeScript file`
175483
175490
  );
175484
175491
  }
175485
175492
  if (!SCRIPT_FILE_NAME_PATTERN.test(path48.posix.basename(value))) {
@@ -175490,6 +175497,7 @@ function parseScriptPath(raw, value) {
175490
175497
  }
175491
175498
  return value;
175492
175499
  }
175500
+ var COMMONJS_ONLY_EXTENSIONS = [".cjs", ".cts"];
175493
175501
  var SCRIPT_EXTENSIONS_FOR_MESSAGE = `${SCRIPT_FILE_EXTENSIONS.slice(0, -1).join(", ")} or ${SCRIPT_FILE_EXTENSIONS.slice(-1)[0]}`;
175494
175502
  function parseScriptTimeout(raw, value) {
175495
175503
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
@@ -176321,7 +176329,7 @@ standalone e2e test, record a restart-app of the app under test as the FIRST ste
176321
176329
  pass executionPrerequisite instead. Starting over an existing e2e test replaces the
176322
176330
  whole file, including its \`requires:\` block; pass \`requires\` to keep it.
176323
176331
  Use e2e-add-echo to add labels, and
176324
- e2e-add-script to run a local .mjs or .mts file and record it as a \`script:\` step.
176332
+ e2e-add-script to run a local .mjs, .mts, .js or .ts file and record it as a \`script:\` step.
176325
176333
  Call e2e-finish-recording when done.
176326
176334
 
176327
176335
  To remove or reorder steps, edit the .yaml file after e2e-finish-recording, not
@@ -180216,11 +180224,17 @@ var FlowScriptExecutor = class {
180216
180224
  // The runner rides in as a preload, not as the entry module, so the
180217
180225
  // *script* is what `process.argv[1]`/`require.main` name and an "am I
180218
180226
  // the main module?" guard runs its body. Node awaits an `--import`
180219
- // module before the entry, which leaves room for the handshake.
180227
+ // module before the entry, which leaves room for the handshake. The
180228
+ // preload also sends a CommonJS entry through the ESM loader, which
180229
+ // leaves `module.id` and `module.parent` unlike a main module's; the
180230
+ // runner's `claimMainModuleIdentity` puts those back. A CommonJS `.ts`
180231
+ // entry also gets a reduced `require` there, so the runner loads that
180232
+ // one itself: see its `loadEntryAsPlainNodeDoes`.
180220
180233
  execArgv: [
180221
180234
  `--max-old-space-size=${bounds.heapLimitMb}`,
180222
180235
  "--import",
180223
- (0, import_node_url3.pathToFileURL)(runnerPath).href
180236
+ (0, import_node_url3.pathToFileURL)(runnerPath).href,
180237
+ ...typelessPackageWarningFlags()
180224
180238
  ],
180225
180239
  // Index 3 is a sink, and the protocol channel sits above it. The
180226
180240
  // channel is inherited by the script, Node parses it inside its own
@@ -180602,6 +180616,9 @@ function realPathOrSelf(candidate) {
180602
180616
  return candidate;
180603
180617
  }
180604
180618
  }
180619
+ function typelessPackageWarningFlags() {
180620
+ return process.allowedNodeEnvironmentFlags.has("--disable-warning") ? ["--disable-warning=MODULE_TYPELESS_PACKAGE_JSON"] : [];
180621
+ }
180605
180622
  function resolveRunnerPath(runnerDir) {
180606
180623
  const dir = runnerDir ?? __dirname;
180607
180624
  const runner = path53.join(dir, RUNNER_FILE);
@@ -181057,11 +181074,11 @@ async function runFlowScriptStep(request3) {
181057
181074
  const roots = result.ok ? [] : [request3.projectRoot, await canonicalFlowPath(request3.projectRoot)];
181058
181075
  const hostLimit = await typeScriptLoadRefusal(target, result, roots);
181059
181076
  const verdict = hostLimit !== void 0 ? { status: "error", reason: [hostLimit, ...result.notes].join(" ") } : scriptVerdict(result);
181060
- const frames = result.ok || hostLimit !== void 0 ? "" : scriptFrames(result.failure?.stack, roots);
181077
+ const tail = result.ok || hostLimit !== void 0 ? "" : cjsRenameNote(result.failure, canonical) + scriptFrames(result.failure?.stack, roots);
181061
181078
  return {
181062
181079
  outcome: {
181063
181080
  ...verdict,
181064
- ...frames && verdict.reason !== void 0 ? { reason: verdict.reason + frames } : {},
181081
+ ...tail && verdict.reason !== void 0 ? { reason: verdict.reason + tail } : {},
181065
181082
  ...result.log ? { scriptLog: result.log } : {},
181066
181083
  ...result.logTruncated ? { scriptLogTruncated: true } : {}
181067
181084
  },
@@ -181070,8 +181087,18 @@ async function runFlowScriptStep(request3) {
181070
181087
  };
181071
181088
  }
181072
181089
  function isTypeScriptScript(base) {
181073
- return base.endsWith(".mts");
181090
+ return base.endsWith(".ts") || base.endsWith(".mts");
181091
+ }
181092
+ function javaScriptSpelling(target) {
181093
+ return /\.m[jt]s$/.test(target) ? ".mjs" : ".js, or .mjs for an ES module";
181094
+ }
181095
+ function cjsRenameNote(failure2, canonical) {
181096
+ if (!failure2?.stack || !NODE_CJS_RENAME_ADVICE.test(failure2.message)) return "";
181097
+ const top = failure2.stack.split("\n").find((line) => line.trim().startsWith("at "));
181098
+ if (!top?.includes(`${(0, import_node_url4.pathToFileURL)(canonical).href}:`)) return "";
181099
+ return " A script step does not accept a .cjs file: use import in the script instead.";
181074
181100
  }
181101
+ var NODE_CJS_RENAME_ADVICE = /rename it to use the '\.cjs' file extension/;
181075
181102
  var TYPESCRIPT_MIN_NODE = "22.18";
181076
181103
  function nodeStripsTypes(version3 = process.versions.node) {
181077
181104
  const [major2 = 0, minor = 0] = version3.split(".").map(Number);
@@ -181084,32 +181111,53 @@ function typeScriptGap(strips, version3 = process.versions.node) {
181084
181111
  if (!nodeStripsTypes(version3)) return "release";
181085
181112
  return strips === false ? "build" : void 0;
181086
181113
  }
181087
- function typeScriptRefusalReason(subject2, gap, version3 = process.versions.node) {
181114
+ function typeScriptRefusalReason(subject2, gap, version3 = process.versions.node, javaScript = ".mjs") {
181088
181115
  const host = gap === "release" ? `the tool-server runs on Node.js ${version3}, which cannot run it. Node.js runs TypeScript from ${TYPESCRIPT_MIN_NODE}, except on 23.0 to 23.5. Stop the tool-server with \`argent server stop\`, then run Argent on such a Node.js,` : `the tool-server runs on a build of Node.js ${version3} that cannot run it: the build has no TypeScript support, like the nodejs package of Debian and Ubuntu. Stop the tool-server with \`argent server stop\`, then run Argent on a Node.js from nodejs.org,`;
181089
- return `${subject2}, and ${host} or use JavaScript (.mjs) for the script and for the files it imports.`;
181116
+ return `${subject2}, and ${host} or use JavaScript (${javaScript}) for the script and for the files it imports.`;
181090
181117
  }
181091
181118
  async function typeScriptScriptRefusal(target) {
181092
181119
  if (!isTypeScriptScript(path54.posix.basename(target))) return void 0;
181093
181120
  const gap = typeScriptGap(await flowScriptExecutor().stripsTypes());
181094
- return gap && typeScriptRefusalReason(`Script "${target}" is TypeScript`, gap);
181121
+ return gap && typeScriptRefusalReason(
181122
+ `Script "${target}" is TypeScript`,
181123
+ gap,
181124
+ void 0,
181125
+ javaScriptSpelling(target)
181126
+ );
181095
181127
  }
181096
181128
  var UNKNOWN_TYPESCRIPT_FILE_RE = /^Unknown file extension "\.[mc]?ts" for (.+)$/;
181097
181129
  async function typeScriptLoadRefusal(target, result, roots) {
181098
- if (result.ok || result.failure?.kind !== "load") return void 0;
181099
- const file2 = UNKNOWN_TYPESCRIPT_FILE_RE.exec(result.failure.message)?.[1];
181130
+ if (result.ok || !result.failure) return void 0;
181131
+ const file2 = unloadedTypeScriptFile(result.failure);
181100
181132
  if (file2 === void 0) return void 0;
181101
181133
  const gap = typeScriptGap(await flowScriptExecutor().stripsTypes());
181102
181134
  return gap && typeScriptRefusalReason(
181103
181135
  `Script "${target}" loads the TypeScript file "${readablePath(file2, roots)}"`,
181104
- gap
181136
+ gap,
181137
+ void 0,
181138
+ javaScriptSpelling(target)
181105
181139
  );
181106
181140
  }
181141
+ function unloadedTypeScriptFile(failure2) {
181142
+ if (failure2.kind === "load") {
181143
+ const named = UNKNOWN_TYPESCRIPT_FILE_RE.exec(failure2.message)?.[1];
181144
+ if (named !== void 0) return named;
181145
+ }
181146
+ const lines = failure2.stack?.split("\n") ?? [];
181147
+ const place = lines[0]?.trim() ?? "";
181148
+ if (!STACK_PLACE_RE.test(place) || place.startsWith("file:")) return void 0;
181149
+ const file2 = place.slice(0, place.lastIndexOf(":"));
181150
+ if (!TYPESCRIPT_FILE_RE.test(file2)) return void 0;
181151
+ return lines.some((line) => line.startsWith("SyntaxError")) ? file2 : void 0;
181152
+ }
181153
+ var TYPESCRIPT_FILE_RE = /\.[mc]?ts$/;
181107
181154
  var SCRIPT_REASON_MAX_FRAMES = 6;
181108
181155
  function isHostFrame(frame2) {
181109
- return frame2.includes("node:internal") || frame2.includes("flow-script-runner.mjs") || frame2.includes("flow-script-watchdog");
181156
+ return NODE_FRAME_RE.test(frame2) || frame2.includes("node:internal") || frame2.includes("flow-script-runner.mjs") || frame2.includes("flow-script-watchdog");
181110
181157
  }
181158
+ var NODE_FRAME_RE = /(?:^at (?:async )?|\()node:[^\s()]+\)?$/;
181111
181159
  function readableFrame(frame2, roots) {
181112
- return frame2.replace(/file:\/\/[^\s)]+/g, (match) => {
181160
+ const withoutUrls = frame2.replace(/file:\/\/[^\s)]+/g, (match) => {
181113
181161
  const split = /^(.*?)(:\d+(?::\d+)?)$/.exec(match);
181114
181162
  const url2 = split ? split[1] : match;
181115
181163
  const position = split ? split[2] : "";
@@ -181121,6 +181169,13 @@ function readableFrame(frame2, roots) {
181121
181169
  }
181122
181170
  return `${readablePath(file2, roots)}${position}`;
181123
181171
  });
181172
+ return roots.reduce(withoutRoot, withoutUrls);
181173
+ }
181174
+ function withoutRoot(frame2, root) {
181175
+ const prefix = root.endsWith(path54.sep) ? root : root + path54.sep;
181176
+ const escaped = prefix.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
181177
+ const flags = process.platform === "win32" ? "gi" : "g";
181178
+ return frame2.replace(new RegExp(`(^at (?:async )?|\\()${escaped}`, flags), "$1");
181124
181179
  }
181125
181180
  function readablePath(file2, roots) {
181126
181181
  for (const root of roots) {
@@ -181131,14 +181186,14 @@ function readablePath(file2, roots) {
181131
181186
  }
181132
181187
  return file2;
181133
181188
  }
181134
- var STACK_PLACE_RE = /^file:\/\/\S+:\d+$/;
181189
+ var STACK_PLACE_RE = /^(?:file:\/\/\S+|(?:\/|[A-Za-z]:[\\/]).*):\d+$/;
181135
181190
  function scriptFrames(stack, roots) {
181136
181191
  if (!stack) return "";
181137
181192
  const frames = [];
181138
181193
  let dropped = 0;
181139
181194
  const lines = stack.split("\n");
181140
181195
  const place = lines[0].trim();
181141
- if (STACK_PLACE_RE.test(place)) frames.push(` at ${readableFrame(place, roots)}`);
181196
+ if (STACK_PLACE_RE.test(place)) frames.push(` ${readableFrame(`at ${place}`, roots)}`);
181142
181197
  for (const line of lines) {
181143
181198
  const frame2 = line.trim();
181144
181199
  if (!frame2.startsWith("at ") || isHostFrame(frame2)) continue;
@@ -181244,13 +181299,13 @@ var zodSchema69 = external_exports.object({
181244
181299
  name: external_exports.string().describe("E2E test name passed to e2e-start-recording."),
181245
181300
  project_root: external_exports.string().describe("Absolute project root passed to e2e-start-recording."),
181246
181301
  path: external_exports.string().describe(
181247
- 'Path to the .mjs or .mts file, relative to the e2e test YAML. For example: "../../scripts/seed-order.mjs".'
181302
+ 'Path to the script file (.mjs, .mts, .js or .ts), relative to the e2e test YAML. For example: "../../scripts/seed-order.mjs".'
181248
181303
  ),
181249
181304
  timeout: external_exports.number().optional().describe("Time limit in milliseconds. The default is 30000 and the minimum is 100.")
181250
181305
  });
181251
181306
  var flowAddScriptTool = {
181252
181307
  id: "e2e-add-script",
181253
- description: `Run a local .mjs or .mts (TypeScript) file and record it as a \`script:\` step in an active e2e test. Use when the user requests a local script in the e2e test, and only then. Call it at the point in the recording where the script must run. Returns \`status\`, \`reason\` and \`stepCount\`. A failed script is not recorded. Check \`reason\` and the affected state before you retry. Over a link (argent link or ARGENT_TOOLS_URL), the tool refuses the call: record such an e2e test with no link.`,
181308
+ description: `Run a local JavaScript (.mjs, .js) or TypeScript (.mts, .ts) file and record it as a \`script:\` step in an active e2e test. Use when the user requests a local script in the e2e test, and only then. Call it at the point in the recording where the script must run. Returns \`status\`, \`reason\` and \`stepCount\`. A failed script is not recorded. Check \`reason\` and the affected state before you retry. Over a link (argent link or ARGENT_TOOLS_URL), the tool refuses the call: record such an e2e test with no link.`,
181254
181309
  zodSchema: zodSchema69,
181255
181310
  aliases: ["flow-add-script"],
181256
181311
  interaction: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.33.1-next.12",
3
+ "version": "0.33.1-next.13",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
6
6
  "license": "Apache-2.0",
@@ -252,15 +252,17 @@ A `run:` target is a YAML path resolved against the directory of the test file c
252
252
 
253
253
  Use the map form shown above. A bare `script: scripts/seed.mjs` is invalid.
254
254
 
255
- `path` is relative to the test file that contains the step. Use an `.mjs` file, or an `.mts` file for TypeScript, and match the file name's letter case. `timeout` is in milliseconds, as in `e2e-add-script`.
255
+ `path` is relative to the test file that contains the step. Use an `.mjs` or `.js` file, or an `.mts` or `.ts` file for TypeScript, and match the file name's letter case. `timeout` is in milliseconds, as in `e2e-add-script`.
256
256
 
257
- Node runs `.mts` by removing the types, and it does not read `tsconfig.json`. In an `.mts` script:
257
+ `.mjs` and `.mts` are always ES modules. `.js` and `.ts` take their module type from the project's `package.json` `type` field; with no `type`, Node 20.19+ and 22.7+ read a file with `import`, `export` or top-level `await` as an ES module, and older Node reads every such file as CommonJS. So prefer `.mjs` or `.mts` for a new script and use `.js` or `.ts` for a script the project already has. `.cjs` and `.cts` are invalid: under `"type": "module"`, use `import` in the script, not `require`.
258
+
259
+ Node runs `.mts` and `.ts` by removing the types, and it does not read `tsconfig.json`. In an `.mts` or `.ts` script:
258
260
 
259
261
  - Use no `enum`, runtime `namespace`, parameter property or `paths` alias.
260
262
  - Write the extension in each relative import (`./helpers.mts`), and import shared code only from `.mts` or `.mjs` files.
261
263
  - Import a type with `import type`.
262
264
 
263
- If the reason says that the Node.js of the tool-server cannot run TypeScript, use `.mjs` files.
265
+ If the reason says that the Node.js of the tool-server cannot run TypeScript, use `.mjs` or `.js` files.
264
266
 
265
267
  Over a link (`argent link` or `ARGENT_TOOLS_URL`, also to 127.0.0.1), `e2e-add-script` refuses the call, and a replay rejects a test with a `script:` step. Record and replay a test with a script without a link.
266
268