packtory 0.0.96 → 0.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (517) hide show
  1. package/artifacts/artifacts-builder.js +37 -4
  2. package/artifacts/artifacts-builder.js.map +1 -1
  3. package/artifacts/content-collection.js +59 -2
  4. package/artifacts/content-collection.js.map +1 -1
  5. package/artifacts/folder-writer.js +25 -2
  6. package/artifacts/folder-writer.js.map +1 -1
  7. package/bundle-emitter/emitter.js +137 -6
  8. package/bundle-emitter/emitter.js.map +1 -1
  9. package/bundle-emitter/extract-package-tarball.js +13 -2
  10. package/bundle-emitter/extract-package-tarball.js.map +1 -1
  11. package/bundle-emitter/fetch-published-artifacts.js +19 -2
  12. package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
  13. package/bundle-emitter/publication-outcome.js +5 -0
  14. package/bundle-emitter/publication-outcome.js.map +1 -1
  15. package/bundle-emitter/publish-error/auto-mode-error-matching.js +28 -2
  16. package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
  17. package/bundle-emitter/publish-error/error-shape-helpers.js +9 -0
  18. package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
  19. package/bundle-emitter/publish-error/file-mode-error-matching.js +33 -2
  20. package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
  21. package/bundle-emitter/publish-error/publish-error-messages.js +24 -0
  22. package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
  23. package/bundle-emitter/registry/metadata-auth-retry.js +24 -1
  24. package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
  25. package/bundle-emitter/registry/oidc-token-exchange.js +68 -3
  26. package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
  27. package/bundle-emitter/registry/package-metadata-fetcher.js +210 -7
  28. package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
  29. package/bundle-emitter/registry/publish-settings-bridge.js +34 -3
  30. package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
  31. package/bundle-emitter/registry/registry-auth-config.js +106 -0
  32. package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
  33. package/bundle-emitter/registry/registry-client.js +74 -4
  34. package/bundle-emitter/registry/registry-client.js.map +1 -1
  35. package/bundle-emitter/registry/registry-package-path.js +3 -0
  36. package/bundle-emitter/registry/registry-package-path.js.map +1 -1
  37. package/bundle-emitter/registry/registry-response-schemas.js +50 -2
  38. package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
  39. package/bundle-emitter/registry/tarball-integrity.js +31 -1
  40. package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
  41. package/bundle-emitter/registry/validate-tarball-host.js +26 -1
  42. package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
  43. package/bundle-emitter/release-artifact-canonicalizer.js +31 -5
  44. package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
  45. package/checks/check-runner.js +8 -0
  46. package/checks/check-runner.js.map +1 -1
  47. package/checks/rule.js +12 -2
  48. package/checks/rule.js.map +1 -1
  49. package/checks/rules/duplicate-detection.js +23 -1
  50. package/checks/rules/duplicate-detection.js.map +1 -1
  51. package/checks/rules/duplicate-messages.js +22 -0
  52. package/checks/rules/duplicate-messages.js.map +1 -1
  53. package/checks/rules/file-ownership.js +15 -0
  54. package/checks/rules/file-ownership.js.map +1 -1
  55. package/checks/rules/max-bundle-size.js +55 -1
  56. package/checks/rules/max-bundle-size.js.map +1 -1
  57. package/checks/rules/no-dev-dependency-imports.js +51 -1
  58. package/checks/rules/no-dev-dependency-imports.js.map +1 -1
  59. package/checks/rules/no-duplicated-files.js +53 -3
  60. package/checks/rules/no-duplicated-files.js.map +1 -1
  61. package/checks/rules/no-side-effects.js +50 -1
  62. package/checks/rules/no-side-effects.js.map +1 -1
  63. package/checks/rules/no-unexposed-executables.js +43 -2
  64. package/checks/rules/no-unexposed-executables.js.map +1 -1
  65. package/checks/rules/no-unused-bundle-dependencies.js +30 -2
  66. package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
  67. package/checks/rules/registry.js +22 -9
  68. package/checks/rules/registry.js.map +1 -1
  69. package/checks/rules/required-files.js +41 -3
  70. package/checks/rules/required-files.js.map +1 -1
  71. package/checks/rules/type-script-declaration-integrity.js +81 -3
  72. package/checks/rules/type-script-declaration-integrity.js.map +1 -1
  73. package/checks/rules/type-script-declaration-paths.js +55 -1
  74. package/checks/rules/type-script-declaration-paths.js.map +1 -1
  75. package/checks/rules/type-script-declaration-project.js +202 -3
  76. package/checks/rules/type-script-declaration-project.js.map +1 -1
  77. package/checks/rules/type-script-declaration-reachability.js +38 -2
  78. package/checks/rules/type-script-declaration-reachability.js.map +1 -1
  79. package/checks/rules/type-script-declaration-roots.js +29 -0
  80. package/checks/rules/type-script-declaration-roots.js.map +1 -1
  81. package/checks/rules/type-script-integrity.js +72 -2
  82. package/checks/rules/type-script-integrity.js.map +1 -1
  83. package/checks/rules/type-script-package-resolution.js +42 -1
  84. package/checks/rules/type-script-package-resolution.js.map +1 -1
  85. package/checks/rules/type-script-resolution-summary.js +53 -0
  86. package/checks/rules/type-script-resolution-summary.js.map +1 -1
  87. package/checks/rules/unique-target-paths.js +34 -2
  88. package/checks/rules/unique-target-paths.js.map +1 -1
  89. package/common/bundled-dependency-groups.js +27 -0
  90. package/common/bundled-dependency-groups.js.map +1 -1
  91. package/common/code-files.js +28 -0
  92. package/common/code-files.js.map +1 -1
  93. package/common/declaration-companion-paths.js +24 -0
  94. package/common/declaration-companion-paths.js.map +1 -1
  95. package/common/package-name-map.js +7 -0
  96. package/common/package-name-map.js.map +1 -1
  97. package/common/stable-json.js +42 -2
  98. package/common/stable-json.js.map +1 -1
  99. package/common/worklist.js +22 -0
  100. package/common/worklist.js.map +1 -1
  101. package/config/additional-files.js +6 -2
  102. package/config/additional-files.js.map +1 -1
  103. package/config/additional-package-json-attributes-schema.js +6 -2
  104. package/config/additional-package-json-attributes-schema.js.map +1 -1
  105. package/config/automatic-versioning-settings.js +6 -2
  106. package/config/automatic-versioning-settings.js.map +1 -1
  107. package/config/changelog-settings.js +120 -3
  108. package/config/changelog-settings.js.map +1 -1
  109. package/config/common-package-settings-schemas.js +19 -3
  110. package/config/common-package-settings-schemas.js.map +1 -1
  111. package/config/config.js +3 -1
  112. package/config/config.js.map +1 -1
  113. package/config/cross-package-validation.js +17 -0
  114. package/config/cross-package-validation.js.map +1 -1
  115. package/config/dead-code-elimination-settings.js +36 -2
  116. package/config/dead-code-elimination-settings.js.map +1 -1
  117. package/config/dependency-existence-validation.js +19 -1
  118. package/config/dependency-existence-validation.js.map +1 -1
  119. package/config/dependency-policy.js +5 -2
  120. package/config/dependency-policy.js.map +1 -1
  121. package/config/main-package-json-schema.js +11 -2
  122. package/config/main-package-json-schema.js.map +1 -1
  123. package/config/manual-versioning-settings.d.ts +12 -0
  124. package/config/manual-versioning-settings.d.ts.map +1 -1
  125. package/config/manual-versioning-settings.js +29 -2
  126. package/config/manual-versioning-settings.js.map +1 -1
  127. package/config/optional-package-settings-schema.js +16 -7
  128. package/config/optional-package-settings-schema.js.map +1 -1
  129. package/config/package-config.js +2 -1
  130. package/config/package-config.js.map +1 -1
  131. package/config/package-graph-builder.js +14 -2
  132. package/config/package-graph-builder.js.map +1 -1
  133. package/config/package-interface.js +25 -2
  134. package/config/package-interface.js.map +1 -1
  135. package/config/package-json.d.ts.map +1 -1
  136. package/config/package-json.js +16 -0
  137. package/config/package-json.js.map +1 -1
  138. package/config/packtory-config-without-registry-schema.js +6 -0
  139. package/config/packtory-config-without-registry-schema.js.map +1 -1
  140. package/config/per-package-settings-schema.js +22 -6
  141. package/config/per-package-settings-schema.js.map +1 -1
  142. package/config/pre-graph-validation.js +20 -5
  143. package/config/pre-graph-validation.js.map +1 -1
  144. package/config/publish-settings.js +25 -3
  145. package/config/publish-settings.js.map +1 -1
  146. package/config/publish-settings.report.js +17 -1
  147. package/config/publish-settings.report.js.map +1 -1
  148. package/config/registry-settings.js +40 -2
  149. package/config/registry-settings.js.map +1 -1
  150. package/config/registry-settings.report.js +46 -0
  151. package/config/registry-settings.report.js.map +1 -1
  152. package/config/root-config-validation.js +141 -0
  153. package/config/root-config-validation.js.map +1 -1
  154. package/config/root.js +6 -2
  155. package/config/root.js.map +1 -1
  156. package/config/sbom-settings.js +4 -1
  157. package/config/sbom-settings.js.map +1 -1
  158. package/config/settings-validation.js +28 -0
  159. package/config/settings-validation.js.map +1 -1
  160. package/config/versioning-settings.js +10 -3
  161. package/config/versioning-settings.js.map +1 -1
  162. package/dead-code-eliminator/analyzed-bundle.js +7 -0
  163. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  164. package/dead-code-eliminator/artifact-module-reference-contract.js +27 -0
  165. package/dead-code-eliminator/artifact-module-reference-contract.js.map +1 -0
  166. package/dead-code-eliminator/bundle-analysis.js +38 -5
  167. package/dead-code-eliminator/bundle-analysis.js.map +1 -1
  168. package/dead-code-eliminator/class-purity.js +48 -2
  169. package/dead-code-eliminator/class-purity.js.map +1 -1
  170. package/dead-code-eliminator/code-file-analyzer.js +68 -4
  171. package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
  172. package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -0
  173. package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
  174. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
  175. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
  176. package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -3
  177. package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
  178. package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
  179. package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
  180. package/dead-code-eliminator/dependency-metadata.js +172 -2
  181. package/dead-code-eliminator/dependency-metadata.js.map +1 -1
  182. package/dead-code-eliminator/elimination-emitter.js +52 -0
  183. package/dead-code-eliminator/elimination-emitter.js.map +1 -1
  184. package/dead-code-eliminator/eliminator.js +22 -4
  185. package/dead-code-eliminator/eliminator.js.map +1 -1
  186. package/dead-code-eliminator/expression-unwrapping.js +16 -1
  187. package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
  188. package/dead-code-eliminator/imported-expression-origin.js +101 -2
  189. package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
  190. package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
  191. package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
  192. package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
  193. package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
  194. package/dead-code-eliminator/liveness/external-purity-summary.js +314 -3
  195. package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
  196. package/dead-code-eliminator/liveness/external-purity.js +39 -3
  197. package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
  198. package/dead-code-eliminator/liveness/module-analysis.js +27 -2
  199. package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
  200. package/dead-code-eliminator/liveness/resource-retention.js +91 -1
  201. package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
  202. package/dead-code-eliminator/liveness/runtime-code.js +15 -1
  203. package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
  204. package/dead-code-eliminator/load-bundle.js +86 -5
  205. package/dead-code-eliminator/load-bundle.js.map +1 -1
  206. package/dead-code-eliminator/pure-expression.js +178 -5
  207. package/dead-code-eliminator/pure-expression.js.map +1 -1
  208. package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
  209. package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
  210. package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
  211. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  212. package/dead-code-eliminator/reachability/binding-id.js +106 -1
  213. package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
  214. package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -1
  215. package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
  216. package/dead-code-eliminator/reachability/impure-statements.js +11 -2
  217. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  218. package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
  219. package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
  220. package/dead-code-eliminator/reachability/reachability.js +70 -4
  221. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  222. package/dead-code-eliminator/side-effect-classifier.js +39 -4
  223. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  224. package/dead-code-eliminator/side-effects-field.js +23 -1
  225. package/dead-code-eliminator/side-effects-field.js.map +1 -1
  226. package/dead-code-eliminator/source-map-recomposition.js +29 -2
  227. package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
  228. package/dead-code-eliminator/statement-classifiers.js +94 -4
  229. package/dead-code-eliminator/statement-classifiers.js.map +1 -1
  230. package/dead-code-eliminator/syntax-kind-sets.js +16 -0
  231. package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
  232. package/dead-code-eliminator/transform/atom-translator.js +57 -2
  233. package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
  234. package/dead-code-eliminator/transform/declaration-removal.js +183 -5
  235. package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
  236. package/dead-code-eliminator/transform/declaration-remover.js +17 -2
  237. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  238. package/dead-code-eliminator/transform/line-index.js +20 -0
  239. package/dead-code-eliminator/transform/line-index.js.map +1 -1
  240. package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
  241. package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
  242. package/dead-code-eliminator/transform/source-map-composer.js +84 -3
  243. package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
  244. package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
  245. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
  246. package/dependency-scanner/dependency-graph.js +77 -3
  247. package/dependency-scanner/dependency-graph.js.map +1 -1
  248. package/dependency-scanner/external-dependencies.js +55 -1
  249. package/dependency-scanner/external-dependencies.js.map +1 -1
  250. package/dependency-scanner/file-host-predicates.js +9 -0
  251. package/dependency-scanner/file-host-predicates.js.map +1 -1
  252. package/dependency-scanner/host-method-binding.js +18 -0
  253. package/dependency-scanner/host-method-binding.js.map +1 -1
  254. package/dependency-scanner/injected-dynamic-imports.js +232 -1
  255. package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
  256. package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
  257. package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
  258. package/dependency-scanner/package-owned-asset-file-path.js +9 -1
  259. package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
  260. package/dependency-scanner/scanner.js +109 -4
  261. package/dependency-scanner/scanner.js.map +1 -1
  262. package/dependency-scanner/source-file-references.js +171 -6
  263. package/dependency-scanner/source-file-references.js.map +1 -1
  264. package/dependency-scanner/source-map-file-locator.js +66 -2
  265. package/dependency-scanner/source-map-file-locator.js.map +1 -1
  266. package/dependency-scanner/typescript-compiler-options.js +21 -1
  267. package/dependency-scanner/typescript-compiler-options.js.map +1 -1
  268. package/dependency-scanner/typescript-file-host.js +49 -5
  269. package/dependency-scanner/typescript-file-host.js.map +1 -1
  270. package/dependency-scanner/typescript-module-resolution.js +214 -0
  271. package/dependency-scanner/typescript-module-resolution.js.map +1 -0
  272. package/dependency-scanner/typescript-project-analyzer.js +32 -3
  273. package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
  274. package/dependency-scanner/virtual-package-json-host.js +45 -4
  275. package/dependency-scanner/virtual-package-json-host.js.map +1 -1
  276. package/directed-graph/graph.js +240 -1
  277. package/directed-graph/graph.js.map +1 -1
  278. package/file-manager/compare.js +23 -2
  279. package/file-manager/compare.js.map +1 -1
  280. package/file-manager/equal.js +5 -0
  281. package/file-manager/equal.js.map +1 -1
  282. package/file-manager/file-description.js +3 -0
  283. package/file-manager/file-description.js.map +1 -1
  284. package/file-manager/permissions.js +28 -1
  285. package/file-manager/permissions.js.map +1 -1
  286. package/git/current-git-head.js +24 -0
  287. package/git/current-git-head.js.map +1 -1
  288. package/git/git-command.js +49 -1
  289. package/git/git-command.js.map +1 -1
  290. package/linker/linked-bundle.js +5 -0
  291. package/linker/linked-bundle.js.map +1 -1
  292. package/linker/linker.js +51 -5
  293. package/linker/linker.js.map +1 -1
  294. package/linker/replacement-lookup.js +297 -8
  295. package/linker/replacement-lookup.js.map +1 -1
  296. package/linker/resource-graph.js +65 -2
  297. package/linker/resource-graph.js.map +1 -1
  298. package/linker/source-modifier/import-paths.js +80 -3
  299. package/linker/source-modifier/import-paths.js.map +1 -1
  300. package/linker/substitute-bundles.js +166 -3
  301. package/linker/substitute-bundles.js.map +1 -1
  302. package/linker/substituted-resource-graph.js +111 -2
  303. package/linker/substituted-resource-graph.js.map +1 -1
  304. package/npm-oidc-id-token-resolver.js +82 -0
  305. package/npm-oidc-id-token-resolver.js.map +1 -1
  306. package/pack-emitter/pack-emitter.js +27 -0
  307. package/pack-emitter/pack-emitter.js.map +1 -1
  308. package/package-surface/bin-field.js +8 -2
  309. package/package-surface/bin-field.js.map +1 -1
  310. package/package-surface/explicit-bin.js +24 -2
  311. package/package-surface/explicit-bin.js.map +1 -1
  312. package/package-surface/explicit-exports.js +26 -3
  313. package/package-surface/explicit-exports.js.map +1 -1
  314. package/package-surface/export-map.js +9 -2
  315. package/package-surface/export-map.js.map +1 -1
  316. package/package-surface/implicit-bin.js +25 -1
  317. package/package-surface/implicit-bin.js.map +1 -1
  318. package/package-surface/implicit-exports.js +10 -3
  319. package/package-surface/implicit-exports.js.map +1 -1
  320. package/package-surface/implicit-root-exports.js +13 -2
  321. package/package-surface/implicit-root-exports.js.map +1 -1
  322. package/package-surface/package-json-export.js +9 -0
  323. package/package-surface/package-json-export.js.map +1 -1
  324. package/package-surface/package-shape.js +10 -1
  325. package/package-surface/package-shape.js.map +1 -1
  326. package/package-surface/package-surface-index.js +165 -3
  327. package/package-surface/package-surface-index.js.map +1 -1
  328. package/package-surface/public-module-usage.js +46 -3
  329. package/package-surface/public-module-usage.js.map +1 -1
  330. package/package-surface/public-specifiers.js +7 -1
  331. package/package-surface/public-specifiers.js.map +1 -1
  332. package/package-surface/root-registry.js +26 -0
  333. package/package-surface/root-registry.js.map +1 -1
  334. package/package-surface/specifier-syntax.js +4 -0
  335. package/package-surface/specifier-syntax.js.map +1 -1
  336. package/package-surface/substitution-exports.js +101 -3
  337. package/package-surface/substitution-exports.js.map +1 -1
  338. package/package-surface/surface.js +12 -0
  339. package/package-surface/surface.js.map +1 -1
  340. package/package.json +2 -2
  341. package/packages/package-processor.composition.js +161 -34
  342. package/packages/package-processor.composition.js.map +1 -1
  343. package/packtory/map-config.js +35 -4
  344. package/packtory/map-config.js.map +1 -1
  345. package/packtory/normalize-paths.js +25 -1
  346. package/packtory/normalize-paths.js.map +1 -1
  347. package/packtory/options/bundle-dependency-resolution.js +17 -1
  348. package/packtory/options/bundle-dependency-resolution.js.map +1 -1
  349. package/packtory/options/dead-code-elimination-resolution.js +10 -1
  350. package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
  351. package/packtory/options/prepare-package-options.js +46 -5
  352. package/packtory/options/prepare-package-options.js.map +1 -1
  353. package/packtory/options/required-value-helpers.js +17 -0
  354. package/packtory/options/required-value-helpers.js.map +1 -1
  355. package/packtory/options/setting-resolvers.js +47 -3
  356. package/packtory/options/setting-resolvers.js.map +1 -1
  357. package/packtory/options/surface-resolution.js +15 -2
  358. package/packtory/options/surface-resolution.js.map +1 -1
  359. package/packtory/options/version-provider-context.js +24 -2
  360. package/packtory/options/version-provider-context.js.map +1 -1
  361. package/packtory/options/version-trigger.js +39 -2
  362. package/packtory/options/version-trigger.js.map +1 -1
  363. package/packtory/pack-output-preflight.js +60 -3
  364. package/packtory/pack-output-preflight.js.map +1 -1
  365. package/packtory/package-processor-build.js +97 -3
  366. package/packtory/package-processor-build.js.map +1 -1
  367. package/packtory/package-processor-publish.js +297 -6
  368. package/packtory/package-processor-publish.js.map +1 -1
  369. package/packtory/package-processor.js +10 -2
  370. package/packtory/package-processor.js.map +1 -1
  371. package/packtory/packtory-pack.js +298 -10
  372. package/packtory/packtory-pack.js.map +1 -1
  373. package/packtory/packtory-package-dependencies.js +116 -2
  374. package/packtory/packtory-package-dependencies.js.map +1 -1
  375. package/packtory/packtory-package-inspection.js +26 -5
  376. package/packtory/packtory-package-inspection.js.map +1 -1
  377. package/packtory/packtory-package-side-effects.js +64 -3
  378. package/packtory/packtory-package-side-effects.js.map +1 -1
  379. package/packtory/packtory-package-tree.js +43 -4
  380. package/packtory/packtory-package-tree.js.map +1 -1
  381. package/packtory/packtory-publish.js +17 -4
  382. package/packtory/packtory-publish.js.map +1 -1
  383. package/packtory/packtory-release-analysis.js +64 -6
  384. package/packtory/packtory-release-analysis.js.map +1 -1
  385. package/packtory/packtory-release-diff.js +48 -5
  386. package/packtory/packtory-release-diff.js.map +1 -1
  387. package/packtory/packtory-release-plan.js +87 -6
  388. package/packtory/packtory-release-plan.js.map +1 -1
  389. package/packtory/packtory-resolve.js +16 -5
  390. package/packtory/packtory-resolve.js.map +1 -1
  391. package/packtory/packtory.js +242 -13
  392. package/packtory/packtory.js.map +1 -1
  393. package/packtory/publish-failure-mapping.js +6 -0
  394. package/packtory/publish-failure-mapping.js.map +1 -1
  395. package/packtory/publish-target-preflight.js +25 -3
  396. package/packtory/publish-target-preflight.js.map +1 -1
  397. package/packtory/published-release-state.js +11 -0
  398. package/packtory/published-release-state.js.map +1 -1
  399. package/packtory/release-analysis.js +153 -5
  400. package/packtory/release-analysis.js.map +1 -1
  401. package/packtory/release-diff-failure-mapping.js +6 -0
  402. package/packtory/release-diff-failure-mapping.js.map +1 -1
  403. package/packtory/release-plan.js +135 -7
  404. package/packtory/release-plan.js.map +1 -1
  405. package/packtory/report-attachment.js +35 -2
  406. package/packtory/report-attachment.js.map +1 -1
  407. package/packtory/resolved-package.js +97 -3
  408. package/packtory/resolved-package.js.map +1 -1
  409. package/packtory/scheduler.js +99 -1
  410. package/packtory/scheduler.js.map +1 -1
  411. package/packtory/stages/package-analysis-stage.js +50 -2
  412. package/packtory/stages/package-analysis-stage.js.map +1 -1
  413. package/packtory/stages/package-resolution-stage.js +80 -5
  414. package/packtory/stages/package-resolution-stage.js.map +1 -1
  415. package/packtory/stages/publish-stage.js +125 -4
  416. package/packtory/stages/publish-stage.js.map +1 -1
  417. package/packtory/stages/release-diff-stage.js +84 -5
  418. package/packtory/stages/release-diff-stage.js.map +1 -1
  419. package/progress/progress-broadcaster.js +45 -0
  420. package/progress/progress-broadcaster.js.map +1 -1
  421. package/published-package/published-package.js +12 -1
  422. package/published-package/published-package.js.map +1 -1
  423. package/report/aggregator/artifact-entry-merger.js +20 -0
  424. package/report/aggregator/artifact-entry-merger.js.map +1 -1
  425. package/report/aggregator/package-report-materialization.js +75 -2
  426. package/report/aggregator/package-report-materialization.js.map +1 -1
  427. package/report/aggregator/report-aggregator.js +37 -2
  428. package/report/aggregator/report-aggregator.js.map +1 -1
  429. package/report/aggregator/report-event-handlers.js +141 -2
  430. package/report/aggregator/report-event-handlers.js.map +1 -1
  431. package/report/aggregator/report-types.js +3 -0
  432. package/report/aggregator/report-types.js.map +1 -1
  433. package/report/config-redactor.js +29 -3
  434. package/report/config-redactor.js.map +1 -1
  435. package/report/decorators.js +85 -0
  436. package/report/decorators.js.map +1 -1
  437. package/report/inspectors/inspect-artifact-sizes.js +34 -1
  438. package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
  439. package/report/inspectors/inspect-linker-rewrites.js +14 -1
  440. package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
  441. package/report/inspectors/inspect-package-json-provenance.js +15 -0
  442. package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
  443. package/report/inspectors/inspect-scan-results.js +15 -0
  444. package/report/inspectors/inspect-scan-results.js.map +1 -1
  445. package/report/release-diff/release-version-transition.js +18 -0
  446. package/report/release-diff/release-version-transition.js.map +1 -1
  447. package/resource-resolver/bundle-resource-lookup.js +25 -0
  448. package/resource-resolver/bundle-resource-lookup.js.map +1 -1
  449. package/resource-resolver/content.js +136 -4
  450. package/resource-resolver/content.js.map +1 -1
  451. package/resource-resolver/dependency-resolution-walker.js +73 -2
  452. package/resource-resolver/dependency-resolution-walker.js.map +1 -1
  453. package/resource-resolver/resolved-bundle.js +3 -0
  454. package/resource-resolver/resolved-bundle.js.map +1 -1
  455. package/resource-resolver/resource-resolve-options.js +13 -1
  456. package/resource-resolver/resource-resolve-options.js.map +1 -1
  457. package/resource-resolver/resource-resolver.js +128 -6
  458. package/resource-resolver/resource-resolver.js.map +1 -1
  459. package/sbom/extract-license.js +11 -1
  460. package/sbom/extract-license.js.map +1 -1
  461. package/sbom/license-resolver.js +23 -2
  462. package/sbom/license-resolver.js.map +1 -1
  463. package/sbom/sbom-builder.js +57 -2
  464. package/sbom/sbom-builder.js.map +1 -1
  465. package/sbom/sbom-canonicalizer.js +45 -3
  466. package/sbom/sbom-canonicalizer.js.map +1 -1
  467. package/sbom/sbom-file.js +54 -5
  468. package/sbom/sbom-file.js.map +1 -1
  469. package/sbom/sbom-serializer.js +14 -1
  470. package/sbom/sbom-serializer.js.map +1 -1
  471. package/sbom/tool-version.js +49 -1
  472. package/sbom/tool-version.js.map +1 -1
  473. package/sbom.cdx.json +10 -10
  474. package/tar/extract-tar.js +83 -3
  475. package/tar/extract-tar.js.map +1 -1
  476. package/tar/gzipped-pack.js +20 -0
  477. package/tar/gzipped-pack.js.map +1 -1
  478. package/tar/tarball-builder.js +44 -4
  479. package/tar/tarball-builder.js.map +1 -1
  480. package/vendor-materializer/vendor-entry.js +20 -1
  481. package/vendor-materializer/vendor-entry.js.map +1 -1
  482. package/vendor-materializer/vendor-materializer.js +240 -8
  483. package/vendor-materializer/vendor-materializer.js.map +1 -1
  484. package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
  485. package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
  486. package/version-manager/dependencies/dependency-groups.js +11 -1
  487. package/version-manager/dependencies/dependency-groups.js.map +1 -1
  488. package/version-manager/dependencies/external-dependency-classification.js +82 -3
  489. package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
  490. package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
  491. package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
  492. package/version-manager/imports/hash-import-scanner.js +20 -2
  493. package/version-manager/imports/hash-import-scanner.js.map +1 -1
  494. package/version-manager/imports/imports-key-matcher.js +22 -0
  495. package/version-manager/imports/imports-key-matcher.js.map +1 -1
  496. package/version-manager/imports/versioned-bundle-imports.js +44 -2
  497. package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
  498. package/version-manager/manager.js +46 -6
  499. package/version-manager/manager.js.map +1 -1
  500. package/version-manager/manifest/builder.js +51 -1
  501. package/version-manager/manifest/builder.js.map +1 -1
  502. package/version-manager/manifest/serialize.js +8 -1
  503. package/version-manager/manifest/serialize.js.map +1 -1
  504. package/version-manager/optional-bundle-fields.js +5 -1
  505. package/version-manager/optional-bundle-fields.js.map +1 -1
  506. package/version-manager/representative-root.js +9 -1
  507. package/version-manager/representative-root.js.map +1 -1
  508. package/version-manager/specifier-classifier.js +42 -2
  509. package/version-manager/specifier-classifier.js.map +1 -1
  510. package/version-manager/specifier-errors.js +58 -0
  511. package/version-manager/specifier-errors.js.map +1 -1
  512. package/version-manager/versioned-bundle.js +31 -6
  513. package/version-manager/versioned-bundle.js.map +1 -1
  514. package/zip/zip-builder.js +81 -2
  515. package/zip/zip-builder.js.map +1 -1
  516. package/dead-code-eliminator/liveness/external-module-resolution.js +0 -3
  517. package/dead-code-eliminator/liveness/external-module-resolution.js.map +0 -1
