packtory 0.0.96 → 0.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (517) hide show
  1. package/artifacts/artifacts-builder.js +37 -4
  2. package/artifacts/artifacts-builder.js.map +1 -1
  3. package/artifacts/content-collection.js +59 -2
  4. package/artifacts/content-collection.js.map +1 -1
  5. package/artifacts/folder-writer.js +25 -2
  6. package/artifacts/folder-writer.js.map +1 -1
  7. package/bundle-emitter/emitter.js +137 -6
  8. package/bundle-emitter/emitter.js.map +1 -1
  9. package/bundle-emitter/extract-package-tarball.js +13 -2
  10. package/bundle-emitter/extract-package-tarball.js.map +1 -1
  11. package/bundle-emitter/fetch-published-artifacts.js +19 -2
  12. package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
  13. package/bundle-emitter/publication-outcome.js +5 -0
  14. package/bundle-emitter/publication-outcome.js.map +1 -1
  15. package/bundle-emitter/publish-error/auto-mode-error-matching.js +28 -2
  16. package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
  17. package/bundle-emitter/publish-error/error-shape-helpers.js +9 -0
  18. package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
  19. package/bundle-emitter/publish-error/file-mode-error-matching.js +33 -2
  20. package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
  21. package/bundle-emitter/publish-error/publish-error-messages.js +24 -0
  22. package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
  23. package/bundle-emitter/registry/metadata-auth-retry.js +24 -1
  24. package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
  25. package/bundle-emitter/registry/oidc-token-exchange.js +68 -3
  26. package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
  27. package/bundle-emitter/registry/package-metadata-fetcher.js +210 -7
  28. package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
  29. package/bundle-emitter/registry/publish-settings-bridge.js +34 -3
  30. package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
  31. package/bundle-emitter/registry/registry-auth-config.js +106 -0
  32. package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
  33. package/bundle-emitter/registry/registry-client.js +74 -4
  34. package/bundle-emitter/registry/registry-client.js.map +1 -1
  35. package/bundle-emitter/registry/registry-package-path.js +3 -0
  36. package/bundle-emitter/registry/registry-package-path.js.map +1 -1
  37. package/bundle-emitter/registry/registry-response-schemas.js +50 -2
  38. package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
  39. package/bundle-emitter/registry/tarball-integrity.js +31 -1
  40. package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
  41. package/bundle-emitter/registry/validate-tarball-host.js +26 -1
  42. package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
  43. package/bundle-emitter/release-artifact-canonicalizer.js +31 -5
  44. package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
  45. package/checks/check-runner.js +8 -0
  46. package/checks/check-runner.js.map +1 -1
  47. package/checks/rule.js +12 -2
  48. package/checks/rule.js.map +1 -1
  49. package/checks/rules/duplicate-detection.js +23 -1
  50. package/checks/rules/duplicate-detection.js.map +1 -1
  51. package/checks/rules/duplicate-messages.js +22 -0
  52. package/checks/rules/duplicate-messages.js.map +1 -1
  53. package/checks/rules/file-ownership.js +15 -0
  54. package/checks/rules/file-ownership.js.map +1 -1
  55. package/checks/rules/max-bundle-size.js +55 -1
  56. package/checks/rules/max-bundle-size.js.map +1 -1
  57. package/checks/rules/no-dev-dependency-imports.js +51 -1
  58. package/checks/rules/no-dev-dependency-imports.js.map +1 -1
  59. package/checks/rules/no-duplicated-files.js +53 -3
  60. package/checks/rules/no-duplicated-files.js.map +1 -1
  61. package/checks/rules/no-side-effects.js +50 -1
  62. package/checks/rules/no-side-effects.js.map +1 -1
  63. package/checks/rules/no-unexposed-executables.js +43 -2
  64. package/checks/rules/no-unexposed-executables.js.map +1 -1
  65. package/checks/rules/no-unused-bundle-dependencies.js +30 -2
  66. package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
  67. package/checks/rules/registry.js +22 -9
  68. package/checks/rules/registry.js.map +1 -1
  69. package/checks/rules/required-files.js +41 -3
  70. package/checks/rules/required-files.js.map +1 -1
  71. package/checks/rules/type-script-declaration-integrity.js +81 -3
  72. package/checks/rules/type-script-declaration-integrity.js.map +1 -1
  73. package/checks/rules/type-script-declaration-paths.js +55 -1
  74. package/checks/rules/type-script-declaration-paths.js.map +1 -1
  75. package/checks/rules/type-script-declaration-project.js +202 -3
  76. package/checks/rules/type-script-declaration-project.js.map +1 -1
  77. package/checks/rules/type-script-declaration-reachability.js +38 -2
  78. package/checks/rules/type-script-declaration-reachability.js.map +1 -1
  79. package/checks/rules/type-script-declaration-roots.js +29 -0
  80. package/checks/rules/type-script-declaration-roots.js.map +1 -1
  81. package/checks/rules/type-script-integrity.js +72 -2
  82. package/checks/rules/type-script-integrity.js.map +1 -1
  83. package/checks/rules/type-script-package-resolution.js +42 -1
  84. package/checks/rules/type-script-package-resolution.js.map +1 -1
  85. package/checks/rules/type-script-resolution-summary.js +53 -0
  86. package/checks/rules/type-script-resolution-summary.js.map +1 -1
  87. package/checks/rules/unique-target-paths.js +34 -2
  88. package/checks/rules/unique-target-paths.js.map +1 -1
  89. package/common/bundled-dependency-groups.js +27 -0
  90. package/common/bundled-dependency-groups.js.map +1 -1
  91. package/common/code-files.js +28 -0
  92. package/common/code-files.js.map +1 -1
  93. package/common/declaration-companion-paths.js +24 -0
  94. package/common/declaration-companion-paths.js.map +1 -1
  95. package/common/package-name-map.js +7 -0
  96. package/common/package-name-map.js.map +1 -1
  97. package/common/stable-json.js +42 -2
  98. package/common/stable-json.js.map +1 -1
  99. package/common/worklist.js +22 -0
  100. package/common/worklist.js.map +1 -1
  101. package/config/additional-files.js +6 -2
  102. package/config/additional-files.js.map +1 -1
  103. package/config/additional-package-json-attributes-schema.js +6 -2
  104. package/config/additional-package-json-attributes-schema.js.map +1 -1
  105. package/config/automatic-versioning-settings.js +6 -2
  106. package/config/automatic-versioning-settings.js.map +1 -1
  107. package/config/changelog-settings.js +120 -3
  108. package/config/changelog-settings.js.map +1 -1
  109. package/config/common-package-settings-schemas.js +19 -3
  110. package/config/common-package-settings-schemas.js.map +1 -1
  111. package/config/config.js +3 -1
  112. package/config/config.js.map +1 -1
  113. package/config/cross-package-validation.js +17 -0
  114. package/config/cross-package-validation.js.map +1 -1
  115. package/config/dead-code-elimination-settings.js +36 -2
  116. package/config/dead-code-elimination-settings.js.map +1 -1
  117. package/config/dependency-existence-validation.js +19 -1
  118. package/config/dependency-existence-validation.js.map +1 -1
  119. package/config/dependency-policy.js +5 -2
  120. package/config/dependency-policy.js.map +1 -1
  121. package/config/main-package-json-schema.js +11 -2
  122. package/config/main-package-json-schema.js.map +1 -1
  123. package/config/manual-versioning-settings.d.ts +12 -0
  124. package/config/manual-versioning-settings.d.ts.map +1 -1
  125. package/config/manual-versioning-settings.js +29 -2
  126. package/config/manual-versioning-settings.js.map +1 -1
  127. package/config/optional-package-settings-schema.js +16 -7
  128. package/config/optional-package-settings-schema.js.map +1 -1
  129. package/config/package-config.js +2 -1
  130. package/config/package-config.js.map +1 -1
  131. package/config/package-graph-builder.js +14 -2
  132. package/config/package-graph-builder.js.map +1 -1
  133. package/config/package-interface.js +25 -2
  134. package/config/package-interface.js.map +1 -1
  135. package/config/package-json.d.ts.map +1 -1
  136. package/config/package-json.js +16 -0
  137. package/config/package-json.js.map +1 -1
  138. package/config/packtory-config-without-registry-schema.js +6 -0
  139. package/config/packtory-config-without-registry-schema.js.map +1 -1
  140. package/config/per-package-settings-schema.js +22 -6
  141. package/config/per-package-settings-schema.js.map +1 -1
  142. package/config/pre-graph-validation.js +20 -5
  143. package/config/pre-graph-validation.js.map +1 -1
  144. package/config/publish-settings.js +25 -3
  145. package/config/publish-settings.js.map +1 -1
  146. package/config/publish-settings.report.js +17 -1
  147. package/config/publish-settings.report.js.map +1 -1
  148. package/config/registry-settings.js +40 -2
  149. package/config/registry-settings.js.map +1 -1
  150. package/config/registry-settings.report.js +46 -0
  151. package/config/registry-settings.report.js.map +1 -1
  152. package/config/root-config-validation.js +141 -0
  153. package/config/root-config-validation.js.map +1 -1
  154. package/config/root.js +6 -2
  155. package/config/root.js.map +1 -1
  156. package/config/sbom-settings.js +4 -1
  157. package/config/sbom-settings.js.map +1 -1
  158. package/config/settings-validation.js +28 -0
  159. package/config/settings-validation.js.map +1 -1
  160. package/config/versioning-settings.js +10 -3
  161. package/config/versioning-settings.js.map +1 -1
  162. package/dead-code-eliminator/analyzed-bundle.js +7 -0
  163. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  164. package/dead-code-eliminator/artifact-module-reference-contract.js +27 -0
  165. package/dead-code-eliminator/artifact-module-reference-contract.js.map +1 -0
  166. package/dead-code-eliminator/bundle-analysis.js +38 -5
  167. package/dead-code-eliminator/bundle-analysis.js.map +1 -1
  168. package/dead-code-eliminator/class-purity.js +48 -2
  169. package/dead-code-eliminator/class-purity.js.map +1 -1
  170. package/dead-code-eliminator/code-file-analyzer.js +68 -4
  171. package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
  172. package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -0
  173. package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
  174. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
  175. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
  176. package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -3
  177. package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
  178. package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
  179. package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
  180. package/dead-code-eliminator/dependency-metadata.js +172 -2
  181. package/dead-code-eliminator/dependency-metadata.js.map +1 -1
  182. package/dead-code-eliminator/elimination-emitter.js +52 -0
  183. package/dead-code-eliminator/elimination-emitter.js.map +1 -1
  184. package/dead-code-eliminator/eliminator.js +22 -4
  185. package/dead-code-eliminator/eliminator.js.map +1 -1
  186. package/dead-code-eliminator/expression-unwrapping.js +16 -1
  187. package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
  188. package/dead-code-eliminator/imported-expression-origin.js +101 -2
  189. package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
  190. package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
  191. package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
  192. package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
  193. package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
  194. package/dead-code-eliminator/liveness/external-purity-summary.js +314 -3
  195. package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
  196. package/dead-code-eliminator/liveness/external-purity.js +39 -3
  197. package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
  198. package/dead-code-eliminator/liveness/module-analysis.js +27 -2
  199. package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
  200. package/dead-code-eliminator/liveness/resource-retention.js +91 -1
  201. package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
  202. package/dead-code-eliminator/liveness/runtime-code.js +15 -1
  203. package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
  204. package/dead-code-eliminator/load-bundle.js +86 -5
  205. package/dead-code-eliminator/load-bundle.js.map +1 -1
  206. package/dead-code-eliminator/pure-expression.js +178 -5
  207. package/dead-code-eliminator/pure-expression.js.map +1 -1
  208. package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
  209. package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
  210. package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
  211. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  212. package/dead-code-eliminator/reachability/binding-id.js +106 -1
  213. package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
  214. package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -1
  215. package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
  216. package/dead-code-eliminator/reachability/impure-statements.js +11 -2
  217. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  218. package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
  219. package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
  220. package/dead-code-eliminator/reachability/reachability.js +70 -4
  221. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  222. package/dead-code-eliminator/side-effect-classifier.js +39 -4
  223. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  224. package/dead-code-eliminator/side-effects-field.js +23 -1
  225. package/dead-code-eliminator/side-effects-field.js.map +1 -1
  226. package/dead-code-eliminator/source-map-recomposition.js +29 -2
  227. package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
  228. package/dead-code-eliminator/statement-classifiers.js +94 -4
  229. package/dead-code-eliminator/statement-classifiers.js.map +1 -1
  230. package/dead-code-eliminator/syntax-kind-sets.js +16 -0
  231. package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
  232. package/dead-code-eliminator/transform/atom-translator.js +57 -2
  233. package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
  234. package/dead-code-eliminator/transform/declaration-removal.js +183 -5
  235. package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
  236. package/dead-code-eliminator/transform/declaration-remover.js +17 -2
  237. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  238. package/dead-code-eliminator/transform/line-index.js +20 -0
  239. package/dead-code-eliminator/transform/line-index.js.map +1 -1
  240. package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
  241. package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
  242. package/dead-code-eliminator/transform/source-map-composer.js +84 -3
  243. package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
  244. package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
  245. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
  246. package/dependency-scanner/dependency-graph.js +77 -3
  247. package/dependency-scanner/dependency-graph.js.map +1 -1
  248. package/dependency-scanner/external-dependencies.js +55 -1
  249. package/dependency-scanner/external-dependencies.js.map +1 -1
  250. package/dependency-scanner/file-host-predicates.js +9 -0
  251. package/dependency-scanner/file-host-predicates.js.map +1 -1
  252. package/dependency-scanner/host-method-binding.js +18 -0
  253. package/dependency-scanner/host-method-binding.js.map +1 -1
  254. package/dependency-scanner/injected-dynamic-imports.js +232 -1
  255. package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
  256. package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
  257. package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
  258. package/dependency-scanner/package-owned-asset-file-path.js +9 -1
  259. package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
  260. package/dependency-scanner/scanner.js +109 -4
  261. package/dependency-scanner/scanner.js.map +1 -1
  262. package/dependency-scanner/source-file-references.js +171 -6
  263. package/dependency-scanner/source-file-references.js.map +1 -1
  264. package/dependency-scanner/source-map-file-locator.js +66 -2
  265. package/dependency-scanner/source-map-file-locator.js.map +1 -1
  266. package/dependency-scanner/typescript-compiler-options.js +21 -1
  267. package/dependency-scanner/typescript-compiler-options.js.map +1 -1
  268. package/dependency-scanner/typescript-file-host.js +49 -5
  269. package/dependency-scanner/typescript-file-host.js.map +1 -1
  270. package/dependency-scanner/typescript-module-resolution.js +214 -0
  271. package/dependency-scanner/typescript-module-resolution.js.map +1 -0
  272. package/dependency-scanner/typescript-project-analyzer.js +32 -3
  273. package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
  274. package/dependency-scanner/virtual-package-json-host.js +45 -4
  275. package/dependency-scanner/virtual-package-json-host.js.map +1 -1
  276. package/directed-graph/graph.js +240 -1
  277. package/directed-graph/graph.js.map +1 -1
  278. package/file-manager/compare.js +23 -2
  279. package/file-manager/compare.js.map +1 -1
  280. package/file-manager/equal.js +5 -0
  281. package/file-manager/equal.js.map +1 -1
  282. package/file-manager/file-description.js +3 -0
  283. package/file-manager/file-description.js.map +1 -1
  284. package/file-manager/permissions.js +28 -1
  285. package/file-manager/permissions.js.map +1 -1
  286. package/git/current-git-head.js +24 -0
  287. package/git/current-git-head.js.map +1 -1
  288. package/git/git-command.js +49 -1
  289. package/git/git-command.js.map +1 -1
  290. package/linker/linked-bundle.js +5 -0
  291. package/linker/linked-bundle.js.map +1 -1
  292. package/linker/linker.js +51 -5
  293. package/linker/linker.js.map +1 -1
  294. package/linker/replacement-lookup.js +297 -8
  295. package/linker/replacement-lookup.js.map +1 -1
  296. package/linker/resource-graph.js +65 -2
  297. package/linker/resource-graph.js.map +1 -1
  298. package/linker/source-modifier/import-paths.js +80 -3
  299. package/linker/source-modifier/import-paths.js.map +1 -1
  300. package/linker/substitute-bundles.js +166 -3
  301. package/linker/substitute-bundles.js.map +1 -1
  302. package/linker/substituted-resource-graph.js +111 -2
  303. package/linker/substituted-resource-graph.js.map +1 -1
  304. package/npm-oidc-id-token-resolver.js +82 -0
  305. package/npm-oidc-id-token-resolver.js.map +1 -1
  306. package/pack-emitter/pack-emitter.js +27 -0
  307. package/pack-emitter/pack-emitter.js.map +1 -1
  308. package/package-surface/bin-field.js +8 -2
  309. package/package-surface/bin-field.js.map +1 -1
  310. package/package-surface/explicit-bin.js +24 -2
  311. package/package-surface/explicit-bin.js.map +1 -1
  312. package/package-surface/explicit-exports.js +26 -3
  313. package/package-surface/explicit-exports.js.map +1 -1
  314. package/package-surface/export-map.js +9 -2
  315. package/package-surface/export-map.js.map +1 -1
  316. package/package-surface/implicit-bin.js +25 -1
  317. package/package-surface/implicit-bin.js.map +1 -1
  318. package/package-surface/implicit-exports.js +10 -3
  319. package/package-surface/implicit-exports.js.map +1 -1
  320. package/package-surface/implicit-root-exports.js +13 -2
  321. package/package-surface/implicit-root-exports.js.map +1 -1
  322. package/package-surface/package-json-export.js +9 -0
  323. package/package-surface/package-json-export.js.map +1 -1
  324. package/package-surface/package-shape.js +10 -1
  325. package/package-surface/package-shape.js.map +1 -1
  326. package/package-surface/package-surface-index.js +165 -3
  327. package/package-surface/package-surface-index.js.map +1 -1
  328. package/package-surface/public-module-usage.js +46 -3
  329. package/package-surface/public-module-usage.js.map +1 -1
  330. package/package-surface/public-specifiers.js +7 -1
  331. package/package-surface/public-specifiers.js.map +1 -1
  332. package/package-surface/root-registry.js +26 -0
  333. package/package-surface/root-registry.js.map +1 -1
  334. package/package-surface/specifier-syntax.js +4 -0
  335. package/package-surface/specifier-syntax.js.map +1 -1
  336. package/package-surface/substitution-exports.js +101 -3
  337. package/package-surface/substitution-exports.js.map +1 -1
  338. package/package-surface/surface.js +12 -0
  339. package/package-surface/surface.js.map +1 -1
  340. package/package.json +2 -2
  341. package/packages/package-processor.composition.js +161 -34
  342. package/packages/package-processor.composition.js.map +1 -1
  343. package/packtory/map-config.js +35 -4
  344. package/packtory/map-config.js.map +1 -1
  345. package/packtory/normalize-paths.js +25 -1
  346. package/packtory/normalize-paths.js.map +1 -1
  347. package/packtory/options/bundle-dependency-resolution.js +17 -1
  348. package/packtory/options/bundle-dependency-resolution.js.map +1 -1
  349. package/packtory/options/dead-code-elimination-resolution.js +10 -1
  350. package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
  351. package/packtory/options/prepare-package-options.js +46 -5
  352. package/packtory/options/prepare-package-options.js.map +1 -1
  353. package/packtory/options/required-value-helpers.js +17 -0
  354. package/packtory/options/required-value-helpers.js.map +1 -1
  355. package/packtory/options/setting-resolvers.js +47 -3
  356. package/packtory/options/setting-resolvers.js.map +1 -1
  357. package/packtory/options/surface-resolution.js +15 -2
  358. package/packtory/options/surface-resolution.js.map +1 -1
  359. package/packtory/options/version-provider-context.js +24 -2
  360. package/packtory/options/version-provider-context.js.map +1 -1
  361. package/packtory/options/version-trigger.js +39 -2
  362. package/packtory/options/version-trigger.js.map +1 -1
  363. package/packtory/pack-output-preflight.js +60 -3
  364. package/packtory/pack-output-preflight.js.map +1 -1
  365. package/packtory/package-processor-build.js +97 -3
  366. package/packtory/package-processor-build.js.map +1 -1
  367. package/packtory/package-processor-publish.js +297 -6
  368. package/packtory/package-processor-publish.js.map +1 -1
  369. package/packtory/package-processor.js +10 -2
  370. package/packtory/package-processor.js.map +1 -1
  371. package/packtory/packtory-pack.js +298 -10
  372. package/packtory/packtory-pack.js.map +1 -1
  373. package/packtory/packtory-package-dependencies.js +116 -2
  374. package/packtory/packtory-package-dependencies.js.map +1 -1
  375. package/packtory/packtory-package-inspection.js +26 -5
  376. package/packtory/packtory-package-inspection.js.map +1 -1
  377. package/packtory/packtory-package-side-effects.js +64 -3
  378. package/packtory/packtory-package-side-effects.js.map +1 -1
  379. package/packtory/packtory-package-tree.js +43 -4
  380. package/packtory/packtory-package-tree.js.map +1 -1
  381. package/packtory/packtory-publish.js +17 -4
  382. package/packtory/packtory-publish.js.map +1 -1
  383. package/packtory/packtory-release-analysis.js +64 -6
  384. package/packtory/packtory-release-analysis.js.map +1 -1
  385. package/packtory/packtory-release-diff.js +48 -5
  386. package/packtory/packtory-release-diff.js.map +1 -1
  387. package/packtory/packtory-release-plan.js +87 -6
  388. package/packtory/packtory-release-plan.js.map +1 -1
  389. package/packtory/packtory-resolve.js +16 -5
  390. package/packtory/packtory-resolve.js.map +1 -1
  391. package/packtory/packtory.js +242 -13
  392. package/packtory/packtory.js.map +1 -1
  393. package/packtory/publish-failure-mapping.js +6 -0
  394. package/packtory/publish-failure-mapping.js.map +1 -1
  395. package/packtory/publish-target-preflight.js +25 -3
  396. package/packtory/publish-target-preflight.js.map +1 -1
  397. package/packtory/published-release-state.js +11 -0
  398. package/packtory/published-release-state.js.map +1 -1
  399. package/packtory/release-analysis.js +153 -5
  400. package/packtory/release-analysis.js.map +1 -1
  401. package/packtory/release-diff-failure-mapping.js +6 -0
  402. package/packtory/release-diff-failure-mapping.js.map +1 -1
  403. package/packtory/release-plan.js +135 -7
  404. package/packtory/release-plan.js.map +1 -1
  405. package/packtory/report-attachment.js +35 -2
  406. package/packtory/report-attachment.js.map +1 -1
  407. package/packtory/resolved-package.js +97 -3
  408. package/packtory/resolved-package.js.map +1 -1
  409. package/packtory/scheduler.js +99 -1
  410. package/packtory/scheduler.js.map +1 -1
  411. package/packtory/stages/package-analysis-stage.js +50 -2
  412. package/packtory/stages/package-analysis-stage.js.map +1 -1
  413. package/packtory/stages/package-resolution-stage.js +80 -5
  414. package/packtory/stages/package-resolution-stage.js.map +1 -1
  415. package/packtory/stages/publish-stage.js +125 -4
  416. package/packtory/stages/publish-stage.js.map +1 -1
  417. package/packtory/stages/release-diff-stage.js +84 -5
  418. package/packtory/stages/release-diff-stage.js.map +1 -1
  419. package/progress/progress-broadcaster.js +45 -0
  420. package/progress/progress-broadcaster.js.map +1 -1
  421. package/published-package/published-package.js +12 -1
  422. package/published-package/published-package.js.map +1 -1
  423. package/report/aggregator/artifact-entry-merger.js +20 -0
  424. package/report/aggregator/artifact-entry-merger.js.map +1 -1
  425. package/report/aggregator/package-report-materialization.js +75 -2
  426. package/report/aggregator/package-report-materialization.js.map +1 -1
  427. package/report/aggregator/report-aggregator.js +37 -2
  428. package/report/aggregator/report-aggregator.js.map +1 -1
  429. package/report/aggregator/report-event-handlers.js +141 -2
  430. package/report/aggregator/report-event-handlers.js.map +1 -1
  431. package/report/aggregator/report-types.js +3 -0
  432. package/report/aggregator/report-types.js.map +1 -1
  433. package/report/config-redactor.js +29 -3
  434. package/report/config-redactor.js.map +1 -1
  435. package/report/decorators.js +85 -0
  436. package/report/decorators.js.map +1 -1
  437. package/report/inspectors/inspect-artifact-sizes.js +34 -1
  438. package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
  439. package/report/inspectors/inspect-linker-rewrites.js +14 -1
  440. package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
  441. package/report/inspectors/inspect-package-json-provenance.js +15 -0
  442. package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
  443. package/report/inspectors/inspect-scan-results.js +15 -0
  444. package/report/inspectors/inspect-scan-results.js.map +1 -1
  445. package/report/release-diff/release-version-transition.js +18 -0
  446. package/report/release-diff/release-version-transition.js.map +1 -1
  447. package/resource-resolver/bundle-resource-lookup.js +25 -0
  448. package/resource-resolver/bundle-resource-lookup.js.map +1 -1
  449. package/resource-resolver/content.js +136 -4
  450. package/resource-resolver/content.js.map +1 -1
  451. package/resource-resolver/dependency-resolution-walker.js +73 -2
  452. package/resource-resolver/dependency-resolution-walker.js.map +1 -1
  453. package/resource-resolver/resolved-bundle.js +3 -0
  454. package/resource-resolver/resolved-bundle.js.map +1 -1
  455. package/resource-resolver/resource-resolve-options.js +13 -1
  456. package/resource-resolver/resource-resolve-options.js.map +1 -1
  457. package/resource-resolver/resource-resolver.js +128 -6
  458. package/resource-resolver/resource-resolver.js.map +1 -1
  459. package/sbom/extract-license.js +11 -1
  460. package/sbom/extract-license.js.map +1 -1
  461. package/sbom/license-resolver.js +23 -2
  462. package/sbom/license-resolver.js.map +1 -1
  463. package/sbom/sbom-builder.js +57 -2
  464. package/sbom/sbom-builder.js.map +1 -1
  465. package/sbom/sbom-canonicalizer.js +45 -3
  466. package/sbom/sbom-canonicalizer.js.map +1 -1
  467. package/sbom/sbom-file.js +54 -5
  468. package/sbom/sbom-file.js.map +1 -1
  469. package/sbom/sbom-serializer.js +14 -1
  470. package/sbom/sbom-serializer.js.map +1 -1
  471. package/sbom/tool-version.js +49 -1
  472. package/sbom/tool-version.js.map +1 -1
  473. package/sbom.cdx.json +10 -10
  474. package/tar/extract-tar.js +83 -3
  475. package/tar/extract-tar.js.map +1 -1
  476. package/tar/gzipped-pack.js +20 -0
  477. package/tar/gzipped-pack.js.map +1 -1
  478. package/tar/tarball-builder.js +44 -4
  479. package/tar/tarball-builder.js.map +1 -1
  480. package/vendor-materializer/vendor-entry.js +20 -1
  481. package/vendor-materializer/vendor-entry.js.map +1 -1
  482. package/vendor-materializer/vendor-materializer.js +240 -8
  483. package/vendor-materializer/vendor-materializer.js.map +1 -1
  484. package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
  485. package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
  486. package/version-manager/dependencies/dependency-groups.js +11 -1
  487. package/version-manager/dependencies/dependency-groups.js.map +1 -1
  488. package/version-manager/dependencies/external-dependency-classification.js +82 -3
  489. package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
  490. package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
  491. package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
  492. package/version-manager/imports/hash-import-scanner.js +20 -2
  493. package/version-manager/imports/hash-import-scanner.js.map +1 -1
  494. package/version-manager/imports/imports-key-matcher.js +22 -0
  495. package/version-manager/imports/imports-key-matcher.js.map +1 -1
  496. package/version-manager/imports/versioned-bundle-imports.js +44 -2
  497. package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
  498. package/version-manager/manager.js +46 -6
  499. package/version-manager/manager.js.map +1 -1
  500. package/version-manager/manifest/builder.js +51 -1
  501. package/version-manager/manifest/builder.js.map +1 -1
  502. package/version-manager/manifest/serialize.js +8 -1
  503. package/version-manager/manifest/serialize.js.map +1 -1
  504. package/version-manager/optional-bundle-fields.js +5 -1
  505. package/version-manager/optional-bundle-fields.js.map +1 -1
  506. package/version-manager/representative-root.js +9 -1
  507. package/version-manager/representative-root.js.map +1 -1
  508. package/version-manager/specifier-classifier.js +42 -2
  509. package/version-manager/specifier-classifier.js.map +1 -1
  510. package/version-manager/specifier-errors.js +58 -0
  511. package/version-manager/specifier-errors.js.map +1 -1
  512. package/version-manager/versioned-bundle.js +31 -6
  513. package/version-manager/versioned-bundle.js.map +1 -1
  514. package/zip/zip-builder.js +81 -2
  515. package/zip/zip-builder.js.map +1 -1
  516. package/dead-code-eliminator/liveness/external-module-resolution.js +0 -3
  517. package/dead-code-eliminator/liveness/external-module-resolution.js.map +0 -1
