packtory 0.0.91 → 0.0.93

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 (650) hide show
  1. package/artifacts/artifacts-builder.js +4 -37
  2. package/artifacts/artifacts-builder.js.map +1 -1
  3. package/artifacts/content-collection.js +2 -59
  4. package/artifacts/content-collection.js.map +1 -1
  5. package/artifacts/folder-writer.js +2 -25
  6. package/artifacts/folder-writer.js.map +1 -1
  7. package/bundle-emitter/emitter.d.ts +0 -8
  8. package/bundle-emitter/emitter.d.ts.map +1 -1
  9. package/bundle-emitter/emitter.js +6 -106
  10. package/bundle-emitter/emitter.js.map +1 -1
  11. package/bundle-emitter/extract-package-tarball.js +2 -13
  12. package/bundle-emitter/extract-package-tarball.js.map +1 -1
  13. package/bundle-emitter/fetch-published-artifacts.js +2 -16
  14. package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
  15. package/bundle-emitter/publication-outcome.d.ts +0 -3
  16. package/bundle-emitter/publication-outcome.d.ts.map +1 -1
  17. package/bundle-emitter/publication-outcome.js +0 -5
  18. package/bundle-emitter/publication-outcome.js.map +1 -1
  19. package/bundle-emitter/publish-error/auto-mode-error-matching.js +2 -28
  20. package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
  21. package/bundle-emitter/publish-error/error-shape-helpers.js +0 -9
  22. package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
  23. package/bundle-emitter/publish-error/file-mode-error-matching.js +2 -33
  24. package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
  25. package/bundle-emitter/publish-error/publish-error-messages.js +0 -24
  26. package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
  27. package/bundle-emitter/registry/metadata-auth-retry.js +1 -24
  28. package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
  29. package/bundle-emitter/registry/oidc-token-exchange.js +3 -68
  30. package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
  31. package/bundle-emitter/registry/package-metadata-fetcher.d.ts +0 -13
  32. package/bundle-emitter/registry/package-metadata-fetcher.d.ts.map +1 -1
  33. package/bundle-emitter/registry/package-metadata-fetcher.js +7 -186
  34. package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
  35. package/bundle-emitter/registry/publish-settings-bridge.js +3 -34
  36. package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
  37. package/bundle-emitter/registry/registry-auth-config.js +0 -106
  38. package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
  39. package/bundle-emitter/registry/registry-client.d.ts +1 -13
  40. package/bundle-emitter/registry/registry-client.d.ts.map +1 -1
  41. package/bundle-emitter/registry/registry-client.js +4 -71
  42. package/bundle-emitter/registry/registry-client.js.map +1 -1
  43. package/bundle-emitter/registry/registry-package-path.js +0 -3
  44. package/bundle-emitter/registry/registry-package-path.js.map +1 -1
  45. package/bundle-emitter/registry/registry-response-schemas.js +2 -50
  46. package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
  47. package/bundle-emitter/registry/tarball-integrity.d.ts +0 -1
  48. package/bundle-emitter/registry/tarball-integrity.d.ts.map +1 -1
  49. package/bundle-emitter/registry/tarball-integrity.js +1 -31
  50. package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
  51. package/bundle-emitter/registry/validate-tarball-host.js +1 -26
  52. package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
  53. package/bundle-emitter/release-artifact-canonicalizer.js +5 -31
  54. package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
  55. package/checks/check-runner.js +0 -8
  56. package/checks/check-runner.js.map +1 -1
  57. package/checks/rule.js +2 -12
  58. package/checks/rule.js.map +1 -1
  59. package/checks/rules/duplicate-detection.js +1 -23
  60. package/checks/rules/duplicate-detection.js.map +1 -1
  61. package/checks/rules/duplicate-messages.js +0 -22
  62. package/checks/rules/duplicate-messages.js.map +1 -1
  63. package/checks/rules/file-ownership.js +0 -15
  64. package/checks/rules/file-ownership.js.map +1 -1
  65. package/checks/rules/max-bundle-size.js +1 -55
  66. package/checks/rules/max-bundle-size.js.map +1 -1
  67. package/checks/rules/no-dev-dependency-imports.js +1 -51
  68. package/checks/rules/no-dev-dependency-imports.js.map +1 -1
  69. package/checks/rules/no-duplicated-files.js +3 -53
  70. package/checks/rules/no-duplicated-files.js.map +1 -1
  71. package/checks/rules/no-side-effects.js +1 -50
  72. package/checks/rules/no-side-effects.js.map +1 -1
  73. package/checks/rules/no-unexposed-executables.js +2 -43
  74. package/checks/rules/no-unexposed-executables.js.map +1 -1
  75. package/checks/rules/no-unused-bundle-dependencies.js +2 -30
  76. package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
  77. package/checks/rules/registry.js +9 -22
  78. package/checks/rules/registry.js.map +1 -1
  79. package/checks/rules/required-files.js +3 -41
  80. package/checks/rules/required-files.js.map +1 -1
  81. package/checks/rules/type-script-declaration-integrity.js +3 -81
  82. package/checks/rules/type-script-declaration-integrity.js.map +1 -1
  83. package/checks/rules/type-script-declaration-paths.js +1 -55
  84. package/checks/rules/type-script-declaration-paths.js.map +1 -1
  85. package/checks/rules/type-script-declaration-project.js +3 -202
  86. package/checks/rules/type-script-declaration-project.js.map +1 -1
  87. package/checks/rules/type-script-declaration-reachability.js +2 -38
  88. package/checks/rules/type-script-declaration-reachability.js.map +1 -1
  89. package/checks/rules/type-script-declaration-roots.js +0 -29
  90. package/checks/rules/type-script-declaration-roots.js.map +1 -1
  91. package/checks/rules/type-script-integrity.js +2 -72
  92. package/checks/rules/type-script-integrity.js.map +1 -1
  93. package/checks/rules/type-script-package-resolution.js +1 -42
  94. package/checks/rules/type-script-package-resolution.js.map +1 -1
  95. package/checks/rules/type-script-resolution-summary.js +0 -53
  96. package/checks/rules/type-script-resolution-summary.js.map +1 -1
  97. package/checks/rules/unique-target-paths.js +2 -34
  98. package/checks/rules/unique-target-paths.js.map +1 -1
  99. package/common/bundled-dependency-groups.js +0 -27
  100. package/common/bundled-dependency-groups.js.map +1 -1
  101. package/common/code-files.js +0 -28
  102. package/common/code-files.js.map +1 -1
  103. package/common/declaration-companion-paths.js +0 -24
  104. package/common/declaration-companion-paths.js.map +1 -1
  105. package/common/package-name-map.js +0 -7
  106. package/common/package-name-map.js.map +1 -1
  107. package/common/stable-json.js +2 -42
  108. package/common/stable-json.js.map +1 -1
  109. package/common/worklist.js +0 -22
  110. package/common/worklist.js.map +1 -1
  111. package/config/additional-files.js +2 -6
  112. package/config/additional-files.js.map +1 -1
  113. package/config/additional-package-json-attributes-schema.js +2 -6
  114. package/config/additional-package-json-attributes-schema.js.map +1 -1
  115. package/config/automatic-versioning-settings.js +2 -6
  116. package/config/automatic-versioning-settings.js.map +1 -1
  117. package/config/changelog-settings.d.ts +0 -44
  118. package/config/changelog-settings.d.ts.map +1 -1
  119. package/config/changelog-settings.js +3 -120
  120. package/config/changelog-settings.js.map +1 -1
  121. package/config/common-package-settings-schemas.js +3 -19
  122. package/config/common-package-settings-schemas.js.map +1 -1
  123. package/config/config.d.ts +1 -6
  124. package/config/config.d.ts.map +1 -1
  125. package/config/config.js +1 -3
  126. package/config/config.js.map +1 -1
  127. package/config/cross-package-validation.js +0 -17
  128. package/config/cross-package-validation.js.map +1 -1
  129. package/config/dead-code-elimination-settings.d.ts +0 -1
  130. package/config/dead-code-elimination-settings.d.ts.map +1 -1
  131. package/config/dead-code-elimination-settings.js +2 -36
  132. package/config/dead-code-elimination-settings.js.map +1 -1
  133. package/config/dependency-existence-validation.js +1 -19
  134. package/config/dependency-existence-validation.js.map +1 -1
  135. package/config/dependency-policy.js +2 -5
  136. package/config/dependency-policy.js.map +1 -1
  137. package/config/main-package-json-schema.js +2 -13
  138. package/config/main-package-json-schema.js.map +1 -1
  139. package/config/manual-versioning-settings.d.ts +0 -12
  140. package/config/manual-versioning-settings.d.ts.map +1 -1
  141. package/config/manual-versioning-settings.js +2 -29
  142. package/config/manual-versioning-settings.js.map +1 -1
  143. package/config/optional-package-settings-schema.js +7 -16
  144. package/config/optional-package-settings-schema.js.map +1 -1
  145. package/config/package-config.d.ts +0 -4
  146. package/config/package-config.d.ts.map +1 -1
  147. package/config/package-config.js +1 -2
  148. package/config/package-config.js.map +1 -1
  149. package/config/package-graph-builder.js +2 -14
  150. package/config/package-graph-builder.js.map +1 -1
  151. package/config/package-interface.js +2 -25
  152. package/config/package-interface.js.map +1 -1
  153. package/config/package-json.d.ts +0 -2
  154. package/config/package-json.d.ts.map +1 -1
  155. package/config/package-json.js +0 -16
  156. package/config/package-json.js.map +1 -1
  157. package/config/packtory-config-without-registry-schema.js +0 -6
  158. package/config/packtory-config-without-registry-schema.js.map +1 -1
  159. package/config/per-package-settings-schema.js +6 -22
  160. package/config/per-package-settings-schema.js.map +1 -1
  161. package/config/pre-graph-validation.js +5 -20
  162. package/config/pre-graph-validation.js.map +1 -1
  163. package/config/publish-settings.d.ts +0 -3
  164. package/config/publish-settings.d.ts.map +1 -1
  165. package/config/publish-settings.js +3 -25
  166. package/config/publish-settings.js.map +1 -1
  167. package/config/publish-settings.report.js +1 -17
  168. package/config/publish-settings.report.js.map +1 -1
  169. package/config/registry-settings.d.ts +0 -41
  170. package/config/registry-settings.d.ts.map +1 -1
  171. package/config/registry-settings.js +2 -40
  172. package/config/registry-settings.js.map +1 -1
  173. package/config/registry-settings.report.js +0 -46
  174. package/config/registry-settings.report.js.map +1 -1
  175. package/config/root-config-validation.js +0 -141
  176. package/config/root-config-validation.js.map +1 -1
  177. package/config/root.js +2 -6
  178. package/config/root.js.map +1 -1
  179. package/config/sbom-settings.js +1 -4
  180. package/config/sbom-settings.js.map +1 -1
  181. package/config/settings-validation.js +0 -28
  182. package/config/settings-validation.js.map +1 -1
  183. package/config/versioning-settings.d.ts +1 -18
  184. package/config/versioning-settings.d.ts.map +1 -1
  185. package/config/versioning-settings.js +3 -10
  186. package/config/versioning-settings.js.map +1 -1
  187. package/dead-code-eliminator/analyzed-bundle.d.ts +0 -11
  188. package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
  189. package/dead-code-eliminator/analyzed-bundle.js +0 -7
  190. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  191. package/dead-code-eliminator/class-purity.js +2 -48
  192. package/dead-code-eliminator/class-purity.js.map +1 -1
  193. package/dead-code-eliminator/code-file-analyzer.js +4 -62
  194. package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
  195. package/dead-code-eliminator/cross-bundle/bundle-index.js +1 -27
  196. package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
  197. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +3 -18
  198. package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
  199. package/dead-code-eliminator/cross-bundle/import-export-walker.js +4 -75
  200. package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
  201. package/dead-code-eliminator/cross-bundle/seed-store.js +1 -22
  202. package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
  203. package/dead-code-eliminator/dependency-metadata.js +3 -205
  204. package/dead-code-eliminator/dependency-metadata.js.map +1 -1
  205. package/dead-code-eliminator/elimination-emitter.js +0 -52
  206. package/dead-code-eliminator/elimination-emitter.js.map +1 -1
  207. package/dead-code-eliminator/eliminator.js +8 -64
  208. package/dead-code-eliminator/eliminator.js.map +1 -1
  209. package/dead-code-eliminator/expression-unwrapping.js +1 -16
  210. package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
  211. package/dead-code-eliminator/imported-expression-origin.js +2 -101
  212. package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
  213. package/dead-code-eliminator/liveness/asset-side-effects.js +1 -9
  214. package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
  215. package/dead-code-eliminator/liveness/boolean-facts.js +2 -98
  216. package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
  217. package/dead-code-eliminator/liveness/external-module-resolution.js +2 -172
  218. package/dead-code-eliminator/liveness/external-module-resolution.js.map +1 -1
  219. package/dead-code-eliminator/liveness/external-purity-summary.js +3 -294
  220. package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
  221. package/dead-code-eliminator/liveness/external-purity.js +3 -39
  222. package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
  223. package/dead-code-eliminator/liveness/module-analysis.js +2 -27
  224. package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
  225. package/dead-code-eliminator/liveness/resource-retention.js +1 -78
  226. package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
  227. package/dead-code-eliminator/liveness/runtime-code.js +1 -15
  228. package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
  229. package/dead-code-eliminator/load-bundle.js +5 -70
  230. package/dead-code-eliminator/load-bundle.js.map +1 -1
  231. package/dead-code-eliminator/pure-expression.js +5 -178
  232. package/dead-code-eliminator/pure-expression.js.map +1 -1
  233. package/dead-code-eliminator/reachability/bfs-closure.js +0 -50
  234. package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
  235. package/dead-code-eliminator/reachability/binding-extractor.js +2 -100
  236. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  237. package/dead-code-eliminator/reachability/binding-id.js +1 -32
  238. package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
  239. package/dead-code-eliminator/reachability/identifier-target-collector.js +2 -39
  240. package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
  241. package/dead-code-eliminator/reachability/impure-statements.js +2 -11
  242. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  243. package/dead-code-eliminator/reachability/local-seed-gathering.js +4 -43
  244. package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
  245. package/dead-code-eliminator/reachability/reachability.js +4 -38
  246. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  247. package/dead-code-eliminator/side-effect-classifier.js +4 -39
  248. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  249. package/dead-code-eliminator/side-effects-field.js +1 -23
  250. package/dead-code-eliminator/side-effects-field.js.map +1 -1
  251. package/dead-code-eliminator/source-map-recomposition.js +2 -29
  252. package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
  253. package/dead-code-eliminator/statement-classifiers.js +4 -94
  254. package/dead-code-eliminator/statement-classifiers.js.map +1 -1
  255. package/dead-code-eliminator/syntax-kind-sets.js +0 -16
  256. package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
  257. package/dead-code-eliminator/transform/atom-translator.d.ts +0 -8
  258. package/dead-code-eliminator/transform/atom-translator.d.ts.map +1 -1
  259. package/dead-code-eliminator/transform/atom-translator.js +2 -57
  260. package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
  261. package/dead-code-eliminator/transform/declaration-removal.js +4 -135
  262. package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
  263. package/dead-code-eliminator/transform/declaration-remover.js +2 -17
  264. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  265. package/dead-code-eliminator/transform/line-index.d.ts +0 -7
  266. package/dead-code-eliminator/transform/line-index.d.ts.map +1 -1
  267. package/dead-code-eliminator/transform/line-index.js +0 -20
  268. package/dead-code-eliminator/transform/line-index.js.map +1 -1
  269. package/dead-code-eliminator/transform/named-declaration-kinds.js +0 -3
  270. package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
  271. package/dead-code-eliminator/transform/source-map-composer.js +3 -84
  272. package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
  273. package/dead-code-eliminator/variable-declaration-bindings.js +1 -25
  274. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
  275. package/dependency-scanner/dependency-graph.js +3 -74
  276. package/dependency-scanner/dependency-graph.js.map +1 -1
  277. package/dependency-scanner/external-dependencies.d.ts +0 -9
  278. package/dependency-scanner/external-dependencies.d.ts.map +1 -1
  279. package/dependency-scanner/external-dependencies.js +1 -55
  280. package/dependency-scanner/external-dependencies.js.map +1 -1
  281. package/dependency-scanner/file-host-predicates.js +0 -9
  282. package/dependency-scanner/file-host-predicates.js.map +1 -1
  283. package/dependency-scanner/host-method-binding.js +0 -18
  284. package/dependency-scanner/host-method-binding.js.map +1 -1
  285. package/dependency-scanner/injected-dynamic-imports.js +1 -232
  286. package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
  287. package/dependency-scanner/node-modules-manifest-synthesizer.js +4 -52
  288. package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
  289. package/dependency-scanner/package-owned-asset-file-path.js +1 -9
  290. package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
  291. package/dependency-scanner/scanner.js +4 -102
  292. package/dependency-scanner/scanner.js.map +1 -1
  293. package/dependency-scanner/source-file-references.js +6 -174
  294. package/dependency-scanner/source-file-references.js.map +1 -1
  295. package/dependency-scanner/source-map-file-locator.js +2 -66
  296. package/dependency-scanner/source-map-file-locator.js.map +1 -1
  297. package/dependency-scanner/typescript-compiler-options.js +1 -21
  298. package/dependency-scanner/typescript-compiler-options.js.map +1 -1
  299. package/dependency-scanner/typescript-file-host.js +5 -49
  300. package/dependency-scanner/typescript-file-host.js.map +1 -1
  301. package/dependency-scanner/typescript-project-analyzer.js +3 -35
  302. package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
  303. package/dependency-scanner/virtual-package-json-host.js +4 -45
  304. package/dependency-scanner/virtual-package-json-host.js.map +1 -1
  305. package/directed-graph/graph.d.ts +0 -1
  306. package/directed-graph/graph.d.ts.map +1 -1
  307. package/directed-graph/graph.js +1 -240
  308. package/directed-graph/graph.js.map +1 -1
  309. package/file-manager/compare.js +2 -23
  310. package/file-manager/compare.js.map +1 -1
  311. package/file-manager/equal.js +0 -5
  312. package/file-manager/equal.js.map +1 -1
  313. package/file-manager/file-description.d.ts +0 -1
  314. package/file-manager/file-description.d.ts.map +1 -1
  315. package/file-manager/file-description.js +0 -3
  316. package/file-manager/file-description.js.map +1 -1
  317. package/file-manager/permissions.js +1 -28
  318. package/file-manager/permissions.js.map +1 -1
  319. package/git/current-git-head.js +0 -24
  320. package/git/current-git-head.js.map +1 -1
  321. package/git/git-command.js +1 -49
  322. package/git/git-command.js.map +1 -1
  323. package/linker/linked-bundle.d.ts +0 -8
  324. package/linker/linked-bundle.d.ts.map +1 -1
  325. package/linker/linked-bundle.js +0 -5
  326. package/linker/linked-bundle.js.map +1 -1
  327. package/linker/linker.js +5 -51
  328. package/linker/linker.js.map +1 -1
  329. package/linker/replacement-lookup.js +8 -295
  330. package/linker/replacement-lookup.js.map +1 -1
  331. package/linker/resource-graph.js +2 -44
  332. package/linker/resource-graph.js.map +1 -1
  333. package/linker/source-modifier/import-paths.js +3 -76
  334. package/linker/source-modifier/import-paths.js.map +1 -1
  335. package/linker/substitute-bundles.js +3 -140
  336. package/linker/substitute-bundles.js.map +1 -1
  337. package/linker/substituted-resource-graph.js +2 -99
  338. package/linker/substituted-resource-graph.js.map +1 -1
  339. package/npm-oidc-id-token-resolver.js +0 -82
  340. package/npm-oidc-id-token-resolver.js.map +1 -1
  341. package/pack-emitter/pack-emitter.d.ts +0 -20
  342. package/pack-emitter/pack-emitter.d.ts.map +1 -1
  343. package/pack-emitter/pack-emitter.js +0 -27
  344. package/pack-emitter/pack-emitter.js.map +1 -1
  345. package/package-surface/bin-field.js +2 -8
  346. package/package-surface/bin-field.js.map +1 -1
  347. package/package-surface/explicit-bin.js +2 -24
  348. package/package-surface/explicit-bin.js.map +1 -1
  349. package/package-surface/explicit-exports.js +3 -26
  350. package/package-surface/explicit-exports.js.map +1 -1
  351. package/package-surface/export-map.js +2 -9
  352. package/package-surface/export-map.js.map +1 -1
  353. package/package-surface/implicit-bin.js +1 -25
  354. package/package-surface/implicit-bin.js.map +1 -1
  355. package/package-surface/implicit-exports.js +3 -10
  356. package/package-surface/implicit-exports.js.map +1 -1
  357. package/package-surface/implicit-root-exports.js +2 -13
  358. package/package-surface/implicit-root-exports.js.map +1 -1
  359. package/package-surface/package-json-export.js +0 -9
  360. package/package-surface/package-json-export.js.map +1 -1
  361. package/package-surface/package-shape.js +1 -10
  362. package/package-surface/package-shape.js.map +1 -1
  363. package/package-surface/package-surface-index.js +3 -165
  364. package/package-surface/package-surface-index.js.map +1 -1
  365. package/package-surface/public-module-usage.js +3 -46
  366. package/package-surface/public-module-usage.js.map +1 -1
  367. package/package-surface/public-specifiers.js +1 -7
  368. package/package-surface/public-specifiers.js.map +1 -1
  369. package/package-surface/root-registry.js +0 -26
  370. package/package-surface/root-registry.js.map +1 -1
  371. package/package-surface/specifier-syntax.js +0 -4
  372. package/package-surface/specifier-syntax.js.map +1 -1
  373. package/package-surface/substitution-exports.js +3 -101
  374. package/package-surface/substitution-exports.js.map +1 -1
  375. package/package-surface/surface.d.ts +0 -2
  376. package/package-surface/surface.d.ts.map +1 -1
  377. package/package-surface/surface.js +0 -12
  378. package/package-surface/surface.js.map +1 -1
  379. package/package.json +2 -2
  380. package/packages/package-processor.composition.d.ts +0 -22
  381. package/packages/package-processor.composition.d.ts.map +1 -1
  382. package/packages/package-processor.composition.js +34 -160
  383. package/packages/package-processor.composition.js.map +1 -1
  384. package/packtory/map-config.d.ts +3 -22
  385. package/packtory/map-config.d.ts.map +1 -1
  386. package/packtory/map-config.js +4 -35
  387. package/packtory/map-config.js.map +1 -1
  388. package/packtory/normalize-paths.js +1 -25
  389. package/packtory/normalize-paths.js.map +1 -1
  390. package/packtory/options/bundle-dependency-resolution.js +1 -17
  391. package/packtory/options/bundle-dependency-resolution.js.map +1 -1
  392. package/packtory/options/dead-code-elimination-resolution.js +1 -10
  393. package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
  394. package/packtory/options/prepare-package-options.d.ts +0 -14
  395. package/packtory/options/prepare-package-options.d.ts.map +1 -1
  396. package/packtory/options/prepare-package-options.js +5 -46
  397. package/packtory/options/prepare-package-options.js.map +1 -1
  398. package/packtory/options/required-value-helpers.js +0 -17
  399. package/packtory/options/required-value-helpers.js.map +1 -1
  400. package/packtory/options/setting-resolvers.d.ts +0 -18
  401. package/packtory/options/setting-resolvers.d.ts.map +1 -1
  402. package/packtory/options/setting-resolvers.js +3 -47
  403. package/packtory/options/setting-resolvers.js.map +1 -1
  404. package/packtory/options/surface-resolution.js +2 -15
  405. package/packtory/options/surface-resolution.js.map +1 -1
  406. package/packtory/options/version-provider-context.js +2 -24
  407. package/packtory/options/version-provider-context.js.map +1 -1
  408. package/packtory/options/version-trigger.js +2 -39
  409. package/packtory/options/version-trigger.js.map +1 -1
  410. package/packtory/pack-output-preflight.js +3 -60
  411. package/packtory/pack-output-preflight.js.map +1 -1
  412. package/packtory/package-processor-build.js +3 -97
  413. package/packtory/package-processor-build.js.map +1 -1
  414. package/packtory/package-processor-publish.d.ts +0 -13
  415. package/packtory/package-processor-publish.d.ts.map +1 -1
  416. package/packtory/package-processor-publish.js +5 -293
  417. package/packtory/package-processor-publish.js.map +1 -1
  418. package/packtory/package-processor.d.ts +1 -34
  419. package/packtory/package-processor.d.ts.map +1 -1
  420. package/packtory/package-processor.js +2 -10
  421. package/packtory/package-processor.js.map +1 -1
  422. package/packtory/packtory-pack.js +10 -298
  423. package/packtory/packtory-pack.js.map +1 -1
  424. package/packtory/packtory-package-dependencies.js +7 -135
  425. package/packtory/packtory-package-dependencies.js.map +1 -1
  426. package/packtory/packtory-package-tree.js +4 -43
  427. package/packtory/packtory-package-tree.js.map +1 -1
  428. package/packtory/packtory-publish.js +4 -17
  429. package/packtory/packtory-publish.js.map +1 -1
  430. package/packtory/packtory-release-analysis.js +6 -64
  431. package/packtory/packtory-release-analysis.js.map +1 -1
  432. package/packtory/packtory-release-diff.js +5 -48
  433. package/packtory/packtory-release-diff.js.map +1 -1
  434. package/packtory/packtory-release-plan.js +6 -87
  435. package/packtory/packtory-release-plan.js.map +1 -1
  436. package/packtory/packtory-resolve.js +5 -16
  437. package/packtory/packtory-resolve.js.map +1 -1
  438. package/packtory/packtory.d.ts +1 -28
  439. package/packtory/packtory.d.ts.map +1 -1
  440. package/packtory/packtory.js +12 -225
  441. package/packtory/packtory.js.map +1 -1
  442. package/packtory/publish-failure-mapping.js +0 -6
  443. package/packtory/publish-failure-mapping.js.map +1 -1
  444. package/packtory/published-release-state.d.ts +0 -19
  445. package/packtory/published-release-state.d.ts.map +1 -1
  446. package/packtory/published-release-state.js +0 -11
  447. package/packtory/published-release-state.js.map +1 -1
  448. package/packtory/release-analysis.js +5 -153
  449. package/packtory/release-analysis.js.map +1 -1
  450. package/packtory/release-diff-failure-mapping.js +0 -6
  451. package/packtory/release-diff-failure-mapping.js.map +1 -1
  452. package/packtory/release-plan.js +7 -135
  453. package/packtory/release-plan.js.map +1 -1
  454. package/packtory/report-attachment.js +2 -35
  455. package/packtory/report-attachment.js.map +1 -1
  456. package/packtory/resolved-package.d.ts +0 -11
  457. package/packtory/resolved-package.d.ts.map +1 -1
  458. package/packtory/resolved-package.js +3 -97
  459. package/packtory/resolved-package.js.map +1 -1
  460. package/packtory/scheduler.d.ts +0 -47
  461. package/packtory/scheduler.d.ts.map +1 -1
  462. package/packtory/scheduler.js +1 -99
  463. package/packtory/scheduler.js.map +1 -1
  464. package/packtory/stages/package-analysis-stage.js +2 -50
  465. package/packtory/stages/package-analysis-stage.js.map +1 -1
  466. package/packtory/stages/package-resolution-stage.js +5 -80
  467. package/packtory/stages/package-resolution-stage.js.map +1 -1
  468. package/packtory/stages/publish-stage.js +3 -54
  469. package/packtory/stages/publish-stage.js.map +1 -1
  470. package/packtory/stages/release-diff-stage.js +5 -84
  471. package/packtory/stages/release-diff-stage.js.map +1 -1
  472. package/progress/progress-broadcaster.d.ts +0 -1
  473. package/progress/progress-broadcaster.d.ts.map +1 -1
  474. package/progress/progress-broadcaster.js +0 -45
  475. package/progress/progress-broadcaster.js.map +1 -1
  476. package/published-package/published-package.d.ts +0 -2
  477. package/published-package/published-package.d.ts.map +1 -1
  478. package/published-package/published-package.js +1 -12
  479. package/published-package/published-package.js.map +1 -1
  480. package/report/aggregator/artifact-entry-merger.js +0 -20
  481. package/report/aggregator/artifact-entry-merger.js.map +1 -1
  482. package/report/aggregator/package-report-materialization.js +2 -75
  483. package/report/aggregator/package-report-materialization.js.map +1 -1
  484. package/report/aggregator/report-aggregator.js +2 -37
  485. package/report/aggregator/report-aggregator.js.map +1 -1
  486. package/report/aggregator/report-event-handlers.js +2 -141
  487. package/report/aggregator/report-event-handlers.js.map +1 -1
  488. package/report/aggregator/report-types.d.ts +0 -21
  489. package/report/aggregator/report-types.d.ts.map +1 -1
  490. package/report/aggregator/report-types.js +0 -3
  491. package/report/aggregator/report-types.js.map +1 -1
  492. package/report/config-redactor.js +3 -29
  493. package/report/config-redactor.js.map +1 -1
  494. package/report/decorators.js +0 -76
  495. package/report/decorators.js.map +1 -1
  496. package/report/inspectors/inspect-artifact-sizes.js +1 -34
  497. package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
  498. package/report/inspectors/inspect-linker-rewrites.js +1 -14
  499. package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
  500. package/report/inspectors/inspect-package-json-provenance.js +0 -15
  501. package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
  502. package/report/inspectors/inspect-scan-results.js +0 -15
  503. package/report/inspectors/inspect-scan-results.js.map +1 -1
  504. package/report/release-diff/release-version-transition.js +0 -18
  505. package/report/release-diff/release-version-transition.js.map +1 -1
  506. package/resource-resolver/bundle-resource-lookup.js +0 -25
  507. package/resource-resolver/bundle-resource-lookup.js.map +1 -1
  508. package/resource-resolver/content.js +3 -81
  509. package/resource-resolver/content.js.map +1 -1
  510. package/resource-resolver/dependency-resolution-walker.js +2 -73
  511. package/resource-resolver/dependency-resolution-walker.js.map +1 -1
  512. package/resource-resolver/resolved-bundle.d.ts +0 -17
  513. package/resource-resolver/resolved-bundle.d.ts.map +1 -1
  514. package/resource-resolver/resolved-bundle.js +0 -3
  515. package/resource-resolver/resolved-bundle.js.map +1 -1
  516. package/resource-resolver/resource-resolve-options.d.ts +0 -5
  517. package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
  518. package/resource-resolver/resource-resolve-options.js +1 -13
  519. package/resource-resolver/resource-resolve-options.js.map +1 -1
  520. package/resource-resolver/resource-resolver.js +5 -83
  521. package/resource-resolver/resource-resolver.js.map +1 -1
  522. package/sbom/extract-license.js +1 -11
  523. package/sbom/extract-license.js.map +1 -1
  524. package/sbom/license-resolver.js +2 -23
  525. package/sbom/license-resolver.js.map +1 -1
  526. package/sbom/sbom-builder.js +2 -57
  527. package/sbom/sbom-builder.js.map +1 -1
  528. package/sbom/sbom-canonicalizer.js +3 -45
  529. package/sbom/sbom-canonicalizer.js.map +1 -1
  530. package/sbom/sbom-file.d.ts +0 -10
  531. package/sbom/sbom-file.d.ts.map +1 -1
  532. package/sbom/sbom-file.js +5 -54
  533. package/sbom/sbom-file.js.map +1 -1
  534. package/sbom/sbom-serializer.js +1 -14
  535. package/sbom/sbom-serializer.js.map +1 -1
  536. package/sbom/tool-version.js +1 -49
  537. package/sbom/tool-version.js.map +1 -1
  538. package/sbom.cdx.json +10 -10
  539. package/tar/extract-tar.js +3 -83
  540. package/tar/extract-tar.js.map +1 -1
  541. package/tar/gzipped-pack.js +0 -20
  542. package/tar/gzipped-pack.js.map +1 -1
  543. package/tar/tarball-builder.js +4 -44
  544. package/tar/tarball-builder.js.map +1 -1
  545. package/vendor-materializer/vendor-entry.js +1 -20
  546. package/vendor-materializer/vendor-entry.js.map +1 -1
  547. package/vendor-materializer/vendor-materializer.js +8 -240
  548. package/vendor-materializer/vendor-materializer.js.map +1 -1
  549. package/version-manager/dependencies/bundle-dependency-grouping.js +2 -32
  550. package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
  551. package/version-manager/dependencies/dependency-groups.js +1 -11
  552. package/version-manager/dependencies/dependency-groups.js.map +1 -1
  553. package/version-manager/dependencies/external-dependency-classification.js +3 -82
  554. package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
  555. package/version-manager/dependencies/versioned-bundle-dependencies.js +3 -8
  556. package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
  557. package/version-manager/imports/hash-import-scanner.js +2 -20
  558. package/version-manager/imports/hash-import-scanner.js.map +1 -1
  559. package/version-manager/imports/imports-key-matcher.js +0 -22
  560. package/version-manager/imports/imports-key-matcher.js.map +1 -1
  561. package/version-manager/imports/versioned-bundle-imports.js +2 -44
  562. package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
  563. package/version-manager/manager.d.ts +0 -5
  564. package/version-manager/manager.d.ts.map +1 -1
  565. package/version-manager/manager.js +6 -46
  566. package/version-manager/manager.js.map +1 -1
  567. package/version-manager/manifest/builder.js +1 -51
  568. package/version-manager/manifest/builder.js.map +1 -1
  569. package/version-manager/manifest/serialize.js +1 -8
  570. package/version-manager/manifest/serialize.js.map +1 -1
  571. package/version-manager/optional-bundle-fields.js +1 -5
  572. package/version-manager/optional-bundle-fields.js.map +1 -1
  573. package/version-manager/representative-root.js +1 -9
  574. package/version-manager/representative-root.js.map +1 -1
  575. package/version-manager/specifier-classifier.js +2 -42
  576. package/version-manager/specifier-classifier.js.map +1 -1
  577. package/version-manager/specifier-errors.js +0 -58
  578. package/version-manager/specifier-errors.js.map +1 -1
  579. package/version-manager/versioned-bundle.d.ts +1 -3
  580. package/version-manager/versioned-bundle.d.ts.map +1 -1
  581. package/version-manager/versioned-bundle.js +6 -31
  582. package/version-manager/versioned-bundle.js.map +1 -1
  583. package/zip/zip-builder.js +2 -81
  584. package/zip/zip-builder.js.map +1 -1
  585. package/artifacts/artifacts-builder.d.ts +0 -28
  586. package/artifacts/artifacts-builder.d.ts.map +0 -1
  587. package/bundle-emitter/registry/registry-auth-config.d.ts +0 -17
  588. package/bundle-emitter/registry/registry-auth-config.d.ts.map +0 -1
  589. package/checks/check-runner.d.ts +0 -18
  590. package/checks/check-runner.d.ts.map +0 -1
  591. package/checks/rule.d.ts +0 -42
  592. package/checks/rule.d.ts.map +0 -1
  593. package/checks/rules/max-bundle-size.d.ts +0 -13
  594. package/checks/rules/max-bundle-size.d.ts.map +0 -1
  595. package/checks/rules/no-dev-dependency-imports.d.ts +0 -11
  596. package/checks/rules/no-dev-dependency-imports.d.ts.map +0 -1
  597. package/checks/rules/no-duplicated-files.d.ts +0 -11
  598. package/checks/rules/no-duplicated-files.d.ts.map +0 -1
  599. package/checks/rules/no-side-effects.d.ts +0 -15
  600. package/checks/rules/no-side-effects.d.ts.map +0 -1
  601. package/checks/rules/no-unexposed-executables.d.ts +0 -8
  602. package/checks/rules/no-unexposed-executables.d.ts.map +0 -1
  603. package/checks/rules/no-unused-bundle-dependencies.d.ts +0 -8
  604. package/checks/rules/no-unused-bundle-dependencies.d.ts.map +0 -1
  605. package/checks/rules/registry.d.ts +0 -23
  606. package/checks/rules/registry.d.ts.map +0 -1
  607. package/checks/rules/required-files.d.ts +0 -15
  608. package/checks/rules/required-files.d.ts.map +0 -1
  609. package/checks/rules/type-script-declaration-integrity.d.ts +0 -9
  610. package/checks/rules/type-script-declaration-integrity.d.ts.map +0 -1
  611. package/checks/rules/type-script-declaration-project.d.ts +0 -29
  612. package/checks/rules/type-script-declaration-project.d.ts.map +0 -1
  613. package/checks/rules/type-script-integrity.d.ts +0 -24
  614. package/checks/rules/type-script-integrity.d.ts.map +0 -1
  615. package/checks/rules/type-script-package-resolution.d.ts +0 -29
  616. package/checks/rules/type-script-package-resolution.d.ts.map +0 -1
  617. package/checks/rules/unique-target-paths.d.ts +0 -8
  618. package/checks/rules/unique-target-paths.d.ts.map +0 -1
  619. package/dependency-scanner/dependency-graph.d.ts +0 -38
  620. package/dependency-scanner/dependency-graph.d.ts.map +0 -1
  621. package/dependency-scanner/scanner.d.ts +0 -20
  622. package/dependency-scanner/scanner.d.ts.map +0 -1
  623. package/dependency-scanner/source-file-references.d.ts +0 -30
  624. package/dependency-scanner/source-file-references.d.ts.map +0 -1
  625. package/dependency-scanner/source-map-file-locator.d.ts +0 -10
  626. package/dependency-scanner/source-map-file-locator.d.ts.map +0 -1
  627. package/dependency-scanner/typescript-compiler-options.d.ts +0 -8
  628. package/dependency-scanner/typescript-compiler-options.d.ts.map +0 -1
  629. package/dependency-scanner/typescript-file-host.d.ts +0 -12
  630. package/dependency-scanner/typescript-file-host.d.ts.map +0 -1
  631. package/dependency-scanner/typescript-project-analyzer.d.ts +0 -19
  632. package/dependency-scanner/typescript-project-analyzer.d.ts.map +0 -1
  633. package/git/current-git-head.d.ts +0 -12
  634. package/git/current-git-head.d.ts.map +0 -1
  635. package/linker/linker.d.ts +0 -13
  636. package/linker/linker.d.ts.map +0 -1
  637. package/resource-resolver/resource-resolver.d.ts +0 -15
  638. package/resource-resolver/resource-resolver.d.ts.map +0 -1
  639. package/sbom/license-resolver.d.ts +0 -14
  640. package/sbom/license-resolver.d.ts.map +0 -1
  641. package/sbom/sbom-serializer.d.ts +0 -8
  642. package/sbom/sbom-serializer.d.ts.map +0 -1
  643. package/tar/tarball-builder.d.ts +0 -14
  644. package/tar/tarball-builder.d.ts.map +0 -1
  645. package/vendor-materializer/vendor-entry.d.ts +0 -12
  646. package/vendor-materializer/vendor-entry.d.ts.map +0 -1
  647. package/vendor-materializer/vendor-materializer.d.ts +0 -55
  648. package/vendor-materializer/vendor-materializer.d.ts.map +0 -1
  649. package/zip/zip-builder.d.ts +0 -22
  650. package/zip/zip-builder.d.ts.map +0 -1