@@ -1,3 +1,74 @@
1
- import "../dependency-scanner/dependency-graph.js";
2
- import "./resource-resolve-options.js";
1
+ import { mergeDependencyFiles } from "../dependency-scanner/dependency-graph.js";
2
+ import { resolveRootsAndSurface } from "./resource-resolve-options.js";
3
+ function emptyDependencyFiles() {
4
+ return { externalDependencies: new Map(), localFiles: [] };
5
+ }
6
+ async function scanDeclarationGraph(dependencies, options, entryFiles, scannedDeclarationFiles) {
7
+ const pendingEntryFiles = entryFiles.filter(function (entryFile) {
8
+ return !scannedDeclarationFiles.has(entryFile);
9
+ });
10
+ if (pendingEntryFiles.length === 0) {
11
+ return emptyDependencyFiles();
12
+ }
13
+ pendingEntryFiles.forEach(function (entryFile) {
14
+ scannedDeclarationFiles.record(entryFile);
15
+ });
16
+ const declarationDependencyGraph = await dependencies.dependencyScanner.scanEntries(pendingEntryFiles, options.sourcesFolder, {
17
+ includeSourceMapFiles: options.includeSourceMapFiles,
18
+ resolveDeclarationFiles: true,
19
+ mainPackageJson: options.mainPackageJson
20
+ });
21
+ return pendingEntryFiles.reduce(function (result, entryFile) {
22
+ return mergeDependencyFiles(result, declarationDependencyGraph.flatten(entryFile));
23
+ }, emptyDependencyFiles());
24
+ }
25
+ function createDeclarationScanTracker() {
26
+ const scannedDeclarationFiles = new Set();
27
+ return {
28
+ has(filePath) {
29
+ return scannedDeclarationFiles.has(filePath);
30
+ },
31
+ record(filePath) {
32
+ scannedDeclarationFiles.add(filePath);
33
+ }
34
+ };
35
+ }
36
+ async function resolveJsDependencies(context, root) {
37
+ const { dependencies, options } = context;
38
+ const { sourcesFolder, includeSourceMapFiles, mainPackageJson } = options;
39
+ const jsDependencyGraph = await dependencies.dependencyScanner.scan(root.js, sourcesFolder, {
40
+ includeSourceMapFiles,
41
+ resolveDeclarationFiles: false,
42
+ mainPackageJson
43
+ });
44
+ return jsDependencyGraph.flatten(root.js);
45
+ }
46
+ async function resolveRootDeclarationDependencies(context, root) {
47
+ const entryFiles = [];
48
+ if (root.declarationFile !== undefined) {
49
+ entryFiles.push(root.declarationFile);
50
+ }
51
+ return scanDeclarationGraph(context.dependencies, context.options, entryFiles, context.scannedDeclarationFiles);
52
+ }
53
+ async function resolveDependenciesForRoot(context, root) {
54
+ const jsDependencies = await resolveJsDependencies(context, root);
55
+ const declarationDependencies = await resolveRootDeclarationDependencies(context, root);
56
+ return mergeDependencyFiles(jsDependencies, declarationDependencies);
57
+ }
58
+ export async function resolveDependenciesForAllRoots(dependencies, options, promotedDeclarationEntryFiles) {
59
+ const { roots } = resolveRootsAndSurface(options);
60
+ const rootValues = Object.values(roots);
61
+ const context = {
62
+ dependencies,
63
+ options,
64
+ scannedDeclarationFiles: createDeclarationScanTracker()
65
+ };
66
+ let dependencyFiles = emptyDependencyFiles();
67
+ for (const root of rootValues) {
68
+ dependencyFiles = mergeDependencyFiles(dependencyFiles, await resolveDependenciesForRoot(context, root));
69
+ }
70
+ const promotedDeclarationDependencies = await scanDeclarationGraph(dependencies, options, promotedDeclarationEntryFiles, context.scannedDeclarationFiles);
71
+ dependencyFiles = mergeDependencyFiles(dependencyFiles, promotedDeclarationDependencies);
72
+ return dependencyFiles;
73
+ }
3
74
  //# sourceMappingURL=dependency-resolution-walker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependency-resolution-walker.js","sourceRoot":"","sources":["../../../../source/resource-resolver/dependency-resolution-walker.ts"],"names":[],"mappings":"AAAA,OAA2D,2CAA2C,CAAC;AAGvG,OAIO,+BAA+B,CAAC"}
