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,295 +1,4 @@
1
- import { Node as TsMorphNode, SyntaxKind } from 'ts-morph';
2
- import { unwrapExpression } from "../expression-unwrapping.js";
3
- import { resolveModuleSourceFile } from "./external-module-resolution.js";
4
- const noExportEntries = [];
5
- function isProjectSummaryStore(value) {
6
- return value instanceof Map;
7
- }
8
- function projectSummaryCache(project) {
9
- const stored = Reflect.get(project, projectSummaryCache.name);
10
- const cache = isProjectSummaryStore(stored) ? stored : new Map();
11
- Reflect.set(project, projectSummaryCache.name, cache);
12
- return cache;
13
- }
14
- function kindIsTextOrNumberReturnLeaf(kind) {
15
- return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NumericLiteral;
16
- }
17
- function kindIsBooleanReturnLeaf(kind) {
18
- return kind === SyntaxKind.TrueKeyword || kind === SyntaxKind.FalseKeyword;
19
- }
20
- function kindIsPureReturnLeaf(kind) {
21
- return kindIsTextOrNumberReturnLeaf(kind) ||
22
- kindIsBooleanReturnLeaf(kind) ||
23
- kind === SyntaxKind.NullKeyword;
24
- }
25
- function arrowReturnExpressionFrom(functionLike) {
26
- const body = functionLike.getBody();
27
- return TsMorphNode.isExpression(body) ? body : undefined;
28
- }
29
- function blockFromFunctionLike(functionLike) {
30
- return functionLike.getBody()?.asKind(SyntaxKind.Block);
31
- }
32
- function blockReturnExpressionFrom(functionLike) {
33
- const body = blockFromFunctionLike(functionLike);
34
- if (body === undefined) {
35
- return undefined;
36
- }
37
- const [statement] = body.getStatements();
38
- return TsMorphNode.isReturnStatement(statement) ? statement.getExpression() : undefined;
39
- }
40
- function returnExpressionFrom(functionLike) {
41
- if (TsMorphNode.isArrowFunction(functionLike)) {
42
- return arrowReturnExpressionFrom(functionLike);
43
- }
44
- return blockReturnExpressionFrom(functionLike);
45
- }
46
- function expressionIsPureReturnStructure(expression) {
47
- return TsMorphNode.isObjectLiteralExpression(expression) ||
48
- TsMorphNode.isArrayLiteralExpression(expression) ||
49
- TsMorphNode.isArrowFunction(expression) ||
50
- TsMorphNode.isFunctionExpression(expression);
51
- }
52
- function expressionIsPureReturnValue(expression) {
53
- const unwrapped = unwrapExpression(expression);
54
- return kindIsPureReturnLeaf(unwrapped.getKind()) || expressionIsPureReturnStructure(unwrapped);
55
- }
56
- function functionLikeIsPureBuilder(functionLike) {
57
- if (functionLike.getFullText().includes('@__NO_SIDE_EFFECTS__')) {
58
- return true;
59
- }
60
- const expression = returnExpressionFrom(functionLike);
61
- return expression !== undefined && expressionIsPureReturnValue(expression);
62
- }
63
- function callablePurity(functionLike) {
64
- return functionLikeIsPureBuilder(functionLike) ? 'pure-callable' : 'unknown';
65
- }
66
- function propertyInitializerPurity(initializer) {
67
- if (TsMorphNode.isFunctionExpression(initializer) || TsMorphNode.isArrowFunction(initializer)) {
68
- return callablePurity(initializer);
69
- }
70
- return TsMorphNode.isObjectLiteralExpression(initializer) ? 'pure-object' : 'unknown';
71
- }
72
- function supportedObjectProperty(property) {
73
- if (TsMorphNode.isMethodDeclaration(property) || TsMorphNode.isPropertyAssignment(property)) {
74
- return property;
75
- }
76
- return undefined;
77
- }
78
- function propertyPurity(property) {
79
- if (TsMorphNode.isMethodDeclaration(property)) {
80
- return callablePurity(property);
81
- }
82
- return propertyInitializerPurity(property.getInitializerOrThrow());
83
- }
84
- function propertyName(property) {
85
- const nameNode = property.getNameNode();
86
- return TsMorphNode.isStringLiteral(nameNode) ? nameNode.getLiteralText() : property.getName();
87
- }
88
- function functionLikeReturnObjectEntries(exportName, functionLike, collectObjectEntries) {
89
- const unwrapped = unwrapExpression(returnExpressionFrom(functionLike));
90
- return TsMorphNode.isObjectLiteralExpression(unwrapped)
91
- ? collectObjectEntries(exportName, unwrapped, undefined)
92
- : noExportEntries;
93
- }
94
- function methodReturnObjectEntries(propertyPath, property, collectObjectEntries) {
95
- return TsMorphNode.isMethodDeclaration(property)
96
- ? functionLikeReturnObjectEntries(propertyPath, property, collectObjectEntries)
97
- : noExportEntries;
98
- }
99
- function propertyAssignmentReturnObjectEntries(propertyPath, property, collectObjectEntries) {
100
- if (!TsMorphNode.isPropertyAssignment(property)) {
101
- return noExportEntries;
102
- }
103
- const initializer = property.getInitializerOrThrow();
104
- return TsMorphNode.isFunctionExpression(initializer) || TsMorphNode.isArrowFunction(initializer)
105
- ? functionLikeReturnObjectEntries(propertyPath, initializer, collectObjectEntries)
106
- : noExportEntries;
107
- }
108
- function objectPropertyExportEntries(exportName, property, collectObjectEntries) {
109
- const supportedProperty = supportedObjectProperty(property);
110
- if (supportedProperty === undefined) {
111
- return noExportEntries;
112
- }
113
- const name = propertyName(supportedProperty);
114
- const propertyPath = `${exportName}.${name}`;
115
- return [
116
- [propertyPath, propertyPurity(supportedProperty)],
117
- ...methodReturnObjectEntries(propertyPath, supportedProperty, collectObjectEntries),
118
- ...propertyAssignmentReturnObjectEntries(propertyPath, supportedProperty, collectObjectEntries)
119
- ];
120
- }
121
- function objectLiteralExportEntries(exportName, initializer, selfPurity) {
122
- const entries = [];
123
- for (const property of initializer.getProperties()) {
124
- entries.push(...objectPropertyExportEntries(exportName, property, objectLiteralExportEntries));
125
- }
126
- if (selfPurity !== undefined) {
127
- entries.push([exportName, selfPurity]);
128
- }
129
- return entries;
130
- }
131
- function variableExportEntries(declaration) {
132
- const initializer = declaration.getInitializer();
133
- const name = declaration.getName();
134
- if (TsMorphNode.isObjectLiteralExpression(initializer)) {
135
- return objectLiteralExportEntries(name, initializer, 'pure-object');
136
- }
137
- if (TsMorphNode.isFunctionExpression(initializer) || TsMorphNode.isArrowFunction(initializer)) {
138
- return [
139
- [name, callablePurity(initializer)],
140
- ...functionLikeReturnObjectEntries(name, initializer, objectLiteralExportEntries)
141
- ];
142
- }
143
- return noExportEntries;
144
- }
145
- function addVariableExport(declaration, context) {
146
- for (const [name, purity] of variableExportEntries(declaration)) {
147
- context.exportPurities.set(name, purity);
148
- }
149
- }
150
- function mergeExports(context, prefix, source) {
151
- for (const [key, value] of source) {
152
- context.exportPurities.set(prefix === '' ? key : `${prefix}.${key}`, value);
153
- }
154
- if (prefix !== '') {
155
- context.exportPurities.set(prefix, 'pure-object');
156
- }
157
- }
158
- function resolvedModuleSummary(context, moduleSpecifier) {
159
- const target = resolveModuleSourceFile(moduleSpecifier, context.sourceFile);
160
- return target === undefined ? undefined : context.buildSummary(target);
161
- }
162
- function sourceExportPrefix(sourceName) {
163
- return `${sourceName}.`;
164
- }
165
- function importedNamespaceSources(sourceFile) {
166
- const namespaces = new Map();
167
- for (const declaration of sourceFile.getImportDeclarations()) {
168
- const namespace = declaration.getNamespaceImport();
169
- if (namespace !== undefined) {
170
- namespaces.set(namespace.getText(), declaration.getModuleSpecifierValue());
171
- }
172
- }
173
- return namespaces;
174
- }
175
- function mergeNestedNamedExport(context, sourceName, exportedName, summary) {
176
- const prefix = sourceExportPrefix(sourceName);
177
- for (const [key, value] of summary.exports) {
178
- if (key.startsWith(prefix)) {
179
- context.exportPurities.set(`${exportedName}.${key.slice(prefix.length)}`, value);
180
- }
181
- }
182
- }
183
- function mergeNamedExport(context, namedExport, summary) {
184
- const sourceName = namedExport.getName();
185
- const exportedName = namedExport.getAliasNode()?.getText() ?? sourceName;
186
- context.exportPurities.set(exportedName, summary.exports.get(sourceName) ?? 'unknown');
187
- mergeNestedNamedExport(context, sourceName, exportedName, summary);
188
- }
189
- function mergeNamedExports(context, declaration, summary) {
190
- for (const namedExport of declaration.getNamedExports()) {
191
- mergeNamedExport(context, namedExport, summary);
192
- }
193
- }
194
- function mergeModuleExportsByKind(context, declaration, summary) {
195
- if (declaration.getNamedExports().length === 0) {
196
- mergeExports(context, '', summary.exports);
197
- return;
198
- }
199
- mergeNamedExports(context, declaration, summary);
200
- }
201
- function mergeModuleExportDeclaration(context, declaration, moduleSpecifier) {
202
- const summary = resolvedModuleSummary(context, moduleSpecifier);
203
- if (summary === undefined) {
204
- return;
205
- }
206
- const namespaceExport = declaration.getNamespaceExport();
207
- if (namespaceExport !== undefined) {
208
- mergeExports(context, namespaceExport.getName(), summary.exports);
209
- return;
210
- }
211
- mergeModuleExportsByKind(context, declaration, summary);
212
- }
213
- function mergeNamespaceReexport(context, namedExport, namespaceSource) {
214
- const summary = resolvedModuleSummary(context, namespaceSource);
215
- if (summary === undefined) {
216
- return;
217
- }
218
- const sourceName = namedExport.getName();
219
- const exportedName = namedExport.getAliasNode()?.getText() ?? sourceName;
220
- mergeExports(context, exportedName, summary.exports);
221
- }
222
- function mergeLocalExportDeclaration(context, declaration) {
223
- for (const namedExport of declaration.getNamedExports()) {
224
- const namespaceSource = context.namespaces.get(namedExport.getName());
225
- if (namespaceSource !== undefined) {
226
- mergeNamespaceReexport(context, namedExport, namespaceSource);
227
- }
228
- }
229
- }
230
- function mergeExportDeclaration(context, declaration) {
231
- const moduleSpecifier = declaration.getModuleSpecifierValue();
232
- if (moduleSpecifier !== undefined) {
233
- mergeModuleExportDeclaration(context, declaration, moduleSpecifier);
234
- return;
235
- }
236
- mergeLocalExportDeclaration(context, declaration);
237
- }
238
- function addFunctionExport(statement, context) {
239
- if (!TsMorphNode.isFunctionDeclaration(statement) || !statement.isExported()) {
240
- return;
241
- }
242
- const name = statement.getName();
243
- if (name !== undefined) {
244
- context.exportPurities.set(name, callablePurity(statement));
245
- }
246
- }
247
- function addVariableStatementExports(statement, context) {
248
- if (!TsMorphNode.isVariableStatement(statement) || !statement.isExported()) {
249
- return;
250
- }
251
- for (const declaration of statement.getDeclarations()) {
252
- addVariableExport(declaration, context);
253
- }
254
- }
255
- function mergeStatementExports(context, statement) {
256
- addFunctionExport(statement, context);
257
- addVariableStatementExports(statement, context);
258
- if (TsMorphNode.isExportDeclaration(statement)) {
259
- mergeExportDeclaration(context, statement);
260
- }
261
- }
262
- function summaryContext(sourceFile, exportPurities, buildSummary) {
263
- return {
264
- sourceFile,
265
- namespaces: importedNamespaceSources(sourceFile),
266
- exportPurities,
267
- buildSummary
268
- };
269
- }
270
- function createExternalPuritySummary(sourceFile, cache, buildSummary) {
271
- const exportPurities = new Map();
272
- const summary = { exports: exportPurities };
273
- cache.set(sourceFile.getFilePath(), summary);
274
- const context = summaryContext(sourceFile, exportPurities, buildSummary);
275
- for (const statement of sourceFile.getStatements()) {
276
- mergeStatementExports(context, statement);
277
- }
278
- return summary;
279
- }
280
- function buildExternalPuritySummary(sourceFile) {
281
- const cache = projectSummaryCache(sourceFile.getProject());
282
- const cached = cache.get(sourceFile.getFilePath());
283
- return cached ?? createExternalPuritySummary(sourceFile, cache, buildExternalPuritySummary);
284
- }
285
- function exportKey(origin) {
286
- return origin.path.join('.');
287
- }
288
- export function exportPurityForOrigin(origin, containingSourceFile) {
289
- const sourceFile = resolveModuleSourceFile(origin.from, containingSourceFile);
290
- if (sourceFile === undefined) {
291
- return 'unknown';
292
- }
293
- return buildExternalPuritySummary(sourceFile).exports.get(exportKey(origin)) ?? 'unknown';
294
- }
1
+ import 'ts-morph';
2
+ import "../expression-unwrapping.js";
3
+ import "./external-module-resolution.js";
295
4
  //# sourceMappingURL=external-purity-summary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-purity-summary.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-purity-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,IAAI,WAAW,EACnB,UAAU,EAeb,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAoC1E,MAAM,eAAe,GAAiC,EAAE,CAAC;AAEzD,SAAS,qBAAqB,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,GAAG,CAAC;AAChC,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAgB;IACzC,MAAM,MAAM,GAAY,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvE,MAAM,KAAK,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,EAAiC,CAAC;IAChG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,4BAA4B,CAAC,IAAgB;IAClD,OAAO,IAAI,KAAK,UAAU,CAAC,aAAa,IAAI,IAAI,KAAK,UAAU,CAAC,cAAc,CAAC;AACnF,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAgB;IAC7C,OAAO,IAAI,KAAK,UAAU,CAAC,WAAW,IAAI,IAAI,KAAK,UAAU,CAAC,YAAY,CAAC;AAC/E,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAgB;IAC1C,OAAO,4BAA4B,CAAC,IAAI,CAAC;QACrC,uBAAuB,CAAC,IAAI,CAAC;QAC7B,IAAI,KAAK,UAAU,CAAC,WAAW,CAAC;AACxC,CAAC;AAED,SAA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AY,CAAC,CAAC;IACzE,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,aAAa,EAAE,EAAE,CAAC;QACjD,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,SAAS,0BAA0B,CAAC,UAAsB;IACtD,MAAM,KAAK,GAAG,mBAAmB,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACnD,OAAO,MAAM,IAAI,2BAA2B,CAAC,UAAU,EAAE,KAAK,EAAE,0BAA0B,CAAC,CAAC;AAChG,CAAC;AAED,SAAS,SAAS,CAAC,MAAgC;IAC/C,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,qBAAqB,CACjC,MAAgC,EAChC,oBAAgC;IAEhC,MAAM,UAAU,GAAG,uBAAuB,CAAC,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAC9E,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,0BAA0B,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,SAAS,CAAC;AAC9F,CAAC"}