@@ -1,3 +1,58 @@
1
- import 'diff';
2
- import "./line-index.js";
1
+ import { diffChars } from 'diff';
2
+ import { buildLineIndex } from "./line-index.js";
3
+ function initialState() {
4
+ return {
5
+ originalOffset: 0,
6
+ transformedOffset: 0,
7
+ atoms: new Array()
8
+ };
9
+ }
10
+ function appendAtom(state, length) {
11
+ return {
12
+ originalOffset: state.originalOffset + length,
13
+ transformedOffset: state.transformedOffset + length,
14
+ atoms: [
15
+ ...state.atoms,
16
+ {
17
+ originalStart: state.originalOffset,
18
+ originalEnd: state.originalOffset + length,
19
+ newStart: state.transformedOffset
20
+ }
21
+ ]
22
+ };
23
+ }
24
+ function shiftOffsets(state, change, length) {
25
+ return {
26
+ originalOffset: state.originalOffset + (change.removed ? length : 0),
27
+ transformedOffset: state.transformedOffset + (change.added ? length : 0),
28
+ atoms: state.atoms
29
+ };
30
+ }
31
+ function appendChange(state, change) {
32
+ const { length } = change.value;
33
+ return change.added || change.removed ? shiftOffsets(state, change, length) : appendAtom(state, length);
34
+ }
35
+ export function buildTextTransformMap(originalCode, transformedCode) {
36
+ const state = diffChars(originalCode, transformedCode).reduce(appendChange, initialState());
37
+ return { originalCode, transformedCode, atoms: state.atoms };
38
+ }
39
+ export function toSourceMapTransform(textTransform) {
40
+ return {
41
+ originalLineIndex: buildLineIndex(textTransform.originalCode),
42
+ transformedLineIndex: buildLineIndex(textTransform.transformedCode),
43
+ atoms: textTransform.atoms
44
+ };
45
+ }
46
+ function findAtomFor(atoms, offset) {
47
+ return atoms.find(function (atom) {
48
+ return offset >= atom.originalStart && offset < atom.originalEnd;
49
+ });
50
+ }
51
+ export function translateGeneratedOffset(offset, atoms) {
52
+ const atom = findAtomFor(atoms, offset);
53
+ if (atom === undefined) {
54
+ return undefined;
55
+ }
56
+ return atom.newStart + (offset - atom.originalStart);
57
+ }
3
58
  //# sourceMappingURL=atom-translator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"atom-translator.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/atom-translator.ts"],"names":[],"mappings":"AAAA,OAA0B,MAAM,CAAC;AACjC,OAA+C,iBAAiB,CAAC"}
