packtory 0.0.96 → 0.0.98

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 (517) hide show
  1. package/artifacts/artifacts-builder.js +37 -4
  2. package/artifacts/artifacts-builder.js.map +1 -1
  3. package/artifacts/content-collection.js +59 -2
  4. package/artifacts/content-collection.js.map +1 -1
  5. package/artifacts/folder-writer.js +25 -2
  6. package/artifacts/folder-writer.js.map +1 -1
  7. package/bundle-emitter/emitter.js +137 -6
  8. package/bundle-emitter/emitter.js.map +1 -1
  9. package/bundle-emitter/extract-package-tarball.js +13 -2
  10. package/bundle-emitter/extract-package-tarball.js.map +1 -1
  11. package/bundle-emitter/fetch-published-artifacts.js +19 -2
  12. package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
  13. package/bundle-emitter/publication-outcome.js +5 -0
  14. package/bundle-emitter/publication-outcome.js.map +1 -1
  15. package/bundle-emitter/publish-error/auto-mode-error-matching.js +28 -2
  16. package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
  17. package/bundle-emitter/publish-error/error-shape-helpers.js +9 -0
  18. package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
  19. package/bundle-emitter/publish-error/file-mode-error-matching.js +33 -2
  20. package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
  21. package/bundle-emitter/publish-error/publish-error-messages.js +24 -0
  22. package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
  23. package/bundle-emitter/registry/metadata-auth-retry.js +24 -1
  24. package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
  25. package/bundle-emitter/registry/oidc-token-exchange.js +68 -3
  26. package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
  27. package/bundle-emitter/registry/package-metadata-fetcher.js +210 -7
  28. package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
  29. package/bundle-emitter/registry/publish-settings-bridge.js +34 -3
  30. package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
  31. package/bundle-emitter/registry/registry-auth-config.js +106 -0
  32. package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
  33. package/bundle-emitter/registry/registry-client.js +74 -4
  34. package/bundle-emitter/registry/registry-client.js.map +1 -1
  35. package/bundle-emitter/registry/registry-package-path.js +3 -0
  36. package/bundle-emitter/registry/registry-package-path.js.map +1 -1
  37. package/bundle-emitter/registry/registry-response-schemas.js +50 -2
  38. package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
  39. package/bundle-emitter/registry/tarball-integrity.js +31 -1
  40. package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
  41. package/bundle-emitter/registry/validate-tarball-host.js +26 -1
  42. package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
  43. package/bundle-emitter/release-artifact-canonicalizer.js +31 -5
  44. package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
  45. package/checks/check-runner.js +8 -0
  46. package/checks/check-runner.js.map +1 -1
  47. package/checks/rule.js +12 -2
  48. package/checks/rule.js.map +1 -1
  49. package/checks/rules/duplicate-detection.js +23 -1
  50. package/checks/rules/duplicate-detection.js.map +1 -1
  51. package/checks/rules/duplicate-messages.js +22 -0
  52. package/checks/rules/duplicate-messages.js.map +1 -1
  53. package/checks/rules/file-ownership.js +15 -0
  54. package/checks/rules/file-ownership.js.map +1 -1
  55. package/checks/rules/max-bundle-size.js +55 -1
  56. package/checks/rules/max-bundle-size.js.map +1 -1
  57. package/checks/rules/no-dev-dependency-imports.js +51 -1
  58. package/checks/rules/no-dev-dependency-imports.js.map +1 -1
  59. package/checks/rules/no-duplicated-files.js +53 -3
  60. package/checks/rules/no-duplicated-files.js.map +1 -1
  61. package/checks/rules/no-side-effects.js +50 -1
  62. package/checks/rules/no-side-effects.js.map +1 -1
  63. package/checks/rules/no-unexposed-executables.js +43 -2
  64. package/checks/rules/no-unexposed-executables.js.map +1 -1
  65. package/checks/rules/no-unused-bundle-dependencies.js +30 -2
  66. package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
  67. package/checks/rules/registry.js +22 -9
  68. package/checks/rules/registry.js.map +1 -1
  69. package/checks/rules/required-files.js +41 -3
  70. package/checks/rules/required-files.js.map +1 -1
  71. package/checks/rules/type-script-declaration-integrity.js +81 -3
  72. package/checks/rules/type-script-declaration-integrity.js.map +1 -1
  73. package/checks/rules/type-script-declaration-paths.js +55 -1
  74. package/checks/rules/type-script-declaration-paths.js.map +1 -1
  75. package/checks/rules/type-script-declaration-project.js +202 -3
  76. package/checks/rules/type-script-declaration-project.js.map +1 -1
  77. package/checks/rules/type-script-declaration-reachability.js +38 -2
  78. package/checks/rules/type-script-declaration-reachability.js.map +1 -1
  79. package/checks/rules/type-script-declaration-roots.js +29 -0
  80. package/checks/rules/type-script-declaration-roots.js.map +1 -1
  81. package/checks/rules/type-script-integrity.js +72 -2
  82. package/checks/rules/type-script-integrity.js.map +1 -1
  83. package/checks/rules/type-script-package-resolution.js +42 -1
  84. package/checks/rules/type-script-package-resolution.js.map +1 -1
  85. package/checks/rules/type-script-resolution-summary.js +53 -0
  86. package/checks/rules/type-script-resolution-summary.js.map +1 -1
  87. package/checks/rules/unique-target-paths.js +34 -2
  88. package/checks/rules/unique-target-paths.js.map +1 -1
  89. package/common/bundled-dependency-groups.js +27 -0
  90. package/common/bundled-dependency-groups.js.map +1 -1
  91. package/common/code-files.js +28 -0
  92. package/common/code-files.js.map +1 -1
  93. package/common/declaration-companion-paths.js +24 -0
  94. package/common/declaration-companion-paths.js.map +1 -1
  95. package/common/package-name-map.js +7 -0
  96. package/common/package-name-map.js.map +1 -1
  97. package/common/stable-json.js +42 -2
  98. package/common/stable-json.js.map +1 -1
  99. package/common/worklist.js +22 -0
  100. package/common/worklist.js.map +1 -1
  101. package/config/additional-files.js +6 -2
  102. package/config/additional-files.js.map +1 -1
  103. package/config/additional-package-json-attributes-schema.js +6 -2
  104. package/config/additional-package-json-attributes-schema.js.map +1 -1
  105. package/config/automatic-versioning-settings.js +6 -2
  106. package/config/automatic-versioning-settings.js.map +1 -1
  107. package/config/changelog-settings.js +120 -3
  108. package/config/changelog-settings.js.map +1 -1
  109. package/config/common-package-settings-schemas.js +19 -3
  110. package/config/common-package-settings-schemas.js.map +1 -1
  111. package/config/config.js +3 -1
  112. package/config/config.js.map +1 -1
  113. package/config/cross-package-validation.js +17 -0
  114. package/config/cross-package-validation.js.map +1 -1
  115. package/config/dead-code-elimination-settings.js +36 -2
  116. package/config/dead-code-elimination-settings.js.map +1 -1
  117. package/config/dependency-existence-validation.js +19 -1
  118. package/config/dependency-existence-validation.js.map +1 -1
  119. package/config/dependency-policy.js +5 -2
  120. package/config/dependency-policy.js.map +1 -1
  121. package/config/main-package-json-schema.js +11 -2
  122. package/config/main-package-json-schema.js.map +1 -1
  123. package/config/manual-versioning-settings.d.ts +12 -0
  124. package/config/manual-versioning-settings.d.ts.map +1 -1
  125. package/config/manual-versioning-settings.js +29 -2
  126. package/config/manual-versioning-settings.js.map +1 -1
  127. package/config/optional-package-settings-schema.js +16 -7
  128. package/config/optional-package-settings-schema.js.map +1 -1
  129. package/config/package-config.js +2 -1
  130. package/config/package-config.js.map +1 -1
  131. package/config/package-graph-builder.js +14 -2
  132. package/config/package-graph-builder.js.map +1 -1
  133. package/config/package-interface.js +25 -2
  134. package/config/package-interface.js.map +1 -1
  135. package/config/package-json.d.ts.map +1 -1
  136. package/config/package-json.js +16 -0
  137. package/config/package-json.js.map +1 -1
  138. package/config/packtory-config-without-registry-schema.js +6 -0
  139. package/config/packtory-config-without-registry-schema.js.map +1 -1
  140. package/config/per-package-settings-schema.js +22 -6
  141. package/config/per-package-settings-schema.js.map +1 -1
  142. package/config/pre-graph-validation.js +20 -5
  143. package/config/pre-graph-validation.js.map +1 -1
  144. package/config/publish-settings.js +25 -3
  145. package/config/publish-settings.js.map +1 -1
  146. package/config/publish-settings.report.js +17 -1
  147. package/config/publish-settings.report.js.map +1 -1
  148. package/config/registry-settings.js +40 -2
  149. package/config/registry-settings.js.map +1 -1
  150. package/config/registry-settings.report.js +46 -0
  151. package/config/registry-settings.report.js.map +1 -1
  152. package/config/root-config-validation.js +141 -0
  153. package/config/root-config-validation.js.map +1 -1
  154. package/config/root.js +6 -2
  155. package/config/root.js.map +1 -1
  156. package/config/sbom-settings.js +4 -1
  157. package/config/sbom-settings.js.map +1 -1
  158. package/config/settings-validation.js +28 -0
  159. package/config/settings-validation.js.map +1 -1
  160. package/config/versioning-settings.js +10 -3
  161. package/config/versioning-settings.js.map +1 -1
  162. package/dead-code-eliminator/analyzed-bundle.js +7 -0
  163. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  164. package/dead-code-eliminator/artifact-module-reference-contract.js +27 -0
  165. package/dead-code-eliminator/artifact-module-reference-contract.js.map +1 -0
  166. package/dead-code-eliminator/bundle-analysis.js +38 -5
  167. package/dead-code-eliminator/bundle-analysis.js.map +1 -1
  168. package/dead-code-eliminator/class-purity.js +48 -2
  169. package/dead-code-eliminator/class-purity.js.map +1 -1
  170. package/dead-code-eliminator/code-file-analyzer.js +68 -4
  171. package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
  172. package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -0
  173. package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
  174. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
  175. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
  176. package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -3
  177. package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
  178. package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
  179. package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
  180. package/dead-code-eliminator/dependency-metadata.js +172 -2
  181. package/dead-code-eliminator/dependency-metadata.js.map +1 -1
  182. package/dead-code-eliminator/elimination-emitter.js +52 -0
  183. package/dead-code-eliminator/elimination-emitter.js.map +1 -1
  184. package/dead-code-eliminator/eliminator.js +22 -4
  185. package/dead-code-eliminator/eliminator.js.map +1 -1
  186. package/dead-code-eliminator/expression-unwrapping.js +16 -1
  187. package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
  188. package/dead-code-eliminator/imported-expression-origin.js +101 -2
  189. package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
  190. package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
  191. package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
  192. package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
  193. package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
  194. package/dead-code-eliminator/liveness/external-purity-summary.js +314 -3
  195. package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
  196. package/dead-code-eliminator/liveness/external-purity.js +39 -3
  197. package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
  198. package/dead-code-eliminator/liveness/module-analysis.js +27 -2
  199. package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
  200. package/dead-code-eliminator/liveness/resource-retention.js +91 -1
  201. package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
  202. package/dead-code-eliminator/liveness/runtime-code.js +15 -1
  203. package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
  204. package/dead-code-eliminator/load-bundle.js +86 -5
  205. package/dead-code-eliminator/load-bundle.js.map +1 -1
  206. package/dead-code-eliminator/pure-expression.js +178 -5
  207. package/dead-code-eliminator/pure-expression.js.map +1 -1
  208. package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
  209. package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
  210. package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
  211. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  212. package/dead-code-eliminator/reachability/binding-id.js +106 -1
  213. package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
  214. package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -1
  215. package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
  216. package/dead-code-eliminator/reachability/impure-statements.js +11 -2
  217. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  218. package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
  219. package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
  220. package/dead-code-eliminator/reachability/reachability.js +70 -4
  221. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  222. package/dead-code-eliminator/side-effect-classifier.js +39 -4
  223. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  224. package/dead-code-eliminator/side-effects-field.js +23 -1
  225. package/dead-code-eliminator/side-effects-field.js.map +1 -1
  226. package/dead-code-eliminator/source-map-recomposition.js +29 -2
  227. package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
  228. package/dead-code-eliminator/statement-classifiers.js +94 -4
  229. package/dead-code-eliminator/statement-classifiers.js.map +1 -1
  230. package/dead-code-eliminator/syntax-kind-sets.js +16 -0
  231. package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
  232. package/dead-code-eliminator/transform/atom-translator.js +57 -2
  233. package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
  234. package/dead-code-eliminator/transform/declaration-removal.js +183 -5
  235. package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
  236. package/dead-code-eliminator/transform/declaration-remover.js +17 -2
  237. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  238. package/dead-code-eliminator/transform/line-index.js +20 -0
  239. package/dead-code-eliminator/transform/line-index.js.map +1 -1
  240. package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
  241. package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
  242. package/dead-code-eliminator/transform/source-map-composer.js +84 -3
  243. package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
  244. package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
  245. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
  246. package/dependency-scanner/dependency-graph.js +77 -3
  247. package/dependency-scanner/dependency-graph.js.map +1 -1
  248. package/dependency-scanner/external-dependencies.js +55 -1
  249. package/dependency-scanner/external-dependencies.js.map +1 -1
  250. package/dependency-scanner/file-host-predicates.js +9 -0
  251. package/dependency-scanner/file-host-predicates.js.map +1 -1
  252. package/dependency-scanner/host-method-binding.js +18 -0
  253. package/dependency-scanner/host-method-binding.js.map +1 -1
  254. package/dependency-scanner/injected-dynamic-imports.js +232 -1
  255. package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
  256. package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
  257. package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
  258. package/dependency-scanner/package-owned-asset-file-path.js +9 -1
  259. package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
  260. package/dependency-scanner/scanner.js +109 -4
  261. package/dependency-scanner/scanner.js.map +1 -1
  262. package/dependency-scanner/source-file-references.js +171 -6
  263. package/dependency-scanner/source-file-references.js.map +1 -1
  264. package/dependency-scanner/source-map-file-locator.js +66 -2
  265. package/dependency-scanner/source-map-file-locator.js.map +1 -1
  266. package/dependency-scanner/typescript-compiler-options.js +21 -1
  267. package/dependency-scanner/typescript-compiler-options.js.map +1 -1
  268. package/dependency-scanner/typescript-file-host.js +49 -5
  269. package/dependency-scanner/typescript-file-host.js.map +1 -1
  270. package/dependency-scanner/typescript-module-resolution.js +214 -0
  271. package/dependency-scanner/typescript-module-resolution.js.map +1 -0
  272. package/dependency-scanner/typescript-project-analyzer.js +32 -3
  273. package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
  274. package/dependency-scanner/virtual-package-json-host.js +45 -4
  275. package/dependency-scanner/virtual-package-json-host.js.map +1 -1
  276. package/directed-graph/graph.js +240 -1
  277. package/directed-graph/graph.js.map +1 -1
  278. package/file-manager/compare.js +23 -2
  279. package/file-manager/compare.js.map +1 -1
  280. package/file-manager/equal.js +5 -0
  281. package/file-manager/equal.js.map +1 -1
  282. package/file-manager/file-description.js +3 -0
  283. package/file-manager/file-description.js.map +1 -1
  284. package/file-manager/permissions.js +28 -1
  285. package/file-manager/permissions.js.map +1 -1
  286. package/git/current-git-head.js +24 -0
  287. package/git/current-git-head.js.map +1 -1
  288. package/git/git-command.js +49 -1
  289. package/git/git-command.js.map +1 -1
  290. package/linker/linked-bundle.js +5 -0
  291. package/linker/linked-bundle.js.map +1 -1
  292. package/linker/linker.js +51 -5
  293. package/linker/linker.js.map +1 -1
  294. package/linker/replacement-lookup.js +297 -8
  295. package/linker/replacement-lookup.js.map +1 -1
  296. package/linker/resource-graph.js +65 -2
  297. package/linker/resource-graph.js.map +1 -1
  298. package/linker/source-modifier/import-paths.js +80 -3
  299. package/linker/source-modifier/import-paths.js.map +1 -1
  300. package/linker/substitute-bundles.js +166 -3
  301. package/linker/substitute-bundles.js.map +1 -1
  302. package/linker/substituted-resource-graph.js +111 -2
  303. package/linker/substituted-resource-graph.js.map +1 -1
  304. package/npm-oidc-id-token-resolver.js +82 -0
  305. package/npm-oidc-id-token-resolver.js.map +1 -1
  306. package/pack-emitter/pack-emitter.js +27 -0
  307. package/pack-emitter/pack-emitter.js.map +1 -1
  308. package/package-surface/bin-field.js +8 -2
  309. package/package-surface/bin-field.js.map +1 -1
  310. package/package-surface/explicit-bin.js +24 -2
  311. package/package-surface/explicit-bin.js.map +1 -1
  312. package/package-surface/explicit-exports.js +26 -3
  313. package/package-surface/explicit-exports.js.map +1 -1
  314. package/package-surface/export-map.js +9 -2
  315. package/package-surface/export-map.js.map +1 -1
  316. package/package-surface/implicit-bin.js +25 -1
  317. package/package-surface/implicit-bin.js.map +1 -1
  318. package/package-surface/implicit-exports.js +10 -3
  319. package/package-surface/implicit-exports.js.map +1 -1
  320. package/package-surface/implicit-root-exports.js +13 -2
  321. package/package-surface/implicit-root-exports.js.map +1 -1
  322. package/package-surface/package-json-export.js +9 -0
  323. package/package-surface/package-json-export.js.map +1 -1
  324. package/package-surface/package-shape.js +10 -1
  325. package/package-surface/package-shape.js.map +1 -1
  326. package/package-surface/package-surface-index.js +165 -3
  327. package/package-surface/package-surface-index.js.map +1 -1
  328. package/package-surface/public-module-usage.js +46 -3
  329. package/package-surface/public-module-usage.js.map +1 -1
  330. package/package-surface/public-specifiers.js +7 -1
  331. package/package-surface/public-specifiers.js.map +1 -1
  332. package/package-surface/root-registry.js +26 -0
  333. package/package-surface/root-registry.js.map +1 -1
  334. package/package-surface/specifier-syntax.js +4 -0
  335. package/package-surface/specifier-syntax.js.map +1 -1
  336. package/package-surface/substitution-exports.js +101 -3
  337. package/package-surface/substitution-exports.js.map +1 -1
  338. package/package-surface/surface.js +12 -0
  339. package/package-surface/surface.js.map +1 -1
  340. package/package.json +2 -2
  341. package/packages/package-processor.composition.js +161 -34
  342. package/packages/package-processor.composition.js.map +1 -1
  343. package/packtory/map-config.js +35 -4
  344. package/packtory/map-config.js.map +1 -1
  345. package/packtory/normalize-paths.js +25 -1
  346. package/packtory/normalize-paths.js.map +1 -1
  347. package/packtory/options/bundle-dependency-resolution.js +17 -1
  348. package/packtory/options/bundle-dependency-resolution.js.map +1 -1
  349. package/packtory/options/dead-code-elimination-resolution.js +10 -1
  350. package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
  351. package/packtory/options/prepare-package-options.js +46 -5
  352. package/packtory/options/prepare-package-options.js.map +1 -1
  353. package/packtory/options/required-value-helpers.js +17 -0
  354. package/packtory/options/required-value-helpers.js.map +1 -1
  355. package/packtory/options/setting-resolvers.js +47 -3
  356. package/packtory/options/setting-resolvers.js.map +1 -1
  357. package/packtory/options/surface-resolution.js +15 -2
  358. package/packtory/options/surface-resolution.js.map +1 -1
  359. package/packtory/options/version-provider-context.js +24 -2
  360. package/packtory/options/version-provider-context.js.map +1 -1
  361. package/packtory/options/version-trigger.js +39 -2
  362. package/packtory/options/version-trigger.js.map +1 -1
  363. package/packtory/pack-output-preflight.js +60 -3
  364. package/packtory/pack-output-preflight.js.map +1 -1
  365. package/packtory/package-processor-build.js +97 -3
  366. package/packtory/package-processor-build.js.map +1 -1
  367. package/packtory/package-processor-publish.js +297 -6
  368. package/packtory/package-processor-publish.js.map +1 -1
  369. package/packtory/package-processor.js +10 -2
  370. package/packtory/package-processor.js.map +1 -1
  371. package/packtory/packtory-pack.js +298 -10
  372. package/packtory/packtory-pack.js.map +1 -1
  373. package/packtory/packtory-package-dependencies.js +116 -2
  374. package/packtory/packtory-package-dependencies.js.map +1 -1
  375. package/packtory/packtory-package-inspection.js +26 -5
  376. package/packtory/packtory-package-inspection.js.map +1 -1
  377. package/packtory/packtory-package-side-effects.js +64 -3
  378. package/packtory/packtory-package-side-effects.js.map +1 -1
  379. package/packtory/packtory-package-tree.js +43 -4
  380. package/packtory/packtory-package-tree.js.map +1 -1
  381. package/packtory/packtory-publish.js +17 -4
  382. package/packtory/packtory-publish.js.map +1 -1
  383. package/packtory/packtory-release-analysis.js +64 -6
  384. package/packtory/packtory-release-analysis.js.map +1 -1
  385. package/packtory/packtory-release-diff.js +48 -5
  386. package/packtory/packtory-release-diff.js.map +1 -1
  387. package/packtory/packtory-release-plan.js +87 -6
  388. package/packtory/packtory-release-plan.js.map +1 -1
  389. package/packtory/packtory-resolve.js +16 -5
  390. package/packtory/packtory-resolve.js.map +1 -1
  391. package/packtory/packtory.js +242 -13
  392. package/packtory/packtory.js.map +1 -1
  393. package/packtory/publish-failure-mapping.js +6 -0
  394. package/packtory/publish-failure-mapping.js.map +1 -1
  395. package/packtory/publish-target-preflight.js +25 -3
  396. package/packtory/publish-target-preflight.js.map +1 -1
  397. package/packtory/published-release-state.js +11 -0
  398. package/packtory/published-release-state.js.map +1 -1
  399. package/packtory/release-analysis.js +153 -5
  400. package/packtory/release-analysis.js.map +1 -1
  401. package/packtory/release-diff-failure-mapping.js +6 -0
  402. package/packtory/release-diff-failure-mapping.js.map +1 -1
  403. package/packtory/release-plan.js +135 -7
  404. package/packtory/release-plan.js.map +1 -1
  405. package/packtory/report-attachment.js +35 -2
  406. package/packtory/report-attachment.js.map +1 -1
  407. package/packtory/resolved-package.js +97 -3
  408. package/packtory/resolved-package.js.map +1 -1
  409. package/packtory/scheduler.js +99 -1
  410. package/packtory/scheduler.js.map +1 -1
  411. package/packtory/stages/package-analysis-stage.js +50 -2
  412. package/packtory/stages/package-analysis-stage.js.map +1 -1
  413. package/packtory/stages/package-resolution-stage.js +80 -5
  414. package/packtory/stages/package-resolution-stage.js.map +1 -1
  415. package/packtory/stages/publish-stage.js +125 -4
  416. package/packtory/stages/publish-stage.js.map +1 -1
  417. package/packtory/stages/release-diff-stage.js +84 -5
  418. package/packtory/stages/release-diff-stage.js.map +1 -1
  419. package/progress/progress-broadcaster.js +45 -0
  420. package/progress/progress-broadcaster.js.map +1 -1
  421. package/published-package/published-package.js +12 -1
  422. package/published-package/published-package.js.map +1 -1
  423. package/report/aggregator/artifact-entry-merger.js +20 -0
  424. package/report/aggregator/artifact-entry-merger.js.map +1 -1
  425. package/report/aggregator/package-report-materialization.js +75 -2
  426. package/report/aggregator/package-report-materialization.js.map +1 -1
  427. package/report/aggregator/report-aggregator.js +37 -2
  428. package/report/aggregator/report-aggregator.js.map +1 -1
  429. package/report/aggregator/report-event-handlers.js +141 -2
  430. package/report/aggregator/report-event-handlers.js.map +1 -1
  431. package/report/aggregator/report-types.js +3 -0
  432. package/report/aggregator/report-types.js.map +1 -1
  433. package/report/config-redactor.js +29 -3
  434. package/report/config-redactor.js.map +1 -1
  435. package/report/decorators.js +85 -0
  436. package/report/decorators.js.map +1 -1
  437. package/report/inspectors/inspect-artifact-sizes.js +34 -1
  438. package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
  439. package/report/inspectors/inspect-linker-rewrites.js +14 -1
  440. package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
  441. package/report/inspectors/inspect-package-json-provenance.js +15 -0
  442. package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
  443. package/report/inspectors/inspect-scan-results.js +15 -0
  444. package/report/inspectors/inspect-scan-results.js.map +1 -1
  445. package/report/release-diff/release-version-transition.js +18 -0
  446. package/report/release-diff/release-version-transition.js.map +1 -1
  447. package/resource-resolver/bundle-resource-lookup.js +25 -0
  448. package/resource-resolver/bundle-resource-lookup.js.map +1 -1
  449. package/resource-resolver/content.js +136 -4
  450. package/resource-resolver/content.js.map +1 -1
  451. package/resource-resolver/dependency-resolution-walker.js +73 -2
  452. package/resource-resolver/dependency-resolution-walker.js.map +1 -1
  453. package/resource-resolver/resolved-bundle.js +3 -0
  454. package/resource-resolver/resolved-bundle.js.map +1 -1
  455. package/resource-resolver/resource-resolve-options.js +13 -1
  456. package/resource-resolver/resource-resolve-options.js.map +1 -1
  457. package/resource-resolver/resource-resolver.js +128 -6
  458. package/resource-resolver/resource-resolver.js.map +1 -1
  459. package/sbom/extract-license.js +11 -1
  460. package/sbom/extract-license.js.map +1 -1
  461. package/sbom/license-resolver.js +23 -2
  462. package/sbom/license-resolver.js.map +1 -1
  463. package/sbom/sbom-builder.js +57 -2
  464. package/sbom/sbom-builder.js.map +1 -1
  465. package/sbom/sbom-canonicalizer.js +45 -3
  466. package/sbom/sbom-canonicalizer.js.map +1 -1
  467. package/sbom/sbom-file.js +54 -5
  468. package/sbom/sbom-file.js.map +1 -1
  469. package/sbom/sbom-serializer.js +14 -1
  470. package/sbom/sbom-serializer.js.map +1 -1
  471. package/sbom/tool-version.js +49 -1
  472. package/sbom/tool-version.js.map +1 -1
  473. package/sbom.cdx.json +10 -10
  474. package/tar/extract-tar.js +83 -3
  475. package/tar/extract-tar.js.map +1 -1
  476. package/tar/gzipped-pack.js +20 -0
  477. package/tar/gzipped-pack.js.map +1 -1
  478. package/tar/tarball-builder.js +44 -4
  479. package/tar/tarball-builder.js.map +1 -1
  480. package/vendor-materializer/vendor-entry.js +20 -1
  481. package/vendor-materializer/vendor-entry.js.map +1 -1
  482. package/vendor-materializer/vendor-materializer.js +240 -8
  483. package/vendor-materializer/vendor-materializer.js.map +1 -1
  484. package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
  485. package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
  486. package/version-manager/dependencies/dependency-groups.js +11 -1
  487. package/version-manager/dependencies/dependency-groups.js.map +1 -1
  488. package/version-manager/dependencies/external-dependency-classification.js +82 -3
  489. package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
  490. package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
  491. package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
  492. package/version-manager/imports/hash-import-scanner.js +20 -2
  493. package/version-manager/imports/hash-import-scanner.js.map +1 -1
  494. package/version-manager/imports/imports-key-matcher.js +22 -0
  495. package/version-manager/imports/imports-key-matcher.js.map +1 -1
  496. package/version-manager/imports/versioned-bundle-imports.js +44 -2
  497. package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
  498. package/version-manager/manager.js +46 -6
  499. package/version-manager/manager.js.map +1 -1
  500. package/version-manager/manifest/builder.js +51 -1
  501. package/version-manager/manifest/builder.js.map +1 -1
  502. package/version-manager/manifest/serialize.js +8 -1
  503. package/version-manager/manifest/serialize.js.map +1 -1
  504. package/version-manager/optional-bundle-fields.js +5 -1
  505. package/version-manager/optional-bundle-fields.js.map +1 -1
  506. package/version-manager/representative-root.js +9 -1
  507. package/version-manager/representative-root.js.map +1 -1
  508. package/version-manager/specifier-classifier.js +42 -2
  509. package/version-manager/specifier-classifier.js.map +1 -1
  510. package/version-manager/specifier-errors.js +58 -0
  511. package/version-manager/specifier-errors.js.map +1 -1
  512. package/version-manager/versioned-bundle.js +31 -6
  513. package/version-manager/versioned-bundle.js.map +1 -1
  514. package/zip/zip-builder.js +81 -2
  515. package/zip/zip-builder.js.map +1 -1
  516. package/dead-code-eliminator/liveness/external-module-resolution.js +0 -3
  517. package/dead-code-eliminator/liveness/external-module-resolution.js.map +0 -1
