@shapeshift-labs/frontier-lang-compiler 0.2.150 → 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.
- package/README.md +315 -9
- package/bench/real-repo-corpus-checkout-identity.mjs +134 -0
- package/bench/real-repo-corpus-checkout-proof.mjs +263 -0
- package/bench/real-repo-corpus-command-execution.mjs +314 -0
- package/bench/real-repo-corpus-evidence.mjs +165 -0
- package/bench/real-repo-corpus-suite.mjs +273 -0
- package/bench/smoke.mjs +109 -7
- package/dist/declarations/import-adapter-core.d.ts +4 -3
- package/dist/declarations/import-adapter-options-native.d.ts +21 -0
- package/dist/declarations/js-ts-project-merge-admission-routes.d.ts +35 -0
- package/dist/declarations/js-ts-project-merge-commonjs-interop.d.ts +29 -0
- package/dist/declarations/js-ts-project-merge-confidence.d.ts +64 -0
- package/dist/declarations/js-ts-project-merge-declaration-emit-parity.d.ts +37 -0
- package/dist/declarations/js-ts-project-merge-declarations.d.ts +65 -0
- package/dist/declarations/js-ts-project-merge-diagnostics.d.ts +97 -0
- package/dist/declarations/js-ts-project-merge-global-augmentation.d.ts +30 -0
- package/dist/declarations/js-ts-project-merge-jsx-render-branch.d.ts +48 -0
- package/dist/declarations/js-ts-project-merge-proof-levels.d.ts +109 -0
- package/dist/declarations/js-ts-project-merge-quality-gates.d.ts +38 -0
- package/dist/declarations/js-ts-project-merge-semantic-equivalence-proof.d.ts +45 -0
- package/dist/declarations/js-ts-project-merge-tsconfig.d.ts +43 -0
- package/dist/declarations/js-ts-safe-merge.d.ts +47 -0
- package/dist/declarations/js-ts-safe-project-merge.d.ts +120 -38
- package/dist/declarations/native-project-compiler-assignability-oracle.d.ts +41 -0
- package/dist/declarations/native-project-compiler-callable-signatures.d.ts +31 -0
- package/dist/declarations/native-project-compiler-class-member-runtime-proof.d.ts +87 -0
- package/dist/declarations/native-project-compiler-composite-types.d.ts +23 -0
- package/dist/declarations/native-project-compiler-enum-proof.d.ts +58 -0
- package/dist/declarations/native-project-compiler-index-signature.d.ts +7 -0
- package/dist/declarations/native-project-compiler-public-api-source-binding.d.ts +8 -0
- package/dist/declarations/native-project-compiler-scope.d.ts +37 -0
- package/dist/declarations/native-project-compiler-type-reference-targets.d.ts +38 -0
- package/dist/declarations/native-project-css-modules.d.ts +90 -0
- package/dist/declarations/native-project-decorator-metadata.d.ts +126 -0
- package/dist/declarations/native-project-jsx-graph.d.ts +313 -0
- package/dist/declarations/native-project-module-declarations.d.ts +52 -0
- package/dist/declarations/native-project-module-resolution.d.ts +76 -1
- package/dist/declarations/native-project-runtime-effect-target.d.ts +29 -0
- package/dist/declarations/native-project-runtime-executable-effect-evidence.d.ts +107 -0
- package/dist/declarations/native-project-runtime-mutation-target.d.ts +33 -0
- package/dist/declarations/native-project-runtime-promise-chain.d.ts +30 -0
- package/dist/declarations/native-project-runtime-promise-combinator.d.ts +22 -0
- package/dist/declarations/native-project-runtime-reachability.d.ts +30 -0
- package/dist/declarations/native-project-runtime-resource-management.d.ts +27 -0
- package/dist/declarations/native-project-runtime-yield-delegation.d.ts +10 -0
- package/dist/declarations/native-project-scope-template-reference.d.ts +13 -0
- package/dist/declarations/native-project-source-evidence.d.ts +8 -0
- package/dist/declarations/native-project.d.ts +40 -39
- package/dist/declarations/semantic-edit-script.d.ts +10 -8
- package/dist/declarations/semantic-graph-layers.d.ts +79 -0
- package/dist/declarations/semantic-sidecar.d.ts +3 -2
- package/dist/declarations/semantic-structural-diff.d.ts +94 -0
- package/dist/declarations/source-preservation.d.ts +32 -1
- package/dist/declarations/target-adapters.d.ts +22 -2
- package/dist/index.d.ts +31 -0
- package/dist/index.js +5 -0
- package/dist/internal/index-impl/compileNativeSource.js +53 -5
- package/dist/internal/index-impl/createLightweightNativeImport.js +58 -4
- package/dist/internal/index-impl/createNativeImportFromSyntaxAst.js +17 -1
- package/dist/internal/index-impl/createNativeImportFromTypeScriptAst.js +28 -4
- package/dist/internal/index-impl/createNativeProjectImportResult.js +31 -27
- package/dist/internal/index-impl/createNativeProjectModuleResolutionFromPackageManifests.js +145 -0
- package/dist/internal/index-impl/createNativeSourcePreservation.js +34 -7
- package/dist/internal/index-impl/createSemanticImportSidecar.js +27 -1
- package/dist/internal/index-impl/createTypeScriptCompilerNativeImporterAdapter.js +16 -5
- package/dist/internal/index-impl/dynamicImportExpressionMetadata.js +80 -0
- package/dist/internal/index-impl/importMetaUrlDependencyMetadata.js +176 -0
- package/dist/internal/index-impl/importNativeSource.js +2 -3
- package/dist/internal/index-impl/moduleImportAttributeMetadata.js +232 -0
- package/dist/internal/index-impl/projectSemanticEditScriptToSource.js +8 -1
- package/dist/internal/index-impl/projectSymbolGraphClassStaticBlocks.js +148 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerAdvancedTypeMetadata.js +45 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerCallableSignatureEquivalence.js +107 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerClassPrivateAccessorRuntimeProof.js +280 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerClassShapeEquivalence.js +103 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerConditionalTypeEquivalence.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerDecoratorRuntimeProof.js +197 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerEnumEquivalence.js +188 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerFacts.js +244 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerIndexSignatureEquivalence.js +58 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerMetadata.js +168 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalence.js +199 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalenceProof.js +204 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeReferenceTargetEquivalence.js +99 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleRecords.js +264 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleScanners.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleUtils.js +152 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModules.js +82 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentImports.js +170 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentProviderLookup.js +167 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentWrappers.js +150 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxContextTargets.js +71 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxContextValues.js +212 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxEventHandlers.js +172 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxHookEffects.js +124 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxHooks.js +281 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxMemberComponents.js +139 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxPropFlows.js +320 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxPropValues.js +145 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxProviderFlows.js +133 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRecords.js +315 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderCollections.js +155 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderReturns.js +291 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderRisk.js +279 -0
- package/dist/internal/index-impl/projectSymbolGraphModuleDeclarationShapes.js +138 -0
- package/dist/internal/index-impl/projectSymbolGraphModuleResolution.js +89 -87
- package/dist/internal/index-impl/projectSymbolGraphPackageConditions.js +314 -0
- package/dist/internal/index-impl/projectSymbolGraphReExportImportTargets.js +43 -0
- package/dist/internal/index-impl/projectSymbolGraphReExports.js +55 -1
- package/dist/internal/index-impl/projectSymbolGraphRuntimeRegions.js +108 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefAliases.js +307 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefLexical.js +320 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefOwners.js +50 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecordBuilders.js +112 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecords.js +238 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructural.js +104 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructuralNormalize.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefUseHashes.js +107 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceMapGeneratedBoundary.js +111 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceRecords.js +268 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceRecordsOwnership.js +309 -0
- package/dist/internal/index-impl/replaySemanticEditProjection.js +53 -39
- package/dist/internal/index-impl/runtimeOrderEvidenceBinding.js +151 -0
- package/dist/internal/index-impl/runtimeOrderProofSurfaces.js +253 -0
- package/dist/internal/index-impl/semanticEditCallsiteArgumentMerge.js +319 -0
- package/dist/internal/index-impl/semanticEditExplicitSourceReplacement.js +7 -2
- package/dist/internal/index-impl/semanticEditProjectionRecord.js +8 -0
- package/dist/internal/index-impl/semanticEditReplayDiagnostics.js +7 -2
- package/dist/internal/index-impl/semanticEditReplayOutputBinding.js +61 -0
- package/dist/internal/index-impl/semanticEditReplayRerunRoute.js +27 -0
- package/dist/internal/index-impl/semanticEditReplaySourceReplacement.js +6 -1
- package/dist/internal/index-impl/semanticEditRuntimeOrderReasons.js +320 -0
- package/dist/internal/index-impl/semanticEditScriptClassification.js +90 -5
- package/dist/internal/index-impl/semanticEditScripts.js +42 -5
- package/dist/internal/index-impl/semanticEditTypeSyntaxReasons.js +134 -0
- package/dist/internal/index-impl/semanticIndexFromNativeDeclarations.js +11 -5
- package/dist/internal/index-impl/semanticStructuralDiffRecords.js +150 -0
- package/dist/internal/index-impl/sourceMapGeneratedBoundaryGate.js +185 -0
- package/dist/internal/index-impl/staticMemberLiteral.js +31 -0
- package/dist/internal/index-impl/staticOptionalMemberReference.js +22 -0
- package/dist/internal/index-impl/syntaxAstSourcePreservation.js +273 -0
- package/dist/internal/index-impl/syntaxCommonJsModuleDeclarationEntries.js +297 -0
- package/dist/internal/index-impl/syntaxModuleDeclarationEntries.js +56 -132
- package/dist/internal/index-impl/syntaxModuleEntryRecords.js +160 -0
- package/dist/internal/index-impl/typeScriptCompilerAdvancedTypeShapes.js +160 -0
- package/dist/internal/index-impl/typeScriptCompilerAssignabilityOracle.js +97 -0
- package/dist/internal/index-impl/typeScriptCompilerClassApi.js +238 -0
- package/dist/internal/index-impl/typeScriptCompilerDecoratorMetadata.js +290 -0
- package/dist/internal/index-impl/typeScriptCompilerEnumShape.js +279 -0
- package/dist/internal/index-impl/typeScriptCompilerFacts.js +294 -0
- package/dist/internal/index-impl/typeScriptCompilerInferenceSyntax.js +170 -0
- package/dist/internal/index-impl/typeScriptCompilerReferenceGraph.js +186 -0
- package/dist/internal/index-impl/typeScriptCompilerSymbolIdentity.js +294 -0
- package/dist/internal/index-impl/typeScriptCompilerTypeReferenceTargets.js +142 -0
- package/dist/internal/index-impl/typeScriptDeclaration.js +10 -38
- package/dist/internal/index-impl/typeScriptModuleDeclarationEntries.js +52 -15
- package/dist/internal/index-impl/typeScriptSourceFilePreservation.js +296 -0
- package/dist/js-ts-safe-member-class-invariants.js +247 -0
- package/dist/js-ts-safe-member-merge-result.js +23 -3
- package/dist/js-ts-safe-member-merge.js +28 -4
- package/dist/js-ts-safe-merge-binding-patterns.js +170 -0
- package/dist/js-ts-safe-merge-jsx-attribute-fallback.js +151 -157
- package/dist/js-ts-safe-merge-jsx-attribute-parser.js +277 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-fallback.js +161 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-merge.js +319 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-parser.js +300 -0
- package/dist/js-ts-safe-merge-parse-declarations.js +46 -2
- package/dist/js-ts-safe-merge-parse-statements.js +8 -0
- package/dist/js-ts-safe-merge-semantic-edit-fallback.js +13 -5
- package/dist/js-ts-safe-merge-source-shape-fallbacks.js +3 -1
- package/dist/js-ts-safe-merge-top-level-rename-fallback.js +31 -5
- package/dist/js-ts-safe-merge-top-level-rename-result.js +7 -2
- package/dist/js-ts-safe-merge-variable-declarator-fallback.js +124 -6
- package/dist/js-ts-safe-merge-variable-declarator-parser.js +34 -4
- package/dist/js-ts-safe-merge.js +136 -0
- package/dist/js-ts-safe-project-merge-admission-routes.js +216 -0
- package/dist/js-ts-safe-project-merge-admission.js +161 -0
- package/dist/js-ts-safe-project-merge-ambient.js +110 -0
- package/dist/js-ts-safe-project-merge-core.js +85 -0
- package/dist/js-ts-safe-project-merge-css-module-conflicts.js +60 -0
- package/dist/js-ts-safe-project-merge-declaration-emit-parity.js +186 -0
- package/dist/js-ts-safe-project-merge-declarations.js +227 -0
- package/dist/js-ts-safe-project-merge-diagnostics-metadata.js +42 -0
- package/dist/js-ts-safe-project-merge-diagnostics-ts.js +73 -0
- package/dist/js-ts-safe-project-merge-diagnostics.js +283 -0
- package/dist/js-ts-safe-project-merge-evidence-routing.js +38 -0
- package/dist/js-ts-safe-project-merge-files.js +70 -0
- package/dist/js-ts-safe-project-merge-global-augmentation-compatibility.js +99 -0
- package/dist/js-ts-safe-project-merge-graph-conflicts.js +90 -2
- package/dist/js-ts-safe-project-merge-graph-delta-commonjs-interop.js +108 -0
- package/dist/js-ts-safe-project-merge-graph-delta-compiler-conflicts.js +179 -0
- package/dist/js-ts-safe-project-merge-graph-delta-compiler-details.js +189 -0
- package/dist/js-ts-safe-project-merge-graph-delta-conflicts.js +51 -184
- package/dist/js-ts-safe-project-merge-graph-delta-identity-conflicts.js +202 -0
- package/dist/js-ts-safe-project-merge-graph-delta-inference-syntax.js +80 -0
- package/dist/js-ts-safe-project-merge-graph-delta-module-declarations.js +155 -0
- package/dist/js-ts-safe-project-merge-graph-limits.js +16 -1
- package/dist/js-ts-safe-project-merge-graph.js +37 -5
- package/dist/js-ts-safe-project-merge-import-removal.js +292 -0
- package/dist/js-ts-safe-project-merge-jsx-graph-conflict-details.js +235 -0
- package/dist/js-ts-safe-project-merge-jsx-graph-conflicts.js +173 -0
- package/dist/js-ts-safe-project-merge-jsx-prop-contracts.js +86 -0
- package/dist/js-ts-safe-project-merge-jsx-render-branch-proof.js +189 -0
- package/dist/js-ts-safe-project-merge-missing-evidence.js +310 -0
- package/dist/js-ts-safe-project-merge-move-rename.js +209 -0
- package/dist/js-ts-safe-project-merge-proof-conflicts.js +44 -0
- package/dist/js-ts-safe-project-merge-proof-levels.js +320 -0
- package/dist/js-ts-safe-project-merge-quality-gates.js +140 -0
- package/dist/js-ts-safe-project-merge-routing-calibration.js +125 -0
- package/dist/js-ts-safe-project-merge-runtime-region-conflicts.js +156 -0
- package/dist/js-ts-safe-project-merge-scope-use-def-conflicts.js +292 -0
- package/dist/js-ts-safe-project-merge-semantic-equivalence-proof.js +175 -0
- package/dist/js-ts-safe-project-merge-semantic-replay-proof.js +311 -0
- package/dist/js-ts-safe-project-merge-semantic-replay-routes.js +179 -0
- package/dist/js-ts-safe-project-merge-source-span-conflicts.js +310 -0
- package/dist/js-ts-safe-project-merge-source-span-roundtrip-proof.js +172 -0
- package/dist/js-ts-safe-project-merge-split-merge-admission.js +96 -0
- package/dist/js-ts-safe-project-merge-split-merge-records.js +320 -0
- package/dist/js-ts-safe-project-merge-split-merge-shapes.js +234 -0
- package/dist/js-ts-safe-project-merge-split-merge.js +218 -0
- package/dist/js-ts-safe-project-merge-summary.js +320 -0
- package/dist/js-ts-safe-project-merge-symbol-move-admission.js +63 -0
- package/dist/js-ts-safe-project-merge-symbol-move-default-admission.js +143 -0
- package/dist/js-ts-safe-project-merge-symbol-move-risks.js +213 -0
- package/dist/js-ts-safe-project-merge-symbol-move.js +316 -0
- package/dist/js-ts-safe-project-merge-symbol-rename-admission.js +59 -0
- package/dist/js-ts-safe-project-merge-symbol-rename-default-admission.js +111 -0
- package/dist/js-ts-safe-project-merge-symbol-rename.js +319 -0
- package/dist/js-ts-safe-project-merge-ts-options.js +205 -0
- package/dist/js-ts-safe-project-merge-ts-program.js +268 -0
- package/dist/js-ts-safe-project-merge-typed-property-rename-rebase-utils.js +69 -0
- package/dist/js-ts-safe-project-merge-typed-property-rename-rebase.js +317 -0
- package/dist/js-ts-safe-project-merge-unsupported-surfaces.js +319 -0
- package/dist/js-ts-safe-project-merge.js +170 -171
- package/dist/js-ts-semantic-scope-use-def-bindings.js +287 -0
- package/dist/js-ts-semantic-scope-use-def-scan.js +241 -0
- package/dist/js-ts-semantic-scope-use-def-utils.js +132 -0
- package/dist/js-ts-semantic-scope-use-def.js +217 -0
- package/dist/lightweight-dependency-effects.js +28 -4
- package/dist/lightweight-dependency-relations.js +13 -7
- package/dist/lightweight-dependency-top-level.js +63 -0
- package/dist/native-import-language-profiles.js +27 -1
- package/dist/native-js-ts-importers.js +9 -5
- package/dist/native-parser-ast-format-profiles.js +12 -0
- package/dist/native-parser-html-css-format-profiles.js +85 -0
- package/dist/native-region-scanner-core.js +5 -3
- package/dist/native-region-scanner-js-commonjs.js +155 -0
- package/dist/native-region-scanner-js-imports.js +51 -13
- package/dist/native-region-scanner-js-reexports.js +79 -0
- package/dist/native-region-scanner-js-ts-helpers.js +23 -0
- package/dist/native-source-ledger-helpers.js +1 -1
- package/dist/native-source-ledger.js +24 -10
- package/dist/native-source-maps-ecma426.js +316 -0
- package/dist/native-source-maps.js +36 -6
- package/dist/native-source-preservation-ownership.js +292 -0
- package/dist/native-source-preservation-scanner.js +63 -25
- package/dist/native-source-preservation-types.d.ts +3 -0
- package/dist/semantic-import-effect-occurrences.js +242 -0
- package/dist/semantic-import-effect-regions.js +95 -58
- package/dist/semantic-import-graph-layers.js +224 -0
- package/dist/semantic-import-runtime-conditional-evidence.js +135 -0
- package/dist/semantic-import-runtime-effect-target-evidence.js +145 -0
- package/dist/semantic-import-runtime-exit-evidence.js +32 -0
- package/dist/semantic-import-runtime-import-meta-evidence.js +33 -0
- package/dist/semantic-import-runtime-mutation-evidence.js +155 -0
- package/dist/semantic-import-runtime-order-evidence.js +318 -0
- package/dist/semantic-import-runtime-promise-chain-evidence.js +103 -0
- package/dist/semantic-import-runtime-promise-combinator-evidence.js +166 -0
- package/dist/semantic-import-runtime-reachability-evidence.js +269 -0
- package/dist/semantic-import-runtime-resource-management-evidence.js +293 -0
- package/dist/semantic-import-runtime-switch-evidence.js +304 -0
- package/dist/semantic-import-runtime-throw-evidence.js +44 -0
- package/dist/semantic-import-runtime-try-finally-evidence.js +172 -0
- package/dist/semantic-import-sidecar-entry.js +4 -0
- package/dist/semantic-import-source-preservation.js +6 -2
- package/package.json +1 -1
|
@@ -1,15 +1,57 @@
|
|
|
1
1
|
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
2
|
import { safeMergeJsTsSource } from './js-ts-safe-merge-composed.js';
|
|
3
3
|
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
4
|
+
import { createJsTsProjectMergeDeclarationGate } from './js-ts-safe-project-merge-declarations.js';
|
|
5
|
+
import { createJsTsProjectMergeDeclarationEmitParityProof } from './js-ts-safe-project-merge-declaration-emit-parity.js';
|
|
6
|
+
import { createJsTsProjectMergeDiagnosticsGate } from './js-ts-safe-project-merge-diagnostics.js';
|
|
4
7
|
import { createJsTsProjectSafeMergeGraphArtifacts, createJsTsProjectSafeMergeGraphDelta } from './js-ts-safe-project-merge-graph.js';
|
|
5
8
|
import { addProjectGraphDeltaConflictSummary } from './js-ts-safe-project-merge-graph-delta-conflicts.js';
|
|
6
9
|
import { outputProjectGraphConflicts, projectGraphDeltaConflicts } from './js-ts-safe-project-merge-graph-conflicts.js';
|
|
10
|
+
import { createProjectAdmissionRoutes, projectAdmissionRouteSummary } from './js-ts-safe-project-merge-admission-routes.js';
|
|
11
|
+
import { maybeBlockAmbientProjectFile } from './js-ts-safe-project-merge-ambient.js';
|
|
12
|
+
import { maybeMergeImportSpecifierRemovalFile } from './js-ts-safe-project-merge-import-removal.js';
|
|
13
|
+
import { createJsTsProjectMergeQualityGate } from './js-ts-safe-project-merge-quality-gates.js';
|
|
14
|
+
import { createJsTsProjectMergeProofEvidence } from './js-ts-safe-project-merge-proof-levels.js';
|
|
15
|
+
import { projectProofEvidenceConflicts } from './js-ts-safe-project-merge-proof-conflicts.js';
|
|
16
|
+
import { blockedFile, hashText, policyForFile, safeId, sourceLedgersForFile, syntheticFile, uniqueStrings } from './js-ts-safe-project-merge-core.js';
|
|
17
|
+
import { normalizeProjectFiles } from './js-ts-safe-project-merge-files.js';
|
|
18
|
+
import { applyProjectMoveRenameClassifications, classifyProjectMoveRenames } from './js-ts-safe-project-merge-move-rename.js';
|
|
19
|
+
import { applyProjectSymbolRenameClassifications, classifyProjectSymbolRenames } from './js-ts-safe-project-merge-symbol-rename.js';
|
|
20
|
+
import { applyProjectSplitMergeClassifications, classifyProjectSplitMerges } from './js-ts-safe-project-merge-split-merge.js';
|
|
21
|
+
import { projectConfidence, projectEvidence, projectSummary, projectSummaryWithConfidenceEvidence } from './js-ts-safe-project-merge-summary.js';
|
|
7
22
|
|
|
8
23
|
function safeMergeJsTsProject(input = {}) {
|
|
9
24
|
const id = String(input.id ?? 'js_ts_project_safe_merge');
|
|
10
25
|
const files = normalizeProjectFiles(input);
|
|
11
|
-
const
|
|
26
|
+
const projectMoveRenames = classifyProjectMoveRenames(files, input, id);
|
|
27
|
+
const projectSymbolRenames = classifyProjectSymbolRenames(files, input);
|
|
28
|
+
const projectSplitMerges = classifyProjectSplitMerges(files);
|
|
29
|
+
const mergedFileResults = files.map((file) => mergeProjectFile(file, input, id, projectSymbolRenames));
|
|
30
|
+
const fileResults = applyProjectSplitMergeClassifications(
|
|
31
|
+
applyProjectSymbolRenameClassifications(
|
|
32
|
+
applyProjectMoveRenameClassifications(mergedFileResults, projectMoveRenames, files, input),
|
|
33
|
+
files,
|
|
34
|
+
input,
|
|
35
|
+
projectSymbolRenames
|
|
36
|
+
),
|
|
37
|
+
projectSplitMerges,
|
|
38
|
+
files,
|
|
39
|
+
input
|
|
40
|
+
);
|
|
41
|
+
const symbolRenameSummary = {
|
|
42
|
+
...projectSymbolRenames.summary,
|
|
43
|
+
...(projectSymbolRenames.admissionSummary ?? {})
|
|
44
|
+
};
|
|
45
|
+
const moveRenameSummary = {
|
|
46
|
+
...projectMoveRenames.summary,
|
|
47
|
+
...(projectMoveRenames.admissionSummary ?? {})
|
|
48
|
+
};
|
|
49
|
+
const splitMergeSummary = {
|
|
50
|
+
...projectSplitMerges.summary,
|
|
51
|
+
...(projectSplitMerges.admissionSummary ?? {})
|
|
52
|
+
};
|
|
12
53
|
const blockedFiles = fileResults.filter((file) => file.status === 'blocked');
|
|
54
|
+
const inputFilesByPath = new Map(files.map((file) => [file.sourcePath, file]));
|
|
13
55
|
const outputFiles = fileResults
|
|
14
56
|
.filter((file) => typeof file.outputSourceText === 'string')
|
|
15
57
|
.map((file) => compactRecord({
|
|
@@ -17,27 +59,65 @@ function safeMergeJsTsProject(input = {}) {
|
|
|
17
59
|
language: file.language,
|
|
18
60
|
sourceText: file.outputSourceText,
|
|
19
61
|
sourceHash: file.outputHash,
|
|
62
|
+
parserTriviaEvidence: outputParserTriviaEvidence(inputFilesByPath.get(file.sourcePath), file),
|
|
20
63
|
operation: file.operation
|
|
21
64
|
}));
|
|
65
|
+
const outputDeclarationGate = blockedFiles.length === 0
|
|
66
|
+
? createJsTsProjectMergeDeclarationGate(input, outputFiles, id)
|
|
67
|
+
: undefined;
|
|
68
|
+
const declarationEmitParityProof = blockedFiles.length === 0
|
|
69
|
+
? createJsTsProjectMergeDeclarationEmitParityProof(input, files, outputFiles, id)
|
|
70
|
+
: undefined;
|
|
22
71
|
const projectGraphDelta = blockedFiles.length === 0 && input.includeProjectGraphDelta
|
|
23
72
|
? createJsTsProjectSafeMergeGraphDelta(input, files, outputFiles, id)
|
|
24
73
|
: undefined;
|
|
25
74
|
const graphArtifacts = projectGraphDelta?.stages?.output ?? (blockedFiles.length === 0 && input.includeOutputProjectSymbolGraph
|
|
26
75
|
? createJsTsProjectSafeMergeGraphArtifacts(input, outputFiles, id)
|
|
27
76
|
: undefined);
|
|
77
|
+
const outputDiagnosticsGate = blockedFiles.length === 0
|
|
78
|
+
? createJsTsProjectMergeDiagnosticsGate(input, outputFiles, id, { fileResults })
|
|
79
|
+
: undefined;
|
|
80
|
+
const outputQualityGate = blockedFiles.length === 0 ? createJsTsProjectMergeQualityGate(input, id) : undefined;
|
|
81
|
+
const proofEvidence = createJsTsProjectMergeProofEvidence({
|
|
82
|
+
id,
|
|
83
|
+
files,
|
|
84
|
+
fileResults,
|
|
85
|
+
outputDiagnosticsGate,
|
|
86
|
+
outputDeclarationGate,
|
|
87
|
+
outputQualityGate, externalSemanticEquivalenceProof: input.externalSemanticEquivalenceProof ?? input.semanticEquivalenceProof, semanticEquivalenceProof: input.semanticEquivalenceProof, language: input.language
|
|
88
|
+
});
|
|
28
89
|
const outputGraphConflicts = outputProjectGraphConflicts(projectGraphDelta ? graphArtifacts?.projectSymbolGraph : graphArtifacts);
|
|
29
|
-
const deltaGraphConflicts = projectGraphDeltaConflicts(projectGraphDelta);
|
|
90
|
+
const deltaGraphConflicts = projectGraphDeltaConflicts(projectGraphDelta, { declarationEmitParityProof, outputDiagnosticsGate, outputDeclarationGate, runtimeOrderEvidence: input.runtimeOrderEvidence, projectRuntimeOrderEvidence: input.projectRuntimeOrderEvidence, evidence: input.evidence, commonJsRuntimeInteropProof: input.commonJsRuntimeInteropProof, commonJsRuntimeInteropProofs: input.commonJsRuntimeInteropProofs, globalAugmentationCompatibilityProof: input.globalAugmentationCompatibilityProof, globalAugmentationCompatibilityProofs: input.globalAugmentationCompatibilityProofs, jsxRenderReturnBranchProof: input.jsxRenderReturnBranchProof, jsxRenderReturnBranchProofs: input.jsxRenderReturnBranchProofs });
|
|
30
91
|
const projectGraphDeltaWithConflicts = addProjectGraphDeltaConflictSummary(projectGraphDelta, deltaGraphConflicts);
|
|
92
|
+
const diagnosticsConflicts = outputDiagnosticsGate?.conflicts ?? [];
|
|
93
|
+
const declarationConflicts = outputDeclarationGate?.conflicts ?? [];
|
|
94
|
+
const qualityConflicts = outputQualityGate?.conflicts ?? [];
|
|
95
|
+
const proofConflicts = projectProofEvidenceConflicts(proofEvidence);
|
|
31
96
|
const graphConflicts = [...outputGraphConflicts, ...deltaGraphConflicts];
|
|
32
|
-
const
|
|
97
|
+
const outputConflicts = [...graphConflicts, ...diagnosticsConflicts, ...declarationConflicts, ...qualityConflicts, ...proofConflicts];
|
|
98
|
+
const status = blockedFiles.length || outputConflicts.length ? 'blocked' : 'merged';
|
|
33
99
|
const reasonCodes = uniqueStrings([
|
|
34
100
|
...blockedFiles.flatMap((file) => file.admission.reasonCodes),
|
|
35
|
-
...
|
|
101
|
+
...outputConflicts.map((conflict) => conflict.code)
|
|
36
102
|
]);
|
|
37
103
|
const conflictKeys = uniqueStrings([
|
|
38
104
|
...fileResults.flatMap((file) => file.conflictKeys),
|
|
39
|
-
...
|
|
105
|
+
...outputConflicts.map((conflict) => conflict.details?.conflictKey)
|
|
40
106
|
]);
|
|
107
|
+
const baseSummary = projectSummary(fileResults, graphConflicts, Boolean(projectGraphDelta), outputDiagnosticsGate, outputDeclarationGate, outputQualityGate, moveRenameSummary, proofEvidence, symbolRenameSummary, splitMergeSummary);
|
|
108
|
+
const evidenceContext = {
|
|
109
|
+
fileResults,
|
|
110
|
+
outputDiagnosticsGate,
|
|
111
|
+
outputDeclarationGate,
|
|
112
|
+
outputQualityGate,
|
|
113
|
+
proofEvidence,
|
|
114
|
+
hasProjectGraphEvidence: Boolean(projectGraphDeltaWithConflicts || graphArtifacts?.projectSymbolGraph)
|
|
115
|
+
};
|
|
116
|
+
const evidence = projectEvidence(id, status, baseSummary, evidenceContext);
|
|
117
|
+
const confidence = projectConfidence(id, status, baseSummary, evidence, reasonCodes, conflictKeys, evidenceContext);
|
|
118
|
+
const admissionRoutes = createProjectAdmissionRoutes({ status, fileResults, conflicts: [...fileResults.flatMap((file) => file.conflicts), ...outputConflicts], missingEvidence: confidence.missingEvidence });
|
|
119
|
+
const admissionRouteSummary = projectAdmissionRouteSummary(admissionRoutes);
|
|
120
|
+
const summary = projectSummaryWithConfidenceEvidence(baseSummary, evidence, confidence);
|
|
41
121
|
const core = {
|
|
42
122
|
kind: 'frontier.lang.jsTsProjectSafeMerge',
|
|
43
123
|
version: 1,
|
|
@@ -49,18 +129,31 @@ function safeMergeJsTsProject(input = {}) {
|
|
|
49
129
|
outputProjectImport: graphArtifacts?.projectImport,
|
|
50
130
|
outputProjectSymbolGraph: graphArtifacts?.projectSymbolGraph,
|
|
51
131
|
projectGraphDelta: projectGraphDeltaWithConflicts,
|
|
52
|
-
|
|
132
|
+
outputDiagnosticsGate,
|
|
133
|
+
outputDeclarationGate,
|
|
134
|
+
declarationEmitParityProof,
|
|
135
|
+
outputQualityGate,
|
|
136
|
+
conflicts: [...fileResults.flatMap((file) => file.conflicts), ...outputConflicts],
|
|
53
137
|
admission: {
|
|
54
138
|
status: status === 'merged' ? 'auto-merge-candidate' : 'blocked',
|
|
55
139
|
action: status === 'merged' ? 'apply-project' : 'human-review',
|
|
56
140
|
reviewRequired: status !== 'merged',
|
|
57
141
|
autoApplyCandidate: status === 'merged',
|
|
58
142
|
autoMergeClaim: false,
|
|
59
|
-
semanticEquivalenceClaim:
|
|
143
|
+
semanticEquivalenceClaim: proofEvidence.summary.semanticEquivalenceClaim === true,
|
|
144
|
+
semanticEquivalenceLevel: proofEvidence.semanticEquivalenceLevel,
|
|
145
|
+
proofEvidenceStatus: proofEvidence.status,
|
|
146
|
+
proofEvidenceLevels: proofEvidence.summary.evidenceLevels,
|
|
147
|
+
proofEvidenceIds: proofEvidence.records.map((record) => record.id),
|
|
148
|
+
routes: admissionRoutes,
|
|
149
|
+
routeSummary: admissionRouteSummary,
|
|
60
150
|
reasonCodes,
|
|
61
151
|
conflictKeys
|
|
62
152
|
},
|
|
63
|
-
|
|
153
|
+
proofEvidence,
|
|
154
|
+
confidence,
|
|
155
|
+
evidence,
|
|
156
|
+
summary,
|
|
64
157
|
metadata: compactRecord({
|
|
65
158
|
workerChangeSetId: input.workerChangeSetId,
|
|
66
159
|
headChangeSetId: input.headChangeSetId,
|
|
@@ -71,20 +164,61 @@ function safeMergeJsTsProject(input = {}) {
|
|
|
71
164
|
projectGraphConflicts: graphConflicts.length || undefined,
|
|
72
165
|
outputProjectGraphConflicts: outputGraphConflicts.length || undefined,
|
|
73
166
|
projectGraphDeltaConflicts: deltaGraphConflicts.length || undefined,
|
|
167
|
+
projectGraphSourceSpanConflicts: deltaGraphConflicts.filter((conflict) => conflict.code === 'project-source-span-delta-conflict').length || undefined,
|
|
168
|
+
projectGraphCompilerTypeConflicts: deltaGraphConflicts.filter((conflict) => conflict.code === 'project-public-compiler-type-delta-conflict').length || undefined,
|
|
169
|
+
projectGraphRuntimeRegionConflicts: deltaGraphConflicts.filter((conflict) => conflict.code === 'project-public-runtime-region-delta-conflict').length || undefined,
|
|
170
|
+
projectGraphScopeUseDefConflicts: deltaGraphConflicts.filter((conflict) => conflict.code === 'project-public-scope-use-def-delta-conflict' || conflict.code === 'project-public-scope-reference-delta-conflict').length || undefined,
|
|
171
|
+
projectGraphJsxPropConflicts: deltaGraphConflicts.filter((conflict) => conflict.code === 'project-jsx-public-prop-delta-conflict').length || undefined,
|
|
172
|
+
projectGraphJsxRenderRiskConflicts: deltaGraphConflicts.filter((conflict) => conflict.code === 'project-jsx-public-render-risk-delta-conflict').length || undefined,
|
|
173
|
+
projectGraphModuleDeclarationShapeConflicts: deltaGraphConflicts.filter((conflict) => conflict.code === 'project-module-declaration-shape-delta-conflict').length || undefined,
|
|
174
|
+
projectGraphExportAssignmentShapeConflicts: deltaGraphConflicts.filter((conflict) => conflict.code === 'project-export-assignment-shape-delta-conflict').length || undefined,
|
|
74
175
|
projectGraphLimitConflicts: graphConflicts.filter((conflict) => conflict.gateId === 'project-graph-limit').length || undefined,
|
|
176
|
+
outputDiagnostics: outputDiagnosticsGate?.summary?.diagnostics || undefined,
|
|
177
|
+
outputDiagnosticConflicts: diagnosticsConflicts.length || undefined,
|
|
178
|
+
outputDiagnosticSource: outputDiagnosticsGate?.metadata?.diagnosticSource,
|
|
179
|
+
outputCompilerOptions: outputDiagnosticsGate?.metadata?.compilerOptions,
|
|
180
|
+
outputCompilerOptionSources: outputDiagnosticsGate?.metadata?.compilerOptionSources,
|
|
181
|
+
outputProjectReferences: outputDiagnosticsGate?.metadata?.projectReferences,
|
|
182
|
+
outputProjectReferenceCount: outputDiagnosticsGate?.metadata?.projectReferenceCount,
|
|
183
|
+
outputDeclarations: outputDeclarationGate?.summary?.declarationFiles || undefined,
|
|
184
|
+
outputDeclarationConflicts: declarationConflicts.length || undefined,
|
|
185
|
+
declarationEmitParityProofStatus: declarationEmitParityProof?.status,
|
|
186
|
+
declarationEmitParityProofReasonCodes: declarationEmitParityProof?.reasonCodes,
|
|
187
|
+
outputQualityGateConflicts: qualityConflicts.length || undefined,
|
|
188
|
+
proofEvidence: proofEvidence.summary,
|
|
189
|
+
semanticEquivalenceLevel: proofEvidence.semanticEquivalenceLevel,
|
|
190
|
+
confidenceScore: confidence.score,
|
|
191
|
+
confidenceLevel: confidence.level,
|
|
192
|
+
projectAdmissionRoutes: admissionRoutes.length || undefined,
|
|
193
|
+
evidenceRecords: evidence.length || undefined,
|
|
194
|
+
failedEvidenceRecords: evidence.filter((record) => record.status === 'failed').length || undefined,
|
|
195
|
+
projectMoveRenameClassifications: moveRenameSummary.classifications || moveRenameSummary.symbolMoveAdmissions ? moveRenameSummary : undefined,
|
|
196
|
+
projectSymbolRenameClassifications: symbolRenameSummary.classifications || symbolRenameSummary.admissions ? symbolRenameSummary : undefined,
|
|
197
|
+
projectSplitMergeClassifications: splitMergeSummary.classifications || splitMergeSummary.splitMergeAdmissions ? splitMergeSummary : undefined,
|
|
75
198
|
autoMergeClaim: false,
|
|
76
|
-
semanticEquivalenceClaim:
|
|
199
|
+
semanticEquivalenceClaim: proofEvidence.summary.semanticEquivalenceClaim === true
|
|
77
200
|
})
|
|
78
201
|
};
|
|
79
202
|
return { ...core, hash: hashSemanticValue(core) };
|
|
80
203
|
}
|
|
81
204
|
|
|
82
|
-
function
|
|
205
|
+
function outputParserTriviaEvidence(file, resultFile) {
|
|
206
|
+
if (!file) return undefined;
|
|
207
|
+
if (file.outputParserTriviaEvidence) return file.outputParserTriviaEvidence;
|
|
208
|
+
const workerText = file.workerDeleted ? undefined : file.workerSourceText ?? file.baseSourceText;
|
|
209
|
+
return resultFile.outputHash && resultFile.outputHash === hashText(workerText)
|
|
210
|
+
? file.workerParserTriviaEvidence ?? file.parserTriviaEvidence
|
|
211
|
+
: undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function mergeProjectFile(file, input, projectId, projectSymbolRenames) {
|
|
83
215
|
const base = file.baseSourceText;
|
|
84
216
|
const worker = file.workerDeleted ? undefined : file.workerSourceText ?? base;
|
|
85
217
|
const head = file.headDeleted ? undefined : file.headSourceText ?? base;
|
|
86
218
|
const context = { sourcePath: file.sourcePath, language: file.language ?? input.language ?? 'typescript' };
|
|
87
219
|
if (!file.sourcePath) return blockedFile(file, context, 'missing-source-path');
|
|
220
|
+
const ambientBlock = maybeBlockAmbientProjectFile(file, context, input);
|
|
221
|
+
if (ambientBlock) return ambientBlock;
|
|
88
222
|
if (base === undefined && worker === undefined && head !== undefined) {
|
|
89
223
|
return syntheticFile(file, context, head, 'head-only');
|
|
90
224
|
}
|
|
@@ -109,10 +243,11 @@ function mergeProjectFile(file, input, projectId) {
|
|
|
109
243
|
: blockedFile(file, context, 'head-file-delete-conflict');
|
|
110
244
|
}
|
|
111
245
|
const result = safeMergeJsTsSource({
|
|
112
|
-
...input,
|
|
246
|
+
...sourceMergeInputForProjectFile(input),
|
|
113
247
|
...context,
|
|
114
248
|
deferReExportIdentityConflictsToProjectGraph: input.includeProjectGraphDelta === true || input.includeOutputProjectSymbolGraph === true,
|
|
115
249
|
deferTopLevelRenamePublicExportContractToProjectGraph: input.includeProjectGraphDelta === true || input.includeOutputProjectSymbolGraph === true,
|
|
250
|
+
deferDirectExportRenamePublicContractToProjectSymbolRename: allowsProjectSymbolRenameForFile(input, projectSymbolRenames, file.sourcePath),
|
|
116
251
|
id: `${projectId}_${safeId(file.sourcePath)}`,
|
|
117
252
|
baseSourceText: base,
|
|
118
253
|
workerSourceText: worker,
|
|
@@ -120,7 +255,10 @@ function mergeProjectFile(file, input, projectId) {
|
|
|
120
255
|
sourceLedgers: sourceLedgersForFile(input, file.sourcePath),
|
|
121
256
|
policy: file.policy ?? file.mergePolicy ?? policyForFile(input, file.sourcePath)
|
|
122
257
|
});
|
|
123
|
-
if (result.status !== 'merged')
|
|
258
|
+
if (result.status !== 'merged') {
|
|
259
|
+
return maybeMergeImportSpecifierRemovalFile(file, context, result, input)
|
|
260
|
+
?? mergeBlockedFile(file, context, result);
|
|
261
|
+
}
|
|
124
262
|
return compactRecord({
|
|
125
263
|
kind: 'frontier.lang.jsTsProjectSafeMergeFile',
|
|
126
264
|
version: 1,
|
|
@@ -142,6 +280,26 @@ function mergeProjectFile(file, input, projectId) {
|
|
|
142
280
|
});
|
|
143
281
|
}
|
|
144
282
|
|
|
283
|
+
function allowsProjectSymbolRenameForFile(input, projectSymbolRenames, sourcePath) {
|
|
284
|
+
return (input.allowProjectSymbolRenames === true || input.allowCrossFileSymbolRenames === true)
|
|
285
|
+
&& projectSymbolRenames?.byPath?.has(sourcePath);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function sourceMergeInputForProjectFile(input) {
|
|
289
|
+
const {
|
|
290
|
+
outputDiagnostics,
|
|
291
|
+
outputSyntaxDiagnostics,
|
|
292
|
+
mergedOutputSyntaxDiagnostics,
|
|
293
|
+
syntaxDiagnostics,
|
|
294
|
+
requireOutputSyntaxDiagnostics,
|
|
295
|
+
requireOutputSyntaxGate,
|
|
296
|
+
requireMergedOutputSyntaxDiagnostics,
|
|
297
|
+
requireSyntaxGate,
|
|
298
|
+
...sourceInput
|
|
299
|
+
} = input;
|
|
300
|
+
return sourceInput;
|
|
301
|
+
}
|
|
302
|
+
|
|
145
303
|
function mergeBlockedFile(file, context, result) {
|
|
146
304
|
return compactRecord({
|
|
147
305
|
kind: 'frontier.lang.jsTsProjectSafeMergeFile',
|
|
@@ -158,163 +316,4 @@ function mergeBlockedFile(file, context, result) {
|
|
|
158
316
|
});
|
|
159
317
|
}
|
|
160
318
|
|
|
161
|
-
function syntheticFile(file, context, sourceText, operation) {
|
|
162
|
-
return compactRecord({
|
|
163
|
-
kind: 'frontier.lang.jsTsProjectSafeMergeFile',
|
|
164
|
-
version: 1,
|
|
165
|
-
sourcePath: file.sourcePath,
|
|
166
|
-
language: context.language,
|
|
167
|
-
status: 'merged',
|
|
168
|
-
operation,
|
|
169
|
-
outputSourceText: sourceText,
|
|
170
|
-
outputHash: hashText(sourceText),
|
|
171
|
-
baseHash: hashText(file.baseSourceText),
|
|
172
|
-
workerHash: hashText(file.workerSourceText),
|
|
173
|
-
headHash: hashText(file.headSourceText),
|
|
174
|
-
conflicts: [],
|
|
175
|
-
admission: admittedSyntheticAdmission(operation),
|
|
176
|
-
summary: { conflicts: 0, synthetic: true },
|
|
177
|
-
conflictKeys: [`source#${file.sourcePath}`]
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function blockedFile(file, context, reasonCode) {
|
|
182
|
-
const conflict = {
|
|
183
|
-
code: reasonCode,
|
|
184
|
-
gateId: 'project-file-presence',
|
|
185
|
-
message: `Project file cannot be safely merged: ${reasonCode}.`,
|
|
186
|
-
sourcePath: file.sourcePath,
|
|
187
|
-
details: { sourcePath: file.sourcePath }
|
|
188
|
-
};
|
|
189
|
-
return compactRecord({
|
|
190
|
-
kind: 'frontier.lang.jsTsProjectSafeMergeFile',
|
|
191
|
-
version: 1,
|
|
192
|
-
sourcePath: file.sourcePath,
|
|
193
|
-
language: context.language,
|
|
194
|
-
status: 'blocked',
|
|
195
|
-
operation: 'blocked-file-presence',
|
|
196
|
-
conflicts: [conflict],
|
|
197
|
-
admission: blockedAdmission(reasonCode),
|
|
198
|
-
summary: { conflicts: 1, synthetic: true },
|
|
199
|
-
conflictKeys: [`source#${file.sourcePath ?? 'unknown'}`]
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function normalizeProjectFiles(input) {
|
|
204
|
-
if (Array.isArray(input.files)) return input.files.map(normalizeFileRecord).sort(bySourcePath);
|
|
205
|
-
const base = normalizeFileMap(input.baseFiles);
|
|
206
|
-
const worker = normalizeFileMap(input.workerFiles);
|
|
207
|
-
const head = normalizeFileMap(input.headFiles);
|
|
208
|
-
const paths = [...new Set([...base.keys(), ...worker.keys(), ...head.keys()])].sort();
|
|
209
|
-
return paths.map((sourcePath) => normalizeFileRecord({
|
|
210
|
-
sourcePath,
|
|
211
|
-
baseSourceText: base.get(sourcePath),
|
|
212
|
-
workerSourceText: worker.get(sourcePath),
|
|
213
|
-
headSourceText: head.get(sourcePath)
|
|
214
|
-
}));
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function normalizeFileRecord(record = {}) {
|
|
218
|
-
return {
|
|
219
|
-
sourcePath: record.sourcePath ?? record.path,
|
|
220
|
-
language: record.language,
|
|
221
|
-
baseSourceText: stringOrUndefined(record.baseSourceText ?? record.baseText),
|
|
222
|
-
workerSourceText: stringOrUndefined(record.workerSourceText ?? record.workerText),
|
|
223
|
-
headSourceText: stringOrUndefined(record.headSourceText ?? record.headText),
|
|
224
|
-
workerDeleted: record.workerDeleted === true,
|
|
225
|
-
headDeleted: record.headDeleted === true,
|
|
226
|
-
policy: record.policy,
|
|
227
|
-
mergePolicy: record.mergePolicy
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function normalizeFileMap(value) {
|
|
232
|
-
const map = new Map();
|
|
233
|
-
if (!value) return map;
|
|
234
|
-
if (value instanceof Map) {
|
|
235
|
-
for (const [sourcePath, sourceText] of value) map.set(String(sourcePath), String(sourceText));
|
|
236
|
-
return map;
|
|
237
|
-
}
|
|
238
|
-
if (Array.isArray(value)) {
|
|
239
|
-
for (const entry of value) {
|
|
240
|
-
if (!entry?.sourcePath && !entry?.path) continue;
|
|
241
|
-
map.set(String(entry.sourcePath ?? entry.path), String(entry.sourceText ?? entry.text ?? ''));
|
|
242
|
-
}
|
|
243
|
-
return map;
|
|
244
|
-
}
|
|
245
|
-
for (const [sourcePath, sourceText] of Object.entries(value)) map.set(sourcePath, String(sourceText));
|
|
246
|
-
return map;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function policyForFile(input, sourcePath) {
|
|
250
|
-
if (input.policyByPath?.[sourcePath]) return input.policyByPath[sourcePath];
|
|
251
|
-
if (input.mergePolicyByPath?.[sourcePath]) return input.mergePolicyByPath[sourcePath];
|
|
252
|
-
return input.policy ?? input.mergePolicy;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function sourceLedgersForFile(input, sourcePath) {
|
|
256
|
-
const byPath = input.sourceLedgersByPath?.[sourcePath] ?? input.sourceLedgers?.[sourcePath];
|
|
257
|
-
return byPath ?? (input.sourceLedgers?.base || input.sourceLedgers?.worker || input.sourceLedgers?.head ? input.sourceLedgers : undefined);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function projectSummary(files, graphConflicts = [], hasProjectGraphDelta = false) {
|
|
261
|
-
const byOperation = {};
|
|
262
|
-
for (const file of files) byOperation[file.operation] = (byOperation[file.operation] ?? 0) + 1;
|
|
263
|
-
const limitConflicts = graphConflicts.filter((conflict) => conflict.gateId === 'project-graph-limit');
|
|
264
|
-
const deltaConflicts = graphConflicts.filter((conflict) => conflict.gateId === 'project-graph-delta' || (hasProjectGraphDelta && conflict.gateId === 'project-graph-limit'));
|
|
265
|
-
const outputConflicts = graphConflicts.filter((conflict) => conflict.gateId === 'project-symbol-graph' || (!hasProjectGraphDelta && conflict.gateId === 'project-graph-limit'));
|
|
266
|
-
return {
|
|
267
|
-
files: files.length,
|
|
268
|
-
mergedFiles: files.filter((file) => file.status === 'merged').length,
|
|
269
|
-
blockedFiles: files.filter((file) => file.status === 'blocked').length,
|
|
270
|
-
outputFiles: files.filter((file) => typeof file.outputSourceText === 'string').length,
|
|
271
|
-
projectGraphConflicts: graphConflicts.length,
|
|
272
|
-
outputProjectGraphConflicts: outputConflicts.length,
|
|
273
|
-
projectGraphDeltaConflicts: deltaConflicts.length,
|
|
274
|
-
projectGraphLimitConflicts: limitConflicts.length,
|
|
275
|
-
projectGraphPublicContractConflicts: deltaConflicts.filter((conflict) => conflict.code === 'project-public-contract-delta-conflict').length,
|
|
276
|
-
projectGraphReExportIdentityConflicts: deltaConflicts.filter((conflict) => conflict.code === 'project-re-export-identity-delta-conflict').length,
|
|
277
|
-
projectGraphImportTargetConflicts: deltaConflicts.filter((conflict) => conflict.code === 'project-import-target-delta-conflict').length,
|
|
278
|
-
semanticArtifactFiles: files.filter((file) => file.semanticArtifacts).length,
|
|
279
|
-
operations: byOperation
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function admittedSyntheticAdmission(operation) {
|
|
284
|
-
return {
|
|
285
|
-
status: 'auto-merge-candidate',
|
|
286
|
-
action: operation === 'head-only' ? 'preserve-head' : 'apply',
|
|
287
|
-
reviewRequired: false,
|
|
288
|
-
autoApplyCandidate: true,
|
|
289
|
-
autoMergeClaim: false,
|
|
290
|
-
semanticEquivalenceClaim: false,
|
|
291
|
-
reasonCodes: []
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function blockedAdmission(reasonCode) {
|
|
296
|
-
return {
|
|
297
|
-
status: 'blocked',
|
|
298
|
-
action: 'human-review',
|
|
299
|
-
reviewRequired: true,
|
|
300
|
-
autoApplyCandidate: false,
|
|
301
|
-
autoMergeClaim: false,
|
|
302
|
-
semanticEquivalenceClaim: false,
|
|
303
|
-
reasonCodes: [reasonCode]
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function hashText(text) { return typeof text === 'string' ? hashSemanticValue(text) : undefined; }
|
|
308
|
-
function stringOrUndefined(value) { return typeof value === 'string' ? value : undefined; }
|
|
309
|
-
|
|
310
|
-
function safeId(value) {
|
|
311
|
-
return String(value ?? 'unknown').replace(/[^a-zA-Z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'file';
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function bySourcePath(left, right) { return String(left.sourcePath ?? '').localeCompare(String(right.sourcePath ?? '')); }
|
|
315
|
-
|
|
316
|
-
function uniqueStrings(values) {
|
|
317
|
-
return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))];
|
|
318
|
-
}
|
|
319
|
-
|
|
320
319
|
export { safeMergeJsTsProject };
|