sh-ast 0.3.1 → 0.4.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 (84) hide show
  1. package/README.md +116 -144
  2. package/dist/analyze/ansi-c-escapes.d.ts +1 -1
  3. package/dist/analyze/ansi-c-escapes.js +1 -1
  4. package/dist/analyze/enumerate-commands.d.ts +11 -16
  5. package/dist/analyze/enumerate-commands.d.ts.map +1 -1
  6. package/dist/analyze/enumerate-commands.js +82 -92
  7. package/dist/analyze/enumerate-commands.js.map +1 -1
  8. package/dist/analyze/index.d.ts +3 -2
  9. package/dist/analyze/index.d.ts.map +1 -1
  10. package/dist/analyze/index.js +1 -1
  11. package/dist/analyze/node-helpers.d.ts +10 -21
  12. package/dist/analyze/node-helpers.d.ts.map +1 -1
  13. package/dist/analyze/node-helpers.js +16 -27
  14. package/dist/analyze/node-helpers.js.map +1 -1
  15. package/dist/analyze/resolve-argv0.d.ts +6 -6
  16. package/dist/analyze/resolve-argv0.js +6 -6
  17. package/dist/analyze/resolve-word.d.ts +7 -10
  18. package/dist/analyze/resolve-word.d.ts.map +1 -1
  19. package/dist/analyze/resolve-word.js +39 -22
  20. package/dist/analyze/resolve-word.js.map +1 -1
  21. package/dist/analyze.d.ts +3780 -397
  22. package/dist/errors.d.ts +6 -79
  23. package/dist/errors.d.ts.map +1 -1
  24. package/dist/errors.js +5 -64
  25. package/dist/errors.js.map +1 -1
  26. package/dist/index.d.ts +16 -14
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +23 -4
  29. package/dist/index.js.map +1 -1
  30. package/dist/sh-ast.d.ts +3503 -1027
  31. package/dist/syntax-errors.d.ts +56 -0
  32. package/dist/syntax-errors.d.ts.map +1 -0
  33. package/dist/syntax-errors.js +80 -0
  34. package/dist/syntax-errors.js.map +1 -0
  35. package/dist/syntax-snapshot.d.ts +47 -0
  36. package/dist/syntax-snapshot.d.ts.map +1 -0
  37. package/dist/syntax-snapshot.js +121 -0
  38. package/dist/syntax-snapshot.js.map +1 -0
  39. package/dist/syntax-wire.d.ts +31 -0
  40. package/dist/syntax-wire.d.ts.map +1 -0
  41. package/dist/syntax-wire.js +202 -0
  42. package/dist/syntax-wire.js.map +1 -0
  43. package/dist/syntax.d.ts +65 -0
  44. package/dist/syntax.d.ts.map +1 -0
  45. package/dist/syntax.js +152 -0
  46. package/dist/syntax.js.map +1 -0
  47. package/dist/wasm-instance.d.ts +5 -8
  48. package/dist/wasm-instance.d.ts.map +1 -1
  49. package/dist/wasm-instance.js +44 -47
  50. package/dist/wasm-instance.js.map +1 -1
  51. package/generated/syntax-constants.d.ts +1652 -0
  52. package/generated/syntax-constants.js +1384 -0
  53. package/generated/syntax-schema.d.ts +60 -0
  54. package/generated/syntax-schema.js +1740 -0
  55. package/generated/syntax-types.d.ts +1977 -0
  56. package/package.json +2 -2
  57. package/shim/sh-ast.wasm +0 -0
  58. package/dist/normalize.d.ts +0 -52
  59. package/dist/normalize.d.ts.map +0 -1
  60. package/dist/normalize.js +0 -260
  61. package/dist/normalize.js.map +0 -1
  62. package/dist/parse.d.ts +0 -50
  63. package/dist/parse.d.ts.map +0 -1
  64. package/dist/parse.js +0 -125
  65. package/dist/parse.js.map +0 -1
  66. package/dist/types.d.ts +0 -74
  67. package/dist/types.d.ts.map +0 -1
  68. package/dist/types.js +0 -2
  69. package/dist/types.js.map +0 -1
  70. package/dist/visitor-keys.d.ts +0 -21
  71. package/dist/visitor-keys.d.ts.map +0 -1
  72. package/dist/visitor-keys.js +0 -23
  73. package/dist/visitor-keys.js.map +0 -1
  74. package/dist/walk.d.ts +0 -18
  75. package/dist/walk.d.ts.map +0 -1
  76. package/dist/walk.js +0 -40
  77. package/dist/walk.js.map +0 -1
  78. package/generated/child-type-schema.d.ts +0 -14
  79. package/generated/child-type-schema.js +0 -188
  80. package/generated/node-types.d.ts +0 -1002
  81. package/generated/position-fields.d.ts +0 -21
  82. package/generated/position-fields.js +0 -50
  83. package/generated/visitor-keys.d.ts +0 -11
  84. package/generated/visitor-keys.js +0 -50