1
+ {"version":3,"file":"atom-translator.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/atom-translator.ts"],"names":[],"m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U,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC5G,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,YAAoB,EAAE,eAAuB;IAC/E,MAAM,KAAK,GAAG,SAAS,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC;IAC5F,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,aAA+B;IAChE,OAAO;QACH,iBAAiB,EAAE,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC;QAC7D,oBAAoB,EAAE,cAAc,CAAC,aAAa,CAAC,eAAe,CAAC;QACnE,KAAK,EAAE,aAAa,CAAC,KAAK;KAC7B,CAAC;AACN,CAAC;AAED,SAAS,WAAW,CAAC,KAA8B,EAAE,MAAc;IAC/D,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI;QAC5B,OAAO,MAAM,IAAI,IAAI,CAAC,aAAa,IAAI,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAc,EAAE,KAA8B;IACnF,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;AACzD,CAAC"}
@@ -1,6 +1,184 @@
1
- import 'ts-morph';
2
- import "../liveness/runtime-code.js";
3
- import "../reachability/binding-id.js";
4
- import "../variable-declaration-bindings.js";
5
- import "./named-declaration-kinds.js";
1
+ import { Node as TsMorphNode, SyntaxKind } from 'ts-morph';
2
+ import { isDeclarationCodeTargetPath } from "../liveness/runtime-code.js";
3
+ import { bindingId } from "../reachability/binding-id.js";
4
+ import { collectVariableDeclarationBindings, variableDeclarationSurvives } from "../variable-declaration-bindings.js";
5
+ import { isNamedDeclaration } from "./named-declaration-kinds.js";
6
+ function recordBindingRemoved(plan, name) {
7
+ if (plan.trace !== undefined) {
8
+ plan.trace.collector.record({
9
+ type: 'binding-removed',
10
+ bundleName: plan.bundleName,
11
+ bindingId: bindingId(plan.targetFilePath, name),
12
+ inputFilePath: plan.inputFilePath
13
+ });
14
+ }
15
+ }
16
+ function processNamedDeclaration(statement, plan) {
17
+ if (!isNamedDeclaration(statement)) {
18
+ return false;
19
+ }
20
+ const name = statement.getName();
21
+ if (name === undefined || plan.survivingNames.has(name)) {
22
+ return false;
23
+ }
24
+ recordBindingRemoved(plan, name);
25
+ statement.remove();
26
+ return true;
27
+ }
28
+ function processVariableStatement(statement, plan) {
29
+ if (!TsMorphNode.isVariableStatement(statement)) {
30
+ return false;
31
+ }
32
+ const removedDeclarators = statement.getDeclarations().filter(function (declarator) {
33
+ return !variableDeclarationSurvives(declarator, plan.survivingNames);
34
+ });
35
+ for (const declarator of removedDeclarators) {
36
+ for (const binding of collectVariableDeclarationBindings(declarator)) {
37
+ recordBindingRemoved(plan, binding.name);
38
+ }
39
+ declarator.remove();
40
+ }
41
+ return removedDeclarators.length > 0;
42
+ }
43
+ export function processStatement(statement, plan) {
44
+ if (processNamedDeclaration(statement, plan)) {
45
+ return true;
46
+ }
47
+ return processVariableStatement(statement, plan);
48
+ }
49
+ function importName(binding) {
50
+ return binding.getAliasNode()?.getText() ?? binding.getName();
51
+ }
52
+ function hasRuntime(declaration) {
53
+ if (isDeclarationCodeTargetPath(declaration.getSourceFile().getFilePath())) {
54
+ return false;
55
+ }
56
+ if (declaration.isTypeOnly()) {
57
+ return false;
58
+ }
59
+ const runtimeNamedCount = declaration
60
+ .getNamedImports()
61
+ .filter(function (binding) {
62
+ return !binding.isTypeOnly();
63
+ })
64
+ .length;
65
+ return (declaration.getDefaultImport() !== undefined ||
66
+ declaration.getNamespaceImport() !== undefined ||
67
+ runtimeNamedCount > 0);
68
+ }
69
+ function bindingCount(declaration) {
70
+ return [declaration.getDefaultImport(), declaration.getNamespaceImport(), ...declaration.getNamedImports()]
71
+ .filter(Boolean)
72
+ .length;
73
+ }
74
+ function bareText(declaration) {
75
+ const start = declaration.getStart();
76
+ const specifier = declaration.getModuleSpecifier();
77
+ const specifierEnd = specifier.getEnd() - start;
78
+ return `import ${specifier.getText()}${declaration.getText().slice(specifierEnd)}`;
79
+ }
80
+ function recordImportBindingDropped(plan, declaration, bindingName) {
81
+ if (plan.trace !== undefined) {
82
+ plan.trace.collector.record({
83
+ type: 'import-repaired',
84
+ bundleName: plan.bundleName,
85
+ targetFilePath: plan.targetFilePath,
86
+ moduleSpecifier: declaration.getModuleSpecifierValue(),
87
+ repairKind: 'binding-dropped',
88
+ bindingName
89
+ });
90
+ }
91
+ }
92
+ function recordImportRepair(plan, declaration, repairKind) {
93
+ if (plan.trace !== undefined) {
94
+ plan.trace.collector.record({
95
+ type: 'import-repaired',
96
+ bundleName: plan.bundleName,
97
+ targetFilePath: plan.targetFilePath,
98
+ moduleSpecifier: declaration.getModuleSpecifierValue(),
99
+ repairKind
100
+ });
101
+ }
102
+ }
103
+ function dropDefault(declaration, plan) {
104
+ const binding = declaration.getDefaultImport();
105
+ if (binding !== undefined && !plan.survivingNames.has(binding.getText())) {
106
+ recordImportBindingDropped(plan, declaration, binding.getText());
107
+ declaration.removeDefaultImport();
108
+ }
109
+ }
110
+ function dropNamespace(declaration, plan) {
111
+ const binding = declaration.getNamespaceImport();
112
+ if (binding !== undefined && !plan.survivingNames.has(binding.getText())) {
113
+ recordImportBindingDropped(plan, declaration, binding.getText());
114
+ declaration.removeNamespaceImport();
115
+ }
116
+ }
117
+ function dropNamed(declaration, plan) {
118
+ const deadBindings = declaration.getNamedImports().filter(function (binding) {
119
+ return !plan.survivingNames.has(importName(binding));
120
+ });
121
+ for (const binding of deadBindings) {
122
+ recordImportBindingDropped(plan, declaration, importName(binding));
123
+ binding.remove();
124
+ }
125
+ }
126
+ function dropBindings(declaration, plan) {
127
+ dropDefault(declaration, plan);
128
+ dropNamespace(declaration, plan);
129
+ dropNamed(declaration, plan);
130
+ }
131
+ function importRemovalKind(plan) {
132
+ return isDeclarationCodeTargetPath(plan.targetFilePath)
133
+ ? 'removed-declaration-file-import'
134
+ : 'removed-type-only';
135
+ }
136
+ function repairEmpty(declaration, runtime, plan) {
137
+ if (runtime) {
138
+ recordImportRepair(plan, declaration, 'converted-to-bare');
139
+ declaration.replaceWithText(bareText(declaration));
140
+ return;
141
+ }
142
+ recordImportRepair(plan, declaration, importRemovalKind(plan));
143
+ declaration.remove();
144
+ }
145
+ function repairImport(declaration, plan) {
146
+ if (bindingCount(declaration) === 0) {
147
+ return;
148
+ }
149
+ const runtime = hasRuntime(declaration);
150
+ dropBindings(declaration, plan);
151
+ if (bindingCount(declaration) > 0) {
152
+ return;
153
+ }
154
+ repairEmpty(declaration, runtime, plan);
155
+ }
156
+ function hasExport(statement) {
157
+ return TsMorphNode.isModifierable(statement) && statement.hasModifier(SyntaxKind.ExportKeyword);
158
+ }
159
+ function hasModuleSyntax(sourceFile) {
160
+ if (sourceFile.getImportDeclarations().length > 0 ||
161
+ sourceFile.getExportDeclarations().length > 0 ||
162
+ sourceFile.getExportAssignments().length > 0) {
163
+ return true;
164
+ }
165
+ return sourceFile.getStatements().some(hasExport);
166
+ }
167
+ function repairImports(sourceFile, plan) {
168
+ for (const declaration of sourceFile.getImportDeclarations()) {
169
+ repairImport(declaration, plan);
170
+ }
171
+ }
172
+ function preserveModuleStatus(sourceFile, wasModule) {
173
+ if (wasModule && !hasModuleSyntax(sourceFile)) {
174
+ sourceFile.insertStatements(0, 'export {};');
175
+ }
176
+ }
177
+ export function repairImportDeclarations(sourceFile, plan) {
178
+ const originalText = sourceFile.getFullText();
179
+ const wasModule = hasModuleSyntax(sourceFile);
180
+ repairImports(sourceFile, plan);
181
+ preserveModuleStatus(sourceFile, wasModule);
182
+ return sourceFile.getFullText() !== originalText;
183
+ }
6
184
  //# sourceMappingURL=declaration-removal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"declaration-removal.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/declaration-removal.ts"],"names":[],"mappings":"AAAA,OAMO,UAAU,CAAC;AAClB,OAA4C,6BAA6B,CAAC;AAC1E,OAA0B,+BAA+B,CAAC;AAC1D,OAGO,qCAAqC,CAAC;AAE7C,OAAmC,8BAA8B,CAAC"}
