packtory 0.0.95 → 0.0.97

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 (673) hide show
  1. package/artifacts/artifacts-builder.d.ts +28 -0
  2. package/artifacts/artifacts-builder.d.ts.map +1 -0
  3. package/artifacts/artifacts-builder.js +37 -4
  4. package/artifacts/artifacts-builder.js.map +1 -1
  5. package/artifacts/content-collection.js +59 -2
  6. package/artifacts/content-collection.js.map +1 -1
  7. package/artifacts/folder-writer.js +25 -2
  8. package/artifacts/folder-writer.js.map +1 -1
  9. package/bundle-emitter/emitter.d.ts +8 -0
  10. package/bundle-emitter/emitter.d.ts.map +1 -1
  11. package/bundle-emitter/emitter.js +137 -6
  12. package/bundle-emitter/emitter.js.map +1 -1
  13. package/bundle-emitter/extract-package-tarball.js +13 -2
  14. package/bundle-emitter/extract-package-tarball.js.map +1 -1
  15. package/bundle-emitter/fetch-published-artifacts.d.ts +2 -0
  16. package/bundle-emitter/fetch-published-artifacts.d.ts.map +1 -1
  17. package/bundle-emitter/fetch-published-artifacts.js +19 -2
  18. package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
  19. package/bundle-emitter/publication-outcome.d.ts +3 -0
  20. package/bundle-emitter/publication-outcome.d.ts.map +1 -1
  21. package/bundle-emitter/publication-outcome.js +5 -0
  22. package/bundle-emitter/publication-outcome.js.map +1 -1
  23. package/bundle-emitter/publish-error/auto-mode-error-matching.js +28 -2
  24. package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
  25. package/bundle-emitter/publish-error/error-shape-helpers.js +9 -0
  26. package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
  27. package/bundle-emitter/publish-error/file-mode-error-matching.js +33 -2
  28. package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
  29. package/bundle-emitter/publish-error/publish-error-messages.js +24 -0
  30. package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
  31. package/bundle-emitter/registry/metadata-auth-retry.js +24 -1
  32. package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
  33. package/bundle-emitter/registry/oidc-token-exchange.js +68 -3
  34. package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
  35. package/bundle-emitter/registry/package-metadata-fetcher.d.ts +14 -0
  36. package/bundle-emitter/registry/package-metadata-fetcher.d.ts.map +1 -1
  37. package/bundle-emitter/registry/package-metadata-fetcher.js +210 -7
  38. package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
  39. package/bundle-emitter/registry/publish-settings-bridge.js +34 -3
  40. package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
  41. package/bundle-emitter/registry/registry-auth-config.d.ts +17 -0
  42. package/bundle-emitter/registry/registry-auth-config.d.ts.map +1 -0
  43. package/bundle-emitter/registry/registry-auth-config.js +106 -0
  44. package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
  45. package/bundle-emitter/registry/registry-client.d.ts +13 -1
  46. package/bundle-emitter/registry/registry-client.d.ts.map +1 -1
  47. package/bundle-emitter/registry/registry-client.js +74 -4
  48. package/bundle-emitter/registry/registry-client.js.map +1 -1
  49. package/bundle-emitter/registry/registry-package-path.js +3 -0
  50. package/bundle-emitter/registry/registry-package-path.js.map +1 -1
  51. package/bundle-emitter/registry/registry-response-schemas.js +50 -2
  52. package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
  53. package/bundle-emitter/registry/tarball-integrity.d.ts +1 -0
  54. package/bundle-emitter/registry/tarball-integrity.d.ts.map +1 -1
  55. package/bundle-emitter/registry/tarball-integrity.js +31 -1
  56. package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
  57. package/bundle-emitter/registry/validate-tarball-host.js +26 -1
  58. package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
  59. package/bundle-emitter/release-artifact-canonicalizer.js +31 -5
  60. package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
  61. package/checks/check-runner.d.ts +18 -0
  62. package/checks/check-runner.d.ts.map +1 -0
  63. package/checks/check-runner.js +8 -0
  64. package/checks/check-runner.js.map +1 -1
  65. package/checks/rule.d.ts +42 -0
  66. package/checks/rule.d.ts.map +1 -0
  67. package/checks/rule.js +12 -2
  68. package/checks/rule.js.map +1 -1
  69. package/checks/rules/duplicate-detection.js +23 -1
  70. package/checks/rules/duplicate-detection.js.map +1 -1
  71. package/checks/rules/duplicate-messages.js +22 -0
  72. package/checks/rules/duplicate-messages.js.map +1 -1
  73. package/checks/rules/file-ownership.js +15 -0
  74. package/checks/rules/file-ownership.js.map +1 -1
  75. package/checks/rules/max-bundle-size.d.ts +13 -0
  76. package/checks/rules/max-bundle-size.d.ts.map +1 -0
  77. package/checks/rules/max-bundle-size.js +55 -1
  78. package/checks/rules/max-bundle-size.js.map +1 -1
  79. package/checks/rules/no-dev-dependency-imports.d.ts +11 -0
  80. package/checks/rules/no-dev-dependency-imports.d.ts.map +1 -0
  81. package/checks/rules/no-dev-dependency-imports.js +51 -1
  82. package/checks/rules/no-dev-dependency-imports.js.map +1 -1
  83. package/checks/rules/no-duplicated-files.d.ts +11 -0
  84. package/checks/rules/no-duplicated-files.d.ts.map +1 -0
  85. package/checks/rules/no-duplicated-files.js +53 -3
  86. package/checks/rules/no-duplicated-files.js.map +1 -1
  87. package/checks/rules/no-side-effects.d.ts +15 -0
  88. package/checks/rules/no-side-effects.d.ts.map +1 -0
  89. package/checks/rules/no-side-effects.js +50 -1
  90. package/checks/rules/no-side-effects.js.map +1 -1
  91. package/checks/rules/no-unexposed-executables.d.ts +8 -0
  92. package/checks/rules/no-unexposed-executables.d.ts.map +1 -0
  93. package/checks/rules/no-unexposed-executables.js +43 -2
  94. package/checks/rules/no-unexposed-executables.js.map +1 -1
  95. package/checks/rules/no-unused-bundle-dependencies.d.ts +8 -0
  96. package/checks/rules/no-unused-bundle-dependencies.d.ts.map +1 -0
  97. package/checks/rules/no-unused-bundle-dependencies.js +30 -2
  98. package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
  99. package/checks/rules/registry.d.ts +23 -0
  100. package/checks/rules/registry.d.ts.map +1 -0
  101. package/checks/rules/registry.js +22 -9
  102. package/checks/rules/registry.js.map +1 -1
  103. package/checks/rules/required-files.d.ts +15 -0
  104. package/checks/rules/required-files.d.ts.map +1 -0
  105. package/checks/rules/required-files.js +41 -3
  106. package/checks/rules/required-files.js.map +1 -1
  107. package/checks/rules/type-script-declaration-integrity.d.ts +9 -0
  108. package/checks/rules/type-script-declaration-integrity.d.ts.map +1 -0
  109. package/checks/rules/type-script-declaration-integrity.js +81 -3
  110. package/checks/rules/type-script-declaration-integrity.js.map +1 -1
  111. package/checks/rules/type-script-declaration-paths.js +55 -1
  112. package/checks/rules/type-script-declaration-paths.js.map +1 -1
  113. package/checks/rules/type-script-declaration-project.d.ts +29 -0
  114. package/checks/rules/type-script-declaration-project.d.ts.map +1 -0
  115. package/checks/rules/type-script-declaration-project.js +202 -3
  116. package/checks/rules/type-script-declaration-project.js.map +1 -1
  117. package/checks/rules/type-script-declaration-reachability.js +38 -2
  118. package/checks/rules/type-script-declaration-reachability.js.map +1 -1
  119. package/checks/rules/type-script-declaration-roots.js +29 -0
  120. package/checks/rules/type-script-declaration-roots.js.map +1 -1
  121. package/checks/rules/type-script-integrity.d.ts +24 -0
  122. package/checks/rules/type-script-integrity.d.ts.map +1 -0
  123. package/checks/rules/type-script-integrity.js +72 -2
  124. package/checks/rules/type-script-integrity.js.map +1 -1
  125. package/checks/rules/type-script-package-resolution.d.ts +29 -0
  126. package/checks/rules/type-script-package-resolution.d.ts.map +1 -0
  127. package/checks/rules/type-script-package-resolution.js +42 -1
  128. package/checks/rules/type-script-package-resolution.js.map +1 -1
  129. package/checks/rules/type-script-resolution-summary.js +53 -0
  130. package/checks/rules/type-script-resolution-summary.js.map +1 -1
  131. package/checks/rules/unique-target-paths.d.ts +8 -0
  132. package/checks/rules/unique-target-paths.d.ts.map +1 -0
  133. package/checks/rules/unique-target-paths.js +34 -2
  134. package/checks/rules/unique-target-paths.js.map +1 -1
  135. package/common/bundled-dependency-groups.js +27 -0
  136. package/common/bundled-dependency-groups.js.map +1 -1
  137. package/common/code-files.js +28 -0
  138. package/common/code-files.js.map +1 -1
  139. package/common/declaration-companion-paths.js +24 -0
  140. package/common/declaration-companion-paths.js.map +1 -1
  141. package/common/package-name-map.js +7 -0
  142. package/common/package-name-map.js.map +1 -1
  143. package/common/stable-json.js +42 -2
  144. package/common/stable-json.js.map +1 -1
  145. package/common/worklist.js +22 -0
  146. package/common/worklist.js.map +1 -1
  147. package/config/additional-files.d.ts +1 -1
  148. package/config/additional-files.js +6 -2
  149. package/config/additional-files.js.map +1 -1
  150. package/config/additional-package-json-attributes-schema.js +6 -2
  151. package/config/additional-package-json-attributes-schema.js.map +1 -1
  152. package/config/automatic-versioning-settings.js +6 -2
  153. package/config/automatic-versioning-settings.js.map +1 -1
  154. package/config/changelog-settings.d.ts +44 -0
  155. package/config/changelog-settings.d.ts.map +1 -1
  156. package/config/changelog-settings.js +120 -3
  157. package/config/changelog-settings.js.map +1 -1
  158. package/config/common-package-settings-schemas.js +19 -3
  159. package/config/common-package-settings-schemas.js.map +1 -1
  160. package/config/config.d.ts +6 -1
  161. package/config/config.d.ts.map +1 -1
  162. package/config/config.js +3 -1
  163. package/config/config.js.map +1 -1
  164. package/config/cross-package-validation.js +17 -0
  165. package/config/cross-package-validation.js.map +1 -1
  166. package/config/dead-code-elimination-settings.d.ts +1 -0
  167. package/config/dead-code-elimination-settings.d.ts.map +1 -1
  168. package/config/dead-code-elimination-settings.js +36 -2
  169. package/config/dead-code-elimination-settings.js.map +1 -1
  170. package/config/dependency-existence-validation.js +19 -1
  171. package/config/dependency-existence-validation.js.map +1 -1
  172. package/config/dependency-policy.js +5 -2
  173. package/config/dependency-policy.js.map +1 -1
  174. package/config/main-package-json-schema.js +13 -2
  175. package/config/main-package-json-schema.js.map +1 -1
  176. package/config/manual-versioning-settings.d.ts +12 -0
  177. package/config/manual-versioning-settings.d.ts.map +1 -1
  178. package/config/manual-versioning-settings.js +29 -2
  179. package/config/manual-versioning-settings.js.map +1 -1
  180. package/config/optional-package-settings-schema.js +16 -7
  181. package/config/optional-package-settings-schema.js.map +1 -1
  182. package/config/package-config.d.ts +4 -0
  183. package/config/package-config.d.ts.map +1 -1
  184. package/config/package-config.js +2 -1
  185. package/config/package-config.js.map +1 -1
  186. package/config/package-graph-builder.js +14 -2
  187. package/config/package-graph-builder.js.map +1 -1
  188. package/config/package-interface.js +25 -2
  189. package/config/package-interface.js.map +1 -1
  190. package/config/package-json.d.ts +2 -0
  191. package/config/package-json.d.ts.map +1 -1
  192. package/config/package-json.js +16 -0
  193. package/config/package-json.js.map +1 -1
  194. package/config/packtory-config-schema.d.ts +12 -12
  195. package/config/packtory-config-without-registry-schema.js +6 -0
  196. package/config/packtory-config-without-registry-schema.js.map +1 -1
  197. package/config/per-package-settings-schema.js +22 -6
  198. package/config/per-package-settings-schema.js.map +1 -1
  199. package/config/pre-graph-validation.js +20 -5
  200. package/config/pre-graph-validation.js.map +1 -1
  201. package/config/publish-settings.d.ts +3 -0
  202. package/config/publish-settings.d.ts.map +1 -1
  203. package/config/publish-settings.js +25 -3
  204. package/config/publish-settings.js.map +1 -1
  205. package/config/publish-settings.report.js +17 -1
  206. package/config/publish-settings.report.js.map +1 -1
  207. package/config/registry-settings.d.ts +41 -0
  208. package/config/registry-settings.d.ts.map +1 -1
  209. package/config/registry-settings.js +40 -2
  210. package/config/registry-settings.js.map +1 -1
  211. package/config/registry-settings.report.js +46 -0
  212. package/config/registry-settings.report.js.map +1 -1
  213. package/config/root-config-validation.js +141 -0
  214. package/config/root-config-validation.js.map +1 -1
  215. package/config/root.js +6 -2
  216. package/config/root.js.map +1 -1
  217. package/config/sbom-settings.js +4 -1
  218. package/config/sbom-settings.js.map +1 -1
  219. package/config/settings-validation.js +28 -0
  220. package/config/settings-validation.js.map +1 -1
  221. package/config/validation.d.ts.map +1 -1
  222. package/config/validation.js +35 -1
  223. package/config/validation.js.map +1 -1
  224. package/config/versioning-settings.d.ts +18 -1
  225. package/config/versioning-settings.d.ts.map +1 -1
  226. package/config/versioning-settings.js +10 -3
  227. package/config/versioning-settings.js.map +1 -1
  228. package/dead-code-eliminator/analyzed-bundle.d.ts +11 -0
  229. package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
  230. package/dead-code-eliminator/analyzed-bundle.js +7 -0
  231. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  232. package/dead-code-eliminator/bundle-analysis.js +38 -5
  233. package/dead-code-eliminator/bundle-analysis.js.map +1 -1
  234. package/dead-code-eliminator/class-purity.js +48 -2
  235. package/dead-code-eliminator/class-purity.js.map +1 -1
  236. package/dead-code-eliminator/code-file-analyzer.js +68 -4
  237. package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
  238. package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -1
  239. package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
  240. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
  241. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
  242. package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -4
  243. package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
  244. package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
  245. package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
  246. package/dead-code-eliminator/dependency-metadata.js +172 -3
  247. package/dead-code-eliminator/dependency-metadata.js.map +1 -1
  248. package/dead-code-eliminator/elimination-emitter.js +52 -0
  249. package/dead-code-eliminator/elimination-emitter.js.map +1 -1
  250. package/dead-code-eliminator/eliminator.js +22 -4
  251. package/dead-code-eliminator/eliminator.js.map +1 -1
  252. package/dead-code-eliminator/expression-unwrapping.js +16 -1
  253. package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
  254. package/dead-code-eliminator/imported-expression-origin.js +101 -2
  255. package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
  256. package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
  257. package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
  258. package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
  259. package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
  260. package/dead-code-eliminator/liveness/external-module-resolution.js +172 -2
  261. package/dead-code-eliminator/liveness/external-module-resolution.js.map +1 -1
  262. package/dead-code-eliminator/liveness/external-purity-summary.js +294 -3
  263. package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
  264. package/dead-code-eliminator/liveness/external-purity.js +39 -3
  265. package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
  266. package/dead-code-eliminator/liveness/module-analysis.js +27 -2
  267. package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
  268. package/dead-code-eliminator/liveness/resource-retention.js +91 -1
  269. package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
  270. package/dead-code-eliminator/liveness/runtime-code.js +15 -1
  271. package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
  272. package/dead-code-eliminator/load-bundle.js +86 -5
  273. package/dead-code-eliminator/load-bundle.js.map +1 -1
  274. package/dead-code-eliminator/pure-expression.js +178 -5
  275. package/dead-code-eliminator/pure-expression.js.map +1 -1
  276. package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
  277. package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
  278. package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
  279. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  280. package/dead-code-eliminator/reachability/binding-id.js +106 -1
  281. package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
  282. package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -2
  283. package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
  284. package/dead-code-eliminator/reachability/impure-statements.js +11 -2
  285. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  286. package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
  287. package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
  288. package/dead-code-eliminator/reachability/reachability.js +65 -4
  289. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  290. package/dead-code-eliminator/side-effect-classifier.js +39 -4
  291. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  292. package/dead-code-eliminator/side-effects-field.js +23 -1
  293. package/dead-code-eliminator/side-effects-field.js.map +1 -1
  294. package/dead-code-eliminator/source-map-recomposition.js +29 -2
  295. package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
  296. package/dead-code-eliminator/statement-classifiers.js +94 -4
  297. package/dead-code-eliminator/statement-classifiers.js.map +1 -1
  298. package/dead-code-eliminator/syntax-kind-sets.js +16 -0
  299. package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
  300. package/dead-code-eliminator/transform/atom-translator.d.ts +8 -0
  301. package/dead-code-eliminator/transform/atom-translator.d.ts.map +1 -1
  302. package/dead-code-eliminator/transform/atom-translator.js +57 -2
  303. package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
  304. package/dead-code-eliminator/transform/declaration-removal.js +183 -5
  305. package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
  306. package/dead-code-eliminator/transform/declaration-remover.js +17 -2
  307. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  308. package/dead-code-eliminator/transform/line-index.d.ts +7 -0
  309. package/dead-code-eliminator/transform/line-index.d.ts.map +1 -1
  310. package/dead-code-eliminator/transform/line-index.js +20 -0
  311. package/dead-code-eliminator/transform/line-index.js.map +1 -1
  312. package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
  313. package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
  314. package/dead-code-eliminator/transform/source-map-composer.js +84 -3
  315. package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
  316. package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
  317. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
  318. package/dependency-scanner/dependency-graph.d.ts +41 -0
  319. package/dependency-scanner/dependency-graph.d.ts.map +1 -0
  320. package/dependency-scanner/dependency-graph.js +77 -3
  321. package/dependency-scanner/dependency-graph.js.map +1 -1
  322. package/dependency-scanner/external-dependencies.d.ts +10 -1
  323. package/dependency-scanner/external-dependencies.d.ts.map +1 -1
  324. package/dependency-scanner/external-dependencies.js +55 -1
  325. package/dependency-scanner/external-dependencies.js.map +1 -1
  326. package/dependency-scanner/file-host-predicates.js +9 -0
  327. package/dependency-scanner/file-host-predicates.js.map +1 -1
  328. package/dependency-scanner/host-method-binding.js +18 -0
  329. package/dependency-scanner/host-method-binding.js.map +1 -1
  330. package/dependency-scanner/injected-dynamic-imports.js +232 -1
  331. package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
  332. package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
  333. package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
  334. package/dependency-scanner/package-owned-asset-file-path.js +9 -1
  335. package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
  336. package/dependency-scanner/scanner.d.ts +20 -0
  337. package/dependency-scanner/scanner.d.ts.map +1 -0
  338. package/dependency-scanner/scanner.js +109 -4
  339. package/dependency-scanner/scanner.js.map +1 -1
  340. package/dependency-scanner/source-file-references.d.ts +37 -0
  341. package/dependency-scanner/source-file-references.d.ts.map +1 -0
  342. package/dependency-scanner/source-file-references.js +181 -6
  343. package/dependency-scanner/source-file-references.js.map +1 -1
  344. package/dependency-scanner/source-map-file-locator.d.ts +10 -0
  345. package/dependency-scanner/source-map-file-locator.d.ts.map +1 -0
  346. package/dependency-scanner/source-map-file-locator.js +66 -2
  347. package/dependency-scanner/source-map-file-locator.js.map +1 -1
  348. package/dependency-scanner/typescript-compiler-options.d.ts +8 -0
  349. package/dependency-scanner/typescript-compiler-options.d.ts.map +1 -0
  350. package/dependency-scanner/typescript-compiler-options.js +21 -1
  351. package/dependency-scanner/typescript-compiler-options.js.map +1 -1
  352. package/dependency-scanner/typescript-file-host.d.ts +12 -0
  353. package/dependency-scanner/typescript-file-host.d.ts.map +1 -0
  354. package/dependency-scanner/typescript-file-host.js +49 -5
  355. package/dependency-scanner/typescript-file-host.js.map +1 -1
  356. package/dependency-scanner/typescript-project-analyzer.d.ts +19 -0
  357. package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -0
  358. package/dependency-scanner/typescript-project-analyzer.js +35 -3
  359. package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
  360. package/dependency-scanner/virtual-package-json-host.js +45 -4
  361. package/dependency-scanner/virtual-package-json-host.js.map +1 -1
  362. package/directed-graph/graph.d.ts +1 -0
  363. package/directed-graph/graph.d.ts.map +1 -1
  364. package/directed-graph/graph.js +240 -1
  365. package/directed-graph/graph.js.map +1 -1
  366. package/file-manager/compare.js +23 -2
  367. package/file-manager/compare.js.map +1 -1
  368. package/file-manager/equal.js +5 -0
  369. package/file-manager/equal.js.map +1 -1
  370. package/file-manager/file-description.d.ts +2 -1
  371. package/file-manager/file-description.d.ts.map +1 -1
  372. package/file-manager/file-description.js +3 -0
  373. package/file-manager/file-description.js.map +1 -1
  374. package/file-manager/file-manager.d.ts +1 -1
  375. package/file-manager/file-manager.d.ts.map +1 -1
  376. package/file-manager/file-manager.js +4 -4
  377. package/file-manager/file-manager.js.map +1 -1
  378. package/file-manager/permissions.js +28 -1
  379. package/file-manager/permissions.js.map +1 -1
  380. package/git/current-git-head.d.ts +12 -0
  381. package/git/current-git-head.d.ts.map +1 -0
  382. package/git/current-git-head.js +24 -0
  383. package/git/current-git-head.js.map +1 -1
  384. package/git/git-command.js +49 -1
  385. package/git/git-command.js.map +1 -1
  386. package/linker/linked-bundle.d.ts +19 -2
  387. package/linker/linked-bundle.d.ts.map +1 -1
  388. package/linker/linked-bundle.js +5 -0
  389. package/linker/linked-bundle.js.map +1 -1
  390. package/linker/linker.d.ts +13 -0
  391. package/linker/linker.d.ts.map +1 -0
  392. package/linker/linker.js +51 -5
  393. package/linker/linker.js.map +1 -1
  394. package/linker/replacement-lookup.js +297 -8
  395. package/linker/replacement-lookup.js.map +1 -1
  396. package/linker/resource-graph.js +65 -2
  397. package/linker/resource-graph.js.map +1 -1
  398. package/linker/source-modifier/import-paths.js +76 -3
  399. package/linker/source-modifier/import-paths.js.map +1 -1
  400. package/linker/substitute-bundles.js +166 -3
  401. package/linker/substitute-bundles.js.map +1 -1
  402. package/linker/substituted-resource-graph.js +111 -2
  403. package/linker/substituted-resource-graph.js.map +1 -1
  404. package/npm-oidc-id-token-resolver.js +82 -0
  405. package/npm-oidc-id-token-resolver.js.map +1 -1
  406. package/pack-emitter/pack-emitter.d.ts +20 -0
  407. package/pack-emitter/pack-emitter.d.ts.map +1 -1
  408. package/pack-emitter/pack-emitter.js +27 -0
  409. package/pack-emitter/pack-emitter.js.map +1 -1
  410. package/package-surface/bin-field.js +8 -2
  411. package/package-surface/bin-field.js.map +1 -1
  412. package/package-surface/explicit-bin.js +24 -2
  413. package/package-surface/explicit-bin.js.map +1 -1
  414. package/package-surface/explicit-exports.js +26 -3
  415. package/package-surface/explicit-exports.js.map +1 -1
  416. package/package-surface/export-map.js +9 -2
  417. package/package-surface/export-map.js.map +1 -1
  418. package/package-surface/implicit-bin.js +25 -1
  419. package/package-surface/implicit-bin.js.map +1 -1
  420. package/package-surface/implicit-exports.js +10 -3
  421. package/package-surface/implicit-exports.js.map +1 -1
  422. package/package-surface/implicit-root-exports.js +13 -2
  423. package/package-surface/implicit-root-exports.js.map +1 -1
  424. package/package-surface/package-json-export.js +9 -0
  425. package/package-surface/package-json-export.js.map +1 -1
  426. package/package-surface/package-shape.js +10 -1
  427. package/package-surface/package-shape.js.map +1 -1
  428. package/package-surface/package-surface-index.js +165 -3
  429. package/package-surface/package-surface-index.js.map +1 -1
  430. package/package-surface/public-module-usage.js +46 -3
  431. package/package-surface/public-module-usage.js.map +1 -1
  432. package/package-surface/public-specifiers.js +7 -1
  433. package/package-surface/public-specifiers.js.map +1 -1
  434. package/package-surface/root-registry.js +26 -0
  435. package/package-surface/root-registry.js.map +1 -1
  436. package/package-surface/specifier-syntax.js +4 -0
  437. package/package-surface/specifier-syntax.js.map +1 -1
  438. package/package-surface/substitution-exports.js +101 -3
  439. package/package-surface/substitution-exports.js.map +1 -1
  440. package/package-surface/surface.d.ts +2 -0
  441. package/package-surface/surface.d.ts.map +1 -1
  442. package/package-surface/surface.js +12 -0
  443. package/package-surface/surface.js.map +1 -1
  444. package/package.json +1 -1
  445. package/packages/package-processor.composition.d.ts +22 -0
  446. package/packages/package-processor.composition.d.ts.map +1 -1
  447. package/packages/package-processor.composition.js +161 -34
  448. package/packages/package-processor.composition.js.map +1 -1
  449. package/packtory/changelog-source-attribution.js +16 -16
  450. package/packtory/changelog-source-attribution.js.map +1 -1
  451. package/packtory/map-config.d.ts +11 -1
  452. package/packtory/map-config.d.ts.map +1 -1
  453. package/packtory/map-config.js +35 -4
  454. package/packtory/map-config.js.map +1 -1
  455. package/packtory/normalize-paths.js +25 -1
  456. package/packtory/normalize-paths.js.map +1 -1
  457. package/packtory/options/bundle-dependency-resolution.js +17 -1
  458. package/packtory/options/bundle-dependency-resolution.js.map +1 -1
  459. package/packtory/options/dead-code-elimination-resolution.js +10 -1
  460. package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
  461. package/packtory/options/prepare-package-options.d.ts +13 -1
  462. package/packtory/options/prepare-package-options.d.ts.map +1 -1
  463. package/packtory/options/prepare-package-options.js +46 -5
  464. package/packtory/options/prepare-package-options.js.map +1 -1
  465. package/packtory/options/required-value-helpers.js +17 -0
  466. package/packtory/options/required-value-helpers.js.map +1 -1
  467. package/packtory/options/setting-resolvers.d.ts +17 -1
  468. package/packtory/options/setting-resolvers.d.ts.map +1 -1
  469. package/packtory/options/setting-resolvers.js +47 -3
  470. package/packtory/options/setting-resolvers.js.map +1 -1
  471. package/packtory/options/surface-resolution.js +15 -2
  472. package/packtory/options/surface-resolution.js.map +1 -1
  473. package/packtory/options/version-provider-context.js +24 -2
  474. package/packtory/options/version-provider-context.js.map +1 -1
  475. package/packtory/options/version-trigger.js +39 -2
  476. package/packtory/options/version-trigger.js.map +1 -1
  477. package/packtory/pack-output-preflight.js +60 -3
  478. package/packtory/pack-output-preflight.js.map +1 -1
  479. package/packtory/package-processor-build.js +97 -3
  480. package/packtory/package-processor-build.js.map +1 -1
  481. package/packtory/package-processor-publish-result.d.ts +3 -0
  482. package/packtory/package-processor-publish-result.d.ts.map +1 -1
  483. package/packtory/package-processor-publish.d.ts +2 -0
  484. package/packtory/package-processor-publish.d.ts.map +1 -1
  485. package/packtory/package-processor-publish.js +297 -6
  486. package/packtory/package-processor-publish.js.map +1 -1
  487. package/packtory/package-processor.d.ts +34 -0
  488. package/packtory/package-processor.d.ts.map +1 -1
  489. package/packtory/package-processor.js +10 -2
  490. package/packtory/package-processor.js.map +1 -1
  491. package/packtory/packtory-pack.js +298 -10
  492. package/packtory/packtory-pack.js.map +1 -1
  493. package/packtory/packtory-package-dependencies.js +116 -3
  494. package/packtory/packtory-package-dependencies.js.map +1 -1
  495. package/packtory/packtory-package-inspection.js +26 -5
  496. package/packtory/packtory-package-inspection.js.map +1 -1
  497. package/packtory/packtory-package-side-effects.js +64 -3
  498. package/packtory/packtory-package-side-effects.js.map +1 -1
  499. package/packtory/packtory-package-tree.js +43 -4
  500. package/packtory/packtory-package-tree.js.map +1 -1
  501. package/packtory/packtory-publish.js +17 -4
  502. package/packtory/packtory-publish.js.map +1 -1
  503. package/packtory/packtory-release-analysis.js +64 -6
  504. package/packtory/packtory-release-analysis.js.map +1 -1
  505. package/packtory/packtory-release-diff.js +48 -5
  506. package/packtory/packtory-release-diff.js.map +1 -1
  507. package/packtory/packtory-release-plan.js +87 -6
  508. package/packtory/packtory-release-plan.js.map +1 -1
  509. package/packtory/packtory-resolve.js +16 -5
  510. package/packtory/packtory-resolve.js.map +1 -1
  511. package/packtory/packtory.d.ts +28 -1
  512. package/packtory/packtory.d.ts.map +1 -1
  513. package/packtory/packtory.js +242 -13
  514. package/packtory/packtory.js.map +1 -1
  515. package/packtory/publish-failure-mapping.js +6 -0
  516. package/packtory/publish-failure-mapping.js.map +1 -1
  517. package/packtory/publish-target-preflight.js +25 -3
  518. package/packtory/publish-target-preflight.js.map +1 -1
  519. package/packtory/published-release-state.d.ts +19 -0
  520. package/packtory/published-release-state.d.ts.map +1 -1
  521. package/packtory/published-release-state.js +11 -0
  522. package/packtory/published-release-state.js.map +1 -1
  523. package/packtory/release-analysis.js +153 -5
  524. package/packtory/release-analysis.js.map +1 -1
  525. package/packtory/release-diff-failure-mapping.js +6 -0
  526. package/packtory/release-diff-failure-mapping.js.map +1 -1
  527. package/packtory/release-plan.js +135 -7
  528. package/packtory/release-plan.js.map +1 -1
  529. package/packtory/report-attachment.js +35 -2
  530. package/packtory/report-attachment.js.map +1 -1
  531. package/packtory/resolved-package.d.ts +11 -0
  532. package/packtory/resolved-package.d.ts.map +1 -1
  533. package/packtory/resolved-package.js +97 -3
  534. package/packtory/resolved-package.js.map +1 -1
  535. package/packtory/scheduler.d.ts +47 -0
  536. package/packtory/scheduler.d.ts.map +1 -1
  537. package/packtory/scheduler.js +99 -1
  538. package/packtory/scheduler.js.map +1 -1
  539. package/packtory/stages/package-analysis-stage.js +50 -2
  540. package/packtory/stages/package-analysis-stage.js.map +1 -1
  541. package/packtory/stages/package-resolution-stage.js +80 -5
  542. package/packtory/stages/package-resolution-stage.js.map +1 -1
  543. package/packtory/stages/publish-stage.js +125 -4
  544. package/packtory/stages/publish-stage.js.map +1 -1
  545. package/packtory/stages/release-diff-stage.js +84 -5
  546. package/packtory/stages/release-diff-stage.js.map +1 -1
  547. package/progress/progress-broadcaster.d.ts +1 -0
  548. package/progress/progress-broadcaster.d.ts.map +1 -1
  549. package/progress/progress-broadcaster.js +45 -0
  550. package/progress/progress-broadcaster.js.map +1 -1
  551. package/published-package/published-package.d.ts +2 -0
  552. package/published-package/published-package.d.ts.map +1 -1
  553. package/published-package/published-package.js +12 -1
  554. package/published-package/published-package.js.map +1 -1
  555. package/report/aggregator/artifact-entry-merger.js +20 -0
  556. package/report/aggregator/artifact-entry-merger.js.map +1 -1
  557. package/report/aggregator/package-report-materialization.js +75 -2
  558. package/report/aggregator/package-report-materialization.js.map +1 -1
  559. package/report/aggregator/report-aggregator.js +37 -2
  560. package/report/aggregator/report-aggregator.js.map +1 -1
  561. package/report/aggregator/report-event-handlers.js +141 -2
  562. package/report/aggregator/report-event-handlers.js.map +1 -1
  563. package/report/aggregator/report-types.d.ts +21 -0
  564. package/report/aggregator/report-types.d.ts.map +1 -1
  565. package/report/aggregator/report-types.js +3 -0
  566. package/report/aggregator/report-types.js.map +1 -1
  567. package/report/config-redactor.js +29 -3
  568. package/report/config-redactor.js.map +1 -1
  569. package/report/decorators.js +85 -0
  570. package/report/decorators.js.map +1 -1
  571. package/report/inspectors/inspect-artifact-sizes.js +34 -1
  572. package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
  573. package/report/inspectors/inspect-linker-rewrites.js +14 -1
  574. package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
  575. package/report/inspectors/inspect-package-json-provenance.js +15 -0
  576. package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
  577. package/report/inspectors/inspect-scan-results.js +15 -0
  578. package/report/inspectors/inspect-scan-results.js.map +1 -1
  579. package/report/release-diff/release-version-transition.js +18 -0
  580. package/report/release-diff/release-version-transition.js.map +1 -1
  581. package/resource-resolver/bundle-resource-lookup.js +25 -0
  582. package/resource-resolver/bundle-resource-lookup.js.map +1 -1
  583. package/resource-resolver/content.js +136 -3
  584. package/resource-resolver/content.js.map +1 -1
  585. package/resource-resolver/dependency-resolution-walker.js +73 -2
  586. package/resource-resolver/dependency-resolution-walker.js.map +1 -1
  587. package/resource-resolver/resolved-bundle.d.ts +54 -0
  588. package/resource-resolver/resolved-bundle.d.ts.map +1 -1
  589. package/resource-resolver/resolved-bundle.js +3 -0
  590. package/resource-resolver/resolved-bundle.js.map +1 -1
  591. package/resource-resolver/resource-resolve-options.d.ts +5 -0
  592. package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
  593. package/resource-resolver/resource-resolve-options.js +13 -1
  594. package/resource-resolver/resource-resolve-options.js.map +1 -1
  595. package/resource-resolver/resource-resolver.d.ts +15 -0
  596. package/resource-resolver/resource-resolver.d.ts.map +1 -0
  597. package/resource-resolver/resource-resolver.js +128 -5
  598. package/resource-resolver/resource-resolver.js.map +1 -1
  599. package/sbom/extract-license.js +11 -1
  600. package/sbom/extract-license.js.map +1 -1
  601. package/sbom/license-resolver.d.ts +14 -0
  602. package/sbom/license-resolver.d.ts.map +1 -0
  603. package/sbom/license-resolver.js +23 -2
  604. package/sbom/license-resolver.js.map +1 -1
  605. package/sbom/sbom-builder.js +57 -2
  606. package/sbom/sbom-builder.js.map +1 -1
  607. package/sbom/sbom-canonicalizer.js +45 -3
  608. package/sbom/sbom-canonicalizer.js.map +1 -1
  609. package/sbom/sbom-file.d.ts +10 -0
  610. package/sbom/sbom-file.d.ts.map +1 -1
  611. package/sbom/sbom-file.js +54 -5
  612. package/sbom/sbom-file.js.map +1 -1
  613. package/sbom/sbom-serializer.d.ts +8 -0
  614. package/sbom/sbom-serializer.d.ts.map +1 -0
  615. package/sbom/sbom-serializer.js +14 -1
  616. package/sbom/sbom-serializer.js.map +1 -1
  617. package/sbom/tool-version.js +49 -1
  618. package/sbom/tool-version.js.map +1 -1
  619. package/sbom.cdx.json +5 -5
  620. package/tar/extract-tar.js +83 -3
  621. package/tar/extract-tar.js.map +1 -1
  622. package/tar/gzipped-pack.js +20 -0
  623. package/tar/gzipped-pack.js.map +1 -1
  624. package/tar/tarball-builder.d.ts +14 -0
  625. package/tar/tarball-builder.d.ts.map +1 -0
  626. package/tar/tarball-builder.js +44 -4
  627. package/tar/tarball-builder.js.map +1 -1
  628. package/vendor-materializer/vendor-entry.d.ts +12 -0
  629. package/vendor-materializer/vendor-entry.d.ts.map +1 -0
  630. package/vendor-materializer/vendor-entry.js +20 -1
  631. package/vendor-materializer/vendor-entry.js.map +1 -1
  632. package/vendor-materializer/vendor-materializer.d.ts +55 -0
  633. package/vendor-materializer/vendor-materializer.d.ts.map +1 -0
  634. package/vendor-materializer/vendor-materializer.js +240 -8
  635. package/vendor-materializer/vendor-materializer.js.map +1 -1
  636. package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
  637. package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
  638. package/version-manager/dependencies/dependency-groups.js +11 -1
  639. package/version-manager/dependencies/dependency-groups.js.map +1 -1
  640. package/version-manager/dependencies/external-dependency-classification.js +82 -3
  641. package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
  642. package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
  643. package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
  644. package/version-manager/imports/hash-import-scanner.js +20 -2
  645. package/version-manager/imports/hash-import-scanner.js.map +1 -1
  646. package/version-manager/imports/imports-key-matcher.js +22 -0
  647. package/version-manager/imports/imports-key-matcher.js.map +1 -1
  648. package/version-manager/imports/versioned-bundle-imports.js +44 -2
  649. package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
  650. package/version-manager/manager.d.ts +5 -0
  651. package/version-manager/manager.d.ts.map +1 -1
  652. package/version-manager/manager.js +46 -6
  653. package/version-manager/manager.js.map +1 -1
  654. package/version-manager/manifest/builder.js +51 -1
  655. package/version-manager/manifest/builder.js.map +1 -1
  656. package/version-manager/manifest/serialize.js +8 -1
  657. package/version-manager/manifest/serialize.js.map +1 -1
  658. package/version-manager/optional-bundle-fields.js +5 -1
  659. package/version-manager/optional-bundle-fields.js.map +1 -1
  660. package/version-manager/representative-root.js +9 -1
  661. package/version-manager/representative-root.js.map +1 -1
  662. package/version-manager/specifier-classifier.js +42 -2
  663. package/version-manager/specifier-classifier.js.map +1 -1
  664. package/version-manager/specifier-errors.js +58 -0
  665. package/version-manager/specifier-errors.js.map +1 -1
  666. package/version-manager/versioned-bundle.d.ts +3 -1
  667. package/version-manager/versioned-bundle.d.ts.map +1 -1
  668. package/version-manager/versioned-bundle.js +31 -6
  669. package/version-manager/versioned-bundle.js.map +1 -1
  670. package/zip/zip-builder.d.ts +22 -0
  671. package/zip/zip-builder.d.ts.map +1 -0
  672. package/zip/zip-builder.js +81 -2
  673. package/zip/zip-builder.js.map +1 -1
