packtory 0.0.96 → 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 (662) 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.js +6 -2
  148. package/config/additional-files.js.map +1 -1
  149. package/config/additional-package-json-attributes-schema.js +6 -2
  150. package/config/additional-package-json-attributes-schema.js.map +1 -1
  151. package/config/automatic-versioning-settings.js +6 -2
  152. package/config/automatic-versioning-settings.js.map +1 -1
  153. package/config/changelog-settings.d.ts +44 -0
  154. package/config/changelog-settings.d.ts.map +1 -1
  155. package/config/changelog-settings.js +120 -3
  156. package/config/changelog-settings.js.map +1 -1
  157. package/config/common-package-settings-schemas.js +19 -3
  158. package/config/common-package-settings-schemas.js.map +1 -1
  159. package/config/config.d.ts +6 -1
  160. package/config/config.d.ts.map +1 -1
  161. package/config/config.js +3 -1
  162. package/config/config.js.map +1 -1
  163. package/config/cross-package-validation.js +17 -0
  164. package/config/cross-package-validation.js.map +1 -1
  165. package/config/dead-code-elimination-settings.d.ts +1 -0
  166. package/config/dead-code-elimination-settings.d.ts.map +1 -1
  167. package/config/dead-code-elimination-settings.js +36 -2
  168. package/config/dead-code-elimination-settings.js.map +1 -1
  169. package/config/dependency-existence-validation.js +19 -1
  170. package/config/dependency-existence-validation.js.map +1 -1
  171. package/config/dependency-policy.js +5 -2
  172. package/config/dependency-policy.js.map +1 -1
  173. package/config/main-package-json-schema.js +13 -2
  174. package/config/main-package-json-schema.js.map +1 -1
  175. package/config/manual-versioning-settings.d.ts +12 -0
  176. package/config/manual-versioning-settings.d.ts.map +1 -1
  177. package/config/manual-versioning-settings.js +29 -2
  178. package/config/manual-versioning-settings.js.map +1 -1
  179. package/config/optional-package-settings-schema.js +16 -7
  180. package/config/optional-package-settings-schema.js.map +1 -1
  181. package/config/package-config.d.ts +4 -0
  182. package/config/package-config.d.ts.map +1 -1
  183. package/config/package-config.js +2 -1
  184. package/config/package-config.js.map +1 -1
  185. package/config/package-graph-builder.js +14 -2
  186. package/config/package-graph-builder.js.map +1 -1
  187. package/config/package-interface.js +25 -2
  188. package/config/package-interface.js.map +1 -1
  189. package/config/package-json.d.ts +2 -0
  190. package/config/package-json.d.ts.map +1 -1
  191. package/config/package-json.js +16 -0
  192. package/config/package-json.js.map +1 -1
  193. package/config/packtory-config-without-registry-schema.js +6 -0
  194. package/config/packtory-config-without-registry-schema.js.map +1 -1
  195. package/config/per-package-settings-schema.js +22 -6
  196. package/config/per-package-settings-schema.js.map +1 -1
  197. package/config/pre-graph-validation.js +20 -5
  198. package/config/pre-graph-validation.js.map +1 -1
  199. package/config/publish-settings.d.ts +3 -0
  200. package/config/publish-settings.d.ts.map +1 -1
  201. package/config/publish-settings.js +25 -3
  202. package/config/publish-settings.js.map +1 -1
  203. package/config/publish-settings.report.js +17 -1
  204. package/config/publish-settings.report.js.map +1 -1
  205. package/config/registry-settings.d.ts +41 -0
  206. package/config/registry-settings.d.ts.map +1 -1
  207. package/config/registry-settings.js +40 -2
  208. package/config/registry-settings.js.map +1 -1
  209. package/config/registry-settings.report.js +46 -0
  210. package/config/registry-settings.report.js.map +1 -1
  211. package/config/root-config-validation.js +141 -0
  212. package/config/root-config-validation.js.map +1 -1
  213. package/config/root.js +6 -2
  214. package/config/root.js.map +1 -1
  215. package/config/sbom-settings.js +4 -1
  216. package/config/sbom-settings.js.map +1 -1
  217. package/config/settings-validation.js +28 -0
  218. package/config/settings-validation.js.map +1 -1
  219. package/config/versioning-settings.d.ts +18 -1
  220. package/config/versioning-settings.d.ts.map +1 -1
  221. package/config/versioning-settings.js +10 -3
  222. package/config/versioning-settings.js.map +1 -1
  223. package/dead-code-eliminator/analyzed-bundle.d.ts +11 -0
  224. package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
  225. package/dead-code-eliminator/analyzed-bundle.js +7 -0
  226. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  227. package/dead-code-eliminator/bundle-analysis.js +38 -5
  228. package/dead-code-eliminator/bundle-analysis.js.map +1 -1
  229. package/dead-code-eliminator/class-purity.js +48 -2
  230. package/dead-code-eliminator/class-purity.js.map +1 -1
  231. package/dead-code-eliminator/code-file-analyzer.js +68 -4
  232. package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
  233. package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -0
  234. package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
  235. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
  236. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
  237. package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -3
  238. package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
  239. package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
  240. package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
  241. package/dead-code-eliminator/dependency-metadata.js +172 -2
  242. package/dead-code-eliminator/dependency-metadata.js.map +1 -1
  243. package/dead-code-eliminator/elimination-emitter.js +52 -0
  244. package/dead-code-eliminator/elimination-emitter.js.map +1 -1
  245. package/dead-code-eliminator/eliminator.js +22 -4
  246. package/dead-code-eliminator/eliminator.js.map +1 -1
  247. package/dead-code-eliminator/expression-unwrapping.js +16 -1
  248. package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
  249. package/dead-code-eliminator/imported-expression-origin.js +101 -2
  250. package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
  251. package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
  252. package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
  253. package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
  254. package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
  255. package/dead-code-eliminator/liveness/external-module-resolution.js +172 -2
  256. package/dead-code-eliminator/liveness/external-module-resolution.js.map +1 -1
  257. package/dead-code-eliminator/liveness/external-purity-summary.js +294 -3
  258. package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
  259. package/dead-code-eliminator/liveness/external-purity.js +39 -3
  260. package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
  261. package/dead-code-eliminator/liveness/module-analysis.js +27 -2
  262. package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
  263. package/dead-code-eliminator/liveness/resource-retention.js +91 -1
  264. package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
  265. package/dead-code-eliminator/liveness/runtime-code.js +15 -1
  266. package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
  267. package/dead-code-eliminator/load-bundle.js +86 -5
  268. package/dead-code-eliminator/load-bundle.js.map +1 -1
  269. package/dead-code-eliminator/pure-expression.js +178 -5
  270. package/dead-code-eliminator/pure-expression.js.map +1 -1
  271. package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
  272. package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
  273. package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
  274. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  275. package/dead-code-eliminator/reachability/binding-id.js +106 -1
  276. package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
  277. package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -1
  278. package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
  279. package/dead-code-eliminator/reachability/impure-statements.js +11 -2
  280. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  281. package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
  282. package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
  283. package/dead-code-eliminator/reachability/reachability.js +65 -4
  284. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  285. package/dead-code-eliminator/side-effect-classifier.js +39 -4
  286. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  287. package/dead-code-eliminator/side-effects-field.js +23 -1
  288. package/dead-code-eliminator/side-effects-field.js.map +1 -1
  289. package/dead-code-eliminator/source-map-recomposition.js +29 -2
  290. package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
  291. package/dead-code-eliminator/statement-classifiers.js +94 -4
  292. package/dead-code-eliminator/statement-classifiers.js.map +1 -1
  293. package/dead-code-eliminator/syntax-kind-sets.js +16 -0
  294. package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
  295. package/dead-code-eliminator/transform/atom-translator.d.ts +8 -0
  296. package/dead-code-eliminator/transform/atom-translator.d.ts.map +1 -1
  297. package/dead-code-eliminator/transform/atom-translator.js +57 -2
  298. package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
  299. package/dead-code-eliminator/transform/declaration-removal.js +183 -5
  300. package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
  301. package/dead-code-eliminator/transform/declaration-remover.js +17 -2
  302. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  303. package/dead-code-eliminator/transform/line-index.d.ts +7 -0
  304. package/dead-code-eliminator/transform/line-index.d.ts.map +1 -1
  305. package/dead-code-eliminator/transform/line-index.js +20 -0
  306. package/dead-code-eliminator/transform/line-index.js.map +1 -1
  307. package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
  308. package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
  309. package/dead-code-eliminator/transform/source-map-composer.js +84 -3
  310. package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
  311. package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
  312. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
  313. package/dependency-scanner/dependency-graph.d.ts +41 -0
  314. package/dependency-scanner/dependency-graph.d.ts.map +1 -0
  315. package/dependency-scanner/dependency-graph.js +77 -3
  316. package/dependency-scanner/dependency-graph.js.map +1 -1
  317. package/dependency-scanner/external-dependencies.d.ts +9 -0
  318. package/dependency-scanner/external-dependencies.d.ts.map +1 -1
  319. package/dependency-scanner/external-dependencies.js +55 -1
  320. package/dependency-scanner/external-dependencies.js.map +1 -1
  321. package/dependency-scanner/file-host-predicates.js +9 -0
  322. package/dependency-scanner/file-host-predicates.js.map +1 -1
  323. package/dependency-scanner/host-method-binding.js +18 -0
  324. package/dependency-scanner/host-method-binding.js.map +1 -1
  325. package/dependency-scanner/injected-dynamic-imports.js +232 -1
  326. package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
  327. package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
  328. package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
  329. package/dependency-scanner/package-owned-asset-file-path.js +9 -1
  330. package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
  331. package/dependency-scanner/scanner.d.ts +20 -0
  332. package/dependency-scanner/scanner.d.ts.map +1 -0
  333. package/dependency-scanner/scanner.js +109 -4
  334. package/dependency-scanner/scanner.js.map +1 -1
  335. package/dependency-scanner/source-file-references.d.ts +37 -0
  336. package/dependency-scanner/source-file-references.d.ts.map +1 -0
  337. package/dependency-scanner/source-file-references.js +181 -6
  338. package/dependency-scanner/source-file-references.js.map +1 -1
  339. package/dependency-scanner/source-map-file-locator.d.ts +10 -0
  340. package/dependency-scanner/source-map-file-locator.d.ts.map +1 -0
  341. package/dependency-scanner/source-map-file-locator.js +66 -2
  342. package/dependency-scanner/source-map-file-locator.js.map +1 -1
  343. package/dependency-scanner/typescript-compiler-options.d.ts +8 -0
  344. package/dependency-scanner/typescript-compiler-options.d.ts.map +1 -0
  345. package/dependency-scanner/typescript-compiler-options.js +21 -1
  346. package/dependency-scanner/typescript-compiler-options.js.map +1 -1
  347. package/dependency-scanner/typescript-file-host.d.ts +12 -0
  348. package/dependency-scanner/typescript-file-host.d.ts.map +1 -0
  349. package/dependency-scanner/typescript-file-host.js +49 -5
  350. package/dependency-scanner/typescript-file-host.js.map +1 -1
  351. package/dependency-scanner/typescript-project-analyzer.d.ts +19 -0
  352. package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -0
  353. package/dependency-scanner/typescript-project-analyzer.js +35 -3
  354. package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
  355. package/dependency-scanner/virtual-package-json-host.js +45 -4
  356. package/dependency-scanner/virtual-package-json-host.js.map +1 -1
  357. package/directed-graph/graph.d.ts +1 -0
  358. package/directed-graph/graph.d.ts.map +1 -1
  359. package/directed-graph/graph.js +240 -1
  360. package/directed-graph/graph.js.map +1 -1
  361. package/file-manager/compare.js +23 -2
  362. package/file-manager/compare.js.map +1 -1
  363. package/file-manager/equal.js +5 -0
  364. package/file-manager/equal.js.map +1 -1
  365. package/file-manager/file-description.d.ts +1 -0
  366. package/file-manager/file-description.d.ts.map +1 -1
  367. package/file-manager/file-description.js +3 -0
  368. package/file-manager/file-description.js.map +1 -1
  369. package/file-manager/permissions.js +28 -1
  370. package/file-manager/permissions.js.map +1 -1
  371. package/git/current-git-head.d.ts +12 -0
  372. package/git/current-git-head.d.ts.map +1 -0
  373. package/git/current-git-head.js +24 -0
  374. package/git/current-git-head.js.map +1 -1
  375. package/git/git-command.js +49 -1
  376. package/git/git-command.js.map +1 -1
  377. package/linker/linked-bundle.d.ts +8 -0
  378. package/linker/linked-bundle.d.ts.map +1 -1
  379. package/linker/linked-bundle.js +5 -0
  380. package/linker/linked-bundle.js.map +1 -1
  381. package/linker/linker.d.ts +13 -0
  382. package/linker/linker.d.ts.map +1 -0
  383. package/linker/linker.js +51 -5
  384. package/linker/linker.js.map +1 -1
  385. package/linker/replacement-lookup.js +297 -8
  386. package/linker/replacement-lookup.js.map +1 -1
  387. package/linker/resource-graph.js +65 -2
  388. package/linker/resource-graph.js.map +1 -1
  389. package/linker/source-modifier/import-paths.js +76 -3
  390. package/linker/source-modifier/import-paths.js.map +1 -1
  391. package/linker/substitute-bundles.js +166 -3
  392. package/linker/substitute-bundles.js.map +1 -1
  393. package/linker/substituted-resource-graph.js +111 -2
  394. package/linker/substituted-resource-graph.js.map +1 -1
  395. package/npm-oidc-id-token-resolver.js +82 -0
  396. package/npm-oidc-id-token-resolver.js.map +1 -1
  397. package/pack-emitter/pack-emitter.d.ts +20 -0
  398. package/pack-emitter/pack-emitter.d.ts.map +1 -1
  399. package/pack-emitter/pack-emitter.js +27 -0
  400. package/pack-emitter/pack-emitter.js.map +1 -1
  401. package/package-surface/bin-field.js +8 -2
  402. package/package-surface/bin-field.js.map +1 -1
  403. package/package-surface/explicit-bin.js +24 -2
  404. package/package-surface/explicit-bin.js.map +1 -1
  405. package/package-surface/explicit-exports.js +26 -3
  406. package/package-surface/explicit-exports.js.map +1 -1
  407. package/package-surface/export-map.js +9 -2
  408. package/package-surface/export-map.js.map +1 -1
  409. package/package-surface/implicit-bin.js +25 -1
  410. package/package-surface/implicit-bin.js.map +1 -1
  411. package/package-surface/implicit-exports.js +10 -3
  412. package/package-surface/implicit-exports.js.map +1 -1
  413. package/package-surface/implicit-root-exports.js +13 -2
  414. package/package-surface/implicit-root-exports.js.map +1 -1
  415. package/package-surface/package-json-export.js +9 -0
  416. package/package-surface/package-json-export.js.map +1 -1
  417. package/package-surface/package-shape.js +10 -1
  418. package/package-surface/package-shape.js.map +1 -1
  419. package/package-surface/package-surface-index.js +165 -3
  420. package/package-surface/package-surface-index.js.map +1 -1
  421. package/package-surface/public-module-usage.js +46 -3
  422. package/package-surface/public-module-usage.js.map +1 -1
  423. package/package-surface/public-specifiers.js +7 -1
  424. package/package-surface/public-specifiers.js.map +1 -1
  425. package/package-surface/root-registry.js +26 -0
  426. package/package-surface/root-registry.js.map +1 -1
  427. package/package-surface/specifier-syntax.js +4 -0
  428. package/package-surface/specifier-syntax.js.map +1 -1
  429. package/package-surface/substitution-exports.js +101 -3
  430. package/package-surface/substitution-exports.js.map +1 -1
  431. package/package-surface/surface.d.ts +2 -0
  432. package/package-surface/surface.d.ts.map +1 -1
  433. package/package-surface/surface.js +12 -0
  434. package/package-surface/surface.js.map +1 -1
  435. package/package.json +1 -1
  436. package/packages/package-processor.composition.d.ts +22 -0
  437. package/packages/package-processor.composition.d.ts.map +1 -1
  438. package/packages/package-processor.composition.js +161 -34
  439. package/packages/package-processor.composition.js.map +1 -1
  440. package/packtory/map-config.d.ts +11 -1
  441. package/packtory/map-config.d.ts.map +1 -1
  442. package/packtory/map-config.js +35 -4
  443. package/packtory/map-config.js.map +1 -1
  444. package/packtory/normalize-paths.js +25 -1
  445. package/packtory/normalize-paths.js.map +1 -1
  446. package/packtory/options/bundle-dependency-resolution.js +17 -1
  447. package/packtory/options/bundle-dependency-resolution.js.map +1 -1
  448. package/packtory/options/dead-code-elimination-resolution.js +10 -1
  449. package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
  450. package/packtory/options/prepare-package-options.d.ts +13 -1
  451. package/packtory/options/prepare-package-options.d.ts.map +1 -1
  452. package/packtory/options/prepare-package-options.js +46 -5
  453. package/packtory/options/prepare-package-options.js.map +1 -1
  454. package/packtory/options/required-value-helpers.js +17 -0
  455. package/packtory/options/required-value-helpers.js.map +1 -1
  456. package/packtory/options/setting-resolvers.d.ts +17 -1
  457. package/packtory/options/setting-resolvers.d.ts.map +1 -1
  458. package/packtory/options/setting-resolvers.js +47 -3
  459. package/packtory/options/setting-resolvers.js.map +1 -1
  460. package/packtory/options/surface-resolution.js +15 -2
  461. package/packtory/options/surface-resolution.js.map +1 -1
  462. package/packtory/options/version-provider-context.js +24 -2
  463. package/packtory/options/version-provider-context.js.map +1 -1
  464. package/packtory/options/version-trigger.js +39 -2
  465. package/packtory/options/version-trigger.js.map +1 -1
  466. package/packtory/pack-output-preflight.js +60 -3
  467. package/packtory/pack-output-preflight.js.map +1 -1
  468. package/packtory/package-processor-build.js +97 -3
  469. package/packtory/package-processor-build.js.map +1 -1
  470. package/packtory/package-processor-publish-result.d.ts +3 -0
  471. package/packtory/package-processor-publish-result.d.ts.map +1 -1
  472. package/packtory/package-processor-publish.d.ts +2 -0
  473. package/packtory/package-processor-publish.d.ts.map +1 -1
  474. package/packtory/package-processor-publish.js +297 -6
  475. package/packtory/package-processor-publish.js.map +1 -1
  476. package/packtory/package-processor.d.ts +34 -0
  477. package/packtory/package-processor.d.ts.map +1 -1
  478. package/packtory/package-processor.js +10 -2
  479. package/packtory/package-processor.js.map +1 -1
  480. package/packtory/packtory-pack.js +298 -10
  481. package/packtory/packtory-pack.js.map +1 -1
  482. package/packtory/packtory-package-dependencies.js +116 -2
  483. package/packtory/packtory-package-dependencies.js.map +1 -1
  484. package/packtory/packtory-package-inspection.js +26 -5
  485. package/packtory/packtory-package-inspection.js.map +1 -1
  486. package/packtory/packtory-package-side-effects.js +64 -3
  487. package/packtory/packtory-package-side-effects.js.map +1 -1
  488. package/packtory/packtory-package-tree.js +43 -4
  489. package/packtory/packtory-package-tree.js.map +1 -1
  490. package/packtory/packtory-publish.js +17 -4
  491. package/packtory/packtory-publish.js.map +1 -1
  492. package/packtory/packtory-release-analysis.js +64 -6
  493. package/packtory/packtory-release-analysis.js.map +1 -1
  494. package/packtory/packtory-release-diff.js +48 -5
  495. package/packtory/packtory-release-diff.js.map +1 -1
  496. package/packtory/packtory-release-plan.js +87 -6
  497. package/packtory/packtory-release-plan.js.map +1 -1
  498. package/packtory/packtory-resolve.js +16 -5
  499. package/packtory/packtory-resolve.js.map +1 -1
  500. package/packtory/packtory.d.ts +28 -1
  501. package/packtory/packtory.d.ts.map +1 -1
  502. package/packtory/packtory.js +242 -13
  503. package/packtory/packtory.js.map +1 -1
  504. package/packtory/publish-failure-mapping.js +6 -0
  505. package/packtory/publish-failure-mapping.js.map +1 -1
  506. package/packtory/publish-target-preflight.js +25 -3
  507. package/packtory/publish-target-preflight.js.map +1 -1
  508. package/packtory/published-release-state.d.ts +19 -0
  509. package/packtory/published-release-state.d.ts.map +1 -1
  510. package/packtory/published-release-state.js +11 -0
  511. package/packtory/published-release-state.js.map +1 -1
  512. package/packtory/release-analysis.js +153 -5
  513. package/packtory/release-analysis.js.map +1 -1
  514. package/packtory/release-diff-failure-mapping.js +6 -0
  515. package/packtory/release-diff-failure-mapping.js.map +1 -1
  516. package/packtory/release-plan.js +135 -7
  517. package/packtory/release-plan.js.map +1 -1
  518. package/packtory/report-attachment.js +35 -2
  519. package/packtory/report-attachment.js.map +1 -1
  520. package/packtory/resolved-package.d.ts +11 -0
  521. package/packtory/resolved-package.d.ts.map +1 -1
  522. package/packtory/resolved-package.js +97 -3
  523. package/packtory/resolved-package.js.map +1 -1
  524. package/packtory/scheduler.d.ts +47 -0
  525. package/packtory/scheduler.d.ts.map +1 -1
  526. package/packtory/scheduler.js +99 -1
  527. package/packtory/scheduler.js.map +1 -1
  528. package/packtory/stages/package-analysis-stage.js +50 -2
  529. package/packtory/stages/package-analysis-stage.js.map +1 -1
  530. package/packtory/stages/package-resolution-stage.js +80 -5
  531. package/packtory/stages/package-resolution-stage.js.map +1 -1
  532. package/packtory/stages/publish-stage.js +125 -4
  533. package/packtory/stages/publish-stage.js.map +1 -1
  534. package/packtory/stages/release-diff-stage.js +84 -5
  535. package/packtory/stages/release-diff-stage.js.map +1 -1
  536. package/progress/progress-broadcaster.d.ts +1 -0
  537. package/progress/progress-broadcaster.d.ts.map +1 -1
  538. package/progress/progress-broadcaster.js +45 -0
  539. package/progress/progress-broadcaster.js.map +1 -1
  540. package/published-package/published-package.d.ts +2 -0
  541. package/published-package/published-package.d.ts.map +1 -1
  542. package/published-package/published-package.js +12 -1
  543. package/published-package/published-package.js.map +1 -1
  544. package/report/aggregator/artifact-entry-merger.js +20 -0
  545. package/report/aggregator/artifact-entry-merger.js.map +1 -1
  546. package/report/aggregator/package-report-materialization.js +75 -2
  547. package/report/aggregator/package-report-materialization.js.map +1 -1
  548. package/report/aggregator/report-aggregator.js +37 -2
  549. package/report/aggregator/report-aggregator.js.map +1 -1
  550. package/report/aggregator/report-event-handlers.js +141 -2
  551. package/report/aggregator/report-event-handlers.js.map +1 -1
  552. package/report/aggregator/report-types.d.ts +21 -0
  553. package/report/aggregator/report-types.d.ts.map +1 -1
  554. package/report/aggregator/report-types.js +3 -0
  555. package/report/aggregator/report-types.js.map +1 -1
  556. package/report/config-redactor.js +29 -3
  557. package/report/config-redactor.js.map +1 -1
  558. package/report/decorators.js +85 -0
  559. package/report/decorators.js.map +1 -1
  560. package/report/inspectors/inspect-artifact-sizes.js +34 -1
  561. package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
  562. package/report/inspectors/inspect-linker-rewrites.js +14 -1
  563. package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
  564. package/report/inspectors/inspect-package-json-provenance.js +15 -0
  565. package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
  566. package/report/inspectors/inspect-scan-results.js +15 -0
  567. package/report/inspectors/inspect-scan-results.js.map +1 -1
  568. package/report/release-diff/release-version-transition.js +18 -0
  569. package/report/release-diff/release-version-transition.js.map +1 -1
  570. package/resource-resolver/bundle-resource-lookup.js +25 -0
  571. package/resource-resolver/bundle-resource-lookup.js.map +1 -1
  572. package/resource-resolver/content.js +136 -4
  573. package/resource-resolver/content.js.map +1 -1
  574. package/resource-resolver/dependency-resolution-walker.js +73 -2
  575. package/resource-resolver/dependency-resolution-walker.js.map +1 -1
  576. package/resource-resolver/resolved-bundle.d.ts +17 -0
  577. package/resource-resolver/resolved-bundle.d.ts.map +1 -1
  578. package/resource-resolver/resolved-bundle.js +3 -0
  579. package/resource-resolver/resolved-bundle.js.map +1 -1
  580. package/resource-resolver/resource-resolve-options.d.ts +5 -0
  581. package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
  582. package/resource-resolver/resource-resolve-options.js +13 -1
  583. package/resource-resolver/resource-resolve-options.js.map +1 -1
  584. package/resource-resolver/resource-resolver.d.ts +15 -0
  585. package/resource-resolver/resource-resolver.d.ts.map +1 -0
  586. package/resource-resolver/resource-resolver.js +128 -6
  587. package/resource-resolver/resource-resolver.js.map +1 -1
  588. package/sbom/extract-license.js +11 -1
  589. package/sbom/extract-license.js.map +1 -1
  590. package/sbom/license-resolver.d.ts +14 -0
  591. package/sbom/license-resolver.d.ts.map +1 -0
  592. package/sbom/license-resolver.js +23 -2
  593. package/sbom/license-resolver.js.map +1 -1
  594. package/sbom/sbom-builder.js +57 -2
  595. package/sbom/sbom-builder.js.map +1 -1
  596. package/sbom/sbom-canonicalizer.js +45 -3
  597. package/sbom/sbom-canonicalizer.js.map +1 -1
  598. package/sbom/sbom-file.d.ts +10 -0
  599. package/sbom/sbom-file.d.ts.map +1 -1
  600. package/sbom/sbom-file.js +54 -5
  601. package/sbom/sbom-file.js.map +1 -1
  602. package/sbom/sbom-serializer.d.ts +8 -0
  603. package/sbom/sbom-serializer.d.ts.map +1 -0
  604. package/sbom/sbom-serializer.js +14 -1
  605. package/sbom/sbom-serializer.js.map +1 -1
  606. package/sbom/tool-version.js +49 -1
  607. package/sbom/tool-version.js.map +1 -1
  608. package/sbom.cdx.json +5 -5
  609. package/tar/extract-tar.js +83 -3
  610. package/tar/extract-tar.js.map +1 -1
  611. package/tar/gzipped-pack.js +20 -0
  612. package/tar/gzipped-pack.js.map +1 -1
  613. package/tar/tarball-builder.d.ts +14 -0
  614. package/tar/tarball-builder.d.ts.map +1 -0
  615. package/tar/tarball-builder.js +44 -4
  616. package/tar/tarball-builder.js.map +1 -1
  617. package/vendor-materializer/vendor-entry.d.ts +12 -0
  618. package/vendor-materializer/vendor-entry.d.ts.map +1 -0
  619. package/vendor-materializer/vendor-entry.js +20 -1
  620. package/vendor-materializer/vendor-entry.js.map +1 -1
  621. package/vendor-materializer/vendor-materializer.d.ts +55 -0
  622. package/vendor-materializer/vendor-materializer.d.ts.map +1 -0
  623. package/vendor-materializer/vendor-materializer.js +240 -8
  624. package/vendor-materializer/vendor-materializer.js.map +1 -1
  625. package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
  626. package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
  627. package/version-manager/dependencies/dependency-groups.js +11 -1
  628. package/version-manager/dependencies/dependency-groups.js.map +1 -1
  629. package/version-manager/dependencies/external-dependency-classification.js +82 -3
  630. package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
  631. package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
  632. package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
  633. package/version-manager/imports/hash-import-scanner.js +20 -2
  634. package/version-manager/imports/hash-import-scanner.js.map +1 -1
  635. package/version-manager/imports/imports-key-matcher.js +22 -0
  636. package/version-manager/imports/imports-key-matcher.js.map +1 -1
  637. package/version-manager/imports/versioned-bundle-imports.js +44 -2
  638. package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
  639. package/version-manager/manager.d.ts +5 -0
  640. package/version-manager/manager.d.ts.map +1 -1
  641. package/version-manager/manager.js +46 -6
  642. package/version-manager/manager.js.map +1 -1
  643. package/version-manager/manifest/builder.js +51 -1
  644. package/version-manager/manifest/builder.js.map +1 -1
  645. package/version-manager/manifest/serialize.js +8 -1
  646. package/version-manager/manifest/serialize.js.map +1 -1
  647. package/version-manager/optional-bundle-fields.js +5 -1
  648. package/version-manager/optional-bundle-fields.js.map +1 -1
  649. package/version-manager/representative-root.js +9 -1
  650. package/version-manager/representative-root.js.map +1 -1
  651. package/version-manager/specifier-classifier.js +42 -2
  652. package/version-manager/specifier-classifier.js.map +1 -1
  653. package/version-manager/specifier-errors.js +58 -0
  654. package/version-manager/specifier-errors.js.map +1 -1
  655. package/version-manager/versioned-bundle.d.ts +3 -1
  656. package/version-manager/versioned-bundle.d.ts.map +1 -1
  657. package/version-manager/versioned-bundle.js +31 -6
  658. package/version-manager/versioned-bundle.js.map +1 -1
  659. package/zip/zip-builder.d.ts +22 -0
  660. package/zip/zip-builder.d.ts.map +1 -0
  661. package/zip/zip-builder.js +81 -2
  662. package/zip/zip-builder.js.map +1 -1
