packtory 0.0.96 → 0.0.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (662) hide show
  1. package/artifacts/artifacts-builder.d.ts +28 -0
  2. package/artifacts/artifacts-builder.d.ts.map +1 -0
  3. package/artifacts/artifacts-builder.js +37 -4
  4. package/artifacts/artifacts-builder.js.map +1 -1
  5. package/artifacts/content-collection.js +59 -2
  6. package/artifacts/content-collection.js.map +1 -1
  7. package/artifacts/folder-writer.js +25 -2
  8. package/artifacts/folder-writer.js.map +1 -1
  9. package/bundle-emitter/emitter.d.ts +8 -0
  10. package/bundle-emitter/emitter.d.ts.map +1 -1
  11. package/bundle-emitter/emitter.js +137 -6
  12. package/bundle-emitter/emitter.js.map +1 -1
  13. package/bundle-emitter/extract-package-tarball.js +13 -2
  14. package/bundle-emitter/extract-package-tarball.js.map +1 -1
  15. package/bundle-emitter/fetch-published-artifacts.d.ts +2 -0
  16. package/bundle-emitter/fetch-published-artifacts.d.ts.map +1 -1
  17. package/bundle-emitter/fetch-published-artifacts.js +19 -2
  18. package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
  19. package/bundle-emitter/publication-outcome.d.ts +3 -0
  20. package/bundle-emitter/publication-outcome.d.ts.map +1 -1
  21. package/bundle-emitter/publication-outcome.js +5 -0
  22. package/bundle-emitter/publication-outcome.js.map +1 -1
  23. package/bundle-emitter/publish-error/auto-mode-error-matching.js +28 -2
  24. package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
  25. package/bundle-emitter/publish-error/error-shape-helpers.js +9 -0
  26. package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
  27. package/bundle-emitter/publish-error/file-mode-error-matching.js +33 -2
  28. package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
  29. package/bundle-emitter/publish-error/publish-error-messages.js +24 -0
  30. package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
  31. package/bundle-emitter/registry/metadata-auth-retry.js +24 -1
  32. package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
  33. package/bundle-emitter/registry/oidc-token-exchange.js +68 -3
  34. package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
  35. package/bundle-emitter/registry/package-metadata-fetcher.d.ts +14 -0
  36. package/bundle-emitter/registry/package-metadata-fetcher.d.ts.map +1 -1
  37. package/bundle-emitter/registry/package-metadata-fetcher.js +210 -7
  38. package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
  39. package/bundle-emitter/registry/publish-settings-bridge.js +34 -3
  40. package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
  41. package/bundle-emitter/registry/registry-auth-config.d.ts +17 -0
  42. package/bundle-emitter/registry/registry-auth-config.d.ts.map +1 -0
  43. package/bundle-emitter/registry/registry-auth-config.js +106 -0
  44. package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
  45. package/bundle-emitter/registry/registry-client.d.ts +13 -1
  46. package/bundle-emitter/registry/registry-client.d.ts.map +1 -1
  47. package/bundle-emitter/registry/registry-client.js +74 -4
  48. package/bundle-emitter/registry/registry-client.js.map +1 -1
  49. package/bundle-emitter/registry/registry-package-path.js +3 -0
  50. package/bundle-emitter/registry/registry-package-path.js.map +1 -1
  51. package/bundle-emitter/registry/registry-response-schemas.js +50 -2
  52. package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
  53. package/bundle-emitter/registry/tarball-integrity.d.ts +1 -0
  54. package/bundle-emitter/registry/tarball-integrity.d.ts.map +1 -1
  55. package/bundle-emitter/registry/tarball-integrity.js +31 -1
  56. package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
  57. package/bundle-emitter/registry/validate-tarball-host.js +26 -1
  58. package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
  59. package/bundle-emitter/release-artifact-canonicalizer.js +31 -5
  60. package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
  61. package/checks/check-runner.d.ts +18 -0
  62. package/checks/check-runner.d.ts.map +1 -0
  63. package/checks/check-runner.js +8 -0
  64. package/checks/check-runner.js.map +1 -1
  65. package/checks/rule.d.ts +42 -0
  66. package/checks/rule.d.ts.map +1 -0
  67. package/checks/rule.js +12 -2
  68. package/checks/rule.js.map +1 -1
  69. package/checks/rules/duplicate-detection.js +23 -1
  70. package/checks/rules/duplicate-detection.js.map +1 -1
  71. package/checks/rules/duplicate-messages.js +22 -0
  72. package/checks/rules/duplicate-messages.js.map +1 -1
  73. package/checks/rules/file-ownership.js +15 -0
  74. package/checks/rules/file-ownership.js.map +1 -1
  75. package/checks/rules/max-bundle-size.d.ts +13 -0
  76. package/checks/rules/max-bundle-size.d.ts.map +1 -0
  77. package/checks/rules/max-bundle-size.js +55 -1
  78. package/checks/rules/max-bundle-size.js.map +1 -1
  79. package/checks/rules/no-dev-dependency-imports.d.ts +11 -0
  80. package/checks/rules/no-dev-dependency-imports.d.ts.map +1 -0
  81. package/checks/rules/no-dev-dependency-imports.js +51 -1
  82. package/checks/rules/no-dev-dependency-imports.js.map +1 -1
  83. package/checks/rules/no-duplicated-files.d.ts +11 -0
  84. package/checks/rules/no-duplicated-files.d.ts.map +1 -0
  85. package/checks/rules/no-duplicated-files.js +53 -3
  86. package/checks/rules/no-duplicated-files.js.map +1 -1
  87. package/checks/rules/no-side-effects.d.ts +15 -0
  88. package/checks/rules/no-side-effects.d.ts.map +1 -0
  89. package/checks/rules/no-side-effects.js +50 -1
  90. package/checks/rules/no-side-effects.js.map +1 -1
  91. package/checks/rules/no-unexposed-executables.d.ts +8 -0
  92. package/checks/rules/no-unexposed-executables.d.ts.map +1 -0
  93. package/checks/rules/no-unexposed-executables.js +43 -2
  94. package/checks/rules/no-unexposed-executables.js.map +1 -1
  95. package/checks/rules/no-unused-bundle-dependencies.d.ts +8 -0
  96. package/checks/rules/no-unused-bundle-dependencies.d.ts.map +1 -0
  97. package/checks/rules/no-unused-bundle-dependencies.js +30 -2
  98. package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
  99. package/checks/rules/registry.d.ts +23 -0
  100. package/checks/rules/registry.d.ts.map +1 -0
  101. package/checks/rules/registry.js +22 -9
  102. package/checks/rules/registry.js.map +1 -1
  103. package/checks/rules/required-files.d.ts +15 -0
  104. package/checks/rules/required-files.d.ts.map +1 -0
  105. package/checks/rules/required-files.js +41 -3
  106. package/checks/rules/required-files.js.map +1 -1
  107. package/checks/rules/type-script-declaration-integrity.d.ts +9 -0
  108. package/checks/rules/type-script-declaration-integrity.d.ts.map +1 -0
  109. package/checks/rules/type-script-declaration-integrity.js +81 -3
  110. package/checks/rules/type-script-declaration-integrity.js.map +1 -1
  111. package/checks/rules/type-script-declaration-paths.js +55 -1
  112. package/checks/rules/type-script-declaration-paths.js.map +1 -1
  113. package/checks/rules/type-script-declaration-project.d.ts +29 -0
  114. package/checks/rules/type-script-declaration-project.d.ts.map +1 -0
  115. package/checks/rules/type-script-declaration-project.js +202 -3
  116. package/checks/rules/type-script-declaration-project.js.map +1 -1
  117. package/checks/rules/type-script-declaration-reachability.js +38 -2
  118. package/checks/rules/type-script-declaration-reachability.js.map +1 -1
  119. package/checks/rules/type-script-declaration-roots.js +29 -0
  120. package/checks/rules/type-script-declaration-roots.js.map +1 -1
  121. package/checks/rules/type-script-integrity.d.ts +24 -0
  122. package/checks/rules/type-script-integrity.d.ts.map +1 -0
  123. package/checks/rules/type-script-integrity.js +72 -2
  124. package/checks/rules/type-script-integrity.js.map +1 -1
  125. package/checks/rules/type-script-package-resolution.d.ts +29 -0
  126. package/checks/rules/type-script-package-resolution.d.ts.map +1 -0
  127. package/checks/rules/type-script-package-resolution.js +42 -1
  128. package/checks/rules/type-script-package-resolution.js.map +1 -1
  129. package/checks/rules/type-script-resolution-summary.js +53 -0
  130. package/checks/rules/type-script-resolution-summary.js.map +1 -1
  131. package/checks/rules/unique-target-paths.d.ts +8 -0
  132. package/checks/rules/unique-target-paths.d.ts.map +1 -0
  133. package/checks/rules/unique-target-paths.js +34 -2
  134. package/checks/rules/unique-target-paths.js.map +1 -1
  135. package/common/bundled-dependency-groups.js +27 -0
  136. package/common/bundled-dependency-groups.js.map +1 -1
  137. package/common/code-files.js +28 -0
  138. package/common/code-files.js.map +1 -1
  139. package/common/declaration-companion-paths.js +24 -0
  140. package/common/declaration-companion-paths.js.map +1 -1
  141. package/common/package-name-map.js +7 -0
  142. package/common/package-name-map.js.map +1 -1
  143. package/common/stable-json.js +42 -2
  144. package/common/stable-json.js.map +1 -1
  145. package/common/worklist.js +22 -0
  146. package/common/worklist.js.map +1 -1
  147. package/config/additional-files.js +6 -2
  148. package/config/additional-files.js.map +1 -1
  149. package/config/additional-package-json-attributes-schema.js +6 -2
  150. package/config/additional-package-json-attributes-schema.js.map +1 -1
  151. package/config/automatic-versioning-settings.js +6 -2
  152. package/config/automatic-versioning-settings.js.map +1 -1
  153. package/config/changelog-settings.d.ts +44 -0
  154. package/config/changelog-settings.d.ts.map +1 -1
  155. package/config/changelog-settings.js +120 -3
  156. package/config/changelog-settings.js.map +1 -1
  157. package/config/common-package-settings-schemas.js +19 -3
  158. package/config/common-package-settings-schemas.js.map +1 -1
  159. package/config/config.d.ts +6 -1
  160. package/config/config.d.ts.map +1 -1
  161. package/config/config.js +3 -1
  162. package/config/config.js.map +1 -1
  163. package/config/cross-package-validation.js +17 -0
  164. package/config/cross-package-validation.js.map +1 -1
  165. package/config/dead-code-elimination-settings.d.ts +1 -0
  166. package/config/dead-code-elimination-settings.d.ts.map +1 -1
  167. package/config/dead-code-elimination-settings.js +36 -2
  168. package/config/dead-code-elimination-settings.js.map +1 -1
  169. package/config/dependency-existence-validation.js +19 -1
  170. package/config/dependency-existence-validation.js.map +1 -1
  171. package/config/dependency-policy.js +5 -2
  172. package/config/dependency-policy.js.map +1 -1
  173. package/config/main-package-json-schema.js +13 -2
  174. package/config/main-package-json-schema.js.map +1 -1
  175. package/config/manual-versioning-settings.d.ts +12 -0
  176. package/config/manual-versioning-settings.d.ts.map +1 -1
  177. package/config/manual-versioning-settings.js +29 -2
  178. package/config/manual-versioning-settings.js.map +1 -1
  179. package/config/optional-package-settings-schema.js +16 -7
  180. package/config/optional-package-settings-schema.js.map +1 -1
  181. package/config/package-config.d.ts +4 -0
  182. package/config/package-config.d.ts.map +1 -1
  183. package/config/package-config.js +2 -1
  184. package/config/package-config.js.map +1 -1
  185. package/config/package-graph-builder.js +14 -2
  186. package/config/package-graph-builder.js.map +1 -1
  187. package/config/package-interface.js +25 -2
  188. package/config/package-interface.js.map +1 -1
  189. package/config/package-json.d.ts +2 -0
  190. package/config/package-json.d.ts.map +1 -1
  191. package/config/package-json.js +16 -0
  192. package/config/package-json.js.map +1 -1
  193. package/config/packtory-config-without-registry-schema.js +6 -0
  194. package/config/packtory-config-without-registry-schema.js.map +1 -1
  195. package/config/per-package-settings-schema.js +22 -6
  196. package/config/per-package-settings-schema.js.map +1 -1
  197. package/config/pre-graph-validation.js +20 -5
  198. package/config/pre-graph-validation.js.map +1 -1
  199. package/config/publish-settings.d.ts +3 -0
  200. package/config/publish-settings.d.ts.map +1 -1
  201. package/config/publish-settings.js +25 -3
  202. package/config/publish-settings.js.map +1 -1
  203. package/config/publish-settings.report.js +17 -1
  204. package/config/publish-settings.report.js.map +1 -1
  205. package/config/registry-settings.d.ts +41 -0
  206. package/config/registry-settings.d.ts.map +1 -1
  207. package/config/registry-settings.js +40 -2
  208. package/config/registry-settings.js.map +1 -1
  209. package/config/registry-settings.report.js +46 -0
  210. package/config/registry-settings.report.js.map +1 -1
  211. package/config/root-config-validation.js +141 -0
  212. package/config/root-config-validation.js.map +1 -1
  213. package/config/root.js +6 -2
  214. package/config/root.js.map +1 -1
  215. package/config/sbom-settings.js +4 -1
  216. package/config/sbom-settings.js.map +1 -1
  217. package/config/settings-validation.js +28 -0
  218. package/config/settings-validation.js.map +1 -1
  219. package/config/versioning-settings.d.ts +18 -1
  220. package/config/versioning-settings.d.ts.map +1 -1
  221. package/config/versioning-settings.js +10 -3
  222. package/config/versioning-settings.js.map +1 -1
  223. package/dead-code-eliminator/analyzed-bundle.d.ts +11 -0
  224. package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
  225. package/dead-code-eliminator/analyzed-bundle.js +7 -0
  226. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  227. package/dead-code-eliminator/bundle-analysis.js +38 -5
  228. package/dead-code-eliminator/bundle-analysis.js.map +1 -1
  229. package/dead-code-eliminator/class-purity.js +48 -2
  230. package/dead-code-eliminator/class-purity.js.map +1 -1
  231. package/dead-code-eliminator/code-file-analyzer.js +68 -4
  232. package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
  233. package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -0
  234. package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
  235. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
  236. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
  237. package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -3
  238. package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
  239. package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
  240. package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
  241. package/dead-code-eliminator/dependency-metadata.js +172 -2
  242. package/dead-code-eliminator/dependency-metadata.js.map +1 -1
  243. package/dead-code-eliminator/elimination-emitter.js +52 -0
  244. package/dead-code-eliminator/elimination-emitter.js.map +1 -1
  245. package/dead-code-eliminator/eliminator.js +22 -4
  246. package/dead-code-eliminator/eliminator.js.map +1 -1
  247. package/dead-code-eliminator/expression-unwrapping.js +16 -1
  248. package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
  249. package/dead-code-eliminator/imported-expression-origin.js +101 -2
  250. package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
  251. package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
  252. package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
  253. package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
  254. package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
  255. package/dead-code-eliminator/liveness/external-module-resolution.js +172 -2
  256. package/dead-code-eliminator/liveness/external-module-resolution.js.map +1 -1
  257. package/dead-code-eliminator/liveness/external-purity-summary.js +294 -3
  258. package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
  259. package/dead-code-eliminator/liveness/external-purity.js +39 -3
  260. package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
  261. package/dead-code-eliminator/liveness/module-analysis.js +27 -2
  262. package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
  263. package/dead-code-eliminator/liveness/resource-retention.js +91 -1
  264. package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
  265. package/dead-code-eliminator/liveness/runtime-code.js +15 -1
  266. package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
  267. package/dead-code-eliminator/load-bundle.js +86 -5
  268. package/dead-code-eliminator/load-bundle.js.map +1 -1
  269. package/dead-code-eliminator/pure-expression.js +178 -5
  270. package/dead-code-eliminator/pure-expression.js.map +1 -1
  271. package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
  272. package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
  273. package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
  274. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  275. package/dead-code-eliminator/reachability/binding-id.js +106 -1
  276. package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
  277. package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -1
  278. package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
  279. package/dead-code-eliminator/reachability/impure-statements.js +11 -2
  280. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  281. package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
  282. package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
  283. package/dead-code-eliminator/reachability/reachability.js +65 -4
  284. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  285. package/dead-code-eliminator/side-effect-classifier.js +39 -4
  286. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  287. package/dead-code-eliminator/side-effects-field.js +23 -1
  288. package/dead-code-eliminator/side-effects-field.js.map +1 -1
  289. package/dead-code-eliminator/source-map-recomposition.js +29 -2
  290. package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
  291. package/dead-code-eliminator/statement-classifiers.js +94 -4
  292. package/dead-code-eliminator/statement-classifiers.js.map +1 -1
  293. package/dead-code-eliminator/syntax-kind-sets.js +16 -0
  294. package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
  295. package/dead-code-eliminator/transform/atom-translator.d.ts +8 -0
  296. package/dead-code-eliminator/transform/atom-translator.d.ts.map +1 -1
  297. package/dead-code-eliminator/transform/atom-translator.js +57 -2
  298. package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
  299. package/dead-code-eliminator/transform/declaration-removal.js +183 -5
  300. package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
  301. package/dead-code-eliminator/transform/declaration-remover.js +17 -2
  302. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  303. package/dead-code-eliminator/transform/line-index.d.ts +7 -0
  304. package/dead-code-eliminator/transform/line-index.d.ts.map +1 -1
  305. package/dead-code-eliminator/transform/line-index.js +20 -0
  306. package/dead-code-eliminator/transform/line-index.js.map +1 -1
  307. package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
  308. package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
  309. package/dead-code-eliminator/transform/source-map-composer.js +84 -3
  310. package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
  311. package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
  312. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
  313. package/dependency-scanner/dependency-graph.d.ts +41 -0
  314. package/dependency-scanner/dependency-graph.d.ts.map +1 -0
  315. package/dependency-scanner/dependency-graph.js +77 -3
  316. package/dependency-scanner/dependency-graph.js.map +1 -1
  317. package/dependency-scanner/external-dependencies.d.ts +9 -0
  318. package/dependency-scanner/external-dependencies.d.ts.map +1 -1
  319. package/dependency-scanner/external-dependencies.js +55 -1
  320. package/dependency-scanner/external-dependencies.js.map +1 -1
  321. package/dependency-scanner/file-host-predicates.js +9 -0
  322. package/dependency-scanner/file-host-predicates.js.map +1 -1
  323. package/dependency-scanner/host-method-binding.js +18 -0
  324. package/dependency-scanner/host-method-binding.js.map +1 -1
  325. package/dependency-scanner/injected-dynamic-imports.js +232 -1
  326. package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
  327. package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
  328. package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
  329. package/dependency-scanner/package-owned-asset-file-path.js +9 -1
  330. package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
  331. package/dependency-scanner/scanner.d.ts +20 -0
  332. package/dependency-scanner/scanner.d.ts.map +1 -0
  333. package/dependency-scanner/scanner.js +109 -4
  334. package/dependency-scanner/scanner.js.map +1 -1
  335. package/dependency-scanner/source-file-references.d.ts +37 -0
  336. package/dependency-scanner/source-file-references.d.ts.map +1 -0
  337. package/dependency-scanner/source-file-references.js +181 -6
  338. package/dependency-scanner/source-file-references.js.map +1 -1
  339. package/dependency-scanner/source-map-file-locator.d.ts +10 -0
  340. package/dependency-scanner/source-map-file-locator.d.ts.map +1 -0
  341. package/dependency-scanner/source-map-file-locator.js +66 -2
  342. package/dependency-scanner/source-map-file-locator.js.map +1 -1
  343. package/dependency-scanner/typescript-compiler-options.d.ts +8 -0
  344. package/dependency-scanner/typescript-compiler-options.d.ts.map +1 -0
  345. package/dependency-scanner/typescript-compiler-options.js +21 -1
  346. package/dependency-scanner/typescript-compiler-options.js.map +1 -1
  347. package/dependency-scanner/typescript-file-host.d.ts +12 -0
  348. package/dependency-scanner/typescript-file-host.d.ts.map +1 -0
  349. package/dependency-scanner/typescript-file-host.js +49 -5
  350. package/dependency-scanner/typescript-file-host.js.map +1 -1
  351. package/dependency-scanner/typescript-project-analyzer.d.ts +19 -0
  352. package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -0
  353. package/dependency-scanner/typescript-project-analyzer.js +35 -3
  354. package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
  355. package/dependency-scanner/virtual-package-json-host.js +45 -4
  356. package/dependency-scanner/virtual-package-json-host.js.map +1 -1
  357. package/directed-graph/graph.d.ts +1 -0
  358. package/directed-graph/graph.d.ts.map +1 -1
  359. package/directed-graph/graph.js +240 -1
  360. package/directed-graph/graph.js.map +1 -1
  361. package/file-manager/compare.js +23 -2
  362. package/file-manager/compare.js.map +1 -1
  363. package/file-manager/equal.js +5 -0
  364. package/file-manager/equal.js.map +1 -1
  365. package/file-manager/file-description.d.ts +1 -0
  366. package/file-manager/file-description.d.ts.map +1 -1
  367. package/file-manager/file-description.js +3 -0
  368. package/file-manager/file-description.js.map +1 -1
  369. package/file-manager/permissions.js +28 -1
  370. package/file-manager/permissions.js.map +1 -1
  371. package/git/current-git-head.d.ts +12 -0
  372. package/git/current-git-head.d.ts.map +1 -0
  373. package/git/current-git-head.js +24 -0
  374. package/git/current-git-head.js.map +1 -1
  375. package/git/git-command.js +49 -1
  376. package/git/git-command.js.map +1 -1
  377. package/linker/linked-bundle.d.ts +8 -0
  378. package/linker/linked-bundle.d.ts.map +1 -1
  379. package/linker/linked-bundle.js +5 -0
  380. package/linker/linked-bundle.js.map +1 -1
  381. package/linker/linker.d.ts +13 -0
  382. package/linker/linker.d.ts.map +1 -0
  383. package/linker/linker.js +51 -5
  384. package/linker/linker.js.map +1 -1
  385. package/linker/replacement-lookup.js +297 -8
  386. package/linker/replacement-lookup.js.map +1 -1
  387. package/linker/resource-graph.js +65 -2
  388. package/linker/resource-graph.js.map +1 -1
  389. package/linker/source-modifier/import-paths.js +76 -3
  390. package/linker/source-modifier/import-paths.js.map +1 -1
  391. package/linker/substitute-bundles.js +166 -3
  392. package/linker/substitute-bundles.js.map +1 -1
  393. package/linker/substituted-resource-graph.js +111 -2
  394. package/linker/substituted-resource-graph.js.map +1 -1
  395. package/npm-oidc-id-token-resolver.js +82 -0
  396. package/npm-oidc-id-token-resolver.js.map +1 -1
  397. package/pack-emitter/pack-emitter.d.ts +20 -0
  398. package/pack-emitter/pack-emitter.d.ts.map +1 -1
  399. package/pack-emitter/pack-emitter.js +27 -0
  400. package/pack-emitter/pack-emitter.js.map +1 -1
  401. package/package-surface/bin-field.js +8 -2
  402. package/package-surface/bin-field.js.map +1 -1
  403. package/package-surface/explicit-bin.js +24 -2
  404. package/package-surface/explicit-bin.js.map +1 -1
  405. package/package-surface/explicit-exports.js +26 -3
  406. package/package-surface/explicit-exports.js.map +1 -1
  407. package/package-surface/export-map.js +9 -2
  408. package/package-surface/export-map.js.map +1 -1
  409. package/package-surface/implicit-bin.js +25 -1
  410. package/package-surface/implicit-bin.js.map +1 -1
  411. package/package-surface/implicit-exports.js +10 -3
  412. package/package-surface/implicit-exports.js.map +1 -1
  413. package/package-surface/implicit-root-exports.js +13 -2
  414. package/package-surface/implicit-root-exports.js.map +1 -1
  415. package/package-surface/package-json-export.js +9 -0
  416. package/package-surface/package-json-export.js.map +1 -1
  417. package/package-surface/package-shape.js +10 -1
  418. package/package-surface/package-shape.js.map +1 -1
  419. package/package-surface/package-surface-index.js +165 -3
  420. package/package-surface/package-surface-index.js.map +1 -1
  421. package/package-surface/public-module-usage.js +46 -3
  422. package/package-surface/public-module-usage.js.map +1 -1
  423. package/package-surface/public-specifiers.js +7 -1
  424. package/package-surface/public-specifiers.js.map +1 -1
  425. package/package-surface/root-registry.js +26 -0
  426. package/package-surface/root-registry.js.map +1 -1
  427. package/package-surface/specifier-syntax.js +4 -0
  428. package/package-surface/specifier-syntax.js.map +1 -1
  429. package/package-surface/substitution-exports.js +101 -3
  430. package/package-surface/substitution-exports.js.map +1 -1
  431. package/package-surface/surface.d.ts +2 -0
  432. package/package-surface/surface.d.ts.map +1 -1
  433. package/package-surface/surface.js +12 -0
  434. package/package-surface/surface.js.map +1 -1
  435. package/package.json +1 -1
  436. package/packages/package-processor.composition.d.ts +22 -0
  437. package/packages/package-processor.composition.d.ts.map +1 -1
  438. package/packages/package-processor.composition.js +161 -34
  439. package/packages/package-processor.composition.js.map +1 -1
  440. package/packtory/map-config.d.ts +11 -1
  441. package/packtory/map-config.d.ts.map +1 -1
  442. package/packtory/map-config.js +35 -4
  443. package/packtory/map-config.js.map +1 -1
  444. package/packtory/normalize-paths.js +25 -1
  445. package/packtory/normalize-paths.js.map +1 -1
  446. package/packtory/options/bundle-dependency-resolution.js +17 -1
  447. package/packtory/options/bundle-dependency-resolution.js.map +1 -1
  448. package/packtory/options/dead-code-elimination-resolution.js +10 -1
  449. package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
  450. package/packtory/options/prepare-package-options.d.ts +13 -1
  451. package/packtory/options/prepare-package-options.d.ts.map +1 -1
  452. package/packtory/options/prepare-package-options.js +46 -5
  453. package/packtory/options/prepare-package-options.js.map +1 -1
  454. package/packtory/options/required-value-helpers.js +17 -0
  455. package/packtory/options/required-value-helpers.js.map +1 -1
  456. package/packtory/options/setting-resolvers.d.ts +17 -1
  457. package/packtory/options/setting-resolvers.d.ts.map +1 -1
  458. package/packtory/options/setting-resolvers.js +47 -3
  459. package/packtory/options/setting-resolvers.js.map +1 -1
  460. package/packtory/options/surface-resolution.js +15 -2
  461. package/packtory/options/surface-resolution.js.map +1 -1
  462. package/packtory/options/version-provider-context.js +24 -2
  463. package/packtory/options/version-provider-context.js.map +1 -1
  464. package/packtory/options/version-trigger.js +39 -2
  465. package/packtory/options/version-trigger.js.map +1 -1
  466. package/packtory/pack-output-preflight.js +60 -3
  467. package/packtory/pack-output-preflight.js.map +1 -1
  468. package/packtory/package-processor-build.js +97 -3
  469. package/packtory/package-processor-build.js.map +1 -1
  470. package/packtory/package-processor-publish-result.d.ts +3 -0
  471. package/packtory/package-processor-publish-result.d.ts.map +1 -1
  472. package/packtory/package-processor-publish.d.ts +2 -0
  473. package/packtory/package-processor-publish.d.ts.map +1 -1
  474. package/packtory/package-processor-publish.js +297 -6
  475. package/packtory/package-processor-publish.js.map +1 -1
  476. package/packtory/package-processor.d.ts +34 -0
  477. package/packtory/package-processor.d.ts.map +1 -1
  478. package/packtory/package-processor.js +10 -2
  479. package/packtory/package-processor.js.map +1 -1
  480. package/packtory/packtory-pack.js +298 -10
  481. package/packtory/packtory-pack.js.map +1 -1
  482. package/packtory/packtory-package-dependencies.js +116 -2
  483. package/packtory/packtory-package-dependencies.js.map +1 -1
  484. package/packtory/packtory-package-inspection.js +26 -5
  485. package/packtory/packtory-package-inspection.js.map +1 -1
  486. package/packtory/packtory-package-side-effects.js +64 -3
  487. package/packtory/packtory-package-side-effects.js.map +1 -1
  488. package/packtory/packtory-package-tree.js +43 -4
  489. package/packtory/packtory-package-tree.js.map +1 -1
  490. package/packtory/packtory-publish.js +17 -4
  491. package/packtory/packtory-publish.js.map +1 -1
  492. package/packtory/packtory-release-analysis.js +64 -6
  493. package/packtory/packtory-release-analysis.js.map +1 -1
  494. package/packtory/packtory-release-diff.js +48 -5
  495. package/packtory/packtory-release-diff.js.map +1 -1
  496. package/packtory/packtory-release-plan.js +87 -6
  497. package/packtory/packtory-release-plan.js.map +1 -1
  498. package/packtory/packtory-resolve.js +16 -5
  499. package/packtory/packtory-resolve.js.map +1 -1
  500. package/packtory/packtory.d.ts +28 -1
  501. package/packtory/packtory.d.ts.map +1 -1
  502. package/packtory/packtory.js +242 -13
  503. package/packtory/packtory.js.map +1 -1
  504. package/packtory/publish-failure-mapping.js +6 -0
  505. package/packtory/publish-failure-mapping.js.map +1 -1
  506. package/packtory/publish-target-preflight.js +25 -3
  507. package/packtory/publish-target-preflight.js.map +1 -1
  508. package/packtory/published-release-state.d.ts +19 -0
  509. package/packtory/published-release-state.d.ts.map +1 -1
  510. package/packtory/published-release-state.js +11 -0
  511. package/packtory/published-release-state.js.map +1 -1
  512. package/packtory/release-analysis.js +153 -5
  513. package/packtory/release-analysis.js.map +1 -1
  514. package/packtory/release-diff-failure-mapping.js +6 -0
  515. package/packtory/release-diff-failure-mapping.js.map +1 -1
  516. package/packtory/release-plan.js +135 -7
  517. package/packtory/release-plan.js.map +1 -1
  518. package/packtory/report-attachment.js +35 -2
  519. package/packtory/report-attachment.js.map +1 -1
  520. package/packtory/resolved-package.d.ts +11 -0
  521. package/packtory/resolved-package.d.ts.map +1 -1
  522. package/packtory/resolved-package.js +97 -3
  523. package/packtory/resolved-package.js.map +1 -1
  524. package/packtory/scheduler.d.ts +47 -0
  525. package/packtory/scheduler.d.ts.map +1 -1
  526. package/packtory/scheduler.js +99 -1
  527. package/packtory/scheduler.js.map +1 -1
  528. package/packtory/stages/package-analysis-stage.js +50 -2
  529. package/packtory/stages/package-analysis-stage.js.map +1 -1
  530. package/packtory/stages/package-resolution-stage.js +80 -5
  531. package/packtory/stages/package-resolution-stage.js.map +1 -1
  532. package/packtory/stages/publish-stage.js +125 -4
  533. package/packtory/stages/publish-stage.js.map +1 -1
  534. package/packtory/stages/release-diff-stage.js +84 -5
  535. package/packtory/stages/release-diff-stage.js.map +1 -1
  536. package/progress/progress-broadcaster.d.ts +1 -0
  537. package/progress/progress-broadcaster.d.ts.map +1 -1
  538. package/progress/progress-broadcaster.js +45 -0
  539. package/progress/progress-broadcaster.js.map +1 -1
  540. package/published-package/published-package.d.ts +2 -0
  541. package/published-package/published-package.d.ts.map +1 -1
  542. package/published-package/published-package.js +12 -1
  543. package/published-package/published-package.js.map +1 -1
  544. package/report/aggregator/artifact-entry-merger.js +20 -0
  545. package/report/aggregator/artifact-entry-merger.js.map +1 -1
  546. package/report/aggregator/package-report-materialization.js +75 -2
  547. package/report/aggregator/package-report-materialization.js.map +1 -1
  548. package/report/aggregator/report-aggregator.js +37 -2
  549. package/report/aggregator/report-aggregator.js.map +1 -1
  550. package/report/aggregator/report-event-handlers.js +141 -2
  551. package/report/aggregator/report-event-handlers.js.map +1 -1
  552. package/report/aggregator/report-types.d.ts +21 -0
  553. package/report/aggregator/report-types.d.ts.map +1 -1
  554. package/report/aggregator/report-types.js +3 -0
  555. package/report/aggregator/report-types.js.map +1 -1
  556. package/report/config-redactor.js +29 -3
  557. package/report/config-redactor.js.map +1 -1
  558. package/report/decorators.js +85 -0
  559. package/report/decorators.js.map +1 -1
  560. package/report/inspectors/inspect-artifact-sizes.js +34 -1
  561. package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
  562. package/report/inspectors/inspect-linker-rewrites.js +14 -1
  563. package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
  564. package/report/inspectors/inspect-package-json-provenance.js +15 -0
  565. package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
  566. package/report/inspectors/inspect-scan-results.js +15 -0
  567. package/report/inspectors/inspect-scan-results.js.map +1 -1
  568. package/report/release-diff/release-version-transition.js +18 -0
  569. package/report/release-diff/release-version-transition.js.map +1 -1
  570. package/resource-resolver/bundle-resource-lookup.js +25 -0
  571. package/resource-resolver/bundle-resource-lookup.js.map +1 -1
  572. package/resource-resolver/content.js +136 -4
  573. package/resource-resolver/content.js.map +1 -1
  574. package/resource-resolver/dependency-resolution-walker.js +73 -2
  575. package/resource-resolver/dependency-resolution-walker.js.map +1 -1
  576. package/resource-resolver/resolved-bundle.d.ts +17 -0
  577. package/resource-resolver/resolved-bundle.d.ts.map +1 -1
  578. package/resource-resolver/resolved-bundle.js +3 -0
  579. package/resource-resolver/resolved-bundle.js.map +1 -1
  580. package/resource-resolver/resource-resolve-options.d.ts +5 -0
  581. package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
  582. package/resource-resolver/resource-resolve-options.js +13 -1
  583. package/resource-resolver/resource-resolve-options.js.map +1 -1
  584. package/resource-resolver/resource-resolver.d.ts +15 -0
  585. package/resource-resolver/resource-resolver.d.ts.map +1 -0
  586. package/resource-resolver/resource-resolver.js +128 -6
  587. package/resource-resolver/resource-resolver.js.map +1 -1
  588. package/sbom/extract-license.js +11 -1
  589. package/sbom/extract-license.js.map +1 -1
  590. package/sbom/license-resolver.d.ts +14 -0
  591. package/sbom/license-resolver.d.ts.map +1 -0
  592. package/sbom/license-resolver.js +23 -2
  593. package/sbom/license-resolver.js.map +1 -1
  594. package/sbom/sbom-builder.js +57 -2
  595. package/sbom/sbom-builder.js.map +1 -1
  596. package/sbom/sbom-canonicalizer.js +45 -3
  597. package/sbom/sbom-canonicalizer.js.map +1 -1
  598. package/sbom/sbom-file.d.ts +10 -0
  599. package/sbom/sbom-file.d.ts.map +1 -1
  600. package/sbom/sbom-file.js +54 -5
  601. package/sbom/sbom-file.js.map +1 -1
  602. package/sbom/sbom-serializer.d.ts +8 -0
  603. package/sbom/sbom-serializer.d.ts.map +1 -0
  604. package/sbom/sbom-serializer.js +14 -1
  605. package/sbom/sbom-serializer.js.map +1 -1
  606. package/sbom/tool-version.js +49 -1
  607. package/sbom/tool-version.js.map +1 -1
  608. package/sbom.cdx.json +5 -5
  609. package/tar/extract-tar.js +83 -3
  610. package/tar/extract-tar.js.map +1 -1
  611. package/tar/gzipped-pack.js +20 -0
  612. package/tar/gzipped-pack.js.map +1 -1
  613. package/tar/tarball-builder.d.ts +14 -0
  614. package/tar/tarball-builder.d.ts.map +1 -0
  615. package/tar/tarball-builder.js +44 -4
  616. package/tar/tarball-builder.js.map +1 -1
  617. package/vendor-materializer/vendor-entry.d.ts +12 -0
  618. package/vendor-materializer/vendor-entry.d.ts.map +1 -0
  619. package/vendor-materializer/vendor-entry.js +20 -1
  620. package/vendor-materializer/vendor-entry.js.map +1 -1
  621. package/vendor-materializer/vendor-materializer.d.ts +55 -0
  622. package/vendor-materializer/vendor-materializer.d.ts.map +1 -0
  623. package/vendor-materializer/vendor-materializer.js +240 -8
  624. package/vendor-materializer/vendor-materializer.js.map +1 -1
  625. package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
  626. package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
  627. package/version-manager/dependencies/dependency-groups.js +11 -1
  628. package/version-manager/dependencies/dependency-groups.js.map +1 -1
  629. package/version-manager/dependencies/external-dependency-classification.js +82 -3
  630. package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
  631. package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
  632. package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
  633. package/version-manager/imports/hash-import-scanner.js +20 -2
  634. package/version-manager/imports/hash-import-scanner.js.map +1 -1
  635. package/version-manager/imports/imports-key-matcher.js +22 -0
  636. package/version-manager/imports/imports-key-matcher.js.map +1 -1
  637. package/version-manager/imports/versioned-bundle-imports.js +44 -2
  638. package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
  639. package/version-manager/manager.d.ts +5 -0
  640. package/version-manager/manager.d.ts.map +1 -1
  641. package/version-manager/manager.js +46 -6
  642. package/version-manager/manager.js.map +1 -1
  643. package/version-manager/manifest/builder.js +51 -1
  644. package/version-manager/manifest/builder.js.map +1 -1
  645. package/version-manager/manifest/serialize.js +8 -1
  646. package/version-manager/manifest/serialize.js.map +1 -1
  647. package/version-manager/optional-bundle-fields.js +5 -1
  648. package/version-manager/optional-bundle-fields.js.map +1 -1
  649. package/version-manager/representative-root.js +9 -1
  650. package/version-manager/representative-root.js.map +1 -1
  651. package/version-manager/specifier-classifier.js +42 -2
  652. package/version-manager/specifier-classifier.js.map +1 -1
  653. package/version-manager/specifier-errors.js +58 -0
  654. package/version-manager/specifier-errors.js.map +1 -1
  655. package/version-manager/versioned-bundle.d.ts +3 -1
  656. package/version-manager/versioned-bundle.d.ts.map +1 -1
  657. package/version-manager/versioned-bundle.js +31 -6
  658. package/version-manager/versioned-bundle.js.map +1 -1
  659. package/zip/zip-builder.d.ts +22 -0
  660. package/zip/zip-builder.d.ts.map +1 -0
  661. package/zip/zip-builder.js +81 -2
  662. package/zip/zip-builder.js.map +1 -1
