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,2 +1,56 @@
1
- import 'remeda';
1
+ import { unique } from 'remeda';
2
+ function uniqueReferences(references) {
3
+ const keys = new Set();
4
+ const result = [];
5
+ for (const reference of references) {
6
+ const key = `${reference.targetFilePath}\0${reference.sourceSpecifier}\0${reference.emittedSpecifier}`;
7
+ if (!keys.has(key)) {
8
+ keys.add(key);
9
+ result.push(reference);
10
+ }
11
+ }
12
+ const [first, ...rest] = result;
13
+ return first === undefined ? undefined : [first, ...rest];
14
+ }
15
+ function createExternalDependency(name, targetFilePath, specifier) {
16
+ const reference = {
17
+ targetFilePath,
18
+ sourceSpecifier: specifier.sourceSpecifier,
19
+ emittedSpecifier: specifier.emittedSpecifier
20
+ };
21
+ return {
22
+ name,
23
+ referencedFrom: [targetFilePath],
24
+ references: [reference]
25
+ };
26
+ }
27
+ export function mergeExternalDependencies(dependenciesA, dependenciesB) {
28
+ const mergedDependencies = new Map(dependenciesA);
29
+ for (const dependencyB of dependenciesB.values()) {
30
+ const dependencyA = mergedDependencies.get(dependencyB.name);
31
+ if (dependencyA === undefined) {
32
+ mergedDependencies.set(dependencyB.name, dependencyB);
33
+ }
34
+ else {
35
+ const references = uniqueReferences([
36
+ ...dependencyA.references ?? [],
37
+ ...dependencyB.references ?? []
38
+ ]);
39
+ mergedDependencies.set(dependencyA.name, {
40
+ name: dependencyA.name,
41
+ referencedFrom: unique([...dependencyA.referencedFrom, ...dependencyB.referencedFrom]),
42
+ ...references === undefined ? {} : { references }
43
+ });
44
+ }
45
+ }
46
+ return mergedDependencies;
47
+ }
48
+ export function mergeExternalDependencyReference(reference, targetFilePath, existingDependency) {
49
+ const dependency = createExternalDependency(reference.name, targetFilePath, reference);
50
+ if (existingDependency === undefined) {
51
+ return dependency;
52
+ }
53
+ return mergeExternalDependencies(new Map([[existingDependency.name, existingDependency]]), new Map([[dependency.name, dependency]]))
54
+ .get(dependency.name) ?? dependency;
55
+ }
2
56
  //# sourceMappingURL=external-dependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-dependencies.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/external-dependencies.ts"],"names":[],"mappings":"AAAA,OAAuB,QAAQ,CAAC"}
1
+ {"version":3,"file":"external-dependencies.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/external-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAyBhC,SAAS,gBAAgB,CACrB,UAA0C;IAE1C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,MAAM,GAA0B,EAAE,CAAC;IAEzC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC,eAAe,KAAK,SAAS,CAAC,gBAAgB,EAAE,CAAC;QACvG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACjB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;IAED,MAAM,CAAE,KAAK,EAAE,GAAG,IAAI,CAAE,GAAG,MAAM,CAAC;IAClC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAE,KAAK,EAAE,GAAG,IAAI,CAAE,CAAC;AAChE,CAAC;AAED,SAAS,wBAAwB,CAC7B,IAAY,EACZ,cAAsB,EACtB,SAAuC;IAEvC,MAAM,SAAS,GAAG;QACd,cAAc;QACd,eAAe,EAAE,SAAS,CAAC,eAAe;QAC1C,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;KAC/C,CAAC;IACF,OAAO;QACH,IAAI;QACJ,cAAc,EAAE,CAAE,cAAc,CAAE;QAClC,UAAU,EAAE,CAAE,SAAS,CAAE;KAC5B,CAAC;AACN,CAAC;AAED,MAAM,UAAU,yBAAyB,CACrC,aAAmC,EACnC,aAAmC;IAEnC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAA6B,aAAa,CAAC,CAAC;IAE9E,KAAK,MAAM,WAAW,IAA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AC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC;AAC5C,CAAC"}
@@ -1 +1,10 @@
1
+ export function isDeclarationFile(filePath) {
2
+ const lowerCasedFilePath = filePath.toLowerCase();
3
+ return (lowerCasedFilePath.endsWith('.d.ts') ||
4
+ lowerCasedFilePath.endsWith('.d.cts') ||
5
+ lowerCasedFilePath.endsWith('.d.mts'));
6
+ }
7
+ export function isTypesRootFolder(directoryPath) {
8
+ return directoryPath.endsWith('/node_modules/@types') || directoryPath.includes('/node_modules/@types/');
9
+ }
1
10
  //# sourceMappingURL=file-host-predicates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-host-predicates.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/file-host-predicates.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"file-host-predicates.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/file-host-predicates.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAC9C,MAAM,kBAAkB,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAClD,OAAO,CACH,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC;QACpC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACrC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACxC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,aAAqB;IACnD,OAAO,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAC7G,CAAC"}
