semantifold 0.1.1 → 0.3.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 (399) hide show
  1. package/README.md +42 -10
  2. package/build/index.d.ts +32 -3
  3. package/build/index.d.ts.map +1 -1
  4. package/build/index.js +99 -4
  5. package/build/src/acceptance.d.ts +32 -0
  6. package/build/src/acceptance.d.ts.map +1 -0
  7. package/build/src/acceptance.js +358 -0
  8. package/build/src/array.d.ts +7 -0
  9. package/build/src/array.d.ts.map +1 -0
  10. package/build/src/array.js +18 -0
  11. package/build/src/artifact-path.d.ts +13 -0
  12. package/build/src/artifact-path.d.ts.map +1 -0
  13. package/build/src/artifact-path.js +30 -0
  14. package/build/src/artifacts.d.ts +7 -0
  15. package/build/src/artifacts.d.ts.map +1 -0
  16. package/build/src/artifacts.js +389 -0
  17. package/build/src/backends/c-runtime.d.ts +3 -0
  18. package/build/src/backends/c-runtime.d.ts.map +1 -0
  19. package/build/src/backends/c-runtime.js +151 -0
  20. package/build/src/backends/c-validation.d.ts +12 -0
  21. package/build/src/backends/c-validation.d.ts.map +1 -0
  22. package/build/src/backends/c-validation.js +85 -0
  23. package/build/src/backends/c.d.ts +31 -0
  24. package/build/src/backends/c.d.ts.map +1 -0
  25. package/build/src/backends/c.js +308 -0
  26. package/build/src/backends/cpp-runtime.d.ts +3 -0
  27. package/build/src/backends/cpp-runtime.d.ts.map +1 -0
  28. package/build/src/backends/cpp-runtime.js +99 -0
  29. package/build/src/backends/cpp-validation.d.ts +9 -0
  30. package/build/src/backends/cpp-validation.d.ts.map +1 -0
  31. package/build/src/backends/cpp-validation.js +74 -0
  32. package/build/src/backends/cpp.d.ts +16 -0
  33. package/build/src/backends/cpp.d.ts.map +1 -0
  34. package/build/src/backends/cpp.js +285 -0
  35. package/build/src/backends/csharp.d.ts +20 -0
  36. package/build/src/backends/csharp.d.ts.map +1 -0
  37. package/build/src/backends/csharp.js +259 -0
  38. package/build/src/backends/go.d.ts +20 -0
  39. package/build/src/backends/go.d.ts.map +1 -0
  40. package/build/src/backends/go.js +374 -0
  41. package/build/src/backends/identifiers.d.ts +12 -0
  42. package/build/src/backends/identifiers.d.ts.map +1 -1
  43. package/build/src/backends/identifiers.js +79 -2
  44. package/build/src/backends/index.d.ts.map +1 -1
  45. package/build/src/backends/index.js +27 -37
  46. package/build/src/backends/native-validation.d.ts +9 -0
  47. package/build/src/backends/native-validation.d.ts.map +1 -0
  48. package/build/src/backends/native-validation.js +59 -0
  49. package/build/src/backends/ordered-expressions.d.ts +74 -0
  50. package/build/src/backends/ordered-expressions.d.ts.map +1 -0
  51. package/build/src/backends/ordered-expressions.js +159 -0
  52. package/build/src/backends/python.d.ts +8 -0
  53. package/build/src/backends/python.d.ts.map +1 -0
  54. package/build/src/backends/python.js +162 -0
  55. package/build/src/backends/scalars.d.ts.map +1 -1
  56. package/build/src/backends/scalars.js +8 -2
  57. package/build/src/backends/shared.d.ts.map +1 -1
  58. package/build/src/backends/shared.js +67 -19
  59. package/build/src/binary-mapping.d.ts +32 -0
  60. package/build/src/binary-mapping.d.ts.map +1 -0
  61. package/build/src/binary-mapping.js +285 -0
  62. package/build/src/diagnostic.d.ts +36 -4
  63. package/build/src/diagnostic.d.ts.map +1 -1
  64. package/build/src/diagnostic.js +42 -3
  65. package/build/src/frontends/c-parser.d.ts +20 -0
  66. package/build/src/frontends/c-parser.d.ts.map +1 -0
  67. package/build/src/frontends/c-parser.js +14 -0
  68. package/build/src/frontends/c.d.ts +220 -0
  69. package/build/src/frontends/c.d.ts.map +1 -0
  70. package/build/src/frontends/c.js +750 -0
  71. package/build/src/frontends/cpp-parser.d.ts +11 -0
  72. package/build/src/frontends/cpp-parser.d.ts.map +1 -0
  73. package/build/src/frontends/cpp-parser.js +15 -0
  74. package/build/src/frontends/cpp.d.ts +227 -0
  75. package/build/src/frontends/cpp.d.ts.map +1 -0
  76. package/build/src/frontends/cpp.js +784 -0
  77. package/build/src/frontends/csharp.d.ts +14 -0
  78. package/build/src/frontends/csharp.d.ts.map +1 -0
  79. package/build/src/frontends/csharp.js +708 -0
  80. package/build/src/frontends/go.d.ts +15 -0
  81. package/build/src/frontends/go.d.ts.map +1 -0
  82. package/build/src/frontends/go.js +712 -0
  83. package/build/src/frontends/index.d.ts.map +1 -1
  84. package/build/src/frontends/index.js +5 -23
  85. package/build/src/frontends/python.d.ts +14 -0
  86. package/build/src/frontends/python.d.ts.map +1 -0
  87. package/build/src/frontends/python.js +615 -0
  88. package/build/src/frontends/scalars.d.ts.map +1 -1
  89. package/build/src/frontends/scalars.js +21 -1
  90. package/build/src/language-registry.d.ts +113 -0
  91. package/build/src/language-registry.d.ts.map +1 -0
  92. package/build/src/language-registry.js +421 -0
  93. package/build/src/mapping.js +3 -2
  94. package/build/src/semantic/location.d.ts +7 -0
  95. package/build/src/semantic/location.d.ts.map +1 -1
  96. package/build/src/semantic/location.js +10 -1
  97. package/build/src/semantic/provenance.js +3 -3
  98. package/build/src/semantic/types.d.ts +399 -2
  99. package/build/src/semantic/types.d.ts.map +1 -1
  100. package/build/src/semantic/types.js +110 -2
  101. package/build/src/subprocess.d.ts +38 -0
  102. package/build/src/subprocess.d.ts.map +1 -0
  103. package/build/src/subprocess.js +233 -0
  104. package/build/src/timeout.d.ts +8 -0
  105. package/build/src/timeout.d.ts.map +1 -0
  106. package/build/src/timeout.js +11 -0
  107. package/build/src/toolchains.d.ts +107 -0
  108. package/build/src/toolchains.d.ts.map +1 -0
  109. package/build/src/toolchains.js +417 -0
  110. package/docs/architecture.md +23 -5
  111. package/docs/c.md +60 -0
  112. package/docs/cpp.md +61 -0
  113. package/docs/goals.md +4 -2
  114. package/docs/language-support.md +46 -6
  115. package/docs/parser-qualification.md +219 -0
  116. package/docs/plans/2026-09-05-standard-library-portability.md +46 -0
  117. package/docs/source-maps.md +38 -5
  118. package/docs/standard-library-portability.md +190 -0
  119. package/docs/testing.md +131 -3
  120. package/index.js +109 -4
  121. package/node_modules/node-addon-api/LICENSE.md +9 -0
  122. package/node_modules/node-addon-api/README.md +95 -0
  123. package/node_modules/node-addon-api/common.gypi +21 -0
  124. package/node_modules/node-addon-api/except.gypi +25 -0
  125. package/node_modules/node-addon-api/index.js +14 -0
  126. package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
  127. package/node_modules/node-addon-api/napi-inl.h +7250 -0
  128. package/node_modules/node-addon-api/napi.h +3463 -0
  129. package/node_modules/node-addon-api/node_addon_api.gyp +42 -0
  130. package/node_modules/node-addon-api/node_api.gyp +9 -0
  131. package/node_modules/node-addon-api/noexcept.gypi +26 -0
  132. package/node_modules/node-addon-api/nothing.c +0 -0
  133. package/node_modules/node-addon-api/package-support.json +21 -0
  134. package/node_modules/node-addon-api/package.json +481 -0
  135. package/node_modules/node-addon-api/tools/README.md +73 -0
  136. package/node_modules/node-addon-api/tools/check-napi.js +99 -0
  137. package/node_modules/node-addon-api/tools/clang-format.js +71 -0
  138. package/node_modules/node-addon-api/tools/conversion.js +301 -0
  139. package/node_modules/node-gyp-build/LICENSE +21 -0
  140. package/node_modules/node-gyp-build/README.md +58 -0
  141. package/node_modules/node-gyp-build/SECURITY.md +5 -0
  142. package/node_modules/node-gyp-build/bin.js +84 -0
  143. package/node_modules/node-gyp-build/build-test.js +19 -0
  144. package/node_modules/node-gyp-build/index.js +6 -0
  145. package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
  146. package/node_modules/node-gyp-build/optional.js +7 -0
  147. package/node_modules/node-gyp-build/package.json +43 -0
  148. package/node_modules/semantifold-tree-sitter-legacy-internal/LICENSE +15 -0
  149. package/node_modules/semantifold-tree-sitter-legacy-internal/README.md +7 -0
  150. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/LICENSE +21 -0
  151. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/README.md +90 -0
  152. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/binding.gyp +79 -0
  153. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/index.js +895 -0
  154. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/package.json +62 -0
  155. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
  156. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
  157. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
  158. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
  159. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/addon_data.h +47 -0
  160. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/binding.cc +35 -0
  161. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/conversions.cc +140 -0
  162. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/conversions.h +22 -0
  163. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/language.cc +106 -0
  164. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/language.h +17 -0
  165. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/logger.cc +70 -0
  166. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/logger.h +19 -0
  167. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
  168. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
  169. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/node.cc +1056 -0
  170. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/node.h +30 -0
  171. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/parser.cc +298 -0
  172. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/parser.h +35 -0
  173. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/query.cc +383 -0
  174. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/query.h +39 -0
  175. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree.cc +307 -0
  176. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree.h +45 -0
  177. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
  178. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree_cursor.h +52 -0
  179. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/tree-sitter.d.ts +211 -0
  180. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1266 -0
  181. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
  182. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
  183. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +290 -0
  184. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
  185. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
  186. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
  187. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +501 -0
  188. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
  189. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
  190. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +221 -0
  191. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +299 -0
  192. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
  193. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +419 -0
  194. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +49 -0
  195. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +14 -0
  196. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +774 -0
  197. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2151 -0
  198. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +230 -0
  199. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +62 -0
  200. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4134 -0
  201. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
  202. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
  203. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +899 -0
  204. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
  205. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1060 -0
  206. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +382 -0
  207. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +165 -0
  208. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
  209. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +714 -0
  210. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
  211. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
  212. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
  213. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
  214. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
  215. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
  216. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
  217. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
  218. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
  219. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
  220. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +50 -0
  221. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +23 -0
  222. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +109 -0
  223. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1294 -0
  224. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1823 -0
  225. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
  226. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/LICENSE +21 -0
  227. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/README.md +18 -0
  228. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/binding.gyp +29 -0
  229. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/binding.cc +20 -0
  230. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/binding_test.js +9 -0
  231. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/index.d.ts +28 -0
  232. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/index.js +11 -0
  233. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/grammar.js +1470 -0
  234. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/package.json +60 -0
  235. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/darwin-arm64/tree-sitter-c.node +0 -0
  236. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/darwin-x64/tree-sitter-c.node +0 -0
  237. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/linux-arm64/tree-sitter-c.node +0 -0
  238. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/linux-x64/tree-sitter-c.node +0 -0
  239. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/win32-arm64/tree-sitter-c.node +0 -0
  240. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/win32-x64/tree-sitter-c.node +0 -0
  241. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/queries/highlights.scm +81 -0
  242. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/queries/tags.scm +9 -0
  243. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/grammar.json +9735 -0
  244. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/node-types.json +4614 -0
  245. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/parser.c +119615 -0
  246. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/alloc.h +54 -0
  247. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/array.h +290 -0
  248. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/parser.h +266 -0
  249. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/tree-sitter-c.wasm +0 -0
  250. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/tree-sitter.json +43 -0
  251. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/LICENSE +21 -0
  252. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/README.md +22 -0
  253. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/binding.gyp +30 -0
  254. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/binding.cc +20 -0
  255. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/binding_test.js +9 -0
  256. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/index.d.ts +28 -0
  257. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/index.js +11 -0
  258. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/grammar.js +1436 -0
  259. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/package.json +61 -0
  260. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/darwin-arm64/tree-sitter-cpp.node +0 -0
  261. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/darwin-x64/tree-sitter-cpp.node +0 -0
  262. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/linux-arm64/tree-sitter-cpp.node +0 -0
  263. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/linux-x64/tree-sitter-cpp.node +0 -0
  264. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/win32-arm64/tree-sitter-cpp.node +0 -0
  265. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/win32-x64/tree-sitter-cpp.node +0 -0
  266. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/highlights.scm +70 -0
  267. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/injections.scm +3 -0
  268. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/tags.scm +15 -0
  269. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/grammar.json +17084 -0
  270. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/node-types.json +7997 -0
  271. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/parser.c +530368 -0
  272. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/scanner.c +148 -0
  273. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/alloc.h +54 -0
  274. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/array.h +290 -0
  275. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/parser.h +266 -0
  276. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/tree-sitter-cpp.wasm +0 -0
  277. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/tree-sitter.json +55 -0
  278. package/node_modules/semantifold-tree-sitter-legacy-internal/package.json +22 -0
  279. package/node_modules/semantifold-tree-sitter-legacy-internal/src/c.js +152 -0
  280. package/node_modules/tree-sitter/LICENSE +21 -0
  281. package/node_modules/tree-sitter/README.md +128 -0
  282. package/node_modules/tree-sitter/binding.gyp +88 -0
  283. package/node_modules/tree-sitter/index.js +950 -0
  284. package/node_modules/tree-sitter/package.json +76 -0
  285. package/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
  286. package/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
  287. package/node_modules/tree-sitter/prebuilds/linux-arm64/tree-sitter.node +0 -0
  288. package/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
  289. package/node_modules/tree-sitter/prebuilds/win32-arm64/tree-sitter.node +0 -0
  290. package/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
  291. package/node_modules/tree-sitter/src/addon_data.h +47 -0
  292. package/node_modules/tree-sitter/src/binding.cc +35 -0
  293. package/node_modules/tree-sitter/src/conversions.cc +140 -0
  294. package/node_modules/tree-sitter/src/conversions.h +22 -0
  295. package/node_modules/tree-sitter/src/language.cc +105 -0
  296. package/node_modules/tree-sitter/src/language.h +17 -0
  297. package/node_modules/tree-sitter/src/logger.cc +70 -0
  298. package/node_modules/tree-sitter/src/logger.h +19 -0
  299. package/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
  300. package/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
  301. package/node_modules/tree-sitter/src/node.cc +1088 -0
  302. package/node_modules/tree-sitter/src/node.h +30 -0
  303. package/node_modules/tree-sitter/src/parser.cc +332 -0
  304. package/node_modules/tree-sitter/src/parser.h +35 -0
  305. package/node_modules/tree-sitter/src/query.cc +425 -0
  306. package/node_modules/tree-sitter/src/query.h +40 -0
  307. package/node_modules/tree-sitter/src/tree.cc +316 -0
  308. package/node_modules/tree-sitter/src/tree.h +45 -0
  309. package/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
  310. package/node_modules/tree-sitter/src/tree_cursor.h +52 -0
  311. package/node_modules/tree-sitter/tree-sitter.d.ts +1083 -0
  312. package/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1478 -0
  313. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
  314. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
  315. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +291 -0
  316. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
  317. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
  318. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
  319. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +523 -0
  320. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
  321. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
  322. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +293 -0
  323. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +293 -0
  324. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
  325. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +483 -0
  326. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +54 -0
  327. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +12 -0
  328. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +875 -0
  329. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2297 -0
  330. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +286 -0
  331. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +48 -0
  332. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/portable/endian.h +241 -0
  333. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4347 -0
  334. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
  335. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
  336. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +912 -0
  337. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
  338. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1034 -0
  339. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +399 -0
  340. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +170 -0
  341. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
  342. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +716 -0
  343. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
  344. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/ts_assert.h +11 -0
  345. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
  346. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
  347. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
  348. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
  349. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
  350. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
  351. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
  352. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
  353. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
  354. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +75 -0
  355. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +24 -0
  356. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +137 -0
  357. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1314 -0
  358. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1937 -0
  359. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
  360. package/package.json +24 -6
  361. package/src/acceptance.js +380 -0
  362. package/src/array.js +19 -0
  363. package/src/artifact-path.js +34 -0
  364. package/src/artifacts.js +420 -0
  365. package/src/backends/c-runtime.js +151 -0
  366. package/src/backends/c-validation.js +83 -0
  367. package/src/backends/c.js +308 -0
  368. package/src/backends/cpp-runtime.js +99 -0
  369. package/src/backends/cpp-validation.js +70 -0
  370. package/src/backends/cpp.js +285 -0
  371. package/src/backends/csharp.js +270 -0
  372. package/src/backends/go.js +383 -0
  373. package/src/backends/identifiers.js +80 -1
  374. package/src/backends/index.js +23 -32
  375. package/src/backends/native-validation.js +64 -0
  376. package/src/backends/ordered-expressions.js +161 -0
  377. package/src/backends/python.js +175 -0
  378. package/src/backends/scalars.js +8 -1
  379. package/src/backends/shared.js +64 -17
  380. package/src/binary-mapping.js +305 -0
  381. package/src/diagnostic.js +34 -2
  382. package/src/frontends/c-parser.js +17 -0
  383. package/src/frontends/c.js +780 -0
  384. package/src/frontends/cpp-parser.js +18 -0
  385. package/src/frontends/cpp.js +816 -0
  386. package/src/frontends/csharp.js +759 -0
  387. package/src/frontends/go.js +770 -0
  388. package/src/frontends/index.js +5 -20
  389. package/src/frontends/python.js +689 -0
  390. package/src/frontends/scalars.js +20 -0
  391. package/src/language-registry.js +454 -0
  392. package/src/mapping.js +2 -1
  393. package/src/semantic/location.js +10 -0
  394. package/src/semantic/provenance.js +2 -2
  395. package/src/semantic/types.js +124 -1
  396. package/src/subprocess.js +232 -0
  397. package/src/timeout.js +12 -0
  398. package/src/toolchains.js +448 -0
  399. package/tsconfig.json +1 -0
