@smeltjs/core 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 (199) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +55 -0
  3. package/THIRD-PARTY.md +140 -0
  4. package/dist/apply.d.ts +145 -0
  5. package/dist/apply.d.ts.map +1 -0
  6. package/dist/apply.js +244 -0
  7. package/dist/apply.js.map +1 -0
  8. package/dist/cache/prefix.d.ts +164 -0
  9. package/dist/cache/prefix.d.ts.map +1 -0
  10. package/dist/cache/prefix.js +361 -0
  11. package/dist/cache/prefix.js.map +1 -0
  12. package/dist/cli/args.d.ts +71 -0
  13. package/dist/cli/args.d.ts.map +1 -0
  14. package/dist/cli/args.js +308 -0
  15. package/dist/cli/args.js.map +1 -0
  16. package/dist/cli/bin.d.ts +3 -0
  17. package/dist/cli/bin.d.ts.map +1 -0
  18. package/dist/cli/bin.js +161 -0
  19. package/dist/cli/bin.js.map +1 -0
  20. package/dist/cli/config.d.ts +73 -0
  21. package/dist/cli/config.d.ts.map +1 -0
  22. package/dist/cli/config.js +144 -0
  23. package/dist/cli/config.js.map +1 -0
  24. package/dist/cli/init.d.ts +56 -0
  25. package/dist/cli/init.d.ts.map +1 -0
  26. package/dist/cli/init.js +449 -0
  27. package/dist/cli/init.js.map +1 -0
  28. package/dist/cli/report.d.ts +44 -0
  29. package/dist/cli/report.d.ts.map +1 -0
  30. package/dist/cli/report.js +113 -0
  31. package/dist/cli/report.js.map +1 -0
  32. package/dist/cli/resolve.d.ts +103 -0
  33. package/dist/cli/resolve.d.ts.map +1 -0
  34. package/dist/cli/resolve.js +106 -0
  35. package/dist/cli/resolve.js.map +1 -0
  36. package/dist/cli/run.d.ts +99 -0
  37. package/dist/cli/run.d.ts.map +1 -0
  38. package/dist/cli/run.js +351 -0
  39. package/dist/cli/run.js.map +1 -0
  40. package/dist/detect.d.ts +16 -0
  41. package/dist/detect.d.ts.map +1 -0
  42. package/dist/detect.js +18 -0
  43. package/dist/detect.js.map +1 -0
  44. package/dist/errors.d.ts +88 -0
  45. package/dist/errors.d.ts.map +1 -0
  46. package/dist/errors.js +107 -0
  47. package/dist/errors.js.map +1 -0
  48. package/dist/hash.d.ts +13 -0
  49. package/dist/hash.d.ts.map +1 -0
  50. package/dist/hash.js +16 -0
  51. package/dist/hash.js.map +1 -0
  52. package/dist/index.d.ts +121 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +93 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/lang/bash.d.ts +3 -0
  57. package/dist/lang/bash.d.ts.map +1 -0
  58. package/dist/lang/bash.js +28 -0
  59. package/dist/lang/bash.js.map +1 -0
  60. package/dist/lang/c.d.ts +3 -0
  61. package/dist/lang/c.d.ts.map +1 -0
  62. package/dist/lang/c.js +39 -0
  63. package/dist/lang/c.js.map +1 -0
  64. package/dist/lang/c_sharp.d.ts +3 -0
  65. package/dist/lang/c_sharp.d.ts.map +1 -0
  66. package/dist/lang/c_sharp.js +37 -0
  67. package/dist/lang/c_sharp.js.map +1 -0
  68. package/dist/lang/cpp.d.ts +3 -0
  69. package/dist/lang/cpp.d.ts.map +1 -0
  70. package/dist/lang/cpp.js +46 -0
  71. package/dist/lang/cpp.js.map +1 -0
  72. package/dist/lang/go.d.ts +3 -0
  73. package/dist/lang/go.d.ts.map +1 -0
  74. package/dist/lang/go.js +31 -0
  75. package/dist/lang/go.js.map +1 -0
  76. package/dist/lang/java.d.ts +3 -0
  77. package/dist/lang/java.d.ts.map +1 -0
  78. package/dist/lang/java.js +34 -0
  79. package/dist/lang/java.js.map +1 -0
  80. package/dist/lang/javascript.d.ts +3 -0
  81. package/dist/lang/javascript.d.ts.map +1 -0
  82. package/dist/lang/javascript.js +28 -0
  83. package/dist/lang/javascript.js.map +1 -0
  84. package/dist/lang/kotlin.d.ts +3 -0
  85. package/dist/lang/kotlin.d.ts.map +1 -0
  86. package/dist/lang/kotlin.js +37 -0
  87. package/dist/lang/kotlin.js.map +1 -0
  88. package/dist/lang/php.d.ts +3 -0
  89. package/dist/lang/php.d.ts.map +1 -0
  90. package/dist/lang/php.js +37 -0
  91. package/dist/lang/php.js.map +1 -0
  92. package/dist/lang/profile.d.ts +130 -0
  93. package/dist/lang/profile.d.ts.map +1 -0
  94. package/dist/lang/profile.js +2 -0
  95. package/dist/lang/profile.js.map +1 -0
  96. package/dist/lang/python.d.ts +3 -0
  97. package/dist/lang/python.d.ts.map +1 -0
  98. package/dist/lang/python.js +33 -0
  99. package/dist/lang/python.js.map +1 -0
  100. package/dist/lang/registry.d.ts +31 -0
  101. package/dist/lang/registry.d.ts.map +1 -0
  102. package/dist/lang/registry.js +89 -0
  103. package/dist/lang/registry.js.map +1 -0
  104. package/dist/lang/ruby.d.ts +3 -0
  105. package/dist/lang/ruby.d.ts.map +1 -0
  106. package/dist/lang/ruby.js +47 -0
  107. package/dist/lang/ruby.js.map +1 -0
  108. package/dist/lang/rust.d.ts +3 -0
  109. package/dist/lang/rust.d.ts.map +1 -0
  110. package/dist/lang/rust.js +45 -0
  111. package/dist/lang/rust.js.map +1 -0
  112. package/dist/lang/swift.d.ts +3 -0
  113. package/dist/lang/swift.d.ts.map +1 -0
  114. package/dist/lang/swift.js +34 -0
  115. package/dist/lang/swift.js.map +1 -0
  116. package/dist/lang/tsx.d.ts +4 -0
  117. package/dist/lang/tsx.d.ts.map +1 -0
  118. package/dist/lang/tsx.js +11 -0
  119. package/dist/lang/tsx.js.map +1 -0
  120. package/dist/lang/typescript.d.ts +18 -0
  121. package/dist/lang/typescript.d.ts.map +1 -0
  122. package/dist/lang/typescript.js +61 -0
  123. package/dist/lang/typescript.js.map +1 -0
  124. package/dist/net/policy.d.ts +49 -0
  125. package/dist/net/policy.d.ts.map +1 -0
  126. package/dist/net/policy.js +120 -0
  127. package/dist/net/policy.js.map +1 -0
  128. package/dist/plan/grammar.d.ts +38 -0
  129. package/dist/plan/grammar.d.ts.map +1 -0
  130. package/dist/plan/grammar.js +85 -0
  131. package/dist/plan/grammar.js.map +1 -0
  132. package/dist/plan/lexical.d.ts +51 -0
  133. package/dist/plan/lexical.d.ts.map +1 -0
  134. package/dist/plan/lexical.js +167 -0
  135. package/dist/plan/lexical.js.map +1 -0
  136. package/dist/plan/planners.d.ts +35 -0
  137. package/dist/plan/planners.d.ts.map +1 -0
  138. package/dist/plan/planners.js +26 -0
  139. package/dist/plan/planners.js.map +1 -0
  140. package/dist/plan/structural.d.ts +68 -0
  141. package/dist/plan/structural.d.ts.map +1 -0
  142. package/dist/plan/structural.js +458 -0
  143. package/dist/plan/structural.js.map +1 -0
  144. package/dist/repomap/cache.d.ts +53 -0
  145. package/dist/repomap/cache.d.ts.map +1 -0
  146. package/dist/repomap/cache.js +139 -0
  147. package/dist/repomap/cache.js.map +1 -0
  148. package/dist/repomap/map.d.ts +161 -0
  149. package/dist/repomap/map.d.ts.map +1 -0
  150. package/dist/repomap/map.js +302 -0
  151. package/dist/repomap/map.js.map +1 -0
  152. package/dist/repomap/rank.d.ts +52 -0
  153. package/dist/repomap/rank.d.ts.map +1 -0
  154. package/dist/repomap/rank.js +155 -0
  155. package/dist/repomap/rank.js.map +1 -0
  156. package/dist/repomap/tags.d.ts +47 -0
  157. package/dist/repomap/tags.d.ts.map +1 -0
  158. package/dist/repomap/tags.js +101 -0
  159. package/dist/repomap/tags.js.map +1 -0
  160. package/dist/retrieve.d.ts +14 -0
  161. package/dist/retrieve.d.ts.map +1 -0
  162. package/dist/retrieve.js +44 -0
  163. package/dist/retrieve.js.map +1 -0
  164. package/dist/stages.d.ts +22 -0
  165. package/dist/stages.d.ts.map +1 -0
  166. package/dist/stages.js +33 -0
  167. package/dist/stages.js.map +1 -0
  168. package/dist/stats.d.ts +40 -0
  169. package/dist/stats.d.ts.map +1 -0
  170. package/dist/stats.js +37 -0
  171. package/dist/stats.js.map +1 -0
  172. package/dist/store-dir.d.ts +98 -0
  173. package/dist/store-dir.d.ts.map +1 -0
  174. package/dist/store-dir.js +379 -0
  175. package/dist/store-dir.js.map +1 -0
  176. package/dist/store.d.ts +36 -0
  177. package/dist/store.d.ts.map +1 -0
  178. package/dist/store.js +56 -0
  179. package/dist/store.js.map +1 -0
  180. package/dist/types.d.ts +298 -0
  181. package/dist/types.d.ts.map +1 -0
  182. package/dist/types.js +2 -0
  183. package/dist/types.js.map +1 -0
  184. package/grammars/tree-sitter-bash.wasm +0 -0
  185. package/grammars/tree-sitter-c.wasm +0 -0
  186. package/grammars/tree-sitter-c_sharp.wasm +0 -0
  187. package/grammars/tree-sitter-cpp.wasm +0 -0
  188. package/grammars/tree-sitter-go.wasm +0 -0
  189. package/grammars/tree-sitter-java.wasm +0 -0
  190. package/grammars/tree-sitter-javascript.wasm +0 -0
  191. package/grammars/tree-sitter-kotlin.wasm +0 -0
  192. package/grammars/tree-sitter-php.wasm +0 -0
  193. package/grammars/tree-sitter-python.wasm +0 -0
  194. package/grammars/tree-sitter-ruby.wasm +0 -0
  195. package/grammars/tree-sitter-rust.wasm +0 -0
  196. package/grammars/tree-sitter-swift.wasm +0 -0
  197. package/grammars/tree-sitter-tsx.wasm +0 -0
  198. package/grammars/tree-sitter-typescript.wasm +0 -0
  199. package/package.json +68 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kotlin.js","sourceRoot":"","sources":["../../src/lang/kotlin.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,EAAE,EAAE,QAAQ;IACZ,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;IACzB,IAAI,EAAE,yBAAyB;IAC/B,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE;QACT,8DAA8D;QAC9D,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;QAC5D,cAAc,EAAE,IAAI,GAAG,EAAE;QACzB,+EAA+E;QAC/E,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC;QACtC,0EAA0E;QAC1E,+EAA+E;QAC/E,+EAA+E;QAC/E,yBAAyB,EAAE,IAAI,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC;QACnD,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV,oBAAoB,EAAE,UAAU;YAChC,qEAAqE;YACrE,2EAA2E;YAC3E,iBAAiB,EAAE,kBAAkB;YACrC,kBAAkB,EAAE,QAAQ;YAC5B,oBAAoB,EAAE,UAAU;YAChC,UAAU,EAAE,YAAY;YACxB,cAAc,EAAE,gBAAgB;YAChC,WAAW,EAAE,aAAa;YAC1B,YAAY,EAAE,SAAS;SACxB;KACF;IACD,6EAA6E;IAC7E,kFAAkF;IAClF,OAAO,EAAE;QACP,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KACnD;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { LanguageProfile } from './profile.ts';
