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
@@ -13,5 +13,10 @@ export type ResourceResolveOptions = {
13
13
  readonly roots: Roots;
14
14
  readonly surface?: PackageSurface | undefined;
15
15
  };
16
+ export type ResolvedRootsAndSurface = {
17
+ readonly roots: Roots;
18
+ readonly surface: PackageSurface;
19
+ };
20
+ export declare function resolveRootsAndSurface(options: ResourceResolveOptions): ResolvedRootsAndSurface;
16
21
  export {};
17
22
  //# sourceMappingURL=resource-resolve-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-resolve-options.d.ts","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolve-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE5F,KAAK,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAE5C,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,yBAAyB,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1E,QAAQ,CAAC,eAAe,E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BAAsB,GAAG,uBAAuB,CAY/F"}
@@ -1,2 +1,14 @@
1
- import "../package-surface/surface.js";
1
+ import { implicitPackageSurface } from "../package-surface/surface.js";
2
+ export function resolveRootsAndSurface(options) {
3
+ const rootEntries = Object.entries(options.roots);
4
+ const [firstRootEntry] = rootEntries;
5
+ if (firstRootEntry === undefined) {
6
+ throw new Error(`Package "${options.name}" must define at least one root`);
7
+ }
8
+ const [firstRootId] = firstRootEntry;
9
+ return {
10
+ roots: options.roots,
11
+ surface: options.surface ?? implicitPackageSurface(firstRootId)
12
+ };
13
+ }
2
14
  //# sourceMappingURL=resource-resolve-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-resolve-options.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolve-options.ts"],"names":[],"mappings":"AAGA,OAA4D,+BAA+B,CAAC"}