1
+ {"version":3,"file":"declaration-removal.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/declaration-removal.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,IAAI,WAAW,EACnB,UAAU,EAIb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EACH,kCAAkC,EAClC,2BAA2B,EAC9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,SAAS,oBAAoB,CAAC,IAAiB,EAAE,IAAY;IACzD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;YACxB,IAAI,EAAE,iBAAiB;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC;YAC/C,aAAa,EAAE,IAAI,CAAC,aAAa;SACpC,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,SAAS,uBAAuB,CAAC,SAAoB,EAAE,IAAiB;IACpE,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,OAAO,KAA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AAS,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5C,UAAU,CAAC,gBAAgB,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;AACL,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,UAAsB,EAAE,IAAiB;IAC9E,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAC9C,MAAM,SAAS,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAC9C,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAChC,oBAAoB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC;AACrD,CAAC"}
@@ -1,3 +1,18 @@
1
- import "./atom-translator.js";
2
- import "./declaration-removal.js";
1
+ import { buildTextTransformMap } from "./atom-translator.js";
2
+ import { processStatement, repairImportDeclarations } from "./declaration-removal.js";
3
+ export function applyRemovalPlan(sourceFile, plan) {
4
+ const originalCode = sourceFile.getFullText();
5
+ const statements = sourceFile.getStatements();
6
+ let mutated = false;
7
+ for (const statement of statements) {
8
+ if (processStatement(statement, plan)) {
9
+ mutated = true;
10
+ }
11
+ }
12
+ if (repairImportDeclarations(sourceFile, plan)) {
13
+ mutated = true;
14
+ }
15
+ const transformedCode = sourceFile.getFullText();
16
+ return { mutated, atoms: buildTextTransformMap(originalCode, transformedCode).atoms };
17
+ }
3
18
  //# sourceMappingURL=declaration-remover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"declaration-remover.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/declaration-remover.ts"],"names":[],"mappings":"AACA,OAAyD,sBAAsB,CAAC;AAChF,OAA2D,0BAA0B,CAAC"}
