@shapeshift-labs/frontier-lang-compiler 0.2.149 → 0.2.151

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 (280) hide show
  1. package/README.md +315 -9
  2. package/bench/real-repo-corpus-checkout-identity.mjs +134 -0
  3. package/bench/real-repo-corpus-checkout-proof.mjs +263 -0
  4. package/bench/real-repo-corpus-command-execution.mjs +314 -0
  5. package/bench/real-repo-corpus-evidence.mjs +165 -0
  6. package/bench/real-repo-corpus-suite.mjs +273 -0
  7. package/bench/smoke.mjs +109 -7
  8. package/dist/declarations/import-adapter-core.d.ts +4 -3
  9. package/dist/declarations/import-adapter-options-native.d.ts +21 -0
  10. package/dist/declarations/js-ts-project-merge-admission-routes.d.ts +35 -0
  11. package/dist/declarations/js-ts-project-merge-commonjs-interop.d.ts +29 -0
  12. package/dist/declarations/js-ts-project-merge-confidence.d.ts +64 -0
  13. package/dist/declarations/js-ts-project-merge-declaration-emit-parity.d.ts +37 -0
  14. package/dist/declarations/js-ts-project-merge-declarations.d.ts +65 -0
  15. package/dist/declarations/js-ts-project-merge-diagnostics.d.ts +97 -0
  16. package/dist/declarations/js-ts-project-merge-global-augmentation.d.ts +30 -0
  17. package/dist/declarations/js-ts-project-merge-jsx-render-branch.d.ts +48 -0
  18. package/dist/declarations/js-ts-project-merge-proof-levels.d.ts +109 -0
  19. package/dist/declarations/js-ts-project-merge-quality-gates.d.ts +38 -0
  20. package/dist/declarations/js-ts-project-merge-semantic-equivalence-proof.d.ts +45 -0
  21. package/dist/declarations/js-ts-project-merge-tsconfig.d.ts +43 -0
  22. package/dist/declarations/js-ts-safe-merge.d.ts +47 -0
  23. package/dist/declarations/js-ts-safe-project-merge.d.ts +120 -38
  24. package/dist/declarations/native-project-compiler-assignability-oracle.d.ts +41 -0
  25. package/dist/declarations/native-project-compiler-callable-signatures.d.ts +31 -0
  26. package/dist/declarations/native-project-compiler-class-member-runtime-proof.d.ts +87 -0
  27. package/dist/declarations/native-project-compiler-composite-types.d.ts +23 -0
  28. package/dist/declarations/native-project-compiler-enum-proof.d.ts +58 -0
  29. package/dist/declarations/native-project-compiler-index-signature.d.ts +7 -0
  30. package/dist/declarations/native-project-compiler-public-api-source-binding.d.ts +8 -0
  31. package/dist/declarations/native-project-compiler-scope.d.ts +37 -0
  32. package/dist/declarations/native-project-compiler-type-reference-targets.d.ts +38 -0
  33. package/dist/declarations/native-project-css-modules.d.ts +90 -0
  34. package/dist/declarations/native-project-decorator-metadata.d.ts +126 -0
  35. package/dist/declarations/native-project-jsx-graph.d.ts +313 -0
  36. package/dist/declarations/native-project-module-declarations.d.ts +52 -0
  37. package/dist/declarations/native-project-module-resolution.d.ts +76 -1
  38. package/dist/declarations/native-project-runtime-effect-target.d.ts +29 -0
  39. package/dist/declarations/native-project-runtime-executable-effect-evidence.d.ts +107 -0
  40. package/dist/declarations/native-project-runtime-mutation-target.d.ts +33 -0
  41. package/dist/declarations/native-project-runtime-promise-chain.d.ts +30 -0
  42. package/dist/declarations/native-project-runtime-promise-combinator.d.ts +22 -0
  43. package/dist/declarations/native-project-runtime-reachability.d.ts +30 -0
  44. package/dist/declarations/native-project-runtime-resource-management.d.ts +27 -0
  45. package/dist/declarations/native-project-runtime-yield-delegation.d.ts +10 -0
  46. package/dist/declarations/native-project-scope-template-reference.d.ts +13 -0
  47. package/dist/declarations/native-project-source-evidence.d.ts +8 -0
  48. package/dist/declarations/native-project.d.ts +40 -39
  49. package/dist/declarations/semantic-edit-script.d.ts +10 -8
  50. package/dist/declarations/semantic-graph-layers.d.ts +79 -0
  51. package/dist/declarations/semantic-patch-bundle-composition.d.ts +62 -0
  52. package/dist/declarations/semantic-sidecar.d.ts +3 -2
  53. package/dist/declarations/semantic-structural-diff.d.ts +94 -0
  54. package/dist/declarations/source-preservation.d.ts +32 -1
  55. package/dist/declarations/target-adapters.d.ts +22 -2
  56. package/dist/index.d.ts +32 -0
  57. package/dist/index.js +6 -0
  58. package/dist/internal/index-impl/compileNativeSource.js +53 -5
  59. package/dist/internal/index-impl/createLightweightNativeImport.js +58 -4
  60. package/dist/internal/index-impl/createNativeImportFromSyntaxAst.js +17 -1
  61. package/dist/internal/index-impl/createNativeImportFromTypeScriptAst.js +28 -4
  62. package/dist/internal/index-impl/createNativeProjectImportResult.js +31 -27
  63. package/dist/internal/index-impl/createNativeProjectModuleResolutionFromPackageManifests.js +145 -0
  64. package/dist/internal/index-impl/createNativeSourcePreservation.js +34 -7
  65. package/dist/internal/index-impl/createSemanticImportSidecar.js +27 -1
  66. package/dist/internal/index-impl/createTypeScriptCompilerNativeImporterAdapter.js +16 -5
  67. package/dist/internal/index-impl/dynamicImportExpressionMetadata.js +80 -0
  68. package/dist/internal/index-impl/importMetaUrlDependencyMetadata.js +176 -0
  69. package/dist/internal/index-impl/importNativeSource.js +2 -3
  70. package/dist/internal/index-impl/moduleImportAttributeMetadata.js +232 -0
  71. package/dist/internal/index-impl/projectSemanticEditScriptToSource.js +8 -1
  72. package/dist/internal/index-impl/projectSymbolGraphClassStaticBlocks.js +148 -0
  73. package/dist/internal/index-impl/projectSymbolGraphCompilerAdvancedTypeMetadata.js +45 -0
  74. package/dist/internal/index-impl/projectSymbolGraphCompilerCallableSignatureEquivalence.js +107 -0
  75. package/dist/internal/index-impl/projectSymbolGraphCompilerClassPrivateAccessorRuntimeProof.js +280 -0
  76. package/dist/internal/index-impl/projectSymbolGraphCompilerClassShapeEquivalence.js +103 -0
  77. package/dist/internal/index-impl/projectSymbolGraphCompilerConditionalTypeEquivalence.js +242 -0
  78. package/dist/internal/index-impl/projectSymbolGraphCompilerDecoratorRuntimeProof.js +197 -0
  79. package/dist/internal/index-impl/projectSymbolGraphCompilerEnumEquivalence.js +188 -0
  80. package/dist/internal/index-impl/projectSymbolGraphCompilerFacts.js +244 -0
  81. package/dist/internal/index-impl/projectSymbolGraphCompilerIndexSignatureEquivalence.js +58 -0
  82. package/dist/internal/index-impl/projectSymbolGraphCompilerMetadata.js +168 -0
  83. package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalence.js +199 -0
  84. package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalenceProof.js +204 -0
  85. package/dist/internal/index-impl/projectSymbolGraphCompilerTypeReferenceTargetEquivalence.js +99 -0
  86. package/dist/internal/index-impl/projectSymbolGraphCssModuleRecords.js +264 -0
  87. package/dist/internal/index-impl/projectSymbolGraphCssModuleScanners.js +242 -0
  88. package/dist/internal/index-impl/projectSymbolGraphCssModuleUtils.js +152 -0
  89. package/dist/internal/index-impl/projectSymbolGraphCssModules.js +82 -0
  90. package/dist/internal/index-impl/projectSymbolGraphJsxComponentImports.js +170 -0
  91. package/dist/internal/index-impl/projectSymbolGraphJsxComponentProviderLookup.js +167 -0
  92. package/dist/internal/index-impl/projectSymbolGraphJsxComponentWrappers.js +150 -0
  93. package/dist/internal/index-impl/projectSymbolGraphJsxContextTargets.js +71 -0
  94. package/dist/internal/index-impl/projectSymbolGraphJsxContextValues.js +212 -0
  95. package/dist/internal/index-impl/projectSymbolGraphJsxEventHandlers.js +172 -0
  96. package/dist/internal/index-impl/projectSymbolGraphJsxHookEffects.js +124 -0
  97. package/dist/internal/index-impl/projectSymbolGraphJsxHooks.js +281 -0
  98. package/dist/internal/index-impl/projectSymbolGraphJsxMemberComponents.js +139 -0
  99. package/dist/internal/index-impl/projectSymbolGraphJsxPropFlows.js +320 -0
  100. package/dist/internal/index-impl/projectSymbolGraphJsxPropValues.js +145 -0
  101. package/dist/internal/index-impl/projectSymbolGraphJsxProviderFlows.js +133 -0
  102. package/dist/internal/index-impl/projectSymbolGraphJsxRecords.js +315 -0
  103. package/dist/internal/index-impl/projectSymbolGraphJsxRenderCollections.js +155 -0
  104. package/dist/internal/index-impl/projectSymbolGraphJsxRenderReturns.js +291 -0
  105. package/dist/internal/index-impl/projectSymbolGraphJsxRenderRisk.js +279 -0
  106. package/dist/internal/index-impl/projectSymbolGraphModuleDeclarationShapes.js +138 -0
  107. package/dist/internal/index-impl/projectSymbolGraphModuleResolution.js +89 -87
  108. package/dist/internal/index-impl/projectSymbolGraphPackageConditions.js +314 -0
  109. package/dist/internal/index-impl/projectSymbolGraphReExportImportTargets.js +43 -0
  110. package/dist/internal/index-impl/projectSymbolGraphReExports.js +55 -1
  111. package/dist/internal/index-impl/projectSymbolGraphRuntimeRegions.js +108 -0
  112. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefAliases.js +307 -0
  113. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefLexical.js +320 -0
  114. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefOwners.js +50 -0
  115. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecordBuilders.js +112 -0
  116. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecords.js +238 -0
  117. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructural.js +104 -0
  118. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructuralNormalize.js +242 -0
  119. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefUseHashes.js +107 -0
  120. package/dist/internal/index-impl/projectSymbolGraphSourceMapGeneratedBoundary.js +111 -0
  121. package/dist/internal/index-impl/projectSymbolGraphSourceRecords.js +268 -0
  122. package/dist/internal/index-impl/projectSymbolGraphSourceRecordsOwnership.js +309 -0
  123. package/dist/internal/index-impl/replaySemanticEditProjection.js +53 -39
  124. package/dist/internal/index-impl/runtimeOrderEvidenceBinding.js +151 -0
  125. package/dist/internal/index-impl/runtimeOrderProofSurfaces.js +253 -0
  126. package/dist/internal/index-impl/semanticEditCallsiteArgumentMerge.js +319 -0
  127. package/dist/internal/index-impl/semanticEditExplicitSourceReplacement.js +7 -2
  128. package/dist/internal/index-impl/semanticEditProjectionRecord.js +8 -0
  129. package/dist/internal/index-impl/semanticEditReplayDiagnostics.js +7 -2
  130. package/dist/internal/index-impl/semanticEditReplayOutputBinding.js +61 -0
  131. package/dist/internal/index-impl/semanticEditReplayRerunRoute.js +27 -0
  132. package/dist/internal/index-impl/semanticEditReplaySourceReplacement.js +6 -1
  133. package/dist/internal/index-impl/semanticEditRuntimeOrderReasons.js +320 -0
  134. package/dist/internal/index-impl/semanticEditScriptClassification.js +90 -5
  135. package/dist/internal/index-impl/semanticEditScripts.js +42 -5
  136. package/dist/internal/index-impl/semanticEditTypeSyntaxReasons.js +134 -0
  137. package/dist/internal/index-impl/semanticIndexFromNativeDeclarations.js +11 -5
  138. package/dist/internal/index-impl/semanticPatchBundleComposition.js +166 -0
  139. package/dist/internal/index-impl/semanticStructuralDiffRecords.js +150 -0
  140. package/dist/internal/index-impl/sourceMapGeneratedBoundaryGate.js +185 -0
  141. package/dist/internal/index-impl/staticMemberLiteral.js +31 -0
  142. package/dist/internal/index-impl/staticOptionalMemberReference.js +22 -0
  143. package/dist/internal/index-impl/syntaxAstSourcePreservation.js +273 -0
  144. package/dist/internal/index-impl/syntaxCommonJsModuleDeclarationEntries.js +297 -0
  145. package/dist/internal/index-impl/syntaxModuleDeclarationEntries.js +56 -132
  146. package/dist/internal/index-impl/syntaxModuleEntryRecords.js +160 -0
  147. package/dist/internal/index-impl/typeScriptCompilerAdvancedTypeShapes.js +160 -0
  148. package/dist/internal/index-impl/typeScriptCompilerAssignabilityOracle.js +97 -0
  149. package/dist/internal/index-impl/typeScriptCompilerClassApi.js +238 -0
  150. package/dist/internal/index-impl/typeScriptCompilerDecoratorMetadata.js +290 -0
  151. package/dist/internal/index-impl/typeScriptCompilerEnumShape.js +279 -0
  152. package/dist/internal/index-impl/typeScriptCompilerFacts.js +294 -0
  153. package/dist/internal/index-impl/typeScriptCompilerInferenceSyntax.js +170 -0
  154. package/dist/internal/index-impl/typeScriptCompilerReferenceGraph.js +186 -0
  155. package/dist/internal/index-impl/typeScriptCompilerSymbolIdentity.js +294 -0
  156. package/dist/internal/index-impl/typeScriptCompilerTypeReferenceTargets.js +142 -0
  157. package/dist/internal/index-impl/typeScriptDeclaration.js +10 -38
  158. package/dist/internal/index-impl/typeScriptModuleDeclarationEntries.js +52 -15
  159. package/dist/internal/index-impl/typeScriptSourceFilePreservation.js +296 -0
  160. package/dist/js-ts-safe-member-class-invariants.js +247 -0
  161. package/dist/js-ts-safe-member-merge-result.js +23 -3
  162. package/dist/js-ts-safe-member-merge.js +28 -4
  163. package/dist/js-ts-safe-merge-binding-patterns.js +170 -0
  164. package/dist/js-ts-safe-merge-context.js +1 -0
  165. package/dist/js-ts-safe-merge-jsx-attribute-fallback.js +314 -0
  166. package/dist/js-ts-safe-merge-jsx-attribute-parser.js +277 -0
  167. package/dist/js-ts-safe-merge-jsx-child-expression-fallback.js +161 -0
  168. package/dist/js-ts-safe-merge-jsx-child-expression-merge.js +319 -0
  169. package/dist/js-ts-safe-merge-jsx-child-expression-parser.js +300 -0
  170. package/dist/js-ts-safe-merge-parse-declarations.js +46 -2
  171. package/dist/js-ts-safe-merge-parse-statements.js +8 -0
  172. package/dist/js-ts-safe-merge-plan.js +3 -1
  173. package/dist/js-ts-safe-merge-semantic-edit-fallback.js +49 -0
  174. package/dist/js-ts-safe-merge-source-shape-fallbacks.js +5 -1
  175. package/dist/js-ts-safe-merge-top-level-rename-fallback.js +31 -5
  176. package/dist/js-ts-safe-merge-top-level-rename-result.js +7 -2
  177. package/dist/js-ts-safe-merge-variable-declarator-fallback.js +124 -6
  178. package/dist/js-ts-safe-merge-variable-declarator-parser.js +34 -4
  179. package/dist/js-ts-safe-merge.js +136 -0
  180. package/dist/js-ts-safe-project-merge-admission-routes.js +216 -0
  181. package/dist/js-ts-safe-project-merge-admission.js +161 -0
  182. package/dist/js-ts-safe-project-merge-ambient.js +110 -0
  183. package/dist/js-ts-safe-project-merge-core.js +85 -0
  184. package/dist/js-ts-safe-project-merge-css-module-conflicts.js +60 -0
  185. package/dist/js-ts-safe-project-merge-declaration-emit-parity.js +186 -0
  186. package/dist/js-ts-safe-project-merge-declarations.js +227 -0
  187. package/dist/js-ts-safe-project-merge-diagnostics-metadata.js +42 -0
  188. package/dist/js-ts-safe-project-merge-diagnostics-ts.js +73 -0
  189. package/dist/js-ts-safe-project-merge-diagnostics.js +283 -0
  190. package/dist/js-ts-safe-project-merge-evidence-routing.js +38 -0
  191. package/dist/js-ts-safe-project-merge-files.js +70 -0
  192. package/dist/js-ts-safe-project-merge-global-augmentation-compatibility.js +99 -0
  193. package/dist/js-ts-safe-project-merge-graph-conflicts.js +90 -2
  194. package/dist/js-ts-safe-project-merge-graph-delta-commonjs-interop.js +108 -0
  195. package/dist/js-ts-safe-project-merge-graph-delta-compiler-conflicts.js +179 -0
  196. package/dist/js-ts-safe-project-merge-graph-delta-compiler-details.js +189 -0
  197. package/dist/js-ts-safe-project-merge-graph-delta-conflicts.js +51 -184
  198. package/dist/js-ts-safe-project-merge-graph-delta-identity-conflicts.js +202 -0
  199. package/dist/js-ts-safe-project-merge-graph-delta-inference-syntax.js +80 -0
  200. package/dist/js-ts-safe-project-merge-graph-delta-module-declarations.js +155 -0
  201. package/dist/js-ts-safe-project-merge-graph-limits.js +16 -1
  202. package/dist/js-ts-safe-project-merge-graph.js +37 -5
  203. package/dist/js-ts-safe-project-merge-import-removal.js +292 -0
  204. package/dist/js-ts-safe-project-merge-jsx-graph-conflict-details.js +235 -0
  205. package/dist/js-ts-safe-project-merge-jsx-graph-conflicts.js +173 -0
  206. package/dist/js-ts-safe-project-merge-jsx-prop-contracts.js +86 -0
  207. package/dist/js-ts-safe-project-merge-jsx-render-branch-proof.js +189 -0
  208. package/dist/js-ts-safe-project-merge-missing-evidence.js +310 -0
  209. package/dist/js-ts-safe-project-merge-move-rename.js +209 -0
  210. package/dist/js-ts-safe-project-merge-proof-conflicts.js +44 -0
  211. package/dist/js-ts-safe-project-merge-proof-levels.js +320 -0
  212. package/dist/js-ts-safe-project-merge-quality-gates.js +140 -0
  213. package/dist/js-ts-safe-project-merge-routing-calibration.js +125 -0
  214. package/dist/js-ts-safe-project-merge-runtime-region-conflicts.js +156 -0
  215. package/dist/js-ts-safe-project-merge-scope-use-def-conflicts.js +292 -0
  216. package/dist/js-ts-safe-project-merge-semantic-equivalence-proof.js +175 -0
  217. package/dist/js-ts-safe-project-merge-semantic-replay-proof.js +311 -0
  218. package/dist/js-ts-safe-project-merge-semantic-replay-routes.js +179 -0
  219. package/dist/js-ts-safe-project-merge-source-span-conflicts.js +310 -0
  220. package/dist/js-ts-safe-project-merge-source-span-roundtrip-proof.js +172 -0
  221. package/dist/js-ts-safe-project-merge-split-merge-admission.js +96 -0
  222. package/dist/js-ts-safe-project-merge-split-merge-records.js +320 -0
  223. package/dist/js-ts-safe-project-merge-split-merge-shapes.js +234 -0
  224. package/dist/js-ts-safe-project-merge-split-merge.js +218 -0
  225. package/dist/js-ts-safe-project-merge-summary.js +320 -0
  226. package/dist/js-ts-safe-project-merge-symbol-move-admission.js +63 -0
  227. package/dist/js-ts-safe-project-merge-symbol-move-default-admission.js +143 -0
  228. package/dist/js-ts-safe-project-merge-symbol-move-risks.js +213 -0
  229. package/dist/js-ts-safe-project-merge-symbol-move.js +316 -0
  230. package/dist/js-ts-safe-project-merge-symbol-rename-admission.js +59 -0
  231. package/dist/js-ts-safe-project-merge-symbol-rename-default-admission.js +111 -0
  232. package/dist/js-ts-safe-project-merge-symbol-rename.js +319 -0
  233. package/dist/js-ts-safe-project-merge-ts-options.js +205 -0
  234. package/dist/js-ts-safe-project-merge-ts-program.js +268 -0
  235. package/dist/js-ts-safe-project-merge-typed-property-rename-rebase-utils.js +69 -0
  236. package/dist/js-ts-safe-project-merge-typed-property-rename-rebase.js +317 -0
  237. package/dist/js-ts-safe-project-merge-unsupported-surfaces.js +319 -0
  238. package/dist/js-ts-safe-project-merge.js +171 -172
  239. package/dist/js-ts-semantic-scope-use-def-bindings.js +287 -0
  240. package/dist/js-ts-semantic-scope-use-def-scan.js +241 -0
  241. package/dist/js-ts-semantic-scope-use-def-utils.js +132 -0
  242. package/dist/js-ts-semantic-scope-use-def.js +217 -0
  243. package/dist/lightweight-dependency-effects.js +28 -4
  244. package/dist/lightweight-dependency-relations.js +13 -7
  245. package/dist/lightweight-dependency-top-level.js +63 -0
  246. package/dist/native-import-language-profiles.js +27 -1
  247. package/dist/native-js-ts-importers.js +9 -5
  248. package/dist/native-parser-ast-format-profiles.js +12 -0
  249. package/dist/native-parser-html-css-format-profiles.js +85 -0
  250. package/dist/native-region-scanner-core.js +5 -3
  251. package/dist/native-region-scanner-js-commonjs.js +155 -0
  252. package/dist/native-region-scanner-js-imports.js +51 -13
  253. package/dist/native-region-scanner-js-reexports.js +79 -0
  254. package/dist/native-region-scanner-js-ts-helpers.js +23 -0
  255. package/dist/native-source-ledger-helpers.js +1 -1
  256. package/dist/native-source-ledger.js +24 -10
  257. package/dist/native-source-maps-ecma426.js +316 -0
  258. package/dist/native-source-maps.js +36 -6
  259. package/dist/native-source-preservation-ownership.js +292 -0
  260. package/dist/native-source-preservation-scanner.js +63 -25
  261. package/dist/native-source-preservation-types.d.ts +3 -0
  262. package/dist/semantic-import-effect-occurrences.js +242 -0
  263. package/dist/semantic-import-effect-regions.js +95 -58
  264. package/dist/semantic-import-graph-layers.js +224 -0
  265. package/dist/semantic-import-runtime-conditional-evidence.js +135 -0
  266. package/dist/semantic-import-runtime-effect-target-evidence.js +145 -0
  267. package/dist/semantic-import-runtime-exit-evidence.js +32 -0
  268. package/dist/semantic-import-runtime-import-meta-evidence.js +33 -0
  269. package/dist/semantic-import-runtime-mutation-evidence.js +155 -0
  270. package/dist/semantic-import-runtime-order-evidence.js +318 -0
  271. package/dist/semantic-import-runtime-promise-chain-evidence.js +103 -0
  272. package/dist/semantic-import-runtime-promise-combinator-evidence.js +166 -0
  273. package/dist/semantic-import-runtime-reachability-evidence.js +269 -0
  274. package/dist/semantic-import-runtime-resource-management-evidence.js +293 -0
  275. package/dist/semantic-import-runtime-switch-evidence.js +304 -0
  276. package/dist/semantic-import-runtime-throw-evidence.js +44 -0
  277. package/dist/semantic-import-runtime-try-finally-evidence.js +172 -0
  278. package/dist/semantic-import-sidecar-entry.js +4 -0
  279. package/dist/semantic-import-source-preservation.js +6 -2
  280. package/package.json +1 -1
