@atlaspack/core 2.16.2-canary.21 → 2.16.2-canary.211

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 (355) hide show
  1. package/CHANGELOG.md +561 -0
  2. package/dist/AssetGraph.js +591 -0
  3. package/dist/Atlaspack.js +656 -0
  4. package/dist/AtlaspackConfig.js +324 -0
  5. package/dist/AtlaspackConfig.schema.js +108 -0
  6. package/dist/BundleGraph.js +1628 -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 +531 -0
  14. package/dist/ReporterRunner.js +151 -0
  15. package/dist/RequestTracker.js +1368 -0
  16. package/dist/SymbolPropagation.js +617 -0
  17. package/dist/TargetDescriptor.schema.js +143 -0
  18. package/dist/Transformation.js +487 -0
  19. package/dist/UncommittedAsset.js +315 -0
  20. package/dist/Validation.js +196 -0
  21. package/dist/applyRuntimes.js +305 -0
  22. package/dist/assetUtils.js +168 -0
  23. package/dist/atlaspack-v3/AtlaspackV3.js +70 -0
  24. package/dist/atlaspack-v3/NapiWorkerPool.js +57 -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 +94 -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 +76 -0
  35. package/dist/atlaspack-v3/worker/compat/plugin-logger.js +26 -0
  36. package/dist/atlaspack-v3/worker/compat/plugin-options.js +122 -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/worker.js +292 -0
  40. package/dist/constants.js +17 -0
  41. package/dist/dumpGraphToGraphViz.js +281 -0
  42. package/dist/index.js +62 -0
  43. package/dist/loadAtlaspackPlugin.js +128 -0
  44. package/dist/loadDotEnv.js +41 -0
  45. package/dist/projectPath.js +83 -0
  46. package/dist/public/Asset.js +279 -0
  47. package/dist/public/Bundle.js +224 -0
  48. package/dist/public/BundleGraph.js +359 -0
  49. package/dist/public/BundleGroup.js +53 -0
  50. package/dist/public/Config.js +286 -0
  51. package/dist/public/Dependency.js +138 -0
  52. package/dist/public/Environment.js +278 -0
  53. package/dist/public/MutableBundleGraph.js +277 -0
  54. package/dist/public/PluginOptions.js +80 -0
  55. package/dist/public/Symbols.js +248 -0
  56. package/dist/public/Target.js +69 -0
  57. package/dist/registerCoreWithSerializer.js +38 -0
  58. package/dist/requests/AssetGraphRequest.js +429 -0
  59. package/dist/requests/AssetGraphRequestRust.js +246 -0
  60. package/dist/requests/AssetRequest.js +130 -0
  61. package/dist/requests/AtlaspackBuildRequest.js +60 -0
  62. package/dist/requests/AtlaspackConfigRequest.js +490 -0
  63. package/dist/requests/BundleGraphRequest.js +441 -0
  64. package/dist/requests/ConfigRequest.js +222 -0
  65. package/dist/requests/DevDepRequest.js +204 -0
  66. package/dist/requests/EntryRequest.js +314 -0
  67. package/dist/requests/PackageRequest.js +65 -0
  68. package/dist/requests/PathRequest.js +349 -0
  69. package/dist/requests/TargetRequest.js +1310 -0
  70. package/dist/requests/ValidationRequest.js +49 -0
  71. package/dist/requests/WriteBundleRequest.js +254 -0
  72. package/dist/requests/WriteBundlesRequest.js +165 -0
  73. package/dist/requests/asset-graph-diff.js +126 -0
  74. package/dist/requests/asset-graph-dot.js +131 -0
  75. package/dist/resolveOptions.js +268 -0
  76. package/dist/rustWorkerThreadDylibHack.js +19 -0
  77. package/dist/serializerCore.browser.js +43 -0
  78. package/dist/summarizeRequest.js +39 -0
  79. package/dist/types.js +31 -0
  80. package/dist/utils.js +172 -0
  81. package/dist/worker.js +123 -0
  82. package/lib/AssetGraph.js +111 -14
  83. package/lib/Atlaspack.js +82 -35
  84. package/lib/AtlaspackConfig.js +15 -3
  85. package/lib/AtlaspackConfig.schema.js +7 -5
  86. package/lib/BundleGraph.js +83 -30
  87. package/lib/CommittedAsset.js +6 -0
  88. package/lib/Dependency.js +8 -2
  89. package/lib/Environment.js +15 -8
  90. package/lib/EnvironmentManager.js +143 -0
  91. package/lib/IdentifierRegistry.js +1 -3
  92. package/lib/InternalConfig.js +3 -2
  93. package/lib/PackagerRunner.js +66 -23
  94. package/lib/ReporterRunner.js +6 -9
  95. package/lib/RequestTracker.js +256 -139
  96. package/lib/SymbolPropagation.js +22 -3
  97. package/lib/TargetDescriptor.schema.js +7 -1
  98. package/lib/Transformation.js +16 -9
  99. package/lib/UncommittedAsset.js +30 -9
  100. package/lib/Validation.js +18 -2
  101. package/lib/applyRuntimes.js +9 -1
  102. package/lib/assetUtils.js +7 -4
  103. package/lib/atlaspack-v3/AtlaspackV3.js +32 -7
  104. package/lib/atlaspack-v3/NapiWorkerPool.js +3 -0
  105. package/lib/atlaspack-v3/fs.js +3 -1
  106. package/lib/atlaspack-v3/index.js +28 -1
  107. package/lib/atlaspack-v3/jsCallable.js +0 -2
  108. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +7 -4
  109. package/lib/atlaspack-v3/worker/compat/bitflags.js +7 -6
  110. package/lib/atlaspack-v3/worker/compat/dependency.js +3 -0
  111. package/lib/atlaspack-v3/worker/compat/environment.js +10 -7
  112. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +14 -9
  113. package/lib/atlaspack-v3/worker/compat/plugin-config.js +8 -10
  114. package/lib/atlaspack-v3/worker/compat/plugin-options.js +1 -0
  115. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +3 -0
  116. package/lib/atlaspack-v3/worker/compat/target.js +2 -0
  117. package/lib/atlaspack-v3/worker/index.js +3 -0
  118. package/lib/atlaspack-v3/worker/worker.js +34 -6
  119. package/lib/constants.js +0 -1
  120. package/lib/dumpGraphToGraphViz.js +71 -16
  121. package/lib/index.js +45 -1
  122. package/lib/loadDotEnv.js +4 -1
  123. package/lib/projectPath.js +5 -0
  124. package/lib/public/Asset.js +21 -11
  125. package/lib/public/Bundle.js +15 -16
  126. package/lib/public/BundleGraph.js +10 -4
  127. package/lib/public/BundleGroup.js +4 -5
  128. package/lib/public/Config.js +118 -17
  129. package/lib/public/Dependency.js +8 -6
  130. package/lib/public/Environment.js +12 -7
  131. package/lib/public/MutableBundleGraph.js +54 -12
  132. package/lib/public/PluginOptions.js +2 -2
  133. package/lib/public/Symbols.js +11 -11
  134. package/lib/public/Target.js +7 -6
  135. package/lib/registerCoreWithSerializer.js +5 -3
  136. package/lib/requests/AssetGraphRequest.js +41 -4
  137. package/lib/requests/AssetGraphRequestRust.js +29 -14
  138. package/lib/requests/AssetRequest.js +23 -6
  139. package/lib/requests/AtlaspackBuildRequest.js +6 -2
  140. package/lib/requests/AtlaspackConfigRequest.js +12 -11
  141. package/lib/requests/BundleGraphRequest.js +29 -18
  142. package/lib/requests/ConfigRequest.js +28 -4
  143. package/lib/requests/DevDepRequest.js +31 -5
  144. package/lib/requests/EntryRequest.js +2 -0
  145. package/lib/requests/PackageRequest.js +7 -2
  146. package/lib/requests/PathRequest.js +24 -3
  147. package/lib/requests/TargetRequest.js +120 -56
  148. package/lib/requests/ValidationRequest.js +5 -1
  149. package/lib/requests/WriteBundleRequest.js +39 -11
  150. package/lib/requests/WriteBundlesRequest.js +24 -2
  151. package/lib/requests/asset-graph-diff.js +8 -3
  152. package/lib/requests/asset-graph-dot.js +1 -7
  153. package/lib/resolveOptions.js +36 -10
  154. package/lib/rustWorkerThreadDylibHack.js +0 -1
  155. package/lib/types/AssetGraph.d.ts +80 -0
  156. package/lib/types/Atlaspack.d.ts +52 -0
  157. package/lib/types/AtlaspackConfig.d.ts +65 -0
  158. package/lib/types/AtlaspackConfig.schema.d.ts +46 -0
  159. package/lib/types/BundleGraph.d.ts +182 -0
  160. package/lib/types/CommittedAsset.d.ts +23 -0
  161. package/lib/types/Dependency.d.ts +44 -0
  162. package/lib/types/Environment.d.ts +11 -0
  163. package/lib/types/EnvironmentManager.d.ts +37 -0
  164. package/lib/types/IdentifierRegistry.d.ts +6 -0
  165. package/lib/types/InternalConfig.d.ts +24 -0
  166. package/lib/types/PackagerRunner.d.ts +80 -0
  167. package/lib/types/ReporterRunner.d.ts +25 -0
  168. package/lib/types/RequestTracker.d.ts +385 -0
  169. package/lib/types/SymbolPropagation.d.ts +11 -0
  170. package/lib/types/TargetDescriptor.schema.d.ts +5 -0
  171. package/lib/types/Transformation.d.ts +72 -0
  172. package/lib/types/UncommittedAsset.d.ts +61 -0
  173. package/lib/types/Validation.d.ts +37 -0
  174. package/lib/types/applyRuntimes.d.ts +25 -0
  175. package/lib/types/assetUtils.d.ts +42 -0
  176. package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +26 -0
  177. package/lib/types/atlaspack-v3/NapiWorkerPool.d.ts +12 -0
  178. package/lib/types/atlaspack-v3/fs.d.ts +12 -0
  179. package/lib/types/atlaspack-v3/index.d.ts +5 -0
  180. package/lib/types/atlaspack-v3/jsCallable.d.ts +1 -0
  181. package/lib/types/atlaspack-v3/worker/compat/asset-symbols.d.ts +51 -0
  182. package/lib/types/atlaspack-v3/worker/compat/bitflags.d.ts +15 -0
  183. package/lib/types/atlaspack-v3/worker/compat/dependency.d.ts +25 -0
  184. package/lib/types/atlaspack-v3/worker/compat/environment.d.ts +27 -0
  185. package/{src/atlaspack-v3/worker/compat/index.js → lib/types/atlaspack-v3/worker/compat/index.d.ts} +0 -1
  186. package/lib/types/atlaspack-v3/worker/compat/mutable-asset.d.ts +49 -0
  187. package/lib/types/atlaspack-v3/worker/compat/plugin-config.d.ts +37 -0
  188. package/lib/types/atlaspack-v3/worker/compat/plugin-logger.d.ts +9 -0
  189. package/lib/types/atlaspack-v3/worker/compat/plugin-options.d.ts +22 -0
  190. package/lib/types/atlaspack-v3/worker/compat/plugin-tracer.d.ts +5 -0
  191. package/lib/types/atlaspack-v3/worker/compat/target.d.ts +11 -0
  192. package/lib/types/atlaspack-v3/worker/worker.d.ts +58 -0
  193. package/lib/types/constants.d.ts +13 -0
  194. package/lib/types/dumpGraphToGraphViz.d.ts +10 -0
  195. package/lib/types/index.d.ts +8 -0
  196. package/lib/types/loadAtlaspackPlugin.d.ts +8 -0
  197. package/lib/types/loadDotEnv.d.ts +3 -0
  198. package/lib/types/projectPath.d.ts +19 -0
  199. package/lib/types/public/Asset.d.ts +74 -0
  200. package/lib/types/public/Bundle.d.ts +45 -0
  201. package/lib/types/public/BundleGraph.d.ts +70 -0
  202. package/lib/types/public/BundleGroup.d.ts +12 -0
  203. package/lib/types/public/Config.d.ts +75 -0
  204. package/lib/types/public/Dependency.d.ts +32 -0
  205. package/lib/types/public/Environment.d.ts +34 -0
  206. package/lib/types/public/MutableBundleGraph.d.ts +26 -0
  207. package/lib/types/public/PluginOptions.d.ts +25 -0
  208. package/lib/types/public/Symbols.d.ts +81 -0
  209. package/lib/types/public/Target.d.ts +16 -0
  210. package/lib/types/registerCoreWithSerializer.d.ts +2 -0
  211. package/lib/types/requests/AssetGraphRequest.d.ts +74 -0
  212. package/lib/types/requests/AssetGraphRequestRust.d.ts +21 -0
  213. package/lib/types/requests/AssetRequest.d.ts +16 -0
  214. package/lib/types/requests/AtlaspackBuildRequest.d.ts +29 -0
  215. package/lib/types/requests/AtlaspackConfigRequest.d.ts +45 -0
  216. package/lib/types/requests/BundleGraphRequest.d.ts +28 -0
  217. package/lib/types/requests/ConfigRequest.d.ts +59 -0
  218. package/lib/types/requests/DevDepRequest.d.ts +30 -0
  219. package/lib/types/requests/EntryRequest.d.ts +36 -0
  220. package/lib/types/requests/PackageRequest.d.ts +27 -0
  221. package/lib/types/requests/PathRequest.d.ts +48 -0
  222. package/lib/types/requests/TargetRequest.d.ts +48 -0
  223. package/lib/types/requests/ValidationRequest.d.ts +20 -0
  224. package/lib/types/requests/WriteBundleRequest.d.ts +28 -0
  225. package/lib/types/requests/WriteBundlesRequest.d.ts +26 -0
  226. package/lib/types/requests/asset-graph-diff.d.ts +1 -0
  227. package/lib/types/requests/asset-graph-dot.d.ts +9 -0
  228. package/lib/types/resolveOptions.d.ts +3 -0
  229. package/lib/types/rustWorkerThreadDylibHack.d.ts +9 -0
  230. package/lib/types/serializerCore.browser.d.ts +3 -0
  231. package/lib/types/summarizeRequest.d.ts +10 -0
  232. package/lib/types/types.d.ts +493 -0
  233. package/lib/types/utils.d.ts +23 -0
  234. package/lib/types/worker.d.ts +44 -0
  235. package/lib/types.js +8 -1
  236. package/lib/utils.js +17 -2
  237. package/lib/worker.js +29 -13
  238. package/package.json +24 -34
  239. package/src/{AssetGraph.js → AssetGraph.ts} +156 -52
  240. package/src/{Atlaspack.js → Atlaspack.ts} +113 -60
  241. package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +16 -19
  242. package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +78 -54
  243. package/src/{BundleGraph.js → BundleGraph.ts} +213 -133
  244. package/src/{CommittedAsset.js → CommittedAsset.ts} +14 -12
  245. package/src/{Dependency.js → Dependency.ts} +59 -42
  246. package/src/{Environment.js → Environment.ts} +24 -15
  247. package/src/EnvironmentManager.ts +154 -0
  248. package/src/{IdentifierRegistry.js → IdentifierRegistry.ts} +1 -4
  249. package/src/{InternalConfig.js → InternalConfig.ts} +22 -23
  250. package/src/{PackagerRunner.js → PackagerRunner.ts} +149 -81
  251. package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
  252. package/src/{RequestTracker.js → RequestTracker.ts} +558 -336
  253. package/src/{SymbolPropagation.js → SymbolPropagation.ts} +137 -39
  254. package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +7 -1
  255. package/src/{Transformation.js → Transformation.ts} +67 -61
  256. package/src/{UncommittedAsset.js → UncommittedAsset.ts} +57 -36
  257. package/src/{Validation.js → Validation.ts} +32 -17
  258. package/src/{applyRuntimes.js → applyRuntimes.ts} +35 -26
  259. package/src/{assetUtils.js → assetUtils.ts} +47 -35
  260. package/src/atlaspack-v3/AtlaspackV3.ts +122 -0
  261. package/src/atlaspack-v3/{NapiWorkerPool.js → NapiWorkerPool.ts} +10 -5
  262. package/src/atlaspack-v3/{fs.js → fs.ts} +3 -4
  263. package/src/atlaspack-v3/{index.js → index.ts} +2 -4
  264. package/src/atlaspack-v3/jsCallable.ts +14 -0
  265. package/src/atlaspack-v3/worker/compat/{asset-symbols.js → asset-symbols.ts} +40 -30
  266. package/src/atlaspack-v3/worker/compat/{bitflags.js → bitflags.ts} +9 -10
  267. package/src/atlaspack-v3/worker/compat/{dependency.js → dependency.ts} +12 -12
  268. package/src/atlaspack-v3/worker/compat/{environment.js → environment.ts} +13 -9
  269. package/src/atlaspack-v3/worker/compat/index.ts +9 -0
  270. package/src/atlaspack-v3/worker/compat/{mutable-asset.js → mutable-asset.ts} +20 -19
  271. package/src/atlaspack-v3/worker/compat/{plugin-config.js → plugin-config.ts} +27 -26
  272. package/src/atlaspack-v3/worker/compat/{plugin-logger.js → plugin-logger.ts} +0 -2
  273. package/src/atlaspack-v3/worker/compat/{plugin-options.js → plugin-options.ts} +4 -5
  274. package/src/atlaspack-v3/worker/compat/{plugin-tracer.js → plugin-tracer.ts} +2 -2
  275. package/src/atlaspack-v3/worker/compat/{target.js → target.ts} +3 -4
  276. package/src/atlaspack-v3/worker/index.js +2 -1
  277. package/src/atlaspack-v3/worker/{worker.js → worker.ts} +94 -65
  278. package/src/{constants.js → constants.ts} +0 -3
  279. package/src/{dumpGraphToGraphViz.js → dumpGraphToGraphViz.ts} +73 -28
  280. package/src/index.ts +18 -0
  281. package/src/{loadAtlaspackPlugin.js → loadAtlaspackPlugin.ts} +8 -9
  282. package/src/{loadDotEnv.js → loadDotEnv.ts} +2 -2
  283. package/src/{projectPath.js → projectPath.ts} +20 -9
  284. package/src/public/{Asset.js → Asset.ts} +40 -27
  285. package/src/public/{Bundle.js → Bundle.ts} +28 -29
  286. package/src/public/{BundleGraph.js → BundleGraph.ts} +81 -50
  287. package/src/public/{BundleGroup.js → BundleGroup.ts} +7 -10
  288. package/src/public/{Config.js → Config.ts} +171 -33
  289. package/src/public/{Dependency.js → Dependency.ts} +20 -17
  290. package/src/public/{Environment.js → Environment.ts} +28 -17
  291. package/src/public/{MutableBundleGraph.js → MutableBundleGraph.ts} +55 -24
  292. package/src/public/{PluginOptions.js → PluginOptions.ts} +6 -6
  293. package/src/public/{Symbols.js → Symbols.ts} +75 -36
  294. package/src/public/{Target.js → Target.ts} +10 -8
  295. package/src/{registerCoreWithSerializer.js → registerCoreWithSerializer.ts} +9 -7
  296. package/src/requests/{AssetGraphRequest.js → AssetGraphRequest.ts} +83 -48
  297. package/src/requests/{AssetGraphRequestRust.js → AssetGraphRequestRust.ts} +36 -29
  298. package/src/requests/{AssetRequest.js → AssetRequest.ts} +24 -18
  299. package/src/requests/{AtlaspackBuildRequest.js → AtlaspackBuildRequest.ts} +30 -31
  300. package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +58 -51
  301. package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +66 -57
  302. package/src/requests/{ConfigRequest.js → ConfigRequest.ts} +71 -50
  303. package/src/requests/{DevDepRequest.js → DevDepRequest.ts} +60 -35
  304. package/src/requests/{EntryRequest.js → EntryRequest.ts} +36 -31
  305. package/src/requests/{PackageRequest.js → PackageRequest.ts} +21 -21
  306. package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
  307. package/src/requests/{TargetRequest.js → TargetRequest.ts} +259 -179
  308. package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
  309. package/src/requests/{WriteBundleRequest.js → WriteBundleRequest.ts} +77 -49
  310. package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +77 -34
  311. package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +14 -14
  312. package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
  313. package/src/{resolveOptions.js → resolveOptions.ts} +56 -24
  314. package/src/{rustWorkerThreadDylibHack.js → rustWorkerThreadDylibHack.ts} +1 -4
  315. package/src/{serializerCore.browser.js → serializerCore.browser.ts} +2 -3
  316. package/src/{summarizeRequest.js → summarizeRequest.ts} +17 -5
  317. package/src/types.ts +647 -0
  318. package/src/{utils.js → utils.ts} +52 -21
  319. package/src/{worker.js → worker.ts} +49 -41
  320. package/test/{AssetGraph.test.js → AssetGraph.test.ts} +37 -8
  321. package/test/{Atlaspack.test.js → Atlaspack.test.ts} +5 -10
  322. package/test/{AtlaspackConfig.test.js → AtlaspackConfig.test.ts} +0 -5
  323. package/test/{AtlaspackConfigRequest.test.js → AtlaspackConfigRequest.test.ts} +3 -15
  324. package/test/{BundleGraph.test.js → BundleGraph.test.ts} +8 -13
  325. package/test/{Dependency.test.js → Dependency.test.ts} +2 -3
  326. package/test/{EntryRequest.test.js → EntryRequest.test.ts} +1 -6
  327. package/test/Environment.test.ts +153 -0
  328. package/test/EnvironmentManager.test.ts +188 -0
  329. package/test/{IdentifierRegistry.test.js → IdentifierRegistry.test.ts} +2 -4
  330. package/test/{InternalAsset.test.js → InternalAsset.test.ts} +2 -7
  331. package/test/PackagerRunner.test.ts +0 -0
  332. package/test/{PublicAsset.test.js → PublicAsset.test.ts} +2 -7
  333. package/test/{PublicBundle.test.js → PublicBundle.test.ts} +1 -2
  334. package/test/{PublicDependency.test.js → PublicDependency.test.ts} +0 -2
  335. package/test/PublicEnvironment.test.ts +49 -0
  336. package/test/{PublicMutableBundleGraph.test.js → PublicMutableBundleGraph.test.ts} +6 -11
  337. package/test/{RequestTracker.test.js → RequestTracker.test.ts} +314 -59
  338. package/test/{SymbolPropagation.test.js → SymbolPropagation.test.ts} +124 -74
  339. package/test/{TargetRequest.test.js → TargetRequest.test.ts} +54 -92
  340. package/test/public/Config.test.ts +104 -0
  341. package/test/requests/{AssetGraphRequestRust.test.js → AssetGraphRequestRust.test.ts} +163 -134
  342. package/test/requests/{ConfigRequest.test.js → ConfigRequest.test.ts} +202 -13
  343. package/test/requests/{DevDepRequest.test.js → DevDepRequest.test.ts} +0 -2
  344. package/test/{test-utils.js → test-utils.ts} +4 -11
  345. package/test/{utils.test.js → utils.test.ts} +1 -3
  346. package/tsconfig.json +57 -0
  347. package/tsconfig.tsbuildinfo +1 -0
  348. package/index.d.ts +0 -30
  349. package/src/atlaspack-v3/AtlaspackV3.js +0 -87
  350. package/src/atlaspack-v3/jsCallable.js +0 -18
  351. package/src/index.js +0 -13
  352. package/src/types.js +0 -600
  353. package/test/Environment.test.js +0 -119
  354. package/test/PackagerRunner.test.js +0 -27
  355. package/test/PublicEnvironment.test.js +0 -27