@@ -1,4 +1,77 @@
1
- import "../../dead-code-eliminator/transform/line-index.js";
2
- import "../../dependency-scanner/source-file-references.js";
3
- import "../../dependency-scanner/typescript-project-analyzer.js";
1
+ import { buildLineIndex } from "../../dead-code-eliminator/transform/line-index.js";
2
+ import { getModuleReferenceLiterals, resolveSourceFileForLiteral } from "../../dependency-scanner/source-file-references.js";
3
+ import { getSourcePathFromSourceFile } from "../../dependency-scanner/typescript-project-analyzer.js";
4
+ function collectImportPathEdits(sourceFile, replacements) {
5
+ const edits = [];
6
+ const literals = getModuleReferenceLiterals(sourceFile);
7
+ for (const literal of literals) {
8
+ const resolvedSourceFile = resolveSourceFileForLiteral(literal, sourceFile);
9
+ if (resolvedSourceFile !== undefined) {
10
+ const replacement = replacements.get(getSourcePathFromSourceFile(resolvedSourceFile));
11
+ if (replacement !== undefined) {
12
+ edits.push({
13
+ start: literal.getStart() + 1,
14
+ end: literal.getEnd() - 1,
15
+ reference: {
16
+ name: replacement.packageName,
17
+ sourceSpecifier: literal.getLiteralValue(),
18
+ emittedSpecifier: replacement.emittedSpecifier
19
+ }
20
+ });
21
+ }
22
+ }
23
+ }
24
+ return edits.toSorted(function (left, right) {
25
+ return left.start - right.start;
26
+ });
27
+ }
28
+ function applyEdits(sourceContent, edits) {
29
+ let content = '';
30
+ let originalOffset = 0;
31
+ const atoms = [];
32
+ function appendEdit(edit) {
33
+ const newStart = content.length;
34
+ content += sourceContent.slice(originalOffset, edit.start) + edit.reference.emittedSpecifier;
35
+ atoms.push({ originalStart: originalOffset, originalEnd: edit.start, newStart });
36
+ originalOffset = edit.end;
37
+ }
38
+ function appendTail() {
39
+ const tailStart = content.length;
40
+ content += sourceContent.slice(originalOffset);
41
+ atoms.push({
42
+ originalStart: originalOffset,
43
+ originalEnd: sourceContent.length,
44
+ newStart: tailStart
45
+ });
46
+ }
47
+ for (const edit of edits) {
48
+ appendEdit(edit);
49
+ }
50
+ appendTail();
51
+ return {
52
+ content,
53
+ dependencyReferences: edits.map(function (edit) {
54
+ return edit.reference;
55
+ }),
56
+ sourceMapTransform: {
57
+ originalLineIndex: buildLineIndex(sourceContent),
58
+ transformedLineIndex: buildLineIndex(content),
59
+ atoms
60
+ }
61
+ };
62
+ }
63
+ export function replaceImportPathsWithTransform(project, inputFilePath, sourceContent, replacements) {
64
+ if (project === undefined) {
65
+ return { content: sourceContent, dependencyReferences: [], sourceMapTransform: undefined };
66
+ }
67
+ const sourceFile = project.getSourceFile(inputFilePath);
68
+ if (sourceFile === undefined) {
69
+ return { content: sourceContent, dependencyReferences: [], sourceMapTransform: undefined };
70
+ }
71
+ const edits = collectImportPathEdits(sourceFile, replacements);
72
+ if (edits.length === 0) {
73
+ return { content: sourceContent, dependencyReferences: [], sourceMapTransform: undefined };
74
+ }
75
+ return applyEdits(sourceContent, edits);
76
+ }
4
77
  //# sourceMappingURL=import-paths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"import-paths.js","sourceRoot":"","sources":["../../../../../source/linker/source-modifier/import-paths.ts"],"names":[],"mappings":"AACA,OAA+B,oDAAoD,CAAC;AAEpF,OAGO,oDAAoD,CAAC;AAC5D,OAA4C,yDAAyD,CAAC"}