@@ -1,5 +1,69 @@
1
- import "./analyzed-bundle.js";
2
- import "./liveness/module-analysis.js";
3
- import "./reachability/binding-id.js";
4
- import "./transform/declaration-remover.js";
1
+ import { createEmptyFileAnalysis } from "./analyzed-bundle.js";
2
+ import { buildModuleAnalysis } from "./liveness/module-analysis.js";
3
+ import { bindingId } from "./reachability/binding-id.js";
4
+ import { applyRemovalPlan } from "./transform/declaration-remover.js";
5
+ const noTransforms = [];
6
+ function allBindingNamesFor(loaded) {
7
+ const names = new Set();
8
+ for (const binding of loaded.bindings) {
9
+ names.add(binding.name);
10
+ }
11
+ return names;
12
+ }
13
+ function reachableBindingsFor(loaded, reachable) {
14
+ const { targetFilePath } = loaded.resource.fileDescription;
15
+ return new Set(loaded.bindings.flatMap(function (binding) {
16
+ return reachable.has(bindingId(targetFilePath, binding.name)) ? [binding.name] : [];
17
+ }));
18
+ }
19
+ function transformSourceFile(loaded, context, sourceFile, surviving) {
20
+ const result = applyRemovalPlan(sourceFile, {
21
+ bundleName: context.bundleName,
22
+ inputFilePath: loaded.resource.fileDescription.inputFilePath,
23
+ targetFilePath: loaded.resource.fileDescription.targetFilePath,
24
+ survivingNames: surviving,
25
+ trace: context.trace
26
+ });
27
+ return { transformedCode: sourceFile.getFullText(), atoms: result.atoms };
28
+ }
29
+ function analyzeCodeFile(loaded, context) {
30
+ const moduleAnalysis = buildModuleAnalysis({
31
+ inputFilePath: loaded.resource.fileDescription.inputFilePath,
32
+ targetFilePath: loaded.resource.fileDescription.targetFilePath,
33
+ sourceFile: loaded.sourceFile,
34
+ bindings: loaded.bindings,
35
+ deadCodeElimination: context.deadCodeElimination
36
+ });
37
+ const sideEffectStatements = moduleAnalysis.effects;
38
+ const reachableBindings = reachableBindingsFor(loaded, context.reachable);
39
+ const shouldTransform = context.transformationsEnabled;
40
+ const survivingBindings = shouldTransform ? reachableBindings : allBindingNamesFor(loaded);
41
+ return {
42
+ analysis: { survivingBindings, sideEffectStatements, sideEffectImports: new Set() },
43
+ reachableBindings,
44
+ shouldTransform
45
+ };
46
+ }
47
+ export function buildAnalyzedResource(loaded, context) {
48
+ if (loaded.sourceFile === undefined) {
49
+ return { resource: { ...loaded.resource, analysis: createEmptyFileAnalysis() }, transforms: noTransforms };
50
+ }
51
+ const { analysis, reachableBindings, shouldTransform } = analyzeCodeFile(loaded, context);
52
+ if (!shouldTransform) {
53
+ return { resource: { ...loaded.resource, analysis }, transforms: noTransforms };
54
+ }
55
+ const originalCode = loaded.resource.fileDescription.content;
56
+ const { transformedCode, atoms } = transformSourceFile(loaded, context, loaded.sourceFile, reachableBindings);
57
+ if (transformedCode === originalCode) {
58
+ return { resource: { ...loaded.resource, analysis }, transforms: noTransforms };
59
+ }
60
+ return {
61
+ resource: {
62
+ ...loaded.resource,
63
+ fileDescription: { ...loaded.resource.fileDescription, content: transformedCode },
64
+ analysis
65
+ },
66
+ transforms: [{ textTransform: { originalCode, transformedCode, atoms } }]
67
+ };
68
+ }
5
69
  //# sourceMappingURL=code-file-analyzer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-file-analyzer.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/code-file-analyzer.ts"],"names":[],"mappings":"AAEA,OAAwF,sBAAsB,CAAC;AAE/G,OAAoC,+BAA+B,CAAC;AACpE,OAA0B,8BAA8B,CAAC;AAGzD,OAAiC,oCAAoC,CAAC"}