@@ -1,53 +1 @@
1
- function buildFileDecisions(original, analyzed) {
2
- const analyzedBySourcePath = new Map(analyzed.contents.map(function (entry) {
3
- return [entry.fileDescription.sourceFilePath, entry];
4
- }));
5
- return original.contents.map(function (entry) {
6
- const emitted = analyzedBySourcePath.get(entry.fileDescription.sourceFilePath);
7
- const sourceBytes = Buffer.byteLength(entry.fileDescription.content);
8
- if (emitted === undefined) {
9
- return {
10
- path: entry.fileDescription.sourceFilePath,
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.sourceFilePath,
20
- decision: 'transformed',
21
- reason: 'rewritten-after-analysis',
22
- sourceBytes,
23
- outputBytes
24
- };
25
- }
26
- return {
27
- path: entry.fileDescription.sourceFilePath,
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
- }
53
1
  //# 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":"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,cAAc,EAAE,KAAK,CAAW,CAAC;IACpE,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,cAAc,CAAC,CAAC;QAC/E,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,cAAc;gBAC1C,QAAQ,EAAE,YAAY;gBACtB,MAAM,EAAE,4BAA4B;gBACpC,W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sourceRoot":"","sources":["../../../../source/dead-code-eliminator/elimination-emitter.ts"],"names":[],"mappings":""}
@@ -1,65 +1,9 @@
1
- import { buildAnalyzedResource } from "./code-file-analyzer.js";
2
- import { buildCrossBundleSeeds } from "./cross-bundle/cross-bundle-seeds.js";
3
- import { indexSourceFiles, recomputeDependencyMetadata } from "./dependency-metadata.js";
4
- import { maybeEmitElimination } from "./elimination-emitter.js";
5
- import { loadBundle } from "./load-bundle.js";
6
- import { pruneContents } from "./liveness/resource-retention.js";
7
- import { buildMapPathTransformIndex, recomposePairedSourceMaps } from "./source-map-recomposition.js";
8
- import { computeSideEffectsField } from "./side-effects-field.js";
9
- function crossBundleInputFrom(loaded) {
10
- const sourceFiles = [];
11
- for (const entry of loaded.loaded) {
12
- if (entry.sourceFile !== undefined) {
13
- sourceFiles.push(entry.sourceFile);
14
- }
15
- }
16
- return {
17
- bundle: loaded.input.bundle,
18
- sourceFiles,
19
- fileBindings: loaded.fileBindings,
20
- localReachable: loaded.reachability.localReachable
21
- };
22
- }
23
- function analyzeBundleWithSeeds(loaded, externalSeeds) {
24
- const context = {
25
- reachable: loaded.reachability.expandWith(externalSeeds),
26
- transformationsEnabled: loaded.input.transformationsEnabled,
27
- deadCodeElimination: loaded.input.deadCodeElimination
28
- };
29
- const outputs = loaded.loaded.map(function (entry) {
30
- return buildAnalyzedResource(entry, context);
31
- });
32
- const transformsByMapPath = buildMapPathTransformIndex(outputs, loaded.input.bundle.sourceMapTransformsByTargetPath);
33
- const contents = outputs.map(function (output) {
34
- return output.resource;
35
- });
36
- const finalContents = recomposePairedSourceMaps(contents, transformsByMapPath);
37
- const sourceFileIndex = indexSourceFiles(loaded);
38
- const prePruneMetadata = recomputeDependencyMetadata(loaded.input.bundle, finalContents, sourceFileIndex);
39
- const prunedContents = pruneContents(loaded.input.bundle, prePruneMetadata.contents, loaded.input.transformationsEnabled);
40
- const dependencyMetadata = recomputeDependencyMetadata(loaded.input.bundle, prunedContents, sourceFileIndex);
41
- return {
42
- ...loaded.input.bundle,
43
- ...dependencyMetadata,
44
- sideEffectsField: computeSideEffectsField(dependencyMetadata.contents)
45
- };
46
- }
47
- export function createDeadCodeEliminator(dependencies) {
48
- const { createProject, progressBroadcaster } = dependencies;
49
- return {
50
- async eliminate(inputs) {
51
- const loadedBundles = inputs.map(function (input) {
52
- return loadBundle(createProject, input);
53
- });
54
- const seedMap = buildCrossBundleSeeds(loadedBundles.map(crossBundleInputFrom));
55
- const analyzed = loadedBundles.map(function (loaded) {
56
- return analyzeBundleWithSeeds(loaded, seedMap.get(loaded.input.bundle.name));
57
- });
58
- maybeEmitElimination(progressBroadcaster, inputs.map(function (input) {
59
- return input.bundle;
60
- }), analyzed);
61
- return analyzed;
62
- }
63
- };
64
- }
1
+ import "./code-file-analyzer.js";
2
+ import "./cross-bundle/cross-bundle-seeds.js";
3
+ import "./dependency-metadata.js";
4
+ import "./elimination-emitter.js";
5
+ import "./load-bundle.js";
6
+ import "./liveness/resource-retention.js";
7
+ import "./source-map-recomposition.js";
8
+ import "./side-effects-field.js";
65
9
  //# sourceMappingURL=eliminator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eliminator.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/eliminator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAwB,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAyB,MAAM,sCAAsC,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAyC,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;A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AC;YACF,OAAO,QAAQ,CAAC;QACpB,CAAC;KACJ,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"eliminator.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/eliminator.ts"],"names":[],"mappings":"AAEA,OAA4D,yBAAyB,CAAC;AACtF,OAA6D,sCAAsC,CAAC;AACpG,OAA8D,0BAA0B,CAAC;AACzF,OAAqC,0BAA0B,CAAC;AAChE,OAAkE,kBAAkB,CAAC;AACrF,OAA8B,kCAAkC,CAAC;AACjE,OAAsE,+BAA+B,CAAC;AACtG,OAAwC,yBAAyB,CAAC"}
@@ -1,17 +1,2 @@
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
- }
1
+ import 'ts-morph';
17
2
  //# 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,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"}
1
+ {"version":3,"file":"expression-unwrapping.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/expression-unwrapping.ts"],"names":[],"mappings":"AAAA,OAAqD,UAAU,CAAC"}
@@ -1,103 +1,4 @@
1
- import { Node as TsMorphNode, SyntaxKind } from 'ts-morph';
2
- import { unwrapExpression } from "./expression-unwrapping.js";
3
- function importedOriginForDeclaration(declaration) {
4
- if (TsMorphNode.isImportSpecifier(declaration)) {
5
- return {
6
- from: declaration.getImportDeclaration().getModuleSpecifierValue(),
7
- path: [declaration.getName()]
8
- };
9
- }
10
- if (TsMorphNode.isNamespaceImport(declaration)) {
11
- const importDeclaration = declaration.getFirstAncestorByKindOrThrow(SyntaxKind.ImportDeclaration);
12
- return {
13
- from: importDeclaration.getModuleSpecifierValue(),
14
- path: []
15
- };
16
- }
17
- if (TsMorphNode.isImportClause(declaration)) {
18
- const importDeclaration = declaration.getFirstAncestorByKindOrThrow(SyntaxKind.ImportDeclaration);
19
- return {
20
- from: importDeclaration.getModuleSpecifierValue(),
21
- path: ['default']
22
- };
23
- }
24
- return undefined;
25
- }
26
- function importedOriginForIdentifier(identifier) {
27
- const symbol = identifier.getSymbol();
28
- if (symbol === undefined) {
29
- return undefined;
30
- }
31
- for (const declaration of symbol.getDeclarations()) {
32
- const origin = importedOriginForDeclaration(declaration);
33
- if (origin !== undefined) {
34
- return origin;
35
- }
36
- }
37
- return undefined;
38
- }
39
- function originMatchesTrustedImport(origin, trustedImport) {
40
- if (trustedImport.from !== origin.from) {
41
- return false;
42
- }
43
- if (trustedImport.imports === undefined) {
44
- return true;
45
- }
46
- const [pathHead = trustedImport.from] = origin.path;
47
- return pathHead !== trustedImport.from && trustedImport.imports.includes(pathHead);
48
- }
49
- function expressionOriginIsTrusted(origin, settings) {
50
- const pureImports = settings?.pureImports;
51
- if (origin === undefined || pureImports === undefined) {
52
- return false;
53
- }
54
- return pureImports.some(function (trustedImport) {
55
- return originMatchesTrustedImport(origin, trustedImport);
56
- });
57
- }
58
- function arePureCallArguments(callArguments, recurse) {
59
- return callArguments.every(function (argument) {
60
- if (TsMorphNode.isSpreadElement(argument)) {
61
- return recurse(argument.getExpression());
62
- }
63
- return TsMorphNode.isExpression(argument) && recurse(argument);
64
- });
65
- }
66
- function appendPropertyAccess(base, propertyName) {
67
- return base === undefined ? undefined : { from: base.from, path: [...base.path, propertyName] };
68
- }
69
- function originOfTrustedCall(callee, callArguments, recurse, settings) {
70
- if (!expressionOriginIsTrusted(callee, settings)) {
71
- return undefined;
72
- }
73
- return arePureCallArguments(callArguments, recurse) ? callee : undefined;
74
- }
75
- export function resolveImportedExpressionPath(expression) {
76
- const identifier = unwrapExpression(expression).asKind(SyntaxKind.Identifier);
77
- return identifier === undefined ? undefined : importedOriginForIdentifier(identifier);
78
- }
79
- function propertyAccessOrigin(expression, recurse, settings, resolveOrigin) {
80
- if (!TsMorphNode.isPropertyAccessExpression(expression)) {
81
- return undefined;
82
- }
83
- const base = resolveOrigin(expression.getExpression(), recurse, settings);
84
- return appendPropertyAccess(base, expression.getName());
85
- }
86
- function trustedCallOrigin(expression, recurse, settings, resolveOrigin) {
87
- if (!TsMorphNode.isCallExpression(expression)) {
88
- return undefined;
89
- }
90
- const callee = resolveOrigin(expression.getExpression(), recurse, settings);
91
- return originOfTrustedCall(callee, expression.getArguments(), recurse, settings);
92
- }
93
- export function resolveImportedExpressionOrigin(expression, recurse, settings) {
94
- const unwrapped = unwrapExpression(expression);
95
- const directOrigin = resolveImportedExpressionPath(unwrapped);
96
- if (directOrigin !== undefined) {
97
- return directOrigin;
98
- }
99
- return propertyAccessOrigin(unwrapped, recurse, settings, resolveImportedExpressionOrigin) ??
100
- trustedCallOrigin(unwrapped, recurse, settings, resolveImportedExpressionOrigin);
101
- }
1
+ import 'ts-morph';
2
+ import "./expression-unwrapping.js";
102
3
  export { arePureCallArguments };
103
4
  //# sourceMappingURL=imported-expression-origin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imported-expression-origin.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/imported-expression-origin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,UAAU,EAAoC,MAAM,UAAU,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAoB9D,SAAS,4BAA4B,CAAC,WAAwB;IAC1D,IAAI,WAAW,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7C,OAAO;YACH,IAAI,EAAE,WAAW,CAAC,oBAAoB,EAAE,CAAC,uBAAuB,EAAE;YAClE,IAAI,EAAE,CAAE,WAAW,CAAC,OAAO,EAAE,CAAE;SAClC,CAAC;IACN,CAAC;IAED,IAAI,WAAW,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7C,MAAM,iBAAiB,GAAG,WAAW,CAAC,6BAA6B,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAClG,OAAO;YACH,IAAI,EAAE,iBAAiB,CAAC,uBAAuB,EAAE;YACjD,IAAI,EAAE,EAAE;SACX,CAAC;IACN,CAAC;IAED,IAAI,WAAW,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1C,MAAM,iBAAiB,GAAG,WAAW,CAAC,6BAA6B,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;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,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"imported-expression-origin.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/imported-expression-origin.ts"],"names":[],"mappings":"AAAA,OAAkF,UAAU,CAAC;AAE7F,OAAiC,4BAA4B,CAAC;OA8B/C,uBAgEP,CAC8D,CAAC"}
@@ -1,10 +1,2 @@
1
- import path from 'node:path';
2
- const sideEffectAssetExtensions = new Set(['.css', '.less', '.sass', '.scss']);
3
- export function sideEffectAssetImportKind(specifier) {
4
- const extension = path.extname(specifier);
5
- if (!sideEffectAssetExtensions.has(extension)) {
6
- return undefined;
7
- }
8
- return `${extension.slice(1)} import`;
9
- }
1
+ import 'node:path';
10
2
  //# sourceMappingURL=asset-side-effects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"asset-side-effects.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/asset-side-effects.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAE,CAAC,CAAC;AAEjF,MAAM,UAAU,yBAAyB,CAAC,SAAiB;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5C,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"asset-side-effects.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/asset-side-effects.ts"],"names":[],"mappings":"AAAA,OAAiB,WAAW,CAAC"}
@@ -1,99 +1,3 @@
1
- import { Node as TsMorphNode, SyntaxKind, VariableDeclarationKind } from 'ts-morph';
2
- import { unwrapExpression } from "../expression-unwrapping.js";
3
- function andOperator(left, right) {
4
- return left && right;
5
- }
6
- function orOperator(left, right) {
7
- return left || right;
8
- }
9
- function equalOperator(left, right) {
10
- return left === right;
11
- }
12
- function notEqualOperator(left, right) {
13
- return left !== right;
14
- }
15
- function literalBooleanValue(expression) {
16
- if (expression.getKind() === SyntaxKind.TrueKeyword) {
17
- return true;
18
- }
19
- return expression.getKind() === SyntaxKind.FalseKeyword ? false : undefined;
20
- }
21
- function logicalBooleanOperatorValue(kind, left, right) {
22
- if (kind === SyntaxKind.AmpersandAmpersandToken) {
23
- return andOperator(left, right);
24
- }
25
- if (kind === SyntaxKind.BarBarToken) {
26
- return orOperator(left, right);
27
- }
28
- return undefined;
29
- }
30
- function equalityBooleanOperatorValue(kind, left, right) {
31
- if (kind === SyntaxKind.EqualsEqualsEqualsToken) {
32
- return equalOperator(left, right);
33
- }
34
- if (kind === SyntaxKind.ExclamationEqualsEqualsToken) {
35
- return notEqualOperator(left, right);
36
- }
37
- return undefined;
38
- }
39
- function binaryBooleanOperatorValue(kind, left, right) {
40
- return logicalBooleanOperatorValue(kind, left, right) ?? equalityBooleanOperatorValue(kind, left, right);
41
- }
42
- function identifierBooleanValue(expression, facts) {
43
- return TsMorphNode.isIdentifier(expression) ? facts.get(expression.getText()) : undefined;
44
- }
45
- function binaryBooleanValue(expression, facts, evaluate) {
46
- if (!TsMorphNode.isBinaryExpression(expression)) {
47
- return undefined;
48
- }
49
- const binary = expression.asKindOrThrow(SyntaxKind.BinaryExpression);
50
- const left = evaluate(binary.getLeft(), facts);
51
- const right = evaluate(binary.getRight(), facts);
52
- if (left === undefined || right === undefined) {
53
- return undefined;
54
- }
55
- return binaryBooleanOperatorValue(binary.getOperatorToken().getKind(), left, right);
56
- }
57
- function prefixBooleanValue(expression, facts, evaluate) {
58
- if (!TsMorphNode.isPrefixUnaryExpression(expression)) {
59
- return undefined;
60
- }
61
- const operand = evaluate(expression.getOperand(), facts);
62
- return operand !== undefined && expression.getOperatorToken() === SyntaxKind.ExclamationToken
63
- ? !operand
64
- : undefined;
65
- }
66
- export function booleanValue(expression, facts) {
67
- const unwrapped = unwrapExpression(expression);
68
- return literalBooleanValue(unwrapped) ??
69
- identifierBooleanValue(unwrapped, facts) ??
70
- prefixBooleanValue(unwrapped, facts, booleanValue) ??
71
- binaryBooleanValue(unwrapped, facts, booleanValue);
72
- }
73
- function collectBooleanFact(declaration, facts) {
74
- const nameNode = declaration.getNameNode();
75
- const initializer = declaration.getInitializer();
76
- if (initializer === undefined || !TsMorphNode.isIdentifier(nameNode)) {
77
- return undefined;
78
- }
79
- const value = booleanValue(initializer, facts);
80
- return value === undefined ? undefined : [nameNode.getText(), value];
81
- }
82
- function collectConstBooleanFacts(statement, facts) {
83
- if (statement.getDeclarationKind() !== VariableDeclarationKind.Const) {
84
- return facts;
85
- }
86
- const nextFacts = new Map(facts);
87
- for (const declaration of statement.getDeclarations()) {
88
- const fact = collectBooleanFact(declaration, nextFacts);
89
- if (fact !== undefined) {
90
- const [name, value] = fact;
91
- nextFacts.set(name, value);
92
- }
93
- }
94
- return nextFacts;
95
- }
96
- export function factsAfterStatement(statement, facts) {
97
- return TsMorphNode.isVariableStatement(statement) ? collectConstBooleanFacts(statement, facts) : facts;
98
- }
1
+ import 'ts-morph';
2
+ import "../expression-unwrapping.js";
99
3
  //# sourceMappingURL=boolean-facts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"boolean-facts.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/boolean-facts.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,IAAI,WAAW,EACnB,UAAU,EACV,uBAAuB,EAK1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAM/D,SAAS,WAAW,CAAC,IAAa,EAAE,KAAc;IAC9C,OAAO,IAAI,IAAI,KAAK,CAAC;AACzB,CAAC;AAED,SAAS,UAAU,CAAC,IAAa,EAAE,KAAc;IA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AAC,eAAe,EAAE,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,kBAAkB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACxD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,MAAM,CAAE,IAAI,EAAE,KAAK,CAAE,GAAG,IAAI,CAAC;YAC7B,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,SAAoB,EAAE,KAAmB;IACzE,OAAO,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3G,CAAC"}
1
+ {"version":3,"file":"boolean-facts.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/boolean-facts.ts"],"names":[],"mappings":"AAAA,OAQO,UAAU,CAAC;AAClB,OAAiC,6BAA6B,CAAC"}
@@ -1,173 +1,3 @@
1
- import path from 'node:path';
2
- import { ts } from 'ts-morph';
3
- function isRelativeOrAbsoluteSpecifier(specifier) {
4
- return specifier.startsWith('.') || path.isAbsolute(specifier);
5
- }
6
- function scopedPackageSpecifierFrom(specifier) {
7
- const [scope, name, ...rest] = specifier.split('/');
8
- if (name === undefined) {
9
- return undefined;
10
- }
11
- return {
12
- packageName: `${scope}/${name}`,
13
- subpath: rest.length === 0 ? '.' : `./${rest.join('/')}`
14
- };
15
- }
16
- function unscopedPackageSpecifierFrom(specifier) {
17
- const [packageName = specifier, ...rest] = specifier.split('/');
18
- return {
19
- packageName,
20
- subpath: rest.length === 0 ? '.' : `./${rest.join('/')}`
21
- };
22
- }
23
- function packageSpecifierFrom(specifier) {
24
- if (isRelativeOrAbsoluteSpecifier(specifier) || specifier.startsWith('#')) {
25
- return undefined;
26
- }
27
- return specifier.startsWith('@') ? scopedPackageSpecifierFrom(specifier) : unscopedPackageSpecifierFrom(specifier);
28
- }
29
- function hostFileExists(sourceFile, filePath) {
30
- return sourceFile.getProject().getModuleResolutionHost().fileExists(filePath);
31
- }
32
- function hostReadFile(sourceFile, filePath) {
33
- return sourceFile.getProject().getModuleResolutionHost().readFile(filePath);
34
- }
35
- function packageLookupDirectories(containingSourceFile) {
36
- const start = path.resolve(path.dirname(containingSourceFile.getFilePath()));
37
- const { root } = path.parse(start);
38
- const directorySegments = path
39
- .relative(root, start)
40
- .split(path.sep);
41
- return Array.from({ length: directorySegments.length + 1 }, function (_unusedValue, ancestorOffset) {
42
- return path.join(root, ...directorySegments.slice(0, directorySegments.length - ancestorOffset));
43
- });
44
- }
45
- function packageRootPath(specifier, containingSourceFile) {
46
- for (const directory of packageLookupDirectories(containingSourceFile)) {
47
- const packageRoot = path.join(directory, 'node_modules', specifier.packageName);
48
- if (hostFileExists(containingSourceFile, path.join(packageRoot, 'package.json'))) {
49
- return packageRoot;
50
- }
51
- }
52
- return undefined;
53
- }
54
- function isRecord(value) {
55
- return typeof value === 'object' && value !== null && !Array.isArray(value);
56
- }
57
- function stringProperty(record, key) {
58
- const value = record[key];
59
- return typeof value === 'string' ? value : undefined;
60
- }
61
- function parsePackageManifest(filePath, content) {
62
- const parsed = ts.parseConfigFileTextToJson(filePath, content);
63
- return parsed.error === undefined && isRecord(parsed.config) ? parsed.config : undefined;
64
- }
65
- function readPackageManifest(packageRoot, containingSourceFile) {
66
- const filePath = path.join(packageRoot, 'package.json');
67
- const parsed = parsePackageManifest(filePath, String(hostReadFile(containingSourceFile, filePath)));
68
- if (parsed === undefined) {
69
- return undefined;
70
- }
71
- return {
72
- type: stringProperty(parsed, 'type'),
73
- exports: parsed.exports,
74
- main: stringProperty(parsed, 'main'),
75
- module: stringProperty(parsed, 'module')
76
- };
77
- }
78
- function targetFromConditionArray(value, resolveTarget) {
79
- if (!Array.isArray(value)) {
80
- return undefined;
81
- }
82
- for (const entry of value) {
83
- const target = resolveTarget(entry);
84
- if (target !== undefined) {
85
- return target;
86
- }
87
- }
88
- return undefined;
89
- }
90
- function targetFromConditionRecord(value, resolveTarget) {
91
- if (!isRecord(value)) {
92
- return undefined;
93
- }
94
- return resolveTarget(value.import) ?? resolveTarget(value.default);
95
- }
96
- function targetFromCondition(value) {
97
- if (typeof value === 'string') {
98
- return value;
99
- }
100
- return targetFromConditionArray(value, targetFromCondition) ??
101
- targetFromConditionRecord(value, targetFromCondition);
102
- }
103
- function targetFromRootExports(exportsValue) {
104
- if (typeof exportsValue === 'string' || Array.isArray(exportsValue)) {
105
- return targetFromCondition(exportsValue);
106
- }
107
- if (!isRecord(exportsValue)) {
108
- return undefined;
109
- }
110
- const rootTarget = exportsValue['.'];
111
- return targetFromCondition(rootTarget === undefined ? exportsValue : rootTarget);
112
- }
113
- function targetFromSubpathExports(exportsValue, subpath) {
114
- return isRecord(exportsValue) ? targetFromCondition(exportsValue[subpath]) : undefined;
115
- }
116
- function targetFromExports(exportsValue, subpath) {
117
- return subpath === '.'
118
- ? targetFromRootExports(exportsValue)
119
- : targetFromSubpathExports(exportsValue, subpath);
120
- }
121
- function manifestFallbackTarget(manifest) {
122
- if (manifest.module !== undefined) {
123
- return manifest.module;
124
- }
125
- return manifest.type === 'module' ? manifest.main : undefined;
126
- }
127
- function targetIsEsm(resolved, manifest) {
128
- const extension = path.extname(resolved);
129
- return extension === '.mjs' || extension === '.js' && manifest.type === 'module';
130
- }
131
- function runtimeTargetPath(packageRoot, manifest, specifier) {
132
- const target = targetFromExports(manifest.exports, specifier.subpath) ?? manifestFallbackTarget(manifest);
133
- if (target === undefined) {
134
- return undefined;
135
- }
136
- const resolved = path.resolve(packageRoot, target);
137
- if (!resolved.startsWith(`${path.resolve(packageRoot)}${path.sep}`)) {
138
- return undefined;
139
- }
140
- return targetIsEsm(resolved, manifest) ? resolved : undefined;
141
- }
142
- function sourceFileAtPath(project, filePath) {
143
- return project.getSourceFile(filePath) ?? project.addSourceFileAtPathIfExists(filePath);
144
- }
145
- function resolvePackageSourceFile(specifier, containingSourceFile) {
146
- const packageRoot = packageRootPath(specifier, containingSourceFile);
147
- if (packageRoot === undefined) {
148
- return undefined;
149
- }
150
- const manifest = readPackageManifest(packageRoot, containingSourceFile);
151
- const targetPath = manifest === undefined ? undefined : runtimeTargetPath(packageRoot, manifest, specifier);
152
- return targetPath === undefined ? undefined : sourceFileAtPath(containingSourceFile.getProject(), targetPath);
153
- }
154
- function resolveRelativeSourceFile(moduleSpecifier, containingSourceFile) {
155
- const project = containingSourceFile.getProject();
156
- const resolved = path.resolve(path.dirname(containingSourceFile.getFilePath()), moduleSpecifier);
157
- const candidates = [resolved, `${resolved}.mjs`, `${resolved}.js`];
158
- for (const candidate of candidates) {
159
- const sourceFile = sourceFileAtPath(project, candidate);
160
- if (sourceFile !== undefined) {
161
- return sourceFile;
162
- }
163
- }
164
- return undefined;
165
- }
166
- export function resolveModuleSourceFile(moduleSpecifier, containingSourceFile) {
167
- const specifier = packageSpecifierFrom(moduleSpecifier);
168
- if (specifier !== undefined) {
169
- return resolvePackageSourceFile(specifier, containingSourceFile);
170
- }
171
- return resolveRelativeSourceFile(moduleSpecifier, containingSourceFile);
172
- }
1
+ import 'node:path';
2
+ import 'ts-morph';
173
3
  //# sourceMappingURL=external-module-resolution.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-module-resolution.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-module-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAiC,MAAM,UAAU,CAAC;AAgB7D,SAAS,6BAA6B,CAAC,SAAiB;IACpD,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,0BAA0B,CAAC,SAAiB;IACjD,MAAM,CAAE,KAAK,EAAE,IAAI,EAAE,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QAAQ,MAAM,EAAE,GAAG,QAAQ,KAAK,CAAE,CAAC;IACrE,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACxD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,UAAU,CAAC;QACtB,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,uBAAuB,CACnC,eAAuB,EACvB,oBAAgC;IAEhC,MAAM,SAAS,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAAC;IACxD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,wBAAwB,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,yBAAyB,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;AAC5E,CAAC"}
1
+ {"version":3,"file":"external-module-resolution.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-module-resolution.ts"],"names":[],"mappings":"AAAA,OAAiB,WAAW,CAAC;AAC7B,OAAkD,UAAU,CAAC;IA2ClD,EAAoE,MAWtE"}