1
+ {"version":3,"file":"dependency-resolution-walker.js","sourceRoot":"","sources":["../../../../source/resource-resolver/dependency-resolution-walker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAwB,MAAM,2CAA2C,CAAC;AAGvG,OAAO,EAEH,sBAAsB,EAEzB,MAAM,+BAA+B,CAAC;AAiBvC,SAAS,oBAAoB;IACzB,OAAO,EAAE,oBAAoB,EAAE,IAAI,GAAG,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;AAC/D,CAAC;AAED,KAAK,UAAU,oBAAoB,CAC/B,YAA8C,EAC9C,OAA+B,EAC/B,UAA6B,EAC7B,uBAA+C;IAE/C,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,SAAS;QAC3D,OAAO,CAAC,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AAI,IAAI,UAAU,EAAE,CAAC;QAC5B,eAAe,GAAG,oBAAoB,CAAC,eAAe,EAAE,MAAM,0BAA0B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7G,CAAC;IAED,MAAM,+BAA+B,GAAG,MAAM,oBAAoB,CAC9D,YAAY,EACZ,OAAO,EACP,6BAA6B,EAC7B,OAAO,CAAC,uBAAuB,CAClC,CAAC;IAEF,eAAe,GAAG,oBAAoB,CAAC,eAAe,EAAE,+BAA+B,CAAC,CAAC;IAEzF,OAAO,eAAe,CAAC;AAC3B,CAAC"}
@@ -1 +1,4 @@
1
+ export function rootHasDeclarationFile(root) {
2
+ return root.declarationFile !== undefined;
3
+ }
1
4
  //# sourceMappingURL=resolved-bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolved-bundle.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resolved-bundle.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"resolved-bundle.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resolved-bundle.ts"],"names":[],"mappings":"AA2EA,MAAM,UAAU,sBAAsB,CAClC,IAAyB;IAEzB,OAAO,IAAI,CAAC,eAAe,KAAK,SAAS,CAAC;AAC9C,CAAC"}
@@ -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"}
@@ -1,7 +1,129 @@
1
- import "../dependency-scanner/external-dependencies.js";
2
- import "../common/declaration-companion-paths.js";
3
- import "./content.js";
4
- import "./bundle-resource-lookup.js";
5
- import "./dependency-resolution-walker.js";
6
- 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
+ }
7
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":"AACA,OAKO,gDAAgD,CAAC;AAExD,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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EAAE,UAAU,CAAC,oBAAoB;gBACrD,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;aACzE,CAAC;QACN,CAAC,CAAC,CACL,CAAC;QAEF,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAC1D,OAAO;YACH,QAAQ;YACR,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,oBAAoB,EAAE,mCAAmC,CACrD,oBAAoB,CAAC,oBAAoB,EACzC,iBAAiB,CACpB;YACD,KAAK,EAAE,kBAAkB,CAAC,UAAU,EAAE,QAAQ,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"}
@@ -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,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,IAAI,EAAE;QACjF,OAAO,EAAE,aAAa,CAAC,OAAO;QAC9B,MAAM,EAAE,IAAI;QACZ,IAAI;KACP,CAAC,CAAC;AACP,CAAC;AAED,SAAS,wBAAwB,CAAC,UAA0B;IACxD,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,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AC;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,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAe;IACzC,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO;IACX,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC,OAAO,CAAC;QACzB,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAe;IAC5C,IAAI,CAAC;QACD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5C,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC7B,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,OAAO,CAAC;IACnB,CAAC;AACL,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,KAAiC;IACvE,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,IAAI;QAC3B,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,oBAAoB,EAAE,CAAC;YAC7D,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC"}
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":"s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,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"}
@@ -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,CAAC;AAQvE,SAAS,wBAAwB;IAC7B,MAAM,KAAK,GAAG,+FAA+F,CAAC;IAC9G,OAAO,GAAG,KAAK,4DAA4D,CAAC;AAChF,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAc;IAC1C,OAAO,KAAK,KAAK,eAAe,IAAI,KAAK,KAAK,UAAU,CAAC;AAC7D,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAc;IAC3C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,IAAI,KAAK,sBAAsB,IAAI,IAAI,KAAK,+BAA+B,CAAC;AACvF,CAAC;AAED,SAAS,gBAAgB,CAAC,cAAuB;IAC7C,IAAI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