sh-ast 0.0.0 → 0.1.0

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 (73) hide show
  1. package/README.md +147 -0
  2. package/dist/analyze/ansi-c-escapes.d.ts +53 -0
  3. package/dist/analyze/ansi-c-escapes.d.ts.map +1 -0
  4. package/dist/analyze/ansi-c-escapes.js +255 -0
  5. package/dist/analyze/ansi-c-escapes.js.map +1 -0
  6. package/dist/analyze/decode-lit.d.ts +74 -0
  7. package/dist/analyze/decode-lit.d.ts.map +1 -0
  8. package/dist/analyze/decode-lit.js +114 -0
  9. package/dist/analyze/decode-lit.js.map +1 -0
  10. package/dist/analyze/enumerate-commands.d.ts +159 -0
  11. package/dist/analyze/enumerate-commands.d.ts.map +1 -0
  12. package/dist/analyze/enumerate-commands.js +390 -0
  13. package/dist/analyze/enumerate-commands.js.map +1 -0
  14. package/dist/analyze/index.d.ts +18 -0
  15. package/dist/analyze/index.d.ts.map +1 -0
  16. package/dist/analyze/index.js +27 -0
  17. package/dist/analyze/index.js.map +1 -0
  18. package/dist/analyze/node-helpers.d.ts +28 -0
  19. package/dist/analyze/node-helpers.d.ts.map +1 -0
  20. package/dist/analyze/node-helpers.js +37 -0
  21. package/dist/analyze/node-helpers.js.map +1 -0
  22. package/dist/analyze/resolve-word.d.ts +146 -0
  23. package/dist/analyze/resolve-word.d.ts.map +1 -0
  24. package/dist/analyze/resolve-word.js +202 -0
  25. package/dist/analyze/resolve-word.js.map +1 -0
  26. package/dist/analyze.d.ts +390 -0
  27. package/dist/deep-freeze.d.ts +14 -0
  28. package/dist/deep-freeze.d.ts.map +1 -0
  29. package/dist/deep-freeze.js +25 -0
  30. package/dist/deep-freeze.js.map +1 -0
  31. package/dist/errors.d.ts +115 -0
  32. package/dist/errors.d.ts.map +1 -0
  33. package/dist/errors.js +106 -0
  34. package/dist/errors.js.map +1 -0
  35. package/dist/index.d.ts +18 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +5 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/normalize.d.ts +52 -0
  40. package/dist/normalize.d.ts.map +1 -0
  41. package/dist/normalize.js +260 -0
  42. package/dist/normalize.js.map +1 -0
  43. package/dist/parse.d.ts +45 -0
  44. package/dist/parse.d.ts.map +1 -0
  45. package/dist/parse.js +118 -0
  46. package/dist/parse.js.map +1 -0
  47. package/dist/sh-ast.d.ts +1270 -0
  48. package/dist/types.d.ts +70 -0
  49. package/dist/types.d.ts.map +1 -0
  50. package/dist/types.js +2 -0
  51. package/dist/types.js.map +1 -0
  52. package/dist/visitor-keys.d.ts +21 -0
  53. package/dist/visitor-keys.d.ts.map +1 -0
  54. package/dist/visitor-keys.js +23 -0
  55. package/dist/visitor-keys.js.map +1 -0
  56. package/dist/walk.d.ts +18 -0
  57. package/dist/walk.d.ts.map +1 -0
  58. package/dist/walk.js +40 -0
  59. package/dist/walk.js.map +1 -0
  60. package/dist/wasm-instance.d.ts +13 -0
  61. package/dist/wasm-instance.d.ts.map +1 -0
  62. package/dist/wasm-instance.js +88 -0
  63. package/dist/wasm-instance.js.map +1 -0
  64. package/generated/child-type-schema.d.ts +14 -0
  65. package/generated/child-type-schema.js +188 -0
  66. package/generated/node-types.d.ts +958 -0
  67. package/generated/position-fields.d.ts +21 -0
  68. package/generated/position-fields.js +50 -0
  69. package/generated/visitor-keys.d.ts +11 -0
  70. package/generated/visitor-keys.js +50 -0
  71. package/package.json +93 -10
  72. package/shim/sh-ast.wasm +0 -0
  73. package/shim/wasm_exec.js +654 -0