1
+ {"version":3,"file":"declaration-remover.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/declaration-remover.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAqB,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAQtF,MAAM,UAAU,gBAAgB,CAAC,UAAsB,EAAE,IAAiB;IACtE,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;IAC9C,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACjC,IAAI,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;YACpC,OAAO,GAAG,IAAI,CAAC;QACnB,CAAC;IACL,CAAC;IACD,IAAI,wBAAwB,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;QAC7C,OAAO,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,MAAM,eAAe,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IACjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,qBAAqB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,KAAK,EAAE,CAAC;AAC1F,CAAC"}
@@ -1 +1,21 @@
1
+ export function buildLineIndex(text) {
2
+ const entries = [0];
3
+ for (const match of text.matchAll(/\n/gu)) {
4
+ entries.push(match.index + 1);
5
+ }
6
+ return entries;
7
+ }
8
+ export function lineColumnToOffset(lineIndex, oneBasedLine, column) {
9
+ return (lineIndex[oneBasedLine - 1] ?? 0) + column;
10
+ }
11
+ export function offsetToLineColumn(lineIndex, offset) {
12
+ let lineIndexOffset = 0;
13
+ for (const [index, lineStart] of lineIndex.entries()) {
14
+ if (lineStart > offset) {
15
+ break;
16
+ }
17
+ lineIndexOffset = index;
18
+ }
19
+ return { line: lineIndexOffset + 1, column: offset - (lineIndex[lineIndexOffset] ?? 0) };
20
+ }
1
21
  //# sourceMappingURL=line-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"line-index.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/line-index.ts"],"names":[],"mappings":"AAMsC"}