@@ -1,5 +1,137 @@
1
- import 'node:path';
2
- import "../common/code-files.js";
3
- import "../common/package-layout.js";
4
- import "../dependency-scanner/source-file-references.js";
1
+ import path from 'node:path';
2
+ import { isCodeFile } from "../common/code-files.js";
3
+ import { packageManifestFilePath } from "../common/package-layout.js";
4
+ import { moduleReferenceKind } from "../dependency-scanner/source-file-references.js";
5
+ function prependSourcesFolderIfNecessary(sourcesFolder, filePath) {
6
+ if (!path.isAbsolute(filePath)) {
7
+ return path.join(sourcesFolder, filePath);
8
+ }
9
+ return filePath;
10
+ }
11
+ function rejectCodeFile(targetFilePath) {
12
+ if (isCodeFile(targetFilePath)) {
13
+ const errorMessage = [
14
+ `additionalFiles must not include code files; received "${targetFilePath}".`,
15
+ 'Code that should ship in the bundle must be reachable from a root so',
16
+ 'dependency, side-effect and dead-code analyses can run on it.',
17
+ 'If you intend to ship code as a static asset (e.g. a template),',
18
+ 'use a non-code extension like .txt.'
19
+ ]
20
+ .join(' ');
21
+ throw new Error(errorMessage);
22
+ }
23
+ }
24
+ function rejectGeneratedManifestTarget(targetFilePath) {
25
+ if (targetFilePath === packageManifestFilePath) {
26
+ throw new Error(`additionalFiles must not target generated package manifest "${packageManifestFilePath}".`);
27
+ }
28
+ }
29
+ function rejectAdditionalFileTarget(targetFilePath) {
30
+ rejectGeneratedManifestTarget(targetFilePath);
31
+ rejectCodeFile(targetFilePath);
32
+ }
33
+ function toSourceRelativeTargetPath(sourcesFolder, filePath) {
34
+ const targetFilePath = path.relative(sourcesFolder, filePath);
35
+ if (targetFilePath === packageManifestFilePath ||
36
+ targetFilePath.startsWith('..') ||
37
+ path.isAbsolute(targetFilePath) ||
38
+ targetFilePath.length === 0) {
39
+ throw new Error(`Local file "${filePath}" must resolve to a valid bundle target inside "${sourcesFolder}"`);
40
+ }
41
+ return targetFilePath;
42
+ }
43
+ function targetPathForLocalFile(sourcesFolder, localFile) {
44
+ return localFile.isGeneratedManifest
45
+ ? packageManifestFilePath
46
+ : toSourceRelativeTargetPath(sourcesFolder, localFile.filePath);
47
+ }
48
+ function targetPathByInputPathFor(sourcesFolder, localDependencies) {
49
+ return new Map(localDependencies.map(function (localFile) {
50
+ return [localFile.filePath, targetPathForLocalFile(sourcesFolder, localFile)];
51
+ }));
52
+ }
53
+ function requireTargetPath(targetPathByInputPath, inputFilePath) {
54
+ const targetFilePath = targetPathByInputPath.get(inputFilePath);
55
+ if (targetFilePath === undefined) {
56
+ throw new Error(`Resolved local reference "${inputFilePath}" is missing from bundle contents`);
57
+ }
58
+ return targetFilePath;
59
+ }
60
+ function localArtifactReference(type, reference, targetPathByInputPath) {
61
+ return {
62
+ type,
63
+ sourceSpecifier: reference.sourceSpecifier,
64
+ emittedSpecifier: reference.emittedSpecifier,
65
+ targetFilePath: requireTargetPath(targetPathByInputPath, reference.filePath)
66
+ };
67
+ }
68
+ function artifactModuleReference(reference, targetPathByInputPath) {
69
+ if (reference.kind === moduleReferenceKind.externalPackage) {
70
+ return {
71
+ type: 'external-package',
72
+ sourceSpecifier: reference.sourceSpecifier,
73
+ emittedSpecifier: reference.emittedSpecifier,
74
+ packageName: reference.packageName
75
+ };
76
+ }
77
+ if (reference.kind === moduleReferenceKind.generatedManifest) {
78
+ return localArtifactReference('generated-manifest', reference, targetPathByInputPath);
79
+ }
80
+ if (reference.kind === moduleReferenceKind.localAsset) {
81
+ return localArtifactReference('local-asset', reference, targetPathByInputPath);
82
+ }
83
+ return localArtifactReference('local-code', reference, targetPathByInputPath);
84
+ }
85
+ function artifactModuleReferences(references, targetPathByInputPath) {
86
+ return references.map(function (reference) {
87
+ return artifactModuleReference(reference, targetPathByInputPath);
88
+ });
89
+ }
90
+ function directDependencyTargets(localFile, targetPathByInputPath) {
91
+ return new Set(Array.from(localFile.directDependencies, function (inputFilePath) {
92
+ return requireTargetPath(targetPathByInputPath, inputFilePath);
93
+ }));
94
+ }
95
+ export function combineAllBundleFiles(sourcesFolder, localDependencies, additionalFiles) {
96
+ const targetPathByInputPath = targetPathByInputPathFor(sourcesFolder, localDependencies);
97
+ const resolvedLocalFiles = localDependencies.map(function (localFile) {
98
+ const targetFilePath = targetPathForLocalFile(sourcesFolder, localFile);
99
+ const resolvedBundleFile = {
100
+ inputFilePath: localFile.filePath,
101
+ targetFilePath,
102
+ directDependencies: directDependencyTargets(localFile, targetPathByInputPath),
103
+ moduleReferences: artifactModuleReferences(localFile.moduleReferences, targetPathByInputPath),
104
+ ...localFile.project === undefined ? {} : { project: localFile.project },
105
+ isExplicitlyIncluded: false,
106
+ ...localFile.isGeneratedManifest ? { isGeneratedManifest: true } : {}
107
+ };
108
+ return resolvedBundleFile;
109
+ });
110
+ const additionalContents = additionalFiles.map(function (additionalFile) {
111
+ if (typeof additionalFile === 'string') {
112
+ rejectAdditionalFileTarget(additionalFile);
113
+ const inputFilePath = path.join(sourcesFolder, additionalFile);
114
+ const targetFilePath = additionalFile;
115
+ return {
116
+ inputFilePath,
117
+ targetFilePath,
118
+ directDependencies: new Set(),
119
+ moduleReferences: [],
120
+ isExplicitlyIncluded: true
121
+ };
122
+ }
123
+ if (path.isAbsolute(additionalFile.targetFilePath)) {
124
+ throw new Error('The targetFilePath must be relative');
125
+ }
126
+ rejectAdditionalFileTarget(additionalFile.targetFilePath);
127
+ return {
128
+ inputFilePath: prependSourcesFolderIfNecessary(sourcesFolder, additionalFile.inputFilePath),
129
+ targetFilePath: additionalFile.targetFilePath,
130
+ directDependencies: new Set(),
131
+ moduleReferences: [],
132
+ isExplicitlyIncluded: true
133
+ };
134
+ });
135
+ return [...resolvedLocalFiles, ...additionalContents];
136
+ }
5
137
  //# sourceMappingURL=content.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["../../../../source/resource-resolver/content.ts"],"names":[],"mappings":"AAAA,OAAiB,WAAW,CAAC;AAE7B,OAA2B,yBAAyB,CAAC;AACrD,OAAwC,6BAA6B,CAAC;AAGtE,OAA0D,iDAAiD,CAAC"}