package/dist/errors.d.ts CHANGED
@@ -1,92 +1,19 @@
1
- import type { ShellDialect } from './types.js';
1
+ /** Shared failure classes for binding invariants, resource limits, and analysis contracts. */
2
2
  /**
3
- * Common base class for every error this package throws — originally just
4
- * {@link sh-ast#parseSync | parseSync}'s errors, now also the
5
- * `sh-ast/analyze` layer's (see {@link ShAnalyzeMaxDepthError},
6
- * {@link ShAnalyzeInvalidWrapperSpecError}). Provides a stable, documented
7
- * `code` discriminator (e.g. `"SH_AST_PARSE_ERROR"`) alongside the usual
8
- * `instanceof` narrowing, so consumers can branch on failure kind
9
- * programmatically without parsing `.message` strings. Never thrown directly
10
- * — only via its concrete subclasses
11
- * ({@link sh-ast#ShParseError | ShParseError},
12
- * {@link sh-ast#ShInvalidDialectError | ShInvalidDialectError},
13
- * {@link sh-ast#ShInternalError | ShInternalError},
14
- * {@link ShAnalyzeMaxDepthError},
15
- * {@link sh-ast#ShParseMaxDepthError | ShParseMaxDepthError},
16
- * {@link ShAnalyzeInvalidWrapperSpecError}).
17
- *
18
- * Re-exported from `sh-ast/analyze` as well as the root `sh-ast` entry
19
- * point (see #23) — every subclass thrown by `sh-ast/analyze`'s own
20
- * functions extends this, so a consumer of that subpath alone can
21
- * `catch`/reference the base without also importing from root.
22
- *
3
+ * Common base for every package failure, including upstream syntax errors and
4
+ * analysis errors. The stable code discriminator supports programmatic handling
5
+ * without interpreting display messages. Only concrete subclasses are thrown.
23
6
  * @public
24
7
  */
25
8
  export declare abstract class ShAstError extends Error {
26
- /**
27
- * Stable, machine-readable discriminator for this error kind. Distinct
28
- * per subclass and will not change once published.
29
- */
9
+ /** Stable machine-readable identity of the concrete failure kind. */
30
10
  abstract readonly code: string;
31
11
  }
