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
@@ -0,0 +1,55 @@
1
+ import { Result } from 'true-myth';
2
+ import type { FileManager } from '../file-manager/file-manager.ts';
3
+ import type { VendorEntry } from './vendor-entry.ts';
4
+ export declare const vendorMaterializerFailureType: {
5
+ readonly dependencyNotFound: "dependency-not-found";
6
+ readonly invalidDependencyName: "invalid-dependency-name";
7
+ readonly symlinkTargetOutsidePackage: "symlink-target-outside-package";
8
+ };
9
+ type SymlinkTargetOutsidePackageFailure = {
10
+ readonly type: typeof vendorMaterializerFailureType.symlinkTargetOutsidePackage;
11
+ readonly packageName: string;
12
+ readonly entryRelativePath: string;
13
+ readonly resolvedTargetPath: string;
14
+ };
15
+ type InvalidDependencyNameFailure = {
16
+ readonly type: typeof vendorMaterializerFailureType.invalidDependencyName;
17
+ readonly sourcePackageName: string | undefined;
18
+ readonly invalidDependencyName: string;
19
+ };
20
+ type DependencyNotFoundFailure = {
21
+ readonly type: typeof vendorMaterializerFailureType.dependencyNotFound;
22
+ readonly sourcePackageName: string | undefined;
23
+ readonly dependencyName: string;
24
+ };
25
+ type VendorMaterializerFailures = readonly [
26
+ DependencyNotFoundFailure,
27
+ InvalidDependencyNameFailure,
28
+ SymlinkTargetOutsidePackageFailure
29
+ ];
30
+ export type VendorMaterializerFailure = VendorMaterializerFailures[number];
31
+ export type MaterializedExternals = {
32
+ readonly entries: readonly VendorEntry[];
33
+ readonly packageNames: readonly string[];
34
+ readonly peerRequirements: ReadonlyMap<string, readonly string[]>;
35
+ };
36
+ type VendorMaterializerFileManager = {
37
+ readonly checkReadability: FileManager['checkReadability'];
38
+ readonly getRealPath: FileManager['getRealPath'];
39
+ readonly getTransferableFileDescriptionFromPath: FileManager['getTransferableFileDescriptionFromPath'];
40
+ readonly listDirectoryEntries: FileManager['listDirectoryEntries'];
41
+ readonly readFile: FileManager['readFile'];
42
+ };
43
+ export type VendorMaterializerDependencies = {
44
+ readonly fileManager: VendorMaterializerFileManager;
45
+ };
46
+ type MaterializeExternalsOptions = {
47
+ readonly initialDependencyNames: readonly string[];
48
+ readonly projectFolder: string;
49
+ };
50
+ export type VendorMaterializer = {
51
+ materializeExternals: (options: MaterializeExternalsOptions) => Promise<Result<MaterializedExternals, VendorMaterializerFailure>>;
52
+ };
53
+ export declare function createVendorMaterializer(dependencies: VendorMaterializerDependencies): VendorMaterializer;
54
+ export {};
55
+ //# sourceMappingURL=vendor-materializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendor-materializer.d.ts","sourceRoot":"","sources":["../../../../source/vendor-materializer/vendor-materializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAWnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,6BAA6B;;;;CAIhC,CAAC;AAEX,KAAK,kCAAkC,GAAG;IACtC,QAAQ,CAAC,IAAI,EAAE,OAAO,6BAA6B,CAAC,2BAA2B,CAAC;IAChF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACvC,CAAC;AAEF,KAAK,4BAA4B,GAAG;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,6BAA6B,CAAC,qBAAqB,CAAC;IAC1E,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,6BAA6B,CAAC,kBAAkB,CAAC;IACvE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,SAAS;IACvC,yBAAyB;IACzB,4BAA4B;IAC5B,kCAAkC;CACrC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAE3E,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;CACrE,CAAC;AAEF,KAAK,6BAA6B,GAAG;IACjC,QAAQ,CAAC,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAC3D,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACjD,QAAQ,CAAC,sCAAsC,EAAE,WAAW,CAAC,wCAAwC,CAAC,CAAC;IACvG,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;IACnE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IACzC,QAAQ,CAAC,WAAW,EAAE,6BAA6B,CAAC;CACvD,CAAC;AAEF,KAAK,2BAA2B,GAAG;IAC/B,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,oBAAoB,EAAE,CAClB,OAAO,EAAE,2BAA2B,KACnC,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,CAAC,CAAC;CAC1E,CAAC;AAuOF,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,8BAA8B,GAAG,kBAAkB,CA0JzG"}
@@ -1,9 +1,241 @@
1
- import 'node:path';
2
- import 'npm-package-arg';
3
- import 'true-myth';
4
- import 'true-myth/result';
5
- import 'zod/mini';
6
- import "../common/schema-validation.js";
7
- import "../common/package-layout.js";
8
- import "../common/worklist.js";
1
+ import path from 'node:path';
2
+ import parsePackageArgument from 'npm-package-arg';
3
+ import { Result } from 'true-myth';
4
+ import { tryOr } from 'true-myth/result';
5
+ import { z } from 'zod/mini';
6
+ import { safeParse } from "../common/schema-validation.js";
7
+ import { ancestorInstalledDependencyPathCandidates, bundledInstalledDependencyPath, installedDependenciesFolderName, packageManifestPathIn } from "../common/package-layout.js";
8
+ import { createWorklist } from "../common/worklist.js";
9
+ export const vendorMaterializerFailureType = {
10
+ dependencyNotFound: 'dependency-not-found',
11
+ invalidDependencyName: 'invalid-dependency-name',
12
+ symlinkTargetOutsidePackage: 'symlink-target-outside-package'
13
+ };
14
+ const dependencyMapSchema = z.optional(z.record(z.string(), z.string()));
15
+ function packageManifestSchema() {
16
+ return z.object({
17
+ dependencies: dependencyMapSchema,
18
+ peerDependencies: dependencyMapSchema
19
+ });
20
+ }
21
+ function getPackageArgumentName(name) {
22
+ const parsed = tryOr(undefined, function () {
23
+ return parsePackageArgument(name).name ?? undefined;
24
+ });
25
+ return parsed.isOk ? parsed.value : undefined;
26
+ }
27
+ function findFirstInvalidDependencyName(names) {
28
+ for (const name of names) {
29
+ if (getPackageArgumentName(name) !== name) {
30
+ return name;
31
+ }
32
+ }
33
+ return undefined;
34
+ }
35
+ function parseManifestSummary(sourcePackageName, content) {
36
+ const parsed = safeParse(packageManifestSchema(), JSON.parse(content));
37
+ if (!parsed.success) {
38
+ return Result.ok({ dependencies: [], peers: [] });
39
+ }
40
+ const dependencyNames = Object.keys(parsed.data.dependencies ?? {});
41
+ const peerDependencyNames = Object.keys(parsed.data.peerDependencies ?? {});
42
+ const invalidDependencyName = findFirstInvalidDependencyName(dependencyNames.concat(peerDependencyNames));
43
+ if (invalidDependencyName !== undefined) {
44
+ return Result.err({
45
+ type: vendorMaterializerFailureType.invalidDependencyName,
46
+ sourcePackageName,
47
+ invalidDependencyName
48
+ });
49
+ }
50
+ return Result.ok({
51
+ dependencies: dependencyNames,
52
+ peers: peerDependencyNames
53
+ });
54
+ }
55
+ async function collectPackageFileEntry(walker, state, relativeEntryPath) {
56
+ const sourceAbsolutePath = path.join(state.packageDirectory.rootDirectory, relativeEntryPath);
57
+ const targetRelativePath = bundledInstalledDependencyPath(state.packageDirectory.packageName, relativeEntryPath);
58
+ const fileDescription = await walker.getTransferableFileDescriptionFromPath(sourceAbsolutePath, targetRelativePath);
59
+ state.collected.push({
60
+ sourceAbsolutePath,
61
+ sourcePackageRootPath: state.packageDirectory.rootDirectory,
62
+ targetRelativePath,
63
+ isExecutable: fileDescription.isExecutable
64
+ });
65
+ }
66
+ async function getResolvedTargetPath(walker, absoluteEntryPath) {
67
+ try {
68
+ return Result.ok(await walker.getRealPath(absoluteEntryPath));
69
+ }
70
+ catch {
71
+ return Result.err(absoluteEntryPath);
72
+ }
73
+ }
74
+ function isPathInsideRoot(rootDirectory, candidatePath) {
75
+ const normalizedRoot = path.resolve(rootDirectory);
76
+ const normalizedCandidate = path.resolve(candidatePath);
77
+ return normalizedCandidate === normalizedRoot || normalizedCandidate.startsWith(`${normalizedRoot}${path.sep}`);
78
+ }
79
+ async function checkSymlinkInsidePackage(walker, rootDirectory, packageName, relativeEntryPath) {
80
+ const absoluteEntryPath = path.join(rootDirectory, relativeEntryPath);
81
+ const normalizedEntryRelativePath = relativeEntryPath.split(path.sep).join('/');
82
+ const resolvedTarget = await getResolvedTargetPath(walker, absoluteEntryPath);
83
+ const resolvedTargetPath = resolvedTarget.isOk ? resolvedTarget.value : resolvedTarget.error;
84
+ if (resolvedTarget.isErr) {
85
+ return Result.err({
86
+ type: vendorMaterializerFailureType.symlinkTargetOutsidePackage,
87
+ packageName,
88
+ entryRelativePath: normalizedEntryRelativePath,
89
+ resolvedTargetPath
90
+ });
91
+ }
92
+ if (!isPathInsideRoot(rootDirectory, resolvedTargetPath)) {
93
+ return Result.err({
94
+ type: vendorMaterializerFailureType.symlinkTargetOutsidePackage,
95
+ packageName,
96
+ entryRelativePath: normalizedEntryRelativePath,
97
+ resolvedTargetPath
98
+ });
99
+ }
100
+ return Result.ok(undefined);
101
+ }
102
+ async function validatePackageDirectoryEntry(walker, packageDirectory, relativeEntryPath, entry) {
103
+ if (!entry.isSymbolicLink) {
104
+ return Result.ok(undefined);
105
+ }
106
+ return checkSymlinkInsidePackage(walker, packageDirectory.rootDirectory, packageDirectory.packageName, relativeEntryPath);
107
+ }
108
+ const walkPackageDirectory = async function (walker, state, relativeDirectory) {
109
+ const absoluteDirectory = path.join(state.packageDirectory.rootDirectory, relativeDirectory);
110
+ const entries = await walker.listDirectoryEntries(absoluteDirectory);
111
+ const collectDirectoryEntry = async function (entry) {
112
+ if (entry.name === installedDependenciesFolderName) {
113
+ return Result.ok(undefined);
114
+ }
115
+ const relativeEntryPath = path.join(relativeDirectory, entry.name);
116
+ const symlinkCheck = await validatePackageDirectoryEntry(walker, state.packageDirectory, relativeEntryPath, entry);
117
+ if (symlinkCheck.isErr) {
118
+ return symlinkCheck;
119
+ }
120
+ if (entry.isDirectory) {
121
+ return walkPackageDirectory(walker, state, relativeEntryPath);
122
+ }
123
+ await collectPackageFileEntry(walker, state, relativeEntryPath);
124
+ return Result.ok(undefined);
125
+ };
126
+ for (const entry of entries) {
127
+ const result = await collectDirectoryEntry(entry);
128
+ if (result.isErr) {
129
+ return result;
130
+ }
131
+ }
132
+ return Result.ok(undefined);
133
+ };
134
+ export function createVendorMaterializer(dependencies) {
135
+ const { fileManager } = dependencies;
136
+ function queueItem(name, fromFolder, sourcePackageName, required) {
137
+ return { name, fromFolder, required, sourcePackageName };
138
+ }
139
+ function scheduleManifestDependencies(closure, name, realPath, summary) {
140
+ closure.pendingPackages.scheduleAll(summary.dependencies.map(function (dependencyName) {
141
+ return queueItem(dependencyName, realPath, name, true);
142
+ }));
143
+ closure.pendingPackages.scheduleAll(summary.peers.map(function (dependencyName) {
144
+ return queueItem(dependencyName, realPath, name, false);
145
+ }));
146
+ }
147
+ async function collectVendorEntries(packageName, realPath) {
148
+ const collected = [];
149
+ const walkResult = await walkPackageDirectory(fileManager, { packageDirectory: { rootDirectory: realPath, packageName }, collected }, '');
150
+ if (walkResult.isErr) {
151
+ return Result.err(walkResult.error);
152
+ }
153
+ return Result.ok(Array.from(collected));
154
+ }
155
+ async function readManifestSummary(packageName, realPath) {
156
+ const manifestPath = packageManifestPathIn(realPath);
157
+ const content = await fileManager.readFile(manifestPath);
158
+ return parseManifestSummary(packageName, content);
159
+ }
160
+ async function findPackageRealPath(packageName, startFolder) {
161
+ for (const candidatePath of ancestorInstalledDependencyPathCandidates(startFolder, packageName)) {
162
+ const readability = await fileManager.checkReadability(candidatePath);
163
+ if (readability.isReadable) {
164
+ return await fileManager.getRealPath(candidatePath);
165
+ }
166
+ }
167
+ return undefined;
168
+ }
169
+ async function ingestResolvedPackage(closure, name, realPath) {
170
+ const summaryResult = await readManifestSummary(name, realPath);
171
+ if (summaryResult.isErr) {
172
+ return Result.err(summaryResult.error);
173
+ }
174
+ scheduleManifestDependencies(closure, name, realPath, summaryResult.value);
175
+ closure.peerRequirements.set(name, summaryResult.value.peers);
176
+ const collectedResult = await collectVendorEntries(name, realPath);
177
+ if (collectedResult.isErr) {
178
+ return Result.err(collectedResult.error);
179
+ }
180
+ closure.entries.push(...collectedResult.value);
181
+ return Result.ok(undefined);
182
+ }
183
+ async function processPendingPackageItem(closure, item) {
184
+ if (closure.visited.has(item.name)) {
185
+ return Result.ok(undefined);
186
+ }
187
+ const realPath = await findPackageRealPath(item.name, item.fromFolder);
188
+ if (realPath === undefined) {
189
+ if (item.required) {
190
+ return Result.err({
191
+ type: vendorMaterializerFailureType.dependencyNotFound,
192
+ sourcePackageName: item.sourcePackageName,
193
+ dependencyName: item.name
194
+ });
195
+ }
196
+ return Result.ok(undefined);
197
+ }
198
+ closure.visited.add(item.name);
199
+ return ingestResolvedPackage(closure, item.name, realPath);
200
+ }
201
+ async function drainPendingPackages(closure) {
202
+ for (let item = closure.pendingPackages.takeNext(); item !== undefined; item = closure.pendingPackages.takeNext()) {
203
+ const processed = await processPendingPackageItem(closure, item);
204
+ if (processed.isErr) {
205
+ return processed;
206
+ }
207
+ }
208
+ return Result.ok(undefined);
209
+ }
210
+ return {
211
+ async materializeExternals(options) {
212
+ const invalidInitialName = findFirstInvalidDependencyName(options.initialDependencyNames);
213
+ if (invalidInitialName !== undefined) {
214
+ return Result.err({
215
+ type: vendorMaterializerFailureType.invalidDependencyName,
216
+ sourcePackageName: undefined,
217
+ invalidDependencyName: invalidInitialName
218
+ });
219
+ }
220
+ const entries = [];
221
+ const closure = {
222
+ visited: new Set(),
223
+ entries,
224
+ pendingPackages: createWorklist(options.initialDependencyNames.map(function (name) {
225
+ return queueItem(name, options.projectFolder, undefined, true);
226
+ })),
227
+ peerRequirements: new Map()
228
+ };
229
+ const drained = await drainPendingPackages(closure);
230
+ if (drained.isErr) {
231
+ return Result.err(drained.error);
232
+ }
233
+ return Result.ok({
234
+ entries: Array.from(closure.entries),
235
+ packageNames: Array.from(closure.visited),
236
+ peerRequirements: new Map(closure.peerRequirements)
237
+ });
238
+ }
239
+ };
240
+ }
9
241
  //# sourceMappingURL=vendor-materializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vendor-materializer.js","sourceRoot":"","sources":["../../../../source/vendor-materializer/vendor-materializer.ts"],"names":[],"mappings":"AAAA,OAAiB,WAAW,CAAC;AAC7B,OAAiC,iBAAiB,CAAC;AACnD,OAAuB,WAAW,CAAC;AACnC,OAAsB,kBAAkB,CAAC;AACzC,OAAkB,UAAU,CAAC;AAC7B,OAA0B,gCAAgC,CAAC;AAC3D,OAKO,6BAA6B,CAAC;AACrC,OAA8C,uBAAuB,CAAC"}