1
+ {"version":3,"file":"line-index.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/line-index.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,cAAc,CAAC,IAAY;IACvC,MAAM,OAAO,GAAa,CAAE,CAAC,CAAE,CAAC;IAChC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,SAAoB,EAAE,YAAoB,EAAE,MAAc;IACzF,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,SAAoB,EAAE,MAAc;IACnE,IAAI,eAAe,GAAG,CAAC,CAAC;IACxB,KAAK,MAAM,CAAE,KAAK,EAAE,SAAS,CAAE,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;QACrD,IAAI,SAAS,GAAG,MAAM,EAAE,CAAC;YACrB,MAAM;QACV,CAAC;QACD,eAAe,GAAG,KAAK,CAAC;IAC5B,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,eAAe,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;AAC7F,CAAC"}
@@ -7,4 +7,7 @@ const namedDeclarationKinds = new Set([
7
7
  SyntaxKind.EnumDeclaration,
8
8
  SyntaxKind.ModuleDeclaration
9
9
  ]);
10
+ export function isNamedDeclaration(statement) {
11
+ return namedDeclarationKinds.has(statement.getKind());
12
+ }
10
13
  //# sourceMappingURL=named-declaration-kinds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"named-declaration-kinds.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/named-declaration-kinds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,UAAU,CAAC;AAEtD,MAAM,qBAAqB,GAA4B,IAAI,GAAG,CAAC;IAC3D,UAAU,CAAC,mBAAmB;IAC9B,UAAU,CAAC,gBAAgB;IAC3B,UAAU,CAAC,oBAAoB;IAC/B,UAAU,CAAC,oBAAoB;IAC/B,UAAU,CAAC,eAAe;IAC1B,UAAU,CAAC,iBAAiB;CAC/B,CAAC,CAAC"}
