@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
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
2
|
+
|
|
3
|
+
function jsxPropIdentityKey(record) {
|
|
4
|
+
return stableKey(['jsx-prop', record?.sourcePath, record?.publicOwnerName, record?.tagKey, record?.tagName, record?.propName]);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function jsxChildOrderIdentityKey(record) {
|
|
8
|
+
return stableKey(['jsx-child-order', record?.sourcePath, record?.publicOwnerName, record?.keyPropValue]);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function jsxRenderRiskIdentityKey(record) {
|
|
12
|
+
return stableKey(['jsx-render-risk', record?.sourcePath, record?.publicOwnerName, record?.tagKey, record?.tagName]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function jsxPropFingerprint(record) { return record ? stableKey([record.signatureHash]) : undefined; }
|
|
16
|
+
|
|
17
|
+
function jsxChildOrderFingerprint(record) {
|
|
18
|
+
return record ? stableKey([
|
|
19
|
+
record.tagName,
|
|
20
|
+
record.keyPropValue,
|
|
21
|
+
record.ordinal,
|
|
22
|
+
record.tagKey,
|
|
23
|
+
record.fragmentKind,
|
|
24
|
+
record.childOrderSignatureHash
|
|
25
|
+
]) : undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function jsxRenderRiskFingerprint(record) {
|
|
29
|
+
return record ? stableKey([
|
|
30
|
+
record.renderRiskSignatureHash,
|
|
31
|
+
...(record.renderRiskKinds ?? []),
|
|
32
|
+
...(record.renderRiskReasonCodes ?? []),
|
|
33
|
+
record.contextBoundaryKind,
|
|
34
|
+
record.contextName,
|
|
35
|
+
record.contextValuePropName,
|
|
36
|
+
record.contextValueExpressionHash,
|
|
37
|
+
record.contextValueSignatureHash,
|
|
38
|
+
...jsxContextValueFingerprintParts(record.contextValueRecord),
|
|
39
|
+
...(record.contextProviderPath ?? []),
|
|
40
|
+
...(record.contextProviderAncestorTags ?? []),
|
|
41
|
+
record.contextProviderAncestorCount,
|
|
42
|
+
record.contextProviderNestingSignatureHash,
|
|
43
|
+
...(record.hookNames ?? []),
|
|
44
|
+
...(record.hookCallOrder ?? []),
|
|
45
|
+
record.hookCallCount,
|
|
46
|
+
record.hookCallOrderSignatureHash,
|
|
47
|
+
record.hookDependencyCount,
|
|
48
|
+
record.hookDependencySignatureHash,
|
|
49
|
+
...jsxHookDependencyFingerprintParts(record.hookDependencyRecords),
|
|
50
|
+
record.hookEffectCount,
|
|
51
|
+
record.hookEffectSignatureHash,
|
|
52
|
+
JSON.stringify(record.hookEffectRecords ?? []),
|
|
53
|
+
...(record.contextConsumerNames ?? []),
|
|
54
|
+
record.contextConsumerCount,
|
|
55
|
+
record.contextConsumerSignatureHash,
|
|
56
|
+
JSON.stringify(record.contextConsumerRecords ?? []),
|
|
57
|
+
record.renderReturnCount,
|
|
58
|
+
record.renderReturnBranchCount,
|
|
59
|
+
record.renderReturnSignatureHash,
|
|
60
|
+
JSON.stringify(record.renderReturnRecords ?? []),
|
|
61
|
+
...(record.componentWrapperNames ?? []),
|
|
62
|
+
...(record.componentWrapperCalleeTexts ?? []),
|
|
63
|
+
record.componentWrapperCount,
|
|
64
|
+
record.componentWrapperRenderEquivalenceClaim,
|
|
65
|
+
record.componentWrapperSignatureHash,
|
|
66
|
+
JSON.stringify(record.componentWrapperRecords ?? []),
|
|
67
|
+
...(record.eventHandlerPropNames ?? []),
|
|
68
|
+
record.eventHandlerPropCount,
|
|
69
|
+
record.eventHandlerSignatureHash,
|
|
70
|
+
...jsxEventHandlerFingerprintParts(record.eventHandlerPropRecords)
|
|
71
|
+
]) : undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function jsxChildOrderDetails(record) {
|
|
75
|
+
if (!record) return undefined;
|
|
76
|
+
return compactRecord({
|
|
77
|
+
sourcePath: record.sourcePath,
|
|
78
|
+
publicOwnerName: record.publicOwnerName,
|
|
79
|
+
tagName: record.tagName,
|
|
80
|
+
tagKey: record.tagKey,
|
|
81
|
+
keyPropValue: record.keyPropValue,
|
|
82
|
+
keyPropHash: record.keyPropHash,
|
|
83
|
+
ordinal: record.ordinal,
|
|
84
|
+
fragmentKind: record.fragmentKind,
|
|
85
|
+
childOrderSignatureHash: record.childOrderSignatureHash,
|
|
86
|
+
sourceHash: record.sourceHash
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function jsxPropDetails(record) {
|
|
91
|
+
if (!record) return undefined;
|
|
92
|
+
return compactRecord({
|
|
93
|
+
sourcePath: record.sourcePath, publicOwnerName: record.publicOwnerName,
|
|
94
|
+
tagName: record.tagName, tagKey: record.tagKey, propName: record.propName, propKind: record.propKind,
|
|
95
|
+
spreadOrdinal: record.spreadOrdinal, spreadExpressionHash: record.spreadExpressionHash,
|
|
96
|
+
propValueProofStatus: record.propValueProofStatus, propValueReasonCode: record.propValueReasonCode,
|
|
97
|
+
propValueKind: record.propValueKind, propValueText: record.propValueText, propValueExpressionText: record.propValueExpressionText,
|
|
98
|
+
propValueReferenceRoot: record.propValueReferenceRoot, propValueReferencePath: record.propValueReferencePath,
|
|
99
|
+
propValueOptionalReference: record.propValueOptionalReference, propValueOptionalReferenceSegments: record.propValueOptionalReferenceSegments,
|
|
100
|
+
propValueOptionalReferenceSegmentIndexes: record.propValueOptionalReferenceSegmentIndexes, propValueOptionalNullishBoundaryCount: record.propValueOptionalNullishBoundaryCount,
|
|
101
|
+
propValueDynamicText: record.propValueDynamicText, propValueDynamicBlockerReasonCode: record.propValueDynamicBlockerReasonCode,
|
|
102
|
+
propValueExpressionHash: record.propValueExpressionHash, propValueSignatureHash: record.propValueSignatureHash,
|
|
103
|
+
componentPropRenderFlowStatus: record.componentPropRenderFlowStatus, componentPropRenderFlowReasonCode: record.componentPropRenderFlowReasonCode,
|
|
104
|
+
componentPropRenderFlowClaim: record.componentPropRenderFlowClaim, componentPropRenderFlowClaimScope: record.componentPropRenderFlowClaimScope,
|
|
105
|
+
componentPropRenderFlowRenderEquivalenceClaim: record.componentPropRenderFlowRenderEquivalenceClaim,
|
|
106
|
+
componentPropRenderFlowScope: record.componentPropRenderFlowScope,
|
|
107
|
+
componentPropRenderFlowTargetName: record.componentPropRenderFlowTargetName,
|
|
108
|
+
componentPropRenderFlowTargetKind: record.componentPropRenderFlowTargetKind,
|
|
109
|
+
componentPropRenderFlowTargetOwnerName: record.componentPropRenderFlowTargetOwnerName,
|
|
110
|
+
componentPropRenderFlowTargetOwnerCount: record.componentPropRenderFlowTargetOwnerCount,
|
|
111
|
+
componentPropRenderFlowTargetSourcePath: record.componentPropRenderFlowTargetSourcePath,
|
|
112
|
+
componentPropRenderFlowComponentPropName: record.componentPropRenderFlowComponentPropName,
|
|
113
|
+
componentPropRenderFlowRenderedTagName: record.componentPropRenderFlowRenderedTagName,
|
|
114
|
+
componentPropRenderFlowRenderedPropName: record.componentPropRenderFlowRenderedPropName,
|
|
115
|
+
componentPropRenderFlowPassthroughExpressionText: record.componentPropRenderFlowPassthroughExpressionText,
|
|
116
|
+
componentPropRenderFlowBindingKind: record.componentPropRenderFlowBindingKind,
|
|
117
|
+
componentPropRenderFlowReturnOrdinal: record.componentPropRenderFlowReturnOrdinal,
|
|
118
|
+
componentPropRenderFlowDynamicBlockerReasonCode: record.componentPropRenderFlowDynamicBlockerReasonCode,
|
|
119
|
+
componentPropRenderFlowTargetSignatureHash: record.componentPropRenderFlowTargetSignatureHash,
|
|
120
|
+
componentPropRenderFlowSignatureHash: record.componentPropRenderFlowSignatureHash,
|
|
121
|
+
ordinal: record.ordinal, signatureHash: record.signatureHash, sourceHash: record.sourceHash
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function jsxRenderRiskDetails(record) {
|
|
126
|
+
if (!record) return undefined;
|
|
127
|
+
return compactRecord({
|
|
128
|
+
sourcePath: record.sourcePath,
|
|
129
|
+
publicOwnerName: record.publicOwnerName,
|
|
130
|
+
tagName: record.tagName,
|
|
131
|
+
tagKey: record.tagKey,
|
|
132
|
+
renderRiskKinds: record.renderRiskKinds,
|
|
133
|
+
renderRiskReasonCodes: record.renderRiskReasonCodes,
|
|
134
|
+
contextBoundaryKind: record.contextBoundaryKind,
|
|
135
|
+
contextName: record.contextName,
|
|
136
|
+
contextValuePropName: record.contextValuePropName,
|
|
137
|
+
contextValueExpressionHash: record.contextValueExpressionHash,
|
|
138
|
+
contextValueSignatureHash: record.contextValueSignatureHash,
|
|
139
|
+
contextValueRecord: record.contextValueRecord,
|
|
140
|
+
contextProviderPath: record.contextProviderPath,
|
|
141
|
+
contextProviderAncestorTags: record.contextProviderAncestorTags,
|
|
142
|
+
contextProviderAncestorCount: record.contextProviderAncestorCount,
|
|
143
|
+
contextProviderNestingSignatureHash: record.contextProviderNestingSignatureHash,
|
|
144
|
+
hookNames: record.hookNames,
|
|
145
|
+
hookCallOrder: record.hookCallOrder,
|
|
146
|
+
hookCallCount: record.hookCallCount,
|
|
147
|
+
hookCallOrderSignatureHash: record.hookCallOrderSignatureHash,
|
|
148
|
+
hookDependencyRecords: record.hookDependencyRecords,
|
|
149
|
+
hookDependencyCount: record.hookDependencyCount,
|
|
150
|
+
hookDependencySignatureHash: record.hookDependencySignatureHash,
|
|
151
|
+
hookEffectRecords: record.hookEffectRecords,
|
|
152
|
+
hookEffectCount: record.hookEffectCount,
|
|
153
|
+
hookEffectSignatureHash: record.hookEffectSignatureHash,
|
|
154
|
+
contextConsumerNames: record.contextConsumerNames,
|
|
155
|
+
contextConsumerRecords: record.contextConsumerRecords,
|
|
156
|
+
contextConsumerCount: record.contextConsumerCount,
|
|
157
|
+
contextConsumerSignatureHash: record.contextConsumerSignatureHash,
|
|
158
|
+
renderReturnRecords: record.renderReturnRecords, renderReturnCount: record.renderReturnCount, renderReturnBranchCount: record.renderReturnBranchCount, renderReturnSignatureHash: record.renderReturnSignatureHash,
|
|
159
|
+
componentWrapperNames: record.componentWrapperNames,
|
|
160
|
+
componentWrapperCalleeTexts: record.componentWrapperCalleeTexts,
|
|
161
|
+
componentWrapperRecords: record.componentWrapperRecords,
|
|
162
|
+
componentWrapperCount: record.componentWrapperCount,
|
|
163
|
+
componentWrapperRenderEquivalenceClaim: record.componentWrapperRenderEquivalenceClaim,
|
|
164
|
+
componentWrapperSignatureHash: record.componentWrapperSignatureHash,
|
|
165
|
+
eventHandlerPropNames: record.eventHandlerPropNames,
|
|
166
|
+
eventHandlerPropRecords: record.eventHandlerPropRecords,
|
|
167
|
+
eventHandlerPropCount: record.eventHandlerPropCount,
|
|
168
|
+
eventHandlerSignatureHash: record.eventHandlerSignatureHash,
|
|
169
|
+
renderRiskSignatureHash: record.renderRiskSignatureHash,
|
|
170
|
+
sourceHash: record.sourceHash
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function stableKey(parts) {
|
|
175
|
+
const values = parts.map((part) => part === undefined || part === null ? '' : String(part));
|
|
176
|
+
return values.some(Boolean) ? values.join('#') : undefined;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function jsxRenderRiskReasonCodes(...records) {
|
|
180
|
+
return uniqueStrings(records.flatMap((record) => record?.renderRiskReasonCodes ?? []));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function jsxPropLabel(record) { return record?.propKind === 'spread' || record?.spread ? 'spread attribute' : 'prop'; }
|
|
184
|
+
function hasRenderRisk(record) { return Array.isArray(record?.renderRiskKinds) && record.renderRiskKinds.length > 0; }
|
|
185
|
+
|
|
186
|
+
function jsxHookDependencyFingerprintParts(records = []) {
|
|
187
|
+
return records.flatMap((record) => [
|
|
188
|
+
record?.hookName,
|
|
189
|
+
record?.ordinal,
|
|
190
|
+
record?.dependencyCount,
|
|
191
|
+
...(record?.dependencyTexts ?? []),
|
|
192
|
+
JSON.stringify(record?.dependencyRecords ?? []),
|
|
193
|
+
...(record?.dynamicDependencyReasonCodes ?? []),
|
|
194
|
+
record?.dependencyArrayHash,
|
|
195
|
+
record?.dependencySignatureHash
|
|
196
|
+
]);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function jsxContextValueFingerprintParts(record) {
|
|
200
|
+
return record ? [
|
|
201
|
+
record.propName, record.propKind, record.proofStatus, record.reasonCode, record.literalValueKind, record.literalValueText, record.staticValueKind, record.staticValueText, record.staticReferenceRoot,
|
|
202
|
+
...(record.staticReferencePath ?? []), ...(record.staticReferenceMemberPath ?? []), record.referenceBindingStatus,
|
|
203
|
+
record.referenceBindingScope, record.referenceBindingHash, record.dynamicValueKind, record.dynamicValueText, record.dynamicBlockerReasonCode, record.expressionHash, record.signatureHash
|
|
204
|
+
] : [];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function jsxEventHandlerFingerprintParts(records = []) {
|
|
208
|
+
return records.flatMap((record) => [
|
|
209
|
+
record?.propName, record?.ordinal, record?.propKind,
|
|
210
|
+
record?.proofStatus, record?.reasonCode, record?.handlerReferenceText, record?.handlerReferenceRoot,
|
|
211
|
+
...(record?.handlerReferencePath ?? []), record?.optionalReference,
|
|
212
|
+
...(record?.optionalReferenceSegments ?? []), ...(record?.optionalReferenceSegmentIndexes ?? []),
|
|
213
|
+
record?.optionalNullishBoundaryCount, record?.dynamicExpressionText, record?.dynamicExpressionKind,
|
|
214
|
+
record?.dynamicBlockerReasonCode,
|
|
215
|
+
record?.expressionHash,
|
|
216
|
+
record?.signatureHash
|
|
217
|
+
]);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
221
|
+
|
|
222
|
+
export {
|
|
223
|
+
hasRenderRisk,
|
|
224
|
+
jsxChildOrderDetails,
|
|
225
|
+
jsxChildOrderFingerprint,
|
|
226
|
+
jsxChildOrderIdentityKey,
|
|
227
|
+
jsxPropDetails,
|
|
228
|
+
jsxPropFingerprint,
|
|
229
|
+
jsxPropIdentityKey,
|
|
230
|
+
jsxPropLabel,
|
|
231
|
+
jsxRenderRiskDetails,
|
|
232
|
+
jsxRenderRiskFingerprint,
|
|
233
|
+
jsxRenderRiskIdentityKey,
|
|
234
|
+
jsxRenderRiskReasonCodes
|
|
235
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
2
|
+
import { jsxRenderReturnBranchProofAssessment } from './js-ts-safe-project-merge-jsx-render-branch-proof.js';
|
|
3
|
+
import {
|
|
4
|
+
hasRenderRisk,
|
|
5
|
+
jsxChildOrderDetails,
|
|
6
|
+
jsxChildOrderFingerprint,
|
|
7
|
+
jsxChildOrderIdentityKey,
|
|
8
|
+
jsxPropDetails,
|
|
9
|
+
jsxPropFingerprint,
|
|
10
|
+
jsxPropIdentityKey,
|
|
11
|
+
jsxPropLabel,
|
|
12
|
+
jsxRenderRiskDetails,
|
|
13
|
+
jsxRenderRiskFingerprint,
|
|
14
|
+
jsxRenderRiskIdentityKey,
|
|
15
|
+
jsxRenderRiskReasonCodes
|
|
16
|
+
} from './js-ts-safe-project-merge-jsx-graph-conflict-details.js';
|
|
17
|
+
function projectJsxPropDeltaConflicts(projectGraphDelta) {
|
|
18
|
+
const baseGraph = projectGraphDelta?.stages?.base?.projectSymbolGraph;
|
|
19
|
+
const workerGraph = projectGraphDelta?.stages?.worker?.projectSymbolGraph;
|
|
20
|
+
const headGraph = projectGraphDelta?.stages?.head?.projectSymbolGraph;
|
|
21
|
+
const outputGraph = projectGraphDelta?.stages?.output?.projectSymbolGraph;
|
|
22
|
+
if (!baseGraph || !workerGraph || !headGraph) return [];
|
|
23
|
+
const base = publicJsxProps(baseGraph.jsxPropRecords);
|
|
24
|
+
const worker = publicJsxProps(workerGraph.jsxPropRecords);
|
|
25
|
+
const head = publicJsxProps(headGraph.jsxPropRecords);
|
|
26
|
+
const output = publicJsxProps(outputGraph?.jsxPropRecords);
|
|
27
|
+
return uniqueStrings([...base.keys(), ...worker.keys(), ...head.keys()]).flatMap((identityKey) => {
|
|
28
|
+
const baseRecord = base.get(identityKey);
|
|
29
|
+
const workerRecord = worker.get(identityKey);
|
|
30
|
+
const headRecord = head.get(identityKey);
|
|
31
|
+
const fingerprints = [jsxPropFingerprint(baseRecord), jsxPropFingerprint(workerRecord), jsxPropFingerprint(headRecord)];
|
|
32
|
+
if (fingerprints[0] === fingerprints[1] || fingerprints[0] === fingerprints[2] || fingerprints[1] === fingerprints[2]) return [];
|
|
33
|
+
return [projectJsxPropDeltaConflict(identityKey, baseRecord, workerRecord, headRecord, output.get(identityKey))];
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function projectJsxRenderRiskDeltaConflicts(projectGraphDelta, options = {}) {
|
|
37
|
+
const baseGraph = projectGraphDelta?.stages?.base?.projectSymbolGraph;
|
|
38
|
+
const workerGraph = projectGraphDelta?.stages?.worker?.projectSymbolGraph;
|
|
39
|
+
const headGraph = projectGraphDelta?.stages?.head?.projectSymbolGraph;
|
|
40
|
+
const outputGraph = projectGraphDelta?.stages?.output?.projectSymbolGraph;
|
|
41
|
+
if (!baseGraph || !workerGraph || !headGraph) return [];
|
|
42
|
+
const base = publicJsxRenderRisks(baseGraph.jsxElementRecords);
|
|
43
|
+
const worker = publicJsxRenderRisks(workerGraph.jsxElementRecords);
|
|
44
|
+
const head = publicJsxRenderRisks(headGraph.jsxElementRecords);
|
|
45
|
+
const output = publicJsxRenderRisks(outputGraph?.jsxElementRecords);
|
|
46
|
+
return uniqueStrings([...base.keys(), ...worker.keys(), ...head.keys()]).flatMap((identityKey) => {
|
|
47
|
+
const baseRecord = base.get(identityKey);
|
|
48
|
+
const workerRecord = worker.get(identityKey);
|
|
49
|
+
const headRecord = head.get(identityKey);
|
|
50
|
+
const fingerprints = [jsxRenderRiskFingerprint(baseRecord), jsxRenderRiskFingerprint(workerRecord), jsxRenderRiskFingerprint(headRecord)];
|
|
51
|
+
if (fingerprints[0] === fingerprints[1] || fingerprints[0] === fingerprints[2] || fingerprints[1] === fingerprints[2]) return [];
|
|
52
|
+
const branchProof = jsxRenderReturnBranchProofAssessment({ identityKey, baseRecord, workerRecord, headRecord, outputRecord: output.get(identityKey) }, options);
|
|
53
|
+
if (branchProof?.status === 'passed') return [];
|
|
54
|
+
return [projectJsxRenderRiskDeltaConflict(identityKey, baseRecord, workerRecord, headRecord, output.get(identityKey), branchProof)];
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function projectJsxChildOrderDeltaConflicts(projectGraphDelta) {
|
|
58
|
+
const baseGraph = projectGraphDelta?.stages?.base?.projectSymbolGraph;
|
|
59
|
+
const workerGraph = projectGraphDelta?.stages?.worker?.projectSymbolGraph;
|
|
60
|
+
const headGraph = projectGraphDelta?.stages?.head?.projectSymbolGraph;
|
|
61
|
+
const outputGraph = projectGraphDelta?.stages?.output?.projectSymbolGraph;
|
|
62
|
+
if (!baseGraph || !workerGraph || !headGraph) return [];
|
|
63
|
+
const base = publicJsxChildOrders(baseGraph.jsxElementRecords);
|
|
64
|
+
const worker = publicJsxChildOrders(workerGraph.jsxElementRecords);
|
|
65
|
+
const head = publicJsxChildOrders(headGraph.jsxElementRecords);
|
|
66
|
+
const output = publicJsxChildOrders(outputGraph?.jsxElementRecords);
|
|
67
|
+
return uniqueStrings([...base.keys(), ...worker.keys(), ...head.keys()]).flatMap((identityKey) => {
|
|
68
|
+
const baseRecord = base.get(identityKey);
|
|
69
|
+
const workerRecord = worker.get(identityKey);
|
|
70
|
+
const headRecord = head.get(identityKey);
|
|
71
|
+
const fingerprints = [jsxChildOrderFingerprint(baseRecord), jsxChildOrderFingerprint(workerRecord), jsxChildOrderFingerprint(headRecord)];
|
|
72
|
+
if (fingerprints[0] === fingerprints[1] || fingerprints[0] === fingerprints[2] || fingerprints[1] === fingerprints[2]) return [];
|
|
73
|
+
return [projectJsxChildOrderDeltaConflict(identityKey, baseRecord, workerRecord, headRecord, output.get(identityKey))];
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function projectJsxPropDeltaConflict(identityKey, baseRecord, workerRecord, headRecord, outputRecord) {
|
|
77
|
+
const sourcePath = workerRecord?.sourcePath ?? headRecord?.sourcePath ?? baseRecord?.sourcePath;
|
|
78
|
+
const label = jsxPropLabel(workerRecord ?? headRecord ?? baseRecord);
|
|
79
|
+
return {
|
|
80
|
+
code: 'project-jsx-public-prop-delta-conflict',
|
|
81
|
+
gateId: 'project-graph-delta',
|
|
82
|
+
message: `Worker and head both changed JSX public ${label} ${JSON.stringify(identityKey)} in incompatible ways.`,
|
|
83
|
+
sourcePath,
|
|
84
|
+
details: compactRecord({
|
|
85
|
+
reasonCode: 'project-jsx-public-prop-delta-conflict',
|
|
86
|
+
conflictKey: `project-graph-delta#jsx-prop#${identityKey}`,
|
|
87
|
+
identityKey,
|
|
88
|
+
sourcePath,
|
|
89
|
+
base: jsxPropDetails(baseRecord),
|
|
90
|
+
worker: jsxPropDetails(workerRecord),
|
|
91
|
+
head: jsxPropDetails(headRecord),
|
|
92
|
+
output: jsxPropDetails(outputRecord)
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function projectJsxChildOrderDeltaConflict(identityKey, baseRecord, workerRecord, headRecord, outputRecord) {
|
|
97
|
+
const sourcePath = workerRecord?.sourcePath ?? headRecord?.sourcePath ?? baseRecord?.sourcePath;
|
|
98
|
+
return {
|
|
99
|
+
code: 'project-jsx-public-child-order-delta-conflict',
|
|
100
|
+
gateId: 'project-graph-delta',
|
|
101
|
+
message: `Worker and head both changed JSX keyed child order evidence ${JSON.stringify(identityKey)} in incompatible ways.`,
|
|
102
|
+
sourcePath,
|
|
103
|
+
details: compactRecord({
|
|
104
|
+
reasonCode: 'project-jsx-public-child-order-delta-conflict',
|
|
105
|
+
conflictKey: `project-graph-delta#jsx-child-order#${identityKey}`,
|
|
106
|
+
identityKey,
|
|
107
|
+
sourcePath,
|
|
108
|
+
base: jsxChildOrderDetails(baseRecord),
|
|
109
|
+
worker: jsxChildOrderDetails(workerRecord),
|
|
110
|
+
head: jsxChildOrderDetails(headRecord),
|
|
111
|
+
output: jsxChildOrderDetails(outputRecord)
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function projectJsxRenderRiskDeltaConflict(identityKey, baseRecord, workerRecord, headRecord, outputRecord, branchProof) {
|
|
116
|
+
const sourcePath = workerRecord?.sourcePath ?? headRecord?.sourcePath ?? baseRecord?.sourcePath;
|
|
117
|
+
return {
|
|
118
|
+
code: 'project-jsx-public-render-risk-delta-conflict',
|
|
119
|
+
gateId: 'project-graph-delta',
|
|
120
|
+
message: `Worker and head both changed JSX public render-semantics evidence ${JSON.stringify(identityKey)} in incompatible ways.`,
|
|
121
|
+
sourcePath,
|
|
122
|
+
details: compactRecord({
|
|
123
|
+
reasonCode: 'project-jsx-public-render-risk-delta-conflict',
|
|
124
|
+
reasonCodes: uniqueStrings([...jsxRenderRiskReasonCodes(baseRecord, workerRecord, headRecord, outputRecord), ...(branchProof?.reasonCodes ?? [])]),
|
|
125
|
+
conflictKey: `project-graph-delta#jsx-render-risk#${identityKey}`,
|
|
126
|
+
identityKey,
|
|
127
|
+
sourcePath,
|
|
128
|
+
routeId: branchProof?.routeId,
|
|
129
|
+
routeLane: branchProof?.routeLane,
|
|
130
|
+
routeNext: branchProof?.routeNext,
|
|
131
|
+
base: jsxRenderRiskDetails(baseRecord),
|
|
132
|
+
worker: jsxRenderRiskDetails(workerRecord),
|
|
133
|
+
head: jsxRenderRiskDetails(headRecord),
|
|
134
|
+
output: jsxRenderRiskDetails(outputRecord),
|
|
135
|
+
jsxRenderReturnBranchProof: branchProof?.record,
|
|
136
|
+
autoMergeClaim: false,
|
|
137
|
+
semanticEquivalenceClaim: false,
|
|
138
|
+
runtimeEquivalenceClaim: false,
|
|
139
|
+
renderEquivalenceClaim: false
|
|
140
|
+
})
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function publicJsxProps(records = []) {
|
|
144
|
+
const result = new Map();
|
|
145
|
+
for (const record of records) {
|
|
146
|
+
if (!record?.publicContract) continue;
|
|
147
|
+
const key = jsxPropIdentityKey(record);
|
|
148
|
+
if (key && !result.has(key)) result.set(key, record);
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
function publicJsxRenderRisks(records = []) {
|
|
153
|
+
const result = new Map();
|
|
154
|
+
for (const record of records ?? []) {
|
|
155
|
+
if (!record?.publicContract || !hasRenderRisk(record)) continue;
|
|
156
|
+
const key = jsxRenderRiskIdentityKey(record);
|
|
157
|
+
if (key && !result.has(key)) result.set(key, record);
|
|
158
|
+
}
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
function publicJsxChildOrders(records = []) {
|
|
162
|
+
const result = new Map();
|
|
163
|
+
for (const record of records ?? []) {
|
|
164
|
+
if (!record?.publicContract || !record?.keyPropValue) continue;
|
|
165
|
+
const key = jsxChildOrderIdentityKey(record);
|
|
166
|
+
if (key && !result.has(key)) result.set(key, record);
|
|
167
|
+
}
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
172
|
+
|
|
173
|
+
export { projectJsxChildOrderDeltaConflicts, projectJsxPropDeltaConflicts, projectJsxRenderRiskDeltaConflicts };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { compactRecord, uniqueStrings } from './js-ts-safe-merge-context.js';
|
|
2
|
+
|
|
3
|
+
export function collectJsxComponentPropContractsFromFileResults(fileResults = []) {
|
|
4
|
+
const contracts = [];
|
|
5
|
+
for (const file of Array.isArray(fileResults) ? fileResults : []) {
|
|
6
|
+
const fallback = file.result?.metadata?.composed?.jsxAttributeFallback;
|
|
7
|
+
const candidates = fallback?.componentPropContracts ?? fallback?.jsxComponentPropContracts ?? [];
|
|
8
|
+
for (const candidate of Array.isArray(candidates) ? candidates : []) {
|
|
9
|
+
contracts.push({ ...candidate, sourcePath: candidate.sourcePath ?? file.sourcePath });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return contracts;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function normalizeJsxComponentPropContracts(value) {
|
|
16
|
+
const values = Array.isArray(value) ? value : [];
|
|
17
|
+
return values.map((contract, index) => {
|
|
18
|
+
const attributes = uniqueStrings((Array.isArray(contract.attributes) ? contract.attributes : [])
|
|
19
|
+
.map((attribute) => String(attribute))
|
|
20
|
+
.filter(Boolean));
|
|
21
|
+
return compactRecord({
|
|
22
|
+
id: contract.id ?? `jsx_component_prop_contract_${index + 1}`,
|
|
23
|
+
sourcePath: stringOrUndefined(contract.sourcePath),
|
|
24
|
+
tagName: stringOrUndefined(contract.tagName),
|
|
25
|
+
tagKey: stringOrUndefined(contract.tagKey),
|
|
26
|
+
attributes: attributes.length ? attributes : undefined,
|
|
27
|
+
attributeCount: numberOrUndefined(contract.attributeCount) ?? attributes.length
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function matchingJsxComponentPropContracts(diagnostic, jsxComponentPropContracts) {
|
|
33
|
+
if (!jsxComponentPropContracts.length) return [];
|
|
34
|
+
const sourcePath = diagnostic.sourcePath;
|
|
35
|
+
if (!sourcePath) return jsxComponentPropContracts;
|
|
36
|
+
return jsxComponentPropContracts.filter((contract) => contract.sourcePath === sourcePath);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function jsxComponentPropContractConflict(jsxComponentPropContracts) {
|
|
40
|
+
return {
|
|
41
|
+
code: 'jsx-component-prop-contract-evidence-unavailable',
|
|
42
|
+
gateId: 'jsx-component-prop-contract',
|
|
43
|
+
message: 'JSX component prop changes require TypeScript diagnostics or supplied diagnostics before project admission.',
|
|
44
|
+
sourcePath: jsxComponentPropContracts.length === 1 ? jsxComponentPropContracts[0].sourcePath : undefined,
|
|
45
|
+
details: {
|
|
46
|
+
required: true,
|
|
47
|
+
candidates: jsxComponentPropContracts
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function jsxComponentPropContractEvidence(id, status, diagnostics, conflicts, diagnosticSource, jsxComponentPropContracts) {
|
|
53
|
+
if (!jsxComponentPropContracts.length) return [];
|
|
54
|
+
return [{
|
|
55
|
+
id: `${id}_jsx_component_prop_contract_evidence`,
|
|
56
|
+
kind: 'js-ts-jsx-component-prop-contract-evidence',
|
|
57
|
+
status: status === 'passed' ? 'passed' : 'failed',
|
|
58
|
+
summary: status === 'passed'
|
|
59
|
+
? `Validated ${jsxComponentPropContracts.length} JSX component prop contract candidate(s) with diagnostics evidence.`
|
|
60
|
+
: `Blocked JSX component prop contract candidate(s) on ${conflicts.length} diagnostic or evidence conflict(s).`,
|
|
61
|
+
metadata: {
|
|
62
|
+
candidates: jsxComponentPropContracts.length,
|
|
63
|
+
attributes: jsxComponentPropContracts.reduce((total, contract) => total + (contract.attributeCount ?? 0), 0),
|
|
64
|
+
diagnosticSource,
|
|
65
|
+
diagnostics: diagnostics.length,
|
|
66
|
+
conflicts: conflicts.length,
|
|
67
|
+
contracts: jsxComponentPropContracts
|
|
68
|
+
}
|
|
69
|
+
}];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function jsxComponentPropContractSummary(jsxComponentPropContracts) {
|
|
73
|
+
return {
|
|
74
|
+
jsxComponentPropContractCandidates: jsxComponentPropContracts.length,
|
|
75
|
+
jsxComponentPropContractFiles: uniqueStrings(jsxComponentPropContracts.map((contract) => contract.sourcePath)).length,
|
|
76
|
+
jsxComponentPropContractAttributes: jsxComponentPropContracts.reduce((total, contract) => total + (contract.attributeCount ?? 0), 0)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function stringOrUndefined(value) {
|
|
81
|
+
return value === undefined || value === null ? undefined : String(value);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function numberOrUndefined(value) {
|
|
85
|
+
return Number.isFinite(value) ? value : undefined;
|
|
86
|
+
}
|