@@ -1 +1,19 @@
1
+ export const syncMethodNames = {
2
+ fileExists: 'fileExistsSync',
3
+ directoryExists: 'directoryExistsSync',
4
+ readFile: 'readFileSync'
5
+ };
6
+ export function bindRequiredMethod(object, methodName, expectedResultDescription, validateResult) {
7
+ const method = Reflect.get(object, methodName);
8
+ if (typeof method !== 'function') {
9
+ throw new TypeError(`Expected ${methodName} to be a function`);
10
+ }
11
+ return function (filePath) {
12
+ const result = Reflect.apply(method, object, [filePath]);
13
+ if (!validateResult(result)) {
14
+ throw new TypeError(`Expected ${methodName} to return ${expectedResultDescription}`);
15
+ }
16
+ return result;
17
+ };
18
+ }
1
19
  //# sourceMappingURL=host-method-binding.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"host-method-binding.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/host-method-binding.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"host-method-binding.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/host-method-binding.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,eAAe,EAAE,qBAAqB;IACtC,QAAQ,EAAE,cAAc;CAClB,CAAC;AAEX,MAAM,UAAU,kBAAkB,CAC9B,MAAsB,EACtB,UAAkB,EAClB,yBAAiC,EACjC,cAAmD;IAEnD,MAAM,MAAM,GAAY,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAExD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,YAAY,UAAU,mBAAmB,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,UAAU,QAAQ;QACrB,MAAM,MAAM,GAAY,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,CAAE,QAAQ,CAAE,CAAC,CAAC;QAEpE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,SAAS,CAAC,YAAY,UAAU,cAAc,yBAAyB,EAAE,CAAC,CAAC;QACzF,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC"}
