@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.
Files changed (276) hide show
  1. package/README.md +315 -9
  2. package/bench/real-repo-corpus-checkout-identity.mjs +134 -0
  3. package/bench/real-repo-corpus-checkout-proof.mjs +263 -0
  4. package/bench/real-repo-corpus-command-execution.mjs +314 -0
  5. package/bench/real-repo-corpus-evidence.mjs +165 -0
  6. package/bench/real-repo-corpus-suite.mjs +273 -0
  7. package/bench/smoke.mjs +109 -7
  8. package/dist/declarations/import-adapter-core.d.ts +4 -3
  9. package/dist/declarations/import-adapter-options-native.d.ts +21 -0
  10. package/dist/declarations/js-ts-project-merge-admission-routes.d.ts +35 -0
  11. package/dist/declarations/js-ts-project-merge-commonjs-interop.d.ts +29 -0
  12. package/dist/declarations/js-ts-project-merge-confidence.d.ts +64 -0
  13. package/dist/declarations/js-ts-project-merge-declaration-emit-parity.d.ts +37 -0
  14. package/dist/declarations/js-ts-project-merge-declarations.d.ts +65 -0
  15. package/dist/declarations/js-ts-project-merge-diagnostics.d.ts +97 -0
  16. package/dist/declarations/js-ts-project-merge-global-augmentation.d.ts +30 -0
  17. package/dist/declarations/js-ts-project-merge-jsx-render-branch.d.ts +48 -0
  18. package/dist/declarations/js-ts-project-merge-proof-levels.d.ts +109 -0
  19. package/dist/declarations/js-ts-project-merge-quality-gates.d.ts +38 -0
  20. package/dist/declarations/js-ts-project-merge-semantic-equivalence-proof.d.ts +45 -0
  21. package/dist/declarations/js-ts-project-merge-tsconfig.d.ts +43 -0
  22. package/dist/declarations/js-ts-safe-merge.d.ts +47 -0
  23. package/dist/declarations/js-ts-safe-project-merge.d.ts +120 -38
  24. package/dist/declarations/native-project-compiler-assignability-oracle.d.ts +41 -0
  25. package/dist/declarations/native-project-compiler-callable-signatures.d.ts +31 -0
  26. package/dist/declarations/native-project-compiler-class-member-runtime-proof.d.ts +87 -0
  27. package/dist/declarations/native-project-compiler-composite-types.d.ts +23 -0
  28. package/dist/declarations/native-project-compiler-enum-proof.d.ts +58 -0
  29. package/dist/declarations/native-project-compiler-index-signature.d.ts +7 -0
  30. package/dist/declarations/native-project-compiler-public-api-source-binding.d.ts +8 -0
  31. package/dist/declarations/native-project-compiler-scope.d.ts +37 -0
  32. package/dist/declarations/native-project-compiler-type-reference-targets.d.ts +38 -0
  33. package/dist/declarations/native-project-css-modules.d.ts +90 -0
  34. package/dist/declarations/native-project-decorator-metadata.d.ts +126 -0
  35. package/dist/declarations/native-project-jsx-graph.d.ts +313 -0
  36. package/dist/declarations/native-project-module-declarations.d.ts +52 -0
  37. package/dist/declarations/native-project-module-resolution.d.ts +76 -1
  38. package/dist/declarations/native-project-runtime-effect-target.d.ts +29 -0
  39. package/dist/declarations/native-project-runtime-executable-effect-evidence.d.ts +107 -0
  40. package/dist/declarations/native-project-runtime-mutation-target.d.ts +33 -0
  41. package/dist/declarations/native-project-runtime-promise-chain.d.ts +30 -0
  42. package/dist/declarations/native-project-runtime-promise-combinator.d.ts +22 -0
  43. package/dist/declarations/native-project-runtime-reachability.d.ts +30 -0
  44. package/dist/declarations/native-project-runtime-resource-management.d.ts +27 -0
  45. package/dist/declarations/native-project-runtime-yield-delegation.d.ts +10 -0
  46. package/dist/declarations/native-project-scope-template-reference.d.ts +13 -0
  47. package/dist/declarations/native-project-source-evidence.d.ts +8 -0
  48. package/dist/declarations/native-project.d.ts +40 -39
  49. package/dist/declarations/semantic-edit-script.d.ts +10 -8
  50. package/dist/declarations/semantic-graph-layers.d.ts +79 -0
  51. package/dist/declarations/semantic-sidecar.d.ts +3 -2
  52. package/dist/declarations/semantic-structural-diff.d.ts +94 -0
  53. package/dist/declarations/source-preservation.d.ts +32 -1
  54. package/dist/declarations/target-adapters.d.ts +22 -2
  55. package/dist/index.d.ts +31 -0
  56. package/dist/index.js +5 -0
  57. package/dist/internal/index-impl/compileNativeSource.js +53 -5
  58. package/dist/internal/index-impl/createLightweightNativeImport.js +58 -4
  59. package/dist/internal/index-impl/createNativeImportFromSyntaxAst.js +17 -1
  60. package/dist/internal/index-impl/createNativeImportFromTypeScriptAst.js +28 -4
  61. package/dist/internal/index-impl/createNativeProjectImportResult.js +31 -27
  62. package/dist/internal/index-impl/createNativeProjectModuleResolutionFromPackageManifests.js +145 -0
  63. package/dist/internal/index-impl/createNativeSourcePreservation.js +34 -7
  64. package/dist/internal/index-impl/createSemanticImportSidecar.js +27 -1
  65. package/dist/internal/index-impl/createTypeScriptCompilerNativeImporterAdapter.js +16 -5
  66. package/dist/internal/index-impl/dynamicImportExpressionMetadata.js +80 -0
  67. package/dist/internal/index-impl/importMetaUrlDependencyMetadata.js +176 -0
  68. package/dist/internal/index-impl/importNativeSource.js +2 -3
  69. package/dist/internal/index-impl/moduleImportAttributeMetadata.js +232 -0
  70. package/dist/internal/index-impl/projectSemanticEditScriptToSource.js +8 -1
  71. package/dist/internal/index-impl/projectSymbolGraphClassStaticBlocks.js +148 -0
  72. package/dist/internal/index-impl/projectSymbolGraphCompilerAdvancedTypeMetadata.js +45 -0
  73. package/dist/internal/index-impl/projectSymbolGraphCompilerCallableSignatureEquivalence.js +107 -0
  74. package/dist/internal/index-impl/projectSymbolGraphCompilerClassPrivateAccessorRuntimeProof.js +280 -0
  75. package/dist/internal/index-impl/projectSymbolGraphCompilerClassShapeEquivalence.js +103 -0
  76. package/dist/internal/index-impl/projectSymbolGraphCompilerConditionalTypeEquivalence.js +242 -0
  77. package/dist/internal/index-impl/projectSymbolGraphCompilerDecoratorRuntimeProof.js +197 -0
  78. package/dist/internal/index-impl/projectSymbolGraphCompilerEnumEquivalence.js +188 -0
  79. package/dist/internal/index-impl/projectSymbolGraphCompilerFacts.js +244 -0
  80. package/dist/internal/index-impl/projectSymbolGraphCompilerIndexSignatureEquivalence.js +58 -0
  81. package/dist/internal/index-impl/projectSymbolGraphCompilerMetadata.js +168 -0
  82. package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalence.js +199 -0
  83. package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalenceProof.js +204 -0
  84. package/dist/internal/index-impl/projectSymbolGraphCompilerTypeReferenceTargetEquivalence.js +99 -0
  85. package/dist/internal/index-impl/projectSymbolGraphCssModuleRecords.js +264 -0
  86. package/dist/internal/index-impl/projectSymbolGraphCssModuleScanners.js +242 -0
  87. package/dist/internal/index-impl/projectSymbolGraphCssModuleUtils.js +152 -0
  88. package/dist/internal/index-impl/projectSymbolGraphCssModules.js +82 -0
  89. package/dist/internal/index-impl/projectSymbolGraphJsxComponentImports.js +170 -0
  90. package/dist/internal/index-impl/projectSymbolGraphJsxComponentProviderLookup.js +167 -0
  91. package/dist/internal/index-impl/projectSymbolGraphJsxComponentWrappers.js +150 -0
  92. package/dist/internal/index-impl/projectSymbolGraphJsxContextTargets.js +71 -0
  93. package/dist/internal/index-impl/projectSymbolGraphJsxContextValues.js +212 -0
  94. package/dist/internal/index-impl/projectSymbolGraphJsxEventHandlers.js +172 -0
  95. package/dist/internal/index-impl/projectSymbolGraphJsxHookEffects.js +124 -0
  96. package/dist/internal/index-impl/projectSymbolGraphJsxHooks.js +281 -0
  97. package/dist/internal/index-impl/projectSymbolGraphJsxMemberComponents.js +139 -0
  98. package/dist/internal/index-impl/projectSymbolGraphJsxPropFlows.js +320 -0
  99. package/dist/internal/index-impl/projectSymbolGraphJsxPropValues.js +145 -0
  100. package/dist/internal/index-impl/projectSymbolGraphJsxProviderFlows.js +133 -0
  101. package/dist/internal/index-impl/projectSymbolGraphJsxRecords.js +315 -0
  102. package/dist/internal/index-impl/projectSymbolGraphJsxRenderCollections.js +155 -0
  103. package/dist/internal/index-impl/projectSymbolGraphJsxRenderReturns.js +291 -0
  104. package/dist/internal/index-impl/projectSymbolGraphJsxRenderRisk.js +279 -0
  105. package/dist/internal/index-impl/projectSymbolGraphModuleDeclarationShapes.js +138 -0
  106. package/dist/internal/index-impl/projectSymbolGraphModuleResolution.js +89 -87
  107. package/dist/internal/index-impl/projectSymbolGraphPackageConditions.js +314 -0
  108. package/dist/internal/index-impl/projectSymbolGraphReExportImportTargets.js +43 -0
  109. package/dist/internal/index-impl/projectSymbolGraphReExports.js +55 -1
  110. package/dist/internal/index-impl/projectSymbolGraphRuntimeRegions.js +108 -0
  111. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefAliases.js +307 -0
  112. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefLexical.js +320 -0
  113. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefOwners.js +50 -0
  114. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecordBuilders.js +112 -0
  115. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecords.js +238 -0
  116. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructural.js +104 -0
  117. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructuralNormalize.js +242 -0
  118. package/dist/internal/index-impl/projectSymbolGraphScopeUseDefUseHashes.js +107 -0
  119. package/dist/internal/index-impl/projectSymbolGraphSourceMapGeneratedBoundary.js +111 -0
  120. package/dist/internal/index-impl/projectSymbolGraphSourceRecords.js +268 -0
  121. package/dist/internal/index-impl/projectSymbolGraphSourceRecordsOwnership.js +309 -0
  122. package/dist/internal/index-impl/replaySemanticEditProjection.js +53 -39
  123. package/dist/internal/index-impl/runtimeOrderEvidenceBinding.js +151 -0
  124. package/dist/internal/index-impl/runtimeOrderProofSurfaces.js +253 -0
  125. package/dist/internal/index-impl/semanticEditCallsiteArgumentMerge.js +319 -0
  126. package/dist/internal/index-impl/semanticEditExplicitSourceReplacement.js +7 -2
  127. package/dist/internal/index-impl/semanticEditProjectionRecord.js +8 -0
  128. package/dist/internal/index-impl/semanticEditReplayDiagnostics.js +7 -2
  129. package/dist/internal/index-impl/semanticEditReplayOutputBinding.js +61 -0
  130. package/dist/internal/index-impl/semanticEditReplayRerunRoute.js +27 -0
  131. package/dist/internal/index-impl/semanticEditReplaySourceReplacement.js +6 -1
  132. package/dist/internal/index-impl/semanticEditRuntimeOrderReasons.js +320 -0
  133. package/dist/internal/index-impl/semanticEditScriptClassification.js +90 -5
  134. package/dist/internal/index-impl/semanticEditScripts.js +42 -5
  135. package/dist/internal/index-impl/semanticEditTypeSyntaxReasons.js +134 -0
  136. package/dist/internal/index-impl/semanticIndexFromNativeDeclarations.js +11 -5
  137. package/dist/internal/index-impl/semanticStructuralDiffRecords.js +150 -0
  138. package/dist/internal/index-impl/sourceMapGeneratedBoundaryGate.js +185 -0
  139. package/dist/internal/index-impl/staticMemberLiteral.js +31 -0
  140. package/dist/internal/index-impl/staticOptionalMemberReference.js +22 -0
  141. package/dist/internal/index-impl/syntaxAstSourcePreservation.js +273 -0
  142. package/dist/internal/index-impl/syntaxCommonJsModuleDeclarationEntries.js +297 -0
  143. package/dist/internal/index-impl/syntaxModuleDeclarationEntries.js +56 -132
  144. package/dist/internal/index-impl/syntaxModuleEntryRecords.js +160 -0
  145. package/dist/internal/index-impl/typeScriptCompilerAdvancedTypeShapes.js +160 -0
  146. package/dist/internal/index-impl/typeScriptCompilerAssignabilityOracle.js +97 -0
  147. package/dist/internal/index-impl/typeScriptCompilerClassApi.js +238 -0
  148. package/dist/internal/index-impl/typeScriptCompilerDecoratorMetadata.js +290 -0
  149. package/dist/internal/index-impl/typeScriptCompilerEnumShape.js +279 -0
  150. package/dist/internal/index-impl/typeScriptCompilerFacts.js +294 -0
  151. package/dist/internal/index-impl/typeScriptCompilerInferenceSyntax.js +170 -0
  152. package/dist/internal/index-impl/typeScriptCompilerReferenceGraph.js +186 -0
  153. package/dist/internal/index-impl/typeScriptCompilerSymbolIdentity.js +294 -0
  154. package/dist/internal/index-impl/typeScriptCompilerTypeReferenceTargets.js +142 -0
  155. package/dist/internal/index-impl/typeScriptDeclaration.js +10 -38
  156. package/dist/internal/index-impl/typeScriptModuleDeclarationEntries.js +52 -15
  157. package/dist/internal/index-impl/typeScriptSourceFilePreservation.js +296 -0
  158. package/dist/js-ts-safe-member-class-invariants.js +247 -0
  159. package/dist/js-ts-safe-member-merge-result.js +23 -3
  160. package/dist/js-ts-safe-member-merge.js +28 -4
  161. package/dist/js-ts-safe-merge-binding-patterns.js +170 -0
  162. package/dist/js-ts-safe-merge-jsx-attribute-fallback.js +151 -157
  163. package/dist/js-ts-safe-merge-jsx-attribute-parser.js +277 -0
  164. package/dist/js-ts-safe-merge-jsx-child-expression-fallback.js +161 -0
  165. package/dist/js-ts-safe-merge-jsx-child-expression-merge.js +319 -0
  166. package/dist/js-ts-safe-merge-jsx-child-expression-parser.js +300 -0
  167. package/dist/js-ts-safe-merge-parse-declarations.js +46 -2
  168. package/dist/js-ts-safe-merge-parse-statements.js +8 -0
  169. package/dist/js-ts-safe-merge-semantic-edit-fallback.js +13 -5
  170. package/dist/js-ts-safe-merge-source-shape-fallbacks.js +3 -1
  171. package/dist/js-ts-safe-merge-top-level-rename-fallback.js +31 -5
  172. package/dist/js-ts-safe-merge-top-level-rename-result.js +7 -2
  173. package/dist/js-ts-safe-merge-variable-declarator-fallback.js +124 -6
  174. package/dist/js-ts-safe-merge-variable-declarator-parser.js +34 -4
  175. package/dist/js-ts-safe-merge.js +136 -0
  176. package/dist/js-ts-safe-project-merge-admission-routes.js +216 -0
  177. package/dist/js-ts-safe-project-merge-admission.js +161 -0
  178. package/dist/js-ts-safe-project-merge-ambient.js +110 -0
  179. package/dist/js-ts-safe-project-merge-core.js +85 -0
  180. package/dist/js-ts-safe-project-merge-css-module-conflicts.js +60 -0
  181. package/dist/js-ts-safe-project-merge-declaration-emit-parity.js +186 -0
  182. package/dist/js-ts-safe-project-merge-declarations.js +227 -0
  183. package/dist/js-ts-safe-project-merge-diagnostics-metadata.js +42 -0
  184. package/dist/js-ts-safe-project-merge-diagnostics-ts.js +73 -0
  185. package/dist/js-ts-safe-project-merge-diagnostics.js +283 -0
  186. package/dist/js-ts-safe-project-merge-evidence-routing.js +38 -0
  187. package/dist/js-ts-safe-project-merge-files.js +70 -0
  188. package/dist/js-ts-safe-project-merge-global-augmentation-compatibility.js +99 -0
  189. package/dist/js-ts-safe-project-merge-graph-conflicts.js +90 -2
  190. package/dist/js-ts-safe-project-merge-graph-delta-commonjs-interop.js +108 -0
  191. package/dist/js-ts-safe-project-merge-graph-delta-compiler-conflicts.js +179 -0
  192. package/dist/js-ts-safe-project-merge-graph-delta-compiler-details.js +189 -0
  193. package/dist/js-ts-safe-project-merge-graph-delta-conflicts.js +51 -184
  194. package/dist/js-ts-safe-project-merge-graph-delta-identity-conflicts.js +202 -0
  195. package/dist/js-ts-safe-project-merge-graph-delta-inference-syntax.js +80 -0
  196. package/dist/js-ts-safe-project-merge-graph-delta-module-declarations.js +155 -0
  197. package/dist/js-ts-safe-project-merge-graph-limits.js +16 -1
  198. package/dist/js-ts-safe-project-merge-graph.js +37 -5
  199. package/dist/js-ts-safe-project-merge-import-removal.js +292 -0
  200. package/dist/js-ts-safe-project-merge-jsx-graph-conflict-details.js +235 -0
  201. package/dist/js-ts-safe-project-merge-jsx-graph-conflicts.js +173 -0
  202. package/dist/js-ts-safe-project-merge-jsx-prop-contracts.js +86 -0
  203. package/dist/js-ts-safe-project-merge-jsx-render-branch-proof.js +189 -0
  204. package/dist/js-ts-safe-project-merge-missing-evidence.js +310 -0
  205. package/dist/js-ts-safe-project-merge-move-rename.js +209 -0
  206. package/dist/js-ts-safe-project-merge-proof-conflicts.js +44 -0
  207. package/dist/js-ts-safe-project-merge-proof-levels.js +320 -0
  208. package/dist/js-ts-safe-project-merge-quality-gates.js +140 -0
  209. package/dist/js-ts-safe-project-merge-routing-calibration.js +125 -0
  210. package/dist/js-ts-safe-project-merge-runtime-region-conflicts.js +156 -0
  211. package/dist/js-ts-safe-project-merge-scope-use-def-conflicts.js +292 -0
  212. package/dist/js-ts-safe-project-merge-semantic-equivalence-proof.js +175 -0
  213. package/dist/js-ts-safe-project-merge-semantic-replay-proof.js +311 -0
  214. package/dist/js-ts-safe-project-merge-semantic-replay-routes.js +179 -0
  215. package/dist/js-ts-safe-project-merge-source-span-conflicts.js +310 -0
  216. package/dist/js-ts-safe-project-merge-source-span-roundtrip-proof.js +172 -0
  217. package/dist/js-ts-safe-project-merge-split-merge-admission.js +96 -0
  218. package/dist/js-ts-safe-project-merge-split-merge-records.js +320 -0
  219. package/dist/js-ts-safe-project-merge-split-merge-shapes.js +234 -0
  220. package/dist/js-ts-safe-project-merge-split-merge.js +218 -0
  221. package/dist/js-ts-safe-project-merge-summary.js +320 -0
  222. package/dist/js-ts-safe-project-merge-symbol-move-admission.js +63 -0
  223. package/dist/js-ts-safe-project-merge-symbol-move-default-admission.js +143 -0
  224. package/dist/js-ts-safe-project-merge-symbol-move-risks.js +213 -0
  225. package/dist/js-ts-safe-project-merge-symbol-move.js +316 -0
  226. package/dist/js-ts-safe-project-merge-symbol-rename-admission.js +59 -0
  227. package/dist/js-ts-safe-project-merge-symbol-rename-default-admission.js +111 -0
  228. package/dist/js-ts-safe-project-merge-symbol-rename.js +319 -0
  229. package/dist/js-ts-safe-project-merge-ts-options.js +205 -0
  230. package/dist/js-ts-safe-project-merge-ts-program.js +268 -0
  231. package/dist/js-ts-safe-project-merge-typed-property-rename-rebase-utils.js +69 -0
  232. package/dist/js-ts-safe-project-merge-typed-property-rename-rebase.js +317 -0
  233. package/dist/js-ts-safe-project-merge-unsupported-surfaces.js +319 -0
  234. package/dist/js-ts-safe-project-merge.js +170 -171
  235. package/dist/js-ts-semantic-scope-use-def-bindings.js +287 -0
  236. package/dist/js-ts-semantic-scope-use-def-scan.js +241 -0
  237. package/dist/js-ts-semantic-scope-use-def-utils.js +132 -0
  238. package/dist/js-ts-semantic-scope-use-def.js +217 -0
  239. package/dist/lightweight-dependency-effects.js +28 -4
  240. package/dist/lightweight-dependency-relations.js +13 -7
  241. package/dist/lightweight-dependency-top-level.js +63 -0
  242. package/dist/native-import-language-profiles.js +27 -1
  243. package/dist/native-js-ts-importers.js +9 -5
  244. package/dist/native-parser-ast-format-profiles.js +12 -0
  245. package/dist/native-parser-html-css-format-profiles.js +85 -0
  246. package/dist/native-region-scanner-core.js +5 -3
  247. package/dist/native-region-scanner-js-commonjs.js +155 -0
  248. package/dist/native-region-scanner-js-imports.js +51 -13
  249. package/dist/native-region-scanner-js-reexports.js +79 -0
  250. package/dist/native-region-scanner-js-ts-helpers.js +23 -0
  251. package/dist/native-source-ledger-helpers.js +1 -1
  252. package/dist/native-source-ledger.js +24 -10
  253. package/dist/native-source-maps-ecma426.js +316 -0
  254. package/dist/native-source-maps.js +36 -6
  255. package/dist/native-source-preservation-ownership.js +292 -0
  256. package/dist/native-source-preservation-scanner.js +63 -25
  257. package/dist/native-source-preservation-types.d.ts +3 -0
  258. package/dist/semantic-import-effect-occurrences.js +242 -0
  259. package/dist/semantic-import-effect-regions.js +95 -58
  260. package/dist/semantic-import-graph-layers.js +224 -0
  261. package/dist/semantic-import-runtime-conditional-evidence.js +135 -0
  262. package/dist/semantic-import-runtime-effect-target-evidence.js +145 -0
  263. package/dist/semantic-import-runtime-exit-evidence.js +32 -0
  264. package/dist/semantic-import-runtime-import-meta-evidence.js +33 -0
  265. package/dist/semantic-import-runtime-mutation-evidence.js +155 -0
  266. package/dist/semantic-import-runtime-order-evidence.js +318 -0
  267. package/dist/semantic-import-runtime-promise-chain-evidence.js +103 -0
  268. package/dist/semantic-import-runtime-promise-combinator-evidence.js +166 -0
  269. package/dist/semantic-import-runtime-reachability-evidence.js +269 -0
  270. package/dist/semantic-import-runtime-resource-management-evidence.js +293 -0
  271. package/dist/semantic-import-runtime-switch-evidence.js +304 -0
  272. package/dist/semantic-import-runtime-throw-evidence.js +44 -0
  273. package/dist/semantic-import-runtime-try-finally-evidence.js +172 -0
  274. package/dist/semantic-import-sidecar-entry.js +4 -0
  275. package/dist/semantic-import-source-preservation.js +6 -2
  276. package/package.json +1 -1
