packtory 0.0.95 → 0.0.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (673) hide show
  1. package/artifacts/artifacts-builder.d.ts +28 -0
  2. package/artifacts/artifacts-builder.d.ts.map +1 -0
  3. package/artifacts/artifacts-builder.js +37 -4
  4. package/artifacts/artifacts-builder.js.map +1 -1
  5. package/artifacts/content-collection.js +59 -2
  6. package/artifacts/content-collection.js.map +1 -1
  7. package/artifacts/folder-writer.js +25 -2
  8. package/artifacts/folder-writer.js.map +1 -1
  9. package/bundle-emitter/emitter.d.ts +8 -0
  10. package/bundle-emitter/emitter.d.ts.map +1 -1
  11. package/bundle-emitter/emitter.js +137 -6
  12. package/bundle-emitter/emitter.js.map +1 -1
  13. package/bundle-emitter/extract-package-tarball.js +13 -2
  14. package/bundle-emitter/extract-package-tarball.js.map +1 -1
  15. package/bundle-emitter/fetch-published-artifacts.d.ts +2 -0
  16. package/bundle-emitter/fetch-published-artifacts.d.ts.map +1 -1
  17. package/bundle-emitter/fetch-published-artifacts.js +19 -2
  18. package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
  19. package/bundle-emitter/publication-outcome.d.ts +3 -0
  20. package/bundle-emitter/publication-outcome.d.ts.map +1 -1
  21. package/bundle-emitter/publication-outcome.js +5 -0
  22. package/bundle-emitter/publication-outcome.js.map +1 -1
  23. package/bundle-emitter/publish-error/auto-mode-error-matching.js +28 -2
  24. package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
  25. package/bundle-emitter/publish-error/error-shape-helpers.js +9 -0
  26. package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
  27. package/bundle-emitter/publish-error/file-mode-error-matching.js +33 -2
  28. package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
  29. package/bundle-emitter/publish-error/publish-error-messages.js +24 -0
  30. package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
  31. package/bundle-emitter/registry/metadata-auth-retry.js +24 -1
  32. package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
  33. package/bundle-emitter/registry/oidc-token-exchange.js +68 -3
  34. package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
  35. package/bundle-emitter/registry/package-metadata-fetcher.d.ts +14 -0
  36. package/bundle-emitter/registry/package-metadata-fetcher.d.ts.map +1 -1
  37. package/bundle-emitter/registry/package-metadata-fetcher.js +210 -7
  38. package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
  39. package/bundle-emitter/registry/publish-settings-bridge.js +34 -3
  40. package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
  41. package/bundle-emitter/registry/registry-auth-config.d.ts +17 -0
  42. package/bundle-emitter/registry/registry-auth-config.d.ts.map +1 -0
  43. package/bundle-emitter/registry/registry-auth-config.js +106 -0
  44. package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
  45. package/bundle-emitter/registry/registry-client.d.ts +13 -1
  46. package/bundle-emitter/registry/registry-client.d.ts.map +1 -1
  47. package/bundle-emitter/registry/registry-client.js +74 -4
  48. package/bundle-emitter/registry/registry-client.js.map +1 -1
  49. package/bundle-emitter/registry/registry-package-path.js +3 -0
  50. package/bundle-emitter/registry/registry-package-path.js.map +1 -1
  51. package/bundle-emitter/registry/registry-response-schemas.js +50 -2
  52. package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
  53. package/bundle-emitter/registry/tarball-integrity.d.ts +1 -0
  54. package/bundle-emitter/registry/tarball-integrity.d.ts.map +1 -1
  55. package/bundle-emitter/registry/tarball-integrity.js +31 -1
  56. package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
  57. package/bundle-emitter/registry/validate-tarball-host.js +26 -1
  58. package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
  59. package/bundle-emitter/release-artifact-canonicalizer.js +31 -5
  60. package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
  61. package/checks/check-runner.d.ts +18 -0
  62. package/checks/check-runner.d.ts.map +1 -0
  63. package/checks/check-runner.js +8 -0
  64. package/checks/check-runner.js.map +1 -1
  65. package/checks/rule.d.ts +42 -0
  66. package/checks/rule.d.ts.map +1 -0
  67. package/checks/rule.js +12 -2
  68. package/checks/rule.js.map +1 -1
  69. package/checks/rules/duplicate-detection.js +23 -1
  70. package/checks/rules/duplicate-detection.js.map +1 -1
  71. package/checks/rules/duplicate-messages.js +22 -0
  72. package/checks/rules/duplicate-messages.js.map +1 -1
  73. package/checks/rules/file-ownership.js +15 -0
  74. package/checks/rules/file-ownership.js.map +1 -1
  75. package/checks/rules/max-bundle-size.d.ts +13 -0
  76. package/checks/rules/max-bundle-size.d.ts.map +1 -0
  77. package/checks/rules/max-bundle-size.js +55 -1
  78. package/checks/rules/max-bundle-size.js.map +1 -1
  79. package/checks/rules/no-dev-dependency-imports.d.ts +11 -0
  80. package/checks/rules/no-dev-dependency-imports.d.ts.map +1 -0
  81. package/checks/rules/no-dev-dependency-imports.js +51 -1
  82. package/checks/rules/no-dev-dependency-imports.js.map +1 -1
  83. package/checks/rules/no-duplicated-files.d.ts +11 -0
  84. package/checks/rules/no-duplicated-files.d.ts.map +1 -0
  85. package/checks/rules/no-duplicated-files.js +53 -3
  86. package/checks/rules/no-duplicated-files.js.map +1 -1
  87. package/checks/rules/no-side-effects.d.ts +15 -0
  88. package/checks/rules/no-side-effects.d.ts.map +1 -0
  89. package/checks/rules/no-side-effects.js +50 -1
  90. package/checks/rules/no-side-effects.js.map +1 -1
  91. package/checks/rules/no-unexposed-executables.d.ts +8 -0
  92. package/checks/rules/no-unexposed-executables.d.ts.map +1 -0
  93. package/checks/rules/no-unexposed-executables.js +43 -2
  94. package/checks/rules/no-unexposed-executables.js.map +1 -1
  95. package/checks/rules/no-unused-bundle-dependencies.d.ts +8 -0
  96. package/checks/rules/no-unused-bundle-dependencies.d.ts.map +1 -0
  97. package/checks/rules/no-unused-bundle-dependencies.js +30 -2
  98. package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
  99. package/checks/rules/registry.d.ts +23 -0
  100. package/checks/rules/registry.d.ts.map +1 -0
  101. package/checks/rules/registry.js +22 -9
  102. package/checks/rules/registry.js.map +1 -1
  103. package/checks/rules/required-files.d.ts +15 -0
  104. package/checks/rules/required-files.d.ts.map +1 -0
  105. package/checks/rules/required-files.js +41 -3
  106. package/checks/rules/required-files.js.map +1 -1
  107. package/checks/rules/type-script-declaration-integrity.d.ts +9 -0
  108. package/checks/rules/type-script-declaration-integrity.d.ts.map +1 -0
  109. package/checks/rules/type-script-declaration-integrity.js +81 -3
  110. package/checks/rules/type-script-declaration-integrity.js.map +1 -1
  111. package/checks/rules/type-script-declaration-paths.js +55 -1
  112. package/checks/rules/type-script-declaration-paths.js.map +1 -1
  113. package/checks/rules/type-script-declaration-project.d.ts +29 -0
  114. package/checks/rules/type-script-declaration-project.d.ts.map +1 -0
  115. package/checks/rules/type-script-declaration-project.js +202 -3
  116. package/checks/rules/type-script-declaration-project.js.map +1 -1
  117. package/checks/rules/type-script-declaration-reachability.js +38 -2
  118. package/checks/rules/type-script-declaration-reachability.js.map +1 -1
  119. package/checks/rules/type-script-declaration-roots.js +29 -0
  120. package/checks/rules/type-script-declaration-roots.js.map +1 -1
  121. package/checks/rules/type-script-integrity.d.ts +24 -0
  122. package/checks/rules/type-script-integrity.d.ts.map +1 -0
  123. package/checks/rules/type-script-integrity.js +72 -2
  124. package/checks/rules/type-script-integrity.js.map +1 -1
  125. package/checks/rules/type-script-package-resolution.d.ts +29 -0
  126. package/checks/rules/type-script-package-resolution.d.ts.map +1 -0
  127. package/checks/rules/type-script-package-resolution.js +42 -1
  128. package/checks/rules/type-script-package-resolution.js.map +1 -1
  129. package/checks/rules/type-script-resolution-summary.js +53 -0
  130. package/checks/rules/type-script-resolution-summary.js.map +1 -1
  131. package/checks/rules/unique-target-paths.d.ts +8 -0
  132. package/checks/rules/unique-target-paths.d.ts.map +1 -0
  133. package/checks/rules/unique-target-paths.js +34 -2
  134. package/checks/rules/unique-target-paths.js.map +1 -1
  135. package/common/bundled-dependency-groups.js +27 -0
  136. package/common/bundled-dependency-groups.js.map +1 -1
  137. package/common/code-files.js +28 -0
  138. package/common/code-files.js.map +1 -1
  139. package/common/declaration-companion-paths.js +24 -0
  140. package/common/declaration-companion-paths.js.map +1 -1
  141. package/common/package-name-map.js +7 -0
  142. package/common/package-name-map.js.map +1 -1
  143. package/common/stable-json.js +42 -2
  144. package/common/stable-json.js.map +1 -1
  145. package/common/worklist.js +22 -0
  146. package/common/worklist.js.map +1 -1
  147. package/config/additional-files.d.ts +1 -1
  148. package/config/additional-files.js +6 -2
  149. package/config/additional-files.js.map +1 -1
  150. package/config/additional-package-json-attributes-schema.js +6 -2
  151. package/config/additional-package-json-attributes-schema.js.map +1 -1
  152. package/config/automatic-versioning-settings.js +6 -2
  153. package/config/automatic-versioning-settings.js.map +1 -1
  154. package/config/changelog-settings.d.ts +44 -0
  155. package/config/changelog-settings.d.ts.map +1 -1
  156. package/config/changelog-settings.js +120 -3
  157. package/config/changelog-settings.js.map +1 -1
  158. package/config/common-package-settings-schemas.js +19 -3
  159. package/config/common-package-settings-schemas.js.map +1 -1
  160. package/config/config.d.ts +6 -1
  161. package/config/config.d.ts.map +1 -1
  162. package/config/config.js +3 -1
  163. package/config/config.js.map +1 -1
  164. package/config/cross-package-validation.js +17 -0
  165. package/config/cross-package-validation.js.map +1 -1
  166. package/config/dead-code-elimination-settings.d.ts +1 -0
  167. package/config/dead-code-elimination-settings.d.ts.map +1 -1
  168. package/config/dead-code-elimination-settings.js +36 -2
  169. package/config/dead-code-elimination-settings.js.map +1 -1
  170. package/config/dependency-existence-validation.js +19 -1
  171. package/config/dependency-existence-validation.js.map +1 -1
  172. package/config/dependency-policy.js +5 -2
  173. package/config/dependency-policy.js.map +1 -1
  174. package/config/main-package-json-schema.js +13 -2
  175. package/config/main-package-json-schema.js.map +1 -1
  176. package/config/manual-versioning-settings.d.ts +12 -0
  177. package/config/manual-versioning-settings.d.ts.map +1 -1
  178. package/config/manual-versioning-settings.js +29 -2
  179. package/config/manual-versioning-settings.js.map +1 -1
  180. package/config/optional-package-settings-schema.js +16 -7
  181. package/config/optional-package-settings-schema.js.map +1 -1
  182. package/config/package-config.d.ts +4 -0
  183. package/config/package-config.d.ts.map +1 -1
  184. package/config/package-config.js +2 -1
  185. package/config/package-config.js.map +1 -1
  186. package/config/package-graph-builder.js +14 -2
  187. package/config/package-graph-builder.js.map +1 -1
  188. package/config/package-interface.js +25 -2
  189. package/config/package-interface.js.map +1 -1
  190. package/config/package-json.d.ts +2 -0
  191. package/config/package-json.d.ts.map +1 -1
  192. package/config/package-json.js +16 -0
  193. package/config/package-json.js.map +1 -1
  194. package/config/packtory-config-schema.d.ts +12 -12
  195. package/config/packtory-config-without-registry-schema.js +6 -0
  196. package/config/packtory-config-without-registry-schema.js.map +1 -1
  197. package/config/per-package-settings-schema.js +22 -6
  198. package/config/per-package-settings-schema.js.map +1 -1
  199. package/config/pre-graph-validation.js +20 -5
  200. package/config/pre-graph-validation.js.map +1 -1
  201. package/config/publish-settings.d.ts +3 -0
  202. package/config/publish-settings.d.ts.map +1 -1
  203. package/config/publish-settings.js +25 -3
  204. package/config/publish-settings.js.map +1 -1
  205. package/config/publish-settings.report.js +17 -1
  206. package/config/publish-settings.report.js.map +1 -1
  207. package/config/registry-settings.d.ts +41 -0
  208. package/config/registry-settings.d.ts.map +1 -1
  209. package/config/registry-settings.js +40 -2
  210. package/config/registry-settings.js.map +1 -1
  211. package/config/registry-settings.report.js +46 -0
  212. package/config/registry-settings.report.js.map +1 -1
  213. package/config/root-config-validation.js +141 -0
  214. package/config/root-config-validation.js.map +1 -1
  215. package/config/root.js +6 -2
  216. package/config/root.js.map +1 -1
  217. package/config/sbom-settings.js +4 -1
  218. package/config/sbom-settings.js.map +1 -1
  219. package/config/settings-validation.js +28 -0
  220. package/config/settings-validation.js.map +1 -1
  221. package/config/validation.d.ts.map +1 -1
  222. package/config/validation.js +35 -1
  223. package/config/validation.js.map +1 -1
  224. package/config/versioning-settings.d.ts +18 -1
  225. package/config/versioning-settings.d.ts.map +1 -1
  226. package/config/versioning-settings.js +10 -3
  227. package/config/versioning-settings.js.map +1 -1
  228. package/dead-code-eliminator/analyzed-bundle.d.ts +11 -0
  229. package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
  230. package/dead-code-eliminator/analyzed-bundle.js +7 -0
  231. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  232. package/dead-code-eliminator/bundle-analysis.js +38 -5
  233. package/dead-code-eliminator/bundle-analysis.js.map +1 -1
  234. package/dead-code-eliminator/class-purity.js +48 -2
  235. package/dead-code-eliminator/class-purity.js.map +1 -1
  236. package/dead-code-eliminator/code-file-analyzer.js +68 -4
  237. package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
  238. package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -1
  239. package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
  240. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
  241. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
  242. package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -4
  243. package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
  244. package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
  245. package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
  246. package/dead-code-eliminator/dependency-metadata.js +172 -3
  247. package/dead-code-eliminator/dependency-metadata.js.map +1 -1
  248. package/dead-code-eliminator/elimination-emitter.js +52 -0
  249. package/dead-code-eliminator/elimination-emitter.js.map +1 -1
  250. package/dead-code-eliminator/eliminator.js +22 -4
  251. package/dead-code-eliminator/eliminator.js.map +1 -1
  252. package/dead-code-eliminator/expression-unwrapping.js +16 -1
  253. package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
  254. package/dead-code-eliminator/imported-expression-origin.js +101 -2
  255. package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
  256. package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
  257. package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
  258. package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
  259. package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
  260. package/dead-code-eliminator/liveness/external-module-resolution.js +172 -2
  261. package/dead-code-eliminator/liveness/external-module-resolution.js.map +1 -1
  262. package/dead-code-eliminator/liveness/external-purity-summary.js +294 -3
  263. package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
  264. package/dead-code-eliminator/liveness/external-purity.js +39 -3
  265. package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
  266. package/dead-code-eliminator/liveness/module-analysis.js +27 -2
  267. package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
  268. package/dead-code-eliminator/liveness/resource-retention.js +91 -1
  269. package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
  270. package/dead-code-eliminator/liveness/runtime-code.js +15 -1
  271. package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
  272. package/dead-code-eliminator/load-bundle.js +86 -5
  273. package/dead-code-eliminator/load-bundle.js.map +1 -1
  274. package/dead-code-eliminator/pure-expression.js +178 -5
  275. package/dead-code-eliminator/pure-expression.js.map +1 -1
  276. package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
  277. package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
  278. package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
  279. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  280. package/dead-code-eliminator/reachability/binding-id.js +106 -1
  281. package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
  282. package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -2
  283. package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
  284. package/dead-code-eliminator/reachability/impure-statements.js +11 -2
  285. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  286. package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
  287. package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
  288. package/dead-code-eliminator/reachability/reachability.js +65 -4
  289. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  290. package/dead-code-eliminator/side-effect-classifier.js +39 -4
  291. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  292. package/dead-code-eliminator/side-effects-field.js +23 -1
  293. package/dead-code-eliminator/side-effects-field.js.map +1 -1
  294. package/dead-code-eliminator/source-map-recomposition.js +29 -2
  295. package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
  296. package/dead-code-eliminator/statement-classifiers.js +94 -4
  297. package/dead-code-eliminator/statement-classifiers.js.map +1 -1
  298. package/dead-code-eliminator/syntax-kind-sets.js +16 -0
  299. package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
  300. package/dead-code-eliminator/transform/atom-translator.d.ts +8 -0
  301. package/dead-code-eliminator/transform/atom-translator.d.ts.map +1 -1
  302. package/dead-code-eliminator/transform/atom-translator.js +57 -2
  303. package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
  304. package/dead-code-eliminator/transform/declaration-removal.js +183 -5
  305. package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
  306. package/dead-code-eliminator/transform/declaration-remover.js +17 -2
  307. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  308. package/dead-code-eliminator/transform/line-index.d.ts +7 -0
  309. package/dead-code-eliminator/transform/line-index.d.ts.map +1 -1
  310. package/dead-code-eliminator/transform/line-index.js +20 -0
  311. package/dead-code-eliminator/transform/line-index.js.map +1 -1
  312. package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
  313. package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
  314. package/dead-code-eliminator/transform/source-map-composer.js +84 -3
  315. package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
  316. package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
  317. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
  318. package/dependency-scanner/dependency-graph.d.ts +41 -0
  319. package/dependency-scanner/dependency-graph.d.ts.map +1 -0
  320. package/dependency-scanner/dependency-graph.js +77 -3
  321. package/dependency-scanner/dependency-graph.js.map +1 -1
  322. package/dependency-scanner/external-dependencies.d.ts +10 -1
  323. package/dependency-scanner/external-dependencies.d.ts.map +1 -1
  324. package/dependency-scanner/external-dependencies.js +55 -1
  325. package/dependency-scanner/external-dependencies.js.map +1 -1
  326. package/dependency-scanner/file-host-predicates.js +9 -0
  327. package/dependency-scanner/file-host-predicates.js.map +1 -1
  328. package/dependency-scanner/host-method-binding.js +18 -0
  329. package/dependency-scanner/host-method-binding.js.map +1 -1
  330. package/dependency-scanner/injected-dynamic-imports.js +232 -1
  331. package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
  332. package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
  333. package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
  334. package/dependency-scanner/package-owned-asset-file-path.js +9 -1
  335. package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
  336. package/dependency-scanner/scanner.d.ts +20 -0
  337. package/dependency-scanner/scanner.d.ts.map +1 -0
  338. package/dependency-scanner/scanner.js +109 -4
  339. package/dependency-scanner/scanner.js.map +1 -1
  340. package/dependency-scanner/source-file-references.d.ts +37 -0
  341. package/dependency-scanner/source-file-references.d.ts.map +1 -0
  342. package/dependency-scanner/source-file-references.js +181 -6
  343. package/dependency-scanner/source-file-references.js.map +1 -1
  344. package/dependency-scanner/source-map-file-locator.d.ts +10 -0
  345. package/dependency-scanner/source-map-file-locator.d.ts.map +1 -0
  346. package/dependency-scanner/source-map-file-locator.js +66 -2
  347. package/dependency-scanner/source-map-file-locator.js.map +1 -1
  348. package/dependency-scanner/typescript-compiler-options.d.ts +8 -0
  349. package/dependency-scanner/typescript-compiler-options.d.ts.map +1 -0
  350. package/dependency-scanner/typescript-compiler-options.js +21 -1
  351. package/dependency-scanner/typescript-compiler-options.js.map +1 -1
  352. package/dependency-scanner/typescript-file-host.d.ts +12 -0
  353. package/dependency-scanner/typescript-file-host.d.ts.map +1 -0
  354. package/dependency-scanner/typescript-file-host.js +49 -5
  355. package/dependency-scanner/typescript-file-host.js.map +1 -1
  356. package/dependency-scanner/typescript-project-analyzer.d.ts +19 -0
  357. package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -0
  358. package/dependency-scanner/typescript-project-analyzer.js +35 -3
  359. package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
  360. package/dependency-scanner/virtual-package-json-host.js +45 -4
  361. package/dependency-scanner/virtual-package-json-host.js.map +1 -1
  362. package/directed-graph/graph.d.ts +1 -0
  363. package/directed-graph/graph.d.ts.map +1 -1
  364. package/directed-graph/graph.js +240 -1
  365. package/directed-graph/graph.js.map +1 -1
  366. package/file-manager/compare.js +23 -2
  367. package/file-manager/compare.js.map +1 -1
  368. package/file-manager/equal.js +5 -0
  369. package/file-manager/equal.js.map +1 -1
  370. package/file-manager/file-description.d.ts +2 -1
  371. package/file-manager/file-description.d.ts.map +1 -1
  372. package/file-manager/file-description.js +3 -0
  373. package/file-manager/file-description.js.map +1 -1
  374. package/file-manager/file-manager.d.ts +1 -1
  375. package/file-manager/file-manager.d.ts.map +1 -1
  376. package/file-manager/file-manager.js +4 -4
  377. package/file-manager/file-manager.js.map +1 -1
  378. package/file-manager/permissions.js +28 -1
  379. package/file-manager/permissions.js.map +1 -1
  380. package/git/current-git-head.d.ts +12 -0
  381. package/git/current-git-head.d.ts.map +1 -0
  382. package/git/current-git-head.js +24 -0
  383. package/git/current-git-head.js.map +1 -1
  384. package/git/git-command.js +49 -1
  385. package/git/git-command.js.map +1 -1
  386. package/linker/linked-bundle.d.ts +19 -2
  387. package/linker/linked-bundle.d.ts.map +1 -1
  388. package/linker/linked-bundle.js +5 -0
  389. package/linker/linked-bundle.js.map +1 -1
  390. package/linker/linker.d.ts +13 -0
  391. package/linker/linker.d.ts.map +1 -0
  392. package/linker/linker.js +51 -5
  393. package/linker/linker.js.map +1 -1
  394. package/linker/replacement-lookup.js +297 -8
  395. package/linker/replacement-lookup.js.map +1 -1
  396. package/linker/resource-graph.js +65 -2
  397. package/linker/resource-graph.js.map +1 -1
  398. package/linker/source-modifier/import-paths.js +76 -3
  399. package/linker/source-modifier/import-paths.js.map +1 -1
  400. package/linker/substitute-bundles.js +166 -3
  401. package/linker/substitute-bundles.js.map +1 -1
  402. package/linker/substituted-resource-graph.js +111 -2
  403. package/linker/substituted-resource-graph.js.map +1 -1
  404. package/npm-oidc-id-token-resolver.js +82 -0
  405. package/npm-oidc-id-token-resolver.js.map +1 -1
  406. package/pack-emitter/pack-emitter.d.ts +20 -0
  407. package/pack-emitter/pack-emitter.d.ts.map +1 -1
  408. package/pack-emitter/pack-emitter.js +27 -0
  409. package/pack-emitter/pack-emitter.js.map +1 -1
  410. package/package-surface/bin-field.js +8 -2
  411. package/package-surface/bin-field.js.map +1 -1
  412. package/package-surface/explicit-bin.js +24 -2
  413. package/package-surface/explicit-bin.js.map +1 -1
  414. package/package-surface/explicit-exports.js +26 -3
  415. package/package-surface/explicit-exports.js.map +1 -1
  416. package/package-surface/export-map.js +9 -2
  417. package/package-surface/export-map.js.map +1 -1
  418. package/package-surface/implicit-bin.js +25 -1
  419. package/package-surface/implicit-bin.js.map +1 -1
  420. package/package-surface/implicit-exports.js +10 -3
  421. package/package-surface/implicit-exports.js.map +1 -1
  422. package/package-surface/implicit-root-exports.js +13 -2
  423. package/package-surface/implicit-root-exports.js.map +1 -1
  424. package/package-surface/package-json-export.js +9 -0
  425. package/package-surface/package-json-export.js.map +1 -1
  426. package/package-surface/package-shape.js +10 -1
  427. package/package-surface/package-shape.js.map +1 -1
  428. package/package-surface/package-surface-index.js +165 -3
  429. package/package-surface/package-surface-index.js.map +1 -1
  430. package/package-surface/public-module-usage.js +46 -3
  431. package/package-surface/public-module-usage.js.map +1 -1
  432. package/package-surface/public-specifiers.js +7 -1
  433. package/package-surface/public-specifiers.js.map +1 -1
  434. package/package-surface/root-registry.js +26 -0
  435. package/package-surface/root-registry.js.map +1 -1
  436. package/package-surface/specifier-syntax.js +4 -0
  437. package/package-surface/specifier-syntax.js.map +1 -1
  438. package/package-surface/substitution-exports.js +101 -3
  439. package/package-surface/substitution-exports.js.map +1 -1
  440. package/package-surface/surface.d.ts +2 -0
  441. package/package-surface/surface.d.ts.map +1 -1
  442. package/package-surface/surface.js +12 -0
  443. package/package-surface/surface.js.map +1 -1
  444. package/package.json +1 -1
  445. package/packages/package-processor.composition.d.ts +22 -0
  446. package/packages/package-processor.composition.d.ts.map +1 -1
  447. package/packages/package-processor.composition.js +161 -34
  448. package/packages/package-processor.composition.js.map +1 -1
  449. package/packtory/changelog-source-attribution.js +16 -16
  450. package/packtory/changelog-source-attribution.js.map +1 -1
  451. package/packtory/map-config.d.ts +11 -1
  452. package/packtory/map-config.d.ts.map +1 -1
  453. package/packtory/map-config.js +35 -4
  454. package/packtory/map-config.js.map +1 -1
  455. package/packtory/normalize-paths.js +25 -1
  456. package/packtory/normalize-paths.js.map +1 -1
  457. package/packtory/options/bundle-dependency-resolution.js +17 -1
  458. package/packtory/options/bundle-dependency-resolution.js.map +1 -1
  459. package/packtory/options/dead-code-elimination-resolution.js +10 -1
  460. package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
  461. package/packtory/options/prepare-package-options.d.ts +13 -1
  462. package/packtory/options/prepare-package-options.d.ts.map +1 -1
  463. package/packtory/options/prepare-package-options.js +46 -5
  464. package/packtory/options/prepare-package-options.js.map +1 -1
  465. package/packtory/options/required-value-helpers.js +17 -0
  466. package/packtory/options/required-value-helpers.js.map +1 -1
  467. package/packtory/options/setting-resolvers.d.ts +17 -1
  468. package/packtory/options/setting-resolvers.d.ts.map +1 -1
  469. package/packtory/options/setting-resolvers.js +47 -3
  470. package/packtory/options/setting-resolvers.js.map +1 -1
  471. package/packtory/options/surface-resolution.js +15 -2
  472. package/packtory/options/surface-resolution.js.map +1 -1
  473. package/packtory/options/version-provider-context.js +24 -2
  474. package/packtory/options/version-provider-context.js.map +1 -1
  475. package/packtory/options/version-trigger.js +39 -2
  476. package/packtory/options/version-trigger.js.map +1 -1
  477. package/packtory/pack-output-preflight.js +60 -3
  478. package/packtory/pack-output-preflight.js.map +1 -1
  479. package/packtory/package-processor-build.js +97 -3
  480. package/packtory/package-processor-build.js.map +1 -1
  481. package/packtory/package-processor-publish-result.d.ts +3 -0
  482. package/packtory/package-processor-publish-result.d.ts.map +1 -1
  483. package/packtory/package-processor-publish.d.ts +2 -0
  484. package/packtory/package-processor-publish.d.ts.map +1 -1
  485. package/packtory/package-processor-publish.js +297 -6
  486. package/packtory/package-processor-publish.js.map +1 -1
  487. package/packtory/package-processor.d.ts +34 -0
  488. package/packtory/package-processor.d.ts.map +1 -1
  489. package/packtory/package-processor.js +10 -2
  490. package/packtory/package-processor.js.map +1 -1
  491. package/packtory/packtory-pack.js +298 -10
  492. package/packtory/packtory-pack.js.map +1 -1
  493. package/packtory/packtory-package-dependencies.js +116 -3
  494. package/packtory/packtory-package-dependencies.js.map +1 -1
  495. package/packtory/packtory-package-inspection.js +26 -5
  496. package/packtory/packtory-package-inspection.js.map +1 -1
  497. package/packtory/packtory-package-side-effects.js +64 -3
  498. package/packtory/packtory-package-side-effects.js.map +1 -1
  499. package/packtory/packtory-package-tree.js +43 -4
  500. package/packtory/packtory-package-tree.js.map +1 -1
  501. package/packtory/packtory-publish.js +17 -4
  502. package/packtory/packtory-publish.js.map +1 -1
  503. package/packtory/packtory-release-analysis.js +64 -6
  504. package/packtory/packtory-release-analysis.js.map +1 -1
  505. package/packtory/packtory-release-diff.js +48 -5
  506. package/packtory/packtory-release-diff.js.map +1 -1
  507. package/packtory/packtory-release-plan.js +87 -6
  508. package/packtory/packtory-release-plan.js.map +1 -1
  509. package/packtory/packtory-resolve.js +16 -5
  510. package/packtory/packtory-resolve.js.map +1 -1
  511. package/packtory/packtory.d.ts +28 -1
  512. package/packtory/packtory.d.ts.map +1 -1
  513. package/packtory/packtory.js +242 -13
  514. package/packtory/packtory.js.map +1 -1
  515. package/packtory/publish-failure-mapping.js +6 -0
  516. package/packtory/publish-failure-mapping.js.map +1 -1
  517. package/packtory/publish-target-preflight.js +25 -3
  518. package/packtory/publish-target-preflight.js.map +1 -1
  519. package/packtory/published-release-state.d.ts +19 -0
  520. package/packtory/published-release-state.d.ts.map +1 -1
  521. package/packtory/published-release-state.js +11 -0
  522. package/packtory/published-release-state.js.map +1 -1
  523. package/packtory/release-analysis.js +153 -5
  524. package/packtory/release-analysis.js.map +1 -1
  525. package/packtory/release-diff-failure-mapping.js +6 -0
  526. package/packtory/release-diff-failure-mapping.js.map +1 -1
  527. package/packtory/release-plan.js +135 -7
  528. package/packtory/release-plan.js.map +1 -1
  529. package/packtory/report-attachment.js +35 -2
  530. package/packtory/report-attachment.js.map +1 -1
  531. package/packtory/resolved-package.d.ts +11 -0
  532. package/packtory/resolved-package.d.ts.map +1 -1
  533. package/packtory/resolved-package.js +97 -3
  534. package/packtory/resolved-package.js.map +1 -1
  535. package/packtory/scheduler.d.ts +47 -0
  536. package/packtory/scheduler.d.ts.map +1 -1
  537. package/packtory/scheduler.js +99 -1
  538. package/packtory/scheduler.js.map +1 -1
  539. package/packtory/stages/package-analysis-stage.js +50 -2
  540. package/packtory/stages/package-analysis-stage.js.map +1 -1
  541. package/packtory/stages/package-resolution-stage.js +80 -5
  542. package/packtory/stages/package-resolution-stage.js.map +1 -1
  543. package/packtory/stages/publish-stage.js +125 -4
  544. package/packtory/stages/publish-stage.js.map +1 -1
  545. package/packtory/stages/release-diff-stage.js +84 -5
  546. package/packtory/stages/release-diff-stage.js.map +1 -1
  547. package/progress/progress-broadcaster.d.ts +1 -0
  548. package/progress/progress-broadcaster.d.ts.map +1 -1
  549. package/progress/progress-broadcaster.js +45 -0
  550. package/progress/progress-broadcaster.js.map +1 -1
  551. package/published-package/published-package.d.ts +2 -0
  552. package/published-package/published-package.d.ts.map +1 -1
  553. package/published-package/published-package.js +12 -1
  554. package/published-package/published-package.js.map +1 -1
  555. package/report/aggregator/artifact-entry-merger.js +20 -0
  556. package/report/aggregator/artifact-entry-merger.js.map +1 -1
  557. package/report/aggregator/package-report-materialization.js +75 -2
  558. package/report/aggregator/package-report-materialization.js.map +1 -1
  559. package/report/aggregator/report-aggregator.js +37 -2
  560. package/report/aggregator/report-aggregator.js.map +1 -1
  561. package/report/aggregator/report-event-handlers.js +141 -2
  562. package/report/aggregator/report-event-handlers.js.map +1 -1
  563. package/report/aggregator/report-types.d.ts +21 -0
  564. package/report/aggregator/report-types.d.ts.map +1 -1
  565. package/report/aggregator/report-types.js +3 -0
  566. package/report/aggregator/report-types.js.map +1 -1
  567. package/report/config-redactor.js +29 -3
  568. package/report/config-redactor.js.map +1 -1
  569. package/report/decorators.js +85 -0
  570. package/report/decorators.js.map +1 -1
  571. package/report/inspectors/inspect-artifact-sizes.js +34 -1
  572. package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
  573. package/report/inspectors/inspect-linker-rewrites.js +14 -1
  574. package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
  575. package/report/inspectors/inspect-package-json-provenance.js +15 -0
  576. package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
  577. package/report/inspectors/inspect-scan-results.js +15 -0
  578. package/report/inspectors/inspect-scan-results.js.map +1 -1
  579. package/report/release-diff/release-version-transition.js +18 -0
  580. package/report/release-diff/release-version-transition.js.map +1 -1
  581. package/resource-resolver/bundle-resource-lookup.js +25 -0
  582. package/resource-resolver/bundle-resource-lookup.js.map +1 -1
  583. package/resource-resolver/content.js +136 -3
  584. package/resource-resolver/content.js.map +1 -1
  585. package/resource-resolver/dependency-resolution-walker.js +73 -2
  586. package/resource-resolver/dependency-resolution-walker.js.map +1 -1
  587. package/resource-resolver/resolved-bundle.d.ts +54 -0
  588. package/resource-resolver/resolved-bundle.d.ts.map +1 -1
  589. package/resource-resolver/resolved-bundle.js +3 -0
  590. package/resource-resolver/resolved-bundle.js.map +1 -1
  591. package/resource-resolver/resource-resolve-options.d.ts +5 -0
  592. package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
  593. package/resource-resolver/resource-resolve-options.js +13 -1
  594. package/resource-resolver/resource-resolve-options.js.map +1 -1
  595. package/resource-resolver/resource-resolver.d.ts +15 -0
  596. package/resource-resolver/resource-resolver.d.ts.map +1 -0
  597. package/resource-resolver/resource-resolver.js +128 -5
  598. package/resource-resolver/resource-resolver.js.map +1 -1
  599. package/sbom/extract-license.js +11 -1
  600. package/sbom/extract-license.js.map +1 -1
  601. package/sbom/license-resolver.d.ts +14 -0
  602. package/sbom/license-resolver.d.ts.map +1 -0
  603. package/sbom/license-resolver.js +23 -2
  604. package/sbom/license-resolver.js.map +1 -1
  605. package/sbom/sbom-builder.js +57 -2
  606. package/sbom/sbom-builder.js.map +1 -1
  607. package/sbom/sbom-canonicalizer.js +45 -3
  608. package/sbom/sbom-canonicalizer.js.map +1 -1
  609. package/sbom/sbom-file.d.ts +10 -0
  610. package/sbom/sbom-file.d.ts.map +1 -1
  611. package/sbom/sbom-file.js +54 -5
  612. package/sbom/sbom-file.js.map +1 -1
  613. package/sbom/sbom-serializer.d.ts +8 -0
  614. package/sbom/sbom-serializer.d.ts.map +1 -0
  615. package/sbom/sbom-serializer.js +14 -1
  616. package/sbom/sbom-serializer.js.map +1 -1
  617. package/sbom/tool-version.js +49 -1
  618. package/sbom/tool-version.js.map +1 -1
  619. package/sbom.cdx.json +5 -5
  620. package/tar/extract-tar.js +83 -3
  621. package/tar/extract-tar.js.map +1 -1
  622. package/tar/gzipped-pack.js +20 -0
  623. package/tar/gzipped-pack.js.map +1 -1
  624. package/tar/tarball-builder.d.ts +14 -0
  625. package/tar/tarball-builder.d.ts.map +1 -0
  626. package/tar/tarball-builder.js +44 -4
  627. package/tar/tarball-builder.js.map +1 -1
  628. package/vendor-materializer/vendor-entry.d.ts +12 -0
  629. package/vendor-materializer/vendor-entry.d.ts.map +1 -0
  630. package/vendor-materializer/vendor-entry.js +20 -1
  631. package/vendor-materializer/vendor-entry.js.map +1 -1
  632. package/vendor-materializer/vendor-materializer.d.ts +55 -0
  633. package/vendor-materializer/vendor-materializer.d.ts.map +1 -0
  634. package/vendor-materializer/vendor-materializer.js +240 -8
  635. package/vendor-materializer/vendor-materializer.js.map +1 -1
  636. package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
  637. package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
  638. package/version-manager/dependencies/dependency-groups.js +11 -1
  639. package/version-manager/dependencies/dependency-groups.js.map +1 -1
  640. package/version-manager/dependencies/external-dependency-classification.js +82 -3
  641. package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
  642. package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
  643. package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
  644. package/version-manager/imports/hash-import-scanner.js +20 -2
  645. package/version-manager/imports/hash-import-scanner.js.map +1 -1
  646. package/version-manager/imports/imports-key-matcher.js +22 -0
  647. package/version-manager/imports/imports-key-matcher.js.map +1 -1
  648. package/version-manager/imports/versioned-bundle-imports.js +44 -2
  649. package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
  650. package/version-manager/manager.d.ts +5 -0
  651. package/version-manager/manager.d.ts.map +1 -1
  652. package/version-manager/manager.js +46 -6
  653. package/version-manager/manager.js.map +1 -1
  654. package/version-manager/manifest/builder.js +51 -1
  655. package/version-manager/manifest/builder.js.map +1 -1
  656. package/version-manager/manifest/serialize.js +8 -1
  657. package/version-manager/manifest/serialize.js.map +1 -1
  658. package/version-manager/optional-bundle-fields.js +5 -1
  659. package/version-manager/optional-bundle-fields.js.map +1 -1
  660. package/version-manager/representative-root.js +9 -1
  661. package/version-manager/representative-root.js.map +1 -1
  662. package/version-manager/specifier-classifier.js +42 -2
  663. package/version-manager/specifier-classifier.js.map +1 -1
  664. package/version-manager/specifier-errors.js +58 -0
  665. package/version-manager/specifier-errors.js.map +1 -1
  666. package/version-manager/versioned-bundle.d.ts +3 -1
  667. package/version-manager/versioned-bundle.d.ts.map +1 -1
  668. package/version-manager/versioned-bundle.js +31 -6
  669. package/version-manager/versioned-bundle.js.map +1 -1
  670. package/zip/zip-builder.d.ts +22 -0
  671. package/zip/zip-builder.d.ts.map +1 -0
  672. package/zip/zip-builder.js +81 -2
  673. package/zip/zip-builder.js.map +1 -1