32
- /**
33
- * Position info attached to a {@link ShParseError}.
34
- *
35
- * @public
36
- */
37
- export interface ShParseErrorInfo {
38
- /** 1-based line number, exactly as reported by mvdan/sh. */
39
- line: number;
40
- /**
41
- * 1-based column number, in **UTF-16 code units** — converted from
42
- * mvdan/sh's own byte-counting column so it agrees with
43
- * {@link ShNode.loc}'s columns (mvdan/sh reports `column` as a byte count
44
- * on the source line, not a UTF-16 code unit count; see
45
- * design/ARCHITECTURE.md's "Byte→UTF-16 conversion"). For ASCII-only
46
- * source text this is numerically identical to mvdan/sh's own column.
47
- */
48
- column: number;
49
- /** The filename used for the parse (see {@link ParseOptions.filename}). */
50
- filename: string;
51
- }
52
- /**
53
- * Thrown by {@link parseSync} when shell source fails to parse. Carries the
54
- * real position mvdan/sh reported — never 1:1 placeholders: `.line` is
55
- * 1-based exactly as mvdan/sh reports it, and `.column` is converted to
56
- * UTF-16 code units so it agrees with {@link ShNode.loc}'s columns (mvdan/sh
57
- * itself reports `column` as a byte count on the source line — see
58
- * {@link ShParseErrorInfo.column}). The unconverted, raw byte-column
59
- * position appears only inside `.message`, mvdan/sh's own formatted string,
60
- * verbatim.
61
- *
62
- * @public
63
- */
64
- export declare class ShParseError extends ShAstError {
65
- readonly code = "SH_AST_PARSE_ERROR";
66
- readonly line: number;
67
- readonly column: number;
68
- readonly filename: string;
69
- constructor(message: string, info: ShParseErrorInfo);
70
- }
71
- /**
72
- * Thrown by {@link parseSync} when {@link ParseOptions.dialect} is not one
73
- * of the supported {@link ShellDialect} values. Carries the rejected value
74
- * as `.dialect`; `.message` lists the supported dialects. A foreseeable,
75
- * actionable user mistake — never an instance of {@link ShParseError}.
76
- *
77
- * @public
78
- */
79
- export declare class ShInvalidDialectError extends ShAstError {
80
- readonly code = "SH_AST_INVALID_DIALECT";
81
- /** The rejected dialect value, exactly as passed to {@link parseSync}. */
82
- readonly dialect: string;
83
- constructor(dialect: string, supportedDialects: readonly ShellDialect[]);
84
- }
85
12
  /**
86
13
  * Thrown by {@link parseSync} for failures that should never happen given a
87
14
  * correctly-behaving WASM shim: a malformed result envelope, an unexpected
88
15
  * root node type, or any other shim contract violation. Distinct from
89
- * {@link ShInvalidDialectError} and {@link ShParseError}, both of which
16
+ * {@link InputError} and {@link ParseError}, both of which
90
17
  * indicate a foreseeable, actionable user mistake rather than an internal
91
18
  * defect.
92
19
  *
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8BAAsB,UAAW,SAAQ,KAAK;IAC5C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,UAAU;IAC1C,QAAQ,CAAC,IAAI,wBAAwB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB;CAOpD;AAED;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,UAAU;IACnD,QAAQ,CAAC,IAAI,4BAA4B;IACzC,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,SAAS,YAAY,EAAE;CAOxE;AAED;;;;;;;;;GASG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,QAAQ,CAAC,IAAI,qBAAqB;gBAEtB,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,sBAAuB,SAAQ,UAA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,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;gBAEpB,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CAQrD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,gCAAiC,SAAQ,UAAU;IAC9D,QAAQ,CAAC,IAAI,yCAAyC;gBAE1C,OAAO,EAAE,MAAM;CAI5B"}
package/dist/errors.js CHANGED
@@ -1,76 +1,17 @@
1
+ /** Shared failure classes for binding invariants, resource limits, and analysis contracts. */
1
2
  /**
2
- * Common base class for every error this package throws — originally just
3
- * {@link sh-ast#parseSync | parseSync}'s errors, now also the
4
- * `sh-ast/analyze` layer's (see {@link ShAnalyzeMaxDepthError},
5
- * {@link ShAnalyzeInvalidWrapperSpecError}). Provides a stable, documented
6
- * `code` discriminator (e.g. `"SH_AST_PARSE_ERROR"`) alongside the usual
7
- * `instanceof` narrowing, so consumers can branch on failure kind
8
- * programmatically without parsing `.message` strings. Never thrown directly
9
- * — only via its concrete subclasses
10
- * ({@link sh-ast#ShParseError | ShParseError},
11
- * {@link sh-ast#ShInvalidDialectError | ShInvalidDialectError},
12
- * {@link sh-ast#ShInternalError | ShInternalError},
13
- * {@link ShAnalyzeMaxDepthError},
14
- * {@link sh-ast#ShParseMaxDepthError | ShParseMaxDepthError},
15
- * {@link ShAnalyzeInvalidWrapperSpecError}).
16
- *
17
- * Re-exported from `sh-ast/analyze` as well as the root `sh-ast` entry
18
- * point (see #23) — every subclass thrown by `sh-ast/analyze`'s own
19
- * functions extends this, so a consumer of that subpath alone can
20
- * `catch`/reference the base without also importing from root.
21
- *
3
+ * Common base for every package failure, including upstream syntax errors and
4
+ * analysis errors. The stable code discriminator supports programmatic handling
5
+ * without interpreting display messages. Only concrete subclasses are thrown.
22
6
  * @public
23
7
  */
24
8
  export class ShAstError extends Error {
25
9
  }
