@atlaspack/core 2.16.2-canary.37 → 2.16.2-canary.371

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 (367) hide show
  1. package/CHANGELOG.md +941 -0
  2. package/dist/AssetGraph.js +591 -0
  3. package/dist/Atlaspack.js +666 -0
  4. package/dist/AtlaspackConfig.js +324 -0
  5. package/dist/AtlaspackConfig.schema.js +117 -0
  6. package/dist/BundleGraph.js +1740 -0
  7. package/dist/CommittedAsset.js +142 -0
  8. package/dist/Dependency.js +125 -0
  9. package/dist/Environment.js +132 -0
  10. package/dist/EnvironmentManager.js +108 -0
  11. package/dist/IdentifierRegistry.js +38 -0
  12. package/dist/InternalConfig.js +37 -0
  13. package/dist/PackagerRunner.js +545 -0
  14. package/dist/ReporterRunner.js +151 -0
  15. package/dist/RequestTracker.js +1360 -0
  16. package/dist/SymbolPropagation.js +620 -0
  17. package/dist/TargetDescriptor.schema.js +143 -0
  18. package/dist/Transformation.js +514 -0
  19. package/dist/UncommittedAsset.js +315 -0
  20. package/dist/Validation.js +196 -0
  21. package/dist/applyRuntimes.js +383 -0
  22. package/dist/assetUtils.js +169 -0
  23. package/dist/atlaspack-v3/AtlaspackV3.js +74 -0
  24. package/dist/atlaspack-v3/NapiWorkerPool.js +81 -0
  25. package/dist/atlaspack-v3/fs.js +52 -0
  26. package/dist/atlaspack-v3/index.js +25 -0
  27. package/dist/atlaspack-v3/jsCallable.js +16 -0
  28. package/dist/atlaspack-v3/worker/compat/asset-symbols.js +190 -0
  29. package/dist/atlaspack-v3/worker/compat/bitflags.js +98 -0
  30. package/dist/atlaspack-v3/worker/compat/dependency.js +43 -0
  31. package/dist/atlaspack-v3/worker/compat/environment.js +57 -0
  32. package/dist/atlaspack-v3/worker/compat/index.js +25 -0
  33. package/dist/atlaspack-v3/worker/compat/mutable-asset.js +152 -0
  34. package/dist/atlaspack-v3/worker/compat/plugin-config.js +64 -0
  35. package/dist/atlaspack-v3/worker/compat/plugin-logger.js +26 -0
  36. package/dist/atlaspack-v3/worker/compat/plugin-options.js +137 -0
  37. package/dist/atlaspack-v3/worker/compat/plugin-tracer.js +10 -0
  38. package/dist/atlaspack-v3/worker/compat/target.js +14 -0
  39. package/dist/atlaspack-v3/worker/side-effect-detector.js +243 -0
  40. package/dist/atlaspack-v3/worker/worker.js +381 -0
  41. package/dist/constants.js +17 -0
  42. package/dist/dumpGraphToGraphViz.js +281 -0
  43. package/dist/index.js +62 -0
  44. package/dist/loadAtlaspackPlugin.js +128 -0
  45. package/dist/loadDotEnv.js +41 -0
  46. package/dist/projectPath.js +83 -0
  47. package/dist/public/Asset.js +279 -0
  48. package/dist/public/Bundle.js +224 -0
  49. package/dist/public/BundleGraph.js +371 -0
  50. package/dist/public/BundleGroup.js +53 -0
  51. package/dist/public/Config.js +286 -0
  52. package/dist/public/Dependency.js +138 -0
  53. package/dist/public/Environment.js +278 -0
  54. package/dist/public/MutableBundleGraph.js +277 -0
  55. package/dist/public/PluginOptions.js +80 -0
  56. package/dist/public/Symbols.js +248 -0
  57. package/dist/public/Target.js +69 -0
  58. package/dist/registerCoreWithSerializer.js +38 -0
  59. package/dist/requests/AssetGraphRequest.js +439 -0
  60. package/dist/requests/AssetGraphRequestRust.js +273 -0
  61. package/dist/requests/AssetRequest.js +130 -0
  62. package/dist/requests/AtlaspackBuildRequest.js +92 -0
  63. package/dist/requests/AtlaspackConfigRequest.js +493 -0
  64. package/dist/requests/BundleGraphRequest.js +447 -0
  65. package/dist/requests/ConfigRequest.js +246 -0
  66. package/dist/requests/DevDepRequest.js +204 -0
  67. package/dist/requests/EntryRequest.js +314 -0
  68. package/dist/requests/PackageRequest.js +72 -0
  69. package/dist/requests/PathRequest.js +349 -0
  70. package/dist/requests/TargetRequest.js +1311 -0
  71. package/dist/requests/ValidationRequest.js +49 -0
  72. package/dist/requests/WriteBundleRequest.js +254 -0
  73. package/dist/requests/WriteBundlesRequest.js +184 -0
  74. package/dist/requests/asset-graph-diff.js +128 -0
  75. package/dist/requests/asset-graph-dot.js +131 -0
  76. package/dist/resolveOptions.js +269 -0
  77. package/dist/rustWorkerThreadDylibHack.js +19 -0
  78. package/dist/serializerCore.browser.js +43 -0
  79. package/dist/summarizeRequest.js +39 -0
  80. package/dist/types.js +31 -0
  81. package/dist/utils.js +172 -0
  82. package/dist/worker.js +123 -0
  83. package/lib/AssetGraph.js +111 -14
  84. package/lib/Atlaspack.js +94 -41
  85. package/lib/AtlaspackConfig.js +15 -3
  86. package/lib/AtlaspackConfig.schema.js +16 -5
  87. package/lib/BundleGraph.js +197 -32
  88. package/lib/CommittedAsset.js +7 -1
  89. package/lib/Dependency.js +8 -2
  90. package/lib/Environment.js +15 -8
  91. package/lib/EnvironmentManager.js +143 -0
  92. package/lib/IdentifierRegistry.js +1 -3
  93. package/lib/InternalConfig.js +3 -2
  94. package/lib/PackagerRunner.js +90 -27
  95. package/lib/ReporterRunner.js +6 -9
  96. package/lib/RequestTracker.js +266 -156
  97. package/lib/SymbolPropagation.js +42 -18
  98. package/lib/TargetDescriptor.schema.js +7 -1
  99. package/lib/Transformation.js +66 -15
  100. package/lib/UncommittedAsset.js +33 -12
  101. package/lib/Validation.js +18 -2
  102. package/lib/applyRuntimes.js +96 -4
  103. package/lib/assetUtils.js +15 -5
  104. package/lib/atlaspack-v3/AtlaspackV3.js +52 -14
  105. package/lib/atlaspack-v3/NapiWorkerPool.js +28 -1
  106. package/lib/atlaspack-v3/fs.js +3 -1
  107. package/lib/atlaspack-v3/index.js +28 -1
  108. package/lib/atlaspack-v3/jsCallable.js +0 -2
  109. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +7 -4
  110. package/lib/atlaspack-v3/worker/compat/bitflags.js +31 -25
  111. package/lib/atlaspack-v3/worker/compat/dependency.js +4 -1
  112. package/lib/atlaspack-v3/worker/compat/environment.js +10 -7
  113. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +15 -10
  114. package/lib/atlaspack-v3/worker/compat/plugin-config.js +13 -34
  115. package/lib/atlaspack-v3/worker/compat/plugin-options.js +16 -0
  116. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +3 -0
  117. package/lib/atlaspack-v3/worker/compat/target.js +2 -0
  118. package/lib/atlaspack-v3/worker/index.js +3 -0
  119. package/lib/atlaspack-v3/worker/side-effect-detector.js +215 -0
  120. package/lib/atlaspack-v3/worker/worker.js +199 -71
  121. package/lib/constants.js +0 -1
  122. package/lib/dumpGraphToGraphViz.js +71 -16
  123. package/lib/index.js +45 -1
  124. package/lib/loadDotEnv.js +4 -1
  125. package/lib/projectPath.js +5 -0
  126. package/lib/public/Asset.js +21 -11
  127. package/lib/public/Bundle.js +15 -16
  128. package/lib/public/BundleGraph.js +25 -22
  129. package/lib/public/BundleGroup.js +4 -5
  130. package/lib/public/Config.js +118 -17
  131. package/lib/public/Dependency.js +8 -6
  132. package/lib/public/Environment.js +12 -7
  133. package/lib/public/MutableBundleGraph.js +54 -12
  134. package/lib/public/PluginOptions.js +2 -2
  135. package/lib/public/Symbols.js +11 -11
  136. package/lib/public/Target.js +7 -6
  137. package/lib/registerCoreWithSerializer.js +5 -3
  138. package/lib/requests/AssetGraphRequest.js +74 -27
  139. package/lib/requests/AssetGraphRequestRust.js +140 -64
  140. package/lib/requests/AssetRequest.js +23 -6
  141. package/lib/requests/AtlaspackBuildRequest.js +43 -4
  142. package/lib/requests/AtlaspackConfigRequest.js +27 -16
  143. package/lib/requests/BundleGraphRequest.js +41 -24
  144. package/lib/requests/ConfigRequest.js +53 -4
  145. package/lib/requests/DevDepRequest.js +31 -5
  146. package/lib/requests/EntryRequest.js +2 -0
  147. package/lib/requests/PackageRequest.js +16 -2
  148. package/lib/requests/PathRequest.js +24 -3
  149. package/lib/requests/TargetRequest.js +122 -57
  150. package/lib/requests/ValidationRequest.js +5 -1
  151. package/lib/requests/WriteBundleRequest.js +39 -11
  152. package/lib/requests/WriteBundlesRequest.js +51 -4
  153. package/lib/requests/asset-graph-diff.js +12 -7
  154. package/lib/requests/asset-graph-dot.js +1 -7
  155. package/lib/resolveOptions.js +38 -11
  156. package/lib/rustWorkerThreadDylibHack.js +0 -1
  157. package/lib/types/AssetGraph.d.ts +80 -0
  158. package/lib/types/Atlaspack.d.ts +52 -0
  159. package/lib/types/AtlaspackConfig.d.ts +65 -0
  160. package/lib/types/AtlaspackConfig.schema.d.ts +53 -0
  161. package/lib/types/BundleGraph.d.ts +184 -0
  162. package/lib/types/CommittedAsset.d.ts +23 -0
  163. package/lib/types/Dependency.d.ts +44 -0
  164. package/lib/types/Environment.d.ts +11 -0
  165. package/lib/types/EnvironmentManager.d.ts +37 -0
  166. package/lib/types/IdentifierRegistry.d.ts +6 -0
  167. package/lib/types/InternalConfig.d.ts +23 -0
  168. package/lib/types/PackagerRunner.d.ts +85 -0
  169. package/lib/types/ReporterRunner.d.ts +25 -0
  170. package/lib/types/RequestTracker.d.ts +385 -0
  171. package/lib/types/SymbolPropagation.d.ts +11 -0
  172. package/lib/types/TargetDescriptor.schema.d.ts +5 -0
  173. package/lib/types/Transformation.d.ts +72 -0
  174. package/lib/types/UncommittedAsset.d.ts +61 -0
  175. package/lib/types/Validation.d.ts +37 -0
  176. package/lib/types/applyRuntimes.d.ts +25 -0
  177. package/lib/types/assetUtils.d.ts +42 -0
  178. package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +34 -0
  179. package/lib/types/atlaspack-v3/NapiWorkerPool.d.ts +13 -0
  180. package/lib/types/atlaspack-v3/fs.d.ts +12 -0
  181. package/lib/types/atlaspack-v3/index.d.ts +6 -0
  182. package/lib/types/atlaspack-v3/jsCallable.d.ts +1 -0
  183. package/lib/types/atlaspack-v3/worker/compat/asset-symbols.d.ts +51 -0
  184. package/lib/types/atlaspack-v3/worker/compat/bitflags.d.ts +14 -0
  185. package/lib/types/atlaspack-v3/worker/compat/dependency.d.ts +25 -0
  186. package/lib/types/atlaspack-v3/worker/compat/environment.d.ts +27 -0
  187. package/{src/atlaspack-v3/worker/compat/index.js → lib/types/atlaspack-v3/worker/compat/index.d.ts} +0 -1
  188. package/lib/types/atlaspack-v3/worker/compat/mutable-asset.d.ts +49 -0
  189. package/lib/types/atlaspack-v3/worker/compat/plugin-config.d.ts +29 -0
  190. package/lib/types/atlaspack-v3/worker/compat/plugin-logger.d.ts +9 -0
  191. package/lib/types/atlaspack-v3/worker/compat/plugin-options.d.ts +23 -0
  192. package/lib/types/atlaspack-v3/worker/compat/plugin-tracer.d.ts +5 -0
  193. package/lib/types/atlaspack-v3/worker/compat/target.d.ts +11 -0
  194. package/lib/types/atlaspack-v3/worker/side-effect-detector.d.ts +76 -0
  195. package/lib/types/atlaspack-v3/worker/worker.d.ts +80 -0
  196. package/lib/types/constants.d.ts +13 -0
  197. package/lib/types/dumpGraphToGraphViz.d.ts +10 -0
  198. package/lib/types/index.d.ts +8 -0
  199. package/lib/types/loadAtlaspackPlugin.d.ts +8 -0
  200. package/lib/types/loadDotEnv.d.ts +3 -0
  201. package/lib/types/projectPath.d.ts +19 -0
  202. package/lib/types/public/Asset.d.ts +74 -0
  203. package/lib/types/public/Bundle.d.ts +45 -0
  204. package/lib/types/public/BundleGraph.d.ts +72 -0
  205. package/lib/types/public/BundleGroup.d.ts +12 -0
  206. package/lib/types/public/Config.d.ts +75 -0
  207. package/lib/types/public/Dependency.d.ts +32 -0
  208. package/lib/types/public/Environment.d.ts +34 -0
  209. package/lib/types/public/MutableBundleGraph.d.ts +26 -0
  210. package/lib/types/public/PluginOptions.d.ts +25 -0
  211. package/lib/types/public/Symbols.d.ts +81 -0
  212. package/lib/types/public/Target.d.ts +16 -0
  213. package/lib/types/registerCoreWithSerializer.d.ts +2 -0
  214. package/lib/types/requests/AssetGraphRequest.d.ts +76 -0
  215. package/lib/types/requests/AssetGraphRequestRust.d.ts +21 -0
  216. package/lib/types/requests/AssetRequest.d.ts +16 -0
  217. package/lib/types/requests/AtlaspackBuildRequest.d.ts +33 -0
  218. package/lib/types/requests/AtlaspackConfigRequest.d.ts +45 -0
  219. package/lib/types/requests/BundleGraphRequest.d.ts +28 -0
  220. package/lib/types/requests/ConfigRequest.d.ts +67 -0
  221. package/lib/types/requests/DevDepRequest.d.ts +30 -0
  222. package/lib/types/requests/EntryRequest.d.ts +36 -0
  223. package/lib/types/requests/PackageRequest.d.ts +27 -0
  224. package/lib/types/requests/PathRequest.d.ts +48 -0
  225. package/lib/types/requests/TargetRequest.d.ts +48 -0
  226. package/lib/types/requests/ValidationRequest.d.ts +20 -0
  227. package/lib/types/requests/WriteBundleRequest.d.ts +28 -0
  228. package/lib/types/requests/WriteBundlesRequest.d.ts +32 -0
  229. package/lib/types/requests/asset-graph-diff.d.ts +1 -0
  230. package/lib/types/requests/asset-graph-dot.d.ts +9 -0
  231. package/lib/types/resolveOptions.d.ts +3 -0
  232. package/lib/types/rustWorkerThreadDylibHack.d.ts +9 -0
  233. package/lib/types/serializerCore.browser.d.ts +3 -0
  234. package/lib/types/summarizeRequest.d.ts +10 -0
  235. package/lib/types/types.d.ts +495 -0
  236. package/lib/types/utils.d.ts +23 -0
  237. package/lib/types/worker.d.ts +44 -0
  238. package/lib/types.js +8 -1
  239. package/lib/utils.js +17 -2
  240. package/lib/worker.js +30 -14
  241. package/package.json +25 -35
  242. package/src/{AssetGraph.js → AssetGraph.ts} +156 -52
  243. package/src/{Atlaspack.js → Atlaspack.ts} +134 -67
  244. package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +25 -19
  245. package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +78 -54
  246. package/src/{BundleGraph.js → BundleGraph.ts} +383 -140
  247. package/src/{CommittedAsset.js → CommittedAsset.ts} +15 -13
  248. package/src/{Dependency.js → Dependency.ts} +59 -42
  249. package/src/{Environment.js → Environment.ts} +24 -15
  250. package/src/EnvironmentManager.ts +154 -0
  251. package/src/{IdentifierRegistry.js → IdentifierRegistry.ts} +1 -4
  252. package/src/{InternalConfig.js → InternalConfig.ts} +22 -23
  253. package/src/{PackagerRunner.js → PackagerRunner.ts} +179 -87
  254. package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
  255. package/src/{RequestTracker.js → RequestTracker.ts} +572 -357
  256. package/src/{SymbolPropagation.js → SymbolPropagation.ts} +165 -57
  257. package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +7 -1
  258. package/src/{Transformation.js → Transformation.ts} +110 -65
  259. package/src/{UncommittedAsset.js → UncommittedAsset.ts} +60 -39
  260. package/src/{Validation.js → Validation.ts} +32 -17
  261. package/src/{applyRuntimes.js → applyRuntimes.ts} +133 -26
  262. package/src/{assetUtils.js → assetUtils.ts} +49 -36
  263. package/src/atlaspack-v3/AtlaspackV3.ts +143 -0
  264. package/src/atlaspack-v3/NapiWorkerPool.ts +91 -0
  265. package/src/atlaspack-v3/{fs.js → fs.ts} +3 -4
  266. package/src/atlaspack-v3/{index.js → index.ts} +3 -4
  267. package/src/atlaspack-v3/jsCallable.ts +14 -0
  268. package/src/atlaspack-v3/worker/compat/{asset-symbols.js → asset-symbols.ts} +40 -30
  269. package/src/atlaspack-v3/worker/compat/bitflags.ts +102 -0
  270. package/src/atlaspack-v3/worker/compat/{dependency.js → dependency.ts} +13 -13
  271. package/src/atlaspack-v3/worker/compat/{environment.js → environment.ts} +13 -9
  272. package/src/atlaspack-v3/worker/compat/index.ts +9 -0
  273. package/src/atlaspack-v3/worker/compat/{mutable-asset.js → mutable-asset.ts} +21 -20
  274. package/src/atlaspack-v3/worker/compat/{plugin-config.js → plugin-config.ts} +25 -56
  275. package/src/atlaspack-v3/worker/compat/{plugin-logger.js → plugin-logger.ts} +0 -2
  276. package/src/atlaspack-v3/worker/compat/{plugin-options.js → plugin-options.ts} +19 -5
  277. package/src/atlaspack-v3/worker/compat/{plugin-tracer.js → plugin-tracer.ts} +2 -2
  278. package/src/atlaspack-v3/worker/compat/{target.js → target.ts} +3 -4
  279. package/src/atlaspack-v3/worker/index.js +2 -1
  280. package/src/atlaspack-v3/worker/side-effect-detector.ts +298 -0
  281. package/src/atlaspack-v3/worker/worker.ts +531 -0
  282. package/src/{constants.js → constants.ts} +0 -3
  283. package/src/{dumpGraphToGraphViz.js → dumpGraphToGraphViz.ts} +73 -28
  284. package/src/index.ts +18 -0
  285. package/src/{loadAtlaspackPlugin.js → loadAtlaspackPlugin.ts} +8 -9
  286. package/src/{loadDotEnv.js → loadDotEnv.ts} +2 -2
  287. package/src/{projectPath.js → projectPath.ts} +20 -9
  288. package/src/public/{Asset.js → Asset.ts} +41 -28
  289. package/src/public/{Bundle.js → Bundle.ts} +28 -29
  290. package/src/public/{BundleGraph.js → BundleGraph.ts} +103 -68
  291. package/src/public/{BundleGroup.js → BundleGroup.ts} +7 -10
  292. package/src/public/{Config.js → Config.ts} +171 -33
  293. package/src/public/{Dependency.js → Dependency.ts} +20 -17
  294. package/src/public/{Environment.js → Environment.ts} +28 -17
  295. package/src/public/{MutableBundleGraph.js → MutableBundleGraph.ts} +55 -24
  296. package/src/public/{PluginOptions.js → PluginOptions.ts} +6 -6
  297. package/src/public/{Symbols.js → Symbols.ts} +75 -36
  298. package/src/public/{Target.js → Target.ts} +10 -8
  299. package/src/{registerCoreWithSerializer.js → registerCoreWithSerializer.ts} +9 -7
  300. package/src/requests/{AssetGraphRequest.js → AssetGraphRequest.ts} +129 -80
  301. package/src/requests/AssetGraphRequestRust.ts +364 -0
  302. package/src/requests/{AssetRequest.js → AssetRequest.ts} +24 -18
  303. package/src/requests/AtlaspackBuildRequest.ts +163 -0
  304. package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +72 -58
  305. package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +97 -79
  306. package/src/requests/{ConfigRequest.js → ConfigRequest.ts} +110 -50
  307. package/src/requests/{DevDepRequest.js → DevDepRequest.ts} +60 -35
  308. package/src/requests/{EntryRequest.js → EntryRequest.ts} +36 -31
  309. package/src/requests/{PackageRequest.js → PackageRequest.ts} +34 -22
  310. package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
  311. package/src/requests/{TargetRequest.js → TargetRequest.ts} +260 -179
  312. package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
  313. package/src/requests/{WriteBundleRequest.js → WriteBundleRequest.ts} +77 -49
  314. package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +109 -37
  315. package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +25 -21
  316. package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
  317. package/src/{resolveOptions.js → resolveOptions.ts} +59 -25
  318. package/src/{rustWorkerThreadDylibHack.js → rustWorkerThreadDylibHack.ts} +1 -4
  319. package/src/{serializerCore.browser.js → serializerCore.browser.ts} +2 -3
  320. package/src/{summarizeRequest.js → summarizeRequest.ts} +17 -5
  321. package/src/types.ts +650 -0
  322. package/src/{utils.js → utils.ts} +52 -21
  323. package/src/{worker.js → worker.ts} +50 -42
  324. package/test/{AssetGraph.test.js → AssetGraph.test.ts} +37 -8
  325. package/test/{Atlaspack.test.js → Atlaspack.test.ts} +5 -10
  326. package/test/{AtlaspackConfig.test.js → AtlaspackConfig.test.ts} +0 -5
  327. package/test/{AtlaspackConfigRequest.test.js → AtlaspackConfigRequest.test.ts} +76 -16
  328. package/test/{BundleGraph.test.js → BundleGraph.test.ts} +8 -13
  329. package/test/{Dependency.test.js → Dependency.test.ts} +2 -3
  330. package/test/{EntryRequest.test.js → EntryRequest.test.ts} +1 -6
  331. package/test/Environment.test.ts +153 -0
  332. package/test/EnvironmentManager.test.ts +188 -0
  333. package/test/{IdentifierRegistry.test.js → IdentifierRegistry.test.ts} +2 -4
  334. package/test/{InternalAsset.test.js → InternalAsset.test.ts} +2 -7
  335. package/test/PackagerRunner.test.ts +0 -0
  336. package/test/{PublicAsset.test.js → PublicAsset.test.ts} +2 -7
  337. package/test/{PublicBundle.test.js → PublicBundle.test.ts} +1 -2
  338. package/test/{PublicDependency.test.js → PublicDependency.test.ts} +0 -2
  339. package/test/PublicEnvironment.test.ts +49 -0
  340. package/test/{PublicMutableBundleGraph.test.js → PublicMutableBundleGraph.test.ts} +6 -11
  341. package/test/{RequestTracker.test.js → RequestTracker.test.ts} +314 -59
  342. package/test/{SymbolPropagation.test.js → SymbolPropagation.test.ts} +124 -74
  343. package/test/{TargetRequest.test.js → TargetRequest.test.ts} +66 -92
  344. package/test/fixtures/config-with-reporters/.parcelrc +7 -0
  345. package/test/fixtures/custom-targets/package.json +6 -0
  346. package/test/public/Config.test.ts +104 -0
  347. package/test/requests/AssetGraphRequestRust.test.ts +443 -0
  348. package/test/requests/{ConfigRequest.test.js → ConfigRequest.test.ts} +202 -13
  349. package/test/requests/{DevDepRequest.test.js → DevDepRequest.test.ts} +0 -2
  350. package/test/{test-utils.js → test-utils.ts} +4 -11
  351. package/test/{utils.test.js → utils.test.ts} +1 -3
  352. package/tsconfig.json +60 -0
  353. package/tsconfig.tsbuildinfo +1 -0
  354. package/index.d.ts +0 -30
  355. package/src/atlaspack-v3/AtlaspackV3.js +0 -87
  356. package/src/atlaspack-v3/NapiWorkerPool.js +0 -53
  357. package/src/atlaspack-v3/jsCallable.js +0 -18
  358. package/src/atlaspack-v3/worker/compat/bitflags.js +0 -100
  359. package/src/atlaspack-v3/worker/worker.js +0 -362
  360. package/src/index.js +0 -13
  361. package/src/requests/AssetGraphRequestRust.js +0 -263
  362. package/src/requests/AtlaspackBuildRequest.js +0 -111
  363. package/src/types.js +0 -600
  364. package/test/Environment.test.js +0 -119
  365. package/test/PackagerRunner.test.js +0 -27
  366. package/test/PublicEnvironment.test.js +0 -27
  367. package/test/requests/AssetGraphRequestRust.test.js +0 -411