@@ -1,2 +1,233 @@
1
- import 'ts-morph';
1
+ import { Node as TsMorphNode, SyntaxKind } from 'ts-morph';
2
+ function symbolDeclarations(symbol) {
3
+ if (symbol === undefined) {
4
+ return [];
5
+ }
6
+ const targetSymbol = symbol.getAliasedSymbol() ?? symbol;
7
+ return targetSymbol.getDeclarations();
8
+ }
9
+ function referencesDeclaration(identifier, declaration) {
10
+ return symbolDeclarations(identifier.getSymbol()).includes(declaration);
11
+ }
12
+ function parameterForIdentifier(identifier) {
13
+ return symbolDeclarations(identifier.getSymbol()).find(TsMorphNode.isParameterDeclaration);
14
+ }
15
+ function functionParameterTarget(parameter) {
16
+ const parent = parameter.getParent();
17
+ if (!TsMorphNode.isFunctionDeclaration(parent)) {
18
+ return undefined;
19
+ }
20
+ return {
21
+ functionDeclaration: parent,
22
+ parameterIndex: parent.getParameters().indexOf(parameter)
23
+ };
24
+ }
25
+ function isStringLiteralArgument(argument) {
26
+ return argument !== undefined;
27
+ }
28
+ function stringLiteralArguments(callExpression) {
29
+ return callExpression
30
+ .getArguments()
31
+ .map(function (argument, argumentIndex) {
32
+ const literal = argument.asKind(SyntaxKind.StringLiteral);
33
+ return literal === undefined ? undefined : { argumentIndex, literal };
34
+ })
35
+ .filter(isStringLiteralArgument);
36
+ }
37
+ function collectParameterInjectedImportCalls(callExpression) {
38
+ const callee = callExpression.getExpression().asKind(SyntaxKind.Identifier);
39
+ if (callee === undefined) {
40
+ return [];
41
+ }
42
+ const parameter = parameterForIdentifier(callee);
43
+ const target = parameter === undefined ? undefined : functionParameterTarget(parameter);
44
+ if (target === undefined) {
45
+ return [];
46
+ }
47
+ return stringLiteralArguments(callExpression).map(function (literalArgument) {
48
+ return {
49
+ functionDeclaration: target.functionDeclaration,
50
+ injectedParameterIndex: target.parameterIndex,
51
+ importArgumentIndex: literalArgument.argumentIndex,
52
+ literal: literalArgument.literal
53
+ };
54
+ });
55
+ }
56
+ function collectPropertyInjectedImportCalls(callExpression) {
57
+ const callee = callExpression.getExpression().asKind(SyntaxKind.PropertyAccessExpression);
58
+ if (callee === undefined) {
59
+ return [];
60
+ }
61
+ const containerIdentifier = callee.getExpression().asKind(SyntaxKind.Identifier);
62
+ const parameter = containerIdentifier === undefined ? undefined : parameterForIdentifier(containerIdentifier);
63
+ const target = parameter === undefined ? undefined : functionParameterTarget(parameter);
64
+ if (target === undefined) {
65
+ return [];
66
+ }
67
+ return stringLiteralArguments(callExpression).map(function (literalArgument) {
68
+ return {
69
+ containerParameterIndex: target.parameterIndex,
70
+ functionDeclaration: target.functionDeclaration,
71
+ importArgumentIndex: literalArgument.argumentIndex,
72
+ literal: literalArgument.literal,
73
+ propertyName: callee.getName()
74
+ };
75
+ });
76
+ }
77
+ function collectInjectedImportCalls(callExpression) {
78
+ return [
79
+ ...collectParameterInjectedImportCalls(callExpression),
80
+ ...collectPropertyInjectedImportCalls(callExpression)
81
+ ];
82
+ }
83
+ function callTargetsFunctionDeclaration(callExpression, functionDeclaration) {
84
+ return symbolDeclarations(callExpression.getExpression().getSymbol()).includes(functionDeclaration);
85
+ }
86
+ function objectLiteralArgument(callExpression, parameterIndex) {
87
+ const argument = callExpression.getArguments()[parameterIndex];
88
+ return argument === undefined ? undefined : argument.asKind(SyntaxKind.ObjectLiteralExpression);
89
+ }
90
+ function directFunctionInitializer(initializer) {
91
+ const arrowFunction = initializer.asKind(SyntaxKind.ArrowFunction);
92
+ if (arrowFunction !== undefined) {
93
+ return [arrowFunction];
94
+ }
95
+ const functionExpression = initializer.asKind(SyntaxKind.FunctionExpression);
96
+ return functionExpression === undefined ? [] : [functionExpression];
97
+ }
98
+ function importingFunctionsForSymbol(symbol) {
99
+ return symbolDeclarations(symbol).flatMap(function (declaration) {
100
+ if (TsMorphNode.isFunctionDeclaration(declaration)) {
101
+ return [declaration];
102
+ }
103
+ const initializer = declaration
104
+ .asKind(SyntaxKind.VariableDeclaration)
105
+ ?.getInitializer();
106
+ if (initializer === undefined) {
107
+ return [];
108
+ }
109
+ return directFunctionInitializer(initializer);
110
+ });
111
+ }
112
+ function importingFunctionsForValue(value) {
113
+ if (TsMorphNode.isArrowFunction(value) || TsMorphNode.isFunctionExpression(value)) {
114
+ return [value];
115
+ }
116
+ const identifier = value.asKind(SyntaxKind.Identifier);
117
+ return identifier === undefined ? [] : importingFunctionsForSymbol(identifier.getSymbol());
118
+ }
119
+ function dynamicImportUsesParameter(callExpression, parameter) {
120
+ if (callExpression.getExpression().getKind() !== SyntaxKind.ImportKeyword) {
121
+ return false;
122
+ }
123
+ const [firstArgument] = callExpression.getArguments();
124
+ const importArgument = firstArgument === undefined ? undefined : firstArgument.asKind(SyntaxKind.Identifier);
125
+ return importArgument !== undefined && referencesDeclaration(importArgument, parameter);
126
+ }
127
+ function isImportingFunction(node) {
128
+ return TsMorphNode.isArrowFunction(node) ||
129
+ TsMorphNode.isFunctionDeclaration(node) ||
130
+ TsMorphNode.isFunctionExpression(node) ||
131
+ TsMorphNode.isMethodDeclaration(node);
132
+ }
133
+ function enclosingImportingFunction(node) {
134
+ return node.getFirstAncestor(isImportingFunction);
135
+ }
136
+ function isReturnedFromFunction(expression, importingFunction) {
137
+ const parent = expression.getParent();
138
+ if (TsMorphNode.isReturnStatement(parent)) {
139
+ return enclosingImportingFunction(parent) === importingFunction;
140
+ }
141
+ return TsMorphNode.isArrowFunction(importingFunction) && importingFunction.getBody() === expression;
142
+ }
143
+ function returnedImportExpression(callExpression) {
144
+ const parent = callExpression.getParent();
145
+ return TsMorphNode.isAwaitExpression(parent) ? parent : callExpression;
146
+ }
147
+ function functionReturnsImportedArgument(importingFunction, importArgumentIndex) {
148
+ return importingFunction.getParameters().some(function (parameter, parameterIndex) {
149
+ return parameterIndex === importArgumentIndex &&
150
+ importingFunction
151
+ .getDescendantsOfKind(SyntaxKind.CallExpression)
152
+ .some(function (callExpression) {
153
+ const returnedExpression = returnedImportExpression(callExpression);
154
+ return dynamicImportUsesParameter(callExpression, parameter) &&
155
+ isReturnedFromFunction(returnedExpression, importingFunction);
156
+ });
157
+ });
158
+ }
159
+ function expressionImportsArgument(expression, importArgumentIndex) {
160
+ if (expression === undefined) {
161
+ return false;
162
+ }
163
+ return importingFunctionsForValue(expression).some(function (importingFunction) {
164
+ return functionReturnsImportedArgument(importingFunction, importArgumentIndex);
165
+ });
166
+ }
167
+ function functionListImportsArgument(importingFunctions, importArgumentIndex) {
168
+ for (const importingFunction of importingFunctions) {
169
+ if (functionReturnsImportedArgument(importingFunction, importArgumentIndex)) {
170
+ return true;
171
+ }
172
+ }
173
+ return false;
174
+ }
175
+ function shorthandPropertyImportsArgument(property, propertyName, importArgumentIndex) {
176
+ const shorthand = property.asKind(SyntaxKind.ShorthandPropertyAssignment);
177
+ if (shorthand === undefined) {
178
+ return false;
179
+ }
180
+ if (shorthand.getNameNode().getText() !== propertyName) {
181
+ return false;
182
+ }
183
+ return functionListImportsArgument(importingFunctionsForSymbol(shorthand.getValueSymbol()), importArgumentIndex);
184
+ }
185
+ function isParameterInjectedImportCall(input) {
186
+ return Object.hasOwn(input, 'injectedParameterIndex');
187
+ }
188
+ function objectLiteralPropertyImportsArgument(objectLiteral, propertyName, importArgumentIndex) {
189
+ return objectLiteral.getProperties().some(function (property) {
190
+ if (TsMorphNode.isMethodDeclaration(property)) {
191
+ return property.getName() === propertyName &&
192
+ functionReturnsImportedArgument(property, importArgumentIndex);
193
+ }
194
+ if (TsMorphNode.isPropertyAssignment(property)) {
195
+ return property.getName() === propertyName &&
196
+ expressionImportsArgument(property.getInitializer(), importArgumentIndex);
197
+ }
198
+ return shorthandPropertyImportsArgument(property, propertyName, importArgumentIndex);
199
+ });
200
+ }
201
+ function callSiteImportsArgument(callExpression, input) {
202
+ if (!callTargetsFunctionDeclaration(callExpression, input.functionDeclaration)) {
203
+ return false;
204
+ }
205
+ if (isParameterInjectedImportCall(input)) {
206
+ return expressionImportsArgument(callExpression.getArguments()[input.injectedParameterIndex], input.importArgumentIndex);
207
+ }
208
+ const objectLiteral = objectLiteralArgument(callExpression, input.containerParameterIndex);
209
+ return objectLiteral !== undefined &&
210
+ objectLiteralPropertyImportsArgument(objectLiteral, input.propertyName, input.importArgumentIndex);
211
+ }
212
+ function sourceFileHasImportingCallSite(sourceFile, input) {
213
+ return sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression).some(function (callExpression) {
214
+ return callSiteImportsArgument(callExpression, input);
215
+ });
216
+ }
217
+ function projectHasImportingCallSite(input) {
218
+ return input.functionDeclaration.getProject().getSourceFiles().some(function (sourceFile) {
219
+ return sourceFileHasImportingCallSite(sourceFile, input);
220
+ });
221
+ }
222
+ export function getInjectedDynamicImportLiterals(sourceFile) {
223
+ const literals = [];
224
+ for (const callExpression of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
225
+ for (const importCall of collectInjectedImportCalls(callExpression)) {
226
+ if (projectHasImportingCallSite(importCall)) {
227
+ literals.push(importCall.literal);
228
+ }
229
+ }
230
+ }
231
+ return literals;
232
+ }
2
233
  //# sourceMappingURL=injected-dynamic-imports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"injected-dynamic-imports.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/injected-dynamic-imports.ts"],"names":[],"mappings":"AAAA,OAgBO,UAAU,CAAC"}