1
+ {"version":3,"file":"external-purity-summary.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-purity-summary.ts"],"names":[],"mappings":"AAAA,OAiBO,UAAU,CAAC;AAElB,OAAiC,6BAA6B,CAAC;AAC/D,OAAwC,iCAAiC,CAAC"}
@@ -1,40 +1,4 @@
1
- import { Node as TsMorphNode } from 'ts-morph';
2
- import { arePureCallArguments, resolveImportedExpressionPath } from "../imported-expression-origin.js";
3
- import { exportPurityForOrigin } from "./external-purity-summary.js";
4
- function originForPureCall(expression, recurse, resolveOrigin) {
5
- const origin = resolveOrigin(expression.getExpression(), recurse);
6
- if (origin === undefined || !arePureCallArguments(expression.getArguments(), recurse)) {
7
- return undefined;
8
- }
9
- return exportPurityForOrigin(origin, expression.getSourceFile()) === 'pure-callable'
10
- ? origin
11
- : undefined;
12
- }
13
- function fluentOriginForCall(expression, recurse, resolveOrigin) {
14
- if (!TsMorphNode.isCallExpression(expression)) {
15
- return resolveImportedExpressionPath(expression);
16
- }
17
- return originForPureCall(expression, recurse, resolveOrigin);
18
- }
19
- function appendOriginPath(origin, segment) {
20
- return origin === undefined
21
- ? undefined
22
- : { from: origin.from, path: [...origin.path, segment] };
23
- }
24
- function propertyAccessOrigin(expression, recurse, resolveOrigin) {
25
- if (!TsMorphNode.isPropertyAccessExpression(expression)) {
26
- return undefined;
27
- }
28
- return appendOriginPath(fluentOriginForCall(expression.getExpression(), recurse, resolveOrigin), expression.getName());
29
- }
30
- function externalCalleeOrigin(expression, recurse) {
31
- const directOrigin = resolveImportedExpressionPath(expression);
32
- if (directOrigin !== undefined) {
33
- return directOrigin;
34
- }
35
- return propertyAccessOrigin(expression, recurse, externalCalleeOrigin);
36
- }
37
- export function externalCallIsPure(expression, recurse) {
38
- return originForPureCall(expression, recurse, externalCalleeOrigin) !== undefined;
39
- }
1
+ import 'ts-morph';
2
+ import "../imported-expression-origin.js";
3
+ import "./external-purity-summary.js";
40
4
  //# sourceMappingURL=external-purity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-purity.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-purity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,WAAW,EAAwC,MAAM,UAAU,CAAC;AACrF,OAAO,EACH,oBAAoB,EACpB,6BAA6B,EAGhC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAOrE,SAAS,iBAAiB,CACt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C;AAED,SAAS,oBAAoB,CACzB,UAAsB,EACtB,OAAgC;IAEhC,MAAM,YAAY,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;IAC/D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,YAAY,CAAC;IACxB,CAAC;IACD,OAAO,oBAAoB,CAAC,UAAU,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,kBAAkB,CAC9B,UAA0B,EAC1B,OAAgC;IAEhC,OAAO,iBAAiB,CAAC,UAAU,EAAE,OAAO,EAAE,oBAAoB,CAAC,KAAK,SAAS,CAAC;AACtF,CAAC"}