@@ -69,10 +69,17 @@ var _Environment2 = require("../public/Environment");
69
69
  var _utils2 = require("../utils");
70
70
  var _projectPath = require("../projectPath");
71
71
  var _RequestTracker = require("../RequestTracker");
72
+ var _EnvironmentManager = require("../EnvironmentManager");
73
+ function _featureFlags() {
74
+ const data = require("@atlaspack/feature-flags");
75
+ _featureFlags = function () {
76
+ return data;
77
+ };
78
+ return data;
79
+ }
72
80
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73
81
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
74
82
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
75
- // $FlowFixMe
76
83
  const DEFAULT_DIST_DIRNAME = 'dist';
77
84
  const JS_RE = /\.[mc]?js$/;
78
85
  const JS_EXTENSIONS = ['.js', '.mjs', '.cjs'];
@@ -122,6 +129,33 @@ async function run({
122
129
  }) {
123
130
  let targetResolver = new TargetResolver(api, (0, _utils2.optionsProxy)(options, api.invalidateOnOptionChange));
124
131
  let targets = await targetResolver.resolve((0, _projectPath.fromProjectPath)(options.projectRoot, input.packagePath), input.target);
132
+
133
+ // Filter targets based on allowExplicitTargetEntries feature flag
134
+ if ((0, _featureFlags().getFeatureFlag)('allowExplicitTargetEntries') && options.targets &&
135
+ // Only explicit targets are allowed (i.e. an object of targets)
136
+ !Array.isArray(options.targets)) {
137
+ // Check if ALL targets have sources - only apply new behavior if they do
138
+ const allTargetsHaveSources = targets.every(t => t.source);
139
+ if (allTargetsHaveSources) {
140
+ // Get the current entry file path relative to project root
141
+ const currentEntryPath = input.filePath;
142
+
143
+ // Filter targets to only include those whose source matches the current entry
144
+ targets = targets.filter(target => {
145
+ // Handle both string and array sources
146
+ const sources = Array.isArray(target.source) ? target.source : [target.source];
147
+
148
+ // Check if current entry matches any of the target sources
149
+ return sources.some(source => {
150
+ const targetSourcePath = (0, _projectPath.toProjectPath)(options.projectRoot, _path().default.resolve((0, _projectPath.fromProjectPath)(options.projectRoot, input.packagePath), (0, _nullthrows().default)(source, 'Source must be not be undefined when specified')));
151
+ return targetSourcePath === currentEntryPath;
152
+ });
153
+ });
154
+ } else {
155
+ // If not all targets have sources, fall back to old behavior (skip targets with sources)
156
+ targets = targets.filter(target => !target.source);
157
+ }
158
+ }
125
159
  assertTargetsAreNotEntries(targets, input, options);
126
160
  let configResult = (0, _nullthrows().default)(await api.runRequest((0, _AtlaspackConfigRequest.default)()));
127
161
  let atlaspackConfig = (0, _AtlaspackConfigRequest.getCachedAtlaspackConfig)(configResult, options);
@@ -170,6 +204,7 @@ class TargetResolver {
170
204
 
171
205
  // If an array of strings is passed, it's a filter on the resolved package
172
206
  // targets. Load them, and find the matching targets.
207
+ // @ts-expect-error TS2322
173
208
  targets = optionTargets.map(target => {
174
209
  // null means skipped.
175
210
  if (!packageTargets.has(target)) {
@@ -221,7 +256,8 @@ class TargetResolver {
221
256
  shouldOptimize: this.options.defaultTargetOptions.shouldOptimize && descriptor.optimize !== false,
222
257
  shouldScopeHoist: this.options.defaultTargetOptions.shouldScopeHoist && descriptor.scopeHoist !== false,
223
258
  sourceMap: normalizeSourceMap(this.options, descriptor.sourceMap),
224
- unstableSingleFileOutput: descriptor.__unstable_singleFileOutput
259
+ unstableSingleFileOutput: descriptor.__unstable_singleFileOutput,
260
+ customEnv: descriptor.env
225
261
  })
226
262
  };
227
263
  if (descriptor.distEntry != null) {
@@ -231,7 +267,17 @@ class TargetResolver {
231
267
  target.source = descriptor.source;
232
268
  }
233
269
  return target;
234
- }).filter(target => !skipTarget(target.name, exclusiveTarget, target.source));
270
+ }).filter(target => (0, _featureFlags().getFeatureFlag)('allowExplicitTargetEntries') && this.options.entries.length !== 0 || !skipTarget(target.name, exclusiveTarget, target.source));
271
+
272
+ // Apply allowExplicitTargetEntries filtering logic
273
+ if ((0, _featureFlags().getFeatureFlag)('allowExplicitTargetEntries')) {
274
+ // Check if ALL targets have sources - only apply new behavior if they do
275
+ const allTargetsHaveSources = targets.every(t => t.source);
276
+ if (!allTargetsHaveSources) {
277
+ // If not all targets have sources, fall back to old behavior (skip targets with sources)
278
+ targets = targets.filter(target => !target.source);
279
+ }
280
+ }
235
281
  }