1
+ {"version":3,"file":"code-file-analyzer.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/code-file-analyzer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAkD,MAAM,sBAAsB,CAAC;AAE/G,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAwBtE,MAAM,YAAY,GAA+B,EAAE,CAAC;AAEpD,SAAS,kBAAkB,CAAC,MAA0B;IAClD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAA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AM,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAC9G,IAAI,eAAe,KAAK,YAAY,EAAE,CAAC;QACnC,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;IACpF,CAAC;IACD,OAAO;QACH,QAAQ,EAAE;YACN,GAAG,MAAM,CAAC,QAAQ;YAClB,eAAe,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE;YACjF,QAAQ;SACX;QACD,UAAU,EAAE,CAAE,EAAE,aAAa,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,CAAE;KAC9E,CAAC;AACN,CAAC"}
@@ -1 +1,11 @@
1
+ export function indexBundles(inputs) {
2
+ const map = new Map();
3
+ for (const input of inputs) {
4
+ const bindingsByFilePath = new Map(input.fileBindings.map(function (file) {
5
+ return [file.targetFilePath, file];
6
+ }));
7
+ map.set(input.bundle.name, { bundle: input.bundle, bindingsByFilePath });
8
+ }
9
+ return map;
10
+ }
1
11
  //# sourceMappingURL=bundle-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundle-index.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/cross-bundle/bundle-index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"bundle-index.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/cross-bundle/bundle-index.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,YAAY,CACxB,MAAqG;IAErG,MAAM,GAAG,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC7C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAC9B,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,IAAI;YACjC,OAAO,CAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAE,CAAC;QACzC,CAAC,CAAC,CACL,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