1
+ {"version":3,"file":"external-purity.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-purity.ts"],"names":[],"mappings":"AAAA,OAA0E,UAAU,CAAC;AACrF,OAKO,kCAAkC,CAAC;AAC1C,OAAsC,8BAA8B,CAAC"}
@@ -1,28 +1,3 @@
1
- import { classifySideEffects } from "../side-effect-classifier.js";
2
- import { isDeclarationCodeTargetPath, isRuntimeCodeTargetPath } from "./runtime-code.js";
3
- function moduleKindForTargetPath(targetFilePath) {
4
- if (isDeclarationCodeTargetPath(targetFilePath)) {
5
- return 'declaration';
6
- }
7
- if (isRuntimeCodeTargetPath(targetFilePath)) {
8
- return 'runtime';
9
- }
10
- if (targetFilePath.endsWith('.map')) {
11
- return 'source-map';
12
- }
13
- return targetFilePath.includes('.') ? 'asset' : 'other';
14
- }
15
- export function buildModuleAnalysis(input) {
16
- return {
17
- sourceFilePath: input.sourceFilePath,
18
- targetFilePath: input.targetFilePath,
19
- kind: moduleKindForTargetPath(input.targetFilePath),
20
- declarations: input.bindings.map(function (binding) {
21
- return { name: binding.name, exported: binding.isExported };
22
- }),
23
- effects: input.sourceFile === undefined
24
- ? []
25
- : classifySideEffects(input.sourceFile, input.deadCodeElimination)
26
- };
27
- }
1
+ import "../side-effect-classifier.js";
2
+ import "./runtime-code.js";
28
3
  //# sourceMappingURL=module-analysis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-analysis.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/module-analysis.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAyBzF,SAAS,uBAAuB,CAAC,cAAsB;IACnD,IAAI,2BAA2B,CAAC,cAAc,CAAC,EAAE,CAAC;QAC9C,OAAO,aAAa,CAAC;IACzB,CAAC;IACD,IAAI,uBAAuB,CAAC,cAAc,CAAC,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC;IACxB,CAAC;IACD,OAAO,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAA0B;IAC1D,OAAO;QACH,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,IAAI,EAAE,uBAAuB,CAAC,KAAK,CAAC,cAAc,CAAC;QACnD,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,OAAO;YAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QAChE,CAAC,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,UAAU,KAAK,SAAS;YACnC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,mBAAmB,CAAC;KACzE,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"module-analysis.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/module-analysis.ts"],"names":[],"mappings":"AAIA,OAAoC,8BAA8B,CAAC;AACnE,OAAqE,mBAAmB,CAAC"}