2
+ export declare const php: LanguageProfile;
3
+ //# sourceMappingURL=php.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../src/lang/php.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,GAAG,EAAE,eAmCjB,CAAC"}
@@ -0,0 +1,37 @@
1
+ export const php = {
2
+ id: 'php',
3
+ extensions: ['php'],
4
+ wasm: 'tree-sitter-php.wasm',
5
+ markerLeader: '// ',
6
+ structure: {
7
+ // `//`, `#` and `/** … */` PHPDoc are all comment nodes.
8
+ commentTypes: new Set(['comment']),
9
+ attributeTypes: new Set(),
10
+ // `<?php` is what makes the rest of the file php at all.
11
+ pinnedTypes: new Set(['php_tag']),
12
+ wrapperTypes: {},
13
+ kindLabels: {
14
+ function_definition: 'function',
15
+ class_declaration: 'class',
16
+ interface_declaration: 'interface',
17
+ trait_declaration: 'trait',
18
+ enum_declaration: 'enum',
19
+ const_declaration: 'constant',
20
+ namespace_definition: 'namespace',
21
+ namespace_use_declaration: 'use declaration',
22
+ expression_statement: 'statement',
23
+ php_tag: 'php tag',
24
+ // Raw markup between `?>` and `<?php` — calling it a declaration would be the
25
+ // marker lying about the tree.
26
+ text: 'html section',
27
+ text_interpolation: 'html section',
28
+ },
29
+ },
30
+ // No def kinds: php names its definitions with `name` nodes, not identifiers, and
31
+ // an omitted kind means fewer symbols on the map, never wrong ones.
32
+ repomap: {
33
+ defKinds: {},
34
+ refTypes: ['name', 'variable_name'],
35
+ },
36
+ };
37
+ //# sourceMappingURL=php.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"php.js","sourceRoot":"","sources":["../../src/lang/php.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,GAAG,GAAoB;IAClC,EAAE,EAAE,KAAK;IACT,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,IAAI,EAAE,sBAAsB;IAC5B,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE;QACT,yDAAyD;QACzD,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,EAAE,IAAI,GAAG,EAAE;QACzB,yDAAyD;QACzD,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;QACjC,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV,mBAAmB,EAAE,UAAU;YAC/B,iBAAiB,EAAE,OAAO;YAC1B,qBAAqB,EAAE,WAAW;YAClC,iBAAiB,EAAE,OAAO;YAC1B,gBAAgB,EAAE,MAAM;YACxB,iBAAiB,EAAE,UAAU;YAC7B,oBAAoB,EAAE,WAAW;YACjC,yBAAyB,EAAE,iBAAiB;YAC5C,oBAAoB,EAAE,WAAW;YACjC,OAAO,EAAE,SAAS;YAClB,8EAA8E;YAC9E,+BAA+B;YAC/B,IAAI,EAAE,cAAc;YACpB,kBAAkB,EAAE,cAAc;SACnC;KACF;IACD,kFAAkF;IAClF,oEAAoE;IACpE,OAAO,EAAE;QACP,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC;KACpC;CACF,CAAC"}
@@ -0,0 +1,130 @@
1
+ import type { LanguageId } from '../types.ts';
2
+ /**
3
+ * Everything smelt knows about one language, in one place.
4
+ *
5
+ * Before this module existed, a language's facts lived in seven tables across five
6
+ * modules — the extension map in `detect.ts`, the grammar file in `plan/grammar.ts`,
7
+ * the marker leader in `apply.ts`, the structural node kinds and pins in
8
+ * `plan/structural.ts`, and the repo-map tag tables in `repomap/tags.ts`. Adding a
9
+ * language meant editing all five, and forgetting one produced a language that half
10
+ * works: detected but unparsable, parsable but with a syntax-breaking marker.
11
+ *
12
+ * A `LanguageProfile` is the single adapter carrying every per-language fact, and the
13
+ * registry (`registry.ts`) is `Record<LanguageId, LanguageProfile>` so totality stays
14
+ * a compile error: a new `LanguageId` without a profile does not build. Consumers
15
+ * *read* the registry — none of them owns a slice of it.
16
+ *
17
+ * The optional sections state capability, never invent it: a language is a
18
+ * **structural language** exactly when its profile carries a {@link structure}
19
+ * section, and it contributes repo-map symbols exactly when it carries a
20
+ * {@link repomap} section. What a profile does not claim, smelt does not do.
21
+ */
22
+ export interface LanguageProfile {
23
+ readonly id: LanguageId;
24
+ /** File extensions (lowercase, no dot) that detect as this language. */
25
+ readonly extensions: readonly string[];
26
+ /** The bundled grammar file, e.g. `'tree-sitter-python.wasm'`. */
27
+ readonly wasm: string;
28
+ /**
29
+ * The line-comment leader the marker lands behind (`'// '`, `'# '`), so the
30
+ * survivor still parses in this language's own syntax. A bare `<<smelt…>>` line was
31
+ * measured to break the reparse non-locally in every grammar tested — see the doc
32
+ * on `MARKER_LINE_COMMENT_LEADERS` in `src/apply.ts` for the failure classes.
33
+ * Absent only for a language whose survivors have no syntax to break.
34
+ */
35
+ readonly markerLeader?: string;
36
+ /**
37
+ * What the structural planner needs to parse this language honestly. Present iff
38
+ * the language is claimed by `structural/v1`; the derived `STRUCTURAL_LANGUAGES`
39
+ * list is exactly the profiles that carry this section.
40
+ */
41
+ readonly structure?: LanguageStructure;
42
+ /** What the repo map's tag extraction reads. See {@link RepoMapFacts}. */
43
+ readonly repomap?: RepoMapFacts;
44
+ }
45
+ /**
46
+ * What the structural planner needs to know about a language, beyond its grammar:
47
+ * which node types are comments (so a doc comment travels with its declaration),
48
+ * which node types merely wrap the declaration that should be named
49
+ * (`export function f()` is a function, `@cached def f()` is a function), and the
50
+ * human word for each top-level node kind.
51
+ */
52
+ export interface LanguageStructure {
53
+ /** Top-level node types that are comments, in this grammar's vocabulary. */
54
+ readonly commentTypes: ReadonlySet<string>;
55
+ /**
56
+ * Top-level node types that are outer attributes — parsed as siblings of the item
57
+ * they decorate, but attached forward to it unconditionally by the planner's
58
+ * `unitsOf`, because that is what the attribute means in the language.
59
+ */
60
+ readonly attributeTypes: ReadonlySet<string>;
61
+ /**
62
+ * Comments matching this pattern are pinned to the file — never attached, never
63
+ * collapsed. Go's `//go:build` governs which builds see the whole file, and the
64
+ * spec's mandatory blank line after it means it could never attach; bash and ruby
65
+ * shebang lines, and ruby's `# frozen_string_literal:` magic comment, govern how
66
+ * the file executes at all.
67
+ */
68
+ readonly pinnedCommentPattern?: RegExp;
69
+ /**
70
+ * Non-comment node types pinned to the file the same way — php's `<?php` open tag,
71
+ * a `#!` shebang line (javascript's `hash_bang_line`, kotlin and swift's
72
+ * `shebang_line`). Each is its own uncollapsible unit: a run that swallowed one
73
+ * would change what the survivor *is*, not just what it contains.
74
+ */
75
+ readonly pinnedTypes?: ReadonlySet<string>;
76
+ /**
77
+ * Per-node-type text patterns that pin a node the way {@link pinnedTypes} does —
78
+ * for kinds where only *some* nodes govern the file. C and C++ parse every
79
+ * `#pragma` as a `preproc_call`; only `#pragma once` changes what including the
80
+ * survivor *means*, so only it is pinned.
81
+ */
82
+ readonly pinnedPatternsByType?: Readonly<Record<string, RegExp>>;
83
+ /**
84
+ * Node types that belong to the *preceding* statement despite being parsed as
85
+ * top-level siblings — ruby's `heredoc_body`, which tree-sitter emits as a sibling
86
+ * of the statement holding the heredoc opener. Such a node extends the previous
87
+ * unit, so a collapse can never keep an opener while cutting its body (an
88
+ * unterminated heredoc the reparse cannot even see — tree-sitter-ruby reports no
89
+ * ERROR for a heredoc left open at EOF).
90
+ */
91
+ readonly ridesBackwardTypes?: ReadonlySet<string>;
92
+ /**
93
+ * Node types the grammar extends over trailing comments that belong to what
94
+ * *follows* — kotlin's `import_list` swallows a KDoc that directly follows the
95
+ * imports, which is the doc comment of the first declaration after them. The unit
96
+ * for such a node ends at its last non-comment token; the trailing comments ride
97
+ * forward and attach like any other comment block.
98
+ */
99
+ readonly trailingCommentSplitTypes?: ReadonlySet<string>;
100
+ /**
101
+ * Node types that wrap the declaration worth naming — the marker should say what is
102
+ * inside, not name the wrapper. The value is the label to fall back to when nothing
103
+ * nameable is found inside.
104
+ */
105
+ readonly wrapperTypes: Readonly<Record<string, string>>;
106
+ /**
107
+ * Human words per node type. What a language's map does not name, the planner
108
+ * still labels honestly: an `ERROR` node is an `'unparsed region'`, any other
109
+ * statement kind is a `'statement'`, and only what remains is called a
110
+ * `'declaration'` — a marker that calls a parse error or a log line a declaration
111
+ * would be lying about the tree.
112
+ */
113
+ readonly kindLabels: Readonly<Record<string, string>>;
114
+ }
115
+ /**
116
+ * What the repo map's tag extraction (`repomap/tags.ts`) knows about a language.
117
+ *
118
+ * `defKinds` lists only node kinds whose `name` field is an *identifier* node,
119
+ * because that is what the extraction walk reads — a kind whose name is spelled
120
+ * differently (php's `name` nodes, ruby's `constant` class names, bash's `word`
121
+ * function names, kotlin's field-less declarations) is *omitted*, not guessed at. An
122
+ * omitted kind means fewer symbols on the map, never wrong ones.
123
+ */
124
+ export interface RepoMapFacts {
125
+ /** Declaration node type → human kind word. Absent from the map = not a definition. */
126
+ readonly defKinds: Readonly<Record<string, string>>;
127
+ /** Node types counted as references. */
128
+ readonly refTypes: readonly string[];
129
+ }
130
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/lang/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC;IACvC,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjE;;;;;;;OAOG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClD;;;;;;OAMG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACzD;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACvD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/lang/profile.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { LanguageProfile } from './profile.ts';
2
+ export declare const python: LanguageProfile;
3
+ //# sourceMappingURL=python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/lang/python.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,MAAM,EAAE,eA+BpB,CAAC"}
@@ -0,0 +1,33 @@
1
+ export const python = {
2
+ id: 'python',
3
+ extensions: ['py', 'pyi'],
4
+ wasm: 'tree-sitter-python.wasm',
5
+ markerLeader: '# ',
6
+ structure: {
7
+ // Docstrings are not comments — they live inside the definition's body, so a kept
8
+ // definition keeps its docstring because units are kept whole. `#` comments above
9
+ // a definition attach the same way `/** … */` does in TypeScript.
10
+ commentTypes: new Set(['comment']),
11
+ attributeTypes: new Set(),
12
+ // `#!/usr/bin/env python3` parses as a plain comment node, but it decides which
13
+ // interpreter runs the file — pinned the way the bash and ruby shebangs are.
14
+ pinnedCommentPattern: /^#!/,
15
+ wrapperTypes: { decorated_definition: 'declaration' },
16
+ kindLabels: {
17
+ function_definition: 'function',
18
+ class_definition: 'class',
19
+ import_statement: 'import statement',
20
+ import_from_statement: 'import statement',
21
+ future_import_statement: 'import statement',
22
+ expression_statement: 'statement',
23
+ },
24
+ },
25
+ repomap: {
26
+ defKinds: {
27
+ function_definition: 'function',
28
+ class_definition: 'class',
29
+ },
30
+ refTypes: ['identifier'],
31
+ },
32
+ };
33
+ //# sourceMappingURL=python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/lang/python.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,EAAE,EAAE,QAAQ;IACZ,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;IACzB,IAAI,EAAE,yBAAyB;IAC/B,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE;QACT,kFAAkF;QAClF,kFAAkF;QAClF,kEAAkE;QAClE,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,EAAE,IAAI,GAAG,EAAE;QACzB,gFAAgF;QAChF,6EAA6E;QAC7E,oBAAoB,EAAE,KAAK;QAC3B,YAAY,EAAE,EAAE,oBAAoB,EAAE,aAAa,EAAE;QACrD,UAAU,EAAE;YACV,mBAAmB,EAAE,UAAU;YAC/B,gBAAgB,EAAE,OAAO;YACzB,gBAAgB,EAAE,kBAAkB;YACpC,qBAAqB,EAAE,kBAAkB;YACzC,uBAAuB,EAAE,kBAAkB;YAC3C,oBAAoB,EAAE,WAAW;SAClC;KACF;IACD,OAAO,EAAE;QACP,QAAQ,EAAE;YACR,mBAAmB,EAAE,UAAU;YAC/B,gBAAgB,EAAE,OAAO;SAC1B;QACD,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;CACF,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { LanguageId } from '../types.ts';
2
+ import type { LanguageProfile } from './profile.ts';
3
+ /**
4
+ * The registry — every language smelt knows, one {@link LanguageProfile} each.
5
+ *
6
+ * `Record<LanguageId, LanguageProfile>` on purpose: adding a `LanguageId` in
7
+ * `types.ts` without writing its profile is a compile error, so the id list and the
8
+ * facts cannot drift. Every derived view — `SUPPORTED_LANGUAGES`,
9
+ * `WASM_BY_LANGUAGE`, `STRUCTURAL_LANGUAGES`, the extension map, the marker leaders,
10
+ * the repo-map tag tables — is computed from this object, never written twice.
11
+ *
12
+ * Key order is meaningful: it is the order every rendered language list uses (the
13
+ * `--language`/`--strategy` help, the init wizard, error messages), so keep it stable
14
+ * and append new languages at the end.
15
+ */
16
+ export declare const LANGUAGE_PROFILES: Readonly<Record<LanguageId, LanguageProfile>>;
17
+ /** The profile for a language id. Total by construction — see the registry type. */
18
+ export declare function profileFor(id: LanguageId): LanguageProfile;
19
+ /**
20
+ * The profile a path's extension selects, or `undefined` for anything unmapped.
21
+ * Deliberately not a content sniffer: guessing from bytes gets things wrong silently,
22
+ * and `undefined` costs nothing here — `detectLanguage` turns it into `'unknown'`,
23
+ * which selects the lexical planner, and that works on anything.
24
+ */
25
+ export declare function profileForPath(path: string | undefined): LanguageProfile | undefined;
26
+ /**
27
+ * The languages the structural planner claims: exactly the profiles that carry a
28
+ * `structure` section. In registry order, so every rendered list agrees.
29
+ */
30
+ export declare function structuralLanguages(): readonly LanguageId[];
31
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lang/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAiBpD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,CAgB3E,CAAC;AAEF,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,EAAE,EAAE,UAAU,GAAG,eAAe,CAE1D;AAoBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAMpF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,UAAU,EAAE,CAI3D"}
@@ -0,0 +1,89 @@
1
+ import { bash } from './bash.js';
2
+ import { c } from './c.js';
3
+ import { c_sharp } from './c_sharp.js';
4
+ import { cpp } from './cpp.js';
5
+ import { go } from './go.js';
6
+ import { java } from './java.js';
7
+ import { javascript } from './javascript.js';
8
+ import { kotlin } from './kotlin.js';
9
+ import { php } from './php.js';
10
+ import { python } from './python.js';
11
+ import { ruby } from './ruby.js';
12
+ import { rust } from './rust.js';
13
+ import { swift } from './swift.js';
14
+ import { tsx } from './tsx.js';
15
+ import { typescript } from './typescript.js';
16
+ /**
17
+ * The registry — every language smelt knows, one {@link LanguageProfile} each.
18
+ *
19
+ * `Record<LanguageId, LanguageProfile>` on purpose: adding a `LanguageId` in
20
+ * `types.ts` without writing its profile is a compile error, so the id list and the
21
+ * facts cannot drift. Every derived view — `SUPPORTED_LANGUAGES`,
22
+ * `WASM_BY_LANGUAGE`, `STRUCTURAL_LANGUAGES`, the extension map, the marker leaders,
23
+ * the repo-map tag tables — is computed from this object, never written twice.
24
+ *
25
+ * Key order is meaningful: it is the order every rendered language list uses (the
26
+ * `--language`/`--strategy` help, the init wizard, error messages), so keep it stable
27
+ * and append new languages at the end.
28
+ */
29
+ export const LANGUAGE_PROFILES = {
30
+ typescript,
31
+ tsx,
32
+ javascript,
33
+ rust,
34
+ python,
35
+ go,
36
+ java,
37
+ c,
38
+ cpp,
39
+ c_sharp,
40
+ ruby,
41
+ php,
42
+ kotlin,
43
+ swift,
44
+ bash,
45
+ };
46
+ /** The profile for a language id. Total by construction — see the registry type. */
47
+ export function profileFor(id) {
48
+ return LANGUAGE_PROFILES[id];
49
+ }
50
+ /** Extension → profile, derived once. A duplicate claim would be a registry bug. */
51
+ const BY_EXTENSION = (() => {
52
+ const index = new Map();
53
+ for (const profile of Object.values(LANGUAGE_PROFILES)) {
54
+ for (const extension of profile.extensions) {
55
+ const holder = index.get(extension);
56
+ if (holder !== undefined) {
57
+ throw new Error(`smelt: extension ".${extension}" is claimed by both "${holder.id}" and ` +
58
+ `"${profile.id}" — a path would detect as whichever loaded last.`);
59
+ }
60
+ index.set(extension, profile);
61
+ }
62
+ }
63
+ return index;
64
+ })();
65
+ /**
66
+ * The profile a path's extension selects, or `undefined` for anything unmapped.
67
+ * Deliberately not a content sniffer: guessing from bytes gets things wrong silently,
68
+ * and `undefined` costs nothing here — `detectLanguage` turns it into `'unknown'`,
69
+ * which selects the lexical planner, and that works on anything.
70
+ */
71
+ export function profileForPath(path) {
72
+ if (path === undefined)
73
+ return undefined;
74
+ const base = path.replace(/\\/g, '/').split('/').pop() ?? '';
75
+ const dot = base.lastIndexOf('.');
76
+ if (dot <= 0)
77
+ return undefined;
78
+ return BY_EXTENSION.get(base.slice(dot + 1).toLowerCase());
79
+ }
80
+ /**
81
+ * The languages the structural planner claims: exactly the profiles that carry a
82
+ * `structure` section. In registry order, so every rendered list agrees.
83
+ */
84
+ export function structuralLanguages() {
85
+ return Object.values(LANGUAGE_PROFILES)
86
+ .filter((profile) => profile.structure !== undefined)
87
+ .map((profile) => profile.id);
88
+ }
89
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/lang/registry.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import type { LanguageProfile } from './profile.ts';
2
+ export declare const ruby: LanguageProfile;
3
+ //# sourceMappingURL=ruby.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ruby.d.ts","sourceRoot":"","sources":["../../src/lang/ruby.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,IAAI,EAAE,eA6ClB,CAAC"}
@@ -0,0 +1,47 @@
1
+ export const ruby = {
2
+ id: 'ruby',
3
+ extensions: ['rb'],
4
+ wasm: 'tree-sitter-ruby.wasm',
5
+ markerLeader: '# ',
6
+ structure: {
7
+ commentTypes: new Set(['comment']),
8
+ attributeTypes: new Set(),
9
+ // The shebang and the `# frozen_string_literal:` magic comment both govern how
10
+ // the whole file executes; neither may collapse into a run.
11
+ pinnedCommentPattern: /^#(?:!|\s*frozen_string_literal:)/,
12
+ // A heredoc's body is a top-level sibling of the statement holding its opener —
13
+ // it extends that statement's unit, or a collapse could keep the opener and cut
14
+ // the body, leaving an unterminated heredoc that swallows every declaration
15
+ // after it (and tree-sitter-ruby reports no ERROR for it at EOF).
16
+ ridesBackwardTypes: new Set(['heredoc_body']),
17
+ wrapperTypes: {},
18
+ kindLabels: {
19
+ method: 'method',
20
+ singleton_method: 'method',
21
+ class: 'class',
22
+ module: 'module',
23
+ // Top-level `require "json"` and `CONSTANT = 1` are expression nodes in
24
+ // tree-sitter-ruby; "statement" is the honest generic word for both — and for
25
+ // top-level control-flow blocks, which are expressions here too.
26
+ call: 'statement',
27
+ assignment: 'statement',
28
+ if: 'statement',
29
+ unless: 'statement',
30
+ case: 'statement',
31
+ while: 'statement',
32
+ until: 'statement',
33
+ for: 'statement',
34
+ begin: 'statement',
35
+ heredoc_body: 'heredoc body',
36
+ comment: 'comment',
37
+ },
38
+ },
39
+ repomap: {
40
+ defKinds: {
41
+ method: 'method',
42
+ singleton_method: 'method',
43
+ },
44
+ refTypes: ['identifier', 'constant'],
45
+ },
46
+ };
47
+ //# sourceMappingURL=ruby.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ruby.js","sourceRoot":"","sources":["../../src/lang/ruby.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAoB;IACnC,EAAE,EAAE,MAAM;IACV,UAAU,EAAE,CAAC,IAAI,CAAC;IAClB,IAAI,EAAE,uBAAuB;IAC7B,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE;QACT,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,EAAE,IAAI,GAAG,EAAE;QACzB,+EAA+E;QAC/E,4DAA4D;QAC5D,oBAAoB,EAAE,mCAAmC;QACzD,gFAAgF;QAChF,gFAAgF;QAChF,4EAA4E;QAC5E,kEAAkE;QAClE,kBAAkB,EAAE,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC;QAC7C,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,QAAQ;YAC1B,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,QAAQ;YAChB,wEAAwE;YACxE,8EAA8E;YAC9E,iEAAiE;YACjE,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE,WAAW;YACvB,EAAE,EAAE,WAAW;YACf,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,WAAW;YAClB,KAAK,EAAE,WAAW;YAClB,GAAG,EAAE,WAAW;YAChB,KAAK,EAAE,WAAW;YAClB,YAAY,EAAE,cAAc;YAC5B,OAAO,EAAE,SAAS;SACnB;KACF;IACD,OAAO,EAAE;QACP,QAAQ,EAAE;YACR,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,QAAQ;SAC3B;QACD,QAAQ,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC;KACrC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { LanguageProfile } from './profile.ts';
2
+ export declare const rust: LanguageProfile;
3
+ //# sourceMappingURL=rust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rust.d.ts","sourceRoot":"","sources":["../../src/lang/rust.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,IAAI,EAAE,eA2ClB,CAAC"}
@@ -0,0 +1,45 @@
1
+ export const rust = {
2
+ id: 'rust',
3
+ extensions: ['rs'],
4
+ wasm: 'tree-sitter-rust.wasm',
5
+ markerLeader: '// ',
6
+ structure: {
7
+ // `///` and `//!` doc comments are line_comment nodes; `/** … */` is block_comment.
8
+ commentTypes: new Set(['line_comment', 'block_comment']),
9
+ // `#[…]` is a top-level sibling in tree-sitter-rust; it rides forward to its item.
10
+ attributeTypes: new Set(['attribute_item']),
11
+ wrapperTypes: {},
12
+ kindLabels: {
13
+ function_item: 'function',
14
+ struct_item: 'struct',
15
+ enum_item: 'enum',
16
+ union_item: 'union',
17
+ trait_item: 'trait',
18
+ impl_item: 'impl block',
19
+ mod_item: 'module',
20
+ macro_definition: 'macro',
21
+ type_item: 'type alias',
22
+ const_item: 'constant',
23
+ static_item: 'static item',
24
+ use_declaration: 'use declaration',
25
+ extern_crate_declaration: 'extern crate declaration',
26
+ attribute_item: 'attribute',
27
+ foreign_mod_item: 'extern block',
28
+ },
29
+ },
30
+ repomap: {
31
+ defKinds: {
32
+ function_item: 'function',
33
+ struct_item: 'struct',
34
+ enum_item: 'enum',
35
+ trait_item: 'trait',
36
+ mod_item: 'module',
37
+ const_item: 'constant',
38
+ static_item: 'static',
39
+ type_item: 'type alias',
40
+ union_item: 'union',
41
+ },
42
+ refTypes: ['identifier', 'type_identifier'],
43
+ },
44
+ };
45
+ //# sourceMappingURL=rust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rust.js","sourceRoot":"","sources":["../../src/lang/rust.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAoB;IACnC,EAAE,EAAE,MAAM;IACV,UAAU,EAAE,CAAC,IAAI,CAAC;IAClB,IAAI,EAAE,uBAAuB;IAC7B,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE;QACT,oFAAoF;QACpF,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QACxD,mFAAmF;QACnF,cAAc,EAAE,IAAI,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC;QAC3C,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV,aAAa,EAAE,UAAU;YACzB,WAAW,EAAE,QAAQ;YACrB,SAAS,EAAE,MAAM;YACjB,UAAU,EAAE,OAAO;YACnB,UAAU,EAAE,OAAO;YACnB,SAAS,EAAE,YAAY;YACvB,QAAQ,EAAE,QAAQ;YAClB,gBAAgB,EAAE,OAAO;YACzB,SAAS,EAAE,YAAY;YACvB,UAAU,EAAE,UAAU;YACtB,WAAW,EAAE,aAAa;YAC1B,eAAe,EAAE,iBAAiB;YAClC,wBAAwB,EAAE,0BAA0B;YACpD,cAAc,EAAE,WAAW;YAC3B,gBAAgB,EAAE,cAAc;SACjC;KACF;IACD,OAAO,EAAE;QACP,QAAQ,EAAE;YACR,aAAa,EAAE,UAAU;YACzB,WAAW,EAAE,QAAQ;YACrB,SAAS,EAAE,MAAM;YACjB,UAAU,EAAE,OAAO;YACnB,QAAQ,EAAE,QAAQ;YAClB,UAAU,EAAE,UAAU;YACtB,WAAW,EAAE,QAAQ;YACrB,SAAS,EAAE,YAAY;YACvB,UAAU,EAAE,OAAO;SACpB;QACD,QAAQ,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC;KAC5C;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { LanguageProfile } from './profile.ts';
2
+ export declare const swift: LanguageProfile;
3
+ //# sourceMappingURL=swift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swift.d.ts","sourceRoot":"","sources":["../../src/lang/swift.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,KAAK,EAAE,eAgCnB,CAAC"}
@@ -0,0 +1,34 @@
1
+ export const swift = {
2
+ id: 'swift',
3
+ extensions: ['swift'],
4
+ wasm: 'tree-sitter-swift.wasm',
5
+ markerLeader: '// ',
6
+ structure: {
7
+ // `//` and `///` are comment nodes; `/* … */` is multiline_comment.
8
+ commentTypes: new Set(['comment', 'multiline_comment']),
9
+ attributeTypes: new Set(),
10
+ // `#!/usr/bin/env swift` parses as a shebang_line node; same law as the rest.
11
+ pinnedTypes: new Set(['shebang_line']),
12
+ wrapperTypes: {},
13
+ kindLabels: {
14
+ function_declaration: 'function',
15
+ // tree-sitter-swift parses struct, class, enum and extension declarations all
16
+ // as class_declaration — "type declaration" is the honest word for the union.
17
+ class_declaration: 'type declaration',
18
+ protocol_declaration: 'protocol',
19
+ property_declaration: 'property',
20
+ typealias_declaration: 'type alias',
21
+ import_declaration: 'import declaration',
22
+ shebang_line: 'shebang',
23
+ },
24
+ },
25
+ repomap: {
26
+ defKinds: {
27
+ class_declaration: 'type',
28
+ protocol_declaration: 'protocol',
29
+ function_declaration: 'function',
30
+ },
31
+ refTypes: ['simple_identifier', 'type_identifier'],
32
+ },
33
+ };
34
+ //# sourceMappingURL=swift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swift.js","sourceRoot":"","sources":["../../src/lang/swift.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAoB;IACpC,EAAE,EAAE,OAAO;IACX,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,IAAI,EAAE,wBAAwB;IAC9B,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE;QACT,oEAAoE;QACpE,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;QACvD,cAAc,EAAE,IAAI,GAAG,EAAE;QACzB,8EAA8E;QAC9E,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC;QACtC,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV,oBAAoB,EAAE,UAAU;YAChC,8EAA8E;YAC9E,8EAA8E;YAC9E,iBAAiB,EAAE,kBAAkB;YACrC,oBAAoB,EAAE,UAAU;YAChC,oBAAoB,EAAE,UAAU;YAChC,qBAAqB,EAAE,YAAY;YACnC,kBAAkB,EAAE,oBAAoB;YACxC,YAAY,EAAE,SAAS;SACxB;KACF;IACD,OAAO,EAAE;QACP,QAAQ,EAAE;YACR,iBAAiB,EAAE,MAAM;YACzB,oBAAoB,EAAE,UAAU;YAChC,oBAAoB,EAAE,UAAU;SACjC;QACD,QAAQ,EAAE,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KACnD;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { LanguageProfile } from './profile.ts';
2
+ /** TSX is the typescript grammar family's second id — same structure, same facts. */
3
+ export declare const tsx: LanguageProfile;
4
+ //# sourceMappingURL=tsx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsx.d.ts","sourceRoot":"","sources":["../../src/lang/tsx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD,qFAAqF;AACrF,eAAO,MAAM,GAAG,EAAE,eAOjB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { TS_DEF_KINDS, TS_REF_TYPES, TS_STRUCTURE } from './typescript.js';
2
+ /** TSX is the typescript grammar family's second id — same structure, same facts. */
3
+ export const tsx = {
4
+ id: 'tsx',
5
+ extensions: ['tsx'],
6
+ wasm: 'tree-sitter-tsx.wasm',
7
+ markerLeader: '// ',
8
+ structure: TS_STRUCTURE,
9
+ repomap: { defKinds: TS_DEF_KINDS, refTypes: TS_REF_TYPES },
10
+ };
11
+ //# sourceMappingURL=tsx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsx.js","sourceRoot":"","sources":["../../src/lang/tsx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE3E,qFAAqF;AACrF,MAAM,CAAC,MAAM,GAAG,GAAoB;IAClC,EAAE,EAAE,KAAK;IACT,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,IAAI,EAAE,sBAAsB;IAC5B,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,YAAY;IACvB,OAAO,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE;CAC5D,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { LanguageProfile, LanguageStructure } from './profile.ts';
2
+ /**
3
+ * Human words for the tree-sitter node types the structural planner expects at the
4
+ * top level of a TypeScript or TSX file. What the map does not name, the planner
5
+ * still labels honestly — see {@link LanguageStructure.kindLabels}.
6
+ */
7
+ export declare const TS_KIND_LABELS: Readonly<Record<string, string>>;
8
+ /** One grammar family, two ids: the tsx profile shares this structure verbatim. */
9
+ export declare const TS_STRUCTURE: LanguageStructure;
10
+ /**
11
+ * Repo-map definition kinds for the typescript grammar family — shared by the
12
+ * typescript, tsx and javascript profiles, exactly as the extraction treats them.
13
+ */
14
+ export declare const TS_DEF_KINDS: Readonly<Record<string, string>>;
15
+ /** Repo-map reference node types for the typescript grammar family. */
16
+ export declare const TS_REF_TYPES: readonly string[];
17
+ export declare const typescript: LanguageProfile;
18
+ //# sourceMappingURL=typescript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/lang/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkB3D,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,YAAY,EAAE,iBAQ1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWzD,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAsC,CAAC;AAEjF,eAAO,MAAM,UAAU,EAAE,eAOxB,CAAC"}