@@ -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,yBAAyB,CAAC;AACrD,OAA0F,uBAAuB,CAAC;AAGlH,OAA0D,6BAA6B,CAAC"}
1
+ {"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAsD,MAAM,uBAAuB,CAAC;AAGlH,OAAO,EAAE,mBAAmB,EAAwB,MAAM,6BAA6B,CAAC;AA4DxF,MAAM,UAAU,uBAAuB,CACnC,6BAAsE;IAEtE,MAAM,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,GAAG,6BAA6B,CAAC;IAE1F,KAAK,UAAU,qBAAqB,CAAC,KAA8B;QAC/D,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,qBAAqB,IAAI,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC;YAC5F,CAAC,CAAC,MAAM,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC;YAC7E,CAAC,CAAC,KAAK,CAAC,OAAO,EAAU,CAAC;QAE9B,OAAO;YACH,iBAAiB;YACjB,oBAAoB,E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I,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;gBACzC,MAAM,2BAA2B,CAC7B,OAAO,EACP;oBACI,IAAI,EAAE,mBAAmB,CAAC,SAAS;oBACnC,QAAQ,EAAE,cAAc;oBACxB,eAAe,EAAE,cAAc;oBAC/B,gBAAgB,EAAE,cAAc;iBACnC,CACJ,CAAC;YACN,CAAC;QACL,CAAC;IACL,CAAC;IAED,KAAK,UAAU,WAAW,CACtB,eAAkC,EAClC,MAAc,EACd,OAAyB;QAEzB,MAAM,EAAE,uBAAuB,GAAG,KAAK,EAAE,qBAAqB,GAAG,KAAK,EAAE,eAAe,EAAE,GAAG,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,CA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 +1,182 @@
1
- import 'node:path';
2
- import 'node:module';
3
- import 'common-tags';
4
- import 'ts-morph';
5
- import "./injected-dynamic-imports.js";
6
- import "./package-owned-asset-file-path.js";
1
+ import path from 'node:path';
2
+ import { isBuiltin } from 'node:module';
3
+ import { oneLine } from 'common-tags';
4
+ import { SyntaxKind, ts } from 'ts-morph';
5
+ import { getInjectedDynamicImportLiterals } from "./injected-dynamic-imports.js";
6
+ import { findPackageOwnedAssetFilePath } from "./package-owned-asset-file-path.js";
7
+ export const moduleReferenceKind = {
8
+ externalPackage: 'external-package',
9
+ generatedManifest: 'generated-manifest',
10
+ localAsset: 'local-asset',
11
+ localCode: 'local-code'
12
+ };
13
+ function hashImportPrefix() {
14
+ return '#';
15
+ }
16
+ function typesDependenciesFolderPath() {
17
+ return `${path.sep}node_modules${path.sep}@types${path.sep}`;
18
+ }
19
+ function isRelativeOrAbsoluteSpecifier(specifier) {
20
+ return specifier.startsWith('.') || path.isAbsolute(specifier);
21
+ }
22
+ function isHashSpecifier(specifier) {
23
+ return specifier.startsWith(hashImportPrefix());
24
+ }
25
+ const scopedPackageSegmentCount = 2;
26
+ function packageNameFromSpecifier(specifier) {
27
+ if (specifier.startsWith('@')) {
28
+ const [scope, name] = specifier.split('/', scopedPackageSegmentCount);
29
+ if (name === undefined) {
30
+ throw new Error(`Invalid package specifier "${specifier}"`);
31
+ }
32
+ return `${scope}/${name}`;
33
+ }
34
+ const separatorIndex = specifier.indexOf('/');
35
+ return separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
36
+ }
37
+ function typesPackageNameFromResolvedPath(resolvedFilePath) {
38
+ const normalizedPath = path.normalize(resolvedFilePath);
39
+ const folderPath = typesDependenciesFolderPath();
40
+ const folderIndex = normalizedPath.lastIndexOf(folderPath);
41
+ if (folderIndex === -1) {
42
+ return undefined;
43
+ }
44
+ const relativePath = normalizedPath.slice(folderIndex + folderPath.length);
45
+ const [packageName] = relativePath.split(path.sep);
46
+ return `@types/${packageName}`;
47
+ }
48
+ function externalPackageNameForResolvedImport(importValue, resolvedFilePath, containingSourceFile) {
49
+ if (containingSourceFile.getFilePath().endsWith('.d.ts')) {
50
+ return typesPackageNameFromResolvedPath(resolvedFilePath) ?? packageNameFromSpecifier(importValue);
51
+ }
52
+ return packageNameFromSpecifier(importValue);
53
+ }
54
+ function isLocalAssetReference(filePath) {
55
+ const extension = path.extname(filePath);
56
+ return extension === '.json' || extension === '.wasm';
57
+ }
58
+ function referenceSpecifiers(importValue) {
59
+ return {
60
+ sourceSpecifier: importValue,
61
+ emittedSpecifier: importValue
62
+ };
63
+ }
64
+ function classifyLocalReference(resolvedFilePath, packageJsonPath, importValue) {
65
+ const specifiers = referenceSpecifiers(importValue);
66
+ if (path.resolve(resolvedFilePath) === path.resolve(packageJsonPath)) {
67
+ return { kind: moduleReferenceKind.generatedManifest, filePath: resolvedFilePath, ...specifiers };
68
+ }
69
+ if (isLocalAssetReference(resolvedFilePath)) {
70
+ return { kind: moduleReferenceKind.localAsset, filePath: resolvedFilePath, ...specifiers };
71
+ }
72
+ return { kind: moduleReferenceKind.localCode, filePath: resolvedFilePath, ...specifiers };
73
+ }
74
+ function resolvedModuleForImport(importValue, containingSourceFile) {
75
+ const project = containingSourceFile.getProject();
76
+ return ts
77
+ .resolveModuleName(importValue, containingSourceFile.getFilePath(), project.getCompilerOptions(), project.getModuleResolutionHost())
78
+ .resolvedModule;
79
+ }
80
+ export function resolveSourceFileForLiteral(literal, containingSourceFile) {
81
+ const project = containingSourceFile.getProject();
82
+ const resolvedModule = resolvedModuleForImport(literal.getLiteralValue(), containingSourceFile);
83
+ if (resolvedModule !== undefined) {
84
+ const resolvedFilePath = resolvedModule.resolvedFileName;
85
+ return project.getSourceFile(resolvedFilePath);
86
+ }
87
+ return undefined;
88
+ }
89
+ function resolveWasmReference(importValue, containingSourceFile, packageJsonPath) {
90
+ if (isRelativeOrAbsoluteSpecifier(importValue)) {
91
+ const moduleResolutionHost = containingSourceFile.getProject().getModuleResolutionHost();
92
+ const candidatePath = path.resolve(path.dirname(containingSourceFile.getFilePath()), importValue);
93
+ return moduleResolutionHost.fileExists(candidatePath)
94
+ ? classifyLocalReference(candidatePath, packageJsonPath, importValue)
95
+ : undefined;
96
+ }
97
+ packageNameFromSpecifier(importValue);
98
+ const moduleResolutionHost = containingSourceFile.getProject().getModuleResolutionHost();
99
+ const resolvedFilePath = findPackageOwnedAssetFilePath(importValue, path.dirname(containingSourceFile.getFilePath()), function (candidatePath) {
100
+ return moduleResolutionHost.fileExists(candidatePath);
101
+ });
102
+ if (resolvedFilePath === undefined) {
103
+ return undefined;
104
+ }
105
+ return {
106
+ kind: moduleReferenceKind.externalPackage,
107
+ packageName: packageNameFromSpecifier(importValue),
108
+ ...referenceSpecifiers(importValue)
109
+ };
110
+ }
111
+ function resolveModuleReferenceForImport(importValue, containingSourceFile, packageJsonPath) {
112
+ const resolvedModule = resolvedModuleForImport(importValue, containingSourceFile);
113
+ if (resolvedModule !== undefined) {
114
+ if (!isRelativeOrAbsoluteSpecifier(importValue) && !isHashSpecifier(importValue)) {
115
+ return {
116
+ kind: moduleReferenceKind.externalPackage,
117
+ packageName: externalPackageNameForResolvedImport(importValue, resolvedModule.resolvedFileName, containingSourceFile),
118
+ ...referenceSpecifiers(importValue)
119
+ };
120
+ }
121
+ return classifyLocalReference(resolvedModule.resolvedFileName, packageJsonPath, importValue);
122
+ }
123
+ return importValue.endsWith('.wasm')
124
+ ? resolveWasmReference(importValue, containingSourceFile, packageJsonPath)
125
+ : undefined;
126
+ }
127
+ function invalidImportMetaResolveUsage(sourceFile) {
128
+ return new Error(oneLine `Invalid import.meta.resolve() usage in file "${sourceFile.getFilePath()}":
129
+ only a single static string literal argument is supported`);
130
+ }
131
+ function isImportMetaResolveCallee(callee) {
132
+ const metaProperty = callee.getExpression().asKind(SyntaxKind.MetaProperty);
133
+ return metaProperty?.getKeywordToken() === SyntaxKind.ImportKeyword && callee.getNameNode().getText() === 'resolve';
134
+ }
135
+ function collectImportMetaResolveLiteral(callExpression, sourceFile) {
136
+ const callee = callExpression.getExpression().asKind(SyntaxKind.PropertyAccessExpression);
137
+ if (callee === undefined || !isImportMetaResolveCallee(callee)) {
138
+ return undefined;
139
+ }
140
+ const [first, second] = callExpression.getArguments();
141
+ if (first === undefined || second !== undefined) {
142
+ throw invalidImportMetaResolveUsage(sourceFile);
143
+ }
144
+ const literal = first.asKind(SyntaxKind.StringLiteral);
145
+ if (literal === undefined) {
146
+ throw invalidImportMetaResolveUsage(sourceFile);
147
+ }
148
+ return literal;
149
+ }
150
+ function getImportMetaResolveLiterals(sourceFile) {
151
+ const literals = [];
152
+ for (const callExpression of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
153
+ const literal = collectImportMetaResolveLiteral(callExpression, sourceFile);
154
+ if (literal !== undefined) {
155
+ literals.push(literal);
156
+ }
157
+ }
158
+ return literals;
159
+ }
160
+ export function getModuleReferenceLiterals(sourceFile) {
161
+ return [
162
+ ...sourceFile.getImportStringLiterals(),
163
+ ...getImportMetaResolveLiterals(sourceFile),
164
+ ...getInjectedDynamicImportLiterals(sourceFile)
165
+ ];
166
+ }
167
+ export function getReferencedModules(sourceFile, packageJsonPath) {
168
+ const referencedModules = [];
169
+ const allLiterals = getModuleReferenceLiterals(sourceFile);
170
+ for (const literal of allLiterals) {
171
+ const importValue = literal.getLiteralValue();
172
+ const referencedModule = resolveModuleReferenceForImport(importValue, sourceFile, packageJsonPath);
173
+ if (referencedModule !== undefined) {
174
+ referencedModules.push(referencedModule);
175
+ }
176
+ else if (!isBuiltin(importValue)) {
177
+ throw new Error(`Failed to resolve import "${importValue}" in file "${sourceFile.getFilePath()}"`);
178
+ }
179
+ }
180
+ return referencedModules;
181
+ }
7
182
  //# sourceMappingURL=source-file-references.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-file-references.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-file-references.ts"],"names":[],"mappings":"AAAA,OAAiB,WAAW,CAAC;AAC7B,OAA0B,aAAa,CAAC;AACxC,OAAwB,aAAa,CAAC;AACtC,OAOO,UAAU,CAAC;AAClB,OAAiD,+BAA+B,CAAC;AACjF,OAA8C,oCAAoC,CAAC"}
1
+ {"version":3,"file":"source-file-references.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-file-references.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EACH,UAAU,EACV,EAAE,EAKL,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,eAAe,EAAE,kBAAkB;IACnC,iBAAiB,EAAE,oBAAoB;IACvC,UAAU,EAAE,aAAa;IACzB,SAAS,EAAE,YAAY;CACjB,CAAC;AAgCX,SAAS,gBAAgB;IACrB,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,2BAA2B;IAChC,OAAO,GAAG,IAAI,CAAC,GAAG,eAAe,IAAI,CAAC,GAAG,SAAS,IAAI,CAAC,GAAG,EAAE,CAAC;AACjE,CAAC;AAED,SAAS,6BAA6B,CAAC,SAAiB;IACpD,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,eAAe,CAAC,SAAiB;IACtC,OAAO,SAAS,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC,SAAS,wBAAwB,CAAC,SAAiB;IAC/C,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MA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MAAM,UAAU,0BAA0B,CAAC,UAAgC;IACvE,OAAO;QACH,GAAG,UAAU,CAAC,uBAAuB,EAAE;QACvC,GAAG,4BAA4B,CAAC,UAAU,CAAC;QAC3C,GAAG,gCAAgC,CAAC,UAAU,CAAC;KAClD,CAAC;AACN,CAAC;AAED,MAAM,UAAU,oBAAoB,CAChC,UAAgC,EAChC,eAAuB;IAEvB,MAAM,iBAAiB,GAAsB,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAE3D,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;QAChC,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;QAC9C,MAAM,gBAAgB,GAAG,+BAA+B,CAAC,WAAW,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QAEnG,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACjC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7C,CAAC;aAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,6BAA6B,WAAW,cAAc,UAAU,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvG,CAAC;IACL,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Maybe } from 'true-myth';
2
+ import type { FileManager } from '../file-manager/file-manager.ts';
3
+ export type SourceMapFileLocatorDependencies = {
4
+ readonly fileManager: FileManager;
5
+ };
6
+ export type SourceMapFileLocator = {
7
+ locate: (sourceFile: string, sourcesFolder: string) => Promise<Maybe<string>>;
8
+ };
9
+ export declare function createSourceMapFileLocator(dependencies: Readonly<SourceMapFileLocatorDependencies>): SourceMapFileLocator;
10
+ //# sourceMappingURL=source-map-file-locator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-map-file-locator.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-map-file-locator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,MAAM,MAAM,gCAAgC,GAAG;IAC3C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACjF,CAAC;AA8CF,wBAAgB,0BAA0B,CACtC,YAAY,EAAE,QAAQ,CAAC,gCAAgC,CAAC,GACzD,oBAAoB,CAiCtB"}
@@ -1,3 +1,67 @@
1
- import 'node:path';
2
- import 'true-myth';
1
+ import path from 'node:path';
2
+ import { Maybe } from 'true-myth';
3
+ function sourceMappingUrlPrefix() {
4
+ return '//# sourceMappingURL=';
5
+ }
6
+ function getSourceMappingUrl(fileContent) {
7
+ const prefix = sourceMappingUrlPrefix();
8
+ for (const line of fileContent.split('\n')) {
9
+ if (line.startsWith(prefix)) {
10
+ const sourceMappingUrl = line.slice(prefix.length);
11
+ return sourceMappingUrl;
12
+ }
13
+ }
14
+ return undefined;
15
+ }
16
+ function isUrlLike(filePath) {
17
+ return /^[a-z][\d+.a-z-]*:/iu.test(filePath);
18
+ }
19
+ function isRelativeMapFilePath(filePath) {
20
+ if (path.posix.isAbsolute(filePath) || path.win32.isAbsolute(filePath)) {
21
+ return false;
22
+ }
23
+ if (isUrlLike(filePath) || filePath.includes('?') || filePath.includes('#')) {
24
+ return false;
25
+ }
26
+ return path.extname(filePath) === '.map';
27
+ }
28
+ function isInFolder(folder, candidate) {
29
+ const relativePath = path.relative(folder, candidate);
30
+ return relativePath.length > 0 && !relativePath.startsWith('..') && !path.isAbsolute(relativePath);
31
+ }
32
+ function resolveSourceMapFile(sourceFile, sourcesFolder, sourceMappingUrl) {
33
+ if (!isRelativeMapFilePath(sourceMappingUrl)) {
34
+ return Maybe.nothing();
35
+ }
36
+ const sourceMapFile = path.resolve(path.dirname(sourceFile), sourceMappingUrl);
37
+ return isInFolder(path.resolve(sourcesFolder), sourceMapFile) ? Maybe.just(sourceMapFile) : Maybe.nothing();
38
+ }
39
+ export function createSourceMapFileLocator(dependencies) {
40
+ const { fileManager } = dependencies;
41
+ async function isReadableSourceMap(sourcesFolder, sourceMapFile) {
42
+ const { isReadable } = await fileManager.checkReadability(sourceMapFile);
43
+ if (!isReadable) {
44
+ return false;
45
+ }
46
+ const realSourcesFolder = await fileManager.getRealPath(sourcesFolder);
47
+ const realSourceMapFile = await fileManager.getRealPath(sourceMapFile);
48
+ return isInFolder(realSourcesFolder, realSourceMapFile);
49
+ }
50
+ return {
51
+ async locate(sourceFile, sourcesFolder) {
52
+ const fileContent = await fileManager.readFile(sourceFile);
53
+ const sourceMappingUrl = getSourceMappingUrl(fileContent);
54
+ if (sourceMappingUrl === undefined) {
55
+ return Maybe.nothing();
56
+ }
57
+ const sourceMapFile = resolveSourceMapFile(sourceFile, sourcesFolder, sourceMappingUrl);
58
+ if (sourceMapFile.isNothing) {
59
+ return Maybe.nothing();
60
+ }
61
+ return await isReadableSourceMap(sourcesFolder, sourceMapFile.value)
62
+ ? Maybe.just(sourceMapFile.value)
63
+ : Maybe.nothing();
64
+ }
65
+ };
66
+ }
3
67
  //# sourceMappingURL=source-map-file-locator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-map-file-locator.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-map-file-locator.ts"],"names":[],"mappings":"AAAA,OAAiB,WAAW,CAAC;AAC7B,OAAsB,WAAW,CAAC"}
1
+ {"version":3,"file":"source-map-file-locator.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-map-file-locator.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAA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B,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;YAE1D,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACjC,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC;YAED,MAAM,aAAa,GAAG,oBAAoB,CAAC,UAAU,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC;YACxF,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;gBAC1B,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC;YAED,OAAO,MAAM,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC;gBAChE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;gBACjC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type CompilerOptions } from 'ts-morph';
2
+ import type { MainPackageJson } from '../config/package-json.ts';
3
+ export type AnalyzationOptions = {
4
+ readonly resolveDeclarationFiles: boolean;
5
+ readonly mainPackageJson: MainPackageJson;
6
+ };
7
+ export declare function analyzationOptionsToCompilerOptions(options: AnalyzationOptions): CompilerOptions;
8
+ //# sourceMappingURL=typescript-compiler-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-compiler-options.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;CAC7C,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,kBAAkB,GAAG,eAAe,CAsBhG"}
@@ -1,2 +1,22 @@
1
- import 'ts-morph';
1
+ import { ModuleKind, ModuleResolutionKind } from 'ts-morph';
2
+ export function analyzationOptionsToCompilerOptions(options) {
3
+ const { resolveDeclarationFiles } = options;
4
+ const compilerOptions = {
5
+ moduleResolution: ModuleResolutionKind.Node16,
6
+ esModuleInterop: true,
7
+ maxNodeModuleJsDepth: 1,
8
+ noEmit: true,
9
+ allowJs: true,
10
+ resolveJsonModule: true,
11
+ noLib: true,
12
+ skipLibCheck: true,
13
+ module: ModuleKind.Node16,
14
+ resolvePackageJsonImports: true
15
+ };
16
+ if (!resolveDeclarationFiles) {
17
+ compilerOptions.types = [];
18
+ compilerOptions.typeRoots = [];
19
+ }
20
+ return compilerOptions;
21
+ }
2
22
  //# sourceMappingURL=typescript-compiler-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-compiler-options.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-compiler-options.ts"],"names":[],"mappings":"AAAA,OAAuE,UAAU,CAAC"}
1
+ {"version":3,"file":"typescript-compiler-options.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAwB,MAAM,UAAU,CAAC;AAQlF,MAAM,UAAU,mCAAmC,CAAC,OAA2B;IAC3E,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC;IAE5C,MAAM,eAAe,GAAoB;QACrC,gBAAgB,EAAE,oBAAoB,CAAC,MAAM;QAC7C,eAAe,EAAE,IAAI;QACrB,oBAAoB,EAAE,CAAC;QACvB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,iBAAiB,EAAE,IAAI;QACvB,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,yBAAyB,EAAE,IAAI;KAClC,CAAC;IAEF,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC3B,eAAe,CAAC,KAAK,GAAG,EAAE,CAAC;QAC3B,eAAe,CAAC,SAAS,GAAG,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { FileSystemHost } from 'ts-morph';
2
+ import type { MainPackageJson } from '../config/package-json.ts';
3
+ export type FileSystemAdaptersDependencies = {
4
+ readonly fileSystemHost: FileSystemHost;
5
+ };
6
+ export type FileSystemAdapters = {
7
+ readonly fileSystemHostWithoutFilter: FileSystemHost;
8
+ readonly fileSystemHostFilteringDeclarationFiles: FileSystemHost;
9
+ readonly withVirtualPackageJson: (fileSystemHost: FileSystemHost, folder: string, mainPackageJson: MainPackageJson) => FileSystemHost;
10
+ };
11
+ export declare function createFileSystemAdapters(dependencies: FileSystemAdaptersDependencies): FileSystemAdapters;
12
+ //# sourceMappingURL=typescript-file-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-file-host.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAMjE,MAAM,MAAM,8BAA8B,GAAG;IACzC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,CAAC,2BAA2B,EAAE,cAAc,CAAC;IACrD,QAAQ,CAAC,uCAAuC,EAAE,cAAc,CAAC;IACjE,QAAQ,CAAC,sBAAsB,EAAE,CAC7B,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,KAC/B,cAAc,CAAC;CACvB,CAAC;AAgDF,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,8BAA8B,GAAG,kBAAkB,CAQzG"}
@@ -1,6 +1,50 @@
1
- import 'remeda';
2
- import "./file-host-predicates.js";
3
- import "./host-method-binding.js";
4
- import "./node-modules-manifest-synthesizer.js";
5
- import "./virtual-package-json-host.js";
1
+ import { isBoolean } from 'remeda';
2
+ import { isDeclarationFile, isTypesRootFolder } from "./file-host-predicates.js";
3
+ import { bindRequiredMethod, syncMethodNames } from "./host-method-binding.js";
4
+ import { createNodeModulesManifestSynthesizingHost } from "./node-modules-manifest-synthesizer.js";
5
+ import { createVirtualPackageJsonHost } from "./virtual-package-json-host.js";
6
+ function createDeclarationFilteringHost(fileSystemHost) {
7
+ const fileExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.fileExists, 'a boolean', isBoolean);
8
+ const directoryExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.directoryExists, 'a boolean', isBoolean);
9
+ const filteringHost = {
10
+ ...fileSystemHost,
11
+ async fileExists(filePath) {
12
+ if (isDeclarationFile(filePath)) {
13
+ return false;
14
+ }
15
+ return fileSystemHost.fileExists(filePath);
16
+ },
17
+ [syncMethodNames.fileExists](filePath) {
18
+ if (isDeclarationFile(filePath)) {
19
+ return false;
20
+ }
21
+ // eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
22
+ return fileExistsSync(filePath);
23
+ },
24
+ async directoryExists(directoryPath) {
25
+ if (isTypesRootFolder(directoryPath)) {
26
+ return false;
27
+ }
28
+ return fileSystemHost.directoryExists(directoryPath);
29
+ },
30
+ [syncMethodNames.directoryExists](directoryPath) {
31
+ if (isTypesRootFolder(directoryPath)) {
32
+ return false;
33
+ }
34
+ // eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
35
+ return directoryExistsSync(directoryPath);
36
+ }
37
+ };
38
+ Object.setPrototypeOf(filteringHost, fileSystemHost);
39
+ return filteringHost;
40
+ }
41
+ export function createFileSystemAdapters(dependencies) {
42
+ const { fileSystemHost } = dependencies;
43
+ const synthesizingHost = createNodeModulesManifestSynthesizingHost(fileSystemHost);
44
+ return {
45
+ fileSystemHostWithoutFilter: synthesizingHost,
46
+ fileSystemHostFilteringDeclarationFiles: createDeclarationFilteringHost(synthesizingHost),
47
+ withVirtualPackageJson: createVirtualPackageJsonHost
48
+ };
49
+ }
6
50
  //# sourceMappingURL=typescript-file-host.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-file-host.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AACA,OAA0B,QAAQ,CAAC;AAEnC,OAAqD,2BAA2B,CAAC;AACjF,OAAoD,0BAA0B,CAAC;AAC/E,OAA0D,wCAAwC,CAAC;AACnG,OAA6C,gCAAgC,CAAC;AAuClE"}
1
+ {"version":3,"file":"typescript-file-host.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,yCAAyC,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAgB9E,SAAS,8BAA8B,CAAC,cAA8B;IAClE,MAAM,cAAc,GAAG,kBAAkB,CAAC,cAAc,EAAE,eAAe,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC9G,MAAM,mBAAmB,GAAG,kBAAkB,CAC1C,cAAc,EACd,eAAe,CAAC,eAAe,EAC/B,WAAW,EACX,SAAS,CACZ,CAAC;IAEF,MAAM,aAAa,GAAmB;QAClC,GAAG,cAAc;QACjB,KAAK,CAAC,UAAU,CAAC,QAAgB;YAC7B,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC9B,OAAO,KAAK,CAAC;YACjB,CAAC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