1
+ {"version":3,"file":"injected-dynamic-imports.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/injected-dynamic-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,IAAI,WAAW,EACnB,UAAU,EAcb,MAAM,UAAU,CAAC;AA+BlB,SAAS,kBAAkB,CAAC,MAAiC;IACzD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,gBAAgB,EAAE,IAAI,MAAM,CAAC;IACzD,OAAO,YAAY,CAAC,eAAe,EAAE,CAAC;AAC1C,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAgC,EAAE,WAA4B;IACzF,OAAO,kBAAkB,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,sBAAsB,CAAC,UAAgC;IAC5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C,OAAO,UAAU,CAAC,oBAAoB,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,UAAU,cAAc;QAC3F,OAAO,uBAAuB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,2BAA2B,CAAC,KAAmC;IACpE,OAAO,KAAK,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,UAAU,UAAU;QACpF,OAAO,8BAA8B,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,UAAgC;IAC7E,MAAM,QAAQ,GAAoB,EAAE,CAAC;IACrC,KAAK,MAAM,cAAc,IAAI,UAAU,CAAC,oBAAoB,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACtF,KAAK,MAAM,UAAU,IAAI,0BAA0B,CAAC,cAAc,CAAC,EAAE,CAAC;YAClE,IAAI,2BAA2B,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC1C,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC"}
@@ -1,5 +1,53 @@
1
- import 'remeda';
2
- import 'true-myth/result';
3
- import "../common/package-layout.js";
4
- import "./host-method-binding.js";
1
+ import { isPlainObject, isString } from 'remeda';
2
+ import { tryOr } from 'true-myth/result';
3
+ import { isInstalledDependencyManifestPath } from "../common/package-layout.js";
4
+ import { bindRequiredMethod, syncMethodNames } from "./host-method-binding.js";
5
+ const packageJsonIndentationSpaces = 2;
6
+ function injectTypesCondition(_key, value) {
7
+ if (!isPlainObject(value)) {
8
+ return value;
9
+ }
10
+ const target = value.import ?? value.default;
11
+ if (!isString(target)) {
12
+ return value;
13
+ }
14
+ return { types: target, ...value };
15
+ }
16
+ function rewriteManifestContent(content) {
17
+ const parsedResult = tryOr(undefined, function () {
18
+ return JSON.parse(content);
19
+ });
20
+ if (parsedResult.isErr) {
21
+ return content;
22
+ }
23
+ const parsed = parsedResult.value;
24
+ if (!isPlainObject(parsed) || !Object.hasOwn(parsed, 'exports')) {
25
+ return content;
26
+ }
27
+ const rewrittenExports = JSON.parse(JSON.stringify(parsed.exports, injectTypesCondition));
28
+ return JSON.stringify({ ...parsed, exports: rewrittenExports }, null, packageJsonIndentationSpaces);
29
+ }
30
+ export function createNodeModulesManifestSynthesizingHost(fileSystemHost) {
31
+ const readFileSync = bindRequiredMethod(fileSystemHost, syncMethodNames.readFile, 'a string', isString);
32
+ const synthesizingHost = {
33
+ ...fileSystemHost,
34
+ async readFile(filePath, encoding) {
35
+ const content = await fileSystemHost.readFile(filePath, encoding);
36
+ if (!isInstalledDependencyManifestPath(filePath)) {
37
+ return content;
38
+ }
39
+ return rewriteManifestContent(content);
40
+ },
41
+ [syncMethodNames.readFile](filePath) {
42
+ // eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
43
+ const content = readFileSync(filePath);
44
+ if (!isInstalledDependencyManifestPath(filePath)) {
45
+ return content;
46
+ }
47
+ return rewriteManifestContent(content);
48
+ }
49
+ };
50
+ Object.setPrototypeOf(synthesizingHost, fileSystemHost);
51
+ return synthesizingHost;
52
+ }
5
53
  //# sourceMappingURL=node-modules-manifest-synthesizer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-modules-manifest-synthesizer.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/node-modules-manifest-synthesizer.ts"],"names":[],"mappings":"AAAA,OAAwC,QAAQ,CAAC;AACjD,OAAsB,kBAAkB,CAAC;AAEzC,OAAkD,6BAA6B,CAAC;AAChF,OAAoD,0BAA0B,CAAC;AA4CnE"}