@@ -1,4 +1,23 @@
1
- import "./bundle-index.js";
2
- import "./import-export-walker.js";
3
- import "./seed-store.js";
1
+ import { indexBundles } from "./bundle-index.js";
2
+ import { walkCrossBundleStatements } from "./import-export-walker.js";
3
+ import { createSeedStore } from "./seed-store.js";
4
+ export function buildCrossBundleSeeds(inputs, trace) {
5
+ const indexed = indexBundles(inputs);
6
+ let seeds = createSeedStore();
7
+ for (const input of inputs) {
8
+ for (const file of input.fileBindings) {
9
+ seeds = walkCrossBundleStatements(file.sourceFile, {
10
+ indexed,
11
+ seeds,
12
+ sourceBundleName: input.bundle.name,
13
+ inputFilePath: file.inputFilePath,
14
+ sourceTargetFilePath: file.targetFilePath,
15
+ moduleReferences: file.moduleReferences,
16
+ localReachable: input.localReachable,
17
+ trace
18
+ });
19
+ }
20
+ }
21
+ return seeds;
22
+ }
4
23
  //# sourceMappingURL=cross-bundle-seeds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cross-bundle-seeds.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/cross-bundle/cross-bundle-seeds.ts"],"names":[],"mappings":"AAGA,OAA6B,mBAAmB,CAAC;AACjD,OAA0C,2BAA2B,CAAC;AACtE,OAA8C,iBAAiB,CAAC"}