1
+ {"version":3,"file":"resource-resolve-options.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolve-options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAuB,MAAM,+BAA+B,CAAC;AAoB5F,MAAM,UAAU,sBAAsB,CAAC,OAA+B;IAClE,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAE,cAAc,CAAE,GAAG,WAAW,CAAC;IACvC,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,CAAE,WAAW,CAAE,GAAG,cAAc,CAAC;IACvC,OAAO;QACH,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,sBAAsB,CAAC,WAAW,CAAC;KAClE,CAAC;AACN,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { DependencyScanner } from '../dependency-scanner/scanner.ts';
2
+ import type { FileManager } from '../file-manager/file-manager.ts';
3
+ import type { ResolvedBundle } from './resolved-bundle.ts';
4
+ import { type ResourceResolveOptions } from './resource-resolve-options.ts';
5
+ export type ResourceResolverDependencies = {
6
+ readonly dependencyScanner: DependencyScanner;
7
+ readonly fileManager: FileManager;
8
+ };
9
+ export type ResourceResolver = {
10
+ resolve: (options: ResourceResolveOptions) => Promise<ResolvedBundle>;
11
+ resolveWithPromotedDeclarations: (options: ResourceResolveOptions, promotedDeclarationEntryFiles: readonly string[]) => Promise<ResolvedBundle>;
12
+ resolveWithPromotedDeclarationCompanions: (options: ResourceResolveOptions, substitutedInputFilePaths: ReadonlySet<string>) => Promise<ResolvedBundle>;
13
+ };
14
+ export declare function createResourceResolver(dependencies: ResourceResolverDependencies): ResourceResolver;
15
+ //# sourceMappingURL=resource-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-resolver.d.ts","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAO1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEpG,MAAM,MAAM,4BAA4B,GAAG;IACvC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,OAAO,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACtE,+BAA+B,EAAE,CAC7B,OAAO,EAAE,sBAAsB,EAC/B,6BAA6B,EAAE,SAAS,MAAM,EAAE,KAC/C,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7B,wCAAwC,EAAE,CACtC,OAAO,EAAE,sBAAsB,EAC/B,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAAC,KAC7C,OAAO,CAAC,cAAc,CAAC,CAAC;CAChC,CAAC;AAmIF,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,4BAA4B,GAAG,gBAAgB,CAmEnG"}
@@ -1,6 +1,129 @@
1
- import "../common/declaration-companion-paths.js";
2
- import "./content.js";
3
- import "./bundle-resource-lookup.js";
4
- import "./dependency-resolution-walker.js";
5
- import "./resource-resolve-options.js";
1
+ import { mergeExternalDependencyReference } from "../dependency-scanner/external-dependencies.js";
2
+ import { declarationCompanionCandidates } from "../common/declaration-companion-paths.js";
3
+ import { combineAllBundleFiles } from "./content.js";
4
+ import { buildResolvedRoots } from "./bundle-resource-lookup.js";
5
+ import { resolveDependenciesForAllRoots } from "./dependency-resolution-walker.js";
6
+ import { resolveRootsAndSurface } from "./resource-resolve-options.js";
7
+ const packageJsonIndentationSpaces = 4;
8
+ function serializeVirtualManifest(mainPackageJson) {
9
+ return `${JSON.stringify(mainPackageJson, null, packageJsonIndentationSpaces)}\n`;
10
+ }
11
+ function hasDeclarationRoots(options) {
12
+ const normalized = resolveRootsAndSurface(options);
13
+ return Object.values(normalized.roots).some(function (root) {
14
+ return root.declarationFile !== undefined;
15
+ });
16
+ }
17
+ async function findReadableDeclarationCompanion(fileManager, inputFilePath) {
18
+ for (const candidate of declarationCompanionCandidates(inputFilePath)) {
19
+ const readability = await fileManager.checkReadability(candidate);
20
+ if (readability.isReadable) {
21
+ return candidate;
22
+ }
23
+ }
24
+ return undefined;
25
+ }
26
+ async function findReadableDeclarationCompanions(fileManager, substitutedInputFilePaths) {
27
+ const companions = [];
28
+ for (const inputFilePath of substitutedInputFilePaths) {
29
+ const companion = await findReadableDeclarationCompanion(fileManager, inputFilePath);
30
+ if (companion !== undefined) {
31
+ companions.push(companion);
32
+ }
33
+ }
34
+ return companions;
35
+ }
36
+ async function resolveFileDescription(fileManager, bundleFile, mainPackageJson) {
37
+ if (bundleFile.isGeneratedManifest) {
38
+ return {
39
+ content: serializeVirtualManifest(mainPackageJson),
40
+ isExecutable: false,
41
+ inputFilePath: bundleFile.inputFilePath,
42
+ targetFilePath: bundleFile.targetFilePath
43
+ };
44
+ }
45
+ return await fileManager.getTransferableFileDescriptionFromPath(bundleFile.inputFilePath, bundleFile.targetFilePath);
46
+ }
47
+ function targetPathByInputPath(resources) {
48
+ return new Map(resources.map(function (resource) {
49
+ return [resource.fileDescription.inputFilePath, resource.fileDescription.targetFilePath];
50
+ }));
51
+ }
52
+ function targetFilePathFor(targetByInputPath, inputFilePath) {
53
+ return targetByInputPath.get(inputFilePath) ?? inputFilePath;
54
+ }
55
+ function dependencySpecifierReferences(dependency) {
56
+ if (dependency.references !== undefined) {
57
+ return dependency.references.map(function (reference) {
58
+ return {
59
+ name: dependency.name,
60
+ targetFilePath: reference.targetFilePath,
61
+ sourceSpecifier: reference.sourceSpecifier,
62
+ emittedSpecifier: reference.emittedSpecifier
63
+ };
64
+ });
65
+ }
66
+ return dependency.referencedFrom.map(function (targetFilePath) {
67
+ return {
68
+ name: dependency.name,
69
+ targetFilePath,
70
+ sourceSpecifier: dependency.name,
71
+ emittedSpecifier: dependency.name
72
+ };
73
+ });
74
+ }
75
+ function externalDependenciesWithTargetPaths(dependencies, targetByInputPath) {
76
+ const dependenciesByName = new Map();
77
+ for (const dependency of dependencies.values()) {
78
+ for (const reference of dependencySpecifierReferences(dependency)) {
79
+ const existing = dependenciesByName.get(reference.name);
80
+ dependenciesByName.set(reference.name, mergeExternalDependencyReference({
81
+ name: reference.name,
82
+ sourceSpecifier: reference.sourceSpecifier,
83
+ emittedSpecifier: reference.emittedSpecifier
84
+ }, targetFilePathFor(targetByInputPath, reference.targetFilePath), existing));
85
+ }
86
+ }
87
+ return dependenciesByName;
88
+ }
89
+ export function createResourceResolver(dependencies) {
90
+ const { dependencyScanner, fileManager } = dependencies;
91
+ async function resolveWithPromotedDeclarations(options, promotedDeclarationEntryFiles) {
92
+ const normalized = resolveRootsAndSurface(options);
93
+ const resolvedDependencies = await resolveDependenciesForAllRoots({ dependencyScanner, fileManager }, options, promotedDeclarationEntryFiles);
94
+ const bundleFiles = combineAllBundleFiles(options.sourcesFolder, resolvedDependencies.localFiles, options.additionalFiles);
95
+ const contents = await Promise.all(bundleFiles.map(async function (bundleFile) {
96
+ const fileDescription = await resolveFileDescription(fileManager, bundleFile, options.mainPackageJson);
97
+ return {
98
+ fileDescription,
99
+ directDependencies: bundleFile.directDependencies,
100
+ moduleReferences: bundleFile.moduleReferences,
101
+ project: bundleFile.project,
102
+ isExplicitlyIncluded: bundleFile.isExplicitlyIncluded,
103
+ ...bundleFile.isGeneratedManifest ? { isGeneratedManifest: true } : {}
104
+ };
105
+ }));
106
+ const targetByInputPath = targetPathByInputPath(contents);
107
+ return {
108
+ contents,
109
+ name: options.name,
110
+ exportPackageJson: options.exportPackageJson,
111
+ surface: normalized.surface,
112
+ externalDependencies: externalDependenciesWithTargetPaths(resolvedDependencies.externalDependencies, targetByInputPath),
113
+ roots: buildResolvedRoots(normalized, contents)
114
+ };
115
+ }
116
+ return {
117
+ async resolve(options) {
118
+ return await resolveWithPromotedDeclarations(options, []);
119
+ },
120
+ resolveWithPromotedDeclarations,
121
+ async resolveWithPromotedDeclarationCompanions(options, substitutedInputFilePaths) {
122
+ const promotedDeclarationEntryFiles = hasDeclarationRoots(options)
123
+ ? await findReadableDeclarationCompanions(fileManager, substitutedInputFilePaths)
124
+ : [];
125
+ return await resolveWithPromotedDeclarations(options, promotedDeclarationEntryFiles);
126
+ }
127
+ };
128
+ }
6
129
  //# sourceMappingURL=resource-resolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-resolver.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolver.ts"],"names":[],"mappings":"AAEA,OAA+C,0CAA0C,CAAC;AAC1F,OAAsC,cAAc,CAAC;AACrD,OAAmC,6BAA6B,CAAC;AACjE,OAA+C,mCAAmC,CAAC;AAEnF,OAAoE,+BAA+B,CAAC"}
1
+ {"version":3,"file":"resource-resolver.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gCAAgC,EAInC,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAEnF,OAAO,EAAE,sBAAsB,EAA+B,MAAM,+BAA+B,CAAC;AAmBpG,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAQvC,SAAS,wBAAwB,CAAC,eAA0D;IACxF,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,4BAA4B,CAAC,IAAI,CAAC;AACtF,CAAC;AAED,SAAS,mBAAmB,CAAC,OAA+B;IACxD,MAAM,UAAU,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,IAAI;QACtD,OAAO,IAAI,CAAC,eAAe,KAAK,SAAS,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,UAAU,gCAAgC,CAC3C,WAAkD,EAClD,aAAqB;IAErB,KAAK,MAAM,SAAS,IAAI,8BAA8B,CAAC,aAAa,CAAC,EAAE,CAAC;QACpE,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAClE,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;YACzB,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,KAAK,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,CAAC;SAClD,CAAC;IACN,CAAC;IAED,OAAO;QACH,KAAK,CAAC,OAAO,CAAC,OAAO;YACjB,OAAO,MAAM,+BAA+B,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,+BAA+B;QAE/B,KAAK,CAAC,wCAAwC,CAAC,OAAO,EAAE,yBAAyB;YAC7E,MAAM,6BAA6B,GAAG,mBAAmB,CAAC,OAAO,CAAC;gBAC9D,CAAC,CAAC,MAAM,iCAAiC,CAAC,WAAW,EAAE,yBAAyB,CAAC;gBACjF,CAAC,CAAC,EAAE,CAAC;YACT,OAAO,MAAM,+BAA+B,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAC;QACzF,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -1,2 +1,12 @@
1
- import 'remeda';
1
+ import { isPlainObject } from 'remeda';
2
+ export function extractLicenseFromManifest(packageJson) {
3
+ if (!isPlainObject(packageJson)) {
4
+ return undefined;
5
+ }
6
+ const { license } = packageJson;
7
+ if (typeof license === 'string' && license.length > 0) {
8
+ return license;
9
+ }
10
+ return undefined;
11
+ }
2
12
  //# sourceMappingURL=extract-license.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extract-license.js","sourceRoot":"","sources":["../../../../source/sbom/extract-license.ts"],"names":[],"mappings":"AAAA,OAA8B,QAAQ,CAAC"}
1
+ {"version":3,"file":"extract-license.js","sourceRoot":"","sources":["../../../../source/sbom/extract-license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,UAAU,0BAA0B,CAAC,WAAoB;IAC3D,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;IAChC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { FileManager } from '../file-manager/file-manager.ts';
2
+ type LicenseResolverDependencies = {
3
+ readonly fileManager: FileManager;
4
+ };
5
+ type LicenseResolveOptions = {
6
+ readonly projectFolder: string;
7
+ readonly dependencyName: string;
8
+ };
9
+ export type LicenseResolver = {
10
+ resolveLicense: (options: LicenseResolveOptions) => Promise<string | undefined>;
11
+ };
12
+ export declare function createLicenseResolver(dependencies: LicenseResolverDependencies): LicenseResolver;
13
+ export {};
14
+ //# sourceMappingURL=license-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"license-resolver.d.ts","sourceRoot":"","sources":["../../../../source/sbom/license-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAGnE,KAAK,2BAA2B,GAAG;IAC/B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACrC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,cAAc,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACnF,CAAC;AAMF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,2BAA2B,GAAG,eAAe,CAoBhG"}
@@ -1,3 +1,24 @@
1
- import "../common/package-layout.js";
2
- import "./extract-license.js";
1
+ import { installedDependenciesFolderName, installedDependencyManifestPathIn } from "../common/package-layout.js";
2
+ import { extractLicenseFromManifest } from "./extract-license.js";
3
+ function parseJsonString(content) {
4
+ return JSON.parse(content);
5
+ }
6
+ export function createLicenseResolver(dependencies) {
7
+ const { fileManager } = dependencies;
8
+ function buildMissingDependencyMessage(dependencyName) {
9
+ const intro = `Dependency "${dependencyName}" is declared in the published manifest`;
10
+ return `${intro} but is not installed in ${installedDependenciesFolderName}`;
11
+ }
12
+ return {
13
+ async resolveLicense({ projectFolder, dependencyName }) {
14
+ const packageJsonPath = installedDependencyManifestPathIn(projectFolder, dependencyName);
15
+ const readability = await fileManager.checkReadability(packageJsonPath);
16
+ if (!readability.isReadable) {
17
+ throw new Error(buildMissingDependencyMessage(dependencyName));
18
+ }
19
+ const parsed = parseJsonString(await fileManager.readFile(packageJsonPath));
20
+ return extractLicenseFromManifest(parsed);
21
+ }
22
+ };
23
+ }
3
24
  //# sourceMappingURL=license-resolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"license-resolver.js","sourceRoot":"","sources":["../../../../source/sbom/license-resolver.ts"],"names":[],"mappings":"AAAA,OAAmF,6BAA6B,CAAC;AAEjH,OAA2C,sBAAsB,CAAC"}
1
+ {"version":3,"file":"license-resolver.js","sourceRoot":"","sources":["../../../../source/sbom/license-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAEjH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAelE,SAAS,eAAe,CAAC,OAAe;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAY,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,YAAyC;IAC3E,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IAErC,SAAS,6BAA6B,CAAC,cAAsB;QACzD,MAAM,KAAK,GAAG,eAAe,cAAc,yCAAyC,CAAC;QACrF,OAAO,GAAG,KAAK,4BAA4B,+BAA+B,EAAE,CAAC;IACjF,CAAC;IAED,OAAO;QACH,KAAK,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE;YAClD,MAAM,eAAe,GAAG,iCAAiC,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;YACzF,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;YACxE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,cAAc,CAAC,CAAC,CAAC;YACnE,CAAC;YAED,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;YAC5E,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -1,3 +1,58 @@
1
- import '@cyclonedx/cyclonedx-library';
2
- import 'spdx-expression-parse';
1
+ import * as cdx from '@cyclonedx/cyclonedx-library';
2
+ import spdxParse from 'spdx-expression-parse';
3
+ function isParseableSpdxExpression(value) {
4
+ try {
5
+ spdxParse(value);
6
+ }
7
+ catch {
8
+ return false;
9
+ }
10
+ return true;
11
+ }
12
+ function buildPurl(name, versionOrSpecifier) {
13
+ return `pkg:npm/${name}@${encodeURIComponent(versionOrSpecifier)}`;
14
+ }
15
+ function buildRootComponent(rootComponent) {
16
+ const purl = buildPurl(rootComponent.name, rootComponent.version);
17
+ return new cdx.Models.Component(cdx.Enums.ComponentType.Library, rootComponent.name, {
18
+ version: rootComponent.version,
19
+ bomRef: purl,
20
+ purl
21
+ });
22
+ }
23
+ function buildDependencyComponent(dependency) {
24
+ const purl = buildPurl(dependency.name, dependency.specifier);
25
+ const component = new cdx.Models.Component(cdx.Enums.ComponentType.Library, dependency.name, {
26
+ version: dependency.specifier,
27
+ bomRef: purl,
28
+ purl,
29
+ scope: dependency.scope
30
+ });
31
+ if (dependency.license === undefined) {
32
+ return component;
33
+ }
34
+ if (isParseableSpdxExpression(dependency.license)) {
35
+ component.licenses.add(new cdx.Models.LicenseExpression(dependency.license));
36
+ return component;
37
+ }
38
+ component.licenses.add(new cdx.Models.NamedLicense(dependency.license));
39
+ return component;
40
+ }
41
+ function buildToolComponent(toolVersion) {
42
+ return new cdx.Models.Component(cdx.Enums.ComponentType.Application, 'packtory', {
43
+ version: toolVersion
44
+ });
45
+ }
46
+ export function buildSbom(options) {
47
+ const bom = new cdx.Models.Bom();
48
+ bom.metadata.tools.components.add(buildToolComponent(options.toolVersion));
49
+ const rootComponent = buildRootComponent(options.rootComponent);
50
+ bom.metadata.component = rootComponent;
51
+ for (const dependency of options.dependencies) {
52
+ const component = buildDependencyComponent(dependency);
53
+ bom.components.add(component);
54
+ rootComponent.dependencies.add(component.bomRef);
55
+ }
56
+ return bom;
57
+ }
3
58
  //# sourceMappingURL=sbom-builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sbom-builder.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-builder.ts"],"names":[],"mappings":"AAAA,OAAqB,8BAA8B,CAAC;AACpD,OAAsB,uBAAuB,CAAC"}
1
+ {"version":3,"file":"sbom-builder.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAoB9C,SAAS,yBAAyB,CAAC,KAAa;IAC5C,IAAI,CAAC;QACD,SAAS,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,kBAA0B;IACvD,OAAO,WAAW,IAAI,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,CAAC;AACvE,CAAC;AAED,SAAS,kBAAkB,CAAC,aAAgC;IACxD,MAAM,IAAI,GAAG,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAClE,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAA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AAC;AAED,MAAM,UAAU,SAAS,CAAC,OAA2B;IACjD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACjC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAE3E,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAChE,GAAG,CAAC,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;IAEvC,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QAC5C,MAAM,SAAS,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACvD,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC9B,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
@@ -1,4 +1,46 @@
1
- import 'remeda';
2
- import "../common/package-layout.js";
3
- import "../common/stable-json.js";
1
+ import { isArray, isPlainObject } from 'remeda';
2
+ import { bundleRelativePath, sbomArtifactFilePath } from "../common/package-layout.js";
3
+ import { serializeStableJson } from "../common/stable-json.js";
4
+ const packtoryToolName = 'packtory';
5
+ function pluckObjectField(value, key) {
6
+ if (!isPlainObject(value)) {
7
+ return undefined;
8
+ }
9
+ return value[key];
10
+ }
11
+ function resolveToolComponents(parsed) {
12
+ const metadata = pluckObjectField(parsed, 'metadata');
13
+ const tools = pluckObjectField(metadata, 'tools');
14
+ const components = pluckObjectField(tools, 'components');
15
+ return isArray(components) ? components : undefined;
16
+ }
17
+ function stripPacktoryVersion(parsed) {
18
+ const components = resolveToolComponents(parsed);
19
+ if (components === undefined) {
20
+ return;
21
+ }
22
+ for (const entry of components) {
23
+ if (isPlainObject(entry) && entry.name === packtoryToolName) {
24
+ delete entry.version;
25
+ }
26
+ }
27
+ }
28
+ function canonicalizeSbomContent(content) {
29
+ try {
30
+ const parsed = JSON.parse(content);
31
+ stripPacktoryVersion(parsed);
32
+ return serializeStableJson(parsed);
33
+ }
34
+ catch {
35
+ return content;
36
+ }
37
+ }
38
+ export function canonicalizeSbomInFileSet(files) {
39
+ return files.map(function (file) {
40
+ if (bundleRelativePath(file.filePath) !== sbomArtifactFilePath) {
41
+ return file;
42
+ }
43
+ return { ...file, content: canonicalizeSbomContent(file.content) };
44
+ });
45
+ }
4
46
  //# sourceMappingURL=sbom-canonicalizer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sbom-canonicalizer.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-canonicalizer.ts"],"names":[],"mappings":"AAAA,OAAuC,QAAQ,CAAC;AAChD,OAAyD,6BAA6B,CAAC;AACvF,OAAoC,0BAA0B,CAAC"}
1
+ {"version":3,"file":"sbom-canonicalizer.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-canonicalizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAEpC,SAAS,gBAAgB,CAAC,KAAc,EAAE,GAAW;IACjD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAe;IAC1C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CA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-manager/file-description.ts';
3
3
  import type { SbomPackage, SbomSiblingPackage } from '../published-package/published-package.ts';
4
+ import type { LicenseResolver } from './license-resolver.ts';
5
+ import type { SbomSerializer } from './sbom-serializer.ts';
6
+ type ToolVersionProvider = () => Promise<string>;
7
+ type SbomFileBuilderDependencies = {
8
+ readonly licenseResolver: LicenseResolver;
9
+ readonly sbomSerializer: SbomSerializer;
10
+ readonly toolVersionProvider: ToolVersionProvider;
11
+ readonly projectFolder: string;
12
+ };
4
13
  export type SbomFileBuilder = {
5
14
  generate: (bundle: SbomPackage, siblings: readonly SbomSiblingPackage[], publishSettings: PublishSettings) => Promise<readonly FileDescription[] | undefined>;
6
15
  };
16
+ export declare function createSbomFileBuilder(dependencies: SbomFileBuilderDependencies): SbomFileBuilder;
7
17
  export {};
8
18
  //# sourceMappingURL=sbom-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sbom-file.d.ts","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;MAe3F,MAAM,eAAe,GAAG;IAC1B,QAAQ,EAAE,CACN,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,SAAS,kBAAkB,EAAE,EACvC,eAAe,EAAE,eAAe,KAC/B,OAAO,CAAC,SAAS,eAAe,EAAE,GAAG,SAAS,CAAC,CAAC;CACxD,CAAC;AAuBF"}
1
+ {"version":3,"file":"sbom-file.d.ts","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAEjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,KAAK,mBAAmB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;AAEjD,KAAK,2BAA2B,GAAG;IAC/B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,EAAE,CACN,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,SAAS,kBAAkB,EAAE,EACvC,eAAe,EAAE,eAAe,KAC/B,OAAO,CAAC,SAAS,eAAe,EAAE,GAAG,SAAS,CAAC,CAAC;CACxD,CAAC;AAuBF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,2BAA2B,GAAG,eAAe,CA6ChG"}
package/sbom/sbom-file.js CHANGED
@@ -1,6 +1,55 @@
1
- import '@cyclonedx/cyclonedx-library';
2
- import "../common/package-layout.js";
3
- import "../file-manager/file-description.js";
4
- import "./extract-license.js";
5
- import "./sbom-builder.js";
1
+ import * as cdx from '@cyclonedx/cyclonedx-library';
2
+ import { sbomArtifactFilePath } from "../common/package-layout.js";
3
+ import { createFileDescription } from "../file-manager/file-description.js";
4
+ import { extractLicenseFromManifest } from "./extract-license.js";
5
+ import { buildSbom } from "./sbom-builder.js";
6
+ function isSbomEnabled(publishSettings) {
7
+ return publishSettings.sbom?.enabled ?? true;
8
+ }
9
+ function listDependencyEntries(bundle) {
10
+ return [
11
+ ...Object.entries(bundle.dependencies).map(function ([name, specifier]) {
12
+ return { name, specifier, scope: cdx.Enums.ComponentScope.Required };
13
+ }),
14
+ ...Object.entries(bundle.peerDependencies).map(function ([name, specifier]) {
15
+ return { name, specifier, scope: cdx.Enums.ComponentScope.Optional };
16
+ })
17
+ ];
18
+ }
19
+ export function createSbomFileBuilder(dependencies) {
20
+ const { licenseResolver, sbomSerializer, toolVersionProvider, projectFolder } = dependencies;
21
+ async function resolveDependencyEntries(bundle, siblings) {
22
+ const siblingsByName = new Map(siblings.map(function (sibling) {
23
+ return [sibling.name, sibling];
24
+ }));
25
+ const entries = listDependencyEntries(bundle);
26
+ return Promise.all(entries.map(async function (entry) {
27
+ const sibling = siblingsByName.get(entry.name);
28
+ const license = sibling === undefined
29
+ ? await licenseResolver.resolveLicense({ projectFolder, dependencyName: entry.name })
30
+ : extractLicenseFromManifest(sibling.packageJson);
31
+ return { ...entry, license };
32
+ }));
33
+ }
34
+ async function buildFile(bundle, siblings) {
35
+ const [resolvedToolVersion, sbomDependencies] = await Promise.all([
36
+ toolVersionProvider(),
37
+ resolveDependencyEntries(bundle, siblings)
38
+ ]);
39
+ const bom = buildSbom({
40
+ toolVersion: resolvedToolVersion,
41
+ rootComponent: { name: bundle.packageJson.name, version: bundle.packageJson.version },
42
+ dependencies: sbomDependencies
43
+ });
44
+ return createFileDescription(sbomArtifactFilePath, sbomSerializer.serialize(bom));
45
+ }
46
+ return {
47
+ async generate(bundle, siblings, publishSettings) {
48
+ if (!isSbomEnabled(publishSettings)) {
49
+ return undefined;
50
+ }
51
+ return [await buildFile(bundle, siblings)];
52
+ }
53
+ };
54
+ }
6
55
  //# sourceMappingURL=sbom-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sbom-file.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAAA,OAAqB,8BAA8B,CAAC;AACpD,OAAqC,6BAA6B,CAAC;AAEnE,OAA4D,qCAAqC,CAAC;AAElG,OAA2C,sBAAsB,CAAC;AAGlE,OAA+C,mBAAmB,CAAC"}
1
+ {"version":3,"file":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AE,eAAe;YAC5C,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,CAAC;gBAClC,OAAO,SAAS,CAAC;YACrB,CAAC;YACD,OAAO,CAAE,MAAM,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAE,CAAC;QACjD,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,8 @@
1
+ import * as cdx from '@cyclonedx/cyclonedx-library';
2
+ type SerializableBom = Readonly<cdx.Models.Bom>;
3
+ export type SbomSerializer = {
4
+ serialize: (bom: SerializableBom) => string;
5
+ };
6
+ export declare function createSbomSerializer(): SbomSerializer;
7
+ export {};
8
+ //# sourceMappingURL=sbom-serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sbom-serializer.d.ts","sourceRoot":"","sources":["../../../../source/sbom/sbom-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AAEpD,KAAK,eAAe,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IACzB,SAAS,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,MAAM,CAAC;CAC/C,CAAC;AAUF,wBAAgB,oBAAoB,IAAI,cAAc,CAOrD"}
@@ -1,2 +1,15 @@
1
- import '@cyclonedx/cyclonedx-library';
1
+ import * as cdx from '@cyclonedx/cyclonedx-library';
2
+ function createCycloneDxJsonSerializer() {
3
+ return new cdx.Serialize.JsonSerializer(new cdx.Serialize.JSON.Normalize.Factory(cdx.Spec.Spec1dot6));
4
+ }
5
+ function serializeBom(serializer, bom) {
6
+ return String(Reflect.apply(serializer.serialize, serializer, [bom, { sortLists: true, space: 4 }]));
7
+ }
8
+ export function createSbomSerializer() {
9
+ const serializer = createCycloneDxJsonSerializer();
10
+ const serialize = function (bom) {
11
+ return serializeBom(serializer, bom);
12
+ };
13
+ return { serialize };
14
+ }
2
15
  //# sourceMappingURL=sbom-serializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sbom-serializer.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-serializer.ts"],"names":[],"mappings":"AAAA,OAAqB,8BAA8B,CAAC"}
1
+ {"version":3,"file":"sbom-serializer.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AAQpD,SAAS,6BAA6B;IAClC,OAAO,IAAI,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1G,CAAC;AAED,SAAS,YAAY,CAAC,UAAwC,EAAE,GAAoB;IAChF,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,CAAE,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAE,CAAC,CAAC,CAAC;AAC3G,CAAC;AAED,MAAM,UAAU,oBAAoB;IAChC,MAAM,UAAU,GAAG,6BAA6B,EAAE,CAAC;IACnD,MAAM,SAAS,GAAG,UAAU,GAAoB;QAC5C,OAAO,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AACzB,CAAC"}
@@ -1,2 +1,50 @@
1
- import 'remeda';
1
+ import { isObjectType, isPlainObject } from 'remeda';
2
+ const candidatePackageNames = ['@packtory/cli', 'packtory'];
3
+ function buildUnresolvableMessage() {
4
+ const intro = 'Cannot determine packtory tool version: neither "@packtory/cli" nor "packtory" is resolvable.';
5
+ return `${intro} Install packtory via npm so it lives under node_modules/.`;
6
+ }
7
+ function isCandidatePackageName(value) {
8
+ return value === '@packtory/cli' || value === 'packtory';
9
+ }
10
+ function isImportResolutionError(error) {
11
+ if (!isObjectType(error) || !Object.hasOwn(error, 'code')) {
12
+ return false;
13
+ }
14
+ const code = Reflect.get(error, 'code');
15
+ return code === 'ERR_MODULE_NOT_FOUND' || code === 'ERR_PACKAGE_PATH_NOT_EXPORTED';
16
+ }
17
+ function unwrapJsonModule(importedModule) {
18
+ if (!isPlainObject(importedModule) || !Object.hasOwn(importedModule, 'default')) {
19
+ return importedModule;
20
+ }
21
+ return importedModule.default;
22
+ }
23
+ function parseToolPackageJson(specifier, importedModule) {
24
+ const parsed = unwrapJsonModule(importedModule);
25
+ if (!isPlainObject(parsed) || typeof parsed.version !== 'string') {
26
+ throw new Error(`Imported packtory package.json from "${specifier}" is missing a version field`);
27
+ }
28
+ if (!isCandidatePackageName(parsed.name)) {
29
+ throw new Error(`Imported packtory package.json from "${specifier}" has unexpected package name`);
30
+ }
31
+ return parsed.version;
32
+ }
33
+ export function createPacktoryToolVersionResolver(dependencies) {
34
+ const { importPackageJson } = dependencies;
35
+ return async function resolvePacktoryToolVersion() {
36
+ for (const candidatePackageName of candidatePackageNames) {
37
+ const specifier = `${candidatePackageName}/package.json`;
38
+ try {
39
+ return parseToolPackageJson(specifier, await importPackageJson(specifier));
40
+ }
41
+ catch (error) {
42
+ if (!isImportResolutionError(error)) {
43
+ throw error;
44
+ }
45
+ }
46
+ }
47
+ throw new Error(buildUnresolvableMessage());
48
+ };
49
+ }
2
50
  //# sourceMappingURL=tool-version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-version.js","sourceRoot":"","sources":["../../../../source/sbom/tool-version.ts"],"names":[],"mappings":"AAAA,OAA4C,QAAQ,CAAC"}
1
+ {"version":3,"file":"tool-version.js","sourceRoot":"","sources":["../../../../source/sbom/tool-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAErD,MAAM,qBAAqB,GAAG,CAAE,eAAe,EAAE,UAAU,CAAW,C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