1
+ {"version":3,"file":"node-modules-manifest-synthesizer.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/node-modules-manifest-synthesizer.ts"],"names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IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,4BAA4B,CAAC,CAAC;AACxG,CAAC;AAED,MAAM,UAAU,yCAAyC,CAAC,cAA8B;IACpF,MAAM,YAAY,GAAG,kBAAkB,CAAC,cAAc,EAAE,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAExG,MAAM,gBAAgB,GAAmB;QACrC,GAAG,cAAc;QACjB,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,QAAiB;YAC9C,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAClE,IAAI,CAAC,iCAAiC,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/C,OAAO,OAAO,CAAC;YACnB,CAAC;YACD,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,QAAgB;YACvC,wGAAwG;YACxG,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;YACvC,IAAI,CAAC,iCAAiC,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/C,OAAO,OAAO,CAAC;YACnB,CAAC;YACD,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;KACJ,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IACxD,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}
@@ -1,2 +1,10 @@
1
- import "../common/package-layout.js";
1
+ import { ancestorInstalledDependencyPathCandidates } from "../common/package-layout.js";
2
+ export function findPackageOwnedAssetFilePath(importValue, currentFolder, fileExists) {
3
+ for (const candidatePath of ancestorInstalledDependencyPathCandidates(currentFolder, importValue)) {
4
+ if (fileExists(candidatePath)) {
5
+ return candidatePath;
6
+ }
7
+ }
8
+ return undefined;
9
+ }
2
10
  //# sourceMappingURL=package-owned-asset-file-path.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"package-owned-asset-file-path.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/package-owned-asset-file-path.ts"],"names":[],"mappings":"AAAA,OAA0D,6BAA6B,CAAC"}