@@ -1,79 +1,2 @@
1
- import { isDeclarationCodeTargetPath, isRuntimeCodeTargetPath } from "./runtime-code.js";
2
- function rootSourceFilePaths(bundle) {
3
- const paths = new Set();
4
- for (const root of Object.values(bundle.roots)) {
5
- paths.add(root.js.sourceFilePath);
6
- if (root.declarationFile !== undefined) {
7
- paths.add(root.declarationFile.sourceFilePath);
8
- }
9
- }
10
- return paths;
11
- }
12
- function resourceHasSurvivingRuntime(resource) {
13
- return resource.analysis.sideEffectStatements.length > 0 || resource.analysis.survivingBindings.size > 0;
14
- }
15
- function shouldSeedResource(resource, rootPaths) {
16
- const { targetFilePath } = resource.fileDescription;
17
- return (rootPaths.has(resource.fileDescription.sourceFilePath) ||
18
- resource.isExplicitlyIncluded ||
19
- !isRuntimeCodeTargetPath(targetFilePath) && !isDeclarationCodeTargetPath(targetFilePath) ||
20
- resourceHasSurvivingRuntime(resource));
21
- }
22
- function indexResourcesBySourcePath(contents) {
23
- return new Map(contents.map(function (resource) {
24
- return [resource.fileDescription.sourceFilePath, resource];
25
- }));
26
- }
27
- function retentionSeeds(contents, rootPaths) {
28
- return contents
29
- .filter(function (resource) {
30
- return shouldSeedResource(resource, rootPaths);
31
- })
32
- .map(function (resource) {
33
- return resource.fileDescription.sourceFilePath;
34
- });
35
- }
36
- function retainedSourcePaths(bundle, contents) {
37
- const rootPaths = rootSourceFilePaths(bundle);
38
- const resourcesBySourcePath = indexResourcesBySourcePath(contents);
39
- const pending = Array.from(retentionSeeds(contents, rootPaths));
40
- const retained = new Set();
41
- function retain(sourceFilePath) {
42
- const resource = resourcesBySourcePath.get(sourceFilePath);
43
- if (resource !== undefined && !retained.has(sourceFilePath)) {
44
- retained.add(sourceFilePath);
45
- pending.push(...resource.directDependencies);
46
- }
47
- }
48
- for (const sourceFilePath of pending) {
49
- retain(sourceFilePath);
50
- }
51
- return retained;
52
- }
53
- function isPrunedResource(resource, retained) {
54
- return !retained.has(resource.fileDescription.sourceFilePath);
55
- }
56
- function prunedMapTargetPaths(contents, retained) {
57
- return new Set(contents
58
- .filter(function (resource) {
59
- return isPrunedResource(resource, retained);
60
- })
61
- .map(function (resource) {
62
- return `${resource.fileDescription.targetFilePath}.map`;
63
- }));
64
- }
65
- export function pruneContents(bundle, contents, transformationsEnabled) {
66
- if (!transformationsEnabled) {
67
- return contents;
68
- }
69
- const retained = retainedSourcePaths(bundle, contents);
70
- const prunedMapTargets = prunedMapTargetPaths(contents, retained);
71
- return contents.filter(function (resource) {
72
- if (resource.isExplicitlyIncluded) {
73
- return true;
74
- }
75
- return (retained.has(resource.fileDescription.sourceFilePath) &&
76
- !prunedMapTargets.has(resource.fileDescription.targetFilePath));
77
- });
78
- }
1
+ import "./runtime-code.js";
79
2
  //# sourceMappingURL=resource-retention.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-retention.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/resource-retention.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEzF,SAAS,mBAAmB,CAAC,MAAqC;IAC9D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7C,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACrC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,2BAA2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EAAE,QAAQ,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClE,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAU,QAAQ;QACrC,IAAI,QAAQ,CAAC,oBAAoB,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,CACH,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC;YACrD,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC,CACjE,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"resource-retention.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/resource-retention.ts"],"names":[],"mappings":"AACA,OAAqE,mBAAmB,CAAC"}