1
+ {"version":3,"file":"cross-bundle-seeds.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/cross-bundle/cross-bundle-seeds.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAgB,MAAM,iBAAiB,CAAC;AAQhE,MAAM,UAAU,qBAAqB,CAAC,MAAmC,EAAE,KAA+B;IACtG,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,KAAK,GAAG,eAAe,EAAE,CAAC;IAC9B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACpC,KAAK,GAAG,yBAAyB,CAAC,IAAI,CAAC,UAAU,EAAE;gBAC/C,OAAO;gBACP,KAAK;gBACL,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;gBACnC,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,oBAAoB,EAAE,IAAI,CAAC,cAAc;gBACzC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,cAAc,EAAE,KAAK,CAAC,cAAc;gBACpC,KAAK;aACR,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -1,4 +1,165 @@
1
- import 'ts-morph';
2
- import "../reachability/binding-id.js";
3
- import "./seed-store.js";
1
+ import { Node as TsMorphNode } from 'ts-morph';
2
+ import { bindingId } from "../reachability/binding-id.js";
3
+ import { recordSeed } from "./seed-store.js";
4
+ function localNameOfNamedImport(namedImport) {
5
+ const aliasNode = namedImport.getAliasNode();
6
+ return aliasNode === undefined ? namedImport.getName() : aliasNode.getText();
7
+ }
8
+ function isLocalBindingReachable(context, localName) {
9
+ return context.localReachable.has(bindingId(context.sourceTargetFilePath, localName));
10
+ }
11
+ function seedExists(seeds, bundleName, seed) {
12
+ return seeds.get(bundleName)?.has(seed) === true;
13
+ }
14
+ function isLinkedCodeReference(reference) {
15
+ return reference.type === 'linked-code';
16
+ }
17
+ function recordCrossBundleSeed(input) {
18
+ const { context, reason, seed, statement, target } = input;
19
+ if (!seedExists(context.seeds, target.bundleName, seed) && context.trace !== undefined) {
20
+ context.trace.collector.record({
21
+ type: 'cross-bundle-seed-added',
22
+ bundleName: target.bundleName,
23
+ bindingId: seed,
24
+ sourceBundleName: context.sourceBundleName,
25
+ inputFilePath: context.inputFilePath,
26
+ line: statement.getStartLineNumber(),
27
+ moduleSpecifier: statement.getModuleSpecifierValue() ?? context.inputFilePath,
28
+ reason
29
+ });
30
+ }
31
+ return recordSeed(context.seeds, target.bundleName, seed);
32
+ }
33
+ function seedTargetBinding(input) {
34
+ const { context, name, reason, statement, target } = input;
35
+ return recordCrossBundleSeed({
36
+ context,
37
+ target,
38
+ seed: bindingId(target.targetFilePath, name),
39
+ statement,
40
+ reason
41
+ });
42
+ }
43
+ function seedAllTargetBindings(context, target, statement, reason) {
44
+ const fileBindings = target.indexedBundle.bindingsByFilePath.get(target.targetFilePath);
45
+ if (fileBindings === undefined) {
46
+ return context.seeds;
47
+ }
48
+ const { bindings } = fileBindings;
49
+ let { seeds } = context;
50
+ for (const binding of bindings) {
51
+ seeds = seedTargetBinding({
52
+ context: { ...context, seeds },
53
+ target,
54
+ name: binding.name,
55
+ statement,
56
+ reason
57
+ });
58
+ }
59
+ return seeds;
60
+ }
61
+ function recordDefaultImportSeed(importDeclaration, target, context) {
62
+ const defaultImport = importDeclaration.getDefaultImport();
63
+ if (defaultImport === undefined) {
64
+ return context.seeds;
65
+ }
66
+ if (!isLocalBindingReachable(context, defaultImport.getText())) {
67
+ return context.seeds;
68
+ }
69
+ return seedTargetBinding({
70
+ context,
71
+ target,
72
+ name: 'default',
73
+ statement: importDeclaration,
74
+ reason: 'default-import'
75
+ });
76
+ }
77
+ function recordNamedImportSeeds(importDeclaration, target, context) {
78
+ let { seeds } = context;
79
+ for (const namedImport of importDeclaration.getNamedImports()) {
80
+ if (isLocalBindingReachable(context, localNameOfNamedImport(namedImport))) {
81
+ seeds = seedTargetBinding({
82
+ context: { ...context, seeds },
83
+ target,
84
+ name: namedImport.getName(),
85
+ statement: importDeclaration,
86
+ reason: 'named-import'
87
+ });
88
+ }
89
+ }
90
+ return seeds;
91
+ }
92
+ function linkedReferenceFor(statement, context) {
93
+ const specifier = statement.getModuleSpecifierValue();
94
+ if (specifier === undefined) {
95
+ return undefined;
96
+ }
97
+ return context.moduleReferences.filter(isLinkedCodeReference).find(function (reference) {
98
+ return reference.emittedSpecifier === specifier;
99
+ });
100
+ }
101
+ function crossBundleTarget(statement, context) {
102
+ const reference = linkedReferenceFor(statement, context);
103
+ if (reference === undefined) {
104
+ return undefined;
105
+ }
106
+ const indexedBundle = context.indexed.get(reference.packageName);
107
+ if (indexedBundle === undefined) {
108
+ return undefined;
109
+ }
110
+ if (!indexedBundle.bindingsByFilePath.has(reference.targetFilePath)) {
111
+ return undefined;
112
+ }
113
+ return { bundleName: reference.packageName, targetFilePath: reference.targetFilePath, indexedBundle };
114
+ }
115
+ function processImportDeclaration(importDeclaration, context) {
116
+ const target = crossBundleTarget(importDeclaration, context);
117
+ if (target === undefined) {
118
+ return context.seeds;
119
+ }
120
+ const namespaceImport = importDeclaration.getNamespaceImport();
121
+ if (namespaceImport !== undefined) {
122
+ if (isLocalBindingReachable(context, namespaceImport.getText())) {
123
+ return seedAllTargetBindings(context, target, importDeclaration, 'namespace-import');
124
+ }
125
+ return context.seeds;
126
+ }
127
+ const seeds = recordDefaultImportSeed(importDeclaration, target, context);
128
+ return recordNamedImportSeeds(importDeclaration, target, { ...context, seeds });
129
+ }
130
+ function recordNamedReExportSeeds(exportDeclaration, target, context) {
131
+ let nextSeeds = context.seeds;
132
+ for (const namedExport of exportDeclaration.getNamedExports()) {
133
+ nextSeeds = seedTargetBinding({
134
+ context: { ...context, seeds: nextSeeds },
135
+ target,
136
+ name: namedExport.getName(),
137
+ statement: exportDeclaration,
138
+ reason: 'named-reexport'
139
+ });
140
+ }
141
+ return nextSeeds;
142
+ }
143
+ function processExportDeclaration(exportDeclaration, context) {
144
+ const target = crossBundleTarget(exportDeclaration, context);
145
+ if (target === undefined) {
146
+ return context.seeds;
147
+ }
148
+ if (exportDeclaration.isNamespaceExport()) {
149
+ return seedAllTargetBindings(context, target, exportDeclaration, 'namespace-reexport');
150
+ }
151
+ return recordNamedReExportSeeds(exportDeclaration, target, context);
152
+ }
153
+ export function walkCrossBundleStatements(sourceFile, context) {
154
+ let { seeds } = context;
155
+ for (const statement of sourceFile.getStatements()) {
156
+ if (TsMorphNode.isImportDeclaration(statement)) {
157
+ seeds = processImportDeclaration(statement, { ...context, seeds });
158
+ }
159
+ else if (TsMorphNode.isExportDeclaration(statement)) {
160
+ seeds = processExportDeclaration(statement, { ...context, seeds });
161
+ }
162
+ }
163
+ return seeds;
164
+ }
4
165
  //# sourceMappingURL=import-export-walker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"import-export-walker.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/cross-bundle/import-export-walker.ts"],"names":[],"mappings":"AAAA,OAAqG,UAAU,CAAC;AAEhH,OAA0B,+BAA+B,CAAC;AAG1D,OAAyC,iBAAiB,CAAC"}
1
+ {"version":3,"file":"import-export-walker.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/cross-bundle/import-export-walker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,WAAW,EAAmE,MAAM,UAAU,CAAC;AAEhH,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAgB,MAAM,iBAAiB,CAAC;AAgC3D,SAAS,sBAAsB,CAAC,WAAqE;IACjG,MAAM,SAAS,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC;IAC7C,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;AACjF,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAoB,EAAE,SAAiB;IACpE,OAAO,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,oBAAoB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ACjB,CAAC"}
@@ -1 +1,11 @@
1
+ export function createSeedStore() {
2
+ return new Map();
3
+ }
4
+ export function recordSeed(seeds, bundleName, seed) {
5
+ const nextSeeds = new Map(seeds);
6
+ const existing = new Set(nextSeeds.get(bundleName));
7
+ existing.add(seed);
8
+ nextSeeds.set(bundleName, existing);
9
+ return nextSeeds;
10
+ }
1
11
  //# sourceMappingURL=seed-store.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed-store.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/cross-bundle/seed-store.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"seed-store.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/cross-bundle/seed-store.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe;IAC3B,OAAO,IAAI,GAAG,EAA+B,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,UAAkB,EAAE,IAAY;IACvE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnB,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -1,3 +1,173 @@
1
- import "../dependency-scanner/source-file-references.js";
2
- import "./liveness/runtime-code.js";
1
+ import { getModuleReferenceLiterals } from "../dependency-scanner/source-file-references.js";
2
+ import { isCodeTargetPath } from "./liveness/runtime-code.js";
3
+ function hasPackageName(reference) {
4
+ return Object.hasOwn(reference, 'packageName');
5
+ }
6
+ function isLocalDependencyReference(reference) {
7
+ return Object.hasOwn(reference, 'targetFilePath') && !hasPackageName(reference);
8
+ }
9
+ const isPackageDependencyReference = hasPackageName;
10
+ function survivingSpecifiersFor(resource, sourceFilesByPath) {
11
+ const sourceFile = sourceFilesByPath.get(resource.fileDescription.targetFilePath);
12
+ if (sourceFile === undefined) {
13
+ return new Set();
14
+ }
15
+ return new Set(getModuleReferenceLiterals(sourceFile).map(function (literal) {
16
+ return literal.getLiteralValue();
17
+ }));
18
+ }
19
+ function survivingLocalTargets(resource, sourceFilesByPath) {
20
+ const specifiers = survivingSpecifiersFor(resource, sourceFilesByPath);
21
+ return new Set(resource.moduleReferences.flatMap(function (reference) {
22
+ return isLocalDependencyReference(reference) && specifiers.has(reference.emittedSpecifier)
23
+ ? [reference.targetFilePath]
24
+ : [];
25
+ }));
26
+ }
27
+ function recomputeDirectDependencies(resource, sourceFilesByPath) {
28
+ if (!isCodeTargetPath(resource.fileDescription.targetFilePath)) {
29
+ return resource;
30
+ }
31
+ const survivingPaths = survivingLocalTargets(resource, sourceFilesByPath);
32
+ return {
33
+ ...resource,
34
+ directDependencies: new Set(Array.from(resource.directDependencies).filter(function (dependency) {
35
+ return survivingPaths.has(dependency) || dependency.endsWith('.map');
36
+ }))
37
+ };
38
+ }
39
+ function referencedPackagesByPath(contents, sourceFilesByPath) {
40
+ return new Map(contents.map(function (resource) {
41
+ const specifiers = survivingSpecifiersFor(resource, sourceFilesByPath);
42
+ const packagesByName = new Map();
43
+ const survivingReferences = resource
44
+ .moduleReferences
45
+ .filter(isPackageDependencyReference)
46
+ .filter(function (reference) {
47
+ return specifiers.has(reference.emittedSpecifier);
48
+ });
49
+ for (const reference of survivingReferences) {
50
+ const existing = packagesByName.get(reference.packageName) ?? [];
51
+ packagesByName.set(reference.packageName, new Set([...existing, reference.emittedSpecifier]));
52
+ }
53
+ return [resource.fileDescription.targetFilePath, packagesByName];
54
+ }));
55
+ }
56
+ function legacyDependencyReference(dependency, targetFilePath) {
57
+ return {
58
+ targetFilePath,
59
+ sourceSpecifier: dependency.name,
60
+ emittedSpecifier: dependency.name
61
+ };
62
+ }
63
+ function legacyDependencyReferences(dependency) {
64
+ const [targetFilePath, ...rest] = dependency.referencedFrom;
65
+ return [
66
+ legacyDependencyReference(dependency, targetFilePath),
67
+ ...rest.map(function (filePath) {
68
+ return legacyDependencyReference(dependency, filePath);
69
+ })
70
+ ];
71
+ }
72
+ function dependencyReferences(dependency) {
73
+ return dependency.references ?? legacyDependencyReferences(dependency);
74
+ }
75
+ function isSameDependencyReference(left, right) {
76
+ return left.targetFilePath === right.targetFilePath &&
77
+ left.sourceSpecifier === right.sourceSpecifier &&
78
+ left.emittedSpecifier === right.emittedSpecifier;
79
+ }
80
+ function uniqueDependencyReferences(references) {
81
+ const [firstReference, ...rest] = references;
82
+ const unique = [firstReference];
83
+ for (const reference of rest) {
84
+ const isNewReference = unique.every(function (value) {
85
+ return !isSameDependencyReference(value, reference);
86
+ });
87
+ if (isNewReference) {
88
+ unique.push(reference);
89
+ }
90
+ }
91
+ return unique;
92
+ }
93
+ function mergeDependencyTargetPaths(dependency, reference) {
94
+ const sourcePaths = new Set([...dependency.referencedFrom, reference.targetFilePath]);
95
+ sourcePaths.delete(dependency.referencedFrom[0]);
96
+ return [dependency.referencedFrom[0], ...sourcePaths];
97
+ }
98
+ function mergeDependencyReferences(dependency, reference) {
99
+ const [firstReference, ...rest] = dependencyReferences(dependency);
100
+ return uniqueDependencyReferences([firstReference, ...rest, reference]);
101
+ }
102
+ function addReference(dependencies, dependencyName, reference) {
103
+ const dependency = dependencies.get(dependencyName);
104
+ if (dependency === undefined) {
105
+ dependencies.set(dependencyName, {
106
+ name: dependencyName,
107
+ referencedFrom: [reference.targetFilePath],
108
+ references: [reference]
109
+ });
110
+ return;
111
+ }
112
+ dependencies.set(dependencyName, {
113
+ name: dependencyName,
114
+ referencedFrom: mergeDependencyTargetPaths(dependency, reference),
115
+ references: mergeDependencyReferences(dependency, reference)
116
+ });
117
+ }
118
+ function shouldPreserveDependencyReference(dependency, reference, packagesByPath, preservedReferencePaths) {
119
+ if (preservedReferencePaths.has(reference.targetFilePath)) {
120
+ return true;
121
+ }
122
+ const emittedSpecifiers = packagesByPath.get(reference.targetFilePath)?.get(dependency.name);
123
+ if (emittedSpecifiers === undefined) {
124
+ return false;
125
+ }
126
+ return dependency.references === undefined ||
127
+ emittedSpecifiers.has(reference.emittedSpecifier);
128
+ }
129
+ function recomputeDependencies(dependencies, packagesByPath, preservedReferencePaths) {
130
+ const recomputed = new Map();
131
+ for (const dependency of dependencies.values()) {
132
+ for (const reference of dependencyReferences(dependency)) {
133
+ if (shouldPreserveDependencyReference(dependency, reference, packagesByPath, preservedReferencePaths)) {
134
+ addReference(recomputed, dependency.name, reference);
135
+ }
136
+ }
137
+ }
138
+ return recomputed;
139
+ }
140
+ function declarationTargetPaths(contents) {
141
+ const paths = new Set();
142
+ for (const resource of contents) {
143
+ if (resource.fileDescription.targetFilePath.endsWith('.d.ts')) {
144
+ paths.add(resource.fileDescription.targetFilePath);
145
+ }
146
+ }
147
+ return paths;
148
+ }
149
+ function filterSubstitutedSourcePaths(substitutedInputFilePathsByPackageName, linkedBundleDependencies) {
150
+ return new Map(Array.from(substitutedInputFilePathsByPackageName).filter(function ([packageName]) {
151
+ return linkedBundleDependencies.has(packageName);
152
+ }));
153
+ }
154
+ export function indexSourceFiles(loaded) {
155
+ return new Map(loaded.fileBindings.map(function (binding) {
156
+ return [binding.targetFilePath, binding.sourceFile];
157
+ }));
158
+ }
159
+ export function recomputeDependencyMetadata(bundle, contents, sourceFileIndex) {
160
+ const recomputedContents = contents.map(function (resource) {
161
+ return recomputeDirectDependencies(resource, sourceFileIndex);
162
+ });
163
+ const packagesByPath = referencedPackagesByPath(recomputedContents, sourceFileIndex);
164
+ const preservedReferencePaths = declarationTargetPaths(recomputedContents);
165
+ const linkedBundleDependencies = recomputeDependencies(bundle.linkedBundleDependencies, packagesByPath, preservedReferencePaths);
166
+ return {
167
+ contents: recomputedContents,
168
+ externalDependencies: recomputeDependencies(bundle.externalDependencies, packagesByPath, preservedReferencePaths),
169
+ linkedBundleDependencies,
170
+ substitutedInputFilePathsByPackageName: filterSubstitutedSourcePaths(bundle.substitutedInputFilePathsByPackageName, linkedBundleDependencies)
171
+ };
172
+ }
3
173
  //# sourceMappingURL=dependency-metadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependency-metadata.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/dependency-metadata.ts"],"names":[],"mappings":"AAAA,OAA2C,iDAAiD,CAAC;AAI7F,OAAiC,4BAA4B,CAAC"}
1
+ {"version":3,"file":"dependency-metadata.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/dependency-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAI7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AA6C9D,SAAS,cAAc,CAAC,SAAkC;IACtD,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,0BAA0B,CAAC,SAAkC;IAClE,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,4BAA4B,GAAG,cAAc,CAAC;AAEpD,SAAS,sBAAsB,CAC3B,QAAgC,EAChC,iBAAmC;IAEnC,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAClF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,IAAI,GAAG,EAAU,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,GAAG,CACV,0BAA0B,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,UAAU,OAAO;QACxD,OAAO,OAAO,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC,CAAC,CACL,CAAC;AACN,CAAC;AAED,SAAS,qBAAqB,CAC1B,QAAgC,EAChC,iBAAmC;IAEnC,MAAM,UAAU,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O,2BAA2B,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IACH,MAAM,cAAc,GAAG,wBAAwB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;IACrF,MAAM,uBAAuB,GAAG,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;IAC3E,MAAM,wBAAwB,GAAG,qBAAqB,CAClD,MAAM,CAAC,wBAAwB,EAC/B,cAAc,EACd,uBAAuB,CAC1B,CAAC;IACF,OAAO;QACH,QAAQ,EAAE,kBAAkB;QAC5B,oBAAoB,EAAE,qBAAqB,CACvC,MAAM,CAAC,oBAAoB,EAC3B,cAAc,EACd,uBAAuB,CAC1B;QACD,wBAAwB;QACxB,sCAAsC,EAAE,4BAA4B,CAChE,MAAM,CAAC,sCAAsC,EAC7C,wBAAwB,CAC3B;KACJ,CAAC;AACN,CAAC"}
@@ -1 +1,53 @@
1
+ function buildFileDecisions(original, analyzed) {
2
+ const analyzedBySourcePath = new Map(analyzed.contents.map(function (entry) {
3
+ return [entry.fileDescription.inputFilePath, entry];
4
+ }));
5
+ return original.contents.map(function (entry) {
6
+ const emitted = analyzedBySourcePath.get(entry.fileDescription.inputFilePath);
7
+ const sourceBytes = Buffer.byteLength(entry.fileDescription.content);
8
+ if (emitted === undefined) {
9
+ return {
10
+ path: entry.fileDescription.inputFilePath,
11
+ decision: 'eliminated',
12
+ reason: 'not-emitted-after-analysis',
13
+ sourceBytes
14
+ };
15
+ }
16
+ const outputBytes = Buffer.byteLength(emitted.fileDescription.content);
17
+ if (entry.fileDescription.content !== emitted.fileDescription.content) {
18
+ return {
19
+ path: entry.fileDescription.inputFilePath,
20
+ decision: 'transformed',
21
+ reason: 'rewritten-after-analysis',
22
+ sourceBytes,
23
+ outputBytes
24
+ };
25
+ }
26
+ return {
27
+ path: entry.fileDescription.inputFilePath,
28
+ decision: 'kept',
29
+ reason: 'reachable',
30
+ sourceBytes
31
+ };
32
+ });
33
+ }
34
+ export function maybeEmitElimination(broadcaster, originalBundles, analyzed) {
35
+ if (!broadcaster.hasSubscribers('eliminationCompleted')) {
36
+ return;
37
+ }
38
+ broadcaster.emit('eliminationCompleted', {
39
+ perBundle: analyzed.map(function (bundle, index) {
40
+ const originalBundle = originalBundles[index];
41
+ if (originalBundle === undefined) {
42
+ throw new Error(`Original bundle missing for analyzed bundle "${bundle.name}"`);
43
+ }
44
+ return {
45
+ packageName: bundle.name,
46
+ files: buildFileDecisions(originalBundle, bundle),
47
+ droppedSymbols: [],
48
+ seeds: []
49
+ };
50
+ })
51
+ });
52
+ }
1
53
  //# sourceMappingURL=elimination-emitter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"elimination-emitter.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/elimination-emitter.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"elimination-emitter.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/elimination-emitter.ts"],"names":[],"mappings":"AAIA,SAAS,kBAAkB,CAAC,QAAsB,EAAE,QAAwB;IACxE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAChC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,KAAK;QACjC,OAAO,CAAE,KAAK,CAAC,eAAe,CAAC,aAAa,EAAE,KAAK,CAAW,CAAC;IACnE,CAAC,CAAC,CACL,CAAC;IACF,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,KAAK;QACxC,MAAM,OAAO,GAAG,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAC9E,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACrE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO;gBACH,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,aAAa;gBACzC,QAAQ,EAAE,YAAY;gBACtB,MAAM,EAAE,4BA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
1
- import "./bundle-analysis.js";
2
- import "./cross-bundle/cross-bundle-seeds.js";
3
- import "./elimination-emitter.js";
4
- import "./load-bundle.js";
1
+ import { analyzeBundleWithSeeds, crossBundleInputFrom } from "./bundle-analysis.js";
2
+ import { buildCrossBundleSeeds } from "./cross-bundle/cross-bundle-seeds.js";
3
+ import { maybeEmitElimination } from "./elimination-emitter.js";
4
+ import { loadBundle } from "./load-bundle.js";
5
+ export function createDeadCodeEliminator(dependencies) {
6
+ const { createProject, progressBroadcaster, trace } = dependencies;
7
+ return {
8
+ async eliminate(inputs) {
9
+ const loadedBundles = inputs.map(function (input) {
10
+ return loadBundle(createProject, input, trace);
11
+ });
12
+ const seedMap = buildCrossBundleSeeds(loadedBundles.map(crossBundleInputFrom), trace);
13
+ const analyzed = loadedBundles.map(function (loaded) {
14
+ return analyzeBundleWithSeeds(loaded, seedMap.get(loaded.input.bundle.name), trace);
15
+ });
16
+ maybeEmitElimination(progressBroadcaster, inputs.map(function (input) {
17
+ return input.bundle;
18
+ }), analyzed);
19
+ return analyzed;
20
+ }
21
+ };
22
+ }
5
23
  //# sourceMappingURL=eliminator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eliminator.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/eliminator.ts"],"names":[],"mappings":"AAEA,OAA6D,sBAAsB,CAAC;AACpF,OAAsC,sCAAsC,CAAC;AAC7E,OAAqC,0BAA0B,CAAC;AAChE,OAA+C,kBAAkB,CAAC"}
1
+ {"version":3,"file":"eliminator.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/eliminator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAsB,MAAM,kBAAkB,CAAC;AASlE,MAAM,UAAU,wBAAwB,CAAC,YAA4C;IACjF,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC;IACnE,OAAO;QACH,KAAK,CAAC,SAAS,CAAC,MAAM;YAClB,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,KAAK;gBAC5C,OAAO,UAAU,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;YACH,MAAM,OAAO,GAAG,qBAAqB,CAAC,aAAa,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,CAAC;YACtF,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,UAAU,MAAM;gBAC/C,OAAO,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;YACxF,CAAC,CAAC,CAAC;YACH,oBAAoB,CAChB,mBAAmB,EACnB,MAAM,CAAC,GAAG,CAAC,UAAU,KAAK;gBACtB,OAAO,KAAK,CAAC,MAAM,CAAC;YACxB,CAAC,CAAC,EACF,QAAQ,CACX,CAAC;YACF,OAAO,QAAQ,CAAC;QACpB,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -1,2 +1,17 @@
1
- import 'ts-morph';
1
+ import { Node as TsMorphNode } from 'ts-morph';
2
+ function nextUnwrappedExpression(expression) {
3
+ if (TsMorphNode.isAsExpression(expression) || TsMorphNode.isSatisfiesExpression(expression)) {
4
+ return expression.getExpression();
5
+ }
6
+ if (TsMorphNode.isParenthesizedExpression(expression) ||
7
+ TsMorphNode.isTypeAssertion(expression) ||
8
+ TsMorphNode.isNonNullExpression(expression)) {
9
+ return expression.getExpression();
10
+ }
11
+ return undefined;
12
+ }
13
+ export function unwrapExpression(expression) {
14
+ const nextExpression = nextUnwrappedExpression(expression);
15
+ return nextExpression === undefined ? expression : unwrapExpression(nextExpression);
16
+ }
2
17
  //# sourceMappingURL=expression-unwrapping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"expression-unwrapping.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/expression-unwrapping.ts"],"names":[],"mappings":"AAAA,OAAqD,UAAU,CAAC"}
1
+ {"version":3,"file":"expression-unwrapping.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/expression-unwrapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,WAAW,EAAmB,MAAM,UAAU,CAAC;AAEhE,SAAS,uBAAuB,CAAC,UAAkC;IAC/D,IAAI,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,WAAW,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1F,OAAO,UAAU,CAAC,aAAa,EAAE,CAAC;IACtC,CAAC;IACD,IACI,WAAW,CAAC,yBAAyB,CAAC,UAAU,CAAC;QACjD,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC;QACvC,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAC7C,CAAC;QACC,OAAO,UAAU,CAAC,aAAa,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAID,MAAM,UAAU,gBAAgB,CAAC,UAAkC;IAC/D,MAAM,cAAc,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;AACxF,CAAC"}