package/docs/testing.md CHANGED
@@ -1,6 +1,110 @@
1
1
  # Testing
2
2
 
3
- Specs use the released `@velocious/testing@0.0.0` framework and standalone `velocious-test` runner with one top-level `describe` per file. Direct value checks use the framework's `expect` API where it improves clarity; predicate-rich diagnostic assertions retain `node:assert/strict`. Frontend tests load real fixtures through Babel, php-parser, Prism, and Lezer and compare modeled meaning after removing source locations and the separately tested provenance index. They separately assert normalized JSDoc and TypeScript types and verify locations exist.
3
+ ## Task 018 C operational qualification
4
+
5
+ The canonical Ubuntu 26.04 development image installs `clang=1:21.1.6-71`, `clang-21=1:21.1.8-6ubuntu1`, and `libclang-rt-21-dev=1:21.1.8-6ubuntu1`. These exact installed versions were read with `dpkg-query -W clang clang-21 libclang-rt-21-dev`. The `clang` metapackage version differs from the compiler version; the discovered executable is Ubuntu Clang 21.1.8 at `/usr/lib/llvm-21/bin/clang`, target `x86_64-pc-linux-gnu`. Compiler-rt is required for ASan/UBSan and leak detection. Missing tools or runtime libraries fail the C lane; sanitizer coverage is mandatory on this qualified Linux platform.
6
+
7
+ The source-independent root `Dockerfile` remains the canonical image definition and `compose.yml` service `dev` remains the canonical lane. An operator can reproduce the package prerequisite on Ubuntu 26.04 with:
8
+
9
+ ```sh
10
+ sudo apt-get update
11
+ sudo apt-get install --yes --no-install-recommends clang=1:21.1.6-71 clang-21=1:21.1.8-6ubuntu1 libclang-rt-21-dev=1:21.1.8-6ubuntu1
12
+ dpkg-query -W clang clang-21 libclang-rt-21-dev
13
+ clang --version
14
+ clang -dumpmachine
15
+ clang -print-resource-dir
16
+ test "$(clang -dumpversion)" = "21.1.8"
17
+ test "$(clang -dumpmachine)" = "x86_64-pc-linux-gnu"
18
+ test -r "$(clang -print-resource-dir)/lib/linux/libclang_rt.asan-x86_64.a"
19
+ test -r "$(clang -print-resource-dir)/lib/linux/libclang_rt.ubsan_standalone-x86_64.a"
20
+ ```
21
+
22
+ TensorBuzz uses the standard Peakflow Ubuntu 24.04 (`noble`) base, not the development image. Its package repositories cannot resolve the Ubuntu 26.04 pins above. CI instead installs the exact Clang 21.1.8 and compiler-rt builds from the official signed LLVM Noble repository and selects `/usr/bin/clang-21` through `SEMANTIFOLD_CLANG`. The signing key is checksum-pinned before APT receives it, and the repository is restricted to that key through `signed-by`; there is no unsigned package or unpinned compiler fallback. The checked-in `tensorbuzz.yml` owns the executable CI setup:
23
+
24
+ ```sh
25
+ sudo apt-get install --yes --no-install-recommends php-cli python3 ruby default-jdk-headless dotnet-sdk-10.0 ca-certificates curl gnupg
26
+ curl --fail --silent --show-error --location https://apt.llvm.org/llvm-snapshot.gpg.key --output /tmp/semantifold-llvm.asc
27
+ printf '%s %s\n' '8b2a587ffd672c4687e7581dad4b2f6c1bb2ad6b480cd9771ba2ff48e0b8c75d' '/tmp/semantifold-llvm.asc' | sha256sum --check -
28
+ sudo install -D -m 0644 /tmp/semantifold-llvm.asc /etc/apt/keyrings/llvm.asc
29
+ printf '%s\n' 'deb [arch=amd64 signed-by=/etc/apt/keyrings/llvm.asc] https://apt.llvm.org/noble/ llvm-toolchain-noble-21 main' | sudo tee /etc/apt/sources.list.d/semantifold-llvm21.list
30
+ sudo apt-get update
31
+ sudo apt-get install --yes --no-install-recommends clang-21=1:21.1.8~++20251221032922+2078da43e25a-1~exp1~20251221153059.70 libclang-rt-21-dev=1:21.1.8~++20251221032922+2078da43e25a-1~exp1~20251221153059.70
32
+ clang-21 --version
33
+ clang-21 -dumpmachine
34
+ clang-21 -print-resource-dir
35
+ test "$(clang-21 -dumpversion)" = "21.1.8"
36
+ test "$(clang-21 -dumpmachine)" = "x86_64-pc-linux-gnu"
37
+ test -r "$(clang-21 -print-resource-dir)/lib/linux/libclang_rt.asan-x86_64.a"
38
+ test -r "$(clang-21 -print-resource-dir)/lib/linux/libclang_rt.ubsan_standalone-x86_64.a"
39
+ ```
40
+
41
+ The standard CI base was qualified at `peakflow/base-ubuntu-24-04@sha256:9b23d3d5f82a8babb312b7ce549e02d60a6f32344b0088b90d3f486a9d8207a5`: signed APT installation plus UID1000 compile/link/run passed at O0/O2, ordinary and ASan/UBSan/leak profiles. The development image retains its working Ubuntu 26.04 package pins and prints the same compiler probes. Provider versions/authentication, container replacement and host preparation remain external. Package pins can become unavailable if Ubuntu repositories retire them; that is an operational failure requiring deliberate requalification, never a skip or unpinned fallback.
42
+
43
+ For an already materialized generated `program.c` and `semantifold_runtime.h`, use separate compile, link and native execution commands in a fresh directory:
44
+
45
+ ```sh
46
+ export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC
47
+ clang --no-default-config -std=c17 -Wall -Wextra -Werror -pedantic-errors -Wconversion -Wsign-conversion -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wformat=2 -ftrapv -finput-charset=UTF-8 -fexec-charset=UTF-8 -fno-color-diagnostics -O0 -c program.c -o program.o
48
+ clang --no-default-config -O0 program.o -o program
49
+ ./program
50
+ ```
51
+
52
+ Repeat with `-O2`. For both optimizations, repeat compilation and linking with `-g -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer`, then execute with `ASAN_OPTIONS=detect_leaks=1:halt_on_error=1:allocator_may_return_null=1` and `UBSAN_OPTIONS=halt_on_error=1`. The initial UID1000 image qualification passed all four profiles with exact `OK\n`, status zero and empty stderr. Repository C specs independently compile/link/run generated artifacts under all four profiles and compare raw stdout bytes, decoded stdout, stderr and status. Their native byte capture is private test infrastructure; the public acceptance API/lifecycle is unchanged.
53
+
54
+ The C focused files are `c-registry-toolchain.spec.js`, `c-frontend-validation.spec.js`, `c-backend-validation.spec.js`, `c-ordered-expressions.spec.js`, `c-provenance.spec.js`, `c-native-execution.spec.js`, `c-runtime-ownership.spec.js`, and `c-cross-language-acceptance.spec.js`, all under `spec/`. Run explicit files sequentially, for example:
55
+
56
+ ```sh
57
+ npm run verify:legacy-runtime
58
+ npx velocious-test spec/c-frontend-validation.spec.js
59
+ npx velocious-test spec/c-ordered-expressions.spec.js
60
+ npx velocious-test spec/c-native-execution.spec.js
61
+ npx velocious-test spec/c-runtime-ownership.spec.js
62
+ npx velocious-test spec/c-cross-language-acceptance.spec.js
63
+ ```
64
+
65
+ The ownership spec separately compiles native linker instrumentation for `--wrap=malloc` and `--wrap=free`: exact allocation/free counts are checked at normal/fatal exit, the second allocation can fail deterministically, and duplicate/foreign frees are fatal. It never patches a dependency or adds a runtime test hook. Direct native header probes cover invalid lengths, metadata overflow and cumulative arena limits before any borrowed memory access. Signed-64-bit minimum/maximum output and all four arithmetic failures execute at O0/O2 with and without sanitizers. Compile, link and native status failures are tested independently, including removal of their temporary directories. Unicode/NUL copies, returned slices, every operator/consumer, eager ordering, both short-circuit paths, branch fallthrough, forward calls, recursion and unused bindings execute through real Clang.
66
+
67
+ The unchanged legacy parser has a measured 32,767-UTF-16-code-unit source limit (including comments and whitespace). Direct parsing succeeds at that boundary, including astral comment text, and fails at 32,768. Both C source validation and exact generated-size preflight enforce it with located diagnostics before artifacts; no parser payload or consumer setting changes. Clang itself accepts larger generated programs, so native compilation alone cannot establish round-trip support. Strict C17 additionally rejects decoded literals above 4095 bytes; runtime concatenations can exceed that literal limit. The focused C specs execute the accepted literal boundary and nested-region round trips, and reject larger unrepresentable input/output before artifacts.
68
+
69
+ The five C Tasks 001–004 fixtures generate/reparse/execute all original-five targets using real PHP, Ruby, Node, TypeScript/Node and Java compiler/runtime commands. One original-five source rotates through each C profile. Rich/v3 tests verify token origins, synthetic context, shared occurrences, stale metadata and UTF-16 coordinates. Negative corpora cover parser recovery, preprocessing/declarators, ownership/pointers, collisions, malformed IR and every ordered-region boundary. [The C profile](c.md) specifies the exact source, memory and overflow contracts.
70
+
71
+ For this delivery, local testing is restricted to explicitly named changed/affected files. Aggregate `npm test`, directories and shards run only in TensorBuzz, whose end-to-end label includes ten languages and mandatory C/CPP O0/O2 sanitizers. Existing generic aggregate examples below describe that CI gate. Coordinator-owned independent review, exact-head CI and merge remain separate from local implementation delivery; publication/version/tag/release is not part of Tasks 018–019.
72
+
73
+ Specs use the released `@velocious/testing@0.0.0` framework and standalone `velocious-test` runner with one top-level `describe` per file. Direct value checks use the framework's `expect` API where it improves clarity; predicate-rich diagnostic assertions retain `node:assert/strict`. Frontend tests load real fixtures through Babel, php-parser, Prism, Lezer, and the qualified official Tree-sitter Python/C#/Go routes and compare modeled meaning after removing source locations and the separately tested provenance index. They separately assert normalized annotations, complete named/anonymous/comment/directive traversal, parser recovery rejection, and exact UTF-16 locations.
74
+
75
+ The private `packages/tree-sitter-legacy` workspace owns source checking and parser-neutral declaration generation for the internal legacy runtime; neither package is independently publishable. Its direct spec asserts the versioned frozen plain-data C CST, ordered field-bearing children, error/missing/extra state, UTF-16 indices and positions, and a declaration surface without native types. Its distribution spec runs the root package's real `prepack`, checks that the root tarball physically contains root `tree-sitter@0.25.1` and the internal package's isolated `tree-sitter@0.21.1` plus `tree-sitter-c@0.23.2` subtree, including licenses, platform prebuilds, and source fallbacks. It installs only that root tarball into a credential-free consumer with a fresh npm cache, verifies the installed lock and full npm tree, compiles a root API type consumer, and runs modern Go beside legacy C in one Node 24 process. The temporary tarball, cache, lockfile, dependencies, and consumer are always removed; no packed archive or dependency build is committed.
76
+
77
+ `tree-sitter-legacy-install-consistency.spec.js` reproduces source edits after `npm ci` in unique isolated npm fixtures, using the real pretest/prepack hooks and a semantic change to the serializer. Each shipped file must cause a stale-payload rejection until ordinary `npm ci` refreshes the installed copy; real tar extraction proves that subsequent packs contain the edited bytes. The shared gate uses npm's source pack inventory, checks the complete installed payload except its dependency subtree, and compares bytes before runtime specs, lint, and packing. The consumer spec independently compares every bundled internal file with source. Its configuration regression uses only synthetic registry and credential settings, removes all inherited `npm_config_*` inputs and token/module-path variables case-insensitively, isolates both user and global configuration files, and checks npm's effective public registry/config/cache settings before the real fresh-cache installation.
78
+
79
+ The consumer environment must assert npm's ordinary `install-links=false` default without setting it. Root `acceptDependencies` accepts the exact private package already supplied by the bundle while retaining the local `file:` installation source. The spec runs ordinary `npm install`, full `npm ls --all`, and then clean `npm ci` from the generated consumer lock, repeating dependency, simultaneous Go/C runtime, frozen-data, and TypeScript consumer checks. Bundled lock entries have neither links nor external resolutions; real paths must remain inside the consumer. The fresh cache must contain public dependency requests but no internal or retired adapter lookup. No consumer flags, project configuration, workspace fallback, or registry release of the private name are required.
80
+
81
+ Task 015 has separate focused specs for immutable registry-derived discovery, role-specific diagnostics, safe transactional artifact sets, byte-coordinate provenance, exact tool discovery, and staged acceptance. Every caller-supplied ordered array in these contracts must be dense before element validation or iteration; each field independently retains its documented empty/non-empty rule. Error-path discovery uses controlled local fake executables. Positive runner coverage discovers and invokes real `php`, `ruby`, `node`, the lockfile-installed `tsc`, `javac`, `java`, and `go`; a missing or unsupported tool is a failure, never a skip. Runner assertions cover isolated directory cleanup, fixed `C.UTF-8` locale and UTC timezone, absence of undeclared ambient variables, exact argument arrays, and distinct invalid-input, missing, ambiguous, version, setup/materialization, launch, output-limit, nonzero-stage, signal, and timeout diagnostics. `ACCEPTANCE_LAUNCH_FAILURE` is restricted to explicit operating-system spawn errors. `ACCEPTANCE_OUTPUT_LIMIT` identifies a child that launched but exceeded the fixed 16 MiB capture limit; its diagnostic retains stage/tool/version and the deterministic limit evidence while omitting the oversized streams and child error object.
82
+
83
+ `runAcceptanceStages` sets `LANG=C.UTF-8`, `LC_ALL=C.UTF-8`, and `TZ=UTC` for every child it owns, independently of the ambient locale. The aggregate repository suite also includes older direct native execution specs that invoke real tools with `execFile` and inherit the outer test process locale. Their Unicode round trips require a UTF-8 locale, so run the aggregate suite as `LANG=C.UTF-8 LC_ALL=C.UTF-8 npm test`.
84
+
85
+ Task 016 extends the same fail-loud discovery and staged runner to configured Python 3. Native Python acceptance first invokes `python3 -m py_compile program.py`, then executes `python3 program.py` with deterministic `C.UTF-8`, `PYTHONUTF8=1`, and `PYTHONIOENCODING=utf-8`. Cross-language coverage generates and reparses Python from every original-five Tasks 001–004 fixture, then generates every original target from Python-derived IR, compiling where applicable and comparing exact runtime output. Missing Python is a test failure.
86
+
87
+ Task 017 adds the distinct ordered `restore` stage and configured .NET SDK 10 discovery. C# acceptance generates exactly `Program.cs` and `Semantifold.csproj`, then invokes `dotnet restore Semantifold.csproj --source . --no-cache --force --disable-parallel --nologo`, `dotnet build Semantifold.csproj --configuration Release --no-restore --nologo --warnaserror`, and `dotnet exec bin/Release/net10.0/Semantifold.dll` as separate stages. Tests set the .NET telemetry/first-run/no-logo/invariant variables and an isolated absolute `NUGET_PACKAGES` path. They require exact exit/stdout and no warning output. Two fresh directories must produce identical ordered artifact text/mappings/provenance and identical `Semantifold.dll`, `.deps.json`, and `.runtimeconfig.json`; path-bearing restore bookkeeping under `obj/` is intentionally not compared. Missing .NET, restore dependency/network demand, warnings, SDK major mismatch, or nondeterministic compiler output fails without a skip.
88
+
89
+ Task 024 adds configured Go 1.26.x discovery restricted to Linux/amd64; the patch release is read from the discovered toolchain rather than fixed by runtime tests. Acceptance obtains `GOROOT` from that exact `go`, requires the companion `gofmt` beside the configured or discovered executable to resolve to the same `GOROOT/bin/gofmt`, and checks `gofmt -d` before native execution. Each dependency-free generated module is run with `GOTOOLCHAIN=local`, `GOPROXY=off`, `GOSUMDB=off`, `GOVCS=off`, `CGO_ENABLED=0`, `GOENV=off`, `GOWORK=off`, `GOOS=linux`, `GOARCH=amd64`, and isolated HOME/GOPATH/build/module caches. The short-lived discovery fixture also writes exact `off` mode into its isolated Go telemetry directory before invoking the tool, then asserts that the mode file is the only telemetry state: Go 1.26 otherwise starts an unawaited uploader sidecar even in default `local` mode, which can recreate `upload/` while the fixture root is being removed. Cleanup errors remain fatal. Stages run offline `go build`, mandatory `go vet`, and `go run`, while compiler-only differential cases use the matching `go tool compile`. Tests require exact status/stdout, unchanged `go.mod`/`main.go`, no `go.sum`/`go.work`/vendor tree, and byte-identical binaries and output in two fresh directories. Missing, wrong-minor, wrong-architecture, mismatched-gofmt, download, cgo, workspace, vet, formatting, nondeterminism, telemetry leakage, or cleanup evidence fails without a skip.
90
+
91
+ | Tool ID | Canonical command | Absolute-path override | Accepted canonical version |
92
+ | --- | --- | --- | --- |
93
+ | `php` | `php` | `SEMANTIFOLD_PHP` | PHP 8.x |
94
+ | `ruby` | `ruby` | `SEMANTIFOLD_RUBY` | Ruby 3.x |
95
+ | `node` | `node` | `SEMANTIFOLD_NODE` | Node 24.x |
96
+ | `tsc` | `tsc` | `SEMANTIFOLD_TSC` | TypeScript 7.x |
97
+ | `javac` | `javac` | `SEMANTIFOLD_JAVAC` | JDK 17–29 |
98
+ | `java` | `java` | `SEMANTIFOLD_JAVA` | JRE 17–29 |
99
+ | `python` | `python3` | `SEMANTIFOLD_PYTHON` | Python 3.x |
100
+ | `dotnet` | `dotnet` | `SEMANTIFOLD_DOTNET` | .NET SDK 10.x |
101
+ | `go` | `go` | `SEMANTIFOLD_GO` | Go 1.26.x, Linux/amd64 |
102
+ | `clangpp` | `clang++` | `SEMANTIFOLD_CLANGPP` | Ubuntu Clang 21.1.8, x86_64-pc-linux-gnu, C++20/libstdc++ ABI1 |
103
+ | `clang` | `clang` | `SEMANTIFOLD_CLANG` | Ubuntu Clang 21.1.8, x86_64-pc-linux-gnu |
104
+
105
+ Canonical toolchain IDs must be non-empty primitive strings and are validated before property lookup or diagnostic formatting; malformed values normalize to `INVALID_TOOLCHAIN`, while an unknown valid string retains that string as its diagnostic identity. Discovery records the complete version output and first version line. Optional discovery and runner configuration defaults only when a field is `undefined`; explicit `null`, including in an environment entry, is invalid before lookup, setup, or launch. Explicit timeouts must be positive integers no greater than Node's exact timer ceiling of 2,147,483,647 milliseconds; larger values are rejected before lookup, setup, or launch rather than being clamped to one millisecond. Explicit environments must be ordinary or null-prototype records containing only enumerable own data properties with string or `undefined` values; inherited fields, accessors, symbol keys, collection/class instances, and other object shapes are rejected. Accepted environment values are synchronously detached before override lookup, setup, or launch. An override must be an executable absolute path resolving to a regular file; directories and other invalid file types report `TOOL_NOT_FOUND`. Canonical lookup examines the explicit PATH, accepts only executable regular files, resolves symlinks to exact paths, deduplicates aliases of the same executable, and rejects zero or multiple distinct matches. Version arguments and the accepted non-global/non-sticky version-policy expression are validated and detached before asynchronous executable lookup; the immutable discovery result retains the exact argument array that was executed, and caller mutation cannot change the pending version decision. TensorBuzz installs its pinned Node archive at `/usr/local/bin/node` and binds that exact executable through `SEMANTIFOLD_NODE`; a distinct host `/usr/bin/node` therefore cannot make the real-runtime lane ambiguous. This does not weaken canonical ambiguity detection when no override is configured. The runner inherits no ambient variables other than PATH unless the caller explicitly supplies them; locale and timezone are always normalized. Stage executable and version fields are copied and frozen before setup yields, embedded NUL is rejected before temporary-directory setup, and each completed stage returns a frozen copy of its executed argument array, so caller mutation cannot change execution or its audit record. On POSIX, version probes and acceptance stages spawn into one distinct owned process group: the configured deadline signals that exact group with `SIGTERM`, a fixed 250ms grace escalates the still-open group to `SIGKILL`, and a second fixed 250ms grace closes only the owned capture-pipe readers if an escaped descendant still retains their writers. The API then settles on the direct child's `close` event without claiming that an escaped process was terminated; captured output and timer-owned timeout classification remain unchanged. Platforms without this process-group contract fail with normalized unsupported launch/version diagnostics before spawning rather than claiming descendant cleanup. Timeout diagnostics derive from timer ownership rather than a subprocess signal, so spontaneous signals remain `TOOL_VERSION_FAILURE` or `ACCEPTANCE_SIGNAL` with their exact evidence. If a stage and isolated-directory cleanup both fail, the stage diagnostic remains primary with its exact stage, exit, signal, and bounded output fields; a bounded `ACCEPTANCE_CLEANUP_FAILURE` diagnostic is retained in its cause chain. Cleanup failure after successful stages remains `ACCEPTANCE_CLEANUP_FAILURE`.
106
+
107
+ TERM-to-KILL escalation coverage does not assume a spawned fixture has already executed its first instruction. A focused spec at the internal subprocess owner creates an executor with instance-owned spawn observation that begins its test deadline only after the fixture emits process-boundary readiness; the production executor continues to register directly on the child's `spawn` event. The internal factory is absent from the package export map, and no Node builtin binding or shared test dependency is replaced. The fixture records readiness only after installing its TERM handler and capturing its Linux PID/start-time/process-group/session identity. Assertions retain the exact `SIGKILL` result and `SIGTERM` evidence and require both that identity and its complete owned group to disappear, while high-level discovery and acceptance coverage retains timeout-diagnostic translation without timing delays, retries, or relaxed signal expectations.
4
108
 