@@ -1,16 +1,2 @@
1
- import path from 'node:path';
2
- const runtimeCodeExtensions = new Set(['.cjs', '.cts', '.js', '.jsx', '.mjs', '.mts', '.ts', '.tsx']);
3
- const declarationCodeExtensions = ['.d.ts', '.d.cts', '.d.mts'];
4
- export function isDeclarationCodeTargetPath(targetFilePath) {
5
- return declarationCodeExtensions.some(function (extension) {
6
- return targetFilePath.endsWith(extension);
7
- });
8
- }
9
- export function isRuntimeCodeTargetPath(targetFilePath) {
10
- return runtimeCodeExtensions.has(path.extname(targetFilePath)) &&
11
- !isDeclarationCodeTargetPath(targetFilePath);
12
- }
13
- export function isCodeTargetPath(targetFilePath) {
14
- return isRuntimeCodeTargetPath(targetFilePath) || isDeclarationCodeTargetPath(targetFilePath);
15
- }
1
+ import 'node:path';
16
2
  //# sourceMappingURL=runtime-code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-code.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/runtime-code.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAE,CAAC,CAAC;AACxG,MAAM,yBAAyB,GAAG,CAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAE,CAAC;AAElE,MAAM,UAAU,2BAA2B,CAAC,cAAsB;IAC9D,OAAO,yBAAyB,CAAC,IAAI,CAAC,UAAU,SAAS;QACrD,OAAO,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,cAAsB;IAC1D,OAAO,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1D,CAAC,2BAA2B,CAAC,cAAc,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,cAAsB;IACnD,OAAO,uBAAuB,CAAC,cAAc,CAAC,IAAI,2BAA2B,CAAC,cAAc,CAAC,CAAC;AAClG,CAAC"}
