@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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function normalizeProjectFiles(input) {
|
|
2
|
+
if (Array.isArray(input.files)) return input.files.map(normalizeFileRecord).sort(bySourcePath);
|
|
3
|
+
const base = normalizeFileMap(input.baseFiles);
|
|
4
|
+
const worker = normalizeFileMap(input.workerFiles);
|
|
5
|
+
const head = normalizeFileMap(input.headFiles);
|
|
6
|
+
const paths = [...new Set([...base.keys(), ...worker.keys(), ...head.keys()])].sort();
|
|
7
|
+
const field = (entry, name) => entry?.[name];
|
|
8
|
+
return paths.map((sourcePath) => normalizeFileRecord({
|
|
9
|
+
sourcePath,
|
|
10
|
+
baseSourceText: field(base.get(sourcePath), 'sourceText'),
|
|
11
|
+
workerSourceText: field(worker.get(sourcePath), 'sourceText'),
|
|
12
|
+
headSourceText: field(head.get(sourcePath), 'sourceText'),
|
|
13
|
+
baseParserTriviaEvidence: field(base.get(sourcePath), 'parserTriviaEvidence'),
|
|
14
|
+
workerParserTriviaEvidence: field(worker.get(sourcePath), 'parserTriviaEvidence'),
|
|
15
|
+
headParserTriviaEvidence: field(head.get(sourcePath), 'parserTriviaEvidence')
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function normalizeFileRecord(record = {}) {
|
|
20
|
+
return {
|
|
21
|
+
sourcePath: record.sourcePath ?? record.path,
|
|
22
|
+
language: record.language,
|
|
23
|
+
baseSourceText: stringOrUndefined(record.baseSourceText ?? record.baseText),
|
|
24
|
+
workerSourceText: stringOrUndefined(record.workerSourceText ?? record.workerText),
|
|
25
|
+
headSourceText: stringOrUndefined(record.headSourceText ?? record.headText),
|
|
26
|
+
workerDeleted: record.workerDeleted === true,
|
|
27
|
+
headDeleted: record.headDeleted === true,
|
|
28
|
+
policy: record.policy,
|
|
29
|
+
mergePolicy: record.mergePolicy,
|
|
30
|
+
parserTriviaEvidence: record.parserTriviaEvidence,
|
|
31
|
+
baseParserTriviaEvidence: record.baseParserTriviaEvidence,
|
|
32
|
+
workerParserTriviaEvidence: record.workerParserTriviaEvidence,
|
|
33
|
+
headParserTriviaEvidence: record.headParserTriviaEvidence,
|
|
34
|
+
outputParserTriviaEvidence: record.outputParserTriviaEvidence
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function normalizeFileMap(value) {
|
|
39
|
+
const map = new Map();
|
|
40
|
+
if (!value) return map;
|
|
41
|
+
if (value instanceof Map) {
|
|
42
|
+
for (const [sourcePath, entry] of value) map.set(String(sourcePath), normalizeMapFileEntry(entry));
|
|
43
|
+
return map;
|
|
44
|
+
}
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
for (const entry of value) {
|
|
47
|
+
if (!entry?.sourcePath && !entry?.path) continue;
|
|
48
|
+
map.set(String(entry.sourcePath ?? entry.path), normalizeMapFileEntry(entry));
|
|
49
|
+
}
|
|
50
|
+
return map;
|
|
51
|
+
}
|
|
52
|
+
for (const [sourcePath, entry] of Object.entries(value)) map.set(sourcePath, normalizeMapFileEntry(entry));
|
|
53
|
+
return map;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function normalizeMapFileEntry(entry) {
|
|
57
|
+
if (entry && typeof entry === 'object') return {
|
|
58
|
+
sourceText: String(entry.sourceText ?? entry.text ?? ''),
|
|
59
|
+
parserTriviaEvidence: entry.parserTriviaEvidence
|
|
60
|
+
};
|
|
61
|
+
return { sourceText: String(entry ?? '') };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function stringOrUndefined(value) {
|
|
65
|
+
return typeof value === 'string' ? value : undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function bySourcePath(left, right) {
|
|
69
|
+
return String(left.sourcePath ?? '').localeCompare(String(right.sourcePath ?? ''));
|
|
70
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
|
+
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
3
|
+
|
|
4
|
+
const GlobalAugmentationCompatibilityRoute = Object.freeze({
|
|
5
|
+
routeId: 'prove-global-augmentation-compatibility',
|
|
6
|
+
routeLane: 'module-runtime-global-augmentation',
|
|
7
|
+
routeNext: 'supply-source-bound-global-augmentation-compatibility-proof'
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
function globalAugmentationCompatibilityAssessment(input = {}, options = {}) {
|
|
11
|
+
const proof = globalAugmentationCompatibilityProofFor(input, options);
|
|
12
|
+
const reasonCodes = [];
|
|
13
|
+
if (!proof) reasonCodes.push('global-augmentation-compatibility-proof-missing');
|
|
14
|
+
else {
|
|
15
|
+
if (proof.status !== 'passed') reasonCodes.push('global-augmentation-compatibility-proof-status-not-passed');
|
|
16
|
+
if (proof.kind !== undefined && proof.kind !== 'frontier.lang.globalAugmentationCompatibilityProof') reasonCodes.push('global-augmentation-compatibility-proof-schema-mismatch');
|
|
17
|
+
if (proof.schema !== undefined && proof.schema !== 'frontier.lang.globalAugmentationCompatibilityProof.v1') reasonCodes.push('global-augmentation-compatibility-proof-schema-mismatch');
|
|
18
|
+
if (proof.surfaceKind !== 'global-augmentation') reasonCodes.push('global-augmentation-compatibility-proof-surface-mismatch');
|
|
19
|
+
if (input.sourcePath && proof.sourcePath !== input.sourcePath) reasonCodes.push('global-augmentation-compatibility-proof-source-path-mismatch');
|
|
20
|
+
if (!sourceHashesMatch(input, proof)) reasonCodes.push('global-augmentation-compatibility-proof-stale-source');
|
|
21
|
+
if (input.moduleName && proof.moduleName !== input.moduleName) reasonCodes.push('global-augmentation-compatibility-proof-surface-mismatch');
|
|
22
|
+
if (input.moduleDeclarationRecordId && proof.moduleDeclarationRecordId !== input.moduleDeclarationRecordId) reasonCodes.push('global-augmentation-compatibility-shape-hash-mismatch');
|
|
23
|
+
if (input.moduleDeclarationShapeHash && proof.moduleDeclarationShapeHash !== input.moduleDeclarationShapeHash) reasonCodes.push('global-augmentation-compatibility-shape-hash-mismatch');
|
|
24
|
+
if (input.moduleDeclarationSignatureHash && proof.moduleDeclarationSignatureHash !== input.moduleDeclarationSignatureHash) reasonCodes.push('global-augmentation-compatibility-shape-hash-mismatch');
|
|
25
|
+
if (input.sourceSpanHash && proof.sourceSpanHash !== input.sourceSpanHash) reasonCodes.push('global-augmentation-compatibility-source-span-mismatch');
|
|
26
|
+
if (input.declarationOutputHash && proof.declarationOutputHash !== input.declarationOutputHash) reasonCodes.push('global-augmentation-compatibility-declaration-output-mismatch');
|
|
27
|
+
if (!proof.declarationOutputGateId || !proof.declarationOutputHash) reasonCodes.push('global-augmentation-compatibility-declaration-output-missing');
|
|
28
|
+
if (!proof.consumerDiagnosticsGateId || !proof.consumerDiagnosticsHash) reasonCodes.push('global-augmentation-compatibility-consumer-diagnostics-missing');
|
|
29
|
+
if (proof.consumerDiagnosticsPassed !== true || input.consumerDiagnosticsPassed === false) reasonCodes.push('global-augmentation-compatibility-consumer-diagnostics-failed');
|
|
30
|
+
if (!Array.isArray(proof.consumerEntrypoints) || proof.consumerEntrypoints.length === 0) reasonCodes.push('global-augmentation-compatibility-consumer-diagnostics-missing');
|
|
31
|
+
if (proof.globalCompatibilityClaim !== 'declaration-boundary-consumer-diagnostics-only'
|
|
32
|
+
|| proof.hostRuntimeInteractionClaim !== false
|
|
33
|
+
|| proof.runtimeEquivalenceClaim !== false
|
|
34
|
+
|| proof.semanticEquivalenceClaim !== false
|
|
35
|
+
|| proof.autoMergeClaim !== false) reasonCodes.push('global-augmentation-compatibility-proof-claim-bearing');
|
|
36
|
+
}
|
|
37
|
+
const status = proof && reasonCodes.length === 0 ? 'passed' : proof ? 'failed' : 'missing';
|
|
38
|
+
return {
|
|
39
|
+
status,
|
|
40
|
+
...GlobalAugmentationCompatibilityRoute,
|
|
41
|
+
reasonCodes: uniqueStrings(reasonCodes),
|
|
42
|
+
record: compactRecord({
|
|
43
|
+
schema: 'frontier.lang.globalAugmentationCompatibilityProofAssessment.v1',
|
|
44
|
+
status,
|
|
45
|
+
proofStatus: proof?.status,
|
|
46
|
+
proofId: proof?.id,
|
|
47
|
+
proofHash: proof?.proofHash,
|
|
48
|
+
...GlobalAugmentationCompatibilityRoute,
|
|
49
|
+
reasonCodes: uniqueStrings(reasonCodes),
|
|
50
|
+
expected: compactRecord(input),
|
|
51
|
+
globalCompatibilityClaim: 'declaration-boundary-consumer-diagnostics-only',
|
|
52
|
+
autoMergeClaim: false,
|
|
53
|
+
semanticEquivalenceClaim: false,
|
|
54
|
+
runtimeEquivalenceClaim: false,
|
|
55
|
+
hostRuntimeInteractionClaim: false
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function globalAugmentationCompatibilityProofFor(input = {}, options = {}) {
|
|
61
|
+
const proofs = [
|
|
62
|
+
options.globalAugmentationCompatibilityProof,
|
|
63
|
+
...(Array.isArray(options.globalAugmentationCompatibilityProofs) ? options.globalAugmentationCompatibilityProofs : [])
|
|
64
|
+
].filter(Boolean);
|
|
65
|
+
return proofs.find((proof) => (
|
|
66
|
+
proof.moduleDeclarationRecordId === input.moduleDeclarationRecordId
|
|
67
|
+
|| proof.sourcePath === input.sourcePath
|
|
68
|
+
&& proof.moduleName === (input.moduleName ?? 'global')
|
|
69
|
+
&& proof.surfaceKind === 'global-augmentation'
|
|
70
|
+
));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function sourceHashesMatch(input, proof) {
|
|
74
|
+
const expectedHashes = uniqueStrings([input.sourceHash, ...(input.sourceHashes ?? [])]);
|
|
75
|
+
if (!expectedHashes.length) return true;
|
|
76
|
+
const proofHashes = uniqueStrings([proof.sourceHash, ...(proof.sourceHashes ?? [])]);
|
|
77
|
+
return expectedHashes.every((hash) => proofHashes.includes(hash));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function sourceSpanHash(sourceSpan) {
|
|
81
|
+
return sourceSpan ? hashSemanticValue({
|
|
82
|
+
start: sourceSpan.start,
|
|
83
|
+
end: sourceSpan.end,
|
|
84
|
+
startLine: sourceSpan.startLine,
|
|
85
|
+
startColumn: sourceSpan.startColumn,
|
|
86
|
+
endLine: sourceSpan.endLine,
|
|
87
|
+
endColumn: sourceSpan.endColumn
|
|
88
|
+
}) : undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function uniqueStrings(values) {
|
|
92
|
+
return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
GlobalAugmentationCompatibilityRoute,
|
|
97
|
+
globalAugmentationCompatibilityAssessment,
|
|
98
|
+
sourceSpanHash
|
|
99
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
2
|
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
3
|
+
import { cssModuleUseSiteBlockerConflicts, isResolvedCssModuleImportEdge } from './js-ts-safe-project-merge-css-module-conflicts.js';
|
|
3
4
|
import { projectGraphDeltaConflicts } from './js-ts-safe-project-merge-graph-delta-conflicts.js';
|
|
4
5
|
|
|
5
6
|
function outputProjectGraphConflicts(projectSymbolGraph) {
|
|
@@ -7,6 +8,7 @@ function outputProjectGraphConflicts(projectSymbolGraph) {
|
|
|
7
8
|
projectSymbolGraph = projectSymbolGraph?.projectSymbolGraph ?? projectSymbolGraph;
|
|
8
9
|
const importEdges = Array.isArray(projectSymbolGraph?.importEdges) ? projectSymbolGraph.importEdges : [];
|
|
9
10
|
const exportEdges = Array.isArray(projectSymbolGraph?.exportEdges) ? projectSymbolGraph.exportEdges : [];
|
|
11
|
+
const cssModuleBlockers = Array.isArray(projectSymbolGraph?.cssModuleUseSiteBlockers) ? projectSymbolGraph.cssModuleUseSiteBlockers : [];
|
|
10
12
|
const missingModuleGroups = new Map();
|
|
11
13
|
const missingSymbolGroups = new Map();
|
|
12
14
|
for (const edge of importEdges) {
|
|
@@ -26,6 +28,7 @@ function outputProjectGraphConflicts(projectSymbolGraph) {
|
|
|
26
28
|
}
|
|
27
29
|
return [
|
|
28
30
|
...limitConflicts,
|
|
31
|
+
...cssModuleUseSiteBlockerConflicts(cssModuleBlockers),
|
|
29
32
|
...[...missingModuleGroups.values()].map(projectGraphMissingImportConflict),
|
|
30
33
|
...[...missingSymbolGroups.values()].map(projectGraphMissingTargetConflict),
|
|
31
34
|
...duplicateReExportIdentityConflicts(projectSymbolGraph?.reExportIdentities)
|
|
@@ -48,7 +51,9 @@ function projectGraphMissingImportConflict(group) {
|
|
|
48
51
|
resolvedModulePath: edge.resolvedModulePath,
|
|
49
52
|
edgeIds: uniqueStrings(group.map((record) => record.id)),
|
|
50
53
|
importKinds: uniqueStrings(group.map((record) => record.importKind)),
|
|
51
|
-
importedNames: uniqueStrings(group.map((record) => record.importedName))
|
|
54
|
+
importedNames: uniqueStrings(group.map((record) => record.importedName)),
|
|
55
|
+
moduleEdgeFailureReasonCodes: uniqueStrings(group.flatMap(moduleEdgeFailureReasonCodes)),
|
|
56
|
+
moduleEdgeEvidence: group.map(moduleEdgeEvidence)
|
|
52
57
|
})
|
|
53
58
|
};
|
|
54
59
|
}
|
|
@@ -73,7 +78,9 @@ function projectGraphMissingTargetConflict(group) {
|
|
|
73
78
|
edgeIds: uniqueStrings(group.map((record) => record.id)),
|
|
74
79
|
importKinds: uniqueStrings(group.map((record) => record.importKind)),
|
|
75
80
|
importedNames: uniqueStrings(group.map((record) => record.importedName)),
|
|
76
|
-
localNames: uniqueStrings(group.map((record) => record.localName))
|
|
81
|
+
localNames: uniqueStrings(group.map((record) => record.localName)),
|
|
82
|
+
moduleEdgeFailureReasonCodes: uniqueStrings(['project-output-symbol-unresolved', ...group.flatMap(moduleEdgeFailureReasonCodes)]),
|
|
83
|
+
moduleEdgeEvidence: group.map(moduleEdgeEvidence)
|
|
77
84
|
})
|
|
78
85
|
};
|
|
79
86
|
}
|
|
@@ -86,6 +93,7 @@ function isMissingProjectImportTargetEdge(edge, exportEdges = []) {
|
|
|
86
93
|
return hasResolvedProjectModule(edge)
|
|
87
94
|
&& Boolean(projectImportTargetName(edge))
|
|
88
95
|
&& !edge.resolvedTargetSymbolId
|
|
96
|
+
&& !isResolvedCssModuleImportEdge(edge)
|
|
89
97
|
&& !commonJsRequireResolvedByExportAssignment(edge, exportEdges);
|
|
90
98
|
}
|
|
91
99
|
|
|
@@ -160,6 +168,11 @@ function reExportIdentityKey(record) {
|
|
|
160
168
|
function reExportIdentityFingerprint(record) {
|
|
161
169
|
return hashSemanticValue({
|
|
162
170
|
moduleSpecifier: record.moduleSpecifier,
|
|
171
|
+
hasImportAttributes: record.hasImportAttributes,
|
|
172
|
+
importAttributeCount: record.importAttributeCount,
|
|
173
|
+
importAttributeKeys: record.importAttributeKeys,
|
|
174
|
+
importAttributeHash: record.importAttributeHash,
|
|
175
|
+
importAttributes: record.importAttributes,
|
|
163
176
|
exportedName: record.exportedName,
|
|
164
177
|
importedName: record.importedName,
|
|
165
178
|
localName: record.localName,
|
|
@@ -176,6 +189,11 @@ function reExportIdentityFingerprint(record) {
|
|
|
176
189
|
function reExportIdentityDetails(record) {
|
|
177
190
|
return compactRecord({
|
|
178
191
|
moduleSpecifier: record.moduleSpecifier,
|
|
192
|
+
hasImportAttributes: record.hasImportAttributes,
|
|
193
|
+
importAttributeCount: record.importAttributeCount,
|
|
194
|
+
importAttributeKeys: record.importAttributeKeys,
|
|
195
|
+
importAttributeHash: record.importAttributeHash,
|
|
196
|
+
importAttributes: record.importAttributes,
|
|
179
197
|
exportedName: record.exportedName,
|
|
180
198
|
importedName: record.importedName,
|
|
181
199
|
localName: record.localName,
|
|
@@ -189,6 +207,76 @@ function reExportIdentityDetails(record) {
|
|
|
189
207
|
});
|
|
190
208
|
}
|
|
191
209
|
|
|
210
|
+
function moduleEdgeFailureReasonCodes(edge) {
|
|
211
|
+
return [
|
|
212
|
+
edge?.packageRuntimeConditionReasonCode,
|
|
213
|
+
edge?.packageEnvironmentConditionReasonCode,
|
|
214
|
+
edge?.packageResolutionReasonCode,
|
|
215
|
+
typeof edge?.resolutionKind === 'string' && edge.resolutionKind.endsWith('-missing') ? edge.resolutionKind : undefined
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function moduleEdgeEvidence(edge) {
|
|
220
|
+
return compactRecord(Object.fromEntries(moduleEdgeEvidenceFields.map((field) => [field, edge?.[field]])));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const moduleEdgeEvidenceFields = [
|
|
224
|
+
'id',
|
|
225
|
+
'sourcePath',
|
|
226
|
+
'moduleSpecifier',
|
|
227
|
+
'resolutionKind',
|
|
228
|
+
'resolvedModulePath',
|
|
229
|
+
'targetDocumentId',
|
|
230
|
+
'resolvedTargetSymbolId',
|
|
231
|
+
'edgeKind',
|
|
232
|
+
'importKind',
|
|
233
|
+
'exportKind',
|
|
234
|
+
'importedName',
|
|
235
|
+
'exportedName',
|
|
236
|
+
'localName',
|
|
237
|
+
'isTypeOnly',
|
|
238
|
+
'resolutionPathVariant',
|
|
239
|
+
'packageName',
|
|
240
|
+
'packageSubpath',
|
|
241
|
+
'packageExportKey',
|
|
242
|
+
'packageExportCondition',
|
|
243
|
+
'packageExportTarget',
|
|
244
|
+
'packageImportKey',
|
|
245
|
+
'packageImportCondition',
|
|
246
|
+
'packageImportTarget',
|
|
247
|
+
'packageType',
|
|
248
|
+
'packageRuntimeCondition',
|
|
249
|
+
'packageRuntimeConditionEvidenceSource',
|
|
250
|
+
'packageRuntimeConditionEdgeKind',
|
|
251
|
+
'packageRuntimeConditionCandidates',
|
|
252
|
+
'packageRuntimeConditionReasonCode',
|
|
253
|
+
'packageEnvironmentCondition',
|
|
254
|
+
'packageEnvironmentConditionEvidenceSource',
|
|
255
|
+
'packageEnvironmentConditionCandidates',
|
|
256
|
+
'packageEnvironmentConditionReasonCode',
|
|
257
|
+
'packageWorkspaceRootAmbiguous',
|
|
258
|
+
'packageWorkspaceRoots',
|
|
259
|
+
'packageResolutionReasonCode',
|
|
260
|
+
'hostDependencyKind',
|
|
261
|
+
'hostDependencyBase',
|
|
262
|
+
'hostDependencyExpressionHash',
|
|
263
|
+
'hostDependencyStaticSpecifierEvidence',
|
|
264
|
+
'hostDependencyRuntimeResolutionClaim',
|
|
265
|
+
'hostDependencyResolutionProofRequired',
|
|
266
|
+
'dynamicImport',
|
|
267
|
+
'dynamicImportSpecifierKind',
|
|
268
|
+
'dynamicImportExpressionText',
|
|
269
|
+
'dynamicImportExpressionHash',
|
|
270
|
+
'dynamicImportStaticSpecifierEvidence',
|
|
271
|
+
'dynamicImportRuntimeResolutionClaim',
|
|
272
|
+
'dynamicImportResolutionProofRequired',
|
|
273
|
+
'hasImportAttributes',
|
|
274
|
+
'importAttributeCount',
|
|
275
|
+
'importAttributeKeys',
|
|
276
|
+
'importAttributeHash',
|
|
277
|
+
'importAttributes'
|
|
278
|
+
];
|
|
279
|
+
|
|
192
280
|
function stableKey(parts) {
|
|
193
281
|
const values = parts.map((part) => part === undefined || part === null ? '' : String(part));
|
|
194
282
|
return values.some(Boolean) ? values.join('#') : undefined;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
2
|
+
|
|
3
|
+
function commonJsRuntimeInteropDelta(identityKey, edge, workerEdge, outputGraph) {
|
|
4
|
+
if (!isDefaultModuleExportsTarget(edge)) return undefined;
|
|
5
|
+
const exportShape = (outputGraph?.exportAssignmentRecords ?? [])
|
|
6
|
+
.find((record) => record.sourcePath === edge.resolvedModulePath && record.exportedName === 'module.exports');
|
|
7
|
+
return compactRecord({
|
|
8
|
+
schema: 'frontier.lang.commonJsRuntimeInteropDelta.v1',
|
|
9
|
+
identityKey,
|
|
10
|
+
sourcePath: edge.sourcePath,
|
|
11
|
+
sourceHash: edge.sourceHash,
|
|
12
|
+
moduleSpecifier: edge.moduleSpecifier,
|
|
13
|
+
importedName: edge.importedName,
|
|
14
|
+
localName: edge.localName,
|
|
15
|
+
importKind: edge.importKind,
|
|
16
|
+
commonJs: edge.commonJs,
|
|
17
|
+
interopHelper: edge.interopHelper,
|
|
18
|
+
packageRuntimeCondition: edge.packageRuntimeCondition,
|
|
19
|
+
packageRuntimeConditionEdgeKind: edge.packageRuntimeConditionEdgeKind,
|
|
20
|
+
resolvedModulePath: edge.resolvedModulePath,
|
|
21
|
+
outputTargetSymbolId: edge.resolvedTargetSymbolId,
|
|
22
|
+
workerTargetSymbolId: workerEdge.resolvedTargetSymbolId,
|
|
23
|
+
exportAssignmentShapeHash: exportShape?.shapeHash,
|
|
24
|
+
autoMergeClaim: false,
|
|
25
|
+
semanticEquivalenceClaim: false,
|
|
26
|
+
runtimeEquivalenceClaim: false,
|
|
27
|
+
runtimeInteropEquivalenceClaim: false
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function commonJsRuntimeInteropProofAssessment(delta, options = {}) {
|
|
32
|
+
const proof = commonJsRuntimeInteropProofFor(delta, options);
|
|
33
|
+
const reasonCodes = [];
|
|
34
|
+
if (!proof) reasonCodes.push('commonjs-runtime-interop-proof-missing');
|
|
35
|
+
else {
|
|
36
|
+
if (proof.status !== 'passed') reasonCodes.push('commonjs-runtime-interop-proof-status-not-passed');
|
|
37
|
+
if (proof.schema !== 'frontier.lang.commonJsRuntimeInteropProof.v1' && proof.kind !== 'frontier.lang.commonJsRuntimeInteropProof') reasonCodes.push('commonjs-runtime-interop-proof-schema-missing');
|
|
38
|
+
if (proof.sourcePath !== delta.sourcePath) reasonCodes.push('commonjs-runtime-interop-proof-source-path-mismatch');
|
|
39
|
+
if (proof.sourceHash !== delta.sourceHash) reasonCodes.push('commonjs-runtime-interop-proof-source-hash-mismatch');
|
|
40
|
+
if (proof.identityKey !== undefined && proof.identityKey !== delta.identityKey) reasonCodes.push('commonjs-runtime-interop-proof-import-edge-mismatch');
|
|
41
|
+
if (proof.moduleSpecifier !== delta.moduleSpecifier || proof.importedName !== delta.importedName || proof.localName !== delta.localName || proof.importKind !== delta.importKind) reasonCodes.push('commonjs-runtime-interop-proof-import-edge-mismatch');
|
|
42
|
+
if ((delta.interopHelper || proof.interopHelper) && proof.interopHelper !== delta.interopHelper) reasonCodes.push('commonjs-runtime-interop-proof-helper-identity-mismatch');
|
|
43
|
+
if ((delta.packageRuntimeCondition || proof.packageRuntimeCondition) && proof.packageRuntimeCondition !== delta.packageRuntimeCondition) reasonCodes.push('commonjs-runtime-interop-proof-package-runtime-condition-mismatch');
|
|
44
|
+
if ((delta.packageRuntimeConditionEdgeKind || proof.packageRuntimeConditionEdgeKind) && proof.packageRuntimeConditionEdgeKind !== delta.packageRuntimeConditionEdgeKind) reasonCodes.push('commonjs-runtime-interop-proof-package-runtime-condition-mismatch');
|
|
45
|
+
if (proof.outputTargetSymbolId !== delta.outputTargetSymbolId) reasonCodes.push('commonjs-runtime-interop-proof-resolved-target-symbol-mismatch');
|
|
46
|
+
if ((delta.exportAssignmentShapeHash || proof.exportAssignmentShapeHash) && proof.exportAssignmentShapeHash !== delta.exportAssignmentShapeHash) reasonCodes.push('commonjs-runtime-interop-proof-export-assignment-shape-hash-mismatch');
|
|
47
|
+
if (!proof.runtimeTraceHash && !proof.helperTraceHash) reasonCodes.push('commonjs-runtime-interop-proof-trace-hash-missing');
|
|
48
|
+
if (!proof.evidenceHash) reasonCodes.push('commonjs-runtime-interop-proof-evidence-hash-missing');
|
|
49
|
+
if (proof.autoMergeClaim !== false || proof.semanticEquivalenceClaim !== false || proof.runtimeEquivalenceClaim !== false || proof.runtimeInteropEquivalenceClaim !== false) reasonCodes.push('commonjs-runtime-interop-proof-claim-flags-missing');
|
|
50
|
+
}
|
|
51
|
+
const status = proof && reasonCodes.length === 0 ? 'passed' : proof ? 'failed' : 'missing';
|
|
52
|
+
return {
|
|
53
|
+
status,
|
|
54
|
+
routeId: 'prove-commonjs-runtime-interop-equivalence',
|
|
55
|
+
routeLane: 'module-runtime-interop',
|
|
56
|
+
routeNext: 'supply-commonjs-runtime-interop-proof',
|
|
57
|
+
reasonCodes: uniqueStrings(reasonCodes),
|
|
58
|
+
record: compactRecord({
|
|
59
|
+
schema: 'frontier.lang.commonJsRuntimeInteropProofAssessment.v1',
|
|
60
|
+
status,
|
|
61
|
+
proofStatus: proof?.status,
|
|
62
|
+
proofId: proof?.id,
|
|
63
|
+
proofHash: proof?.proofHash,
|
|
64
|
+
routeId: 'prove-commonjs-runtime-interop-equivalence',
|
|
65
|
+
routeLane: 'module-runtime-interop',
|
|
66
|
+
routeNext: 'supply-commonjs-runtime-interop-proof',
|
|
67
|
+
reasonCodes: uniqueStrings(reasonCodes),
|
|
68
|
+
delta,
|
|
69
|
+
autoMergeClaim: false,
|
|
70
|
+
semanticEquivalenceClaim: false,
|
|
71
|
+
runtimeEquivalenceClaim: false,
|
|
72
|
+
runtimeInteropEquivalenceClaim: false
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function commonJsRuntimeInteropProofFor(delta, options = {}) {
|
|
78
|
+
const proofs = [
|
|
79
|
+
options.commonJsRuntimeInteropProof,
|
|
80
|
+
...(Array.isArray(options.commonJsRuntimeInteropProofs) ? options.commonJsRuntimeInteropProofs : [])
|
|
81
|
+
].filter(Boolean);
|
|
82
|
+
return proofs.find((proof) => (
|
|
83
|
+
proof.identityKey === delta.identityKey
|
|
84
|
+
|| proof.sourcePath === delta.sourcePath
|
|
85
|
+
&& proof.moduleSpecifier === delta.moduleSpecifier
|
|
86
|
+
&& proof.importedName === delta.importedName
|
|
87
|
+
&& proof.localName === delta.localName
|
|
88
|
+
&& proof.importKind === delta.importKind
|
|
89
|
+
));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function isDefaultModuleExportsTarget(edge) {
|
|
93
|
+
return projectImportTargetName(edge) === 'default'
|
|
94
|
+
&& /:export:module_exports$/.test(String(edge?.resolvedTargetSymbolId ?? ''));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function projectImportTargetName(edge) {
|
|
98
|
+
if (edge?.importKind === 'side-effect' || edge?.importKind === 'namespace') return undefined;
|
|
99
|
+
const name = edge?.importedName ?? edge?.localName ?? edge?.exportedName;
|
|
100
|
+
if (!name || name === '*') return undefined;
|
|
101
|
+
return String(name);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function uniqueStrings(values) {
|
|
105
|
+
return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { commonJsRuntimeInteropDelta, commonJsRuntimeInteropProofAssessment };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
2
|
+
import { missingDeclarationEmitParityEvidence } from './js-ts-safe-project-merge-declaration-emit-parity.js';
|
|
3
|
+
import { compilerTypeDetails, compilerTypeFingerprint } from './js-ts-safe-project-merge-graph-delta-compiler-details.js';
|
|
4
|
+
import { missingSharedCompilerTypeInferenceSyntaxEvidence } from './js-ts-safe-project-merge-graph-delta-inference-syntax.js';
|
|
5
|
+
|
|
6
|
+
function publicCompilerTypeDeltaConflicts(baseGraph, workerGraph, headGraph, outputGraph, options = {}) {
|
|
7
|
+
return changedIdentityConflicts({
|
|
8
|
+
code: 'project-public-compiler-type-delta-conflict',
|
|
9
|
+
label: 'public compiler type',
|
|
10
|
+
baseRecords: publicCompilerTypeRecords(baseGraph.compilerTypeRecords),
|
|
11
|
+
workerRecords: publicCompilerTypeRecords(workerGraph.compilerTypeRecords),
|
|
12
|
+
headRecords: publicCompilerTypeRecords(headGraph.compilerTypeRecords),
|
|
13
|
+
outputRecords: publicCompilerTypeRecords(outputGraph?.compilerTypeRecords),
|
|
14
|
+
identityKey: compilerTypeIdentityKey,
|
|
15
|
+
fingerprint: compilerTypeFingerprint,
|
|
16
|
+
details: compilerTypeDetails,
|
|
17
|
+
declarationEmitParityProof: options.declarationEmitParityProof, requireDeclarationEmitParity: options.requireDeclarationEmitParity === true || Boolean(options.declarationEmitParityProof)
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function changedIdentityConflicts(input) {
|
|
22
|
+
const base = recordsByIdentityKey(input.baseRecords, input.identityKey);
|
|
23
|
+
const worker = recordsByIdentityKey(input.workerRecords, input.identityKey);
|
|
24
|
+
const head = recordsByIdentityKey(input.headRecords, input.identityKey);
|
|
25
|
+
const output = recordsByIdentityKey(input.outputRecords, input.identityKey);
|
|
26
|
+
const keys = uniqueStrings([...base.keys(), ...worker.keys(), ...head.keys()]);
|
|
27
|
+
return keys.flatMap((identityKey) => {
|
|
28
|
+
const baseRecord = base.get(identityKey);
|
|
29
|
+
const workerRecord = worker.get(identityKey);
|
|
30
|
+
const headRecord = head.get(identityKey);
|
|
31
|
+
const baseFingerprint = optionalFingerprint(baseRecord, input.fingerprint);
|
|
32
|
+
const workerFingerprint = optionalFingerprint(workerRecord, input.fingerprint);
|
|
33
|
+
const headFingerprint = optionalFingerprint(headRecord, input.fingerprint);
|
|
34
|
+
if (baseFingerprint === workerFingerprint || baseFingerprint === headFingerprint) return [];
|
|
35
|
+
if (workerFingerprint === headFingerprint) {
|
|
36
|
+
const missingTypeEvidence = missingSharedCompilerTypeEquivalenceEvidence(workerRecord, headRecord);
|
|
37
|
+
const missingInferenceSyntaxEvidence = missingSharedCompilerTypeInferenceSyntaxEvidence(workerRecord, headRecord);
|
|
38
|
+
const missingDeclarationEvidence = missingDeclarationEmitParityEvidence(input.declarationEmitParityProof, input);
|
|
39
|
+
if (!missingTypeEvidence && !missingInferenceSyntaxEvidence && !missingDeclarationEvidence) return [];
|
|
40
|
+
const missingEvidence = missingDeclarationEvidence ?? missingTypeEvidence ?? missingInferenceSyntaxEvidence;
|
|
41
|
+
return [projectGraphDeltaConflict({
|
|
42
|
+
...input,
|
|
43
|
+
identityKey,
|
|
44
|
+
baseRecord,
|
|
45
|
+
workerRecord,
|
|
46
|
+
headRecord,
|
|
47
|
+
outputRecord: output.get(identityKey),
|
|
48
|
+
reasonCode: missingEvidence.reasonCode,
|
|
49
|
+
typeEquivalenceEvidence: missingTypeEvidence,
|
|
50
|
+
typeInferenceSyntaxEvidence: missingInferenceSyntaxEvidence,
|
|
51
|
+
declarationEmitParityEvidence: missingDeclarationEvidence,
|
|
52
|
+
message: `Worker and head both changed ${input.label} ${JSON.stringify(identityKey)} to the same compiler public API fingerprint, but required public API evidence is missing.`
|
|
53
|
+
})];
|
|
54
|
+
}
|
|
55
|
+
return [projectGraphDeltaConflict({ ...input, identityKey, baseRecord, workerRecord, headRecord, outputRecord: output.get(identityKey) })];
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function projectGraphDeltaConflict(input) {
|
|
60
|
+
const sourcePath = input.workerRecord?.sourcePath ?? input.headRecord?.sourcePath ?? input.baseRecord?.sourcePath;
|
|
61
|
+
const conflictKey = `project-graph-delta#${input.label.replace(/\s+/g, '-')}#${input.identityKey}`;
|
|
62
|
+
return {
|
|
63
|
+
code: input.code,
|
|
64
|
+
gateId: 'project-graph-delta',
|
|
65
|
+
message: input.message ?? `Worker and head both changed ${input.label} ${JSON.stringify(input.identityKey)} in incompatible ways.`,
|
|
66
|
+
sourcePath,
|
|
67
|
+
details: compactRecord({
|
|
68
|
+
reasonCode: input.reasonCode ?? input.code,
|
|
69
|
+
conflictCode: input.reasonCode ? input.code : undefined,
|
|
70
|
+
conflictKey,
|
|
71
|
+
identityKey: input.identityKey,
|
|
72
|
+
sourcePath,
|
|
73
|
+
base: input.details(input.baseRecord),
|
|
74
|
+
worker: input.details(input.workerRecord),
|
|
75
|
+
head: input.details(input.headRecord),
|
|
76
|
+
output: input.details(input.outputRecord),
|
|
77
|
+
typeEquivalenceEvidence: input.typeEquivalenceEvidence,
|
|
78
|
+
typeInferenceSyntaxEvidence: input.typeInferenceSyntaxEvidence,
|
|
79
|
+
declarationEmitParityEvidence: input.declarationEmitParityEvidence
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function publicCompilerTypeRecords(records) { return (records ?? []).filter((record) => record?.publicContract); }
|
|
85
|
+
function compilerTypeIdentityKey(record) { return stableKey(['compiler-public-type', record?.fullyQualifiedName ?? record?.localName ?? record?.symbolName ?? record?.symbolId]); }
|
|
86
|
+
|
|
87
|
+
function missingSharedCompilerTypeEquivalenceEvidence(workerRecord, headRecord) {
|
|
88
|
+
const requiringProof = [workerRecord, headRecord].filter(requiresCompilerTypeEquivalenceProof);
|
|
89
|
+
if (!requiringProof.length) return undefined;
|
|
90
|
+
const missing = requiringProof.filter((record) => !hasPassedCompilerTypeEquivalenceProof(record));
|
|
91
|
+
if (!missing.length) return undefined;
|
|
92
|
+
return {
|
|
93
|
+
reasonCode: 'typescript-public-api-type-equivalence-proof-missing',
|
|
94
|
+
requiredEvidence: 'typescript-checker-public-api-type-equivalence',
|
|
95
|
+
missingRecords: missing.map((record) => compactRecord({
|
|
96
|
+
sourcePath: record.sourcePath, sourceHash: record.sourceHash,
|
|
97
|
+
symbolId: record.symbolId,
|
|
98
|
+
symbolName: record.symbolName,
|
|
99
|
+
fullyQualifiedName: record.fullyQualifiedName,
|
|
100
|
+
typeEquivalenceStatus: record.typeEquivalenceStatus,
|
|
101
|
+
typeEquivalenceReasonCodes: record.typeEquivalenceReasonCodes,
|
|
102
|
+
propertyCount: record.propertyCount, propertyOptionalCount: record.propertyOptionalCount,
|
|
103
|
+
propertyReadonlyCount: record.propertyReadonlyCount, indexSignatureCount: record.indexSignatureCount,
|
|
104
|
+
indexSignatureReadonlyCount: record.indexSignatureReadonlyCount,
|
|
105
|
+
constructorSignatureCount: record.constructorSignatureCount,
|
|
106
|
+
classHeritageCount: record.classHeritageCount,
|
|
107
|
+
assignabilityOracleCount: record.assignabilityOracleCount,
|
|
108
|
+
assignabilityOracleDirectionCount: record.assignabilityOracleDirectionCount,
|
|
109
|
+
typeEquivalenceAssignabilityOracleHash: record.typeEquivalenceAssignabilityOracleHash,
|
|
110
|
+
privateClassMemberCount: record.privateClassMemberCount,
|
|
111
|
+
accessorFieldCount: record.accessorFieldCount,
|
|
112
|
+
classPrivateAccessorRuntimeHash: record.classPrivateAccessorRuntimeHash,
|
|
113
|
+
classPrivateAccessorRuntimeProofStatus: record.classPrivateAccessorRuntimeProof?.status,
|
|
114
|
+
classPrivateAccessorRuntimeProofSourcePath: record.classPrivateAccessorRuntimeProof?.sourcePath,
|
|
115
|
+
classPrivateAccessorRuntimeProofSourceHash: record.classPrivateAccessorRuntimeProof?.sourceHash,
|
|
116
|
+
classPrivateAccessorRuntimeProofReasonCodes: record.classPrivateAccessorRuntimeProofReasonCodes,
|
|
117
|
+
enumMemberCount: record.enumMemberCount,
|
|
118
|
+
enumComputedMemberCount: record.enumComputedMemberCount,
|
|
119
|
+
typeEquivalenceEnumRuntimeShapeHash: record.typeEquivalenceEnumRuntimeShapeHash,
|
|
120
|
+
typeEquivalenceSignatureSetHash: record.typeEquivalenceSignatureSetHash,
|
|
121
|
+
typeEquivalenceCallSignatureSetHash: record.typeEquivalenceCallSignatureSetHash, typeEquivalenceConstructSignatureSetHash: record.typeEquivalenceConstructSignatureSetHash,
|
|
122
|
+
typeEquivalenceTypeParameterSetHash: record.typeEquivalenceTypeParameterSetHash,
|
|
123
|
+
typeEquivalencePropertySetHash: record.typeEquivalencePropertySetHash,
|
|
124
|
+
typeEquivalenceConstructorSetHash: record.typeEquivalenceConstructorSetHash,
|
|
125
|
+
typeEquivalenceClassHeritageHash: record.typeEquivalenceClassHeritageHash,
|
|
126
|
+
typeEquivalencePrivateClassMemberSetHash: record.typeEquivalencePrivateClassMemberSetHash,
|
|
127
|
+
typeEquivalenceAccessorFieldSetHash: record.typeEquivalenceAccessorFieldSetHash,
|
|
128
|
+
typeEquivalenceIndexSignatureSetHash: record.typeEquivalenceIndexSignatureSetHash,
|
|
129
|
+
typeEquivalenceConditionalTypeSetHash: record.typeEquivalenceConditionalTypeSetHash, typeEquivalenceIndexedAccessTypeSetHash: record.typeEquivalenceIndexedAccessTypeSetHash,
|
|
130
|
+
typeEquivalenceMappedTypeSetHash: record.typeEquivalenceMappedTypeSetHash, typeEquivalenceKeyofTypeOperatorSetHash: record.typeEquivalenceKeyofTypeOperatorSetHash,
|
|
131
|
+
typeReferenceTargetCount: record.typeReferenceTargetCount,
|
|
132
|
+
typeEquivalenceTypeReferenceTargetSetHash: record.typeEquivalenceTypeReferenceTargetSetHash,
|
|
133
|
+
typeEquivalenceTemplateLiteralTypeSetHash: record.typeEquivalenceTemplateLiteralTypeSetHash, typeEquivalenceInferTypeSetHash: record.typeEquivalenceInferTypeSetHash,
|
|
134
|
+
typeEquivalenceUnionTypeSetHash: record.typeEquivalenceUnionTypeSetHash, typeEquivalenceIntersectionTypeSetHash: record.typeEquivalenceIntersectionTypeSetHash, typeEquivalenceTupleTypeSetHash: record.typeEquivalenceTupleTypeSetHash,
|
|
135
|
+
typeEquivalenceProofStatus: record.typeEquivalenceProof?.status, typeEquivalenceProofSourcePath: record.typeEquivalenceProof?.sourcePath, typeEquivalenceProofSourceHash: record.typeEquivalenceProof?.sourceHash,
|
|
136
|
+
semanticEquivalenceClaim: record.typeEquivalenceProof?.semanticEquivalenceClaim,
|
|
137
|
+
assignabilityOracle: record.assignabilityOracle,
|
|
138
|
+
missingSignals: record.typeEquivalenceProof?.missingSignals,
|
|
139
|
+
unsupportedSignals: record.typeEquivalenceProof?.unsupportedSignals,
|
|
140
|
+
checkerEvidence: record.typeEquivalenceCheckerEvidence,
|
|
141
|
+
evidenceIds: record.evidenceIds
|
|
142
|
+
}))
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function requiresCompilerTypeEquivalenceProof(record) { return Boolean(record && (record.callSignatureCount > 0 || record.constructSignatureCount > 0 || record.overloadSignatureCount > 1 || record.declarationCount > 1 || record.typeParameterCount > 0 || record.propertyCount > 0 || record.indexSignatureCount > 0 || record.constructorSignatureCount > 0 || record.classHeritageCount > 0 || record.assignabilityOracleCount > 0 || record.privateClassMemberCount > 0 || record.accessorFieldCount > 0 || record.enumMemberCount > 0 || record.advancedTypeShapeCount > 0 || record.typeReferenceTargetCount > 0 || record.typeEquivalenceStatus === 'unsupported')); }
|
|
147
|
+
function hasPassedCompilerTypeEquivalenceProof(record) {
|
|
148
|
+
const requiredHashes = [
|
|
149
|
+
[record?.callSignatureCount > 0, record?.typeEquivalenceCallSignatureSetHash],
|
|
150
|
+
[record?.constructSignatureCount > 0, record?.typeEquivalenceConstructSignatureSetHash],
|
|
151
|
+
[record?.overloadSignatureCount > 1 || record?.declarationCount > 1, record?.typeEquivalenceSignatureSetHash],
|
|
152
|
+
[record?.typeParameterCount > 0, record?.typeEquivalenceTypeParameterSetHash],
|
|
153
|
+
[record?.propertyCount > 0, record?.typeEquivalencePropertySetHash],
|
|
154
|
+
[record?.indexSignatureCount > 0, record?.typeEquivalenceIndexSignatureSetHash],
|
|
155
|
+
[record?.constructorSignatureCount > 0, record?.typeEquivalenceConstructorSetHash],
|
|
156
|
+
[record?.classHeritageCount > 0, record?.typeEquivalenceClassHeritageHash],
|
|
157
|
+
[record?.assignabilityOracleCount > 0, record?.typeEquivalenceAssignabilityOracleHash],
|
|
158
|
+
[record?.privateClassMemberCount > 0, record?.typeEquivalencePrivateClassMemberSetHash],
|
|
159
|
+
[record?.accessorFieldCount > 0, record?.typeEquivalenceAccessorFieldSetHash],
|
|
160
|
+
[record?.enumMemberCount > 0, record?.typeEquivalenceEnumRuntimeShapeHash],
|
|
161
|
+
[record?.conditionalTypeCount > 0, record?.typeEquivalenceConditionalTypeSetHash],
|
|
162
|
+
[record?.indexedAccessTypeCount > 0, record?.typeEquivalenceIndexedAccessTypeSetHash],
|
|
163
|
+
[record?.mappedTypeCount > 0, record?.typeEquivalenceMappedTypeSetHash],
|
|
164
|
+
[record?.keyofTypeOperatorCount > 0, record?.typeEquivalenceKeyofTypeOperatorSetHash],
|
|
165
|
+
[record?.typeReferenceTargetCount > 0, record?.typeEquivalenceTypeReferenceTargetSetHash],
|
|
166
|
+
[record?.templateLiteralTypeCount > 0, record?.typeEquivalenceTemplateLiteralTypeSetHash],
|
|
167
|
+
[record?.inferTypeCount > 0, record?.typeEquivalenceInferTypeSetHash], [record?.unionTypeCount > 0, record?.typeEquivalenceUnionTypeSetHash],
|
|
168
|
+
[record?.intersectionTypeCount > 0, record?.typeEquivalenceIntersectionTypeSetHash], [record?.tupleTypeCount > 0, record?.typeEquivalenceTupleTypeSetHash]
|
|
169
|
+
];
|
|
170
|
+
return Boolean(record?.typeEquivalenceStatus === 'compiler-backed-equivalent'
|
|
171
|
+
&& record?.typeEquivalenceProof?.status === 'passed'
|
|
172
|
+
&& requiredHashes.every(([required, hash]) => !required || hash)
|
|
173
|
+
&& record?.apiSignatureHash);
|
|
174
|
+
}
|
|
175
|
+
function recordsByIdentityKey(records, identityKey) { const result = new Map(); for (const record of records ?? []) { const key = identityKey(record); if (!key || result.has(key)) continue; result.set(key, record); } return result; }
|
|
176
|
+
function optionalFingerprint(record, fingerprint) { return record ? fingerprint(record) : undefined; }
|
|
177
|
+
function stableKey(parts) { const values = parts.map((part) => part === undefined || part === null ? '' : String(part)); return values.some(Boolean) ? values.join('#') : undefined; }
|
|
178
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
179
|
+
export { publicCompilerTypeDeltaConflicts };
|