@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.
- 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-patch-bundle-composition.d.ts +62 -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 +32 -0
- package/dist/index.js +6 -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/semanticPatchBundleComposition.js +166 -0
- 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-context.js +1 -0
- package/dist/js-ts-safe-merge-jsx-attribute-fallback.js +314 -0
- 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-plan.js +3 -1
- package/dist/js-ts-safe-merge-semantic-edit-fallback.js +49 -0
- package/dist/js-ts-safe-merge-source-shape-fallbacks.js +5 -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 +171 -172
- 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,7 +1,14 @@
|
|
|
1
|
-
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
1
|
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { publicCompilerTypeDeltaConflicts } from './js-ts-safe-project-merge-graph-delta-compiler-conflicts.js';
|
|
3
|
+
import { projectJsxPropDeltaConflicts, projectJsxRenderRiskDeltaConflicts } from './js-ts-safe-project-merge-jsx-graph-conflicts.js';
|
|
4
|
+
import { projectRuntimeRegionDeltaConflicts } from './js-ts-safe-project-merge-runtime-region-conflicts.js';
|
|
5
|
+
import { projectScopeUseDefDeltaConflicts } from './js-ts-safe-project-merge-scope-use-def-conflicts.js';
|
|
6
|
+
import { projectSourceSpanDeltaConflicts } from './js-ts-safe-project-merge-source-span-conflicts.js';
|
|
7
|
+
import { projectModuleDeclarationDeltaConflicts } from './js-ts-safe-project-merge-graph-delta-module-declarations.js';
|
|
8
|
+
import { commonJsRuntimeInteropDelta, commonJsRuntimeInteropProofAssessment } from './js-ts-safe-project-merge-graph-delta-commonjs-interop.js';
|
|
9
|
+
import { projectImportAttributeDeltaConflicts, projectPublicContractDeltaConflicts, projectReExportIdentityDeltaConflicts } from './js-ts-safe-project-merge-graph-delta-identity-conflicts.js';
|
|
10
|
+
|
|
11
|
+
function projectGraphDeltaConflicts(projectGraphDelta, options = {}) {
|
|
5
12
|
const limitConflicts = projectGraphDeltaLimitConflicts(projectGraphDelta);
|
|
6
13
|
const baseGraph = projectGraphDelta?.stages?.base?.projectSymbolGraph;
|
|
7
14
|
const workerGraph = projectGraphDelta?.stages?.worker?.projectSymbolGraph;
|
|
@@ -10,29 +17,17 @@ function projectGraphDeltaConflicts(projectGraphDelta) {
|
|
|
10
17
|
if (!baseGraph || !workerGraph || !headGraph) return limitConflicts;
|
|
11
18
|
return [
|
|
12
19
|
...limitConflicts,
|
|
13
|
-
...
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...changedIdentityConflicts({
|
|
25
|
-
code: 'project-re-export-identity-delta-conflict',
|
|
26
|
-
label: 're-export identity',
|
|
27
|
-
baseRecords: baseGraph.reExportIdentities,
|
|
28
|
-
workerRecords: workerGraph.reExportIdentities,
|
|
29
|
-
headRecords: headGraph.reExportIdentities,
|
|
30
|
-
outputRecords: outputGraph?.reExportIdentities,
|
|
31
|
-
identityKey: reExportIdentityKey,
|
|
32
|
-
fingerprint: reExportIdentityFingerprint,
|
|
33
|
-
details: reExportIdentityDetails
|
|
34
|
-
}),
|
|
35
|
-
...projectImportTargetDeltaConflicts(projectGraphDelta)
|
|
20
|
+
...projectPublicContractDeltaConflicts(baseGraph, workerGraph, headGraph, outputGraph),
|
|
21
|
+
...publicCompilerTypeDeltaConflicts(baseGraph, workerGraph, headGraph, outputGraph, options),
|
|
22
|
+
...projectSourceSpanDeltaConflicts(projectGraphDelta),
|
|
23
|
+
...projectRuntimeRegionDeltaConflicts(projectGraphDelta, options),
|
|
24
|
+
...projectScopeUseDefDeltaConflicts(projectGraphDelta),
|
|
25
|
+
...projectJsxPropDeltaConflicts(projectGraphDelta),
|
|
26
|
+
...projectJsxRenderRiskDeltaConflicts(projectGraphDelta, options),
|
|
27
|
+
...projectReExportIdentityDeltaConflicts(baseGraph, workerGraph, headGraph, outputGraph),
|
|
28
|
+
...projectModuleDeclarationDeltaConflicts(projectGraphDelta, options),
|
|
29
|
+
...projectImportAttributeDeltaConflicts(baseGraph, workerGraph, headGraph, outputGraph),
|
|
30
|
+
...projectImportTargetDeltaConflicts(projectGraphDelta, options)
|
|
36
31
|
];
|
|
37
32
|
}
|
|
38
33
|
|
|
@@ -44,7 +39,15 @@ function addProjectGraphDeltaConflictSummary(projectGraphDelta, conflicts) {
|
|
|
44
39
|
...projectGraphDelta.summary,
|
|
45
40
|
conflicts: conflicts.length,
|
|
46
41
|
publicContractConflicts: conflicts.filter((conflict) => conflict.code === 'project-public-contract-delta-conflict').length,
|
|
42
|
+
sourceSpanConflicts: conflicts.filter((conflict) => conflict.code === 'project-source-span-delta-conflict').length,
|
|
43
|
+
compilerTypeConflicts: conflicts.filter((conflict) => conflict.code === 'project-public-compiler-type-delta-conflict').length,
|
|
44
|
+
runtimeRegionConflicts: conflicts.filter((conflict) => conflict.code === 'project-public-runtime-region-delta-conflict').length,
|
|
45
|
+
scopeUseDefConflicts: conflicts.filter(isScopeUseDefConflict).length,
|
|
46
|
+
jsxPropConflicts: conflicts.filter((conflict) => conflict.code === 'project-jsx-public-prop-delta-conflict').length,
|
|
47
|
+
jsxRenderRiskConflicts: conflicts.filter((conflict) => conflict.code === 'project-jsx-public-render-risk-delta-conflict').length,
|
|
47
48
|
reExportIdentityConflicts: conflicts.filter((conflict) => conflict.code === 'project-re-export-identity-delta-conflict').length,
|
|
49
|
+
moduleDeclarationShapeConflicts: conflicts.filter((conflict) => conflict.code === 'project-module-declaration-shape-delta-conflict').length, exportAssignmentShapeConflicts: conflicts.filter((conflict) => conflict.code === 'project-export-assignment-shape-delta-conflict').length,
|
|
50
|
+
importAttributeConflicts: conflicts.filter((conflict) => conflict.code === 'project-import-attribute-delta-conflict').length,
|
|
48
51
|
importTargetConflicts: conflicts.filter((conflict) => conflict.code === 'project-import-target-delta-conflict').length,
|
|
49
52
|
limitConflicts: conflicts.filter((conflict) => conflict.gateId === 'project-graph-limit').length
|
|
50
53
|
}
|
|
@@ -54,35 +57,9 @@ function addProjectGraphDeltaConflictSummary(projectGraphDelta, conflicts) {
|
|
|
54
57
|
function projectGraphDeltaLimitConflicts(projectGraphDelta) {
|
|
55
58
|
return Object.values(projectGraphDelta?.stages ?? {}).flatMap((stage) => stage?.limitConflicts ?? []);
|
|
56
59
|
}
|
|
60
|
+
function isScopeUseDefConflict(conflict) { return conflict.code === 'project-public-scope-use-def-delta-conflict' || conflict.code === 'project-public-scope-reference-delta-conflict'; }
|
|
57
61
|
|
|
58
|
-
function
|
|
59
|
-
const base = recordsByIdentityKey(input.baseRecords, input.identityKey);
|
|
60
|
-
const worker = recordsByIdentityKey(input.workerRecords, input.identityKey);
|
|
61
|
-
const head = recordsByIdentityKey(input.headRecords, input.identityKey);
|
|
62
|
-
const output = recordsByIdentityKey(input.outputRecords, input.identityKey);
|
|
63
|
-
const keys = uniqueStrings([...base.keys(), ...worker.keys(), ...head.keys()]);
|
|
64
|
-
return keys.flatMap((identityKey) => {
|
|
65
|
-
const baseRecord = base.get(identityKey);
|
|
66
|
-
const workerRecord = worker.get(identityKey);
|
|
67
|
-
const headRecord = head.get(identityKey);
|
|
68
|
-
const baseFingerprint = optionalFingerprint(baseRecord, input.fingerprint);
|
|
69
|
-
const workerFingerprint = optionalFingerprint(workerRecord, input.fingerprint);
|
|
70
|
-
const headFingerprint = optionalFingerprint(headRecord, input.fingerprint);
|
|
71
|
-
if (baseFingerprint === workerFingerprint || baseFingerprint === headFingerprint || workerFingerprint === headFingerprint) return [];
|
|
72
|
-
return [projectGraphDeltaConflict({
|
|
73
|
-
code: input.code,
|
|
74
|
-
label: input.label,
|
|
75
|
-
identityKey,
|
|
76
|
-
baseRecord,
|
|
77
|
-
workerRecord,
|
|
78
|
-
headRecord,
|
|
79
|
-
outputRecord: output.get(identityKey),
|
|
80
|
-
details: input.details
|
|
81
|
-
})];
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function projectImportTargetDeltaConflicts(projectGraphDelta) {
|
|
62
|
+
function projectImportTargetDeltaConflicts(projectGraphDelta, options = {}) {
|
|
86
63
|
const baseStage = projectGraphDelta?.stages?.base;
|
|
87
64
|
const workerStage = projectGraphDelta?.stages?.worker;
|
|
88
65
|
const headStage = projectGraphDelta?.stages?.head;
|
|
@@ -91,38 +68,23 @@ function projectImportTargetDeltaConflicts(projectGraphDelta) {
|
|
|
91
68
|
const baseSymbolIds = semanticSymbolIds(baseStage);
|
|
92
69
|
const headSymbolIds = semanticSymbolIds(headStage);
|
|
93
70
|
const conflicts = [];
|
|
94
|
-
|
|
71
|
+
const outputGraph = outputStage?.projectSymbolGraph;
|
|
72
|
+
for (const [identityKey, edge] of importEdgesByIdentityKey(outputGraph?.importEdges)) {
|
|
95
73
|
if (!edge.resolvedTargetSymbolId) continue;
|
|
96
74
|
const workerEdge = workerEdges.get(identityKey);
|
|
97
75
|
if (!workerEdge || workerEdge.resolvedTargetSymbolId === edge.resolvedTargetSymbolId) continue;
|
|
98
76
|
if (baseSymbolIds.has(edge.resolvedTargetSymbolId) || !headSymbolIds.has(edge.resolvedTargetSymbolId)) continue;
|
|
99
|
-
|
|
77
|
+
const commonJsInteropDelta = commonJsRuntimeInteropDelta(identityKey, edge, workerEdge, outputGraph);
|
|
78
|
+
const commonJsProof = commonJsInteropDelta
|
|
79
|
+
? commonJsRuntimeInteropProofAssessment(commonJsInteropDelta, options)
|
|
80
|
+
: undefined;
|
|
81
|
+
if (commonJsProof?.status === 'passed') continue;
|
|
82
|
+
conflicts.push(projectImportTargetDeltaConflict(identityKey, edge, workerEdge, commonJsProof));
|
|
100
83
|
}
|
|
101
84
|
return conflicts;
|
|
102
85
|
}
|
|
103
86
|
|
|
104
|
-
function
|
|
105
|
-
const sourcePath = input.workerRecord?.sourcePath ?? input.headRecord?.sourcePath ?? input.baseRecord?.sourcePath;
|
|
106
|
-
const conflictKey = `project-graph-delta#${input.label.replace(/\s+/g, '-')}#${input.identityKey}`;
|
|
107
|
-
return {
|
|
108
|
-
code: input.code,
|
|
109
|
-
gateId: 'project-graph-delta',
|
|
110
|
-
message: `Worker and head both changed ${input.label} ${JSON.stringify(input.identityKey)} in incompatible ways.`,
|
|
111
|
-
sourcePath,
|
|
112
|
-
details: compactRecord({
|
|
113
|
-
reasonCode: input.code,
|
|
114
|
-
conflictKey,
|
|
115
|
-
identityKey: input.identityKey,
|
|
116
|
-
sourcePath,
|
|
117
|
-
base: input.details(input.baseRecord),
|
|
118
|
-
worker: input.details(input.workerRecord),
|
|
119
|
-
head: input.details(input.headRecord),
|
|
120
|
-
output: input.details(input.outputRecord)
|
|
121
|
-
})
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function projectImportTargetDeltaConflict(identityKey, edge, workerEdge) {
|
|
87
|
+
function projectImportTargetDeltaConflict(identityKey, edge, workerEdge, commonJsProof) {
|
|
126
88
|
return {
|
|
127
89
|
code: 'project-import-target-delta-conflict',
|
|
128
90
|
gateId: 'project-graph-delta',
|
|
@@ -137,105 +99,25 @@ function projectImportTargetDeltaConflict(identityKey, edge, workerEdge) {
|
|
|
137
99
|
importedName: edge.importedName,
|
|
138
100
|
localName: edge.localName,
|
|
139
101
|
importKind: edge.importKind,
|
|
102
|
+
commonJs: edge.commonJs,
|
|
103
|
+
interopHelper: edge.interopHelper,
|
|
104
|
+
packageRuntimeCondition: edge.packageRuntimeCondition,
|
|
105
|
+
packageRuntimeConditionEdgeKind: edge.packageRuntimeConditionEdgeKind,
|
|
140
106
|
resolvedModulePath: edge.resolvedModulePath,
|
|
141
107
|
outputTargetSymbolId: edge.resolvedTargetSymbolId,
|
|
142
108
|
workerTargetSymbolId: workerEdge.resolvedTargetSymbolId,
|
|
143
109
|
workerResolutionKind: workerEdge.resolutionKind,
|
|
144
|
-
outputResolutionKind: edge.resolutionKind
|
|
110
|
+
outputResolutionKind: edge.resolutionKind,
|
|
111
|
+
routeId: commonJsProof?.routeId,
|
|
112
|
+
routeLane: commonJsProof?.routeLane,
|
|
113
|
+
routeNext: commonJsProof?.routeNext,
|
|
114
|
+
reasonCodes: commonJsProof?.reasonCodes,
|
|
115
|
+
commonJsRuntimeInteropProof: commonJsProof?.record,
|
|
116
|
+
semanticEquivalenceClaim: false
|
|
145
117
|
})
|
|
146
118
|
};
|
|
147
119
|
}
|
|
148
120
|
|
|
149
|
-
function recordsByIdentityKey(records, identityKey) {
|
|
150
|
-
const result = new Map();
|
|
151
|
-
for (const record of records ?? []) {
|
|
152
|
-
const key = identityKey(record);
|
|
153
|
-
if (!key || result.has(key)) continue;
|
|
154
|
-
result.set(key, record);
|
|
155
|
-
}
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function publicContractIdentityKey(record) {
|
|
160
|
-
return firstString(
|
|
161
|
-
record?.key,
|
|
162
|
-
stableKey(['public-contract', record?.sourcePath, record?.apiSurfaceKind, record?.edgeKind, record?.moduleSpecifier, record?.exportedName ?? record?.symbolName ?? record?.symbolId])
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function publicContractFingerprint(record) {
|
|
167
|
-
return hashSemanticValue({
|
|
168
|
-
kind: 'frontier.lang.projectGraphDelta.publicContractFingerprint',
|
|
169
|
-
contractHash: record.contractHash,
|
|
170
|
-
signatureHash: record.signatureHash,
|
|
171
|
-
symbolName: record.symbolName,
|
|
172
|
-
symbolKind: record.symbolKind,
|
|
173
|
-
apiSurfaceKind: record.apiSurfaceKind,
|
|
174
|
-
exportedName: record.exportedName,
|
|
175
|
-
moduleSpecifier: record.moduleSpecifier,
|
|
176
|
-
edgeKind: record.edgeKind
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function publicContractDetails(record) {
|
|
181
|
-
if (!record) return undefined;
|
|
182
|
-
return compactRecord({
|
|
183
|
-
sourcePath: record.sourcePath,
|
|
184
|
-
key: publicContractIdentityKey(record),
|
|
185
|
-
symbolName: record.symbolName,
|
|
186
|
-
symbolKind: record.symbolKind,
|
|
187
|
-
apiSurfaceKind: record.apiSurfaceKind,
|
|
188
|
-
exportedName: record.exportedName,
|
|
189
|
-
moduleSpecifier: record.moduleSpecifier,
|
|
190
|
-
edgeKind: record.edgeKind,
|
|
191
|
-
signatureHash: record.signatureHash,
|
|
192
|
-
contractHash: record.contractHash,
|
|
193
|
-
sourceHash: record.sourceHash
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function reExportIdentityKey(record) {
|
|
198
|
-
return stableKey(['re-export-identity', record?.sourcePath, record?.exportedName ?? record?.localName ?? record?.namespace ?? (record?.exportStar || record?.isExportStar ? '*' : undefined)]);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function reExportIdentityFingerprint(record) {
|
|
202
|
-
return hashSemanticValue({
|
|
203
|
-
kind: 'frontier.lang.projectGraphDelta.reExportIdentityFingerprint',
|
|
204
|
-
sourcePath: record.sourcePath,
|
|
205
|
-
moduleSpecifier: record.moduleSpecifier,
|
|
206
|
-
exportedName: record.exportedName,
|
|
207
|
-
importedName: record.importedName,
|
|
208
|
-
localName: record.localName,
|
|
209
|
-
namespace: record.namespace,
|
|
210
|
-
isTypeOnly: record.isTypeOnly,
|
|
211
|
-
exportStar: record.exportStar,
|
|
212
|
-
isExportStar: record.isExportStar,
|
|
213
|
-
originSymbolId: record.originSymbolId,
|
|
214
|
-
exportedSymbolId: record.exportedSymbolId,
|
|
215
|
-
localSymbolId: record.localSymbolId
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function reExportIdentityDetails(record) {
|
|
220
|
-
if (!record) return undefined;
|
|
221
|
-
return compactRecord({
|
|
222
|
-
sourcePath: record.sourcePath,
|
|
223
|
-
key: reExportIdentityKey(record),
|
|
224
|
-
moduleSpecifier: record.moduleSpecifier,
|
|
225
|
-
exportedName: record.exportedName,
|
|
226
|
-
importedName: record.importedName,
|
|
227
|
-
localName: record.localName,
|
|
228
|
-
namespace: record.namespace,
|
|
229
|
-
isTypeOnly: record.isTypeOnly,
|
|
230
|
-
exportStar: record.exportStar,
|
|
231
|
-
isExportStar: record.isExportStar,
|
|
232
|
-
originSymbolId: record.originSymbolId,
|
|
233
|
-
exportedSymbolId: record.exportedSymbolId,
|
|
234
|
-
localSymbolId: record.localSymbolId,
|
|
235
|
-
sourceHash: record.sourceHash
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
|
|
239
121
|
function importEdgesByIdentityKey(records) {
|
|
240
122
|
const result = new Map();
|
|
241
123
|
for (const record of records ?? []) {
|
|
@@ -259,10 +141,6 @@ function projectImportTargetName(edge) {
|
|
|
259
141
|
return String(name);
|
|
260
142
|
}
|
|
261
143
|
|
|
262
|
-
function optionalFingerprint(record, fingerprint) {
|
|
263
|
-
return record ? fingerprint(record) : undefined;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
144
|
function semanticSymbolIds(stage) {
|
|
267
145
|
return new Set((stage?.projectImport?.semanticIndex?.symbols ?? []).map((symbol) => symbol.id).filter(Boolean));
|
|
268
146
|
}
|
|
@@ -272,15 +150,4 @@ function stableKey(parts) {
|
|
|
272
150
|
return values.some(Boolean) ? values.join('#') : undefined;
|
|
273
151
|
}
|
|
274
152
|
|
|
275
|
-
function firstString(...values) {
|
|
276
|
-
for (const value of values) {
|
|
277
|
-
if (value !== undefined && value !== null && String(value)) return String(value);
|
|
278
|
-
}
|
|
279
|
-
return undefined;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
function uniqueStrings(values) {
|
|
283
|
-
return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))];
|
|
284
|
-
}
|
|
285
|
-
|
|
286
153
|
export { addProjectGraphDeltaConflictSummary, projectGraphDeltaConflicts };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
|
+
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
3
|
+
|
|
4
|
+
function projectPublicContractDeltaConflicts(baseGraph, workerGraph, headGraph, outputGraph) {
|
|
5
|
+
return changedIdentityConflicts({
|
|
6
|
+
code: 'project-public-contract-delta-conflict',
|
|
7
|
+
label: 'public contract',
|
|
8
|
+
baseRecords: baseGraph.publicContractRegions,
|
|
9
|
+
workerRecords: workerGraph.publicContractRegions,
|
|
10
|
+
headRecords: headGraph.publicContractRegions,
|
|
11
|
+
outputRecords: outputGraph?.publicContractRegions,
|
|
12
|
+
identityKey: publicContractIdentityKey,
|
|
13
|
+
fingerprint: publicContractFingerprint,
|
|
14
|
+
details: publicContractDetails
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function projectReExportIdentityDeltaConflicts(baseGraph, workerGraph, headGraph, outputGraph) {
|
|
19
|
+
return changedIdentityConflicts({
|
|
20
|
+
code: 'project-re-export-identity-delta-conflict',
|
|
21
|
+
label: 're-export identity',
|
|
22
|
+
baseRecords: baseGraph.reExportIdentities,
|
|
23
|
+
workerRecords: workerGraph.reExportIdentities,
|
|
24
|
+
headRecords: headGraph.reExportIdentities,
|
|
25
|
+
outputRecords: outputGraph?.reExportIdentities,
|
|
26
|
+
identityKey: reExportIdentityKey,
|
|
27
|
+
fingerprint: reExportIdentityFingerprint,
|
|
28
|
+
details: reExportIdentityDetails
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function projectImportAttributeDeltaConflicts(baseGraph, workerGraph, headGraph, outputGraph) {
|
|
33
|
+
return changedIdentityConflicts({
|
|
34
|
+
code: 'project-import-attribute-delta-conflict',
|
|
35
|
+
label: 'import attributes',
|
|
36
|
+
baseRecords: attributedEdges(baseGraph),
|
|
37
|
+
workerRecords: attributedEdges(workerGraph),
|
|
38
|
+
headRecords: attributedEdges(headGraph),
|
|
39
|
+
outputRecords: attributedEdges(outputGraph),
|
|
40
|
+
identityKey: importAttributeIdentityKey,
|
|
41
|
+
fingerprint: importAttributeFingerprint,
|
|
42
|
+
details: importAttributeDetails
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function changedIdentityConflicts(input) {
|
|
47
|
+
const base = recordsByIdentityKey(input.baseRecords, input.identityKey);
|
|
48
|
+
const worker = recordsByIdentityKey(input.workerRecords, input.identityKey);
|
|
49
|
+
const head = recordsByIdentityKey(input.headRecords, input.identityKey);
|
|
50
|
+
const output = recordsByIdentityKey(input.outputRecords, input.identityKey);
|
|
51
|
+
const keys = uniqueStrings([...base.keys(), ...worker.keys(), ...head.keys()]);
|
|
52
|
+
return keys.flatMap((identityKey) => {
|
|
53
|
+
const baseRecord = base.get(identityKey);
|
|
54
|
+
const workerRecord = worker.get(identityKey);
|
|
55
|
+
const headRecord = head.get(identityKey);
|
|
56
|
+
const baseFingerprint = optionalFingerprint(baseRecord, input.fingerprint);
|
|
57
|
+
const workerFingerprint = optionalFingerprint(workerRecord, input.fingerprint);
|
|
58
|
+
const headFingerprint = optionalFingerprint(headRecord, input.fingerprint);
|
|
59
|
+
if (baseFingerprint === workerFingerprint || baseFingerprint === headFingerprint || workerFingerprint === headFingerprint) return [];
|
|
60
|
+
return [projectGraphDeltaConflict({
|
|
61
|
+
code: input.code,
|
|
62
|
+
label: input.label,
|
|
63
|
+
identityKey,
|
|
64
|
+
baseRecord,
|
|
65
|
+
workerRecord,
|
|
66
|
+
headRecord,
|
|
67
|
+
outputRecord: output.get(identityKey),
|
|
68
|
+
details: input.details
|
|
69
|
+
})];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function projectGraphDeltaConflict(input) {
|
|
74
|
+
const sourcePath = input.workerRecord?.sourcePath ?? input.headRecord?.sourcePath ?? input.baseRecord?.sourcePath;
|
|
75
|
+
const conflictKey = `project-graph-delta#${input.label.replace(/\s+/g, '-')}#${input.identityKey}`;
|
|
76
|
+
return {
|
|
77
|
+
code: input.code,
|
|
78
|
+
gateId: 'project-graph-delta',
|
|
79
|
+
message: `Worker and head both changed ${input.label} ${JSON.stringify(input.identityKey)} in incompatible ways.`,
|
|
80
|
+
sourcePath,
|
|
81
|
+
details: compactRecord({
|
|
82
|
+
reasonCode: input.code,
|
|
83
|
+
conflictKey,
|
|
84
|
+
identityKey: input.identityKey,
|
|
85
|
+
sourcePath,
|
|
86
|
+
base: input.details(input.baseRecord),
|
|
87
|
+
worker: input.details(input.workerRecord),
|
|
88
|
+
head: input.details(input.headRecord),
|
|
89
|
+
output: input.details(input.outputRecord)
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function recordsByIdentityKey(records, identityKey) {
|
|
95
|
+
const result = new Map();
|
|
96
|
+
for (const record of records ?? []) {
|
|
97
|
+
const key = identityKey(record);
|
|
98
|
+
if (!key || result.has(key)) continue;
|
|
99
|
+
result.set(key, record);
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function publicContractIdentityKey(record) {
|
|
105
|
+
return firstString(
|
|
106
|
+
record?.key,
|
|
107
|
+
stableKey(['public-contract', record?.sourcePath, record?.apiSurfaceKind, record?.edgeKind, record?.moduleSpecifier, record?.exportedName ?? record?.symbolName ?? record?.symbolId])
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function publicContractFingerprint(record) {
|
|
112
|
+
return hashSemanticValue({
|
|
113
|
+
kind: 'frontier.lang.projectGraphDelta.publicContractFingerprint',
|
|
114
|
+
signatureHash: record.signatureHash,
|
|
115
|
+
symbolName: record.symbolName,
|
|
116
|
+
symbolKind: record.symbolKind,
|
|
117
|
+
apiSurfaceKind: record.apiSurfaceKind,
|
|
118
|
+
exportedName: record.exportedName,
|
|
119
|
+
moduleSpecifier: record.moduleSpecifier,
|
|
120
|
+
edgeKind: record.edgeKind
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function publicContractDetails(record) {
|
|
125
|
+
if (!record) return undefined;
|
|
126
|
+
return compactRecord({
|
|
127
|
+
sourcePath: record.sourcePath,
|
|
128
|
+
key: publicContractIdentityKey(record),
|
|
129
|
+
symbolName: record.symbolName,
|
|
130
|
+
symbolKind: record.symbolKind,
|
|
131
|
+
apiSurfaceKind: record.apiSurfaceKind,
|
|
132
|
+
exportedName: record.exportedName,
|
|
133
|
+
moduleSpecifier: record.moduleSpecifier,
|
|
134
|
+
edgeKind: record.edgeKind,
|
|
135
|
+
signatureHash: record.signatureHash,
|
|
136
|
+
contractHash: record.contractHash,
|
|
137
|
+
sourceHash: record.sourceHash
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function reExportIdentityKey(record) {
|
|
142
|
+
return stableKey(['re-export-identity', record?.sourcePath, record?.exportedName ?? record?.localName ?? record?.namespace ?? (record?.exportStar || record?.isExportStar ? '*' : undefined)]);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function reExportIdentityFingerprint(record) {
|
|
146
|
+
return hashSemanticValue({
|
|
147
|
+
kind: 'frontier.lang.projectGraphDelta.reExportIdentityFingerprint',
|
|
148
|
+
sourcePath: record.sourcePath,
|
|
149
|
+
moduleSpecifier: record.moduleSpecifier,
|
|
150
|
+
hasImportAttributes: record.hasImportAttributes,
|
|
151
|
+
importAttributeCount: record.importAttributeCount,
|
|
152
|
+
importAttributeKeys: record.importAttributeKeys, importAttributeHash: record.importAttributeHash, importAttributes: record.importAttributes,
|
|
153
|
+
exportedName: record.exportedName,
|
|
154
|
+
importedName: record.importedName,
|
|
155
|
+
localName: record.localName,
|
|
156
|
+
namespace: record.namespace,
|
|
157
|
+
isTypeOnly: record.isTypeOnly,
|
|
158
|
+
exportStar: record.exportStar,
|
|
159
|
+
isExportStar: record.isExportStar,
|
|
160
|
+
originSymbolId: record.originSymbolId,
|
|
161
|
+
exportedSymbolId: record.exportedSymbolId,
|
|
162
|
+
localSymbolId: record.localSymbolId
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function reExportIdentityDetails(record) {
|
|
167
|
+
if (!record) return undefined;
|
|
168
|
+
return compactRecord({
|
|
169
|
+
sourcePath: record.sourcePath,
|
|
170
|
+
key: reExportIdentityKey(record),
|
|
171
|
+
moduleSpecifier: record.moduleSpecifier,
|
|
172
|
+
hasImportAttributes: record.hasImportAttributes,
|
|
173
|
+
importAttributeCount: record.importAttributeCount,
|
|
174
|
+
importAttributeKeys: record.importAttributeKeys, importAttributeHash: record.importAttributeHash, importAttributes: record.importAttributes,
|
|
175
|
+
exportedName: record.exportedName,
|
|
176
|
+
importedName: record.importedName,
|
|
177
|
+
localName: record.localName,
|
|
178
|
+
namespace: record.namespace,
|
|
179
|
+
isTypeOnly: record.isTypeOnly,
|
|
180
|
+
exportStar: record.exportStar,
|
|
181
|
+
isExportStar: record.isExportStar,
|
|
182
|
+
originSymbolId: record.originSymbolId,
|
|
183
|
+
exportedSymbolId: record.exportedSymbolId,
|
|
184
|
+
localSymbolId: record.localSymbolId,
|
|
185
|
+
sourceHash: record.sourceHash
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function attributedEdges(graph) { return [...(graph?.importEdges ?? []), ...(graph?.exportEdges ?? [])].filter((edge) => edge?.hasImportAttributes || edge?.importAttributeHash); }
|
|
190
|
+
function importAttributeIdentityKey(edge) { return stableKey(['import-attribute', edge?.predicate, edge?.edgeKind, edge?.sourcePath, edge?.moduleSpecifier, edge?.isTypeOnly]); }
|
|
191
|
+
function importAttributeFingerprint(edge) { return hashSemanticValue({ kind: 'frontier.lang.projectGraphDelta.importAttributeFingerprint', hasImportAttributes: edge.hasImportAttributes, importAttributeCount: edge.importAttributeCount, importAttributeKeys: edge.importAttributeKeys, importAttributeHash: edge.importAttributeHash, importAttributes: edge.importAttributes }); }
|
|
192
|
+
function importAttributeDetails(edge) { if (!edge) return undefined; return compactRecord({ sourcePath: edge.sourcePath, key: importAttributeIdentityKey(edge), predicate: edge.predicate, moduleSpecifier: edge.moduleSpecifier, importedName: edge.importedName, exportedName: edge.exportedName, localName: edge.localName, importKind: edge.importKind, exportKind: edge.exportKind, isTypeOnly: edge.isTypeOnly, hasImportAttributes: edge.hasImportAttributes, importAttributeCount: edge.importAttributeCount, importAttributeKeys: edge.importAttributeKeys, importAttributeHash: edge.importAttributeHash, importAttributes: edge.importAttributes }); }
|
|
193
|
+
function optionalFingerprint(record, fingerprint) { return record ? fingerprint(record) : undefined; }
|
|
194
|
+
function stableKey(parts) { const values = parts.map((part) => part === undefined || part === null ? '' : String(part)); return values.some(Boolean) ? values.join('#') : undefined; }
|
|
195
|
+
function firstString(...values) { for (const value of values) if (value !== undefined && value !== null && String(value)) return String(value); return undefined; }
|
|
196
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
197
|
+
|
|
198
|
+
export {
|
|
199
|
+
projectImportAttributeDeltaConflicts,
|
|
200
|
+
projectPublicContractDeltaConflicts,
|
|
201
|
+
projectReExportIdentityDeltaConflicts
|
|
202
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
2
|
+
|
|
3
|
+
function missingSharedCompilerTypeInferenceSyntaxEvidence(workerRecord, headRecord) {
|
|
4
|
+
const missing = [workerRecord, headRecord].filter((record) => (
|
|
5
|
+
requiresCompilerTypeInferenceSyntaxProof(record) && !hasPassedCompilerTypeInferenceSyntaxProof(record)
|
|
6
|
+
));
|
|
7
|
+
if (!missing.length) return undefined;
|
|
8
|
+
return {
|
|
9
|
+
reasonCode: 'typescript-public-api-type-inference-syntax-proof-missing',
|
|
10
|
+
requiredEvidence: 'typescript-checker-public-api-type-inference-syntax-evidence',
|
|
11
|
+
semanticEquivalenceClaim: false,
|
|
12
|
+
missingRecords: missing.map(typeInferenceSyntaxMissingProofRecord)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function typeInferenceSyntaxMissingProofRecord(record) {
|
|
17
|
+
const proof = record?.typeInferenceSyntaxProof;
|
|
18
|
+
return compactRecord({
|
|
19
|
+
sourcePath: record.sourcePath,
|
|
20
|
+
sourceHash: record.sourceHash,
|
|
21
|
+
symbolId: record.symbolId,
|
|
22
|
+
symbolName: record.symbolName,
|
|
23
|
+
fullyQualifiedName: record.fullyQualifiedName,
|
|
24
|
+
typeInferenceSyntaxHash: record.typeInferenceSyntaxHash,
|
|
25
|
+
typeInferenceSyntaxProofStatus: proof?.status,
|
|
26
|
+
proofTypeInferenceSyntaxHash: proof?.typeInferenceSyntaxHash,
|
|
27
|
+
typeInferenceSyntaxProofSourcePath: proof?.sourcePath,
|
|
28
|
+
typeInferenceSyntaxProofSourceHash: proof?.sourceHash,
|
|
29
|
+
missingSignals: proof?.missingSignals,
|
|
30
|
+
reasonCodes: typeInferenceSyntaxProofReasonCodes(record, proof),
|
|
31
|
+
semanticEquivalenceClaim: proof?.semanticEquivalenceClaim ?? false,
|
|
32
|
+
evidenceIds: record.evidenceIds
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function requiresCompilerTypeInferenceSyntaxProof(record) {
|
|
37
|
+
return Boolean(record && (
|
|
38
|
+
record.typeInferenceSyntaxCount > 0
|
|
39
|
+
|| record.satisfiesExpressionCount > 0
|
|
40
|
+
|| record.asConstAssertionCount > 0
|
|
41
|
+
|| record.constTypeParameterCount > 0
|
|
42
|
+
|| record.typeInferenceSyntaxHash
|
|
43
|
+
|| record.typeInferenceSyntaxProof
|
|
44
|
+
));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function hasPassedCompilerTypeInferenceSyntaxProof(record) {
|
|
48
|
+
const proof = record?.typeInferenceSyntaxProof;
|
|
49
|
+
return Boolean(
|
|
50
|
+
record?.typeInferenceSyntaxHash
|
|
51
|
+
&& proof?.status === 'passed'
|
|
52
|
+
&& proof?.typeInferenceSyntaxHash === record.typeInferenceSyntaxHash
|
|
53
|
+
&& record?.sourcePath
|
|
54
|
+
&& record?.sourceHash
|
|
55
|
+
&& proof?.sourcePath === record.sourcePath
|
|
56
|
+
&& proof?.sourceHash === record.sourceHash
|
|
57
|
+
&& !arrayValue(proof?.missingSignals).length
|
|
58
|
+
&& !arrayValue(proof?.reasonCodes).length
|
|
59
|
+
&& proof.autoMergeClaim === false
|
|
60
|
+
&& proof.semanticEquivalenceClaim === false
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function typeInferenceSyntaxProofReasonCodes(record, proof) {
|
|
65
|
+
const reasonCodes = ['typescript-public-api-type-inference-syntax-proof-missing'];
|
|
66
|
+
if (!proof) return reasonCodes;
|
|
67
|
+
if (proof.status !== 'passed') reasonCodes.push('typescript-type-inference-syntax-proof-status-not-passed');
|
|
68
|
+
if (proof.typeInferenceSyntaxHash !== record?.typeInferenceSyntaxHash) reasonCodes.push('typescript-type-inference-syntax-proof-hash-mismatch');
|
|
69
|
+
if (!record?.sourcePath) reasonCodes.push('typescript-type-inference-syntax-record-source-path-missing');
|
|
70
|
+
if (!record?.sourceHash) reasonCodes.push('typescript-type-inference-syntax-record-source-hash-missing');
|
|
71
|
+
if (proof.sourcePath !== record?.sourcePath) reasonCodes.push('typescript-type-inference-syntax-proof-source-path-mismatch');
|
|
72
|
+
if (proof.sourceHash !== record?.sourceHash) reasonCodes.push('typescript-type-inference-syntax-proof-source-hash-mismatch');
|
|
73
|
+
if (proof.autoMergeClaim !== false || proof.semanticEquivalenceClaim !== false) reasonCodes.push('typescript-type-inference-syntax-proof-claim-flags-missing');
|
|
74
|
+
return uniqueStrings([...reasonCodes, ...arrayValue(proof.reasonCodes), ...arrayValue(proof.missingSignals).map((signal) => `typescript-${signal}-missing`)]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function arrayValue(value) { return Array.isArray(value) ? value : []; }
|
|
78
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
79
|
+
|
|
80
|
+
export { missingSharedCompilerTypeInferenceSyntaxEvidence };
|