@@ -1,4 +1,167 @@
1
- import "./replacement-lookup.js";
2
- import "./source-modifier/import-paths.js";
3
- import "./substituted-resource-graph.js";
1
+ import { findAllPathReplacements, ownsSourcePath } from "./replacement-lookup.js";
2
+ import { replaceImportPathsWithTransform } from "./source-modifier/import-paths.js";
3
+ import { createSubstitutedResourceGraph } from "./substituted-resource-graph.js";
4
+ function isSubstitutionSourcePath(inputFilePath, substitutionSources) {
5
+ return substitutionSources.some(function (bundle) {
6
+ return ownsSourcePath(inputFilePath, bundle);
7
+ });
8
+ }
9
+ function recordUnreplacedConnections(outstandingConnections, fromNodeId, directDependencies, replacedPaths) {
10
+ for (const file of directDependencies) {
11
+ if (!replacedPaths.has(file)) {
12
+ outstandingConnections.push({ from: fromNodeId, to: file });
13
+ }
14
+ }
15
+ }
16
+ function createReplacementRequest(inputFilePath) {
17
+ return {
18
+ inputFilePath,
19
+ requiredExportNames: new Set(),
20
+ requiresNamespaceExport: false
21
+ };
22
+ }
23
+ function replacementRequestForInputFilePath(requestsByInputFilePath, inputFilePath) {
24
+ return requestsByInputFilePath.get(inputFilePath) ?? createReplacementRequest(inputFilePath);
25
+ }
26
+ function addRequiredExportName(requestsByInputFilePath, inputFilePath, requiredExportName) {
27
+ const request = replacementRequestForInputFilePath(requestsByInputFilePath, inputFilePath);
28
+ requestsByInputFilePath.set(inputFilePath, {
29
+ ...request,
30
+ requiredExportNames: new Set([...request.requiredExportNames, requiredExportName])
31
+ });
32
+ }
33
+ function requireNamespaceExport(requestsByInputFilePath, inputFilePath) {
34
+ const request = replacementRequestForInputFilePath(requestsByInputFilePath, inputFilePath);
35
+ requestsByInputFilePath.set(inputFilePath, { ...request, requiresNamespaceExport: true });
36
+ }
37
+ function recordImportRequirements(requestsByInputFilePath, declaration) {
38
+ const importedSourceFile = declaration.getModuleSpecifierSourceFile();
39
+ if (importedSourceFile === undefined) {
40
+ return;
41
+ }
42
+ const inputFilePath = importedSourceFile.getFilePath();
43
+ if (declaration.getDefaultImport() !== undefined) {
44
+ addRequiredExportName(requestsByInputFilePath, inputFilePath, 'default');
45
+ }
46
+ if (declaration.getNamespaceImport() !== undefined) {
47
+ requireNamespaceExport(requestsByInputFilePath, inputFilePath);
48
+ }
49
+ for (const namedImport of declaration.getNamedImports()) {
50
+ addRequiredExportName(requestsByInputFilePath, inputFilePath, namedImport.getName());
51
+ }
52
+ }
53
+ function recordExportRequirements(requestsByInputFilePath, declaration) {
54
+ const exportedSourceFile = declaration.getModuleSpecifierSourceFile();
55
+ if (exportedSourceFile === undefined) {
56
+ return;
57
+ }
58
+ const inputFilePath = exportedSourceFile.getFilePath();
59
+ if (declaration.isNamespaceExport()) {
60
+ requireNamespaceExport(requestsByInputFilePath, inputFilePath);
61
+ }
62
+ for (const namedExport of declaration.getNamedExports()) {
63
+ addRequiredExportName(requestsByInputFilePath, inputFilePath, namedExport.getName());
64
+ }
65
+ }
66
+ function recordStaticRequirements(requestsByInputFilePath, sourceFile) {
67
+ for (const declaration of sourceFile.getImportDeclarations()) {
68
+ recordImportRequirements(requestsByInputFilePath, declaration);
69
+ }
70
+ for (const declaration of sourceFile.getExportDeclarations()) {
71
+ recordExportRequirements(requestsByInputFilePath, declaration);
72
+ }
73
+ }
74
+ function collectImportRequirements(node) {
75
+ const requestsByInputFilePath = new Map();
76
+ for (const inputFilePath of node.adjacentNodeIds) {
77
+ requestsByInputFilePath.set(inputFilePath, createReplacementRequest(inputFilePath));
78
+ }
79
+ const sourceFile = node.data.project?.getSourceFile(node.data.fileDescription.inputFilePath);
80
+ if (sourceFile !== undefined) {
81
+ recordStaticRequirements(requestsByInputFilePath, sourceFile);
82
+ }
83
+ return Array.from(requestsByInputFilePath.values());
84
+ }
85
+ function contentWithReplacements(node, replacements) {
86
+ return replaceImportPathsWithTransform(node.data.project, node.data.fileDescription.inputFilePath, node.data.fileDescription.content, replacements.importPathReplacements);
87
+ }
88
+ function fallbackDependencyReferences(replacements) {
89
+ return Array.from(replacements.importPathReplacements.values(), function (replacement) {
90
+ return {
91
+ name: replacement.packageName,
92
+ sourceSpecifier: replacement.emittedSpecifier,
93
+ emittedSpecifier: replacement.emittedSpecifier
94
+ };
95
+ });
96
+ }
97
+ function referenceWithReplacement(reference, replacements, inputFilePathByTargetFilePath) {
98
+ if (reference.type !== 'local-code' &&
99
+ reference.type !== 'local-asset' &&
100
+ reference.type !== 'generated-manifest') {
101
+ return reference;
102
+ }
103
+ const inputFilePath = inputFilePathByTargetFilePath.get(reference.targetFilePath);
104
+ const replacementLookupPath = inputFilePath ?? reference.targetFilePath;
105
+ const replacement = replacements.importPathReplacements.get(replacementLookupPath);
106
+ if (replacement === undefined) {
107
+ return reference;
108
+ }
109
+ return {
110
+ type: 'linked-code',
111
+ sourceSpecifier: reference.sourceSpecifier,
112
+ emittedSpecifier: replacement.emittedSpecifier,
113
+ packageName: replacement.packageName,
114
+ targetFilePath: reference.targetFilePath
115
+ };
116
+ }
117
+ function moduleReferencesWithReplacements(node, replacements, inputFilePathByTargetFilePath) {
118
+ return node.data.moduleReferences.map(function (reference) {
119
+ return referenceWithReplacement(reference, replacements, inputFilePathByTargetFilePath);
120
+ });
121
+ }
122
+ function addNodeWithReplacements(substitutedGraph, node, replacements, inputFilePathByTargetFilePath) {
123
+ const isSubstituted = replacements.importPathReplacements.size > 0;
124
+ const replacementResult = contentWithReplacements(node, replacements);
125
+ const dependencyReferences = replacementResult.dependencyReferences.length === 0
126
+ ? fallbackDependencyReferences(replacements)
127
+ : replacementResult.dependencyReferences;
128
+ const sourceMapTransformsByTargetPath = replacementResult.sourceMapTransform === undefined
129
+ ? new Map()
130
+ : new Map([[node.data.fileDescription.targetFilePath, [replacementResult.sourceMapTransform]]]);
131
+ substitutedGraph.add(node.id, {
132
+ fileDescription: { ...node.data.fileDescription, content: replacementResult.content },
133
+ moduleReferences: moduleReferencesWithReplacements(node, replacements, inputFilePathByTargetFilePath),
134
+ externalDependencies: node.data.externalDependencies,
135
+ bundleDependencies: isSubstituted ? dependencyReferences : [],
136
+ substitutedInputFilePathsByPackageName: replacements.substitutedInputFilePathsByPackageName,
137
+ sourceMapTransformsByTargetPath,
138
+ isSubstituted,
139
+ isExplicitlyIncluded: node.data.isExplicitlyIncluded,
140
+ ...node.data.isGeneratedManifest ? { isGeneratedManifest: true } : {}
141
+ });
142
+ }
143
+ export function substituteDependencies(resourceGraph, bundleDependencies, bundlePeerDependencies) {
144
+ const substitutedGraph = createSubstitutedResourceGraph();
145
+ const outstandingConnections = [];
146
+ const visited = new Set();
147
+ const substitutionSources = [...bundleDependencies, ...bundlePeerDependencies];
148
+ function substituteNode(node) {
149
+ if (visited.has(node.id)) {
150
+ return;
151
+ }
152
+ visited.add(node.id);
153
+ if (!node.data.isExplicitlyIncluded && isSubstitutionSourcePath(node.id, substitutionSources)) {
154
+ return;
155
+ }
156
+ const directDependencies = Array.from(node.adjacentNodeIds);
157
+ const replacements = findAllPathReplacements(collectImportRequirements(node), bundleDependencies, bundlePeerDependencies);
158
+ recordUnreplacedConnections(outstandingConnections, node.id, directDependencies, replacements.importPathReplacements);
159
+ addNodeWithReplacements(substitutedGraph, node, replacements, resourceGraph.inputFilePathByTargetFilePath);
160
+ }
161
+ resourceGraph.traverse(substituteNode);
162
+ for (const connection of outstandingConnections) {
163
+ substitutedGraph.connect(connection.from, connection.to);
164
+ }
165
+ return substitutedGraph;
166
+ }
4
167
  //# sourceMappingURL=substitute-bundles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"substitute-bundles.js","sourceRoot":"","sources":["../../../../source/linker/substitute-bundles.ts"],"names":[],"mappings":"AAGA,OAKO,yBAAyB,CAAC;AAEjC,OAIO,mCAAmC,CAAC;AAC3C,OAA8E,iCAAiC,CAAC"}