236
282
  let serve = this.options.serveOptions;
237
283
  if (serve && targets.length > 0) {
@@ -245,7 +291,7 @@ class TargetResolver {
245
291
  }
246
292
  });
247
293
  }
248
- if (!_Environment2.BROWSER_ENVS.has(targets[0].env.context)) {
294
+ if (!_Environment2.BROWSER_ENVS.has((0, _EnvironmentManager.fromEnvironmentId)(targets[0].env).context)) {
249
295
  throw new (_diagnostic().default)({
250
296
  diagnostic: {
251
297
  message: `Only browser targets are supported in serve mode`,
@@ -268,6 +314,7 @@ class TargetResolver {
268
314
  env: (0, _Environment.createEnvironment)({
269
315
  context: 'browser',
270
316
  engines: {
317
+ // @ts-expect-error TS2322
271
318
  browsers: DEFAULT_ENGINES.browsers
272
319
  },
273
320
  shouldOptimize: this.options.defaultTargetOptions.shouldOptimize,
@@ -277,6 +324,7 @@ class TargetResolver {
277
324
  })
278
325
  }];
279
326
  } else {
327
+ // @ts-expect-error TS2322
280
328
  targets = Array.from(packageTargets.values()).filter(Boolean).filter(descriptor => {
281
329
  return descriptor && !skipTarget(descriptor.name, exclusiveTarget, descriptor.source);
282
330
  });
@@ -364,6 +412,7 @@ class TargetResolver {
364
412
  browsers: browserslistBrowsers
365
413
  };
366
414
  browsersLoc = {
415
+ // @ts-expect-error TS2353
367
416
  message: `(defined in ${_path().default.relative(process.cwd(), browserslistConfig)})`
368
417
  };
369
418
  }
@@ -384,8 +433,10 @@ class TargetResolver {
384
433
  if (context === 'browser' && pkgEngines.browsers == null) {
385
434
  pkgEngines = {
386
435
  ...pkgEngines,
436
+ // @ts-expect-error TS2322
387
437
  browsers: (defaultEngines === null || defaultEngines === void 0 ? void 0 : defaultEngines.browsers) ?? DEFAULT_ENGINES.browsers
388
438
  };
439
+ // @ts-expect-error TS2353
389
440
  browsersLoc = {
390
441
  message: '(default)'
391
442
  };
@@ -394,6 +445,7 @@ class TargetResolver {
394
445
  ...pkgEngines,
395
446
  node: (defaultEngines === null || defaultEngines === void 0 ? void 0 : defaultEngines.node) ?? DEFAULT_ENGINES.node
396
447
  };
448
+ // @ts-expect-error TS2353
397
449
  nodeLoc = {
398
450
  message: '(default)'
399
451
  };
@@ -480,6 +532,7 @@ class TargetResolver {
480
532
  _targetDist = pkg[targetName][pkg.name];
481
533
  pointer = `/${targetName}/${(0, _diagnostic().encodeJSONKeyComponent)(pkg.name)}`;
482
534
  } else {
535
+ // @ts-expect-error TS7053
483
536
  _targetDist = pkg[targetName];
484
537
  pointer = `/${targetName}`;
485
538
  }
@@ -510,15 +563,16 @@ class TargetResolver {
510
563
  targets.set(targetName, null);
511
564
  continue;
512
565
  }
513
- if (distEntry != null && !COMMON_TARGETS[targetName].match.test(distEntry)) {
514
- let contents = typeof pkgContents === 'string' ? pkgContents :
515
- // $FlowFixMe
516
- JSON.stringify(pkgContents, null, '\t');
517
- // $FlowFixMe
566
+ if (distEntry != null &&
567
+ // @ts-expect-error TS7053
568
+ !COMMON_TARGETS[targetName].match.test(distEntry)) {
569
+ let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
518
570
  let listFormat = new Intl.ListFormat('en-US', {
519
571
  type: 'disjunction'
520
572
  });
521
- let extensions = listFormat.format(COMMON_TARGETS[targetName].extensions);
573
+ let extensions = listFormat.format(
574
+ // @ts-expect-error TS7053
575
+ COMMON_TARGETS[targetName].extensions);
522
576
  let ext = _path().default.extname(distEntry);
523
577
  throw new (_diagnostic().default)({
524
578
  diagnostic: {
@@ -540,9 +594,7 @@ class TargetResolver {
540
594
  });
541
595
  }
542
596
  if (descriptor.outputFormat === 'global') {
543
- let contents = typeof pkgContents === 'string' ? pkgContents :
544
- // $FlowFixMe
545
- JSON.stringify(pkgContents, null, '\t');
597
+ let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
546
598
  throw new (_diagnostic().default)({
547
599
  diagnostic: {
548
600
  message: (0, _diagnostic().md)`The "global" output format is not supported in the "${targetName}" target.`,
@@ -561,13 +613,13 @@ class TargetResolver {
561
613
  }
562
614
  });
563
615
  }
564
- let [inferredOutputFormat, inferredOutputFormatField] = this.inferOutputFormat(distEntry, descriptor, targetName, pkg, pkgFilePath, pkgContents);
616
+ let [inferredOutputFormat, inferredOutputFormatField] = this.inferOutputFormat(distEntry, descriptor, targetName,
617
+ // @ts-expect-error TS2345
618
+ pkg, pkgFilePath, pkgContents);
565
619
  let outputFormat = descriptor.outputFormat ?? this.options.defaultTargetOptions.outputFormat ?? inferredOutputFormat ?? (targetName === 'module' ? 'esmodule' : 'commonjs');
566
620
  let isModule = outputFormat === 'esmodule';
567
621
  if (targetName === 'main' && outputFormat === 'esmodule' && inferredOutputFormat !== 'esmodule') {
568
- let contents = typeof pkgContents === 'string' ? pkgContents :
569
- // $FlowFixMe
570
- JSON.stringify(pkgContents, null, '\t');
622
+ let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
571
623
  throw new (_diagnostic().default)({
572
624
  diagnostic: {
573
625
  // prettier-ignore
@@ -593,9 +645,7 @@ class TargetResolver {
593
645
  });
594
646
  }
595
647
  if (descriptor.scopeHoist === false) {
596
- let contents = typeof pkgContents === 'string' ? pkgContents :
597
- // $FlowFixMe
598
- JSON.stringify(pkgContents, null, '\t');
648
+ let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
599
649
  throw new (_diagnostic().default)({
600
650
  diagnostic: {
601
651
  message: 'Scope hoisting cannot be disabled for library targets.',
@@ -622,6 +672,7 @@ class TargetResolver {
622
672
  publicUrl: descriptor.publicUrl ?? this.options.defaultTargetOptions.publicUrl,
623
673
  env: (0, _Environment.createEnvironment)({
624
674
  engines: descriptor.engines ?? pkgEngines,
675
+ // @ts-expect-error TS2322
625
676
  context,
626
677
  includeNodeModules: descriptor.includeNodeModules ?? false,
627
678
  outputFormat,
@@ -675,10 +726,13 @@ class TargetResolver {
675
726
  });
676
727
  }
677
728
  }
678
- let customTargets = Object.keys(pkgTargets).filter(targetName => !COMMON_TARGETS[targetName]);
729
+ let customTargets = Object.keys(pkgTargets).filter(
730
+ // @ts-expect-error TS7053
731
+ targetName => !COMMON_TARGETS[targetName]);
679
732
 
680
733
  // Custom targets
681
734
  for (let targetName of customTargets) {
735
+ // @ts-expect-error TS7053
682
736
  let distPath = pkg[targetName];
683
737
  let distDir;
684
738
  let distEntry;
@@ -697,9 +751,7 @@ class TargetResolver {
697
751
  };
698
752
  } else {
699
753
  if (typeof distPath !== 'string') {
700
- let contents = typeof pkgContents === 'string' ? pkgContents :
701
- // $FlowFixMe
702
- JSON.stringify(pkgContents, null, '\t');
754
+ let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
703
755
  throw new (_diagnostic().default)({
704
756
  diagnostic: {
705
757
  message: (0, _diagnostic().md)`Invalid distPath for target "${targetName}"`,
@@ -734,11 +786,11 @@ class TargetResolver {
734
786
  targets.set(targetName, null);
735
787
  continue;
736
788
  }
737
- let [inferredOutputFormat, inferredOutputFormatField] = this.inferOutputFormat(distEntry, descriptor, targetName, pkg, pkgFilePath, pkgContents);
789
+ let [inferredOutputFormat, inferredOutputFormatField] = this.inferOutputFormat(distEntry, descriptor, targetName,
790
+ // @ts-expect-error TS2345
791
+ pkg, pkgFilePath, pkgContents);
738
792
  if (descriptor.scopeHoist === false && descriptor.isLibrary) {
739
- let contents = typeof pkgContents === 'string' ? pkgContents :
740
- // $FlowFixMe
741
- JSON.stringify(pkgContents, null, '\t');
793
+ let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
742
794
  throw new (_diagnostic().default)({
743
795
  diagnostic: {
744
796
  message: 'Scope hoisting cannot be disabled for library targets.',
@@ -778,7 +830,8 @@ class TargetResolver {
778
830
  // Libraries are not optimized by default, users must explicitly configure this.
779
831
  isLibrary ? descriptor.optimize === true : descriptor.optimize !== false),
780
832
  shouldScopeHoist: shouldScopeHoist && descriptor.scopeHoist !== false,
781
- sourceMap: normalizeSourceMap(this.options, descriptor.sourceMap)
833
+ sourceMap: normalizeSourceMap(this.options, descriptor.sourceMap),
834
+ customEnv: descriptor.env
782
835
  }),
783
836
  loc: (0, _utils2.toInternalSourceLocation)(this.options.projectRoot, loc)
784
837
  });
@@ -838,6 +891,7 @@ class TargetResolver {
838
891
  publicUrl: this.options.defaultTargetOptions.publicUrl,
839
892
  env: (0, _Environment.createEnvironment)({
840
893
  engines: pkgEngines,
894
+ // @ts-expect-error TS2322
841
895
  context,
842
896
  outputFormat: this.options.defaultTargetOptions.outputFormat,
843
897
  isLibrary: this.options.defaultTargetOptions.isLibrary,
@@ -874,9 +928,7 @@ class TargetResolver {
874
928
  break;
875
929
  }
876
930
  if (descriptor.outputFormat && inferredOutputFormat && descriptor.outputFormat !== inferredOutputFormat) {
877
- let contents = typeof pkgContents === 'string' ? pkgContents :
878
- // $FlowFixMe
879
- JSON.stringify(pkgContents, null, '\t');
931
+ let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
880
932
  let expectedExtensions;
881
933
  switch (descriptor.outputFormat) {
882
934
  case 'esmodule':
@@ -889,7 +941,6 @@ class TargetResolver {
889
941
  expectedExtensions = ['.js'];
890
942
  break;
891
943
  }
892
- // $FlowFixMe
893
944
  let listFormat = new Intl.ListFormat('en-US', {
894
945
  type: 'disjunction'
895
946
  });
@@ -916,6 +967,8 @@ class TargetResolver {
916
967
  }
917
968
  });
918
969
  }
970
+
971
+ // @ts-expect-error TS2322
919
972
  return [inferredOutputFormat, inferredOutputFormatField];
920
973
  }
921
974
  }
@@ -930,7 +983,7 @@ function parseEngines(engines, pkgPath, pkgContents, prependKey, message) {
930
983
  filePath: pkgPath,
931
984
  prependKey
932
985
  }, '@atlaspack/core', message);
933
- // $FlowFixMe we just verified this
986
+ // @ts-expect-error TS2322
934
987
  return engines;
935
988
  }
936
989
  }
@@ -942,7 +995,7 @@ function parseDescriptor(targetName, descriptor, pkgPath, pkgContents) {
942
995
  prependKey: `/targets/${targetName}`
943
996
  }, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
944
997
 
945
- // $FlowFixMe we just verified this
998
+ // @ts-expect-error TS2322
946
999
  return descriptor;
947
1000
  }
948
1001
  function parsePackageDescriptor(targetName, descriptor, pkgPath, pkgContents) {
@@ -952,7 +1005,7 @@ function parsePackageDescriptor(targetName, descriptor, pkgPath, pkgContents) {
952
1005
  filePath: pkgPath,
953
1006
  prependKey: `/targets/${targetName}`
954
1007
  }, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
955
- // $FlowFixMe we just verified this
1008
+ // @ts-expect-error TS2322
956
1009
  return descriptor;
957
1010
  }
958
1011
  function parseCommonTargetDescriptor(targetName, descriptor, pkgPath, pkgContents) {
@@ -963,7 +1016,7 @@ function parseCommonTargetDescriptor(targetName, descriptor, pkgPath, pkgContent
963
1016
  prependKey: `/targets/${targetName}`
964
1017
  }, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
965
1018
 
966
- // $FlowFixMe we just verified this
1019
+ // @ts-expect-error TS2322
967
1020
  return descriptor;
968
1021
  }
969
1022
  function assertNoDuplicateTargets(options, targets, pkgFilePath, pkgContents) {
@@ -1012,7 +1065,9 @@ function assertNoDuplicateTargets(options, targets, pkgFilePath, pkgContents) {
1012
1065
  });
1013
1066
  }
1014
1067
  }
1015
- function normalizeSourceMap(options, sourceMap) {
1068
+ function normalizeSourceMap(options,
1069
+ // @ts-expect-error TS2304
1070
+ sourceMap) {
1016
1071
  if (options.defaultTargetOptions.sourceMaps) {
1017
1072
  if (typeof sourceMap === 'boolean') {
1018
1073
  return sourceMap ? {} : undefined;
@@ -1028,6 +1083,7 @@ function assertTargetsAreNotEntries(targets, input, options) {
1028
1083
  if (target.distEntry != null && (0, _projectPath.joinProjectPath)(target.distDir, target.distEntry) === input.filePath) {
1029
1084
  let loc = target.loc;
1030
1085
  let relativeEntry = _path().default.relative(process.cwd(), (0, _projectPath.fromProjectPath)(options.projectRoot, input.filePath));
1086
+ // @ts-expect-error TS2304
1031
1087
  let codeFrames = [];
1032
1088
  if (loc) {
1033
1089
  codeFrames.push({
@@ -1052,7 +1108,9 @@ function assertTargetsAreNotEntries(targets, input, options) {
1052
1108
  origin: '@atlaspack/core',
1053
1109
  message: `Target "${target.name}" is configured to overwrite entry "${relativeEntry}".`,
1054
1110
  codeFrames,
1055
- hints: [(COMMON_TARGETS[target.name] ? `The "${target.name}" field is an _output_ file path so that your build can be consumed by other tools. ` : '') + `Change the "${target.name}" field to point to an output file rather than your source code.`],
1111
+ hints: [
1112
+ // @ts-expect-error TS7053
1113
+ (COMMON_TARGETS[target.name] ? `The "${target.name}" field is an _output_ file path so that your build can be consumed by other tools. ` : '') + `Change the "${target.name}" field to point to an output file rather than your source code.`],
1056
1114
  documentationURL: 'https://parceljs.org/features/targets/'
1057
1115
  }
1058
1116
  });
@@ -1073,24 +1131,27 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1073
1131
 
1074
1132
  // Resolve relevant engines for context.
1075
1133
  let engines;
1076
- switch (target.env.context) {
1134
+ const env = (0, _EnvironmentManager.fromEnvironmentId)(target.env);
1135
+ switch (env.context) {
1077
1136
  case 'browser':
1078
1137
  case 'web-worker':
1079
1138
  case 'service-worker':
1080
1139
  case 'worklet':
1081
1140
  {
1082
- let browsers = target.env.engines.browsers;
1141
+ let browsers = env.engines.browsers;
1083
1142
  engines = Array.isArray(browsers) ? browsers.join(', ') : browsers;
1084
1143
  break;
1085
1144
  }
1086
1145
  case 'node':
1087
- engines = target.env.engines.node;
1146
+ engines = env.engines.node;
1088
1147
  break;
1089
1148
  case 'electron-main':
1090
1149
  case 'electron-renderer':
1091
- engines = target.env.engines.electron;
1150
+ engines = env.engines.electron;
1092
1151
  break;
1093
1152
  }
1153
+
1154
+ // @ts-expect-error TS2304
1094
1155
  let highlights = [];
1095
1156
  if (input.loc) {
1096
1157
  highlights.push((0, _diagnostic().convertSourceLocationToHighlight)(input.loc, 'entry defined here'));
@@ -1103,6 +1164,7 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1103
1164
  // Builds up map of code highlights for each defined/inferred path in the package.json.
1104
1165
  let jsonHighlights = new Map();
1105
1166
  for (let key in info) {
1167
+ // @ts-expect-error TS7053
1106
1168
  let keyInfo = info[key];
1107
1169
  let path = keyInfo.path || keyInfo.inferred;
1108
1170
  if (!path) {
@@ -1124,11 +1186,10 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1124
1186
  highlight.defined = (0, _diagnostic().md)`${key} defined here`;
1125
1187
  }
1126
1188
  if (keyInfo.inferred) {
1127
- highlight.inferred.push((0, _diagnostic().md)`${key} to be ${JSON.stringify(target.env[key])}`);
1189
+ // @ts-expect-error TS2345
1190
+ highlight.inferred.push((0, _diagnostic().md)`${key} to be ${JSON.stringify(env[key])}`);
1128
1191
  }
1129
1192
  }
1130
-
1131
- // $FlowFixMe
1132
1193
  let listFormat = new Intl.ListFormat('en-US');
1133
1194
 
1134
1195
  // Generate human friendly messages for each field.
@@ -1150,26 +1211,30 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1150
1211
 
1151
1212
  // Format includeNodeModules to be human readable.
1152
1213
  let includeNodeModules;
1153
- if (typeof target.env.includeNodeModules === 'boolean') {
1154
- includeNodeModules = String(target.env.includeNodeModules);
1155
- } else if (Array.isArray(target.env.includeNodeModules)) {
1156
- includeNodeModules = 'only ' + listFormat.format(target.env.includeNodeModules.map(m => JSON.stringify(m)));
1157
- } else if (target.env.includeNodeModules && typeof target.env.includeNodeModules === 'object') {
1158
- includeNodeModules = 'all except ' + listFormat.format(Object.entries(target.env.includeNodeModules).filter(([, v]) => v === false).map(([k]) => JSON.stringify(k)));
1214
+ if (typeof env.includeNodeModules === 'boolean') {
1215
+ includeNodeModules = String(env.includeNodeModules);
1216
+ } else if (Array.isArray(env.includeNodeModules)) {
1217
+ includeNodeModules = 'only ' + listFormat.format(env.includeNodeModules.map(m => JSON.stringify(m)));
1218
+ } else if (env.includeNodeModules && typeof env.includeNodeModules === 'object') {
1219
+ includeNodeModules = 'all except ' + listFormat.format(Object.entries(env.includeNodeModules).filter(([, v]) => v === false)
1220
+ // @ts-expect-error TS2345
1221
+ .map(([k]) => JSON.stringify(k)));
1159
1222
  }
1160
- let format = v => v.message != null ? _diagnostic().md.italic(v.message) : '';
1223
+ let format = v =>
1224
+ // @ts-expect-error TS2339
1225
+ v.message != null ? _diagnostic().md.italic(v.message) : '';
1161
1226
  _logger().default.verbose({
1162
1227
  origin: '@atlaspack/core',
1163
1228
  message: (0, _diagnostic().md)`**Target** "${target.name}"
1164
1229
 
1165
1230
  **Entry**: ${_path().default.relative(process.cwd(), (0, _projectPath.fromProjectPath)(options.projectRoot, input.filePath))}
1166
1231
  **Output**: ${_path().default.relative(process.cwd(), output)}
1167
- **Format**: ${target.env.outputFormat} ${format(info.outputFormat)}
1168
- **Context**: ${target.env.context} ${format(info.context)}
1232
+ **Format**: ${env.outputFormat} ${format(info.outputFormat)}
1233
+ **Context**: ${env.context} ${format(info.context)}
1169
1234
  **Engines**: ${engines || ''} ${format(info.engines)}
1170
- **Library Mode**: ${String(target.env.isLibrary)} ${format(info.isLibrary)}
1235
+ **Library Mode**: ${String(env.isLibrary)} ${format(info.isLibrary)}
1171
1236
  **Include Node Modules**: ${includeNodeModules} ${format(info.includeNodeModules)}
1172
- **Optimize**: ${String(target.env.shouldOptimize)} ${format(info.shouldOptimize)}`,
1237
+ **Optimize**: ${String(env.shouldOptimize)} ${format(info.shouldOptimize)}`,
1173
1238
  codeFrames: target.loc ? [{
1174
1239
  filePath: targetFilePath,
1175
1240
  codeHighlights: highlights
@@ -36,6 +36,7 @@ function createValidationRequest(input) {
36
36
  } = (0, _nullthrows().default)(await api.runRequest((0, _AtlaspackConfigRequest.default)()));
37
37
  let config = new _AtlaspackConfig.AtlaspackConfig(processedConfig, options);
38
38
  let trackedRequestsDesc = assetRequests.filter(request => {
39
+ // @ts-expect-error TS2345
39
40
  return config.getValidatorNames(request.filePath).length > 0;
40
41
  });
41
42
 
@@ -52,10 +53,13 @@ function createValidationRequest(input) {
52
53
  }
53
54
 
54
55
  // Schedule validations on the main thread for all validation plugins that implement "validateAll".
55
- promises.push(new _Validation.default({
56
+ promises.push(
57
+ // @ts-expect-error TS2345
58
+ new _Validation.default({
56
59
  requests: trackedRequestsDesc,
57
60
  options,
58
61
  config,
62
+ // @ts-expect-error TS2322
59
63
  report: _ReporterRunner.report,
60
64
  dedicatedThread: true
61
65
  }).run());
@@ -45,7 +45,6 @@ function _logger() {
45
45
  return data;
46
46
  }
47
47
  var _DevDepRequest = require("./DevDepRequest");
48
- var _AtlaspackConfig = require("../AtlaspackConfig");
49
48
  function _diagnostic() {
50
49
  const data = _interopRequireWildcard(require("@atlaspack/diagnostic"));
51
50
  _diagnostic = function () {
@@ -61,6 +60,14 @@ function _profiler() {
61
60
  return data;
62
61
  }
63
62
  var _RequestTracker = require("../RequestTracker");
63
+ function _featureFlags() {
64
+ const data = require("@atlaspack/feature-flags");
65
+ _featureFlags = function () {
66
+ return data;
67
+ };
68
+ return data;
69
+ }
70
+ var _EnvironmentManager = require("../EnvironmentManager");
64
71
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
65
72
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
66
73
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -79,6 +86,8 @@ function createWriteBundleRequest(input) {
79
86
  input
80
87
  };
81
88
  }
89
+
90
+ // @ts-expect-error TS7031
82
91
  async function run({
83
92
  input,
84
93
  options,
@@ -114,7 +123,8 @@ async function run({
114
123
  let cacheKeys = info.cacheKeys;
115
124
  let mapKey = cacheKeys.map;
116
125
  let fullPath = (0, _projectPath.fromProjectPath)(options.projectRoot, filePath);
117
- if (mapKey && bundle.env.sourceMap && !bundle.env.sourceMap.inline) {
126
+ const env = (0, _EnvironmentManager.fromEnvironmentId)(bundle.env);
127
+ if (mapKey && env.sourceMap && !env.sourceMap.inline) {
118
128
  api.invalidateOnFileDelete((0, _projectPath.toProjectPath)(options.projectRoot, fullPath + '.map'));
119
129
  }
120
130
  let dir = _path().default.dirname(fullPath);
@@ -134,10 +144,14 @@ async function run({
134
144
  contentStream = (0, _utils().blobToStream)(await options.cache.getBlob(cacheKeys.content));
135
145
  }
136
146
  let size = 0;
137
- contentStream = contentStream.pipe(new (_utils().TapStream)(buf => {
147
+ contentStream = contentStream.pipe(
148
+ // @ts-expect-error TS2554
149
+ new (_utils().TapStream)(buf => {
138
150
  size += buf.length;
139
151
  }));
140
- let configResult = (0, _nullthrows().default)(await api.runRequest((0, _AtlaspackConfigRequest.default)()));
152
+ let configResult = (0, _nullthrows().default)(
153
+ // @ts-expect-error TS2347
154
+ await api.runRequest((0, _AtlaspackConfigRequest.default)()));
141
155
  let config = (0, _AtlaspackConfigRequest.getCachedAtlaspackConfig)(configResult, options);
142
156
  let {
143
157
  devDeps,
@@ -145,11 +159,14 @@ async function run({
145
159
  } = await (0, _DevDepRequest.getDevDepRequests)(api);
146
160
  (0, _DevDepRequest.invalidateDevDeps)(invalidDevDeps, options, config);
147
161
  await writeFiles(contentStream, info, hashRefToNameHash, options, config, outputFS, filePath, writeOptions, devDeps, api);
148
- if (mapKey && bundle.env.sourceMap && !bundle.env.sourceMap.inline && (await options.cache.has(mapKey))) {
149
- await writeFiles((0, _utils().blobToStream)(await options.cache.getBlob(mapKey)), info, hashRefToNameHash, options, config, outputFS, (0, _projectPath.toProjectPathUnsafe)((0, _projectPath.fromProjectPathRelative)(filePath) + '.map'), writeOptions, devDeps, api);
162
+ const hasSourceMap = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? await options.cache.hasLargeBlob(mapKey) : await options.cache.has(mapKey);
163
+ if (mapKey && env.sourceMap && !env.sourceMap.inline && hasSourceMap) {
164
+ const mapEntry = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? await options.cache.getLargeBlob(mapKey) : await options.cache.getBlob(mapKey);
165
+ await writeFiles((0, _utils().blobToStream)(mapEntry), info, hashRefToNameHash, options, config, outputFS, (0, _projectPath.toProjectPathUnsafe)((0, _projectPath.fromProjectPathRelative)(filePath) + '.map'), writeOptions, devDeps, api);
150
166
  }
151
167
  let res = {
152
168
  filePath,
169
+ bundleId: bundle.id,
153
170
  type: info.type,
154
171
  stats: {
155
172
  size,
@@ -159,17 +176,23 @@ async function run({
159
176
  api.storeResult(res);
160
177
  return res;
161
178
  }
162
- async function writeFiles(inputStream, info, hashRefToNameHash, options, config, outputFS, filePath, writeOptions, devDeps, api) {
179
+ async function writeFiles(
180
+ // @ts-expect-error TS2503
181
+ inputStream, info, hashRefToNameHash, options, config, outputFS, filePath, writeOptions, devDeps, api) {
163
182
  let compressors = await config.getCompressors((0, _projectPath.fromProjectPathRelative)(filePath));
164
183
  let fullPath = (0, _projectPath.fromProjectPath)(options.projectRoot, filePath);
165
184
  let stream = info.hashReferences.length ? inputStream.pipe(replaceStream(hashRefToNameHash)) : inputStream;
166
185
  let promises = [];
167
186
  for (let compressor of compressors) {
168
- promises.push(runCompressor(compressor, cloneStream(stream), options, outputFS, fullPath, writeOptions, devDeps, api));
187
+ promises.push(
188
+ // @ts-expect-error TS2345
189
+ runCompressor(compressor, cloneStream(stream), options, outputFS, fullPath, writeOptions, devDeps, api));
169
190
  }
170
191
  await Promise.all(promises);
171
192
  }
172
- async function runCompressor(compressor, stream, options, outputFS, filePath, writeOptions, devDeps, api) {
193
+ async function runCompressor(compressor,
194
+ // @ts-expect-error TS2503
195
+ stream, options, outputFS, filePath, writeOptions, devDeps, api) {
173
196
  let measurement;
174
197
  try {
175
198
  measurement = _profiler().tracer.createMeasurement(compressor.name, 'compress', _path().default.relative(options.projectRoot, filePath));
@@ -186,7 +209,9 @@ async function runCompressor(compressor, stream, options, outputFS, filePath, wr
186
209
  });
187
210
  if (res != null) {
188
211
  await new Promise((resolve, reject) => (0, _stream().pipeline)(res.stream, outputFS.createWriteStream(filePath + (res.type != null ? '.' + res.type : ''), writeOptions), err => {
189
- if (err) reject(err);else resolve();
212
+ if (err) reject(err);
213
+ // @ts-expect-error TS2794
214
+ else resolve();
190
215
  }));
191
216
  }
192
217
  } catch (err) {
@@ -241,12 +266,15 @@ function replaceStream(hashRefToNameHash) {
241
266
  }
242
267
  });
243
268
  }
269
+
270
+ // @ts-expect-error TS2503
244
271
  function cloneStream(readable) {
245
272
  let res = new (_stream().Readable)();
246
- // $FlowFixMe
247
273
  res._read = () => {};
274
+ // @ts-expect-error TS7006
248
275
  readable.on('data', chunk => res.push(chunk));
249
276
  readable.on('end', () => res.push(null));
277
+ // @ts-expect-error TS7006
250
278
  readable.on('error', err => res.emit('error', err));
251
279
  return res;
252
280
  }