@@ -89,14 +89,32 @@ async function createDevDependency(opts, requestDevDeps, options) {
89
89
  return devDepRequest;
90
90
  }
91
91
  async function getDevDepRequests(api) {
92
- let previousDevDepRequests = new Map(await Promise.all(api.getSubRequests().filter(req => req.requestType === _RequestTracker.requestTypes.dev_dep_request).map(async req => [req.id, (0, _nullthrows().default)(await api.getRequestResult(req.id))])));
92
+ async function getPreviousDevDepRequests() {
93
+ const allDevDepRequests = await Promise.all(api.getSubRequests().filter(req => req.requestType === _RequestTracker.requestTypes.dev_dep_request).map(async req => [req.id, await api.getRequestResult(req.id)]));
94
+ const nonNullDevDepRequests = [];
95
+ for (const [id, result] of allDevDepRequests) {
96
+ if (result != null) {
97
+ nonNullDevDepRequests.push([id, result]);
98
+ }
99
+ }
100
+
101
+ // @ts-expect-error TS2769
102
+ return new Map(nonNullDevDepRequests);
103
+ }
104
+ const previousDevDepRequests = await getPreviousDevDepRequests();
93
105
  return {
94
- devDeps: new Map([...previousDevDepRequests.entries()].filter(([id]) => api.canSkipSubrequest(id)).map(([, req]) => [`${req.specifier}:${(0, _projectPath.fromProjectPathRelative)(req.resolveFrom)}`, req.hash])),
95
- invalidDevDeps: await Promise.all([...previousDevDepRequests.entries()].filter(([id]) => !api.canSkipSubrequest(id)).flatMap(([, req]) => {
106
+ devDeps: new Map([...previousDevDepRequests.entries()]
107
+ // @ts-expect-error TS2769
108
+ .filter(([id]) => api.canSkipSubrequest(id)).map(([, req]) => [`${req.specifier}:${(0, _projectPath.fromProjectPathRelative)(req.resolveFrom)}`, req.hash])),
109
+ invalidDevDeps: await Promise.all([...previousDevDepRequests.entries()]
110
+ // @ts-expect-error TS2769
111
+ .filter(([id]) => !api.canSkipSubrequest(id)).flatMap(([, req]) => {
96
112
  return [{
97
113
  specifier: req.specifier,
98
114
  resolveFrom: req.resolveFrom
99
- }, ...(req.additionalInvalidations ?? []).map(i => ({
115
+ },
116
+ // @ts-expect-error TS7006
117
+ ...(req.additionalInvalidations ?? []).map(i => ({
100
118
  specifier: i.specifier,
101
119
  resolveFrom: i.resolveFrom
102
120
  }))];
@@ -122,7 +140,9 @@ function invalidateDevDeps(invalidDevDeps, options, config) {
122
140
  }
123
141
  const devDepRequests = (0, _buildCache().createBuildCache)();
124
142
  function resolveDevDepRequestRef(devDepRequestRef) {
125
- const devDepRequest = devDepRequestRef.type === 'ref' ? devDepRequests.get(devDepRequestRef.hash) : devDepRequestRef;
143
+ const devDepRequest =
144
+ // @ts-expect-error TS2339
145
+ devDepRequestRef.type === 'ref' ? devDepRequests.get(devDepRequestRef.hash) : devDepRequestRef;
126
146
  if (devDepRequest == null) {
127
147
  throw new Error(`Worker send back a reference to a missing dev dep request.
128
148
 
@@ -132,15 +152,21 @@ ${process.env.NODE_ENV === 'test' ? `If this is a unit test, call atlaspack.clea
132
152
 
133
153
  This is a bug in Atlaspack.`);
134
154
  }
155
+
156
+ // @ts-expect-error TS2339
135
157
  if (devDepRequestRef.type !== 'ref') {
158
+ // @ts-expect-error TS2345
136
159
  devDepRequests.set(devDepRequest.hash, devDepRequest);
137
160
  }
161
+
162
+ // @ts-expect-error TS2322
138
163
  return devDepRequest;
139
164
  }
140
165
  async function runDevDepRequest(api, devDepRequestRef) {
141
166
  await api.runRequest({
142
167
  id: 'dev_dep_request:' + devDepRequestRef.specifier + ':' + devDepRequestRef.hash,
143
168
  type: _RequestTracker.requestTypes.dev_dep_request,
169
+ // @ts-expect-error TS2322
144
170
  run: ({
145
171
  api
146
172
  }) => {
@@ -47,6 +47,8 @@ function createEntryRequest(input) {
47
47
  input
48
48
  };
49
49
  }
50
+
51
+ // @ts-expect-error TS7031
50
52
  async function run({
51
53
  input,
52
54
  api,
@@ -24,6 +24,8 @@ function createPackageRequest(input) {
24
24
  input
25
25
  };
26
26
  }
27
+
28
+ // @ts-expect-error TS7031
27
29
  async function run({
28
30
  input,
29
31
  api,
@@ -43,7 +45,9 @@ async function run({
43
45
  } = await (0, _DevDepRequest.getDevDepRequests)(api);
44
46
  let {
45
47
  cachePath
46
- } = (0, _nullthrows().default)(await api.runRequest((0, _AtlaspackConfigRequest.default)()));
48
+ } = (0, _nullthrows().default)(
49
+ // @ts-expect-error TS2347
50
+ await api.runRequest((0, _AtlaspackConfigRequest.default)()));
47
51
  let {
48
52
  devDepRequests,
49
53
  configRequests,
@@ -77,11 +81,12 @@ async function run({
77
81
  api.invalidateOnOptionChange(invalidation.key);
78
82
  break;
79
83
  default:
84
+ // @ts-expect-error TS2339
80
85
  throw new Error(`Unknown invalidation type: ${invalidation.type}`);
81
86
  }
82
87
  }
83
88
 
84
- // $FlowFixMe[cannot-write] time is marked read-only, but this is the exception
89
+ // @ts-expect-error TS2540
85
90
  bundleInfo.time = Date.now() - start;
86
91
  api.storeResult(bundleInfo);
87
92
  return bundleInfo;
@@ -26,6 +26,13 @@ function _logger() {
26
26
  };
27
27
  return data;
28
28
  }
29
+ function _featureFlags() {
30
+ const data = require("@atlaspack/feature-flags");
31
+ _featureFlags = function () {
32
+ return data;
33
+ };
34
+ return data;
35
+ }
29
36
  function _nullthrows() {
30
37
  const data = _interopRequireDefault(require("nullthrows"));
31
38
  _nullthrows = function () {
@@ -50,7 +57,6 @@ function _utils() {
50
57
  var _ReporterRunner = require("../ReporterRunner");
51
58
  var _Dependency = require("../public/Dependency");
52
59
  var _PluginOptions = _interopRequireDefault(require("../public/PluginOptions"));
53
- var _AtlaspackConfig = require("../AtlaspackConfig");
54
60
  var _AtlaspackConfigRequest = _interopRequireWildcard(require("./AtlaspackConfigRequest"));
55
61
  var _utils2 = require("../utils");
56
62
  var _projectPath = require("../projectPath");
@@ -78,12 +84,16 @@ function createPathRequest(input) {
78
84
  input
79
85
  };
80
86
  }
87
+
88
+ // @ts-expect-error TS7031
81
89
  async function run({
82
90
  input,
83
91
  api,
84
92
  options
85
93
  }) {
86
- let configResult = (0, _nullthrows().default)(await api.runRequest((0, _AtlaspackConfigRequest.default)()));
94
+ let configResult = (0, _nullthrows().default)(
95
+ // @ts-expect-error TS2347
96
+ await api.runRequest((0, _AtlaspackConfigRequest.default)()));
87
97
  let config = (0, _AtlaspackConfigRequest.getCachedAtlaspackConfig)(configResult, options);
88
98
  let {
89
99
  devDeps,
@@ -127,7 +137,7 @@ async function run({
127
137
  let err = new (_diagnostic().default)({
128
138
  diagnostic: result.diagnostics
129
139
  });
130
- // $FlowFixMe[prop-missing]
140
+ // @ts-expect-error TS2339
131
141
  err.code = 'MODULE_NOT_FOUND';
132
142
  throw err;
133
143
  }
@@ -170,26 +180,34 @@ class ResolverRunner {
170
180
  plugin: plugin.name,
171
181
  searchPath: (0, _projectPath.toProjectPathUnsafe)('index')
172
182
  });
183
+
184
+ // @ts-expect-error TS2345
173
185
  await (0, _ConfigRequest.loadPluginConfig)(plugin, config, this.options);
174
186
  configCache.set(plugin.name, config);
187
+ // @ts-expect-error TS2345
175
188
  this.configs.set(plugin.name, config);
176
189
  }
177
190
  if (config) {
191
+ // @ts-expect-error TS2339
178
192
  for (let devDep of config.devDeps) {
179
193
  let devDepRequest = await (0, _DevDepRequest.createDevDependency)(devDep, this.previousDevDeps, this.options);
180
194
  this.runDevDepRequest(devDepRequest);
181
195
  }
196
+
197
+ // @ts-expect-error TS2345
182
198
  this.configs.set(plugin.name, config);
183
199
  }
184
200
  }
185
201
  }
186
202
  runDevDepRequest(devDepRequest) {
203
+ // @ts-expect-error TS2339
187
204
  if (devDepRequest.type !== 'ref') {
188
205
  let {
189
206
  specifier,
190
207
  resolveFrom
191
208
  } = devDepRequest;
192
209
  let key = `${specifier}:${(0, _projectPath.fromProjectPathRelative)(resolveFrom)}`;
210
+ // @ts-expect-error TS2345
193
211
  this.devDepRequests.set(key, devDepRequest);
194
212
  }
195
213
  }
@@ -259,6 +277,9 @@ class ResolverRunner {
259
277
  }
260
278
  if (result.priority != null) {
261
279
  dependency.priority = _types.Priority[result.priority];
280
+ if ((0, _featureFlags().getFeatureFlag)('hmrImprovements')) {
281
+ dependency.resolverPriority = dependency.priority;
282
+ }
262
283
  }
263
284
  if (result.invalidateOnEnvChange) {
264
285
  invalidateOnEnvChange.push(...result.invalidateOnEnvChange);
@@ -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.',
@@ -838,6 +890,7 @@ class TargetResolver {
838
890
  publicUrl: this.options.defaultTargetOptions.publicUrl,
839
891
  env: (0, _Environment.createEnvironment)({
840
892
  engines: pkgEngines,
893
+ // @ts-expect-error TS2322
841
894
  context,
842
895
  outputFormat: this.options.defaultTargetOptions.outputFormat,
843
896
  isLibrary: this.options.defaultTargetOptions.isLibrary,
@@ -874,9 +927,7 @@ class TargetResolver {
874
927
  break;
875
928
  }
876
929
  if (descriptor.outputFormat && inferredOutputFormat && descriptor.outputFormat !== inferredOutputFormat) {
877
- let contents = typeof pkgContents === 'string' ? pkgContents :
878
- // $FlowFixMe
879
- JSON.stringify(pkgContents, null, '\t');
930
+ let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
880
931
  let expectedExtensions;
881
932
  switch (descriptor.outputFormat) {
882
933
  case 'esmodule':
@@ -889,7 +940,6 @@ class TargetResolver {
889
940
  expectedExtensions = ['.js'];
890
941
  break;
891
942
  }
892
- // $FlowFixMe
893
943
  let listFormat = new Intl.ListFormat('en-US', {
894
944
  type: 'disjunction'
895
945
  });
@@ -916,6 +966,8 @@ class TargetResolver {
916
966
  }
917
967
  });
918
968
  }
969
+
970
+ // @ts-expect-error TS2322
919
971
  return [inferredOutputFormat, inferredOutputFormatField];
920
972
  }
921
973
  }
@@ -930,7 +982,7 @@ function parseEngines(engines, pkgPath, pkgContents, prependKey, message) {
930
982
  filePath: pkgPath,
931
983
  prependKey
932
984
  }, '@atlaspack/core', message);
933
- // $FlowFixMe we just verified this
985
+ // @ts-expect-error TS2322
934
986
  return engines;
935
987
  }
936
988
  }
@@ -942,7 +994,7 @@ function parseDescriptor(targetName, descriptor, pkgPath, pkgContents) {
942
994
  prependKey: `/targets/${targetName}`
943
995
  }, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
944
996
 
945
- // $FlowFixMe we just verified this
997
+ // @ts-expect-error TS2322
946
998
  return descriptor;
947
999
  }
948
1000
  function parsePackageDescriptor(targetName, descriptor, pkgPath, pkgContents) {
@@ -952,7 +1004,7 @@ function parsePackageDescriptor(targetName, descriptor, pkgPath, pkgContents) {
952
1004
  filePath: pkgPath,
953
1005
  prependKey: `/targets/${targetName}`
954
1006
  }, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
955
- // $FlowFixMe we just verified this
1007
+ // @ts-expect-error TS2322
956
1008
  return descriptor;
957
1009
  }
958
1010
  function parseCommonTargetDescriptor(targetName, descriptor, pkgPath, pkgContents) {
@@ -963,7 +1015,7 @@ function parseCommonTargetDescriptor(targetName, descriptor, pkgPath, pkgContent
963
1015
  prependKey: `/targets/${targetName}`
964
1016
  }, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
965
1017
 
966
- // $FlowFixMe we just verified this
1018
+ // @ts-expect-error TS2322
967
1019
  return descriptor;
968
1020
  }
969
1021
  function assertNoDuplicateTargets(options, targets, pkgFilePath, pkgContents) {
@@ -1012,7 +1064,9 @@ function assertNoDuplicateTargets(options, targets, pkgFilePath, pkgContents) {
1012
1064
  });
1013
1065
  }
1014
1066
  }
1015
- function normalizeSourceMap(options, sourceMap) {
1067
+ function normalizeSourceMap(options,
1068
+ // @ts-expect-error TS2304
1069
+ sourceMap) {
1016
1070
  if (options.defaultTargetOptions.sourceMaps) {
1017
1071
  if (typeof sourceMap === 'boolean') {
1018
1072
  return sourceMap ? {} : undefined;
@@ -1028,6 +1082,7 @@ function assertTargetsAreNotEntries(targets, input, options) {
1028
1082
  if (target.distEntry != null && (0, _projectPath.joinProjectPath)(target.distDir, target.distEntry) === input.filePath) {
1029
1083
  let loc = target.loc;
1030
1084
  let relativeEntry = _path().default.relative(process.cwd(), (0, _projectPath.fromProjectPath)(options.projectRoot, input.filePath));
1085
+ // @ts-expect-error TS2304
1031
1086
  let codeFrames = [];
1032
1087
  if (loc) {
1033
1088
  codeFrames.push({
@@ -1052,7 +1107,9 @@ function assertTargetsAreNotEntries(targets, input, options) {
1052
1107
  origin: '@atlaspack/core',
1053
1108
  message: `Target "${target.name}" is configured to overwrite entry "${relativeEntry}".`,
1054
1109
  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.`],
1110
+ hints: [
1111
+ // @ts-expect-error TS7053
1112
+ (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
1113
  documentationURL: 'https://parceljs.org/features/targets/'
1057
1114
  }
1058
1115
  });
@@ -1073,24 +1130,27 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1073
1130
 
1074
1131
  // Resolve relevant engines for context.
1075
1132
  let engines;
1076
- switch (target.env.context) {
1133
+ const env = (0, _EnvironmentManager.fromEnvironmentId)(target.env);
1134
+ switch (env.context) {
1077
1135
  case 'browser':
1078
1136
  case 'web-worker':
1079
1137
  case 'service-worker':
1080
1138
  case 'worklet':
1081
1139
  {
1082
- let browsers = target.env.engines.browsers;
1140
+ let browsers = env.engines.browsers;
1083
1141
  engines = Array.isArray(browsers) ? browsers.join(', ') : browsers;
1084
1142
  break;
1085
1143
  }
1086
1144
  case 'node':
1087
- engines = target.env.engines.node;
1145
+ engines = env.engines.node;
1088
1146
  break;
1089
1147
  case 'electron-main':
1090
1148
  case 'electron-renderer':
1091
- engines = target.env.engines.electron;
1149
+ engines = env.engines.electron;
1092
1150
  break;
1093
1151
  }
1152
+
1153
+ // @ts-expect-error TS2304
1094
1154
  let highlights = [];
1095
1155
  if (input.loc) {
1096
1156
  highlights.push((0, _diagnostic().convertSourceLocationToHighlight)(input.loc, 'entry defined here'));
@@ -1103,6 +1163,7 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1103
1163
  // Builds up map of code highlights for each defined/inferred path in the package.json.
1104
1164
  let jsonHighlights = new Map();
1105
1165
  for (let key in info) {
1166
+ // @ts-expect-error TS7053
1106
1167
  let keyInfo = info[key];
1107
1168
  let path = keyInfo.path || keyInfo.inferred;
1108
1169
  if (!path) {
@@ -1124,11 +1185,10 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1124
1185
  highlight.defined = (0, _diagnostic().md)`${key} defined here`;
1125
1186
  }
1126
1187
  if (keyInfo.inferred) {
1127
- highlight.inferred.push((0, _diagnostic().md)`${key} to be ${JSON.stringify(target.env[key])}`);
1188
+ // @ts-expect-error TS2345
1189
+ highlight.inferred.push((0, _diagnostic().md)`${key} to be ${JSON.stringify(env[key])}`);
1128
1190
  }
1129
1191
  }
1130
-
1131
- // $FlowFixMe
1132
1192
  let listFormat = new Intl.ListFormat('en-US');
1133
1193
 
1134
1194
  // Generate human friendly messages for each field.
@@ -1150,26 +1210,30 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1150
1210
 
1151
1211
  // Format includeNodeModules to be human readable.
1152
1212
  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)));
1213
+ if (typeof env.includeNodeModules === 'boolean') {
1214
+ includeNodeModules = String(env.includeNodeModules);
1215
+ } else if (Array.isArray(env.includeNodeModules)) {
1216
+ includeNodeModules = 'only ' + listFormat.format(env.includeNodeModules.map(m => JSON.stringify(m)));
1217
+ } else if (env.includeNodeModules && typeof env.includeNodeModules === 'object') {
1218
+ includeNodeModules = 'all except ' + listFormat.format(Object.entries(env.includeNodeModules).filter(([, v]) => v === false)
1219
+ // @ts-expect-error TS2345
1220
+ .map(([k]) => JSON.stringify(k)));
1159
1221
  }
1160
- let format = v => v.message != null ? _diagnostic().md.italic(v.message) : '';
1222
+ let format = v =>
1223
+ // @ts-expect-error TS2339
1224
+ v.message != null ? _diagnostic().md.italic(v.message) : '';
1161
1225
  _logger().default.verbose({
1162
1226
  origin: '@atlaspack/core',
1163
1227
  message: (0, _diagnostic().md)`**Target** "${target.name}"
1164
1228
 
1165
1229
  **Entry**: ${_path().default.relative(process.cwd(), (0, _projectPath.fromProjectPath)(options.projectRoot, input.filePath))}
1166
1230
  **Output**: ${_path().default.relative(process.cwd(), output)}
1167
- **Format**: ${target.env.outputFormat} ${format(info.outputFormat)}
1168
- **Context**: ${target.env.context} ${format(info.context)}
1231
+ **Format**: ${env.outputFormat} ${format(info.outputFormat)}
1232
+ **Context**: ${env.context} ${format(info.context)}
1169
1233
  **Engines**: ${engines || ''} ${format(info.engines)}
1170
- **Library Mode**: ${String(target.env.isLibrary)} ${format(info.isLibrary)}
1234
+ **Library Mode**: ${String(env.isLibrary)} ${format(info.isLibrary)}
1171
1235
  **Include Node Modules**: ${includeNodeModules} ${format(info.includeNodeModules)}
1172
- **Optimize**: ${String(target.env.shouldOptimize)} ${format(info.shouldOptimize)}`,
1236
+ **Optimize**: ${String(env.shouldOptimize)} ${format(info.shouldOptimize)}`,
1173
1237
  codeFrames: target.loc ? [{
1174
1238
  filePath: targetFilePath,
1175
1239
  codeHighlights: highlights