26
- /**
27
- * Thrown by {@link parseSync} when shell source fails to parse. Carries the
28
- * real position mvdan/sh reported — never 1:1 placeholders: `.line` is
29
- * 1-based exactly as mvdan/sh reports it, and `.column` is converted to
30
- * UTF-16 code units so it agrees with {@link ShNode.loc}'s columns (mvdan/sh
31
- * itself reports `column` as a byte count on the source line — see
32
- * {@link ShParseErrorInfo.column}). The unconverted, raw byte-column
33
- * position appears only inside `.message`, mvdan/sh's own formatted string,
34
- * verbatim.
35
- *
36
- * @public
37
- */
38
- export class ShParseError extends ShAstError {
39
- code = 'SH_AST_PARSE_ERROR';
40
- line;
41
- column;
42
- filename;
43
- constructor(message, info) {
44
- super(message);
45
- this.name = 'ShParseError';
46
- this.line = info.line;
47
- this.column = info.column;
48
- this.filename = info.filename;
49
- }
50
- }
51
- /**
52
- * Thrown by {@link parseSync} when {@link ParseOptions.dialect} is not one
53
- * of the supported {@link ShellDialect} values. Carries the rejected value
54
- * as `.dialect`; `.message` lists the supported dialects. A foreseeable,
55
- * actionable user mistake — never an instance of {@link ShParseError}.
56
- *
57
- * @public
58
- */
59
- export class ShInvalidDialectError extends ShAstError {
60
- code = 'SH_AST_INVALID_DIALECT';
61
- /** The rejected dialect value, exactly as passed to {@link parseSync}. */
62
- dialect;
63
- constructor(dialect, supportedDialects) {
64
- super(`bridge: unrecognized shell dialect "${dialect}"; supported dialects are: ${supportedDialects.join(', ')}`);
65
- this.name = 'ShInvalidDialectError';
66
- this.dialect = dialect;
67
- }
68
- }
69
10
  /**
70
11
  * Thrown by {@link parseSync} for failures that should never happen given a
71
12
  * correctly-behaving WASM shim: a malformed result envelope, an unexpected
72
13
  * root node type, or any other shim contract violation. Distinct from
73
- * {@link ShInvalidDialectError} and {@link ShParseError}, both of which
14
+ * {@link InputError} and {@link ParseError}, both of which
74
15
  * indicate a foreseeable, actionable user mistake rather than an internal
75
16
  * defect.
76
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAgB,UAAW,SAAQ,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IAC3C,IAAI,GAAG,0BAA0B,CAAC;IAC3C,mHAAmH;IAC1G,QAAQ,CAAS;IAE1B,YAAY,QAAgB;QAC1B,KAAK,CACH,+EAA+E,MAAM,CAAC,QAAQ,CAAC,uGAAuG,CACvM,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IACzC,IAAI,GAAG,wBAAwB,CAAC;IACzC,qHAAqH;IAC5G,QAAQ,CAAS;IAC1B;;;;OAIG;IACM,cAAc,CAAS;IAEhC,YAAY,QAAgB,EAAE,cAAsB;QAClD,KAAK,CACH,0DAA0D,MAAM,CAAC,cAAc,CAAC,sDAAsD,MAAM,CAAC,QAAQ,CAAC,kKAAkK,CACzT,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,gCAAiC,SAAQ,UAAU;IACrD,IAAI,GAAG,qCAAqC,CAAC;IAEtD,YAAY,OAAe;QACzB,KAAK,CAAC,qDAAqD,OAAO,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;IACjD,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,18 +1,20 @@
1
- export { parseSync } from './parse.js';
2
- export { ShAnalyzeInvalidWrapperSpecError, ShAnalyzeMaxDepthError, ShAstError, ShInternalError, ShInvalidDialectError, ShParseError, ShParseMaxDepthError, } from './errors.js';
3
- export type { ShParseErrorInfo } from './errors.js';
4
- export type { ParseOptions, Position, ShellDialect, ShFile, ShNode } from './types.js';
5
- export { visitorKeys } from './visitor-keys.js';
6
- export { walk } from './walk.js';
1
+ export { InputError, LangError, ParseError, newPos, nodeEnd, nodePos, parseSync, parseWithPositionsSync, rawOperator, } from './syntax.js';
2
+ export type { ParseOptions, ParsedFile, PositionSnapshot, NodePositions } from './syntax.js';
3
+ export type * from '../generated/syntax-types.js';
4
+ export * from '../generated/syntax-constants.js';
5
+ export type { SyntaxFieldSchema, SyntaxRecordSchema } from '../generated/syntax-schema.js';
6
+ export { ShAnalyzeInvalidWrapperSpecError, ShAnalyzeMaxDepthError, ShAstError, ShInternalError, ShParseMaxDepthError, } from './errors.js';
7
7
  /**
8
- * Strongly-typed `ShNode` subtypes for every mvdan/sh node type — generated
9
- * by `tools/gen-visitor-keys` alongside {@link visitorKeys} (see
10
- * design/ARCHITECTURE.md, "The schema table is generated, not
11
- * hand-written"). {@link ShNode}'s index signature remains the base
12
- * contract; these are an additive, opt-in stronger typing for consumers
13
- * that want e.g. `ShNodes.ShCallExprNode` instead of a generic `ShNode`.
14
- *
8
+ * Complete upstream field metadata for validating or adapting syntax records.
9
+ * Metadata order is not the upstream Walk visitation order. Shared records are
10
+ * deeply frozen even though the syntax values they describe are mutable.
15
11
  * @public
16
12
  */