@@ -0,0 +1,316 @@
1
+ import { idFragment, reserveUniqueId, uniqueStrings } from './native-import-utils.js';
2
+
3
+ const ECMA426_SOURCE_MAP_LIMITS = Object.freeze({ maxPayloadBytes: 1024 * 1024, maxMappingsBytes: 512 * 1024, maxDecodedMappings: 10000, maxSources: 10000, maxNames: 10000, maxSections: 256, maxErrors: 32 });
4
+ const BASE64_VLQ_VALUES = new Map('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('').map((character, index) => [character, index]));
5
+
6
+ function parseEcma426SourceMapInput(sourceMapInput, sourceMap, context = {}) {
7
+ const candidate = ecma426PayloadCandidate(sourceMapInput, sourceMap);
8
+ if (!candidate.present) return missingEcma426Ingestion();
9
+ return parseEcma426SourceMapPayload(candidate.payload, { ...context, payloadField: candidate.field });
10
+ }
11
+
12
+ function ecma426PayloadCandidate(sourceMapInput, sourceMap) {
13
+ if (typeof sourceMapInput === 'string' || isUint8Array(sourceMapInput)) return { present: true, field: 'self', payload: sourceMapInput };
14
+ for (const field of ['sourceMapPayload', 'ecma426SourceMap', 'ecma426', 'rawSourceMap', 'payload']) {
15
+ if (sourceMap?.[field] !== undefined && sourceMap?.[field] !== null) return { present: true, field, payload: sourceMap[field] };
16
+ }
17
+ if (sourceMap?.version === 3 || typeof sourceMap?.mappings === 'string' || Array.isArray(sourceMap?.sections)) {
18
+ return { present: true, field: 'self', payload: sourceMap };
19
+ }
20
+ return { present: false };
21
+ }
22
+
23
+ function parseEcma426SourceMapPayload(payload, options = {}) {
24
+ const limits = { ...ECMA426_SOURCE_MAP_LIMITS, ...(options.limits ?? {}) };
25
+ const parsed = parseSourceMapJsonPayload(payload, limits, options.payloadField ?? 'self');
26
+ if (!parsed.ok) return parsed.result;
27
+ const state = ecma426DecodeState(limits, options.payloadField ?? 'self');
28
+ decodeEcma426Map(parsed.value, state, { line: 0, column: 0 }, 0);
29
+ return finishEcma426Ingestion(state, parsed.value);
30
+ }
31
+
32
+ function parseSourceMapJsonPayload(payload, limits, payloadField) {
33
+ if (typeof payload === 'string') {
34
+ if (payload.length > limits.maxPayloadBytes) {
35
+ return { ok: false, result: blockedEcma426Ingestion(payloadField, ['ecma-426:payload-too-large'], { payloadBytes: payload.length }) };
36
+ }
37
+ try { return { ok: true, value: JSON.parse(stripJsonProtectionPrefix(payload)) }; }
38
+ catch (error) {
39
+ return { ok: false, result: blockedEcma426Ingestion(payloadField, ['ecma-426:payload-json-invalid'], { error: error instanceof Error ? error.message : String(error) }) };
40
+ }
41
+ }
42
+ if (isUint8Array(payload)) {
43
+ if (payload.byteLength > limits.maxPayloadBytes) {
44
+ return { ok: false, result: blockedEcma426Ingestion(payloadField, ['ecma-426:payload-too-large'], { payloadBytes: payload.byteLength }) };
45
+ }
46
+ if (typeof TextDecoder !== 'function') return { ok: false, result: blockedEcma426Ingestion(payloadField, ['ecma-426:payload-bytes-unsupported']) };
47
+ return parseSourceMapJsonPayload(new TextDecoder().decode(payload), limits, payloadField);
48
+ }
49
+ if (!payload || typeof payload !== 'object' || Array.isArray(payload)) return { ok: false, result: blockedEcma426Ingestion(payloadField, ['ecma-426:payload-not-object']) };
50
+ return { ok: true, value: payload };
51
+ }
52
+
53
+ function stripJsonProtectionPrefix(text) {
54
+ return String(text).startsWith(")]}'") ? String(text).replace(/^\)\]\}'[^\r\n]*(?:\r\n|\n|\r)?/, '') : text;
55
+ }
56
+
57
+ function ecma426DecodeState(limits, payloadField) {
58
+ return { schema: 'frontier.lang.ecma426SourceMapIngestion.v1', version: 1, present: true, payloadField, limits, reasonCodes: ['ecma-426:source-map-payload'], errors: [], warnings: [], decodedMappings: [], decodedSources: [], summary: emptyEcma426Summary() };
59
+ }
60
+
61
+ function decodeEcma426Map(map, state, offset, depth) {
62
+ if (!map || typeof map !== 'object' || Array.isArray(map)) {
63
+ addEcma426Error(state, 'ecma-426:payload-not-object', 'Source map payload must be an object.');
64
+ return;
65
+ }
66
+ if (map.version !== 3) addEcma426Error(state, 'ecma-426:version-missing-or-unsupported', 'Source map version must be integer 3.');
67
+ state.file ??= stringOrUndefined(map.file);
68
+ if (Array.isArray(map.sections)) decodeEcma426IndexMap(map, state, offset, depth);
69
+ else decodeEcma426RegularMap(map, state, offset);
70
+ }
71
+
72
+ function decodeEcma426IndexMap(map, state, offset, depth) {
73
+ if (depth > 4) {
74
+ addEcma426Error(state, 'ecma-426:index-sections-too-deep', 'Index source map sections are nested too deeply.');
75
+ return;
76
+ }
77
+ const sections = map.sections;
78
+ if (!Array.isArray(sections)) {
79
+ addEcma426Error(state, 'ecma-426:index-sections-invalid', 'Index source map sections must be an array.');
80
+ return;
81
+ }
82
+ if (sections.length > state.limits.maxSections) {
83
+ addEcma426Error(state, 'ecma-426:index-sections-too-many', `Index source map sections exceed limit ${state.limits.maxSections}.`);
84
+ return;
85
+ }
86
+ state.summary.sections += sections.length;
87
+ let previousOffset;
88
+ sections.forEach((section, index) => {
89
+ const sectionOffset = sectionOffsetFor(section, state, index);
90
+ if (!sectionOffset) return;
91
+ if (previousOffset && compareGeneratedPosition(sectionOffset, previousOffset) <= 0) {
92
+ addEcma426Error(state, 'ecma-426:index-sections-unsorted', `Index source map section ${index + 1} is not sorted by offset.`);
93
+ }
94
+ previousOffset = sectionOffset;
95
+ if (!section.map || typeof section.map !== 'object' || Array.isArray(section.map)) {
96
+ addEcma426Error(state, 'ecma-426:index-section-map-missing', `Index source map section ${index + 1} must contain an embedded map.`);
97
+ return;
98
+ }
99
+ decodeEcma426Map(section.map, state, {
100
+ line: offset.line + sectionOffset.line,
101
+ column: sectionOffset.line === 0 ? offset.column + sectionOffset.column : sectionOffset.column
102
+ }, depth + 1);
103
+ });
104
+ }
105
+
106
+ function sectionOffsetFor(section, state, index) {
107
+ const line = section?.offset?.line;
108
+ const column = section?.offset?.column;
109
+ if (isNonNegativeInteger(line) && isNonNegativeInteger(column)) return { line, column };
110
+ addEcma426Error(state, 'ecma-426:index-section-offset-invalid', `Index source map section ${index + 1} has invalid offset.`);
111
+ return undefined;
112
+ }
113
+
114
+ function decodeEcma426RegularMap(map, state, offset) {
115
+ const sources = optionalOptionalStringList(map.sources, state, 'sources', true);
116
+ const names = optionalStringList(map.names, state, 'names');
117
+ optionalOptionalStringList(map.sourcesContent, state, 'sourcesContent', false);
118
+ optionalIndexList(map.ignoreList, state, 'ignoreList', sources.length);
119
+ optionalString(map.sourceRoot, state, 'sourceRoot');
120
+ optionalString(map.file, state, 'file');
121
+ if (state.errors.length) return;
122
+ const mappings = map.mappings;
123
+ if (typeof mappings !== 'string') {
124
+ addEcma426Error(state, 'ecma-426:mappings-missing', 'Source map mappings must be a string.');
125
+ return;
126
+ }
127
+ if (mappings.length > state.limits.maxMappingsBytes) {
128
+ addEcma426Error(state, 'ecma-426:mappings-too-large', `Source map mappings exceed limit ${state.limits.maxMappingsBytes}.`);
129
+ return;
130
+ }
131
+ state.summary.sources += sources.length;
132
+ state.summary.names += names.length;
133
+ state.summary.mappingsBytes += mappings.length;
134
+ state.decodedSources.push(...sources.map((source, index) => ({ index, source: combineSourceRoot(map.sourceRoot, source) })));
135
+ decodeMappingsString(mappings, { state, sources, names, sourceRoot: map.sourceRoot, offset });
136
+ }
137
+
138
+ function decodeMappingsString(mappings, context) {
139
+ let previousSource = 0, previousOriginalLine = 0, previousOriginalColumn = 0, previousName = 0;
140
+ for (const [generatedLine, line] of mappings.split(';').entries()) {
141
+ if (!line) continue;
142
+ let previousGeneratedColumn = 0;
143
+ for (const [segmentIndex, segment] of line.split(',').entries()) {
144
+ if (!segment) {
145
+ addEcma426Error(context.state, 'ecma-426:mapping-segment-empty', `Mapping segment ${segmentIndex + 1} on generated line ${generatedLine + 1} is empty.`);
146
+ continue;
147
+ }
148
+ const fields = decodeMappingSegmentFields(segment, context.state);
149
+ if (!fields) continue;
150
+ if (fields.length !== 1 && fields.length !== 4 && fields.length !== 5) {
151
+ addEcma426Error(context.state, 'ecma-426:mapping-segment-field-count-invalid', `Mapping segment ${segmentIndex + 1} on generated line ${generatedLine + 1} has ${fields.length} field(s).`);
152
+ continue;
153
+ }
154
+ const generatedColumn = previousGeneratedColumn + fields[0];
155
+ if (generatedColumn < previousGeneratedColumn || generatedColumn < 0) {
156
+ addEcma426Error(context.state, 'ecma-426:generated-column-order-invalid', `Mapping segment ${segmentIndex + 1} on generated line ${generatedLine + 1} has an invalid generated column.`);
157
+ continue;
158
+ }
159
+ previousGeneratedColumn = generatedColumn;
160
+ const decoded = { generatedLine: context.offset.line + generatedLine, generatedColumn: generatedLine === 0 ? context.offset.column + generatedColumn : generatedColumn };
161
+ if (fields.length > 1) {
162
+ const sourceIndex = previousSource + fields[1], originalLine = previousOriginalLine + fields[2], originalColumn = previousOriginalColumn + fields[3];
163
+ if (!isValidIndex(sourceIndex, context.sources)) {
164
+ addEcma426Error(context.state, sourceIndex < 0 ? 'ecma-426:source-index-negative' : 'ecma-426:source-index-out-of-range', `Mapping segment ${segmentIndex + 1} references source index ${sourceIndex}.`);
165
+ continue;
166
+ }
167
+ if (originalLine < 0 || originalColumn < 0) {
168
+ addEcma426Error(context.state, originalLine < 0 ? 'ecma-426:original-line-negative' : 'ecma-426:original-column-negative', `Mapping segment ${segmentIndex + 1} has negative original position.`);
169
+ continue;
170
+ }
171
+ previousSource = sourceIndex;
172
+ previousOriginalLine = originalLine;
173
+ previousOriginalColumn = originalColumn;
174
+ Object.assign(decoded, { sourceIndex, originalSource: combineSourceRoot(context.sourceRoot, context.sources[sourceIndex]), originalLine, originalColumn });
175
+ context.state.summary.mappedSegments += 1;
176
+ } else {
177
+ context.state.summary.unmappedSegments += 1;
178
+ }
179
+ if (fields.length === 5) {
180
+ const nameIndex = previousName + fields[4];
181
+ if (!isValidIndex(nameIndex, context.names)) {
182
+ addEcma426Error(context.state, nameIndex < 0 ? 'ecma-426:name-index-negative' : 'ecma-426:name-index-out-of-range', `Mapping segment ${segmentIndex + 1} references name index ${nameIndex}.`);
183
+ continue;
184
+ }
185
+ previousName = nameIndex;
186
+ Object.assign(decoded, { nameIndex, name: context.names[nameIndex] });
187
+ }
188
+ if (context.state.decodedMappings.length >= context.state.limits.maxDecodedMappings) {
189
+ addEcma426Error(context.state, 'ecma-426:mappings-too-many', `Source map decoded mappings exceed limit ${context.state.limits.maxDecodedMappings}.`);
190
+ return;
191
+ }
192
+ context.state.decodedMappings.push(decoded);
193
+ }
194
+ }
195
+ }
196
+
197
+ function decodeMappingSegmentFields(segment, state) {
198
+ const fields = [];
199
+ let index = 0;
200
+ while (index < segment.length) {
201
+ const decoded = decodeBase64Vlq(segment, index, state);
202
+ if (!decoded) return undefined;
203
+ fields.push(decoded.value);
204
+ index = decoded.nextIndex;
205
+ }
206
+ return fields;
207
+ }
208
+
209
+ function decodeBase64Vlq(segment, index, state) {
210
+ let result = 0, shift = 0, cursor = index;
211
+ while (cursor < segment.length) {
212
+ const character = segment[cursor], digit = BASE64_VLQ_VALUES.get(character);
213
+ if (digit === undefined) {
214
+ addEcma426Error(state, 'ecma-426:vlq-invalid-character', `Invalid base64 VLQ character ${JSON.stringify(character)}.`);
215
+ return undefined;
216
+ }
217
+ cursor += 1;
218
+ result += (digit & 31) * (2 ** shift);
219
+ if (result > 0xffffffff) {
220
+ addEcma426Error(state, 'ecma-426:vlq-overflow', 'Base64 VLQ value exceeds 32-bit source-map limit.');
221
+ return undefined;
222
+ }
223
+ shift += 5;
224
+ if ((digit & 32) === 0) {
225
+ const negative = (result & 1) === 1, magnitude = Math.floor(result / 2);
226
+ return { value: negative ? -magnitude : magnitude, nextIndex: cursor };
227
+ }
228
+ }
229
+ addEcma426Error(state, 'ecma-426:vlq-unterminated', 'Base64 VLQ continuation was not terminated.');
230
+ return undefined;
231
+ }
232
+
233
+ function finishEcma426Ingestion(state, map) {
234
+ const status = state.errors.length ? 'blocked' : 'valid';
235
+ if (status === 'valid') state.reasonCodes.push('ecma-426:payload-valid');
236
+ state.summary.decodedMappings = state.decodedMappings.length;
237
+ return { ...state, status, valid: status === 'valid', file: stringOrUndefined(map?.file) ?? state.file, reasonCodes: uniqueStrings([...state.reasonCodes, ...(status === 'blocked' ? ['ecma-426:payload-invalid'] : [])]) };
238
+ }
239
+
240
+ function blockedEcma426Ingestion(payloadField, reasonCodes, metadata = {}) {
241
+ return { schema: 'frontier.lang.ecma426SourceMapIngestion.v1', version: 1, present: true, payloadField, status: 'blocked', valid: false, reasonCodes: uniqueStrings(['ecma-426:source-map-payload', 'ecma-426:payload-invalid', ...reasonCodes]), errors: reasonCodes.map((code) => ({ code, message: metadata.error ?? code })), warnings: [], decodedMappings: [], decodedSources: [], summary: { ...emptyEcma426Summary(), ...metadata } };
242
+ }
243
+
244
+ function missingEcma426Ingestion() { return { schema: 'frontier.lang.ecma426SourceMapIngestion.v1', version: 1, present: false, status: 'missing', valid: false, reasonCodes: ['ecma-426:payload-missing'], errors: [], warnings: [], decodedMappings: [], decodedSources: [], summary: emptyEcma426Summary() }; }
245
+ function emptyEcma426Summary() { return { sections: 0, sources: 0, names: 0, mappingsBytes: 0, decodedMappings: 0, mappedSegments: 0, unmappedSegments: 0 }; }
246
+ function addEcma426Error(state, code, message) { state.reasonCodes.push(code); if (state.errors.length < state.limits.maxErrors) state.errors.push({ code, message }); }
247
+
248
+ function ecma426Metadata(ingestion) {
249
+ return { schema: ingestion.schema, version: ingestion.version, present: ingestion.present, payloadField: ingestion.payloadField, status: ingestion.status, valid: ingestion.valid, file: ingestion.file, reasonCodes: ingestion.reasonCodes, errors: ingestion.errors, warnings: ingestion.warnings, summary: ingestion.summary };
250
+ }
251
+
252
+ function sourceMapMappingsFromEcma426(ingestion, sourceMap, context) {
253
+ if (!ingestion.present || ingestion.status !== 'valid') return [];
254
+ const usedIds = new Set();
255
+ return ingestion.decodedMappings.map((mapping, index) => ecma426MappingRecord(ingestion, sourceMap, context, mapping, index, usedIds));
256
+ }
257
+
258
+ function ecma426MappingRecord(ingestion, sourceMap, context, mapping, index, usedIds) {
259
+ const sourcePath = mapping.originalSource ?? sourceMap.sourcePath ?? context.sourcePath;
260
+ const generatedTargetPath = sourceMap.targetPath ?? context.targetPath ?? ingestion.file;
261
+ return {
262
+ id: reserveUniqueId(`map_${idFragment(context.id ?? sourceMap.id ?? 'ecma426')}_${index + 1}`, usedIds),
263
+ nativeSourceId: sourceMap.nativeSourceId ?? context.nativeSource?.id,
264
+ sourceSpan: mapping.sourceIndex === undefined ? undefined : { path: sourcePath, sourceId: sourceMap.sourceHash ?? context.sourceHash, startLine: mapping.originalLine + 1, startColumn: mapping.originalColumn + 1 },
265
+ generatedSpan: { target: sourceMap.target ?? context.target, targetPath: generatedTargetPath, targetHash: sourceMap.targetHash ?? context.targetHash, startLine: mapping.generatedLine + 1, startColumn: mapping.generatedColumn + 1, generatedName: mapping.name },
266
+ target: sourceMap.target ?? context.target,
267
+ generatedName: mapping.name,
268
+ evidenceIds: uniqueStrings([...(sourceMap.evidence ?? []).map((record) => record.id), ...(context.evidence ?? []).map((record) => record.id)]),
269
+ lossIds: [],
270
+ precision: 'line',
271
+ preservation: 'estimated',
272
+ metadata: { ...(sourceMap.metadata ?? {}), sourceMapOrigin: 'ecma-426-payload', ecma426MappingIndex: index, generatedLine: mapping.generatedLine, generatedColumn: mapping.generatedColumn, sourceIndex: mapping.sourceIndex, nameIndex: mapping.nameIndex }
273
+ };
274
+ }
275
+
276
+ function optionalString(value, state, field) {
277
+ if (value === undefined || value === null) return undefined;
278
+ if (typeof value !== 'string') addEcma426Error(state, `ecma-426:${field}-invalid`, `Source map ${field} must be a string when present.`);
279
+ return typeof value === 'string' ? value : undefined;
280
+ }
281
+
282
+ function optionalStringList(value, state, field) {
283
+ if (value === undefined || value === null) return [];
284
+ if (!Array.isArray(value)) return arrayFieldError(state, field);
285
+ if (value.length > state.limits[field === 'names' ? 'maxNames' : 'maxSources']) return boundedListError(state, field);
286
+ return value.map((item, index) => typeof item === 'string' ? item : invalidListEntry(state, field, index, 'string', ''));
287
+ }
288
+
289
+ function optionalOptionalStringList(value, state, field, required) {
290
+ if (value === undefined || value === null) {
291
+ if (required) addEcma426Error(state, `ecma-426:${field}-missing`, `Source map ${field} must be present.`);
292
+ return [];
293
+ }
294
+ if (!Array.isArray(value)) return arrayFieldError(state, field);
295
+ if (field === 'sources' && value.length > state.limits.maxSources) return boundedListError(state, 'sources');
296
+ return value.map((item, index) => item === null || typeof item === 'string' ? item : invalidListEntry(state, field, index, 'string or null', null));
297
+ }
298
+
299
+ function optionalIndexList(value, state, field, sourceCount) {
300
+ if (value === undefined || value === null) return [];
301
+ if (!Array.isArray(value)) return arrayFieldError(state, field);
302
+ return value.map((item, index) => isNonNegativeInteger(item) && item < sourceCount ? item : invalidListEntry(state, field, index, 'source array index', null));
303
+ }
304
+
305
+ function arrayFieldError(state, field) { addEcma426Error(state, `ecma-426:${field}-invalid`, `Source map ${field} must be an array.`); return []; }
306
+ function boundedListError(state, field) { addEcma426Error(state, `ecma-426:${field}-too-many`, `Source map ${field} exceeds bounded ingestion limits.`); return []; }
307
+ function invalidListEntry(state, field, index, expected, fallback) { addEcma426Error(state, `ecma-426:${field}-entry-invalid`, `Source map ${field}[${index}] must be a ${expected}.`); return fallback; }
308
+ function combineSourceRoot(sourceRoot, source) { if (source === null || source === undefined) return undefined; const root = typeof sourceRoot === 'string' ? sourceRoot : ''; return !root ? source : root.endsWith('/') || String(source).startsWith('/') ? `${root}${source}` : `${root}/${source}`; }
309
+ function isValidIndex(index, values) { return Number.isInteger(index) && index >= 0 && index < values.length; }
310
+ function isNonNegativeInteger(value) { return Number.isInteger(value) && value >= 0; }
311
+ function compareGeneratedPosition(left, right) { return left.line !== right.line ? left.line - right.line : left.column - right.column; }
312
+ function stringOrUndefined(value) { return typeof value === 'string' && value ? value : undefined; }
313
+ function isSourceMapInput(value) { return Boolean(value && (typeof value === 'object' || typeof value === 'string')); }
314
+ function isUint8Array(value) { return typeof Uint8Array !== 'undefined' && value instanceof Uint8Array; }
315
+
316
+ export { ecma426Metadata, isSourceMapInput, isUint8Array, parseEcma426SourceMapInput, parseEcma426SourceMapPayload, sourceMapMappingsFromEcma426 };
@@ -7,6 +7,14 @@ import {
7
7
  uniqueRecordsById,
8
8
  uniqueStrings
9
9
  } from './native-import-utils.js';