1
+ {"version":3,"file":"runtime-code.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/runtime-code.ts"],"names":[],"mappings":"AAAA,OAAiB,WAAW,CAAC"}
@@ -1,71 +1,6 @@
1
- import { declarationCompanionCandidates } from "../common/declaration-companion-paths.js";
2
- import { isCodeFile, isDeclarationCodeFile } from "../common/code-files.js";
3
- import { getEntryRootIds } from "../package-surface/root-registry.js";
4
- import { extractTopLevelBindings } from "./reachability/binding-extractor.js";
5
- import { buildReachabilityIndex } from "./reachability/reachability.js";
6
- function projectForResource(runtimeProject, declarationProject, resource) {
7
- return isDeclarationCodeFile(resource.fileDescription.targetFilePath) ? declarationProject : runtimeProject;
8
- }
9
- function loadResource(runtimeProject, declarationProject, resource) {
10
- if (!isCodeFile(resource.fileDescription.targetFilePath)) {
11
- return { resource };
12
- }
13
- const project = projectForResource(runtimeProject, declarationProject, resource);
14
- const sourceFile = project.createSourceFile(resource.fileDescription.sourceFilePath, resource.fileDescription.content, { overwrite: true });
15
- return { resource, sourceFile, bindings: extractTopLevelBindings(sourceFile) };
16
- }
17
- function buildFileBindings(loaded) {
18
- const result = [];
19
- for (const entry of loaded) {
20
- if (entry.sourceFile !== undefined) {
21
- result.push({
22
- sourceFilePath: entry.resource.fileDescription.sourceFilePath,
23
- sourceFile: entry.sourceFile,
24
- bindings: entry.bindings
25
- });
26
- }
27
- }
28
- return result;
29
- }
30
- function substitutionPublicModuleFilePathsFor(substitutionPublicModuleSourceFilePaths) {
31
- const paths = new Set();
32
- for (const sourceFilePath of substitutionPublicModuleSourceFilePaths) {
33
- paths.add(sourceFilePath);
34
- for (const companionPath of declarationCompanionCandidates(sourceFilePath)) {
35
- paths.add(companionPath);
36
- }
37
- }
38
- return paths;
39
- }
40
- function rootFilePathsFor(bundle, rootId) {
41
- const root = bundle.roots[rootId];
42
- if (root === undefined) {
43
- throw new Error(`Bundle "${bundle.name}" is missing root "${rootId}" referenced by its entry surface`);
44
- }
45
- return root.declarationFile === undefined
46
- ? [root.js.sourceFilePath]
47
- : [root.js.sourceFilePath, root.declarationFile.sourceFilePath];
48
- }
49
- function entryRootFilePathsFor(bundle, substitutionPublicModuleSourceFilePaths) {
50
- return new Set([
51
- ...Array.from(getEntryRootIds(bundle)).flatMap(function (rootId) {
52
- return rootFilePathsFor(bundle, rootId);
53
- }),
54
- ...substitutionPublicModuleFilePathsFor(substitutionPublicModuleSourceFilePaths)
55
- ]);
56
- }
57
- export function loadBundle(createProject, input) {
58
- const runtimeProject = createProject();
59
- const declarationProject = createProject();
60
- const loaded = input.bundle.contents.map(function (resource) {
61
- return loadResource(runtimeProject, declarationProject, resource);
62
- });
63
- const fileBindings = buildFileBindings(loaded);
64
- const reachability = buildReachabilityIndex({
65
- files: fileBindings,
66
- entryPointFilePaths: entryRootFilePathsFor(input.bundle, input.substitutionPublicModuleSourceFilePaths),
67
- deadCodeElimination: input.deadCodeElimination
68
- });
69
- return { input, loaded, fileBindings, reachability };
70
- }
1
+ import "../common/declaration-companion-paths.js";
2
+ import "../common/code-files.js";
3
+ import "../package-surface/root-registry.js";
4
+ import "./reachability/binding-extractor.js";
5
+ import "./reachability/reachability.js";
71
6
  //# sourceMappingURL=load-bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-bundle.js","sourceRoot":"","sources":["../../../../source/dead-code-eliminator/load-bundle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAA0B,MAAM,qCAAqC,CAAC;AAEtG,OAAO,EAAE,sBAAsB,EAA0B,MAAM,gCAAgC,CAAC;AAwBhG,SAAS,kBAAkB,CACvB,cAAuB,EACvB,kBAA2B,EAC3B,QAA8B;IAE9B,OAAO,qBAAqB,CAAC,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,cAAc,CAAC;AAChH,CAAC;AAED,SAAS,YAAY,CACjB,cAAuB,EACvB,kBAA2B,EAC3B,QAA8B;IAE9B,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,CAAC;QACvD,OAAO,EAAE,QAAQ,EAAE,CAAC;IACxB,CAAC;IACD,MAAM,OAAO,GAAG,kBAAkB,CAAC,cAAc,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IACjF,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CACvC,QAAQ,CAAC,eAAe,CAAC,cAAc,EACvC,QAAQ,CAAC,eAAe,CAAC,OAAO,EAChC,EAAE,SAAS,EAAE,IAAI,EAAE,CAC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