5
109
  Backend tests start from one parsed semantic module, generate every target, parse each generated program back to equivalent modeled meaning, and work in isolated `mkdtemp` directories. They invoke real commands and assert exact `5\n` output:
6
110
 
@@ -9,10 +113,15 @@ Backend tests start from one parsed semantic module, generate every target, pars
9
113
  - `node program.js`
10
114
  - local lockfile-installed `tsc program.ts`, then `node program.js`
11
115
  - `javac Main.java`, then `java -cp … Main`
116
+ - `python3 -m py_compile program.py`, then `python3 program.py` with `PYTHONUTF8=1` and `PYTHONIOENCODING=utf-8`
117
+ - C#'s separate local-only `dotnet restore`, `dotnet build --no-restore`, and `dotnet exec` commands above
118
+ - matching-GOROOT `gofmt -d`, then isolated offline `go build`, `go vet`, and `go run`
12
119
 
13
120
  Cleanup runs in `finally`. A missing tool raises the process error and fails the spec; there are no skip branches or mocked compilers. Diagnostic specs cover unsupported syntax, missing JSDoc types, and backend capability rejection.
14
121
 
15
- Mapping specs assert all 25 frontend/backend combinations, exact/anchor/synthetic coverage without gaps, semantic-token roles, deterministic source/node/symbol IDs, exact `sourcesContent`, independently decoded v3 maps, rich/v3 composition, malformed caller metadata repair, legacy modules, caller-assembled multi-source IR, and deterministic JSON round trips. Transformation regressions cover same-kind function reorder, insertion, deletion, cloning, ID regeneration, source ownership, shared parameter, expression, and statement occurrences, and their distinct JSON-pointer node identities. UTF-16 cases cover BMP/astral text plus LF, canonical CRLF, and lone CR; escaped Babel identifiers cover declarations, references, and calls. Imported maps are checked against TraceMap on unmapped prefixes and lines; content-backed EOF anchors, including empty sources, round-trip as exact points, while mapped imports without source content are rejected before offset construction. Composition coverage includes derived intermediate provenance that resolves only to unmapped synthetic content, untraced intermediate EOF points whose registry source must remain available, and ordering where a later range remains traceable. Identity-index coverage checks direct, derived, and synthetic-related node/symbol associations for ordered deduplication. External directive coverage includes mixed parent-relative depths and resolution to the advertised map path. A bounded 50-to-200-function scaling test guards linear validation and indexed lookups; deterministic operation-count coverage guards Babel token indexing without wall-clock thresholds. A real `tsc` map is composed through generated TypeScript to original Ruby source. A separate mapped-artifact acceptance executes PHP, Ruby, Node, TypeScript through real `tsc`/Node, and Java through real `javac`/`java`; unavailable commands fail. SHA-256 characterization checks preserve every existing base/local generated byte across all source languages and targets.
122
+ Mapping specs assert all 36 frontend/backend combinations, exact/anchor/synthetic coverage without gaps, semantic-token roles, deterministic source/node/symbol IDs, exact `sourcesContent`, independently decoded v3 maps, rich/v3 composition, malformed caller metadata repair, legacy modules, caller-assembled multi-source IR, and deterministic JSON round trips. Transformation regressions cover same-kind function reorder, insertion, deletion, cloning, ID regeneration, source ownership, shared parameter, expression, and statement occurrences, and their distinct JSON-pointer node identities. UTF-16 cases cover BMP/astral text plus LF, canonical CRLF, and lone CR; escaped Babel identifiers cover declarations, references, and calls. Imported maps are checked against TraceMap on unmapped prefixes and lines; content-backed EOF anchors, including empty sources, round-trip as exact points, while mapped imports without source content are rejected before offset construction. Composition coverage includes derived intermediate provenance that resolves only to unmapped synthetic content, untraced intermediate EOF points whose registry source must remain available, and ordering where a later range remains traceable. Identity-index coverage checks direct, derived, and synthetic-related node/symbol associations for ordered deduplication. External directive coverage includes mixed parent-relative depths and resolution to the advertised map path. A bounded 50-to-200-function scaling test guards linear validation and indexed lookups; deterministic operation-count coverage guards Babel token indexing without wall-clock thresholds. A real `tsc` map is composed through generated TypeScript to original Ruby source. Mapped-artifact acceptance executes PHP, Ruby, Node, TypeScript through real `tsc`/Node, Java through real `javac`/`java`, and Python through its configured interpreter after `py_compile`; unavailable commands fail. SHA-256 characterization checks preserve every existing base/local generated byte across all original source languages and targets.
123
+
124
+ Task 016 adds mapped Python execution through the configured interpreter after `py_compile`; Task 017 adds the five C# profiles, C# generation into every original-five target, a rotated original-five source into C# per profile, and real deterministic .NET project execution. Task 024 adds five Go profiles into every original-five target/runtime, rotates one original-five source per profile into Go, and verifies native evaluation order, signed-64-bit boundaries, reparsing, and deterministic binary/output behavior. The original-six SHA-256 characterizations remain unchanged.
16
125
 