1
+ {"version":3,"file":"named-declaration-kinds.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/named-declaration-kinds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,UAAU,CAAC;AAEtD,MAAM,qBAAqB,GAA4B,IAAI,GAAG,CAAC;IAC3D,UAAU,CAAC,mBAAmB;IAC9B,UAAU,CAAC,gBAAgB;IAC3B,UAAU,CAAC,oBAAoB;IAC/B,UAAU,CAAC,oBAAoB;IAC/B,UAAU,CAAC,eAAe;IAC1B,UAAU,CAAC,iBAAiB;CAC/B,CAAC,CAAC;AAIH,MAAM,UAAU,kBAAkB,CAAC,SAAoB;IACnD,OAAO,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;AAC1D,CAAC"}
@@ -1,4 +1,85 @@
1
- import '@jridgewell/trace-mapping';
2
- import "./atom-translator.js";
3
- import "./line-index.js";
1
+ import { eachMapping, encodedMappings, presortedDecodedMap, TraceMap } from '@jridgewell/trace-mapping';
2
+ import { translateGeneratedOffset } from "./atom-translator.js";
3
+ import { lineColumnToOffset, offsetToLineColumn } from "./line-index.js";
4
+ function tryParseTraceMap(originalMap) {
5
+ try {
6
+ return new TraceMap(originalMap);
7
+ }
8
+ catch {
9
+ return null;
10
+ }
11
+ }
12
+ function namedSegment(generated, traceMap, mapping) {
13
+ const sourceIndex = traceMap.sources.indexOf(mapping.source);
14
+ const originalLine = mapping.originalLine - 1;
15
+ if (mapping.name === null) {
16
+ return [generated.column, sourceIndex, originalLine, mapping.originalColumn];
17
+ }
18
+ const nameIndex = traceMap.names.indexOf(mapping.name);
19
+ return [generated.column, sourceIndex, originalLine, mapping.originalColumn, nameIndex];
20
+ }
21
+ function createSourceMapSegmentStore() {
22
+ const mappings = [];
23
+ return {
24
+ append(lineIndex, segment) {
25
+ const line = mappings[lineIndex];
26
+ if (line === undefined) {
27
+ mappings[lineIndex] = [segment];
28
+ }
29
+ else {
30
+ line.push(segment);
31
+ }
32
+ },
33
+ toMappings() {
34
+ return Array.from({ length: mappings.length }, function (_ignoredValue, index) {
35
+ return mappings[index] ?? [];
36
+ });
37
+ }
38
+ };
39
+ }
40
+ function translatedMappings(traceMap, transform) {
41
+ const mappings = createSourceMapSegmentStore();
42
+ let sawMapping = false;
43
+ eachMapping(traceMap, function (mapping) {
44
+ sawMapping = true;
45
+ if (mapping.source !== null) {
46
+ const oldOffset = lineColumnToOffset(transform.originalLineIndex, mapping.generatedLine, mapping.generatedColumn);
47
+ const newOffset = translateGeneratedOffset(oldOffset, transform.atoms);
48
+ if (newOffset !== undefined) {
49
+ const generated = offsetToLineColumn(transform.transformedLineIndex, newOffset);
50
+ mappings.append(generated.line - 1, namedSegment(generated, traceMap, mapping));
51
+ }
52
+ }
53
+ });
54
+ return { mappings: mappings.toMappings(), sawMapping };
55
+ }
56
+ function recomposeWithTransform(originalMap, transform) {
57
+ const traceMap = tryParseTraceMap(originalMap);
58
+ if (traceMap === null) {
59
+ return originalMap;
60
+ }
61
+ const translated = translatedMappings(traceMap, transform);
62
+ if (!translated.sawMapping) {
63
+ return originalMap;
64
+ }
65
+ return JSON.stringify({
66
+ version: 3,
67
+ file: traceMap.file === null ? undefined : traceMap.file,
68
+ sourceRoot: traceMap.sourceRoot,
69
+ sources: traceMap.sources,
70
+ sourcesContent: traceMap.sourcesContent,
71
+ names: traceMap.names,
72
+ mappings: encodedMappings(presortedDecodedMap({
73
+ version: 3,
74
+ sources: Array.from(traceMap.sources),
75
+ names: Array.from(traceMap.names),
76
+ mappings: translated.mappings.map(function (line) {
77
+ return Array.from(line);
78
+ })
79
+ }))
80
+ });
81
+ }
82
+ export function recomposeSourceMap(originalMap, sourceMapTransforms) {
83
+ return sourceMapTransforms.reduce(recomposeWithTransform, originalMap);
84
+ }
4
85
  //# sourceMappingURL=source-map-composer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-map-composer.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/source-map-composer.ts"],"names":[],"mappings":"AAAA,OAOO,2BAA2B,CAAC;AACnC,OAAkE,sBAAsB,CAAC;AACzF,OAAwE,iBAAiB,CAAC"}
1
+ {"version":3,"file":"source-map-composer.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/transform/source-map-composer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,QAAQ,EAGX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAA2B,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAmB,MAAM,iBAAiB,CAAC;AAc1F,SAAS,gBAAgB,CAAC,WAAmB;IACzC,IAAI,CAAC;QACD,OAAO,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CACjB,SAAqB,EACrB,QAAkB,EAClB,OAAiE;IAEjE,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,CAAC,CAAC;IAC9C,IAAI,OAAO,C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AAK;QACrB,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC;YAC1C,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YACrC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YACjC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,IAAI;gBAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC;SACL,CAAC,CAAC;KACN,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,kBAAkB,CAC9B,WAAmB,EACnB,mBAAkD;IAElD,OAAO,mBAAmB,CAAC,MAAM,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;AAC3E,CAAC"}
@@ -1,2 +1,26 @@
1
- import 'ts-morph';
1
+ import { Node as TsMorphNode, SyntaxKind } from 'ts-morph';
2
+ export function collectVariableDeclarationBindings(declarator) {
3
+ const collectBindingsFromNameNode = function (nameNode, declarationNode, referenceNode) {
4
+ if (TsMorphNode.isIdentifier(nameNode)) {
5
+ return [{ name: nameNode.getText(), declarationNode, referenceNode }];
6
+ }
7
+ return nameNode.getElements().flatMap(function (element) {
8
+ if (!TsMorphNode.isBindingElement(element)) {
9
+ return [];
10
+ }
11
+ return collectBindingsFromNameNode(element.getNameNode(), element, element.getFirstAncestorByKindOrThrow(SyntaxKind.VariableDeclaration));
12
+ });
13
+ };
14
+ return collectBindingsFromNameNode(declarator.getNameNode(), declarator, declarator);
15
+ }
16
+ function namesBoundByVariableDeclaration(declarator) {
17
+ return collectVariableDeclarationBindings(declarator).map(function (binding) {
18
+ return binding.name;
19
+ });
20
+ }
21
+ export function variableDeclarationSurvives(declarator, survivingNames) {
22
+ return namesBoundByVariableDeclaration(declarator).some(function (name) {
23
+ return survivingNames.has(name);
24
+ });
25
+ }
2
26
  //# sourceMappingURL=variable-declaration-bindings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable-declaration-bindings.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/variable-declaration-bindings.ts"],"names":[],"mappings":"AAAA,OAA+F,UAAU,CAAC"}