17
- export type * as ShNodes from '../generated/node-types.js';
13
+ export declare const SYNTAX_SCHEMA: Readonly<Readonly<Record<string, import("../generated/syntax-schema.js").SyntaxRecordSchema>>>;
14
+ /**
15
+ * Concrete alternatives for upstream syntax interfaces. Auxiliary records are
16
+ * absent from Node; consumers must preserve that distinction in their adapters.
17
+ * @public
18
+ */
19
+ export declare const SYNTAX_INTERFACES: Readonly<Readonly<Record<string, readonly string[]>>>;
18
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACL,gCAAgC,EAChC,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;GASG;AACH,YAAY,KAAK,OAAO,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,sBAAsB,EACtB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7F,mBAAmB,8BAA8B,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EACL,gCAAgC,EAChC,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,eAAO,MAAM,aAAa,gGAAqB,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,uDAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,24 @@
1
- export { parseSync } from './parse.js';
2
- export { ShAnalyzeInvalidWrapperSpecError, ShAnalyzeMaxDepthError, ShAstError, ShInternalError, ShInvalidDialectError, ShParseError, ShParseMaxDepthError, } from './errors.js';
3
- export { visitorKeys } from './visitor-keys.js';
4
- export { walk } from './walk.js';
1
+ /**
2
+ * A faithful synchronous interface to mvdan/sh syntax. The root exposes upstream
3
+ * records, constants, parser controls and position operations. Consumer-specific
4
+ * source views and semantic analysis are separate responsibilities.
5
+ */
6
+ import { SYNTAX_INTERFACES as interfaces, SYNTAX_SCHEMA as schema, } from '../generated/syntax-schema.js';
7
+ import { deepFreeze } from './deep-freeze.js';
8
+ export { InputError, LangError, ParseError, newPos, nodeEnd, nodePos, parseSync, parseWithPositionsSync, rawOperator, } from './syntax.js';
9
+ export * from '../generated/syntax-constants.js';
10
+ export { ShAnalyzeInvalidWrapperSpecError, ShAnalyzeMaxDepthError, ShAstError, ShInternalError, ShParseMaxDepthError, } from './errors.js';
11
+ /**
12
+ * Complete upstream field metadata for validating or adapting syntax records.
13
+ * Metadata order is not the upstream Walk visitation order. Shared records are
14
+ * deeply frozen even though the syntax values they describe are mutable.
15
+ * @public
16
+ */
17
+ export const SYNTAX_SCHEMA = deepFreeze(schema);
18
+ /**
19
+ * Concrete alternatives for upstream syntax interfaces. Auxiliary records are
20
+ * absent from Node; consumers must preserve that distinction in their adapters.
21
+ * @public
22
+ */
23
+ export const SYNTAX_INTERFACES = deepFreeze(interfaces);
5
24
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACL,gCAAgC,EAChC,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,iBAAiB,IAAI,UAAU,EAC/B,aAAa,IAAI,MAAM,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,sBAAsB,EACtB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,cAAc,kCAAkC,CAAC;AAEjD,OAAO,EACL,gCAAgC,EAChC,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC"}