17
126
  Local-binding fixtures cover initialized mutable and immutable declarations, plain assignment, function/branch/entry sequencing, exact Ruby/PHP profile metadata, and source locations in all five frontends. Focused negatives cover every declaration/assignment exclusion, declaration-before-use, unresolved and duplicate bindings, callable-name and lexical no-shadowing, immutable parameters/locals, exact type preservation, and RHS-before-target validation. Ruby coverage rejects profile-like tag misspellings, places multibyte text before later function and local carrier comments, asserts their UTF-16 locations, and reparses generated Ruby with the same offset shift. Backend shape coverage applies missing, null, primitive, array, sparse, and unsupported-object values to recursive blocks, statement elements, declaration/assignment fields, and recursively nested call expressions, proving caller-supplied malformed IR receives the nearest located capability diagnostic before emitter dispatch. Backend runtime coverage regenerates and reparses the same binding/mutability semantics, then executes the result through all five real toolchains with exact `yes\n` output. Target-focused coverage rejects JavaScript/TypeScript `console` and Java `args`/`System` entry captures, JavaScript/TypeScript `console` and Java `System` function parameter/local print-receiver captures, and JavaScript/TypeScript `console` and Ruby `puts` function captures before emission. Real `tsc`, PHP, and Ruby coverage demonstrates their strict or reserved binding failures and requires located target-backend rejection for each proven declaration/assignment role. The PHP probe matrix separately covers automatic-global parameters, the narrower `GLOBALS`/`this` assignment restriction, legal function names, assignable non-`GLOBALS` superglobals, ordinary predefined variables, and exact-case near-collisions; other runtime coverage executes safe JavaScript behavior, Ruby `_10`, and TypeScript near-collisions.