1
+ {"version":3,"file":"vendor-materializer.js","sourceRoot":"","sources":["../../../../source/vendor-materializer/vendor-materializer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,oBAAoB,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;A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AS,EAAE,CAAC;gBACnC,OAAO,MAAM,CAAC,GAAG,CAAC;oBACd,IAAI,EAAE,6BAA6B,CAAC,qBAAqB;oBACzD,iBAAiB,EAAE,SAAS;oBAC5B,qBAAqB,EAAE,kBAAkB;iBAC5C,CAAC,CAAC;YACP,CAAC;YACD,MAAM,OAAO,GAAkB,EAAE,CAAC;YAClC,MAAM,OAAO,GAAY;gBACrB,OAAO,EAAE,IAAI,GAAG,EAAU;gBAC1B,OAAO;gBACP,eAAe,EAAE,cAAc,CAC3B,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,UAAU,IAAI;oBAC7C,OAAO,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;gBACnE,CAAC,CAAC,CACL;gBACD,gBAAgB,EAAE,IAAI,GAAG,EAA6B;aACzD,CAAC;YACF,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACpD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,MAAM,CAAC,EAAE,CAAC;gBACb,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;gBACpC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;gBACzC,gBAAgB,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC;aACtD,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -1,3 +1,33 @@
1
- import "../../common/bundled-dependency-groups.js";
2
- import "../../common/package-name-map.js";
1
+ import { bundledDependencyGroup, bundledDependencyLookupOrder } from "../../common/bundled-dependency-groups.js";
2
+ import { packageNameMap } from "../../common/package-name-map.js";
3
+ function matchingGroupedDependency(groupedDependenciesByName, dependencyName) {
4
+ for (const group of bundledDependencyLookupOrder()) {
5
+ const matchingDependency = groupedDependenciesByName[group.propertyName].get(dependencyName);
6
+ if (matchingDependency !== undefined) {
7
+ return { manifestProperty: group.manifestProperty, version: matchingDependency.version };
8
+ }
9
+ }
10
+ return undefined;
11
+ }
12
+ function createDependencyRecord() {
13
+ return {};
14
+ }
15
+ export function groupBundleDependencies(bundle, bundlePeerDependencies, bundleDependencies) {
16
+ const grouped = {
17
+ dependencies: createDependencyRecord(),
18
+ peerDependencies: createDependencyRecord()
19
+ };
20
+ const groupedDependenciesByName = {
21
+ [bundledDependencyGroup.bundle.propertyName]: packageNameMap(bundleDependencies),
22
+ [bundledDependencyGroup.peer.propertyName]: packageNameMap(bundlePeerDependencies)
23
+ };
24
+ for (const dependencyName of bundle.linkedBundleDependencies.keys()) {
25
+ const matchingDependency = matchingGroupedDependency(groupedDependenciesByName, dependencyName);
26
+ if (matchingDependency === undefined) {
27
+ throw new Error(`Couldn’t determine version number of bundle dependency ${dependencyName}`);
28
+ }
29
+ grouped[matchingDependency.manifestProperty][dependencyName] = matchingDependency.version;
30
+ }
31
+ return grouped;
32
+ }
3
33
  //# sourceMappingURL=bundle-dependency-grouping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundle-dependency-grouping.js","sourceRoot":"","sources":["../../../../../source/version-manager/dependencies/bundle-dependency-grouping.ts"],"names":[],"mappings":"AACA,OAAqE,2CAA2C,CAAC;AACjH,OAA+B,kCAAkC,CAAC"}
1
+ {"version":3,"file":"bundle-dependency-grouping.js","sourceRoot":"","sources":["../../../../../source/version-manager/dependencies/bundle-dependency-grouping.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAkBlE,SAAS,yBAAyB,CAC9B,yBAAoD,EACpD,cAAsB;IAEtB,KAAK,MAAM,KAAK,IAAI,4BAA4B,EAAE,EAAE,CA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DependencyGroups(...groups) {
3
+ return {
4
+ dependencies: mergeAll(groups.map(function (group) {
5
+ return group.dependencies;
6
+ })),
7
+ peerDependencies: mergeAll(groups.map(function (group) {
8
+ return group.peerDependencies;
9
+ }))
10
+ };
11
+ }
2
12
  //# sourceMappingURL=dependency-groups.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependency-groups.js","sourceRoot":"","sources":["../../../../../source/version-manager/dependencies/dependency-groups.ts"],"names":[],"mappings":"AAAA,OAAyB,QAAQ,CAAC"}
1
+ {"version":3,"file":"dependency-groups.js","sourceRoot":"","sources":["../../../../../source/version-manager/dependencies/dependency-groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAOlC,MAAM,UAAU,qBAAqB,CAAC,GAAG,MAAsC;IAC3E,OAAO;QACH,YAAY,EAAE,QAAQ,CAClB,MAAM,CAAC,GAAG,CAAC,UAAU,KAAK;YACtB,OAAO,KAAK,CAAC,YAAY,CAAC;QAC9B,CAAC,CAAC,CACL;QACD,gBAAgB,EAAE,QAAQ,CACtB,MAAM,CAAC,GAAG,CAAC,UAAU,KAAK;YACtB,OAAO,KAAK,CAAC,gBAAgB,CAAC;QAClC,CAAC,CAAC,CACL;KACJ,CAAC;AACN,CAAC"}
@@ -1,4 +1,83 @@
1
- import 'common-tags';
2
- import "../specifier-classifier.js";
3
- import "../specifier-errors.js";
1
+ import { oneLine } from 'common-tags';
2
+ import { classifySpecifier } from "../specifier-classifier.js";
3
+ import { renderMalformedSpecifierMessage, renderMutableSpecifierMessage, renderUnusedAllowListMessage } from "../specifier-errors.js";
4
+ function getVersionFromDependencies(moduleName, mainPackageJson, kind) {
5
+ const dependencies = { ...mainPackageJson[kind] };
6
+ return String(dependencies[moduleName]);
7
+ }
8
+ function resolveExternalDependencyEntry(dependencyName, mainPackageJson) {
9
+ const isPeer = mainPackageJson.peerDependencies?.[dependencyName] !== undefined;
10
+ const isDirect = mainPackageJson.dependencies?.[dependencyName] !== undefined;
11
+ if (!isPeer && !isDirect) {
12
+ throw new Error(oneLine `Couldn’t determine version number of ${dependencyName},
13
+ because it is not listed in the main package.json`);
14
+ }
15
+ const kind = isPeer ? 'peerDependencies' : 'dependencies';
16
+ return {
17
+ name: dependencyName,
18
+ version: getVersionFromDependencies(dependencyName, mainPackageJson, kind),
19
+ kind
20
+ };
21
+ }
22
+ function createDependencyRecord() {
23
+ return {};
24
+ }
25
+ function throwHighestPriorityFailure(mutableOffenders, malformedOffenders, usedAllowListEntries, allowMutableSpecifiers) {
26
+ if (malformedOffenders.length > 0) {
27
+ throw new Error(renderMalformedSpecifierMessage(malformedOffenders));
28
+ }
29
+ if (mutableOffenders.length > 0) {
30
+ throw new Error(renderMutableSpecifierMessage(mutableOffenders));
31
+ }
32
+ const unusedAllowListEntries = allowMutableSpecifiers.filter(function (entry) {
33
+ return !usedAllowListEntries.has(entry);
34
+ });
35
+ if (unusedAllowListEntries.length > 0) {
36
+ throw new Error(renderUnusedAllowListMessage(unusedAllowListEntries));
37
+ }
38
+ }
39
+ function recordClassification(entry, recorders) {
40
+ const classification = classifySpecifier(entry.name, entry.version);
41
+ if (classification.kind === 'malformed') {
42
+ recorders.malformedOffenders.push({
43
+ name: entry.name,
44
+ specifier: entry.version,
45
+ reason: classification.reason
46
+ });
47
+ return;
48
+ }
49
+ if (classification.kind === 'mutable') {
50
+ if (recorders.allowMutableSpecifiers.includes(entry.name)) {
51
+ recorders.usedAllowListEntries.add(entry.name);
52
+ }
53
+ else {
54
+ recorders.mutableOffenders.push({
55
+ name: entry.name,
56
+ specifier: entry.version,
57
+ npaType: classification.npaType
58
+ });
59
+ }
60
+ }
61
+ }
62
+ export function groupExternalDependencies(bundle, mainPackageJson, allowMutableSpecifiers) {
63
+ const grouped = {
64
+ dependencies: createDependencyRecord(),
65
+ peerDependencies: createDependencyRecord()
66
+ };
67
+ const mutableOffenders = [];
68
+ const malformedOffenders = [];
69
+ const usedAllowListEntries = new Set();
70
+ for (const dependencyName of bundle.externalDependencies.keys()) {
71
+ const entry = resolveExternalDependencyEntry(dependencyName, mainPackageJson);
72
+ recordClassification(entry, {
73
+ allowMutableSpecifiers,
74
+ mutableOffenders,
75
+ malformedOffenders,
76
+ usedAllowListEntries
77
+ });
78
+ grouped[entry.kind][entry.name] = entry.version;
79
+ }
80
+ throwHighestPriorityFailure(mutableOffenders, malformedOffenders, usedAllowListEntries, allowMutableSpecifiers);
81
+ return grouped;
82
+ }
4
83
  //# sourceMappingURL=external-dependency-classification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-dependency-classification.js","sourceRoot":"","sources":["../../../../../source/version-manager/dependencies/external-dependency-classification.ts"],"names":[],"mappings":"AAAA,OAAwB,aAAa,CAAC;AAGtC,OAAkC,4BAA4B,CAAC;AAC/D,OAMO,wBAAwB,CAAC"}
1
+ {"version":3,"file":"external-dependency-classification.js","sourceRoot":"","sources":["../../../../../source/version-manager/dependencies/external-dependency-classification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EACH,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAG/B,MAAM,wBAAwB,CAAC;AAShC,SAAS,0BAA0B,CAC/B,UAAkB,EAClB,eAAgC,EAChC,IAAyC;IAEzC,MAAM,YAAY,GAAG,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IAClD,OAAO,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,8BAA8B,CACnC,cAAsB,EACtB,eAAgC;IAEhC,MAAM,MAAM,GAAG,eAAe,CAAC,gBAAgB,EAAE,CAAC,cAAc,CAAC,KAAK,SAAS,CAAC;IAChF,MAAM,QAAQ,GAAG,eAAe,CAAC,YAAY,EAAE,CAAC,cAAc,CAAC,KAAK,SAAS,CAAC;IAE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B,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;IACpD,CAAC;IAED,2BAA2B,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;IAEhH,OAAO,OAAO,CAAC;AACnB,CAAC"}
@@ -1,4 +1,9 @@
1
- import "./bundle-dependency-grouping.js";
2
- import "./dependency-groups.js";
3
- import "./external-dependency-classification.js";
1
+ import { groupBundleDependencies } from "./bundle-dependency-grouping.js";
2
+ import { mergeDependencyGroups } from "./dependency-groups.js";
3
+ import { groupExternalDependencies } from "./external-dependency-classification.js";
4
+ export function distributeDependencies(options) {
5
+ const bundleGrouped = groupBundleDependencies(options.bundle, options.bundlePeerDependencies, options.bundleDependencies);
6
+ const externalGrouped = groupExternalDependencies(options.bundle, options.mainPackageJson, options.allowMutableSpecifiers);
7
+ return mergeDependencyGroups(bundleGrouped, externalGrouped);
8
+ }
4
9
  //# sourceMappingURL=versioned-bundle-dependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versioned-bundle-dependencies.js","sourceRoot":"","sources":["../../../../../source/version-manager/dependencies/versioned-bundle-dependencies.ts"],"names":[],"mappings":"AAEA,OAAkE,iCAAiC,CAAC;AACpG,OAAgE,wBAAwB,CAAC;AACzF,OAA0C,yCAAyC,CAAC"}
1
+ {"version":3,"file":"versioned-bundle-dependencies.js","sourceRoot":"","sources":["../../../../../source/version-manager/dependencies/versioned-bundle-dependencies.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAA4B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAA4B,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAYpF,MAAM,UAAU,sBAAsB,CAAC,OAAsC;IACzE,MAAM,aAAa,GAAG,uBAAuB,CACzC,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,sBAAsB,EAC9B,OAAO,CAAC,kBAAkB,CAC7B,CAAC;IACF,MAAM,eAAe,GAAG,yBAAyB,CAC7C,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,eAAe,EACvB,OAAO,CAAC,sBAAsB,CACjC,CAAC;IACF,OAAO,qBAAqB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AACjE,CAAC"}
@@ -1,3 +1,21 @@
1
- import 'ts-morph';
2
- import "../../common/code-files.js";
1
+ import { ts as typescript } from 'ts-morph';
2
+ import { isCodeFile } from "../../common/code-files.js";
3
+ function isHashSpecifier(specifier) {
4
+ return specifier.startsWith('#');
5
+ }
6
+ export function collectHashImportSpecifiers(bundle) {
7
+ const importSpecifiers = new Set();
8
+ for (const resource of bundle.contents) {
9
+ const { targetFilePath, content } = resource.fileDescription;
10
+ if (isCodeFile(targetFilePath)) {
11
+ const parsedFile = typescript.preProcessFile(content, true);
12
+ for (const literal of parsedFile.importedFiles) {
13
+ if (isHashSpecifier(literal.fileName)) {
14
+ importSpecifiers.add(literal.fileName);
15
+ }
16
+ }
17
+ }
18
+ }
19
+ return importSpecifiers;
20
+ }
3
21
  //# sourceMappingURL=hash-import-scanner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hash-import-scanner.js","sourceRoot":"","sources":["../../../../../source/version-manager/imports/hash-import-scanner.ts"],"names":[],"mappings":"AAAA,OAAiC,UAAU,CAAC;AAC5C,OAA2B,4BAA4B,CAAC"}
1
+ {"version":3,"file":"hash-import-scanner.js","sourceRoot":"","sources":["../../../../../source/version-manager/imports/hash-import-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,SAAS,eAAe,CAAC,SAAiB;IACtC,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,MAAwC;IAChF,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAC7D,IAAI,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;YAC7B,MAAM,UAAU,GAAG,UAAU,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC5D,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,aAAa,EAAE,CAAC;gBAC7C,IAAI,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACpC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC3C,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}
@@ -1 +1,23 @@
1
+ function escapeRegExp(value) {
2
+ return value.replaceAll(/[.*+?^${}()|[\]\\]/gu, '\\$&');
3
+ }
4
+ function compareKeyRelevance(specifier, left, right) {
5
+ if (left === specifier || right === specifier) {
6
+ return left === specifier ? -1 : 1;
7
+ }
8
+ return right.length - left.length;
9
+ }
10
+ export function findMatchingImportEntryKey(specifier, importsField) {
11
+ const matchingKeys = Object
12
+ .keys(importsField)
13
+ .filter(function (key) {
14
+ const wildcardPattern = `^${escapeRegExp(key).replaceAll('\\*', '.*')}$`;
15
+ const wildcardRegex = new RegExp(wildcardPattern);
16
+ return wildcardRegex.test(specifier);
17
+ })
18
+ .toSorted(function (left, right) {
19
+ return compareKeyRelevance(specifier, left, right);
20
+ });
21
+ return matchingKeys[0];
22
+ }
1
23
  //# sourceMappingURL=imports-key-matcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imports-key-matcher.js","sourceRoot":"","sources":["../../../../../source/version-manager/imports/imports-key-matcher.ts"],"names":[],"mappings":"AAK4B"}
1
+ {"version":3,"file":"imports-key-matcher.js","sourceRoot":"","sources":["../../../../../source/version-manager/imports/imports-key-matcher.ts"],"names":[],"mappings":"AAIA,SAAS,YAAY,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,UAAU,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,mBAAmB,CAAC,SAAiB,EAAE,IAAY,EAAE,KAAa;IACvE,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5C,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,SAAiB,EAAE,YAA0B;IACpF,MAAM,YAAY,GAAG,MAAM;SACtB,IAAI,CAAC,YAAY,CAAC;SAClB,MAAM,CAAC,UAAU,GAAG;QACjB,MAAM,eAAe,GAAG,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC;QACzE,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;QAClD,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC,CAAC;SACD,QAAQ,CAAC,UAAU,IAAI,EAAE,KAAK;QAC3B,OAAO,mBAAmB,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEP,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC"}
@@ -1,3 +1,45 @@
1
- import "./hash-import-scanner.js";
2
- import "./imports-key-matcher.js";
1
+ import { collectHashImportSpecifiers } from "./hash-import-scanner.js";
2
+ import { findMatchingImportEntryKey } from "./imports-key-matcher.js";
3
+ function buildMissingImportsFieldMessage(firstSpecifier) {
4
+ return (`Found surviving package.json imports specifier "${firstSpecifier}" ` +
5
+ 'but mainPackageJson.imports is not configured');
6
+ }
7
+ function buildMissingImportEntryMessage(specifier) {
8
+ return (`Found surviving package.json imports specifier "${specifier}" ` +
9
+ 'but no matching mainPackageJson.imports entry');
10
+ }
11
+ function buildUndefinedImportEntryMessage(specifier, matchingKey) {
12
+ return (`Found surviving package.json imports specifier "${specifier}" ` +
13
+ `but matching mainPackageJson.imports entry "${matchingKey}" is undefined`);
14
+ }
15
+ function getConfiguredImportsOrThrow(mainPackageJson, referencedSpecifiers) {
16
+ if (mainPackageJson.imports !== undefined) {
17
+ return mainPackageJson.imports;
18
+ }
19
+ const [firstSpecifier] = referencedSpecifiers;
20
+ throw new Error(buildMissingImportsFieldMessage(firstSpecifier));
21
+ }
22
+ function collectReferencedImportsEntries(referencedSpecifiers, configuredImports) {
23
+ const importsField = {};
24
+ for (const specifier of referencedSpecifiers) {
25
+ const matchingKey = findMatchingImportEntryKey(specifier, configuredImports);
26
+ if (matchingKey === undefined) {
27
+ throw new Error(buildMissingImportEntryMessage(specifier));
28
+ }
29
+ const matchingImport = configuredImports[matchingKey];
30
+ if (matchingImport === undefined) {
31
+ throw new Error(buildUndefinedImportEntryMessage(specifier, matchingKey));
32
+ }
33
+ importsField[matchingKey] = matchingImport;
34
+ }
35
+ return importsField;
36
+ }
37
+ export function buildImportsField(bundle, mainPackageJson) {
38
+ const referencedSpecifiers = collectHashImportSpecifiers(bundle);
39
+ if (referencedSpecifiers.size === 0) {
40
+ return undefined;
41
+ }
42
+ const configuredImports = getConfiguredImportsOrThrow(mainPackageJson, referencedSpecifiers);
43
+ return collectReferencedImportsEntries(referencedSpecifiers, configuredImports);
44
+ }
3
45
  //# sourceMappingURL=versioned-bundle-imports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versioned-bundle-imports.js","sourceRoot":"","sources":["../../../../../source/version-manager/imports/versioned-bundle-imports.ts"],"names":[],"mappings":"AAGA,OAA4C,0BAA0B,CAAC;AACvE,OAA8D,0BAA0B,CAAC"}
1
+ {"version":3,"file":"versioned-bundle-imports.js","sourceRoot":"","sources":["../../../../../source/version-manager/imports/versioned-bundle-imports.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAqB,MAAM,0BAA0B,CAAC;AAEzF,SAAS,+BAA+B,CAAC,cAAkC;IACvE,OAAO,CACH,mDAAmD,cAAc,IAAI;QACrE,+CAA+C,CAClD,CAAC;AACN,CAAC;AAED,SAAS,8BAA8B,CAAC,SAAiB;IACrD,OAAO,CACH,mDAAmD,SAAS,IAAI;QAChE,+CAA+C,CAClD,CAAC;AACN,CAAC;AAED,SAAS,gCAAgC,CAAC,SAAiB,EAAE,WAAmB;IAC5E,OAAO,CACH,mDAAmD,SAAS,IAAI;QAChE,+CAA+C,WAAW,gBAAgB,CAC7E,CAAC;AACN,CAAC;AAED,SAAS,2BAA2B,CAChC,eAAgC,EAChC,oBAAyC;IAEzC,IAAI,eAAe,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,eAAe,CAAC,OAAO,CAAC;IACnC,CAAC;IAED,MAAM,CAAE,cAAc,CAAE,GAAG,oBAAoB,CAAC;IAChD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,+BAA+B,CACpC,oBAAyC,EACzC,iBAA+B;IAE/B,MAAM,YAAY,GAA8B,EAAE,CAAC;IAEnD,KAAK,MAAM,SAAS,IAAI,oBAAoB,EAAE,CAAC;QAC3C,MAAM,WAAW,GAAG,0BAA0B,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAC7E,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,cAAc,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;QACtD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;QAC9E,CAAC;QAED,YAAY,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC;IAC/C,CAAC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC7B,MAAwC,EACxC,eAAgC;IAEhC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACjE,IAAI,oBAAoB,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;IAC7F,OAAO,+BAA+B,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;AACpF,CAAC"}
@@ -1,6 +1,11 @@
1
+ import type { ProgressBroadcastProvider } from '../progress/progress-broadcaster.ts';
1
2
  import { type BuildVersionedBundleOptions, type VersionedBundle, type VersionedBundleWithManifest } from './versioned-bundle.ts';
3
+ export type VersionManagerDependencies = {
4
+ readonly progressBroadcaster: ProgressBroadcastProvider;
5
+ };
2
6
  export type VersionManager = {
3
7
  addVersion: (options: BuildVersionedBundleOptions) => VersionedBundleWithManifest;
4
8
  increaseVersion: (bundle: VersionedBundle) => VersionedBundleWithManifest;
5
9
  };
10
+ export declare function createVersionManager(dependencies: VersionManagerDependencies): VersionManager;
6
11
  //# sourceMappingURL=manager.d.ts.map