@@ -0,0 +1,1270 @@
1
+ /**
2
+ * Options accepted by {@link parseSync}.
3
+ *
4
+ * @public
5
+ */
6
+ export declare interface ParseOptions {
7
+ /**
8
+ * The shell dialect to parse against.
9
+ * @defaultValue `"bash"`
10
+ */
11
+ readonly dialect?: ShellDialect;
12
+ /**
13
+ * Filename used only to annotate error messages and positions; the source
14
+ * is never read from disk.
15
+ * @defaultValue `"input.sh"`
16
+ */
17
+ readonly filename?: string;
18
+ }
19
+
20
+ /**
21
+ * Synchronously parses shell source into a normalized AST.
22
+ *
23
+ * The first call instantiates the WASM shim synchronously (Node-only); the
24
+ * instance is reused across subsequent calls, so repeated calls do not
25
+ * re-instantiate (see design/ARCHITECTURE.md).
26
+ *
27
+ * Throws {@link ShParseError} on a shell syntax error, carrying the position
28
+ * mvdan/sh reported: `.line` is 1-based exactly as mvdan/sh reports it;
29
+ * `.column` is converted to UTF-16 code units so it agrees with
30
+ * {@link ShNode.loc}'s columns (mvdan/sh itself reports `column` as a byte
31
+ * count — see {@link ShParseErrorInfo.column}). That unconverted, raw
32
+ * position appears only inside `.message`, which is mvdan/sh's own
33
+ * formatted string, verbatim. Throws {@link ShInvalidDialectError} when
34
+ * {@link ParseOptions.dialect} is not a supported dialect. Throws
35
+ * {@link ShBridgeInternalError} for failures that should never happen given
36
+ * a correctly-behaving shim (malformed envelope, unexpected root node
37
+ * type, shim contract violations).
38
+ *
39
+ * @public
40
+ */
41
+ export declare function parseSync(text: string, options?: ParseOptions): ShFile;
42
+
43
+ /**
44
+ * A 1-based line/column position. Columns are UTF-16 code units, matching
45
+ * JavaScript string indexing (see {@link ShNode.range}).
46
+ *
47
+ * @public
48
+ */
49
+ export declare interface Position {
50
+ readonly line: number;
51
+ readonly column: number;
52
+ }
53
+
54
+ /**
55
+ * Thrown by `sh-ast/analyze`'s `enumerateCommands` when a tree's genuinely
56
+ * nested structure — subshells within subshells, chained command/process
57
+ * substitutions, deeply nested `if`/`case`/loop/function/`time`/`{ }`
58
+ * bodies, deeply chained `elif` — exceeds its defensive recursion-depth
59
+ * guard. **Not** thrown for a long *linear* chain (`|`/`|&`/`&&`/`||` of
60
+ * any realistic length): `enumerateCommands` traverses those iteratively,
61
+ * so chain length alone never grows this guard's depth counter — only
62
+ * genuine tree nesting does.
63
+ *
64
+ * `enumerateCommands` deliberately fails closed here rather than returning
65
+ * a truncated, partial result: a partial `CommandSite[]` silently omits
66
+ * real command sites, which is a false negative for a permission-hook-style
67
+ * consumer that treats "command not found in the enumeration" as "nothing
68
+ * to worry about" — an explicit, documented throw is safer than a silent
69
+ * under-report. Gate-style consumers should treat this error as `deny`,
70
+ * not fall back to "no commands found, so allow".
71
+ *
72
+ * @public
73
+ */
74
+ export declare class ShAnalyzeMaxDepthError extends ShBridgeError {
75
+ readonly code = "ESLINT_SH_ANALYZE_MAX_DEPTH";
76
+ /** The maximum nesting depth `enumerateCommands` supports; the same value every time (not caller-configurable). */
77
+ readonly maxDepth: number;
78
+ constructor(maxDepth: number);
79
+ }
80
+
81
+ /**
82
+ * The union of every normalized node type this bridge can produce.
83
+ *
84
+ * @public
85
+ */
86
+ declare type ShAnyNode =
87
+ | ShArithmCmdNode
88
+ | ShArithmExpNode
89
+ | ShArrayElemNode
90
+ | ShArrayExprNode
91
+ | ShAssignNode
92
+ | ShBinaryArithmNode
93
+ | ShBinaryCmdNode
94
+ | ShBinaryTestNode
95
+ | ShBlockNode
96
+ | ShBraceExpNode
97
+ | ShCStyleLoopNode
98
+ | ShCallExprNode
99
+ | ShCaseClauseNode
100
+ | ShCaseItemNode
101
+ | ShCmdSubstNode
102
+ | ShCommentNode
103
+ | ShCoprocClauseNode
104
+ | ShDblQuotedNode
105
+ | ShDeclClauseNode
106
+ | ShExpansionNode
107
+ | ShExtGlobNode
108
+ | ShFileNode
109
+ | ShFlagsArithmNode
110
+ | ShForClauseNode
111
+ | ShFuncDeclNode
112
+ | ShIfClauseNode
113
+ | ShLetClauseNode
114
+ | ShLitNode
115
+ | ShParamExpNode
116
+ | ShParenArithmNode
117
+ | ShParenTestNode
118
+ | ShProcSubstNode
119
+ | ShRedirectNode
120
+ | ShReplaceNode
121
+ | ShSglQuotedNode
122
+ | ShSliceNode
123
+ | ShStmtNode
124
+ | ShSubshellNode
125
+ | ShTestClauseNode
126
+ | ShTestDeclNode
127
+ | ShTimeClauseNode
128
+ | ShUnaryArithmNode
129
+ | ShUnaryTestNode
130
+ | ShWhileClauseNode
131
+ | ShWordNode
132
+ | ShWordIterNode;
133
+
134
+ /**
135
+ * mvdan/sh's `syntax.ArithmCmd`, normalized.
136
+ *
137
+ * @public
138
+ */
139
+ declare interface ShArithmCmdNode {
140
+ readonly type: 'ArithmCmd';
141
+ readonly range: readonly [number, number];
142
+ readonly loc: {
143
+ readonly start: { readonly line: number; readonly column: number };
144
+ readonly end: { readonly line: number; readonly column: number };
145
+ };
146
+ [field: string]: unknown;
147
+ readonly x?: ShArithmExprNode;
148
+ }
149
+
150
+ /**
151
+ * mvdan/sh's `syntax.ArithmExp`, normalized.
152
+ *
153
+ * @public
154
+ */
155
+ declare interface ShArithmExpNode {
156
+ readonly type: 'ArithmExp';
157
+ readonly range: readonly [number, number];
158
+ readonly loc: {
159
+ readonly start: { readonly line: number; readonly column: number };
160
+ readonly end: { readonly line: number; readonly column: number };
161
+ };
162
+ [field: string]: unknown;
163
+ readonly x?: ShArithmExprNode;
164
+ }
165
+
166
+ /**
167
+ * The union of concrete node types mvdan/sh's `syntax.ArithmExpr` interface can
168
+ * hold.
169
+ *
170
+ * @public
171
+ */
172
+ declare type ShArithmExprNode =
173
+ ShBinaryArithmNode | ShFlagsArithmNode | ShParenArithmNode | ShUnaryArithmNode | ShWordNode;
174
+
175
+ /**
176
+ * mvdan/sh's `syntax.ArrayElem`, normalized.
177
+ *
178
+ * @public
179
+ */
180
+ declare interface ShArrayElemNode {
181
+ readonly type: 'ArrayElem';
182
+ readonly range: readonly [number, number];
183
+ readonly loc: {
184
+ readonly start: { readonly line: number; readonly column: number };
185
+ readonly end: { readonly line: number; readonly column: number };
186
+ };
187
+ [field: string]: unknown;
188
+ readonly comments: readonly ShCommentNode[];
189
+ readonly index?: ShArithmExprNode;
190
+ readonly value?: ShWordNode;
191
+ }
192
+
193
+ /**
194
+ * mvdan/sh's `syntax.ArrayExpr`, normalized.
195
+ *
196
+ * @public
197
+ */
198
+ declare interface ShArrayExprNode {
199
+ readonly type: 'ArrayExpr';
200
+ readonly range: readonly [number, number];
201
+ readonly loc: {
202
+ readonly start: { readonly line: number; readonly column: number };
203
+ readonly end: { readonly line: number; readonly column: number };
204
+ };
205
+ [field: string]: unknown;
206
+ readonly elems: readonly ShArrayElemNode[];
207
+ readonly last: readonly ShCommentNode[];
208
+ }
209
+
210
+ /**
211
+ * mvdan/sh's `syntax.Assign`, normalized.
212
+ *
213
+ * @public
214
+ */
215
+ declare interface ShAssignNode {
216
+ readonly type: 'Assign';
217
+ readonly range: readonly [number, number];
218
+ readonly loc: {
219
+ readonly start: { readonly line: number; readonly column: number };
220
+ readonly end: { readonly line: number; readonly column: number };
221
+ };
222
+ [field: string]: unknown;
223
+ readonly array?: ShArrayExprNode;
224
+ readonly index?: ShArithmExprNode;
225
+ readonly name?: ShLitNode;
226
+ readonly value?: ShWordNode;
227
+ }
228
+
229
+ /**
230
+ * mvdan/sh's `syntax.BinaryArithm`, normalized.
231
+ *
232
+ * @public
233
+ */
234
+ declare interface ShBinaryArithmNode {
235
+ readonly type: 'BinaryArithm';
236
+ readonly range: readonly [number, number];
237
+ readonly loc: {
238
+ readonly start: { readonly line: number; readonly column: number };
239
+ readonly end: { readonly line: number; readonly column: number };
240
+ };
241
+ [field: string]: unknown;
242
+ readonly x?: ShArithmExprNode;
243
+ readonly y?: ShArithmExprNode;
244
+ }
245
+
246
+ /**
247
+ * mvdan/sh's `syntax.BinaryCmd`, normalized.
248
+ *
249
+ * @public
250
+ */
251
+ declare interface ShBinaryCmdNode {
252
+ readonly type: 'BinaryCmd';
253
+ readonly range: readonly [number, number];
254
+ readonly loc: {
255
+ readonly start: { readonly line: number; readonly column: number };
256
+ readonly end: { readonly line: number; readonly column: number };
257
+ };
258
+ [field: string]: unknown;
259
+ readonly x?: ShStmtNode;
260
+ readonly y?: ShStmtNode;
261
+ }
262
+
263
+ /**
264
+ * mvdan/sh's `syntax.BinaryTest`, normalized.
265
+ *
266
+ * @public
267
+ */
268
+ declare interface ShBinaryTestNode {
269
+ readonly type: 'BinaryTest';
270
+ readonly range: readonly [number, number];
271
+ readonly loc: {
272
+ readonly start: { readonly line: number; readonly column: number };
273
+ readonly end: { readonly line: number; readonly column: number };
274
+ };
275
+ [field: string]: unknown;
276
+ readonly x?: ShTestExprNode;
277
+ readonly y?: ShTestExprNode;
278
+ }
279
+
280
+ /**
281
+ * mvdan/sh's `syntax.Block`, normalized.
282
+ *
283
+ * @public
284
+ */
285
+ declare interface ShBlockNode {
286
+ readonly type: 'Block';
287
+ readonly range: readonly [number, number];
288
+ readonly loc: {
289
+ readonly start: { readonly line: number; readonly column: number };
290
+ readonly end: { readonly line: number; readonly column: number };
291
+ };
292
+ [field: string]: unknown;
293
+ readonly last: readonly ShCommentNode[];
294
+ readonly stmts: readonly ShStmtNode[];
295
+ }
296
+
297
+ /**
298
+ * mvdan/sh's `syntax.BraceExp`, normalized.
299
+ *
300
+ * @public
301
+ */
302
+ declare interface ShBraceExpNode {
303
+ readonly type: 'BraceExp';
304
+ readonly range: readonly [number, number];
305
+ readonly loc: {
306
+ readonly start: { readonly line: number; readonly column: number };
307
+ readonly end: { readonly line: number; readonly column: number };
308
+ };
309
+ [field: string]: unknown;
310
+ readonly elems: readonly ShWordNode[];
311
+ }
312
+
313
+ /**
314
+ * Common base class for every error this package throws — originally just
315
+ * {@link parseSync}'s errors, now also the `sh-ast/analyze` layer's (see
316
+ * {@link ShAnalyzeMaxDepthError}). Provides a stable, documented `code`
317
+ * discriminator (e.g. `"ESLINT_SH_PARSE_ERROR"`) alongside the usual
318
+ * `instanceof` narrowing, so consumers can branch on failure kind
319
+ * programmatically without parsing `.message` strings. Never thrown
320
+ * directly — only via its concrete subclasses ({@link ShParseError},
321
+ * {@link ShInvalidDialectError}, {@link ShBridgeInternalError},
322
+ * {@link ShAnalyzeMaxDepthError}).
323
+ *
324
+ * @public
325
+ */
326
+ export declare abstract class ShBridgeError extends Error {
327
+ /**
328
+ * Stable, machine-readable discriminator for this error kind. Distinct
329
+ * per subclass and will not change once published.
330
+ */
331
+ abstract readonly code: string;
332
+ }
333
+
334
+ /**
335
+ * Thrown by {@link parseSync} for failures that should never happen given a
336
+ * correctly-behaving WASM shim: a malformed result envelope, an unexpected
337
+ * root node type, or any other shim contract violation. Distinct from
338
+ * {@link ShInvalidDialectError} and {@link ShParseError}, both of which
339
+ * indicate a foreseeable, actionable user mistake rather than an internal
340
+ * defect.
341
+ *
342
+ * @public
343
+ */
344
+ export declare class ShBridgeInternalError extends ShBridgeError {
345
+ readonly code = "ESLINT_SH_BRIDGE_INTERNAL";
346
+ constructor(message: string);
347
+ }
348
+
349
+ /**
350
+ * mvdan/sh's `syntax.CallExpr`, normalized.
351
+ *
352
+ * @public
353
+ */
354
+ declare interface ShCallExprNode {
355
+ readonly type: 'CallExpr';
356
+ readonly range: readonly [number, number];
357
+ readonly loc: {
358
+ readonly start: { readonly line: number; readonly column: number };
359
+ readonly end: { readonly line: number; readonly column: number };
360
+ };
361
+ [field: string]: unknown;
362
+ readonly args: readonly ShWordNode[];
363
+ readonly assigns: readonly ShAssignNode[];
364
+ }
365
+
366
+ /**
367
+ * mvdan/sh's `syntax.CaseClause`, normalized.
368
+ *
369
+ * @public
370
+ */
371
+ declare interface ShCaseClauseNode {
372
+ readonly type: 'CaseClause';
373
+ readonly range: readonly [number, number];
374
+ readonly loc: {
375
+ readonly start: { readonly line: number; readonly column: number };
376
+ readonly end: { readonly line: number; readonly column: number };
377
+ };
378
+ [field: string]: unknown;
379
+ readonly items: readonly ShCaseItemNode[];
380
+ readonly last: readonly ShCommentNode[];
381
+ readonly word?: ShWordNode;
382
+ }
383
+
384
+ /**
385
+ * mvdan/sh's `syntax.CaseItem`, normalized.
386
+ *
387
+ * @public
388
+ */
389
+ declare interface ShCaseItemNode {
390
+ readonly type: 'CaseItem';
391
+ readonly range: readonly [number, number];
392
+ readonly loc: {
393
+ readonly start: { readonly line: number; readonly column: number };
394
+ readonly end: { readonly line: number; readonly column: number };
395
+ };
396
+ [field: string]: unknown;
397
+ readonly comments: readonly ShCommentNode[];
398
+ readonly last: readonly ShCommentNode[];
399
+ readonly patterns: readonly ShWordNode[];
400
+ readonly stmts: readonly ShStmtNode[];
401
+ }
402
+
403
+ /**
404
+ * mvdan/sh's `syntax.CmdSubst`, normalized.
405
+ *
406
+ * @public
407
+ */
408
+ declare interface ShCmdSubstNode {
409
+ readonly type: 'CmdSubst';
410
+ readonly range: readonly [number, number];
411
+ readonly loc: {
412
+ readonly start: { readonly line: number; readonly column: number };
413
+ readonly end: { readonly line: number; readonly column: number };
414
+ };
415
+ [field: string]: unknown;
416
+ readonly last: readonly ShCommentNode[];
417
+ readonly stmts: readonly ShStmtNode[];
418
+ }
419
+
420
+ /**
421
+ * The union of concrete node types mvdan/sh's `syntax.Command` interface can
422
+ * hold.
423
+ *
424
+ * @public
425
+ */
426
+ declare type ShCommandNode =
427
+ | ShArithmCmdNode
428
+ | ShBinaryCmdNode
429
+ | ShBlockNode
430
+ | ShCallExprNode
431
+ | ShCaseClauseNode
432
+ | ShCoprocClauseNode
433
+ | ShDeclClauseNode
434
+ | ShForClauseNode
435
+ | ShFuncDeclNode
436
+ | ShIfClauseNode
437
+ | ShLetClauseNode
438
+ | ShSubshellNode
439
+ | ShTestClauseNode
440
+ | ShTestDeclNode
441
+ | ShTimeClauseNode
442
+ | ShWhileClauseNode;
443
+
444
+ /**
445
+ * mvdan/sh's `syntax.Comment`, normalized.
446
+ *
447
+ * @public
448
+ */
449
+ declare interface ShCommentNode {
450
+ readonly type: 'Comment';
451
+ readonly range: readonly [number, number];
452
+ readonly loc: {
453
+ readonly start: { readonly line: number; readonly column: number };
454
+ readonly end: { readonly line: number; readonly column: number };
455
+ };
456
+ [field: string]: unknown;
457
+ }
458
+
459
+ /**
460
+ * mvdan/sh's `syntax.CoprocClause`, normalized.
461
+ *
462
+ * @public
463
+ */
464
+ declare interface ShCoprocClauseNode {
465
+ readonly type: 'CoprocClause';
466
+ readonly range: readonly [number, number];
467
+ readonly loc: {
468
+ readonly start: { readonly line: number; readonly column: number };
469
+ readonly end: { readonly line: number; readonly column: number };
470
+ };
471
+ [field: string]: unknown;
472
+ readonly name?: ShWordNode;
473
+ readonly stmt?: ShStmtNode;
474
+ }
475
+
476
+ /**
477
+ * mvdan/sh's `syntax.CStyleLoop`, normalized.
478
+ *
479
+ * @public
480
+ */
481
+ declare interface ShCStyleLoopNode {
482
+ readonly type: 'CStyleLoop';
483
+ readonly range: readonly [number, number];
484
+ readonly loc: {
485
+ readonly start: { readonly line: number; readonly column: number };
486
+ readonly end: { readonly line: number; readonly column: number };
487
+ };
488
+ [field: string]: unknown;
489
+ readonly cond?: ShArithmExprNode;
490
+ readonly init?: ShArithmExprNode;
491
+ readonly post?: ShArithmExprNode;
492
+ }
493
+
494
+ /**
495
+ * mvdan/sh's `syntax.DblQuoted`, normalized.
496
+ *
497
+ * @public
498
+ */
499
+ declare interface ShDblQuotedNode {
500
+ readonly type: 'DblQuoted';
501
+ readonly range: readonly [number, number];
502
+ readonly loc: {
503
+ readonly start: { readonly line: number; readonly column: number };
504
+ readonly end: { readonly line: number; readonly column: number };
505
+ };
506
+ [field: string]: unknown;
507
+ readonly parts: readonly ShWordPartNode[];
508
+ }
509
+
510
+ /**
511
+ * mvdan/sh's `syntax.DeclClause`, normalized.
512
+ *
513
+ * @public
514
+ */
515
+ declare interface ShDeclClauseNode {
516
+ readonly type: 'DeclClause';
517
+ readonly range: readonly [number, number];
518
+ readonly loc: {
519
+ readonly start: { readonly line: number; readonly column: number };
520
+ readonly end: { readonly line: number; readonly column: number };
521
+ };
522
+ [field: string]: unknown;
523
+ readonly args: readonly ShAssignNode[];
524
+ readonly variant?: ShLitNode;
525
+ }
526
+
527
+ /**
528
+ * Shell dialect (mvdan/sh `LangVariant`) to parse against. Mapped to
529
+ * `LangVariant` by string name via `LangVariant.Set()` — never by numeric
530
+ * value, since the bit-flag encoding of `LangVariant` is not a stable
531
+ * contract across mvdan/sh versions. See design/ARCHITECTURE.md, "Parse
532
+ * errors and dialects".
533
+ *
534
+ * @public
535
+ */
536
+ export declare type ShellDialect = 'bash' | 'posix' | 'mksh' | 'bats' | 'zsh';
537
+
538
+ /**
539
+ * mvdan/sh's `syntax.Expansion`, normalized.
540
+ *
541
+ * @public
542
+ */
543
+ declare interface ShExpansionNode {
544
+ readonly type: 'Expansion';
545
+ readonly range: readonly [number, number];
546
+ readonly loc: {
547
+ readonly start: { readonly line: number; readonly column: number };
548
+ readonly end: { readonly line: number; readonly column: number };
549
+ };
550
+ [field: string]: unknown;
551
+ readonly word?: ShWordNode;
552
+ }
553
+
554
+ /**
555
+ * mvdan/sh's `syntax.ExtGlob`, normalized.
556
+ *
557
+ * @public
558
+ */
559
+ declare interface ShExtGlobNode {
560
+ readonly type: 'ExtGlob';
561
+ readonly range: readonly [number, number];
562
+ readonly loc: {
563
+ readonly start: { readonly line: number; readonly column: number };
564
+ readonly end: { readonly line: number; readonly column: number };
565
+ };
566
+ [field: string]: unknown;
567
+ readonly pattern?: ShLitNode;
568
+ }
569
+
570
+ /**
571
+ * The root node of a parsed shell script.
572
+ *
573
+ * @public
574
+ */
575
+ export declare interface ShFile extends ShNode {
576
+ readonly type: 'File';
577
+ readonly stmts: readonly ShNode[];
578
+ }
579
+
580
+ /**
581
+ * mvdan/sh's `syntax.File`, normalized.
582
+ *
583
+ * @public
584
+ */
585
+ declare interface ShFileNode {
586
+ readonly type: 'File';
587
+ readonly range: readonly [number, number];
588
+ readonly loc: {
589
+ readonly start: { readonly line: number; readonly column: number };
590
+ readonly end: { readonly line: number; readonly column: number };
591
+ };
592
+ [field: string]: unknown;
593
+ readonly last: readonly ShCommentNode[];
594
+ readonly stmts: readonly ShStmtNode[];
595
+ }
596
+
597
+ /**
598
+ * mvdan/sh's `syntax.FlagsArithm`, normalized.
599
+ *
600
+ * @public
601
+ */
602
+ declare interface ShFlagsArithmNode {
603
+ readonly type: 'FlagsArithm';
604
+ readonly range: readonly [number, number];
605
+ readonly loc: {
606
+ readonly start: { readonly line: number; readonly column: number };
607
+ readonly end: { readonly line: number; readonly column: number };
608
+ };
609
+ [field: string]: unknown;
610
+ readonly flags?: ShLitNode;
611
+ readonly x?: ShArithmExprNode;
612
+ }
613
+
614
+ /**
615
+ * mvdan/sh's `syntax.ForClause`, normalized.
616
+ *
617
+ * @public
618
+ */
619
+ declare interface ShForClauseNode {
620
+ readonly type: 'ForClause';
621
+ readonly range: readonly [number, number];
622
+ readonly loc: {
623
+ readonly start: { readonly line: number; readonly column: number };
624
+ readonly end: { readonly line: number; readonly column: number };
625
+ };
626
+ [field: string]: unknown;
627
+ readonly do: readonly ShStmtNode[];
628
+ readonly dolast: readonly ShCommentNode[];
629
+ readonly loop?: ShLoopNode;
630
+ }
631
+
632
+ /**
633
+ * mvdan/sh's `syntax.FuncDecl`, normalized.
634
+ *
635
+ * @public
636
+ */
637
+ declare interface ShFuncDeclNode {
638
+ readonly type: 'FuncDecl';
639
+ readonly range: readonly [number, number];
640
+ readonly loc: {
641
+ readonly start: { readonly line: number; readonly column: number };
642
+ readonly end: { readonly line: number; readonly column: number };
643
+ };
644
+ [field: string]: unknown;
645
+ readonly body?: ShStmtNode;
646
+ readonly name?: ShLitNode;
647
+ readonly names: readonly ShLitNode[];
648
+ }
649
+
650
+ /**
651
+ * mvdan/sh's `syntax.IfClause`, normalized.
652
+ *
653
+ * @public
654
+ */
655
+ declare interface ShIfClauseNode {
656
+ readonly type: 'IfClause';
657
+ readonly range: readonly [number, number];
658
+ readonly loc: {
659
+ readonly start: { readonly line: number; readonly column: number };
660
+ readonly end: { readonly line: number; readonly column: number };
661
+ };
662
+ [field: string]: unknown;
663
+ readonly cond: readonly ShStmtNode[];
664
+ readonly condlast: readonly ShCommentNode[];
665
+ readonly else?: ShIfClauseNode;
666
+ readonly last: readonly ShCommentNode[];
667
+ readonly then: readonly ShStmtNode[];
668
+ readonly thenlast: readonly ShCommentNode[];
669
+ }
670
+
671
+ /**
672
+ * Thrown by {@link parseSync} when {@link ParseOptions.dialect} is not one
673
+ * of the supported {@link ShellDialect} values. Carries the rejected value
674
+ * as `.dialect`; `.message` lists the supported dialects. A foreseeable,
675
+ * actionable user mistake — never an instance of {@link ShParseError}.
676
+ *
677
+ * @public
678
+ */
679
+ export declare class ShInvalidDialectError extends ShBridgeError {
680
+ readonly code = "ESLINT_SH_INVALID_DIALECT";
681
+ /** The rejected dialect value, exactly as passed to {@link parseSync}. */
682
+ readonly dialect: string;
683
+ constructor(dialect: string, supportedDialects: readonly ShellDialect[]);
684
+ }
685
+
686
+ /**
687
+ * mvdan/sh's `syntax.LetClause`, normalized.
688
+ *
689
+ * @public
690
+ */
691
+ declare interface ShLetClauseNode {
692
+ readonly type: 'LetClause';
693
+ readonly range: readonly [number, number];
694
+ readonly loc: {
695
+ readonly start: { readonly line: number; readonly column: number };
696
+ readonly end: { readonly line: number; readonly column: number };
697
+ };
698
+ [field: string]: unknown;
699
+ readonly exprs: readonly ShArithmExprNode[];
700
+ }
701
+
702
+ /**
703
+ * mvdan/sh's `syntax.Lit`, normalized.
704
+ *
705
+ * @public
706
+ */
707
+ declare interface ShLitNode {
708
+ readonly type: 'Lit';
709
+ readonly range: readonly [number, number];
710
+ readonly loc: {
711
+ readonly start: { readonly line: number; readonly column: number };
712
+ readonly end: { readonly line: number; readonly column: number };
713
+ };
714
+ [field: string]: unknown;
715
+ }
716
+
717
+ /**
718
+ * The union of concrete node types mvdan/sh's `syntax.Loop` interface can
719
+ * hold.
720
+ *
721
+ * @public
722
+ */
723
+ declare type ShLoopNode = ShCStyleLoopNode | ShWordIterNode;
724
+
725
+ /**
726
+ * A normalized AST node produced by {@link parseSync}.
727
+ *
728
+ * `range` and `loc` are expressed in UTF-16 code units, so
729
+ * `code.slice(node.range[0], node.range[1])` reproduces the node's exact
730
+ * source text — even though mvdan/sh itself reports byte offsets and
731
+ * byte-counting columns internally (see design/ARCHITECTURE.md's
732
+ * "Serialization contract"). Every other field copied over from mvdan/sh's
733
+ * typedjson tree keeps its original value but with the field name
734
+ * lowercased (`Stmts` becomes `stmts`, `CondLast` becomes `condlast`, etc.).
735
+ *
736
+ * @public
737
+ */
738
+ export declare interface ShNode {
739
+ readonly type: string;
740
+ readonly range: readonly [number, number];
741
+ readonly loc: {
742
+ readonly start: Position;
743
+ readonly end: Position;
744
+ };
745
+ [field: string]: unknown;
746
+ }
747
+
748
+ export declare namespace ShNodes {
749
+ export {
750
+ ShArithmCmdNode,
751
+ ShArithmExpNode,
752
+ ShArrayElemNode,
753
+ ShArrayExprNode,
754
+ ShAssignNode,
755
+ ShBinaryArithmNode,
756
+ ShBinaryCmdNode,
757
+ ShBinaryTestNode,
758
+ ShBlockNode,
759
+ ShBraceExpNode,
760
+ ShCStyleLoopNode,
761
+ ShCallExprNode,
762
+ ShCaseClauseNode,
763
+ ShCaseItemNode,
764
+ ShCmdSubstNode,
765
+ ShCommentNode,
766
+ ShCoprocClauseNode,
767
+ ShDblQuotedNode,
768
+ ShDeclClauseNode,
769
+ ShExpansionNode,
770
+ ShExtGlobNode,
771
+ ShFileNode,
772
+ ShFlagsArithmNode,
773
+ ShForClauseNode,
774
+ ShFuncDeclNode,
775
+ ShIfClauseNode,
776
+ ShLetClauseNode,
777
+ ShLitNode,
778
+ ShParamExpNode,
779
+ ShParenArithmNode,
780
+ ShParenTestNode,
781
+ ShProcSubstNode,
782
+ ShRedirectNode,
783
+ ShReplaceNode,
784
+ ShSglQuotedNode,
785
+ ShSliceNode,
786
+ ShStmtNode,
787
+ ShSubshellNode,
788
+ ShTestClauseNode,
789
+ ShTestDeclNode,
790
+ ShTimeClauseNode,
791
+ ShUnaryArithmNode,
792
+ ShUnaryTestNode,
793
+ ShWhileClauseNode,
794
+ ShWordNode,
795
+ ShWordIterNode,
796
+ ShArithmExprNode,
797
+ ShCommandNode,
798
+ ShLoopNode,
799
+ ShTestExprNode,
800
+ ShWordPartNode,
801
+ ShAnyNode,
802
+ ShNodeTypeName
803
+ }
804
+ }
805
+
806
+ /**
807
+ * Every normalized node `type` string this bridge can produce.
808
+ *
809
+ * @public
810
+ */
811
+ declare type ShNodeTypeName =
812
+ | 'ArithmCmd'
813
+ | 'ArithmExp'
814
+ | 'ArrayElem'
815
+ | 'ArrayExpr'
816
+ | 'Assign'
817
+ | 'BinaryArithm'
818
+ | 'BinaryCmd'
819
+ | 'BinaryTest'
820
+ | 'Block'
821
+ | 'BraceExp'
822
+ | 'CStyleLoop'
823
+ | 'CallExpr'
824
+ | 'CaseClause'
825
+ | 'CaseItem'
826
+ | 'CmdSubst'
827
+ | 'Comment'
828
+ | 'CoprocClause'
829
+ | 'DblQuoted'
830
+ | 'DeclClause'
831
+ | 'Expansion'
832
+ | 'ExtGlob'
833
+ | 'File'
834
+ | 'FlagsArithm'
835
+ | 'ForClause'
836
+ | 'FuncDecl'
837
+ | 'IfClause'
838
+ | 'LetClause'
839
+ | 'Lit'
840
+ | 'ParamExp'
841
+ | 'ParenArithm'
842
+ | 'ParenTest'
843
+ | 'ProcSubst'
844
+ | 'Redirect'
845
+ | 'Replace'
846
+ | 'SglQuoted'
847
+ | 'Slice'
848
+ | 'Stmt'
849
+ | 'Subshell'
850
+ | 'TestClause'
851
+ | 'TestDecl'
852
+ | 'TimeClause'
853
+ | 'UnaryArithm'
854
+ | 'UnaryTest'
855
+ | 'WhileClause'
856
+ | 'Word'
857
+ | 'WordIter';
858
+
859
+ /**
860
+ * mvdan/sh's `syntax.ParamExp`, normalized.
861
+ *
862
+ * @public
863
+ */
864
+ declare interface ShParamExpNode {
865
+ readonly type: 'ParamExp';
866
+ readonly range: readonly [number, number];
867
+ readonly loc: {
868
+ readonly start: { readonly line: number; readonly column: number };
869
+ readonly end: { readonly line: number; readonly column: number };
870
+ };
871
+ [field: string]: unknown;
872
+ readonly exp?: ShExpansionNode;
873
+ readonly flags?: ShLitNode;
874
+ readonly index?: ShArithmExprNode;
875
+ readonly modifiers: readonly ShLitNode[];
876
+ readonly nestedparam?: ShWordPartNode;
877
+ readonly param?: ShLitNode;
878
+ readonly repl?: ShReplaceNode;
879
+ readonly slice?: ShSliceNode;
880
+ }
881
+
882
+ /**
883
+ * mvdan/sh's `syntax.ParenArithm`, normalized.
884
+ *
885
+ * @public
886
+ */
887
+ declare interface ShParenArithmNode {
888
+ readonly type: 'ParenArithm';
889
+ readonly range: readonly [number, number];
890
+ readonly loc: {
891
+ readonly start: { readonly line: number; readonly column: number };
892
+ readonly end: { readonly line: number; readonly column: number };
893
+ };
894
+ [field: string]: unknown;
895
+ readonly x?: ShArithmExprNode;
896
+ }
897
+
898
+ /**
899
+ * mvdan/sh's `syntax.ParenTest`, normalized.
900
+ *
901
+ * @public
902
+ */
903
+ declare interface ShParenTestNode {
904
+ readonly type: 'ParenTest';
905
+ readonly range: readonly [number, number];
906
+ readonly loc: {
907
+ readonly start: { readonly line: number; readonly column: number };
908
+ readonly end: { readonly line: number; readonly column: number };
909
+ };
910
+ [field: string]: unknown;
911
+ readonly x?: ShTestExprNode;
912
+ }
913
+
914
+ /**
915
+ * Thrown by {@link parseSync} when shell source fails to parse. Carries the
916
+ * real position mvdan/sh reported — never 1:1 placeholders: `.line` is
917
+ * 1-based exactly as mvdan/sh reports it, and `.column` is converted to
918
+ * UTF-16 code units so it agrees with {@link ShNode.loc}'s columns (mvdan/sh
919
+ * itself reports `column` as a byte count on the source line — see
920
+ * {@link ShParseErrorInfo.column}). The unconverted, raw byte-column
921
+ * position appears only inside `.message`, mvdan/sh's own formatted string,
922
+ * verbatim.
923
+ *
924
+ * @public
925
+ */
926
+ export declare class ShParseError extends ShBridgeError {
927
+ readonly code = "ESLINT_SH_PARSE_ERROR";
928
+ readonly line: number;
929
+ readonly column: number;
930
+ readonly filename: string;
931
+ constructor(message: string, info: ShParseErrorInfo);
932
+ }
933
+
934
+ /**
935
+ * Position info attached to a {@link ShParseError}.
936
+ *
937
+ * @public
938
+ */
939
+ export declare interface ShParseErrorInfo {
940
+ /** 1-based line number, exactly as reported by mvdan/sh. */
941
+ line: number;
942
+ /**
943
+ * 1-based column number, in **UTF-16 code units** — converted from
944
+ * mvdan/sh's own byte-counting column so it agrees with
945
+ * {@link ShNode.loc}'s columns (mvdan/sh reports `column` as a byte count
946
+ * on the source line, not a UTF-16 code unit count; see
947
+ * design/ARCHITECTURE.md's "Byte→UTF-16 conversion"). For ASCII-only
948
+ * source text this is numerically identical to mvdan/sh's own column.
949
+ */
950
+ column: number;
951
+ /** The filename used for the parse (see {@link ParseOptions.filename}). */
952
+ filename: string;
953
+ }
954
+
955
+ /**
956
+ * mvdan/sh's `syntax.ProcSubst`, normalized.
957
+ *
958
+ * @public
959
+ */
960
+ declare interface ShProcSubstNode {
961
+ readonly type: 'ProcSubst';
962
+ readonly range: readonly [number, number];
963
+ readonly loc: {
964
+ readonly start: { readonly line: number; readonly column: number };
965
+ readonly end: { readonly line: number; readonly column: number };
966
+ };
967
+ [field: string]: unknown;
968
+ readonly last: readonly ShCommentNode[];
969
+ readonly stmts: readonly ShStmtNode[];
970
+ }
971
+
972
+ /**
973
+ * mvdan/sh's `syntax.Redirect`, normalized.
974
+ *
975
+ * @public
976
+ */
977
+ declare interface ShRedirectNode {
978
+ readonly type: 'Redirect';
979
+ readonly range: readonly [number, number];
980
+ readonly loc: {
981
+ readonly start: { readonly line: number; readonly column: number };
982
+ readonly end: { readonly line: number; readonly column: number };
983
+ };
984
+ [field: string]: unknown;
985
+ readonly hdoc?: ShWordNode;
986
+ readonly n?: ShLitNode;
987
+ readonly word?: ShWordNode;
988
+ }
989
+
990
+ /**
991
+ * mvdan/sh's `syntax.Replace`, normalized.
992
+ *
993
+ * @public
994
+ */
995
+ declare interface ShReplaceNode {
996
+ readonly type: 'Replace';
997
+ readonly range: readonly [number, number];
998
+ readonly loc: {
999
+ readonly start: { readonly line: number; readonly column: number };
1000
+ readonly end: { readonly line: number; readonly column: number };
1001
+ };
1002
+ [field: string]: unknown;
1003
+ readonly orig?: ShWordNode;
1004
+ readonly with?: ShWordNode;
1005
+ }
1006
+
1007
+ /**
1008
+ * mvdan/sh's `syntax.SglQuoted`, normalized.
1009
+ *
1010
+ * @public
1011
+ */
1012
+ declare interface ShSglQuotedNode {
1013
+ readonly type: 'SglQuoted';
1014
+ readonly range: readonly [number, number];
1015
+ readonly loc: {
1016
+ readonly start: { readonly line: number; readonly column: number };
1017
+ readonly end: { readonly line: number; readonly column: number };
1018
+ };
1019
+ [field: string]: unknown;
1020
+ }
1021
+
1022
+ /**
1023
+ * mvdan/sh's `syntax.Slice`, normalized.
1024
+ *
1025
+ * @public
1026
+ */
1027
+ declare interface ShSliceNode {
1028
+ readonly type: 'Slice';
1029
+ readonly range: readonly [number, number];
1030
+ readonly loc: {
1031
+ readonly start: { readonly line: number; readonly column: number };
1032
+ readonly end: { readonly line: number; readonly column: number };
1033
+ };
1034
+ [field: string]: unknown;
1035
+ readonly length?: ShArithmExprNode;
1036
+ readonly offset?: ShArithmExprNode;
1037
+ }
1038
+
1039
+ /**
1040
+ * mvdan/sh's `syntax.Stmt`, normalized.
1041
+ *
1042
+ * @public
1043
+ */
1044
+ declare interface ShStmtNode {
1045
+ readonly type: 'Stmt';
1046
+ readonly range: readonly [number, number];
1047
+ readonly loc: {
1048
+ readonly start: { readonly line: number; readonly column: number };
1049
+ readonly end: { readonly line: number; readonly column: number };
1050
+ };
1051
+ [field: string]: unknown;
1052
+ readonly cmd?: ShCommandNode;
1053
+ readonly comments: readonly ShCommentNode[];
1054
+ readonly redirs: readonly ShRedirectNode[];
1055
+ }
1056
+
1057
+ /**
1058
+ * mvdan/sh's `syntax.Subshell`, normalized.
1059
+ *
1060
+ * @public
1061
+ */
1062
+ declare interface ShSubshellNode {
1063
+ readonly type: 'Subshell';
1064
+ readonly range: readonly [number, number];
1065
+ readonly loc: {
1066
+ readonly start: { readonly line: number; readonly column: number };
1067
+ readonly end: { readonly line: number; readonly column: number };
1068
+ };
1069
+ [field: string]: unknown;
1070
+ readonly last: readonly ShCommentNode[];
1071
+ readonly stmts: readonly ShStmtNode[];
1072
+ }
1073
+
1074
+ /**
1075
+ * mvdan/sh's `syntax.TestClause`, normalized.
1076
+ *
1077
+ * @public
1078
+ */
1079
+ declare interface ShTestClauseNode {
1080
+ readonly type: 'TestClause';
1081
+ readonly range: readonly [number, number];
1082
+ readonly loc: {
1083
+ readonly start: { readonly line: number; readonly column: number };
1084
+ readonly end: { readonly line: number; readonly column: number };
1085
+ };
1086
+ [field: string]: unknown;
1087
+ readonly x?: ShTestExprNode;
1088
+ }
1089
+
1090
+ /**
1091
+ * mvdan/sh's `syntax.TestDecl`, normalized.
1092
+ *
1093
+ * @public
1094
+ */
1095
+ declare interface ShTestDeclNode {
1096
+ readonly type: 'TestDecl';
1097
+ readonly range: readonly [number, number];
1098
+ readonly loc: {
1099
+ readonly start: { readonly line: number; readonly column: number };
1100
+ readonly end: { readonly line: number; readonly column: number };
1101
+ };
1102
+ [field: string]: unknown;
1103
+ readonly body?: ShStmtNode;
1104
+ readonly description?: ShWordNode;
1105
+ }
1106
+
1107
+ /**
1108
+ * The union of concrete node types mvdan/sh's `syntax.TestExpr` interface can
1109
+ * hold.
1110
+ *
1111
+ * @public
1112
+ */
1113
+ declare type ShTestExprNode = ShBinaryTestNode | ShParenTestNode | ShUnaryTestNode | ShWordNode;
1114
+
1115
+ /**
1116
+ * mvdan/sh's `syntax.TimeClause`, normalized.
1117
+ *
1118
+ * @public
1119
+ */
1120
+ declare interface ShTimeClauseNode {
1121
+ readonly type: 'TimeClause';
1122
+ readonly range: readonly [number, number];
1123
+ readonly loc: {
1124
+ readonly start: { readonly line: number; readonly column: number };
1125
+ readonly end: { readonly line: number; readonly column: number };
1126
+ };
1127
+ [field: string]: unknown;
1128
+ readonly stmt?: ShStmtNode;
1129
+ }
1130
+
1131
+ /**
1132
+ * mvdan/sh's `syntax.UnaryArithm`, normalized.
1133
+ *
1134
+ * @public
1135
+ */
1136
+ declare interface ShUnaryArithmNode {
1137
+ readonly type: 'UnaryArithm';
1138
+ readonly range: readonly [number, number];
1139
+ readonly loc: {
1140
+ readonly start: { readonly line: number; readonly column: number };
1141
+ readonly end: { readonly line: number; readonly column: number };
1142
+ };
1143
+ [field: string]: unknown;
1144
+ readonly x?: ShArithmExprNode;
1145
+ }
1146
+
1147
+ /**
1148
+ * mvdan/sh's `syntax.UnaryTest`, normalized.
1149
+ *
1150
+ * @public
1151
+ */
1152
+ declare interface ShUnaryTestNode {
1153
+ readonly type: 'UnaryTest';
1154
+ readonly range: readonly [number, number];
1155
+ readonly loc: {
1156
+ readonly start: { readonly line: number; readonly column: number };
1157
+ readonly end: { readonly line: number; readonly column: number };
1158
+ };
1159
+ [field: string]: unknown;
1160
+ readonly x?: ShTestExprNode;
1161
+ }
1162
+
1163
+ /**
1164
+ * mvdan/sh's `syntax.WhileClause`, normalized.
1165
+ *
1166
+ * @public
1167
+ */
1168
+ declare interface ShWhileClauseNode {
1169
+ readonly type: 'WhileClause';
1170
+ readonly range: readonly [number, number];
1171
+ readonly loc: {
1172
+ readonly start: { readonly line: number; readonly column: number };
1173
+ readonly end: { readonly line: number; readonly column: number };
1174
+ };
1175
+ [field: string]: unknown;
1176
+ readonly cond: readonly ShStmtNode[];
1177
+ readonly condlast: readonly ShCommentNode[];
1178
+ readonly do: readonly ShStmtNode[];
1179
+ readonly dolast: readonly ShCommentNode[];
1180
+ }
1181
+
1182
+ /**
1183
+ * mvdan/sh's `syntax.WordIter`, normalized.
1184
+ *
1185
+ * @public
1186
+ */
1187
+ declare interface ShWordIterNode {
1188
+ readonly type: 'WordIter';
1189
+ readonly range: readonly [number, number];
1190
+ readonly loc: {
1191
+ readonly start: { readonly line: number; readonly column: number };
1192
+ readonly end: { readonly line: number; readonly column: number };
1193
+ };
1194
+ [field: string]: unknown;
1195
+ readonly items: readonly ShWordNode[];
1196
+ readonly name?: ShLitNode;
1197
+ }
1198
+
1199
+ /**
1200
+ * mvdan/sh's `syntax.Word`, normalized.
1201
+ *
1202
+ * @public
1203
+ */
1204
+ declare interface ShWordNode {
1205
+ readonly type: 'Word';
1206
+ readonly range: readonly [number, number];
1207
+ readonly loc: {
1208
+ readonly start: { readonly line: number; readonly column: number };
1209
+ readonly end: { readonly line: number; readonly column: number };
1210
+ };
1211
+ [field: string]: unknown;
1212
+ readonly parts: readonly ShWordPartNode[];
1213
+ }
1214
+
1215
+ /**
1216
+ * The union of concrete node types mvdan/sh's `syntax.WordPart` interface can
1217
+ * hold.
1218
+ *
1219
+ * @public
1220
+ */
1221
+ declare type ShWordPartNode =
1222
+ | ShArithmExpNode
1223
+ | ShBraceExpNode
1224
+ | ShCmdSubstNode
1225
+ | ShDblQuotedNode
1226
+ | ShExtGlobNode
1227
+ | ShLitNode
1228
+ | ShParamExpNode
1229
+ | ShProcSubstNode
1230
+ | ShSglQuotedNode;
1231
+
1232
+ /**
1233
+ * Maps each normalized node `type` to the field names (lowercased, matching
1234
+ * the normalized node shape produced by `normalize`) whose values hold child
1235
+ * nodes.
1236
+ *
1237
+ * Generated from mvdan/sh's `syntax` package struct definitions by
1238
+ * `tools/gen-visitor-keys` (see design/ARCHITECTURE.md, "The schema table is
1239
+ * generated, not hand-written") — this module only re-exports the generated
1240
+ * table under the public name, frozen. {@link walk} does not depend on this
1241
+ * table for correctness — it discovers children structurally — so any gap
1242
+ * here (there shouldn't be one; the kitchen-sink golden test guards it)
1243
+ * affects only external consumers that choose to traverse via this table.
1244
+ *
1245
+ * Frozen (including each per-type field-name array) so immutability of this
1246
+ * shared, module-scoped table is a contract, not just a convention any
1247
+ * importer happens to honor.
1248
+ *
1249
+ * @public
1250
+ */
1251
+ export declare const visitorKeys: Readonly<Record<string, readonly string[]>>;
1252
+
1253
+ /**
1254
+ * Visits every node in a normalized tree, pre-order (parent before
1255
+ * children), starting at `node`.
1256
+ *
1257
+ * Children are discovered structurally: any field on a visited node whose
1258
+ * value is itself a normalized node (or an array of normalized nodes) is
1259
+ * treated as a child. This is deliberately not driven off {@link
1260
+ * visitorKeys} — the spike's hand-written visitor-keys table missed
1261
+ * `DeclClause.Variant` (see design/ARCHITECTURE.md) and silently
1262
+ * under-walked the tree, and `visitorKeys` remains hand-maintained pending a
1263
+ * schema generator (tracked separately). Walking structurally means this
1264
+ * function's completeness never depends on that table's accuracy.
1265
+ *
1266
+ * @public
1267
+ */
1268
+ export declare function walk(node: ShNode, visit: (node: ShNode, parent: ShNode | null) => void): void;
1269
+
1270
+ export { }