18
127
 
@@ -22,4 +131,23 @@ Typed-operation fixtures cover all 18 closed unary/binary operations and explici
22
131
 
23
132
  Focused correction specs prove that unsafe numeric literals never enter the semantic tree; async/generator flags are rejected; Java receivers, unsupported arguments, and extra entry statements cannot disappear; Ruby annotations and parameter forms stay function-local; and PHP accepts only its precise strict-types declaration. Backend specs cover target reserved identifiers, Java's signed 32-bit range, and exact one-return branch cardinality. Repository-contract specs parse package metadata, Compose/TensorBuzz YAML, and the Dockerfile AST; they prove the custom ESLint plugin uses an immutable commit and TensorBuzz is the sole CI topology.
24
133
 
25
- Run `npx velocious-test spec/repository-contract.spec.js` for the focused repository contract and `npm test` for framework-native discovery of `.spec.js` files under `spec`. An empty selection is a framework failure and exits nonzero. Run `npm run lint`, `npm run typecheck`, and `npm run build` for source quality and declaration generation. Packaging validation is documented in the root README and `AGENTS.md`.
134
+ Run `npx velocious-test spec/repository-contract.spec.js` for the focused repository contract and `npm test` for framework-native discovery of `.spec.js` files under `spec`. An empty selection is a framework failure and exits nonzero. Run `npm run lint`, `npm run typecheck`, and `npm run build` for source quality and declaration generation. Inspect `npm pack --dry-run --json`; the focused packed-consumer spec performs the stronger real root-tarball installation proof. Packaging validation is also documented in the root README and `AGENTS.md`.
135
+
136
+ ## Task019 CPP acceptance
137
+
138
+ The CPP lane selects `/usr/bin/clang++-21` through `SEMANTIFOLD_CLANGPP`; C retains `SEMANTIFOLD_CLANG`. The development image pins libstdc++-15-dev 15.2.0-16ubuntu1 and already obtains clang++ from the exact clang-21 package. Noble TensorBuzz reuses the signed LLVM21 setup above, explicitly installs g++-13/libstdc++ headers, probes clang++ and libstdc++, and runs framework-native discovery of all ten languages. [The CPP profile](cpp.md) lists every compile/link, encoding, warning, exception/RTTI and sanitizer flag. Local validation uses explicit named spec files only; full-suite discovery belongs to TensorBuzz.
139
+
140
+ ```sh
141
+ export SEMANTIFOLD_CLANG=/usr/bin/clang-21
142
+ export SEMANTIFOLD_CLANGPP=/usr/bin/clang++-21
143
+ npx velocious-test spec/cpp-native-execution.spec.js
144
+ npx velocious-test spec/cpp-runtime-values.spec.js
145
+ npx velocious-test spec/cpp-cross-language-acceptance.spec.js
146
+ npx velocious-test spec/tree-sitter-legacy-packed-consumer.spec.js
147
+ ```
148
+
149
+ Each native spec executes O0/O2, ordinary and ASan/UBSan/leak profiles, with byte/stdout/stderr/status assertions and fresh-directory cleanup. The original-five crossing spec invokes real PHP, Ruby, Node, tsc, javac and java; none may silently skip. The packed consumer proves ordinary install and clean npm ci with fresh cache, empty configs, default install-links=false, both bundled runtime paths, CPP and C frozen data, modern Go loading, and public CPP parse/generate/reparse/types.
150
+
151
+ ## Release-version package verification
152
+
153
+ Repository delivery checks validate a stable SemVer root version and require both lockfile version entries to match it. Packed-consumer checks compare the packed and installed package versions with the source manifest, rather than pinning a historical release. When validating a release candidate, run `npx velocious-test spec/repository-contract.spec.js spec/tree-sitter-legacy-packed-consumer.spec.js` on the actual candidate version; all existing runtime isolation, ordinary install/ci, and strict TypeScript checks remain mandatory.
package/index.js CHANGED
@@ -2,8 +2,18 @@
2
2
 