@@ -0,0 +1,140 @@
1
+ import { compactRecord } from './js-ts-safe-merge-context.js';
2
+
3
+ const passStatuses = new Set(['passed', 'pass', 'ok', 'clean', 'accepted-clean', 'success']);
4
+ const qualityGateRerunRoute = Object.freeze({
5
+ id: 'rerun-project-quality-gate',
6
+ lane: 'quality-gates',
7
+ next: 'rerun-failing-quality-gate'
8
+ });
9
+
10
+ function createJsTsProjectMergeQualityGate(input = {}, id = 'js_ts_project_safe_merge') {
11
+ const gates = [
12
+ ...normalizeGates(input.qualityGates),
13
+ ...normalizeGates(input.lintGates, 'lint'),
14
+ ...normalizeGates(input.formatGates, 'format'),
15
+ ...normalizeGates(input.testGates, 'test'),
16
+ ...normalizeGates(input.buildGates, 'build')
17
+ ];
18
+ if (!gates.length) return undefined;
19
+ const conflicts = gates.filter((gate) => !passStatuses.has(gate.status)).map(gateConflict);
20
+ const status = conflicts.length ? 'blocked' : 'passed';
21
+ return {
22
+ kind: 'frontier.lang.jsTsProjectMergeQualityGate',
23
+ version: 1,
24
+ id: `${id}_quality_gate`,
25
+ status,
26
+ gates,
27
+ conflicts,
28
+ evidence: qualityGateEvidence(id, gates),
29
+ decision: qualityGateDecision(status, conflicts),
30
+ summary: {
31
+ gates: gates.length,
32
+ passed: gates.filter((gate) => passStatuses.has(gate.status)).length,
33
+ failed: conflicts.length,
34
+ lint: countCategory(gates, 'lint'),
35
+ format: countCategory(gates, 'format'),
36
+ test: countCategory(gates, 'test'),
37
+ build: countCategory(gates, 'build')
38
+ }
39
+ };
40
+ }
41
+
42
+ function qualityGateEvidence(id, gates) {
43
+ return gates.map((gate) => ({
44
+ id: gate.evidenceId ?? `${id}_${gate.category}_${gate.id}_evidence`,
45
+ kind: `js-ts-project-${gate.category}-gate`,
46
+ status: passStatuses.has(gate.status) ? 'passed' : 'failed',
47
+ summary: passStatuses.has(gate.status)
48
+ ? `Project ${gate.category} gate ${JSON.stringify(gate.id)} passed.`
49
+ : `Project ${gate.category} gate ${JSON.stringify(gate.id)} did not pass.`,
50
+ metadata: compactRecord({
51
+ gateId: gate.id,
52
+ category: gate.category,
53
+ command: gate.command,
54
+ artifactPath: gate.artifactPath,
55
+ admissionAction: passStatuses.has(gate.status) ? 'apply' : 'block',
56
+ nextMissingEvidence: passStatuses.has(gate.status) ? undefined : gateMissingEvidence(gate),
57
+ autoMergeClaim: false,
58
+ semanticEquivalenceClaim: false
59
+ })
60
+ }));
61
+ }
62
+
63
+ function normalizeGates(value, category) {
64
+ const entries = Array.isArray(value) ? value : value ? [value] : [];
65
+ return entries.filter((entry) => entry && typeof entry === 'object').map((entry, index) => compactRecord({
66
+ id: String(entry.id ?? entry.gateId ?? `${category ?? entry.category ?? 'quality'}_${index + 1}`),
67
+ category: String(entry.category ?? category ?? 'quality'),
68
+ status: String(entry.status ?? entry.result ?? 'failed').toLowerCase(),
69
+ command: entry.command,
70
+ artifactPath: entry.artifactPath ?? entry.path,
71
+ evidenceId: entry.evidenceId,
72
+ summary: entry.summary,
73
+ reasonCode: entry.reasonCode
74
+ }));
75
+ }
76
+
77
+ function gateConflict(gate) {
78
+ const code = gate.reasonCode ?? `project-${gate.category}-gate-failed`;
79
+ const nextMissingEvidence = gateMissingEvidence(gate, code);
80
+ return {
81
+ code,
82
+ gateId: 'project-quality-gate',
83
+ message: `Project ${gate.category} gate ${JSON.stringify(gate.id)} did not pass.`,
84
+ sourcePath: gate.artifactPath,
85
+ details: compactRecord({
86
+ reasonCode: code,
87
+ conflictKey: `project-quality-gate#${gate.category}#${gate.id}`,
88
+ gateId: gate.id,
89
+ category: gate.category,
90
+ status: gate.status,
91
+ command: gate.command,
92
+ artifactPath: gate.artifactPath,
93
+ evidenceId: gate.evidenceId,
94
+ admissionAction: 'block',
95
+ requiredEvidence: `${gate.category} gate ${JSON.stringify(gate.id)} passed`,
96
+ nextMissingEvidence
97
+ })
98
+ };
99
+ }
100
+
101
+ function qualityGateDecision(status, conflicts) {
102
+ const reasonCodes = conflicts.map((conflict) => conflict.code).filter(Boolean);
103
+ return compactRecord({
104
+ status,
105
+ action: status === 'passed' ? 'apply' : 'block',
106
+ reviewRequired: status !== 'passed',
107
+ autoApplyCandidate: status === 'passed',
108
+ reasonCodes,
109
+ nextMissingEvidence: conflicts[0]?.details?.nextMissingEvidence,
110
+ autoMergeClaim: false,
111
+ semanticEquivalenceClaim: false
112
+ });
113
+ }
114
+
115
+ function gateMissingEvidence(gate, reasonCode = gate.reasonCode ?? `project-${gate.category}-gate-failed`) {
116
+ return compactRecord({
117
+ code: reasonCode,
118
+ kind: 'quality-gate',
119
+ scope: 'quality-gates',
120
+ status: 'missing-or-failed',
121
+ action: 'rerun-gate',
122
+ route: qualityGateRerunRoute,
123
+ routeId: qualityGateRerunRoute.id,
124
+ routeLane: qualityGateRerunRoute.lane,
125
+ routeNext: qualityGateRerunRoute.next,
126
+ gateId: gate.id,
127
+ category: gate.category,
128
+ command: gate.command,
129
+ artifactPath: gate.artifactPath,
130
+ summary: `Provide a passing ${gate.category} gate for ${JSON.stringify(gate.id)} before applying the project merge.`,
131
+ autoMergeClaim: false,
132
+ semanticEquivalenceClaim: false
133
+ });
134
+ }
135
+
136
+ function countCategory(gates, category) {
137
+ return gates.filter((gate) => gate.category === category).length;
138
+ }
139
+
140
+ export { createJsTsProjectMergeQualityGate };
@@ -0,0 +1,125 @@
1
+ function compactProjectMergeRoutingCalibration(missingEvidence = [], proofEvidence = undefined) {
2
+ const missingRoutes = missingEvidence.map(missingRouteRecord).filter(Boolean);
3
+ const proofSummary = proofEvidence?.summary ?? {};
4
+ const focusedRouteCounts = proofSummary.unsupportedSurfaceProofGapRouteCounts ?? {};
5
+ const focusedLaneCounts = proofSummary.unsupportedSurfaceProofGapRouteLaneCounts ?? {};
6
+ const byRoute = mergeCounts(countField(missingRoutes, 'routeId'), focusedRouteCounts);
7
+ const byLane = mergeCounts(countField(missingRoutes, 'routeLane'), focusedLaneCounts);
8
+ const routeWorklist = compactRouteWorklist(missingRoutes, proofSummary, byRoute);
9
+ const next = missingRoutes[0];
10
+ return compactRecord({
11
+ kind: 'frontier.lang.jsTsProjectMergeRoutingCalibration',
12
+ version: 1,
13
+ schema: 'frontier.lang.jsTsProjectMergeRoutingCalibration.v1',
14
+ routes: Object.keys(byRoute).length,
15
+ missingRoutes: missingRoutes.length,
16
+ focusedProofGapRoutes: sumCounts(focusedRouteCounts),
17
+ byRoute,
18
+ byLane,
19
+ byAction: countField(missingEvidence, 'action'),
20
+ byProofLevel: countField(missingEvidence, 'proofLevel'),
21
+ routeWorklist,
22
+ routeWorklistCount: routeWorklist.length,
23
+ nextRouteWork: routeWorklist[0],
24
+ nextRouteId: next?.routeId,
25
+ nextRouteLane: next?.routeLane,
26
+ nextRouteNext: next?.routeNext,
27
+ nextAction: next?.action,
28
+ nextProofLevel: next?.proofLevel,
29
+ nextFocusedProofGapRouteId: proofSummary.nextUnsupportedSurfaceProofGapRouteId,
30
+ nextFocusedProofGapRouteLane: proofSummary.nextUnsupportedSurfaceProofGapRouteLane,
31
+ nextFocusedProofGapCode: proofSummary.nextUnsupportedSurfaceProofGapCode
32
+ });
33
+ }
34
+
35
+ function compactRouteWorklist(missingRoutes, proofSummary = {}, byRoute = {}) {
36
+ const byId = new Map();
37
+ for (const route of missingRoutes) {
38
+ const existing = byId.get(route.routeId) ?? {
39
+ routeId: route.routeId,
40
+ routeLane: route.routeLane,
41
+ routeNext: route.routeNext,
42
+ action: route.action,
43
+ proofLevel: route.proofLevel,
44
+ codes: [],
45
+ missingEvidenceCount: 0,
46
+ focusedProofGapCount: 0
47
+ };
48
+ existing.codes = uniqueStrings([...existing.codes, route.code]);
49
+ existing.missingEvidenceCount += 1;
50
+ byId.set(route.routeId, existing);
51
+ }
52
+ for (const routeId of Object.keys(proofSummary.unsupportedSurfaceProofGapRouteCounts ?? {}).sort()) {
53
+ const existing = byId.get(routeId) ?? {
54
+ routeId,
55
+ routeLane: focusedRouteLane(routeId, proofSummary),
56
+ routeNext: undefined,
57
+ action: 'review',
58
+ proofLevel: 'unsupported-js-ts-surface-review',
59
+ codes: [],
60
+ missingEvidenceCount: 0,
61
+ focusedProofGapCount: 0
62
+ };
63
+ existing.focusedProofGapCount += Number(proofSummary.unsupportedSurfaceProofGapRouteCounts?.[routeId] ?? 0);
64
+ existing.codes = uniqueStrings([...existing.codes, focusedRouteCode(routeId, proofSummary)]);
65
+ byId.set(routeId, existing);
66
+ }
67
+ return [...byId.values()]
68
+ .map((route) => compactRecord({
69
+ ...route,
70
+ count: Number(byRoute[route.routeId] ?? 0) || route.missingEvidenceCount + route.focusedProofGapCount,
71
+ codes: route.codes.length ? route.codes : undefined
72
+ }))
73
+ .sort((left, right) => routeRank(left) - routeRank(right) || left.routeId.localeCompare(right.routeId));
74
+ }
75
+
76
+ function routeRank(route) {
77
+ const actionRank = route.action === 'rerun-gate' ? 0 : route.action === 'block' ? 1 : 2;
78
+ return actionRank * 100000 - Number(route.count ?? 0) * 1000;
79
+ }
80
+
81
+ function focusedRouteLane(routeId, proofSummary) {
82
+ if (routeId === proofSummary.nextUnsupportedSurfaceProofGapRouteId) return proofSummary.nextUnsupportedSurfaceProofGapRouteLane;
83
+ const routeIds = proofSummary.unsupportedSurfaceProofGapRouteIds ?? [];
84
+ const lanes = proofSummary.unsupportedSurfaceProofGapRouteLanes ?? [];
85
+ const index = routeIds.indexOf(routeId);
86
+ return index >= 0 ? lanes[index] : undefined;
87
+ }
88
+
89
+ function focusedRouteCode(routeId, proofSummary) {
90
+ return routeId === proofSummary.nextUnsupportedSurfaceProofGapRouteId
91
+ ? proofSummary.nextUnsupportedSurfaceProofGapCode
92
+ : undefined;
93
+ }
94
+
95
+ function missingRouteRecord(item) {
96
+ const route = item?.route ?? {};
97
+ const routeId = item?.routeId ?? route.id;
98
+ if (!routeId) return undefined;
99
+ return compactRecord({
100
+ routeId,
101
+ routeLane: item?.routeLane ?? route.lane,
102
+ routeNext: item?.routeNext ?? route.next,
103
+ action: item?.action,
104
+ proofLevel: item?.proofLevel,
105
+ code: item?.code
106
+ });
107
+ }
108
+
109
+ function countField(items, field) {
110
+ const counts = {};
111
+ for (const item of items) if (item?.[field]) counts[item[field]] = (counts[item[field]] ?? 0) + 1;
112
+ return counts;
113
+ }
114
+
115
+ function mergeCounts(...countsList) {
116
+ const merged = {};
117
+ for (const counts of countsList) for (const [key, value] of Object.entries(counts ?? {})) merged[key] = (merged[key] ?? 0) + Number(value ?? 0);
118
+ return merged;
119
+ }
120
+
121
+ function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
122
+ function sumCounts(counts) { return Object.values(counts ?? {}).reduce((total, value) => total + Number(value ?? 0), 0); }
123
+ function compactRecord(record) { return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined)); }
124
+
125
+ export { compactProjectMergeRoutingCalibration };
@@ -0,0 +1,156 @@
1
+ import { compactRecord } from './js-ts-safe-merge-context.js';
2
+ import { runtimeOrderEvidenceBinding } from './internal/index-impl/runtimeOrderEvidenceBinding.js';
3
+ import { runtimeOrderReasonCodes } from './internal/index-impl/semanticEditRuntimeOrderReasons.js';
4
+
5
+ function projectRuntimeRegionDeltaConflicts(projectGraphDelta, options = {}) {
6
+ const baseGraph = projectGraphDelta?.stages?.base?.projectSymbolGraph;
7
+ const workerGraph = projectGraphDelta?.stages?.worker?.projectSymbolGraph;
8
+ const headGraph = projectGraphDelta?.stages?.head?.projectSymbolGraph;
9
+ const outputGraph = projectGraphDelta?.stages?.output?.projectSymbolGraph;
10
+ if (!baseGraph || !workerGraph || !headGraph) return [];
11
+ const base = runtimeRecordsByIdentityKey(baseGraph.runtimeRegionRecords);
12
+ const worker = runtimeRecordsByIdentityKey(workerGraph.runtimeRegionRecords);
13
+ const head = runtimeRecordsByIdentityKey(headGraph.runtimeRegionRecords);
14
+ const output = runtimeRecordsByIdentityKey(outputGraph?.runtimeRegionRecords);
15
+ return uniqueStrings([...base.keys(), ...worker.keys(), ...head.keys()]).flatMap((identityKey) => {
16
+ const baseRecord = base.get(identityKey);
17
+ const workerRecord = worker.get(identityKey);
18
+ const headRecord = head.get(identityKey);
19
+ const fingerprints = [runtimeFingerprint(baseRecord), runtimeFingerprint(workerRecord), runtimeFingerprint(headRecord)];
20
+ if (fingerprints[0] === fingerprints[1] || fingerprints[0] === fingerprints[2] || fingerprints[1] === fingerprints[2]) return [];
21
+ const explicitEvidence = projectRuntimeOrderEvidenceBinding(identityKey, baseRecord, workerRecord, headRecord, output.get(identityKey), options);
22
+ if (explicitEvidence.passed) return [];
23
+ return [projectRuntimeRegionDeltaConflict(identityKey, baseRecord, workerRecord, headRecord, output.get(identityKey), explicitEvidence)];
24
+ });
25
+ }
26
+
27
+ function projectRuntimeRegionDeltaConflict(identityKey, baseRecord, workerRecord, headRecord, outputRecord, explicitEvidence) {
28
+ const sourcePath = workerRecord?.sourcePath ?? headRecord?.sourcePath ?? baseRecord?.sourcePath;
29
+ return {
30
+ code: 'project-public-runtime-region-delta-conflict',
31
+ gateId: 'project-graph-delta',
32
+ message: `Worker and head both changed public runtime region ${JSON.stringify(identityKey)} in incompatible ways.`,
33
+ sourcePath,
34
+ details: compactRecord({
35
+ reasonCode: 'project-public-runtime-region-delta-conflict',
36
+ conflictKey: `project-graph-delta#runtime-region#${identityKey}`,
37
+ identityKey,
38
+ sourcePath,
39
+ reasonCodes: runtimeConflictReasonCodes(baseRecord, workerRecord, headRecord, outputRecord, explicitEvidence),
40
+ explicitRuntimeOrderEvidence: explicitEvidenceDetails(explicitEvidence),
41
+ base: runtimeDetails(baseRecord),
42
+ worker: runtimeDetails(workerRecord),
43
+ head: runtimeDetails(headRecord),
44
+ output: runtimeDetails(outputRecord)
45
+ })
46
+ };
47
+ }
48
+
49
+ function projectRuntimeOrderEvidenceBinding(identityKey, baseRecord, workerRecord, headRecord, outputRecord, options) {
50
+ return runtimeOrderEvidenceBinding({
51
+ scriptInput: {
52
+ runtimeOrderEvidence: runtimeOrderEvidenceCandidates(options),
53
+ evidence: options.evidence
54
+ },
55
+ region: outputRecord ?? workerRecord ?? headRecord ?? baseRecord,
56
+ baseSymbol: baseRecord,
57
+ workerSymbol: workerRecord,
58
+ headSymbol: headRecord,
59
+ anchorKey: workerRecord?.key ?? headRecord?.key ?? baseRecord?.key ?? identityKey,
60
+ context: {
61
+ workerChangeSet: {
62
+ sourcePath: workerRecord?.sourcePath ?? baseRecord?.sourcePath,
63
+ beforeHash: baseRecord?.sourceHash,
64
+ afterHash: workerRecord?.sourceHash
65
+ },
66
+ headChangeSet: {
67
+ sourcePath: headRecord?.sourcePath ?? baseRecord?.sourcePath,
68
+ afterHash: headRecord?.sourceHash
69
+ }
70
+ }
71
+ });
72
+ }
73
+
74
+ function runtimeOrderEvidenceCandidates(options) {
75
+ return [
76
+ ...array(options.runtimeOrderEvidence),
77
+ ...array(options.projectRuntimeOrderEvidence),
78
+ ...array(options.metadata?.runtimeOrderEvidence)
79
+ ];
80
+ }
81
+
82
+ function runtimeRecordsByIdentityKey(records = []) {
83
+ const result = new Map();
84
+ for (const record of records) {
85
+ if (!record?.publicContract) continue;
86
+ const key = runtimeIdentityKey(record);
87
+ if (key && !result.has(key)) result.set(key, record);
88
+ }
89
+ return result;
90
+ }
91
+
92
+ function runtimeIdentityKey(record) {
93
+ return stableKey(['runtime-region', record?.sourcePath, record?.symbolName, record?.regionKind, record?.runtimeKind, record?.ordinal]);
94
+ }
95
+
96
+ function runtimeFingerprint(record) { return record ? stableKey([record.signatureHash, record.regionKind, record.runtimeKind]) : undefined; }
97
+ function runtimeDetails(record) {
98
+ if (!record) return undefined;
99
+ return compactRecord({
100
+ sourcePath: record.sourcePath,
101
+ symbolName: record.symbolName,
102
+ symbolKind: record.symbolKind,
103
+ regionKind: record.regionKind,
104
+ runtimeKind: record.runtimeKind,
105
+ runtimeKinds: record.runtimeKinds,
106
+ line: record.line,
107
+ ordinal: record.ordinal,
108
+ spanKind: record.spanKind,
109
+ runtimeOrderEvidence: record.runtimeOrderEvidence,
110
+ reasonCodes: runtimeRecordReasonCodes(record),
111
+ signatureHash: record.signatureHash,
112
+ sourceHash: record.sourceHash
113
+ });
114
+ }
115
+
116
+ function runtimeConflictReasonCodes(...records) {
117
+ const explicitEvidence = records.find((record) => record?.reasonCodes);
118
+ const runtimeRecords = records.filter((record) => !record?.reasonCodes);
119
+ return uniqueStrings([
120
+ 'project-public-runtime-region-delta-conflict',
121
+ ...(explicitEvidence?.reasonCodes ?? []),
122
+ ...runtimeRecords.flatMap(runtimeRecordReasonCodes)
123
+ ]);
124
+ }
125
+
126
+ function explicitEvidenceDetails(evidence) {
127
+ if (!evidence?.reasonCodes?.length) return undefined;
128
+ return {
129
+ status: 'failed',
130
+ reasonCodes: evidence.reasonCodes,
131
+ evidenceIds: evidence.evidenceIds
132
+ };
133
+ }
134
+
135
+ function runtimeRecordReasonCodes(record) {
136
+ if (!record) return [];
137
+ return runtimeOrderReasonCodes({
138
+ region: {
139
+ ...record,
140
+ metadata: {
141
+ factKinds: record.runtimeKinds ?? (record.runtimeKind ? [record.runtimeKind] : undefined),
142
+ runtimeOrderEvidence: record.runtimeOrderEvidence,
143
+ subjectName: record.symbolName
144
+ }
145
+ }
146
+ });
147
+ }
148
+
149
+ function stableKey(parts) {
150
+ const values = parts.map((part) => part === undefined || part === null ? '' : String(part));
151
+ return values.some(Boolean) ? values.join('#') : undefined;
152
+ }
153
+ function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
154
+ function array(value) { return value === undefined || value === null ? [] : Array.isArray(value) ? value : [value]; }
155
+
156
+ export { projectRuntimeRegionDeltaConflicts };