10
+ import {
11
+ ecma426Metadata,
12
+ isSourceMapInput,
13
+ isUint8Array,
14
+ parseEcma426SourceMapInput,
15
+ parseEcma426SourceMapPayload,
16
+ sourceMapMappingsFromEcma426
17
+ } from './native-source-maps-ecma426.js';
10
18
 
11
19
  function inferSourceMapMappings(input) {
12
20
  const semanticIndex = input.semanticIndex;
@@ -139,16 +147,31 @@ function normalizeSourceMaps(sourceMaps, context) {
139
147
  throw new Error('Native import sourceMaps must be an array');
140
148
  }
141
149
  const usedSourceMapIds = new Set();
142
- return sourceMaps.map((sourceMap, index) => {
143
- if (!sourceMap || typeof sourceMap !== 'object') {
144
- throw new Error(`Native import source map ${index + 1} must be an object`);
150
+ return sourceMaps.map((sourceMapInput, index) => {
151
+ if (!isSourceMapInput(sourceMapInput)) {
152
+ throw new Error(`Native import source map ${index + 1} must be an object or ECMA-426 payload`);
145
153
  }
154
+ const sourceMap = typeof sourceMapInput === 'object' && !isUint8Array(sourceMapInput) ? sourceMapInput : {};
155
+ const ecma426 = parseEcma426SourceMapInput(sourceMapInput, sourceMap, {
156
+ ...context,
157
+ sourceMapIndex: index
158
+ });
146
159
  const id = reserveUniqueId(String(sourceMap.id ?? `${context.defaultSourceMapId}_${index + 1}`), usedSourceMapIds);
147
160
  const evidence = uniqueRecordsById([...(sourceMap.evidence ?? []), ...(context.evidence ?? [])]);
148
161
  const target = sourceMap.target ?? context.target;
149
- const targetPath = sourceMap.targetPath ?? context.targetPath;
162
+ const targetPath = sourceMap.targetPath ?? context.targetPath ?? ecma426.file;
150
163
  const targetHash = sourceMap.targetHash ?? context.targetHash;
151
- const mappings = normalizeSourceMapMappings(sourceMap.mappings ?? [], {
164
+ const ecma426Mappings = Array.isArray(sourceMap.mappings)
165
+ ? []
166
+ : sourceMapMappingsFromEcma426(ecma426, sourceMap, {
167
+ ...context,
168
+ id,
169
+ evidence,
170
+ target,
171
+ targetPath,
172
+ targetHash
173
+ });
174
+ const mappings = normalizeSourceMapMappings(Array.isArray(sourceMap.mappings) ? sourceMap.mappings : ecma426Mappings, {
152
175
  ...context,
153
176
  target,
154
177
  targetPath,
@@ -167,7 +190,13 @@ function normalizeSourceMaps(sourceMaps, context) {
167
190
  nativeAstId: sourceMap.nativeAstId ?? context.nativeAst?.id,
168
191
  nativeSourceId: sourceMap.nativeSourceId ?? context.nativeSource?.id,
169
192
  mappings,
170
- evidence
193
+ evidence,
194
+ metadata: {
195
+ ...(sourceMap.metadata ?? {}),
196
+ ecma426SourceMap: ecma426.present
197
+ ? ecma426Metadata(ecma426)
198
+ : sourceMap.metadata?.ecma426SourceMap ?? ecma426Metadata(ecma426)
199
+ }
171
200
  });
172
201
  const issues = validateSourceMapRecord(normalized, {
173
202
  document: context.document,
@@ -255,6 +284,7 @@ function sourceMapMappingBaseId(mapping, index) {
255
284
  export {
256
285
  inferSourceMapMappings,
257
286
  lossIdsForNativeNode,
287
+ parseEcma426SourceMapPayload,
258
288
  normalizeSourceMapMappings,
259
289
  normalizeSourceMaps
260
290
  };