3
3
  import {parseSource} from "./src/frontends/index.js"
4
4
  import {generateArtifactSource, generateSource} from "./src/backends/index.js"
5
+ import {createGeneratedArtifactSet as constructArtifactSet} from "./src/artifacts.js"
6
+ import {SemantifoldDiagnostic} from "./src/diagnostic.js"
7
+ import {languageRegistry} from "./src/language-registry.js"
5
8
 
6
- export {SemantifoldDiagnostic} from "./src/diagnostic.js"
9
+ const artifactBackendRoles = new Set(["text", "binary", "application"])
10
+
11
+ export {SemantifoldDiagnostic}
12
+ export {languageCapabilities, supportedLanguages} from "./src/language-registry.js"
13
+ export {createGeneratedArtifactSet} from "./src/artifacts.js"
14
+ export {createByteMapping, parseByteMapping, stringifyByteMapping} from "./src/binary-mapping.js"
15
+ export {canonicalToolchains, discoverCanonicalToolchain, discoverToolchain} from "./src/toolchains.js"
16
+ export {runAcceptanceStages} from "./src/acceptance.js"
7
17
  export {getNodeProvenance, getSymbolProvenance} from "./src/semantic/provenance.js"
8
18
  export {primaryLocation} from "./src/semantic/provenance.js"