1
+ {"version":3,"file":"import-paths.js","sourceRoot":"","sources":["../../../../../source/linker/source-modifier/import-paths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAEpF,OAAO,EACH,0BAA0B,EAC1B,2BAA2B,EAC9B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AAuBtG,SAAS,sBAAsB,CAAC,UAAsB,EAAE,YAA0B;IAC9E,MAAM,KA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AAa,EAAE,oBAAoB,EAAE,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC;IAC/F,CAAC;IACD,MAAM,KAAK,GAAG,sBAAsB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC;IAC/F,CAAC;IACD,OAAO,UAAU,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC"}
@@ -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":"AAEA,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,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,2BAA2B,CAChC,sBAAiD,EACjD,UAAkB,EAClB,kBAAqC,EACrC,aAAkE;IAElE,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;QACpC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,sBAAsB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,wBAAwB,CAAC,aAAqB;IACnD,OAAO;QACH,aAAa;QACb,mBAAmB,EAAE,IAAI,GAAG,EAAE;QAC9B,uBAAuB,EAAE,KAAK;KACjC,CAAC;AACN,CAAC;AAED,SAAS,kCAAkC,CACvC,uBAAiD,EACjD,aAAqB;IAErB,OAAO,uBAAuB,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,wBAAwB,CAAC,aAA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,CAAC,eAAe,CAAC,CAAC;QAC5D,MAAM,YAAY,GAAG,uBAAuB,CACxC,yBAAyB,CAAC,IAAI,CAAC,EAC/B,kBAAkB,EAClB,sBAAsB,CACzB,CAAC;QACF,2BAA2B,CACvB,sBAAsB,EACtB,IAAI,CAAC,EAAE,EACP,kBAAkB,EAClB,YAAY,CAAC,sBAAsB,CACtC,CAAC;QACF,uBAAuB,CACnB,gBAAgB,EAChB,IAAI,EACJ,YAAY,EACZ,aAAa,CAAC,6BAA6B,CAC9C,CAAC;IACN,CAAC;IAED,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEvC,KAAK,MAAM,UAAU,IAAI,sBAAsB,EAAE,CAAC;QAC9C,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,gBAAgB,CAAC;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,CAAC;AAED,SAAS,gCAAgC,CACrC,MAAgD,EAChD,MAAgD;IAEhD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAE,WAAW,EAAE,cAAc,CAAE,IAAI,MAAM,EAAE,CAAC;QACnD,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC/C,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,CAAE,GAAG,QAAQ,EAAE,GAAG,cAAc,CAAE,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,2BAA2B,CAChC,oBAAqD,EACrD,YAAoF,EACpF,QAAgB;IAEhB,KAAK,MAAM,mBAAmB,IAAI,YAAY,EAAE,CAAC;QAC7C,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC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AC,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,KAAa;IACtC,IAAI,CAAC;QACD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,IAAI,KAAK,CAAC,qDAAqD,KAAK,GAAG,CAAC,CAAC;IACnF,CAAC;AACL,CAAC;AAED,SAAS,gCAAgC,CAAC,cAAsB;IAC5D,OAAO,CACH,wDAAwD,wBAAwB,EAAE,KAAK;QACvF,QAAQ,cAAc,mEAAmE,CAC5F,CAAC;AACN,CAAC;AAED,SAAS,2BAA2B,CAAC,KAAa;IAC9C,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,sDAAsD,KAAK,GAAG,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,wBAAwB,EAAE,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CA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AAC;IAE5E,KAAK,UAAU,yBAAyB;QACpC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,6BAA6B,CAAC,sBAAsB,CAAC,CAAC;QAC3F,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,UAAU,EAAE;YACnD,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,YAAY,EAAE,EAAE;SACvD,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,wDAAwD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/F,CAAC;QAED,OAAO,iCAAiC,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,KAAK,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,3 +1,23 @@
1
+ import type { ArtifactsBuilder } from '../artifacts/artifacts-builder.ts';
2
+ import type { FileDescription } from '../file-manager/file-description.ts';
3
+ import type { FileManager } from '../file-manager/file-manager.ts';
4
+ import type { ArtifactSourcePackage } from '../published-package/published-package.ts';
5
+ import type { VendorEntry } from '../vendor-materializer/vendor-entry.ts';
1
6
  export type PackFormat = 'folder' | 'tar' | 'zip';
7
+ type PackOptions = {
8
+ readonly bundle: ArtifactSourcePackage;
9
+ readonly format: PackFormat;
10
+ readonly outputPath: string;
11
+ readonly vendorEntries: readonly VendorEntry[];
12
+ readonly extraFiles: readonly FileDescription[];
13
+ };
14
+ export type PackEmitter = {
15
+ pack: (options: PackOptions) => Promise<void>;
16
+ };
17
+ export type PackEmitterDependencies = {
18
+ readonly artifactsBuilder: Pick<ArtifactsBuilder, 'buildFolder' | 'buildTarball' | 'buildZip'>;
19
+ readonly fileManager: Pick<FileManager, 'writeBinaryFile'>;
20
+ };
21
+ export declare function createPackEmitter(dependencies: PackEmitterDependencies): PackEmitter;
2
22
  export {};
3
23
  //# sourceMappingURL=pack-emitter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pack-emitter.d.ts","sourceRoot":"","sources":["../../../../source/pack-emitter/pack-emitter.ts"],"names":[],"mappings":"MAMM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;MAU5C,CAAoB,EAEzB,CAAC"}
1
+ {"version":3,"file":"pack-emitter.d.ts","sourceRoot":"","sources":["../../../../source/pack-emitter/pack-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAElD,KAAK,WAAW,GAAG;IACf,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/C,QAAQ,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG,cAAc,GAAG,UAAU,CAAC,CAAC;IAC/F,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;CAC9D,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,uBAAuB,GAAG,WAAW,CAuCpF"}
@@ -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,iBAAiB,CAAC,YAAqC;IACnE,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IAEvD,KAAK,UAAU,OAAO,CAAC,OAAoB;QACvC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QAC/G,MAAM,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,UAAU,WAAW,CAAC,OAAoB;QAC3C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CAAC,YAAY,CACnD,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,aAAa,CACxB,CAAC;QACF,MAAM,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,UAAU,UAAU,CAAC,OAAoB;QAC1C,MAAM,gBAAgB,CAAC,WAAW,CAC9B,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,aAAa,CACxB,CAAC;IACN,CAAC;IAED,OAAO;QACH,KAAK,CAAC,IAAI,CAAC,OAAO;YACd,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;gBAC3B,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;gBACvB,OAAO;YACX,CAAC;YACD,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;gBAC3B,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC3B,OAAO;YACX,CAAC;YACD,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -1,3 +1,9 @@
1
- import "./explicit-bin.js";
2
- import "./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,C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