1
+ {"version":3,"file":"substitute-bundles.js","sourceRoot":"","sources":["../../../../source/linker/substitute-bundles.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,uBAAuB,EACvB,cAAc,EAGjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACH,+BAA+B,EAGlC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAiC,MAAM,iCAAiC,CAAC;AAahH,SAAS,wBAAwB,CAC7B,aAAqB,EACrB,mBAAwD;IAExD,OAAO,mBAAmB,CAAC,IAAI,CAAC,UAAU,MAAM;QAC5C,OAAO,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AAC5B,CAAC"}
@@ -1,3 +1,112 @@
1
- import "../dependency-scanner/external-dependencies.js";
2
- import "../directed-graph/graph.js";
1
+ import { mergeExternalDependencyReference } from "../dependency-scanner/external-dependencies.js";
2
+ import { createDirectedGraph } from "../directed-graph/graph.js";
3
+ function collectLinkedBundleDependencies(linkedBundleDependencies, bundleDependencies, filePath) {
4
+ for (const bundleDependencyReference of bundleDependencies) {
5
+ const bundleDependency = linkedBundleDependencies.get(bundleDependencyReference.name);
6
+ linkedBundleDependencies.set(bundleDependencyReference.name, mergeExternalDependencyReference(bundleDependencyReference, filePath, bundleDependency));
7
+ }
8
+ }
9
+ function collectSubstitutedInputFilePaths(target, source) {
10
+ const result = new Map(target);
11
+ for (const [packageName, inputFilePaths] of source) {
12
+ const existing = result.get(packageName) ?? [];
13
+ result.set(packageName, new Set([...existing, ...inputFilePaths]));
14
+ }
15
+ return Array.from(result);
16
+ }
17
+ function collectExternalDependencies(externalDependencies, dependencies, filePath) {
18
+ for (const dependencyReference of dependencies) {
19
+ const externalDependency = externalDependencies.get(dependencyReference.name);
20
+ externalDependencies.set(dependencyReference.name, mergeExternalDependencyReference(dependencyReference, filePath, externalDependency));
21
+ }
22
+ }
23
+ function directDependencyTargetPaths(directDependencies, targetFilePathByInputFilePath) {
24
+ return new Set(Array.from(directDependencies, function (inputFilePath) {
25
+ return targetFilePathByInputFilePath.get(inputFilePath) ?? inputFilePath;
26
+ }));
27
+ }
28
+ function collectSourceMapTransforms(sourceMapTransformsByTargetPath, source) {
29
+ for (const [targetPath, transforms] of source) {
30
+ const existing = sourceMapTransformsByTargetPath.get(targetPath) ?? [];
31
+ sourceMapTransformsByTargetPath.set(targetPath, [...existing, ...transforms]);
32
+ }
33
+ }
34
+ function createFlattenCollectors() {
35
+ const contents = [];
36
+ const linkedBundleDependencies = new Map();
37
+ const substitutedInputFilePathsByPackageName = new Map();
38
+ const sourceMapTransformsByTargetPath = new Map();
39
+ const externalDependencies = new Map();
40
+ const visited = new Set();
41
+ function collect(filePath, data, directDependencies, targetFilePathByInputFilePath) {
42
+ if (visited.has(filePath)) {
43
+ return;
44
+ }
45
+ visited.add(filePath);
46
+ contents.push({
47
+ fileDescription: data.fileDescription,
48
+ directDependencies: directDependencyTargetPaths(directDependencies, targetFilePathByInputFilePath),
49
+ moduleReferences: data.moduleReferences,
50
+ isSubstituted: data.isSubstituted,
51
+ isExplicitlyIncluded: data.isExplicitlyIncluded,
52
+ ...data.isGeneratedManifest ? { isGeneratedManifest: true } : {}
53
+ });
54
+ collectLinkedBundleDependencies(linkedBundleDependencies, data.bundleDependencies, data.fileDescription.targetFilePath);
55
+ for (const [packageName, inputFilePaths] of collectSubstitutedInputFilePaths(substitutedInputFilePathsByPackageName, data.substitutedInputFilePathsByPackageName)) {
56
+ substitutedInputFilePathsByPackageName.set(packageName, new Set(inputFilePaths));
57
+ }
58
+ collectSourceMapTransforms(sourceMapTransformsByTargetPath, data.sourceMapTransformsByTargetPath);
59
+ collectExternalDependencies(externalDependencies, data.externalDependencies, data.fileDescription.targetFilePath);
60
+ }
61
+ return {
62
+ collect,
63
+ contents,
64
+ linkedBundleDependencies,
65
+ substitutedInputFilePathsByPackageName,
66
+ sourceMapTransformsByTargetPath,
67
+ externalDependencies
68
+ };
69
+ }
70
+ export function createSubstitutedResourceGraph() {
71
+ const graph = createDirectedGraph();
72
+ const nodeDataByFilePath = new Map();
73
+ function targetFilePathByInputFilePath() {
74
+ return new Map(Array.from(nodeDataByFilePath, function ([filePath, data]) {
75
+ return [filePath, data.fileDescription.targetFilePath];
76
+ }));
77
+ }
78
+ return {
79
+ add(filePath, data) {
80
+ graph.addNode(filePath, data);
81
+ nodeDataByFilePath.set(filePath, data);
82
+ },
83
+ isKnown: graph.hasNode,
84
+ connect(fromFilePath, toFilePath) {
85
+ graph.connect({ from: fromFilePath, to: toFilePath });
86
+ },
87
+ flatten(rootFilePaths) {
88
+ const { collect, contents, linkedBundleDependencies, substitutedInputFilePathsByPackageName, sourceMapTransformsByTargetPath, externalDependencies } = createFlattenCollectors();
89
+ const targetPaths = targetFilePathByInputFilePath();
90
+ for (const rootFilePath of rootFilePaths) {
91
+ graph.visitBreadthFirstSearch(rootFilePath, function (node) {
92
+ collect(node.id, node.data, node.adjacentNodeIds, targetPaths);
93
+ });
94
+ }
95
+ const includedNodes = Array.from(nodeDataByFilePath).filter(function ([, data]) {
96
+ return data.isExplicitlyIncluded;
97
+ });
98
+ for (const [filePath, data] of includedNodes) {
99
+ const directDependencies = graph.getAdjacentIds(filePath);
100
+ collect(filePath, data, directDependencies, targetPaths);
101
+ }
102
+ return {
103
+ contents,
104
+ linkedBundleDependencies,
105
+ substitutedInputFilePathsByPackageName,
106
+ sourceMapTransformsByTargetPath,
107
+ externalDependencies
108
+ };
109
+ }
110
+ };
111
+ }
3
112
  //# sourceMappingURL=substituted-resource-graph.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"substituted-resource-graph.js","sourceRoot":"","sources":["../../../../source/linker/substituted-resource-graph.ts"],"names":[],"mappings":"AAEA,OAIO,gDAAgD,CAAC;AACxD,OAAoC,4BAA4B,CAAC"}
1
+ {"version":3,"file":"substituted-resource-graph.js","sourceRoot":"","sources":["../../../../source/linker/substituted-resource-graph.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,gCAAgC,EAGnC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AA0CjE,SAAS,+BAA+B,CACpC,wBAAyD,EACzD,kBAA0F,EAC1F,QAAgB;IAEhB,KAAK,MAAM,yBAAyB,IAAI,kBAAkB,EAAE,CAAC;QACzD,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,GAAG,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QACtF,wBAAwB,CAAC,GAAG,CACxB,yBAAyB,CAAC,IAAI,EAC9B,gCAAgC,CAAC,yBAAyB,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAC1F,CAAC;IACN,CAAC;AACL,CA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,EACxB,sCAAsC,EACtC,+BAA+B,EAC/B,oBAAoB,EACvB,GAAG,uBAAuB,EAAE,CAAC;YAC9B,MAAM,WAAW,GAAG,6BAA6B,EAAE,CAAC;YAEpD,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;gBACvC,KAAK,CAAC,uBAAuB,CAAC,YAAY,EAAE,UAAU,IAAI;oBACtD,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;gBACnE,CAAC,CAAC,CAAC;YACP,CAAC;YAED,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAE,AAAD,EAAG,IAAI,CAAE;gBAC5E,OAAO,IAAI,CAAC,oBAAoB,CAAC;YACrC,CAAC,CAAC,CAAC;YACH,KAAK,MAAM,CAAE,QAAQ,EAAE,IAAI,CAAE,IAAI,aAAa,EAAE,CAAC;gBAC7C,MAAM,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;gBAC1D,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;YAC7D,CAAC;YAED,OAAO;gBACH,QAAQ;gBACR,wBAAwB;gBACxB,sCAAsC;gBACtC,+BAA+B;gBAC/B,oBAAoB;aACvB,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -1 +1,83 @@
1
+ function isRecord(value) {
2
+ return value instanceof Object && !Array.isArray(value);
3
+ }
4
+ function githubActionsAudience() {
5
+ return 'npm:registry.npmjs.org';
6
+ }
7
+ function defaultOidcIdTokenEnvVariableName() {
8
+ return 'NPM_ID_TOKEN';
9
+ }
10
+ function trustedOidcRequestSuffix() {
11
+ return '.actions.githubusercontent.com';
12
+ }
13
+ function parseOidcRequestUrl(value) {
14
+ try {
15
+ return new URL(value);
16
+ }
17
+ catch {
18
+ throw new Error(`ACTIONS_ID_TOKEN_REQUEST_URL is not a valid URL: "${value}"`);
19
+ }
20
+ }
21
+ function buildOidcHostnameMismatchMessage(actualHostname) {
22
+ return (`ACTIONS_ID_TOKEN_REQUEST_URL hostname must end with "${trustedOidcRequestSuffix()}", ` +
23
+ `got "${actualHostname}". A non-GitHub host would receive the GitHub-issued OIDC bearer.`);
24
+ }
25
+ function assertTrustedOidcRequestUrl(value) {
26
+ const parsed = parseOidcRequestUrl(value);
27
+ if (parsed.protocol !== 'https:') {
28
+ throw new Error(`ACTIONS_ID_TOKEN_REQUEST_URL must use https, got: "${value}"`);
29
+ }
30
+ if (!parsed.hostname.endsWith(trustedOidcRequestSuffix())) {
31
+ throw new Error(buildOidcHostnameMismatchMessage(parsed.hostname));
32
+ }
33
+ return parsed;
34
+ }
35
+ function getGitHubActionsRequestConfig(getEnvironmentVariable) {
36
+ const requestUrl = getEnvironmentVariable('ACTIONS_ID_TOKEN_REQUEST_URL');
37
+ const requestToken = getEnvironmentVariable('ACTIONS_ID_TOKEN_REQUEST_TOKEN');
38
+ if (requestUrl === undefined || requestToken === undefined) {
39
+ throw new Error('GitHub Actions OIDC requires ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN');
40
+ }
41
+ return { requestUrl: assertTrustedOidcRequestUrl(requestUrl), requestToken };
42
+ }
43
+ function parseGitHubActionsIdTokenResponse(body) {
44
+ if (!isRecord(body)) {
45
+ throw new Error('GitHub Actions OIDC token response did not contain a usable id_token');
46
+ }
47
+ const { value } = body;
48
+ if (typeof value !== 'string' || value.length === 0) {
49
+ throw new Error('GitHub Actions OIDC token response did not contain a usable id_token');
50
+ }
51
+ return value;
52
+ }
53
+ function usesGitHubActionsProvider(auth, getEnvironmentVariable) {
54
+ const provider = auth.provider ?? 'auto';
55
+ const runsInGitHubActions = getEnvironmentVariable('GITHUB_ACTIONS') === 'true';
56
+ return provider === 'github-actions' || provider === 'auto' && runsInGitHubActions;
57
+ }
58
+ export function createNpmOidcIdTokenResolver(dependencies) {
59
+ const { fetch: fetchImplementation, getEnvironmentVariable } = dependencies;
60
+ async function fetchGitHubActionsIdToken() {
61
+ const { requestUrl, requestToken } = getGitHubActionsRequestConfig(getEnvironmentVariable);
62
+ requestUrl.searchParams.set('audience', githubActionsAudience());
63
+ const response = await fetchImplementation(requestUrl, {
64
+ headers: { Authorization: `Bearer ${requestToken}` }
65
+ });
66
+ if (!response.ok) {
67
+ throw new Error(`GitHub Actions OIDC token request failed with status ${response.status}`);
68
+ }
69
+ return parseGitHubActionsIdTokenResponse(await response.json());
70
+ }
71
+ return async function (auth) {
72
+ if (usesGitHubActionsProvider(auth, getEnvironmentVariable)) {
73
+ return fetchGitHubActionsIdToken();
74
+ }
75
+ const variableName = auth.idTokenEnvVar ?? defaultOidcIdTokenEnvVariableName();
76
+ const value = getEnvironmentVariable(variableName);
77
+ if (value === undefined) {
78
+ throw new Error(`OIDC id_token environment variable "${variableName}" is missing`);
79
+ }
80
+ return value;
81
+ };
82
+ }
1
83
  //# sourceMappingURL=npm-oidc-id-token-resolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"npm-oidc-id-token-resolver.js","sourceRoot":"","sources":["../../../source/npm-oidc-id-token-resolver.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"npm-oidc-id-token-resolver.js","sourceRoot":"","sources":["../../../source/npm-oidc-id-token-resolver.ts"],"names":[],"mappings":"AAcA,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,KAAK,YAAY,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,qBAAqB;IAC1B,OAAO,wBAAwB,CAAC;AACpC,CAAC;AAED,SAAS,iCAAiC;IACtC,OAAO,cAAc,CAAC;AAC1B,CAAC;AAED,SAAS,wBAAwB;IAC7B,OAAO,gCAAgC,CAAC;AAC5C,CAAC;AAED,SAAS,mBAAmB,CAAC,KA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K,WAAW,IAAI;QACvB,IAAI,yBAAyB,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAAC;YAC1D,OAAO,yBAAyB,EAAE,CAAC;QACvC,CAAC;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,IAAI,iCAAiC,EAAE,CAAC;QAC/E,MAAM,KAAK,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,uCAAuC,YAAY,cAAc,CAAC,CAAC;QACvF,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC;AACN,CAAC"}
@@ -1 +1,28 @@
1
+ export function createPackEmitter(dependencies) {
2
+ const { artifactsBuilder, fileManager } = dependencies;
3
+ async function packZip(options) {
4
+ const { zipData } = await artifactsBuilder.buildZip(options.bundle, options.extraFiles, options.vendorEntries);
5
+ await fileManager.writeBinaryFile(options.outputPath, zipData);
6
+ }
7
+ async function packTarball(options) {
8
+ const { tarData } = await artifactsBuilder.buildTarball(options.bundle, options.extraFiles, options.vendorEntries);
9
+ await fileManager.writeBinaryFile(options.outputPath, tarData);
10
+ }
11
+ async function packFolder(options) {
12
+ await artifactsBuilder.buildFolder(options.bundle, options.outputPath, options.extraFiles, options.vendorEntries);
13
+ }
14
+ return {
15
+ async pack(options) {
16
+ if (options.format === 'zip') {
17
+ await packZip(options);
18
+ return;
19
+ }
20
+ if (options.format === 'tar') {
21
+ await packTarball(options);
22
+ return;
23
+ }
24
+ await packFolder(options);
25
+ }
26
+ };
27
+ }
1
28
  //# sourceMappingURL=pack-emitter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pack-emitter.js","sourceRoot":"","sources":["../../../../source/pack-emitter/pack-emitter.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"pack-emitter.js","sourceRoot":"","sources":["../../../../source/pack-emitter/pack-emitter.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,iBA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"./implicit-bin.js";
1
+ import { buildExplicitBinField } from "./explicit-bin.js";
2
+ import { buildImplicitBinField } from "./implicit-bin.js";
3
+ export function buildBinField(bundle) {
4
+ if (bundle.surface.mode === 'explicit') {
5
+ return buildExplicitBinField(bundle, bundle.surface);
6
+ }
7
+ return buildImplicitBinField(bundle);
8
+ }
3
9
  //# sourceMappingURL=bin-field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bin-field.js","sourceRoot":"","sources":["../../../../source/package-surface/bin-field.ts"],"names":[],"mappings":"AACA,OAAsC,mBAAmB,CAAC;AAC1D,OAAsC,mBAAmB,CAAC"}
1
+ {"version":3,"file":"bin-field.js","sourceRoot":"","sources":["../../../../source/package-surface/bin-field.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAK1D,MAAM,UAAU,aAAa,CAAC,MAAyB;IACnD,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACrC,OAAO,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
@@ -1,3 +1,25 @@
1
- import "./package-shape.js";
2
- import "./root-registry.js";
1
+ import { toImportTarget } from "./package-shape.js";
2
+ import { getRoot } from "./root-registry.js";
3
+ function isShebangContent(content) {
4
+ return content.startsWith('#!');
5
+ }
6
+ function validateShebangRoot(bundleName, entryName, root) {
7
+ if (!isShebangContent(root.js.content)) {
8
+ throw new Error(`Package "${bundleName}" bin "${entryName}" must point to a root with a shebang`);
9
+ }
10
+ return root;
11
+ }
12
+ function buildEntries(bundle, bins) {
13
+ return bins.map(function (entry) {
14
+ const root = validateShebangRoot(bundle.name, entry.name, getRoot(bundle, entry.root));
15
+ return [entry.name, toImportTarget(root.js.targetFilePath)];
16
+ });
17
+ }
18
+ export function buildExplicitBinField(bundle, surface) {
19
+ const { bins } = surface.packageInterface;
20
+ if (bins === undefined) {
21
+ return undefined;
22
+ }
23
+ return Object.fromEntries(buildEntries(bundle, bins));
24
+ }
3
25
  //# sourceMappingURL=explicit-bin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"explicit-bin.js","sourceRoot":"","sources":["../../../../source/package-surface/explicit-bin.ts"],"names":[],"mappings":"AACA,OAAgG,oBAAoB,CAAC;AACrH,OAAwB,oBAAoB,CAAC"}
1
+ {"version":3,"file":"explicit-bin.js","sourceRoot":"","sources":["../../../../source/package-surface/explicit-bin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAmE,MAAM,oBAAoB,CAAC;AACrH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAK7C,SAAS,gBAAgB,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,mBAAmB,CAAC,UAAkB,EAAE,SAAiB,EAAE,IAAyB;IACzF,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,UAAU,SAAS,uCAAuC,CAAC,CAAC;IACtG,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,YAAY,CAAC,MAAyB,EAAE,IAAgB;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,KAAK;QAC3B,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACvF,OAAO,CAAE,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,CAAE,CAAC;IAClE,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,qBAAqB,CACjC,MAAyB,EACzB,OAAwB;IAExB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAC1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1D,CAAC"}
@@ -1,4 +1,27 @@
1
- import "./package-json-export.js";
2
- import "./package-shape.js";
3
- import "./root-registry.js";
1
+ import { decorateWithPackageJsonExport } from "./package-json-export.js";
2
+ import { buildExportEntry, toImportTarget } from "./package-shape.js";
3
+ import { getRoot } from "./root-registry.js";
4
+ function buildExplicitExportEntry(bundle, entry) {
5
+ return [entry.export, buildExportEntry(getRoot(bundle, entry.root))];
6
+ }
7
+ function buildEntries(bundle, surface) {
8
+ const moduleEntries = surface.packageInterface.modules;
9
+ if (moduleEntries !== undefined) {
10
+ return moduleEntries.map(function (entry) {
11
+ return buildExplicitExportEntry(bundle, entry);
12
+ });
13
+ }
14
+ const [binEntry] = surface.packageInterface.bins ?? [];
15
+ if (binEntry === undefined) {
16
+ return [];
17
+ }
18
+ const { declarationFile } = getRoot(bundle, binEntry.root);
19
+ if (declarationFile === undefined) {
20
+ return [];
21
+ }
22
+ return [['.', { types: toImportTarget(declarationFile.targetFilePath) }]];
23
+ }
24
+ export function buildExplicitExportsField(bundle, surface) {
25
+ return decorateWithPackageJsonExport(bundle, Object.fromEntries(buildEntries(bundle, surface)));
26
+ }
4
27
  //# sourceMappingURL=explicit-exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"explicit-exports.js","sourceRoot":"","sources":["../../../../source/package-surface/explicit-exports.ts"],"names":[],"mappings":"AAAA,OAA8C,0BAA0B,CAAC;AACzE,OAMO,oBAAoB,CAAC;AAC5B,OAAwB,oBAAoB,CAAC"}
1
+ {"version":3,"file":"explicit-exports.js","sourceRoot":"","sources":["../../../../source/package-surface/explicit-exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EACH,gBAAgB,EAChB,cAAc,EAIjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI7C,SAAS,wBAAwB,CAC7B,MAA6B,EAC7B,KAA0E;IAE1E,OAAO,CAAE,KAAK,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC;AAC3E,CAAC;AAED,SAAS,YAAY,CACjB,MAA6B,EAC7B,OAAwB;IAExB,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACvD,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,aAAa,CAAC,GAAG,CAAC,UAAU,KAAK;YACpC,OAAO,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAE,QAAQ,CAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,IAAI,EAAE,CAAC;IACzD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3D,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,EAAE,CAAC;IACd,CAAC;IAED,OAAO,CAAE,CAAE,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,CAAE,CAAE,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,yBAAyB,CACrC,MAA6B,EAC7B,OAAwB;IAExB,OAAO,6BAA6B,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACpG,CAAC"}
@@ -1,3 +1,10 @@
1
- import "./explicit-exports.js";
2
- import "./implicit-exports.js";
1
+ import { buildExplicitExportsField } from "./explicit-exports.js";
2
+ import { buildImplicitExportsField } from "./implicit-exports.js";
3
+ export function buildExportsField(bundle, substitutionPublicModuleSourcePaths) {
4
+ const record = bundle.surface.mode === 'explicit'
5
+ ? buildExplicitExportsField(bundle, bundle.surface)
6
+ : buildImplicitExportsField(bundle, bundle.surface, substitutionPublicModuleSourcePaths);
7
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- the assembled record conforms to PackageJson exports
8
+ return record;
9
+ }
3
10
  //# sourceMappingURL=export-map.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"export-map.js","sourceRoot":"","sources":["../../../../source/package-surface/export-map.ts"],"names":[],"mappings":"AAAA,OAA0C,uBAAuB,CAAC;AAClE,OAA0C,uBAAuB,CAAC;AAU9D"}
1
+ {"version":3,"file":"export-map.js","sourceRoot":"","sources":["../../../../source/package-surface/export-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,MAAM,UAAU,iBAAiB,CAC7B,MAAkB,EAClB,mCAAwD;IAExD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU;QAC7C,CAAC,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;QACnD,CAAC,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,mCAAmC,CAAC,CAAC;IAC7F,+HAA+H;IAC/H,OAAO,MAAsB,CAAC;AAClC,CAAC"}
@@ -1,2 +1,26 @@
1
- import "./package-shape.js";
1
+ import { toImportTarget } from "./package-shape.js";
2
+ function isShebangContent(content) {
3
+ return content.startsWith('#!');
4
+ }
5
+ function unscopedPackageName(packageName) {
6
+ return packageName.replace(/^@[^/]+\//u, '');
7
+ }
8
+ function findExecutableShebangRoot(bundle) {
9
+ const executableShebangRoots = Object.values(bundle.roots).filter(function (root) {
10
+ return root.js.isExecutable && isShebangContent(root.js.content);
11
+ });
12
+ if (executableShebangRoots.length > 1) {
13
+ const duplicateShebangRootsMessage = `Package "${bundle.name}" has multiple executable shebang roots; ` +
14
+ 'declare packageInterface.bins explicitly';
15
+ throw new Error(duplicateShebangRootsMessage);
16
+ }
17
+ return executableShebangRoots[0];
18
+ }
19
+ export function buildImplicitBinField(bundle) {
20
+ const root = findExecutableShebangRoot(bundle);
21
+ if (root === undefined) {
22
+ return undefined;
23
+ }
24
+ return { [unscopedPackageName(bundle.name)]: toImportTarget(root.js.targetFilePath) };
25
+ }
2
26
  //# sourceMappingURL=implicit-bin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"implicit-bin.js","sourceRoot":"","sources":["../../../../source/package-surface/implicit-bin.ts"],"names":[],"mappings":"AACA,OAA0E,oBAAoB,CAAC;AAShE"}
1
+ {"version":3,"file":"implicit-bin.js","sourceRoot":"","sources":["../../../../source/package-surface/implicit-bin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA6C,MAAM,oBAAoB,CAAC;AAI/F,SAAS,gBAAgB,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,mBAAmB,CAAC,WAAmB;IAC5C,OAAO,WAAW,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,yBAAyB,CAAC,MAAyB;IACxD,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI;QAC5E,OAAO,IAAI,CAAC,EAAE,CAAC,YAAY,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,4BAA4B,GAAG,YAAY,MAAM,CAAC,IAAI,2CAA2C;YACnG,0CAA0C,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAyB;IAC3D,MAAM,IAAI,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC;AAC1F,CAAC"}
@@ -1,4 +1,11 @@
1
- import "./implicit-root-exports.js";
2
- import "./package-json-export.js";
3
- import "./substitution-exports.js";
1
+ import { buildImplicitRootExports } from "./implicit-root-exports.js";
2
+ import { decorateWithPackageJsonExport } from "./package-json-export.js";
3
+ import { collectSubstitutionExports } from "./substitution-exports.js";
4
+ export function buildImplicitExportsField(bundle, surface, substitutionPublicModuleSourcePaths) {
5
+ const merged = {
6
+ ...buildImplicitRootExports(bundle, surface),
7
+ ...collectSubstitutionExports(bundle, substitutionPublicModuleSourcePaths)
8
+ };
9
+ return decorateWithPackageJsonExport(bundle, merged);
10
+ }
4
11
  //# sourceMappingURL=implicit-exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"implicit-exports.js","sourceRoot":"","sources":["../../../../source/package-surface/implicit-exports.ts"],"names":[],"mappings":"AAAA,OAAyC,4BAA4B,CAAC;AACtE,OAA8C,0BAA0B,CAAC;AAEzE,OAA2C,2BAA2B,CAAC"}
1
+ {"version":3,"file":"implicit-exports.js","sourceRoot":"","sources":["../../../../source/package-surface/implicit-exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAIvE,MAAM,UAAU,yBAAyB,CACrC,MAA6B,EAC7B,OAAwB,EACxB,mCAAwD;IAExD,MAAM,MAAM,GAAyC;QACjD,GAAG,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC;QAC5C,GAAG,0BAA0B,CAAC,MAAM,EAAE,mCAAmC,CAAC;KAC7E,CAAC;IACF,OAAO,6BAA6B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC"}
@@ -1,3 +1,14 @@
1
- import "./package-shape.js";
2
- import "./root-registry.js";
1
+ import { buildExportEntry } from "./package-shape.js";
2
+ import { getRoot } from "./root-registry.js";
3
+ export function buildImplicitRootExports(bundle, surface) {
4
+ const rootExports = {
5
+ '.': buildExportEntry(getRoot(bundle, surface.defaultModuleRoot))
6
+ };
7
+ for (const [rootId, root] of Object.entries(bundle.roots)) {
8
+ if (rootId !== surface.defaultModuleRoot) {
9
+ rootExports[`./${root.js.targetFilePath}`] = buildExportEntry(root);
10
+ }
11
+ }
12
+ return rootExports;
13
+ }
3
14
  //# sourceMappingURL=implicit-root-exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"implicit-root-exports.js","sourceRoot":"","sources":["../../../../source/package-surface/implicit-root-exports.ts"],"names":[],"mappings":"AAAA,OAA0F,oBAAoB,CAAC;AAC/G,OAAwB,oBAAoB,CAAC"}
1
+ {"version":3,"file":"implicit-root-exports.js","sourceRoot":"","sources":["../../../../source/package-surface/implicit-root-exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA2D,MAAM,oBAAoB,CAAC;AAC/G,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI7C,MAAM,UAAU,wBAAwB,CACpC,MAA0B,EAC1B,OAAwB;IAExB,MAAM,WAAW,GAAgC;QAC7C,GAAG,EAAE,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;KACpE,CAAC;IAEF,KAAK,MAAM,CAAE,MAAM,EAAE,IAAI,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1D,IAAI,MAAM,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC;YACvC,WAAW,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACvB,CAAC"}