1
+ {"version":3,"file":"content.js","sourceRoot":"","sources":["../../../../source/resource-resolver/content.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,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,CAAC,aAAa,CAAC;YAC3F,cAAc,EAAE,cAAc,CAAC,cAAc;YAC7C,kBAAkB,EAAE,IAAI,GAAG,EAAE;YAC7B,gBAAgB,EAAE,EAAE;YACpB,oBAAoB,EAAE,IAAI;SAC7B,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,OAAO,CAAE,GAAG,kBAAkB,EAAE,GAAG,kBAAkB,CAAE,CAAC;AAC5D,CAAC"}
@@ -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":["../../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F,OAAO,oBAAoB,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAChD,YAA8C,EAC9C,OAA+B,EAC/B,6BAAgD;IAEhD,MAAM,EAAE,KAAK,EAAE,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,OAAO,GAA0B;QACnC,YAAY;QACZ,OAAO;QACP,uBAAuB,EAAE,4BAA4B,EAAE;KAC1D,CAAC;IACF,IAAI,eAAe,GAAG,oBAAoB,EAAE,CAAC;IAE7C,KAAK,MAAM,IAAI,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,4 +1,7 @@
1
+ import type { Project } from 'ts-morph';
2
+ import type { ExternalDependencies } from '../dependency-scanner/external-dependencies.ts';
1
3
  import type { TransferableFileDescription } from '../file-manager/file-description.ts';
4
+ import type { PackageSurface } from '../package-surface/surface.ts';
2
5
  type ExternalPackageArtifactModuleReference = {
3
6
  readonly type: 'external-package';
4
7
  readonly sourceSpecifier: string;
@@ -41,9 +44,23 @@ export type BundleResource = {
41
44
  readonly isExplicitlyIncluded: boolean;
42
45
  readonly isGeneratedManifest?: true | undefined;
43
46
  };
47
+ export type ResolvedContent = BundleResource & {
48
+ readonly project?: Project | undefined;
49
+ };
44
50
  export type RootFileDescription = {
45
51
  readonly js: TransferableFileDescription;
46
52
  readonly declarationFile?: TransferableFileDescription | undefined;
47
53
  };
54
+ export type ResolvedBundle = {
55
+ readonly contents: readonly ResolvedContent[];
56
+ readonly roots: Readonly<Record<string, RootFileDescription>>;
57
+ readonly surface: PackageSurface;
58
+ readonly name: string;
59
+ readonly exportPackageJson?: true | undefined;
60
+ readonly externalDependencies: ExternalDependencies;
61
+ };
62
+ export declare function rootHasDeclarationFile(root: RootFileDescription): root is RootFileDescription & {
63
+ readonly declarationFile: TransferableFileDescription;
64
+ };
48
65
  export {};
49
66
  //# sourceMappingURL=resolved-bundle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolved-bundle.d.ts","sourceRoot":"","sources":["../../../../source/resource-resolver/resolved-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;KAGlF,sCAAsC,GAAG;IAC1C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,KAAK,wCAAwC,GAAG;IAC5C,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,KAAK,iCAAiC,GAAG;IACrC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACn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Q,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;CACvD,CAAC;AAEF,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,mBAAmB,GAC1B,IAAI,IAAI,mBAAmB,GAAG;IAAE,QAAQ,CAAC,eAAe,EAAE,2BAA2B,CAAC;CAAE,CAE1F"}
@@ -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"}
@@ -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,IA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,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,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CACpC,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,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,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,CAA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,CAAC,gBAAgB;gBAC7C,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,oBAAoB,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"}
@@ -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"}