1
+ {"version":3,"file":"package-owned-asset-file-path.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/package-owned-asset-file-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yCAAyC,EAAE,MAAM,6BAA6B,CAAC;AAExF,MAAM,UAAU,6BAA6B,CACzC,WAAmB,EACnB,aAAqB,EACrB,UAAyC;IAEzC,KAAK,MAAM,aAAa,IAAI,yCAAyC,CAAC,aAAa,EAAE,WAAW,CAAC,EAAE,CAAC;QAChG,IAAI,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;YAC5B,OAAO,aAAa,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { MainPackageJson } from '../config/package-json.ts';
2
+ import { type DependencyGraph } from './dependency-graph.ts';
3
+ import type { SourceMapFileLocator } from './source-map-file-locator.ts';
4
+ import type { TypescriptProjectAnalyzer } from './typescript-project-analyzer.ts';
5
+ type ScanOptionsInput = {
6
+ readonly mainPackageJson: MainPackageJson;
7
+ readonly includeSourceMapFiles?: boolean;
8
+ readonly resolveDeclarationFiles?: boolean;
9
+ };
10
+ export type DependencyScannerDependencies = {
11
+ readonly sourceMapFileLocator: SourceMapFileLocator;
12
+ readonly typescriptProjectAnalyzer: TypescriptProjectAnalyzer;
13
+ };
14
+ export type DependencyScanner = {
15
+ scan: (entryPointFile: string, folder: string, options: ScanOptionsInput) => Promise<DependencyGraph>;
16
+ scanEntries: (entryPointFiles: readonly string[], folder: string, options: ScanOptionsInput) => Promise<DependencyGraph>;
17
+ };
18
+ export declare function createDependencyScanner(dependencyScannerDependencies: Readonly<DependencyScannerDependencies>): DependencyScanner;
19
+ export {};
20
+ //# sourceMappingURL=scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/scanner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAyB,KAAK,eAAe,EAAgC,MAAM,uBAAuB,CAAC;AAElH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAqB,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAQrG,KAAK,gBAAgB,GAAG;IACpB,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,QAAQ,CAAC,yBAAyB,EAAE,yBAAyB,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACtG,WAAW,EAAE,CACT,eAAe,EAAE,SAAS,MAAM,EAAE,EAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,KACxB,OAAO,CAAC,eAAe,CAAC,CAAC;CACjC,CAAC;AAiCF,wBAAgB,uBAAuB,CACnC,6BAA6B,EAAE,QAAQ,CAAC,6BAA6B,CAAC,GACvE,iBAAiB,CA6InB"}
@@ -1,5 +1,110 @@
1
- import 'true-myth/maybe';
2
- import "../common/code-files.js";
3
- import "./dependency-graph.js";
4
- import "./source-file-references.js";
1
+ import { Maybe } from 'true-myth/maybe';
2
+ import { isCodeFile } from "../common/code-files.js";
3
+ import { createDependencyGraph } from "./dependency-graph.js";
4
+ import { moduleReferenceKind } from "./source-file-references.js";
5
+ export function createDependencyScanner(dependencyScannerDependencies) {
6
+ const { sourceMapFileLocator, typescriptProjectAnalyzer } = dependencyScannerDependencies;
7
+ async function getDependencyNodeData(input) {
8
+ const sourceMapFilePath = input.options.includeSourceMapFiles && isCodeFile(input.inputFilePath)
9
+ ? await sourceMapFileLocator.locate(input.inputFilePath, input.sourcesFolder)
10
+ : Maybe.nothing();
11
+ return {
12
+ sourceMapFilePath,
13
+ externalDependencies: input.externalDependencies,
14
+ moduleReferences: input.moduleReferences,
15
+ project: input.project
16
+ };
17
+ }
18
+ function collectReferenceLists(references) {
19
+ const localReferences = [];
20
+ const externalDependencies = [];
21
+ for (const reference of references) {
22
+ if (reference.kind === moduleReferenceKind.externalPackage) {
23
+ externalDependencies.push({
24
+ name: reference.packageName,
25
+ sourceSpecifier: reference.sourceSpecifier,
26
+ emittedSpecifier: reference.emittedSpecifier
27
+ });
28
+ }
29
+ else {
30
+ localReferences.push(reference);
31
+ }
32
+ }
33
+ return {
34
+ localReferences,
35
+ externalDependencies
36
+ };
37
+ }
38
+ function getReferencedModules(project, reference) {
39
+ return reference.kind === moduleReferenceKind.localCode ? project.getReferencedModules(reference.filePath) : [];
40
+ }
41
+ function getNodeProject(project, reference) {
42
+ return reference.kind === moduleReferenceKind.localCode ? project : undefined;
43
+ }
44
+ function toDependencyNode(reference, nodeData) {
45
+ return reference.kind === moduleReferenceKind.generatedManifest
46
+ ? { ...nodeData, isGeneratedManifest: true }
47
+ : nodeData;
48
+ }
49
+ async function scanDependenciesOfReference(context, reference) {
50
+ const inputFilePath = reference.filePath;
51
+ const referencedModules = getReferencedModules(context.project, reference);
52
+ const { localReferences, externalDependencies } = collectReferenceLists(referencedModules);
53
+ const nodeData = await getDependencyNodeData({
54
+ externalDependencies,
55
+ moduleReferences: referencedModules,
56
+ options: context.options,
57
+ project: getNodeProject(context.project, reference),
58
+ inputFilePath,
59
+ sourcesFolder: context.folder
60
+ });
61
+ context.graph.addDependency(inputFilePath, toDependencyNode(reference, nodeData));
62
+ for (const localReference of localReferences) {
63
+ if (!context.graph.isKnown(localReference.filePath)) {
64
+ await scanDependenciesOfReference(context, localReference);
65
+ }
66
+ if (!context.graph.hasConnection(inputFilePath, localReference.filePath)) {
67
+ context.graph.connect(inputFilePath, localReference.filePath);
68
+ }
69
+ }
70
+ }
71
+ async function scanEntryReferences(entryPointFiles, context) {
72
+ for (const entryPointFile of entryPointFiles) {
73
+ if (!context.graph.isKnown(entryPointFile)) {
74
+ await scanDependenciesOfReference(context, {
75
+ kind: moduleReferenceKind.localCode,
76
+ filePath: entryPointFile,
77
+ sourceSpecifier: entryPointFile,
78
+ emittedSpecifier: entryPointFile
79
+ });
80
+ }
81
+ }
82
+ }
83
+ async function scanEntries(entryPointFiles, folder, options) {
84
+ const { resolveDeclarationFiles = false, includeSourceMapFiles = false, mainPackageJson } = options;
85
+ const scanOptions = {
86
+ includeSourceMapFiles,
87
+ resolveDeclarationFiles,
88
+ mainPackageJson
89
+ };
90
+ const graph = createDependencyGraph();
91
+ const project = typescriptProjectAnalyzer.analyzeProject(folder, {
92
+ resolveDeclarationFiles: scanOptions.resolveDeclarationFiles,
93
+ mainPackageJson: scanOptions.mainPackageJson
94
+ });
95
+ await scanEntryReferences(entryPointFiles, {
96
+ folder,
97
+ graph,
98
+ options: scanOptions,
99
+ project
100
+ });
101
+ return graph;
102
+ }
103
+ return {
104
+ async scan(entryPointFile, folder, options) {
105
+ return scanEntries([entryPointFile], folder, options);
106
+ },
107
+ scanEntries
108
+ };
109
+ }
5
110
  //# sourceMappingURL=scanner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAsB,iBAAiB,CAAC;AAExC,OAA2B,yB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AAG,OAAO,CAAC;QACpG,MAAM,WAAW,GAAG;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,eAAe;SAClB,CAAC;QAEF,MAAM,KAAK,GAAG,qBAAqB,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,yBAAyB,CAAC,cAAc,CAAC,MAAM,EAAE;YAC7D,uBAAuB,EAAE,WAAW,CAAC,uBAAuB;YAC5D,eAAe,EAAE,WAAW,CAAC,eAAe;SAC/C,CAAC,CAAC;QAEH,MAAM,mBAAmB,CAAC,eAAe,EAAE;YACvC,MAAM;YACN,KAAK;YACL,OAAO,EAAE,WAAW;YACpB,OAAO;SACV,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO;QACH,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO;YACtC,OAAO,WAAW,CAAC,CAAE,cAAc,CAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC;QAED,WAAW;KACd,CAAC;AACN,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { type SourceFile, type StringLiteral } from 'ts-morph';
2
+ export declare const moduleReferenceKind: {
3
+ readonly externalPackage: "external-package";
4
+ readonly generatedManifest: "generated-manifest";
5
+ readonly localAsset: "local-asset";
6
+ readonly localCode: "local-code";
7
+ };
8
+ type ExternalReference = {
9
+ readonly kind: typeof moduleReferenceKind.externalPackage;
10
+ readonly packageName: string;
11
+ readonly sourceSpecifier: string;
12
+ readonly emittedSpecifier: string;
13
+ };
14
+ type ManifestReference = {
15
+ readonly kind: typeof moduleReferenceKind.generatedManifest;
16
+ readonly filePath: string;
17
+ readonly sourceSpecifier: string;
18
+ readonly emittedSpecifier: string;
19
+ };
20
+ type AssetReference = {
21
+ readonly kind: typeof moduleReferenceKind.localAsset;
22
+ readonly filePath: string;
23
+ readonly sourceSpecifier: string;
24
+ readonly emittedSpecifier: string;
25
+ };
26
+ type CodeReference = {
27
+ readonly kind: typeof moduleReferenceKind.localCode;
28
+ readonly filePath: string;
29
+ readonly sourceSpecifier: string;
30
+ readonly emittedSpecifier: string;
31
+ };
32
+ export type ModuleReference = AssetReference | CodeReference | ExternalReference | ManifestReference;
33
+ export declare function resolveSourceFileForLiteral(literal: StringLiteral, containingSourceFile: Readonly<SourceFile>): Readonly<SourceFile | undefined>;
34
+ export declare function getModuleReferenceLiterals(sourceFile: Readonly<SourceFile>): readonly StringLiteral[];
35
+ export declare function getReferencedModules(sourceFile: Readonly<SourceFile>, packageJsonPath: string): readonly Readonly<ModuleReference>[];
36
+ export {};
37
+ //# sourceMappingURL=source-file-references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file-references.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-file-references.ts"],"names":[],"mappings":"AAGA,OAAO,EAKH,KAAK,UAAU,EACf,KAAK,aAAa,EACrB,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAEX,KAAK,iBAAiB,GAAG;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,mBAAmB,CAAC,eAAe,CAAC;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,mBAAmB,CAAC,iBAAiB,CAAC;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,QAAQ,CAAC,IAAI,EAAE,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QA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