9
19
  export {
@@ -21,9 +31,6 @@ export {
21
31
  toSourceMapV3
22
32
  } from "./src/mapping.js"
23
33
 
24
- /** @type {readonly import("./src/semantic/types.js").SemanticLanguage[]} */
25
- export const supportedLanguages = Object.freeze(["php", "ruby", "javascript", "typescript", "java"])
26
-
27
34
  /**
28
35
  * Parses source into Semantifold's shared semantic representation.
29
36
  * @param {object} input - Parse request.
@@ -61,3 +68,101 @@ export function generate(input) {
61
68
  export function generateArtifact(input) {
62
69
  return generateArtifactSource(input)
63
70
  }
71
+
72
+ /**
73
+ * Generates a deterministic artifact set for one semantic module.
74
+ * @param {object} input - Artifact-set generation request.
75
+ * @param {string} input.language - Registered target language or platform ID.
76
+ * @param {import("./src/semantic/types.js").SemanticModule} input.module - Semantic module.
77
+ * @param {"text" | "binary" | "application"} [input.role] - Requested backend artifact role.
78
+ * @param {string} [input.filename] - Safe output path for a text target.
79
+ * @param {"none" | "external" | "inline"} [input.mapDirective] - JavaScript-family map directive.
80
+ * @param {string} [input.sourceMapFilename] - External map filename.
81
+ * @param {{filename: string, content: string, language?: import("./src/semantic/types.js").SemanticLanguage}[]} [input.sources] - Original sources.
82
+ * @returns {import("./src/semantic/types.js").GeneratedArtifactSet} Complete generated set.
83
+ */
84
+ export function generateArtifactSet(input) {
85
+ if (!input || typeof input != "object" || Array.isArray(input) || Object.getPrototypeOf(input) != Object.prototype) {
86
+ throw new SemantifoldDiagnostic({
87
+ code: "INVALID_ARTIFACT_SET",
88
+ language: "artifact",
89
+ message: "Artifact-set generation requires a request object."
90
+ })
91
+ }
92
+ const {filename, language, mapDirective, module, role = "text", sourceMapFilename, sources} = input
93
+
94
+ if (typeof language != "string" || language.length == 0) {
95
+ throw new SemantifoldDiagnostic({
96
+ code: "INVALID_ARTIFACT_SET",
97
+ language: "artifact",
98
+ message: "Artifact-set generation requires a non-empty string language or target ID."
99
+ })
100
+ }
101
+ if (typeof role != "string" || !artifactBackendRoles.has(role)) {
102
+ throw new SemantifoldDiagnostic({
103
+ code: "INVALID_ARTIFACT_SET",
104
+ language,
105
+ message: "Artifact backend role must be 'text', 'binary', or 'application'."
106
+ })
107
+ }
108
+
109
+ if (role == "text") {
110
+ const record = languageRegistry.record(language)
111
+
112
+ if (record.artifactMultiplicity == "multiple") {
113
+ const backend = languageRegistry.resolve(language, "textBackend", module?.location)
114
+
115
+ return constructArtifactSet(backend({filename, language, mapDirective, module, sourceMapFilename, sources}))
116
+ }
117
+ const artifact = generateArtifactSource({
118
+ filename,
119
+ language: /** @type {import("./src/semantic/types.js").SemanticLanguage} */ (language),
120
+ mapDirective,
121
+ module,
122
+ sourceMapFilename,
123
+ sources
124
+ })
125
+
126
+ /** @type {import("./src/semantic/types.js").GeneratedSetArtifact[]} */
127
+ const artifacts = [{
128
+ content: artifact.code,
129
+ contentKind: "text",
130
+ mediaType: /** @type {string} */ (record.mediaType),
131
+ ownership: "generated",
132
+ path: artifact.filename,
133
+ provenance: {
134
+ kind: "text",
135
+ mapping: artifact.mapping,
136
+ sourceMap: artifact.sourceMap,
137
+ sourceMapFilename: artifact.sourceMapFilename
138
+ },
139
+ role: "entry"
140
+ }]
141
+
142
+ if (mapDirective == "external") {
143
+ artifacts.push({
144
+ content: `${JSON.stringify(artifact.sourceMap)}\n`,
145
+ contentKind: "text",
146
+ mediaType: "application/json",
147
+ ownership: "generated",
148
+ path: artifact.sourceMapFilename,
149
+ provenance: {
150
+ kind: "synthetic",
151
+ reason: "Serialized Source Map v3 projection for the generated entry artifact.",
152
+ relatedOrigins: []
153
+ },
154
+ role: "mapping"
155
+ })
156
+ }
157
+
158
+ return constructArtifactSet({
159
+ artifacts,
160
+ target: language
161
+ })
162
+ }
163
+
164
+ const registryRole = role == "binary" ? "binaryBackend" : "applicationBackend"
165
+ const backend = languageRegistry.resolve(language, registryRole, module?.location)
166
+
167
+ return constructArtifactSet(backend({filename, language, module, sources}))
168
+ }
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 [Node.js API collaborators](https://github.com/nodejs/node-addon-api#collaborators)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,95 @@
1
+ # **node-addon-api module**
2
+
3
+ [![codecov](https://codecov.io/gh/nodejs/node-addon-api/branch/main/graph/badge.svg)](https://app.codecov.io/gh/nodejs/node-addon-api/tree/main)
4
+
5
+ [![NPM](https://nodei.co/npm/node-addon-api.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-addon-api/) [![NPM](https://nodei.co/npm-dl/node-addon-api.png?months=6&height=1)](https://nodei.co/npm/node-addon-api/)
6
+
7
+ This module contains **header-only C++ wrapper classes** which simplify
8
+ the use of the C based [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)
9
+ provided by Node.js when using C++. It provides a C++ object model
10
+ and exception handling semantics with low overhead.
11
+
12
+ - [API References](doc/README.md)
13
+ - [Badges](#badges)
14
+ - [Contributing](#contributing)
15
+ - [License](#license)
16
+
17
+ ## API References
18
+
19
+ API references are available in the [doc](doc/README.md) directory.
20
+
21
+ <!-- x-release-please-start-version -->
22
+ ## Current version: 8.9.2
23
+ <!-- x-release-please-end -->
24
+
25
+ (See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)
26
+
27
+ node-addon-api is based on [Node-API](https://nodejs.org/api/n-api.html) and supports using different Node-API versions.
28
+ This allows addons built with it to run with Node.js versions which support the targeted Node-API version.
29
+ **However** the node-addon-api support model is to support only the active LTS Node.js versions. This means that
30
+ every year there will be a new major which drops support for the Node.js LTS version which has gone out of service.
31
+
32
+ The oldest Node.js version supported by the current version of node-addon-api is Node.js 18.x.
33
+
34
+ ## Badges
35
+
36
+ The use of badges is recommended to indicate the minimum version of Node-API
37
+ required for the module. This helps to determine which Node.js major versions are
38
+ supported. Addon maintainers can consult the [Node-API support matrix][] to determine
39
+ which Node.js versions provide a given Node-API version. The following badges are
40
+ available:
41
+
42
+ ![Node-API v1 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v1%20Badge.svg)
43
+ ![Node-API v2 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v2%20Badge.svg)
44
+ ![Node-API v3 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v3%20Badge.svg)
45
+ ![Node-API v4 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v4%20Badge.svg)
46
+ ![Node-API v5 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v5%20Badge.svg)
47
+ ![Node-API v6 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v6%20Badge.svg)
48
+ ![Node-API v7 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v7%20Badge.svg)
49
+ ![Node-API v8 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v8%20Badge.svg)
50
+ ![Node-API v9 Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20v9%20Badge.svg)
51
+ ![Node-API Experimental Version Badge](https://github.com/nodejs/abi-stable-node/blob/doc/assets/Node-API%20Experimental%20Version%20Badge.svg)
52
+
53
+ ## Contributing
54
+
55
+ We love contributions from the community to **node-addon-api**!
56
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details on our philosophy around extending this module.
57
+
58
+ ## Team members
59
+
60
+ ### Active
61
+
62
+ | Name | GitHub Link |
63
+ | ------------------- | ----------------------------------------------------- |
64
+ | Anna Henningsen | [addaleax](https://github.com/addaleax) |
65
+ | Chengzhong Wu | [legendecas](https://github.com/legendecas) |
66
+ | Jack Xia | [JckXia](https://github.com/JckXia) |
67
+ | Kevin Eady | [KevinEady](https://github.com/KevinEady) |
68
+ | Michael Dawson | [mhdawson](https://github.com/mhdawson) |
69
+ | Nicola Del Gobbo | [NickNaso](https://github.com/NickNaso) |
70
+ | Vladimir Morozov | [vmoroz](https://github.com/vmoroz) |
71
+
72
+ <details>
73
+
74
+ <summary>Emeritus</summary>
75
+
76
+ ### Emeritus
77
+
78
+ | Name | GitHub Link |
79
+ | ------------------- | ----------------------------------------------------- |
80
+ | Arunesh Chandra | [aruneshchandra](https://github.com/aruneshchandra) |
81
+ | Benjamin Byholm | [kkoopa](https://github.com/kkoopa) |
82
+ | Gabriel Schulhof | [gabrielschulhof](https://github.com/gabrielschulhof) |
83
+ | Hitesh Kanwathirtha | [digitalinfinity](https://github.com/digitalinfinity) |
84
+ | Jason Ginchereau | [jasongin](https://github.com/jasongin) |
85
+ | Jim Schlight | [jschlight](https://github.com/jschlight) |
86
+ | Sampson Gao | [sampsongao](https://github.com/sampsongao) |
87
+ | Taylor Woll | [boingoing](https://github.com/boingoing) |
88
+
89
+ </details>
90
+
91
+ ## License
92
+
93
+ Licensed under [MIT](./LICENSE.md)
94
+
95
+ [Node-API support matrix]: https://nodejs.org/dist/latest/docs/api/n-api.html#node-api-version-matrix
@@ -0,0 +1,21 @@
1
+ {
2
+ 'variables': {
3
+ 'NAPI_VERSION%': "<!(node -p \"process.env.NAPI_VERSION || process.versions.napi\")",
4
+ 'disable_deprecated': "<!(node -p \"process.env['npm_config_disable_deprecated']\")"
5
+ },
6
+ 'conditions': [
7
+ ['NAPI_VERSION!=""', { 'defines': ['NAPI_VERSION=<@(NAPI_VERSION)'] } ],
8
+ ['NAPI_VERSION==2147483647', { 'defines': ['NAPI_EXPERIMENTAL', 'NODE_API_EXPERIMENTAL_NO_WARNING'] } ],
9
+ ['disable_deprecated=="true"', {
10
+ 'defines': ['NODE_ADDON_API_DISABLE_DEPRECATED']
11
+ }],
12
+ ['OS=="mac"', {
13
+ 'cflags+': ['-fvisibility=hidden'],
14
+ 'xcode_settings': {
15
+ 'OTHER_CFLAGS': ['-fvisibility=hidden']
16
+ }
17
+ }]
18
+ ],
19
+ 'cflags': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ],
20
+ 'cflags_cc': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ]
21
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ 'defines': [ 'NAPI_CPP_EXCEPTIONS' ],
3
+ 'cflags!': [ '-fno-exceptions' ],
4
+ 'cflags_cc!': [ '-fno-exceptions' ],
5
+ 'conditions': [
6
+ ["OS=='win'", {
7
+ "defines": [
8
+ "_HAS_EXCEPTIONS=1"
9
+ ],
10
+ "msvs_settings": {
11
+ "VCCLCompilerTool": {
12
+ "ExceptionHandling": 1,
13
+ 'EnablePREfast': 'true',
14
+ },
15
+ },
16
+ }],
17
+ ["OS=='mac'", {
18
+ 'xcode_settings': {
19
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
20
+ 'CLANG_CXX_LIBRARY': 'libc++',
21
+ 'MACOSX_DEPLOYMENT_TARGET': '10.7',
22
+ },
23
+ }],
24
+ ],
25
+ }
@@ -0,0 +1,14 @@
1
+ const path = require('path');
2
+ const { version } = require('./package.json');
3
+
4
+ const includeDir = path.relative('.', __dirname);
5
+
6
+ module.exports = {
7
+ include: `"${__dirname}"`, // deprecated, can be removed as part of 4.0.0
8
+ include_dir: includeDir,
9
+ gyp: path.join(includeDir, 'node_api.gyp:nothing'), // deprecated.
10
+ targets: path.join(includeDir, 'node_addon_api.gyp'),
11
+ version,
12
+ isNodeApiBuiltin: true,
13
+ needsFlag: false
14
+ };