1
+ {"version":3,"file":"variable-declaration-bindings.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/variable-declaration-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,UAAU,EAAiD,MAAM,UAAU,CAAC;AAQ1G,MAAM,UAAU,kCAAkC,CAC9C,UAA+B;IAQ/B,MAAM,2BAA2B,GAAqB,UAAU,QAAQ,EAAE,eAAe,EAAE,aAAa;QACpG,IAAI,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrC,OAAO,CAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE,CAAE,CAAC;QAC5E,CAAC;QACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,OAAO;YACnD,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzC,OAAO,EAAE,CAAC;YACd,CAAC;YACD,OAAO,2BAA2B,CAC9B,OAAO,CAAC,WAAW,EAAE,EACrB,OAAO,EACP,OAAO,CAAC,6BAA6B,CAAC,UAAU,CAAC,mBAAmB,CAAC,CACxE,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,2BAA2B,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,+BAA+B,CAAC,UAA+B;IACpE,OAAO,kCAAkC,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,UAAU,OAAO;QACvE,OAAO,OAAO,CAAC,IAAI,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,2BAA2B,CACvC,UAA+B,EAC/B,cAAmC;IAEnC,OAAO,+BAA+B,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAU,IAAI;QAClE,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,4 +1,78 @@
1
- import 'remeda';
2
- import "../directed-graph/graph.js";
3
- import "./external-dependencies.js";
1
+ import { indexBy, values } from 'remeda';
2
+ import { createDirectedGraph } from "../directed-graph/graph.js";
3
+ import { mergeExternalDependencyReference, mergeExternalDependencies } from "./external-dependencies.js";
4
+ export function mergeDependencyFiles(first, second) {
5
+ return {
6
+ localFiles: values(indexBy([...first.localFiles, ...second.localFiles], function (localFile) {
7
+ return localFile.filePath;
8
+ })),
9
+ externalDependencies: mergeExternalDependencies(first.externalDependencies, second.externalDependencies)
10
+ };
11
+ }
12
+ function sourceMapLocalFile(sourceMapFilePath, project) {
13
+ if (!sourceMapFilePath.isJust) {
14
+ return undefined;
15
+ }
16
+ return {
17
+ filePath: sourceMapFilePath.value,
18
+ directDependencies: new Set(),
19
+ moduleReferences: [],
20
+ project: project?.getProject()
21
+ };
22
+ }
23
+ export function createDependencyGraph() {
24
+ const graph = createDirectedGraph();
25
+ return {
26
+ addDependency(filePath, data) {
27
+ graph.addNode(filePath, data);
28
+ },
29
+ isKnown: graph.hasNode,
30
+ connect(fromFilePath, toFilePath) {
31
+ graph.connect({ from: fromFilePath, to: toFilePath });
32
+ },
33
+ hasConnection(fromFilePath, toFilePath) {
34
+ return graph.hasConnection({ from: fromFilePath, to: toFilePath });
35
+ },
36
+ walk(startFilePath, visitor) {
37
+ graph.visitBreadthFirstSearch(startFilePath, function (node) {
38
+ visitor({
39
+ filePath: node.id,
40
+ sourceMapFilePath: node.data.sourceMapFilePath,
41
+ externalDependencies: node.data.externalDependencies,
42
+ moduleReferences: node.data.moduleReferences,
43
+ localFiles: Array.from(node.adjacentNodeIds),
44
+ project: node.data.project,
45
+ ...node.data.isGeneratedManifest ? { isGeneratedManifest: true } : {}
46
+ });
47
+ });
48
+ },
49
+ flatten(startFilePath) {
50
+ const localFiles = new Map();
51
+ const externalDependencies = new Map();
52
+ graph.visitBreadthFirstSearch(startFilePath, function (node) {
53
+ const directDependencies = new Set(graph.getAdjacentIds(node.id));
54
+ const sourceMapFile = sourceMapLocalFile(node.data.sourceMapFilePath, node.data.project);
55
+ if (sourceMapFile !== undefined) {
56
+ directDependencies.add(sourceMapFile.filePath);
57
+ localFiles.set(sourceMapFile.filePath, sourceMapFile);
58
+ }
59
+ localFiles.set(node.id, {
60
+ filePath: node.id,
61
+ directDependencies,
62
+ moduleReferences: node.data.moduleReferences,
63
+ project: node.data.project?.getProject(),
64
+ ...node.data.isGeneratedManifest ? { isGeneratedManifest: true } : {}
65
+ });
66
+ for (const dependencyReference of node.data.externalDependencies) {
67
+ const externalDependency = externalDependencies.get(dependencyReference.name);
68
+ externalDependencies.set(dependencyReference.name, mergeExternalDependencyReference(dependencyReference, node.id, externalDependency));
69
+ }
70
+ });
71
+ return {
72
+ localFiles: Array.from(localFiles.values()),
73
+ externalDependencies
74
+ };
75
+ }
76
+ };
77
+ }
4
78
  //# sourceMappingURL=dependency-graph.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependency-graph.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/dependency-graph.ts"],"names":[],"mappings":"AAEA,OAAgC,QAAQ,CAAC;AACzC,OAAoC,4BAA4B,CAAC;AACjE,OAMO,4BAA4B,CAAC"}
1
+ {"version":3,"file":"dependency-graph.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/dependency-graph.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEH,gCAAgC,EAChC,yBAAyB,EAG5B,MAAM,4BAA4B,CA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C,EAAE,EAAE;oBACpB,QAAQ,EAAE,IAAI,CAAC,EAAE;oBACjB,kBAAkB;oBAClB,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB;oBAC5C,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE;oBACxC,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;iBACxE,CAAC,CAAC;gBACH,KAAK,MAAM,mBAAmB,IAAI,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;oBAC/D,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;oBAC9E,oBAAoB,CAAC,GAAG,CACpB,mBAAmB,CAAC,IAAI,EACxB,gCAAgC,CAAC,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE,kBAAkB,CAAC,CACrF,CAAC;gBACN,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO;gBACH,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3C,oBAAoB;aACvB,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -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,C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AAgB,CAAC;gBAChC,GAAG,WAAW,CAAC,UAAU,IAAI,EAAE;gBAC/B,GAAG,WAAW,CAAC,UAAU,IAAI,EAAE;aAClC,CAAC,CAAC;YACH,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE;gBACrC,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,cAAc,EAAE,MAAM,CAAC,CAAE,GAAG,WAAW,CAAC,cAAc,EAAE,GAAG,WAAW,CAAC,cAAc,CAAE,CAAC;gBACxF,GAAG,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE;aACpD,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC5C,SAA4C,EAC5C,cAAsB,EACtB,kBAAkD;IAElD,MAAM,UAAU,GAAG,wBAAwB,CAAC,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IACvF,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,UAAU,CAAC;IACtB,CAAC;IACD,OAAO,yBAAyB,CAC5B,IAAI,GAAG,CAAC,CAAE,CAAE,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,CAAE,CAAE,CAAC,EAC5D,IAAI,GAAG,CAAC,CAAE,CAAE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAE,CAAE,CAAC,CAC/C;SACI,GAAG,CAAC,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