@atlaspack/core 2.16.2-canary.33 → 2.16.2-canary.330

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 (360) hide show
  1. package/CHANGELOG.md +835 -0
  2. package/dist/AssetGraph.js +591 -0
  3. package/dist/Atlaspack.js +663 -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 +491 -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 +63 -0
  24. package/dist/atlaspack-v3/NapiWorkerPool.js +61 -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 +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 +307 -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 +371 -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 +439 -0
  59. package/dist/requests/AssetGraphRequestRust.js +273 -0
  60. package/dist/requests/AssetRequest.js +130 -0
  61. package/dist/requests/AtlaspackBuildRequest.js +65 -0
  62. package/dist/requests/AtlaspackConfigRequest.js +493 -0
  63. package/dist/requests/BundleGraphRequest.js +447 -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 +62 -0
  68. package/dist/requests/PathRequest.js +349 -0
  69. package/dist/requests/TargetRequest.js +1311 -0
  70. package/dist/requests/ValidationRequest.js +49 -0
  71. package/dist/requests/WriteBundleRequest.js +254 -0
  72. package/dist/requests/WriteBundlesRequest.js +184 -0
  73. package/dist/requests/asset-graph-diff.js +128 -0
  74. package/dist/requests/asset-graph-dot.js +131 -0
  75. package/dist/resolveOptions.js +269 -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 +87 -38
  84. package/lib/AtlaspackConfig.js +15 -3
  85. package/lib/AtlaspackConfig.schema.js +16 -5
  86. package/lib/BundleGraph.js +197 -32
  87. package/lib/CommittedAsset.js +7 -1
  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 +90 -27
  94. package/lib/ReporterRunner.js +6 -9
  95. package/lib/RequestTracker.js +266 -156
  96. package/lib/SymbolPropagation.js +42 -18
  97. package/lib/TargetDescriptor.schema.js +7 -1
  98. package/lib/Transformation.js +35 -14
  99. package/lib/UncommittedAsset.js +33 -12
  100. package/lib/Validation.js +18 -2
  101. package/lib/applyRuntimes.js +96 -4
  102. package/lib/assetUtils.js +15 -5
  103. package/lib/atlaspack-v3/AtlaspackV3.js +32 -14
  104. package/lib/atlaspack-v3/NapiWorkerPool.js +7 -1
  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 +31 -25
  110. package/lib/atlaspack-v3/worker/compat/dependency.js +4 -1
  111. package/lib/atlaspack-v3/worker/compat/environment.js +10 -7
  112. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +15 -10
  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 +60 -12
  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 +25 -22
  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 +74 -27
  137. package/lib/requests/AssetGraphRequestRust.js +140 -64
  138. package/lib/requests/AssetRequest.js +23 -6
  139. package/lib/requests/AtlaspackBuildRequest.js +10 -4
  140. package/lib/requests/AtlaspackConfigRequest.js +27 -16
  141. package/lib/requests/BundleGraphRequest.js +40 -23
  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 +2 -1
  146. package/lib/requests/PathRequest.js +24 -3
  147. package/lib/requests/TargetRequest.js +122 -57
  148. package/lib/requests/ValidationRequest.js +5 -1
  149. package/lib/requests/WriteBundleRequest.js +39 -11
  150. package/lib/requests/WriteBundlesRequest.js +51 -4
  151. package/lib/requests/asset-graph-diff.js +12 -7
  152. package/lib/requests/asset-graph-dot.js +1 -7
  153. package/lib/resolveOptions.js +37 -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 +53 -0
  159. package/lib/types/BundleGraph.d.ts +184 -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 +85 -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 +14 -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 +60 -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 +72 -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 +76 -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 +33 -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 +32 -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 +495 -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 +30 -14
  238. package/package.json +25 -35
  239. package/src/{AssetGraph.js → AssetGraph.ts} +156 -52
  240. package/src/{Atlaspack.js → Atlaspack.ts} +121 -63
  241. package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +25 -19
  242. package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +78 -54
  243. package/src/{BundleGraph.js → BundleGraph.ts} +383 -140
  244. package/src/{CommittedAsset.js → CommittedAsset.ts} +15 -13
  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} +179 -87
  251. package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
  252. package/src/{RequestTracker.js → RequestTracker.ts} +572 -357
  253. package/src/{SymbolPropagation.js → SymbolPropagation.ts} +165 -57
  254. package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +7 -1
  255. package/src/{Transformation.js → Transformation.ts} +74 -64
  256. package/src/{UncommittedAsset.js → UncommittedAsset.ts} +60 -39
  257. package/src/{Validation.js → Validation.ts} +32 -17
  258. package/src/{applyRuntimes.js → applyRuntimes.ts} +133 -26
  259. package/src/{assetUtils.js → assetUtils.ts} +49 -36
  260. package/src/atlaspack-v3/AtlaspackV3.ts +111 -0
  261. package/src/atlaspack-v3/{NapiWorkerPool.js → NapiWorkerPool.ts} +15 -6
  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.ts +102 -0
  267. package/src/atlaspack-v3/worker/compat/{dependency.js → dependency.ts} +13 -13
  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} +21 -20
  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} +124 -71
  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} +41 -28
  285. package/src/public/{Bundle.js → Bundle.ts} +28 -29
  286. package/src/public/{BundleGraph.js → BundleGraph.ts} +103 -68
  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} +129 -80
  297. package/src/requests/AssetGraphRequestRust.ts +364 -0
  298. package/src/requests/{AssetRequest.js → AssetRequest.ts} +24 -18
  299. package/src/requests/{AtlaspackBuildRequest.js → AtlaspackBuildRequest.ts} +46 -32
  300. package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +72 -58
  301. package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +93 -76
  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} +20 -22
  306. package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
  307. package/src/requests/{TargetRequest.js → TargetRequest.ts} +260 -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} +109 -37
  311. package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +25 -21
  312. package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
  313. package/src/{resolveOptions.js → resolveOptions.ts} +57 -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 +650 -0
  318. package/src/{utils.js → utils.ts} +52 -21
  319. package/src/{worker.js → worker.ts} +50 -42
  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} +76 -16
  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} +66 -92
  340. package/test/fixtures/config-with-reporters/.parcelrc +7 -0
  341. package/test/fixtures/custom-targets/package.json +6 -0
  342. package/test/public/Config.test.ts +104 -0
  343. package/test/requests/AssetGraphRequestRust.test.ts +443 -0
  344. package/test/requests/{ConfigRequest.test.js → ConfigRequest.test.ts} +202 -13
  345. package/test/requests/{DevDepRequest.test.js → DevDepRequest.test.ts} +0 -2
  346. package/test/{test-utils.js → test-utils.ts} +4 -11
  347. package/test/{utils.test.js → utils.test.ts} +1 -3
  348. package/tsconfig.json +60 -0
  349. package/tsconfig.tsbuildinfo +1 -0
  350. package/index.d.ts +0 -30
  351. package/src/atlaspack-v3/AtlaspackV3.js +0 -87
  352. package/src/atlaspack-v3/jsCallable.js +0 -18
  353. package/src/atlaspack-v3/worker/compat/bitflags.js +0 -100
  354. package/src/index.js +0 -13
  355. package/src/requests/AssetGraphRequestRust.js +0 -263
  356. package/src/types.js +0 -600
  357. package/test/Environment.test.js +0 -119
  358. package/test/PackagerRunner.test.js +0 -27
  359. package/test/PublicEnvironment.test.js +0 -27
  360. package/test/requests/AssetGraphRequestRust.test.js +0 -411
@@ -29,11 +29,11 @@ function _semver() {
29
29
  var _utils = require("../utils");
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
31
  const inspect = Symbol.for('nodejs.util.inspect.custom');
32
- const BROWSER_ENVS = exports.BROWSER_ENVS = new Set(['browser', 'web-worker', 'service-worker', 'worklet', 'electron-renderer']);
32
+ const BROWSER_ENVS = exports.BROWSER_ENVS = new Set(['browser', 'web-worker', 'service-worker', 'worklet', 'tesseract', 'electron-renderer']);
33
33
  const ELECTRON_ENVS = new Set(['electron-main', 'electron-renderer']);
34
34
  const NODE_ENVS = new Set(['node', ...ELECTRON_ENVS]);
35
35
  const WORKER_ENVS = new Set(['web-worker', 'service-worker']);
36
- const ISOLATED_ENVS = exports.ISOLATED_ENVS = new Set([...WORKER_ENVS, 'worklet']);
36
+ const ISOLATED_ENVS = exports.ISOLATED_ENVS = new Set([...WORKER_ENVS, 'worklet', 'tesseract']);
37
37
  const ALL_BROWSERS = ['chrome', 'and_chr', 'edge', 'firefox', 'and_ff', 'safari', 'ios', 'samsung', 'opera', 'ie', 'op_mini', 'blackberry', 'op_mob', 'ie_mob', 'and_uc', 'and_qq', 'baidu', 'kaios'];
38
38
 
39
39
  // See require("caniuse-api").getSupport(<feature name>)
@@ -127,9 +127,10 @@ function environmentToInternalEnvironment(environment) {
127
127
  return (0, _nullthrows().default)(_environmentToInternalEnvironment.get(environment));
128
128
  }
129
129
  class Environment {
130
- #environment /*: InternalEnvironment */;
131
- #options /*: AtlaspackOptions */;
132
-
130
+ // @ts-expect-error TS2564
131
+ #environment;
132
+ // @ts-expect-error TS2564
133
+ #options;
133
134
  constructor(env, options) {
134
135
  let existing = internalEnvironmentToEnvironment.get(env);
135
136
  if (existing != null) {
@@ -177,8 +178,9 @@ class Environment {
177
178
  get unstableSingleFileOutput() {
178
179
  return this.#environment.unstableSingleFileOutput;
179
180
  }
180
-
181
- // $FlowFixMe[unsupported-syntax]
181
+ get customEnv() {
182
+ return this.#environment.customEnv;
183
+ }
182
184
  [inspect]() {
183
185
  return `Env(${this.#environment.context})`;
184
186
  }
@@ -200,6 +202,9 @@ class Environment {
200
202
  isWorklet() {
201
203
  return this.#environment.context === 'worklet';
202
204
  }
205
+ isTesseract() {
206
+ return this.#environment.context === 'tesseract';
207
+ }
203
208
  matchesEngines(minVersions, defaultValue = false) {
204
209
  // Determine if the environment matches some minimum version requirements.
205
210
  // For browsers, we run a browserslist query with and without the minimum
@@ -26,7 +26,7 @@ function _rust() {
26
26
  return data;
27
27
  }
28
28
  var _BundleGraph = _interopRequireDefault(require("./BundleGraph"));
29
- var _BundleGraph2 = _interopRequireWildcard(require("../BundleGraph"));
29
+ var _BundleGraph2 = require("../BundleGraph");
30
30
  var _Bundle = require("./Bundle");
31
31
  var _Asset = require("./Asset");
32
32
  var _utils = require("../utils");
@@ -38,6 +38,14 @@ var _projectPath = require("../projectPath");
38
38
  var _types = require("../types");
39
39
  var _BundleGroup = _interopRequireWildcard(require("./BundleGroup"));
40
40
  var _IdentifierRegistry = require("../IdentifierRegistry");
41
+ var _EnvironmentManager = require("../EnvironmentManager");
42
+ function _featureFlags() {
43
+ const data = require("@atlaspack/feature-flags");
44
+ _featureFlags = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
41
49
  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); }
42
50
  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; }
43
51
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -53,9 +61,9 @@ function createBundleId(data) {
53
61
  return id;
54
62
  }
55
63
  class MutableBundleGraph extends _BundleGraph.default {
56
- #graph /*: InternalBundleGraph */;
57
- #options /*: AtlaspackOptions */;
58
- #bundlePublicIds /*: Set<string> */ = new Set();
64
+ #graph;
65
+ #options;
66
+ #bundlePublicIds = new Set();
59
67
  constructor(graph, options) {
60
68
  super(graph, _Bundle.Bundle.get.bind(_Bundle.Bundle), options);
61
69
  this.#graph = graph;
@@ -65,10 +73,18 @@ class MutableBundleGraph extends _BundleGraph.default {
65
73
  this.#graph.addAssetToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
66
74
  }
67
75
  addAssetGraphToBundle(asset, bundle, shouldSkipDependency) {
68
- this.#graph.addAssetGraphToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle), shouldSkipDependency ? d => shouldSkipDependency(new _Dependency.default(d, this.#options)) : undefined);
76
+ this.#graph.addAssetGraphToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle),
77
+ // @ts-expect-error TS2345
78
+ shouldSkipDependency ? d =>
79
+ // @ts-expect-error TS2345
80
+ shouldSkipDependency(new _Dependency.default(d, this.#options)) : undefined);
69
81
  }
70
82
  addEntryToBundle(asset, bundle, shouldSkipDependency) {
71
- this.#graph.addEntryToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle), shouldSkipDependency ? d => shouldSkipDependency(new _Dependency.default(d, this.#options)) : undefined);
83
+ this.#graph.addEntryToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle),
84
+ // @ts-expect-error TS2345
85
+ shouldSkipDependency ? d =>
86
+ // @ts-expect-error TS2345
87
+ shouldSkipDependency(new _Dependency.default(d, this.#options)) : undefined);
72
88
  }
73
89
  createBundleGroup(dependency, target) {
74
90
  let dependencyNode = this.#graph._graph.getNodeByContentKey(dependency.id);
@@ -121,10 +137,14 @@ class MutableBundleGraph extends _BundleGraph.default {
121
137
  this.#graph.internalizeAsyncDependency((0, _Bundle.bundleToInternalBundle)(bundle), (0, _Dependency.dependencyToInternalDependency)(dependency));
122
138
  }
123
139
  createBundle(opts) {
124
- let entryAsset = opts.entryAsset ? (0, _Asset.assetToAssetValue)(opts.entryAsset) : null;
140
+ // @ts-expect-error TS2339
141
+ let entryAsset = opts.entryAsset ?
142
+ // @ts-expect-error TS2339
143
+ (0, _Asset.assetToAssetValue)(opts.entryAsset) : null;
125
144
  let target = (0, _Target.targetToInternalTarget)(opts.target);
126
145
  let bundleId = createBundleId({
127
146
  entryAssetId: (entryAsset === null || entryAsset === void 0 ? void 0 : entryAsset.id) ?? null,
147
+ // @ts-expect-error TS2339
128
148
  uniqueKey: opts.uniqueKey ?? null,
129
149
  distDir: target.distDir,
130
150
  bundleBehavior: opts.bundleBehavior ?? null
@@ -142,20 +162,42 @@ class MutableBundleGraph extends _BundleGraph.default {
142
162
  (0, _assert().default)((entryAssetNode === null || entryAssetNode === void 0 ? void 0 : entryAssetNode.type) === 'asset', 'Entry asset does not exist');
143
163
  isPlaceholder = entryAssetNode.requested === false;
144
164
  }
165
+ let entryAssetIds = [];
166
+ if (entryAsset) {
167
+ entryAssetIds = [entryAsset.id];
168
+ if ((0, _featureFlags().getFeatureFlag)('supportWebpackChunkName')) {
169
+ // @ts-expect-error TS2339
170
+ let bundleRoots = opts.bundleRoots ?? [entryAsset];
171
+ let bundleRootIds = bundleRoots.map(({
172
+ id
173
+ }) => id).filter(assetId => assetId !== entryAsset.id);
174
+ entryAssetIds.push(...bundleRootIds);
175
+ }
176
+ }
145
177
  let bundleNode = {
146
178
  type: 'bundle',
147
179
  id: bundleId,
148
180
  value: {
149
181
  id: bundleId,
150
182
  hashReference: this.#options.shouldContentHash ? _constants.HASH_REF_PREFIX + bundleId : bundleId.slice(-8),
183
+ // @ts-expect-error TS2339
151
184
  type: opts.entryAsset ? opts.entryAsset.type : opts.type,
152
- env: opts.env ? (0, _Environment.environmentToInternalEnvironment)(opts.env) : (0, _nullthrows().default)(entryAsset).env,
153
- entryAssetIds: entryAsset ? [entryAsset.id] : [],
185
+ // @ts-expect-error TS2339
186
+ env: opts.env ?
187
+ // @ts-expect-error TS2339
188
+ (0, _EnvironmentManager.toEnvironmentRef)((0, _Environment.environmentToInternalEnvironment)(opts.env)) : (0, _nullthrows().default)(entryAsset).env,
189
+ entryAssetIds,
154
190
  mainEntryId: entryAsset === null || entryAsset === void 0 ? void 0 : entryAsset.id,
191
+ // @ts-expect-error TS2339
155
192
  pipeline: opts.entryAsset ? opts.entryAsset.pipeline : opts.pipeline,
156
193
  needsStableName: opts.needsStableName,
157
194
  bundleBehavior: opts.bundleBehavior != null ? _types.BundleBehavior[opts.bundleBehavior] : null,
158
- isSplittable: opts.entryAsset ? opts.entryAsset.isBundleSplittable : opts.isSplittable,
195
+ // @ts-expect-error TS2339
196
+ isSplittable: opts.entryAsset ?
197
+ // @ts-expect-error TS2339
198
+ opts.entryAsset.isBundleSplittable :
199
+ // @ts-expect-error TS2339
200
+ opts.isSplittable,
159
201
  isPlaceholder,
160
202
  target,
161
203
  name: null,
@@ -165,8 +207,8 @@ class MutableBundleGraph extends _BundleGraph.default {
165
207
  }
166
208
  };
167
209
  let bundleNodeId = this.#graph._graph.addNodeByContentKey(bundleId, bundleNode);
168
- if (opts.entryAsset) {
169
- this.#graph._graph.addEdge(bundleNodeId, this.#graph._graph.getNodeIdByContentKey(opts.entryAsset.id));
210
+ for (let assetId of entryAssetIds) {
211
+ this.#graph._graph.addEdge(bundleNodeId, this.#graph._graph.getNodeIdByContentKey(assetId));
170
212
  }
171
213
  return _Bundle.Bundle.get(bundleNode.value, this.#graph, this.#options);
172
214
  }
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  let parcelOptionsToPluginOptions = new WeakMap();
8
8
  class PluginOptions {
9
- #options /*: AtlaspackOptions */;
10
-
9
+ // @ts-expect-error TS2564
10
+ #options;
11
11
  constructor(options) {
12
12
  let existing = parcelOptionsToPluginOptions.get(options);
13
13
  if (existing != null) {
@@ -31,7 +31,9 @@ class AssetSymbols {
31
31
  /*::
32
32
  @@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, meta?: ?Meta|}]> { return ({}: any); }
33
33
  */
34
+ // @ts-expect-error TS2564
34
35
  #value;
36
+ // @ts-expect-error TS2564
35
37
  #options;
36
38
  constructor(options, asset) {
37
39
  let existing = valueToSymbols.get(asset);
@@ -67,12 +69,10 @@ class AssetSymbols {
67
69
  var _this$value$symbols3;
68
70
  return ((_this$value$symbols3 = this.#value.symbols) === null || _this$value$symbols3 === void 0 ? void 0 : _this$value$symbols3.keys()) ?? [];
69
71
  }
70
- // $FlowFixMe
72
+ // @ts-expect-error TS2416
71
73
  [Symbol.iterator]() {
72
74
  return this.#value.symbols ? this.#value.symbols[Symbol.iterator]() : EMPTY_ITERATOR;
73
75
  }
74
-
75
- // $FlowFixMe
76
76
  [inspect]() {
77
77
  return `AssetSymbols(${this.#value.symbols ? [...this.#value.symbols].map(([s, {
78
78
  local
@@ -85,7 +85,9 @@ class MutableAssetSymbols {
85
85
  /*::
86
86
  @@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, meta?: ?Meta|}]> { return ({}: any); }
87
87
  */
88
+ // @ts-expect-error TS2564
88
89
  #value;
90
+ // @ts-expect-error TS2564
89
91
  #options;
90
92
  constructor(options, asset) {
91
93
  let existing = valueToMutableAssetSymbols.get(asset);
@@ -120,15 +122,13 @@ class MutableAssetSymbols {
120
122
  return this.#value.symbols == null;
121
123
  }
122
124
  exportSymbols() {
123
- // $FlowFixMe
125
+ // @ts-expect-error TS2322
124
126
  return this.#value.symbols.keys();
125
127
  }
126
- // $FlowFixMe
128
+ // @ts-expect-error TS2416
127
129
  [Symbol.iterator]() {
128
130
  return this.#value.symbols ? this.#value.symbols[Symbol.iterator]() : EMPTY_ITERATOR;
129
131
  }
130
-
131
- // $FlowFixMe
132
132
  [inspect]() {
133
133
  return `MutableAssetSymbols(${this.#value.symbols ? [...this.#value.symbols].map(([s, {
134
134
  local
@@ -159,7 +159,9 @@ class MutableDependencySymbols {
159
159
  /*::
160
160
  @@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, isWeak: boolean, meta?: ?Meta|}]> { return ({}: any); }
161
161
  */
162
+ // @ts-expect-error TS2564
162
163
  #value;
164
+ // @ts-expect-error TS2564
163
165
  #options;
164
166
  constructor(options, dep) {
165
167
  let existing = valueToMutableDependencySymbols.get(dep);
@@ -192,16 +194,14 @@ class MutableDependencySymbols {
192
194
  return this.#value.symbols == null;
193
195
  }
194
196
  exportSymbols() {
195
- // $FlowFixMe
197
+ // @ts-expect-error TS2322
196
198
  return this.#value.symbols ? this.#value.symbols.keys() : EMPTY_ITERABLE;
197
199
  }
198
200
 
199
- // $FlowFixMe
201
+ // @ts-expect-error TS2416
200
202
  [Symbol.iterator]() {
201
203
  return this.#value.symbols ? this.#value.symbols[Symbol.iterator]() : EMPTY_ITERATOR;
202
204
  }
203
-
204
- // $FlowFixMe
205
205
  [inspect]() {
206
206
  return `MutableDependencySymbols(${this.#value.symbols ? [...this.#value.symbols].map(([s, {
207
207
  local,
@@ -15,6 +15,7 @@ function _nullthrows() {
15
15
  var _Environment = _interopRequireDefault(require("./Environment"));
16
16
  var _projectPath = require("../projectPath");
17
17
  var _utils = require("../utils");
18
+ var _EnvironmentManager = require("../EnvironmentManager");
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
20
  const inspect = Symbol.for('nodejs.util.inspect.custom');
20
21
  const internalTargetToTarget = new WeakMap();
@@ -23,9 +24,10 @@ function targetToInternalTarget(target) {
23
24
  return (0, _nullthrows().default)(_targetToInternalTarget.get(target));
24
25
  }
25
26
  class Target {
26
- #target /*: TargetValue */;
27
- #options /*: AtlaspackOptions */;
28
-
27
+ // @ts-expect-error TS2564
28
+ #target;
29
+ // @ts-expect-error TS2564
30
+ #options;
29
31
  constructor(target, options) {
30
32
  let existing = internalTargetToTarget.get(target);
31
33
  if (existing != null) {
@@ -44,7 +46,7 @@ class Target {
44
46
  return (0, _projectPath.fromProjectPath)(this.#options.projectRoot, this.#target.distDir);
45
47
  }
46
48
  get env() {
47
- return new _Environment.default(this.#target.env, this.#options);
49
+ return new _Environment.default((0, _EnvironmentManager.fromEnvironmentId)(this.#target.env), this.#options);
48
50
  }
49
51
  get name() {
50
52
  return this.#target.name;
@@ -55,9 +57,8 @@ class Target {
55
57
  get loc() {
56
58
  return (0, _utils.fromInternalSourceLocation)(this.#options.projectRoot, this.#target.loc);
57
59
  }
58
-
59
- // $FlowFixMe[unsupported-syntax]
60
60
  [inspect]() {
61
+ // @ts-expect-error TS7053
61
62
  return `Target(${this.name} - ${this.env[inspect]()})`;
62
63
  }
63
64
  }
@@ -25,8 +25,13 @@ var _BundleGraph = _interopRequireDefault(require("./BundleGraph"));
25
25
  var _Config = _interopRequireDefault(require("./public/Config"));
26
26
  var _RequestTracker = require("./RequestTracker");
27
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
+ // flow-to-ts helpers
29
+
30
+ // /flow-to-ts helpers
31
+ // @ts-expect-error TS7034
28
32
  let coreRegistered;
29
33
  function registerCoreWithSerializer() {
34
+ // @ts-expect-error TS7005
30
35
  if (coreRegistered) {
31
36
  return;
32
37
  }
@@ -34,8 +39,6 @@ function registerCoreWithSerializer() {
34
39
  if (typeof packageVersion !== 'string') {
35
40
  throw new Error('Expected package version to be a string');
36
41
  }
37
-
38
- // $FlowFixMe[incompatible-cast]
39
42
  for (let [name, ctor] of Object.entries({
40
43
  AssetGraph: _AssetGraph.default,
41
44
  Config: _Config.default,
@@ -43,7 +46,6 @@ function registerCoreWithSerializer() {
43
46
  Graph: _graph().Graph,
44
47
  AtlaspackConfig: _AtlaspackConfig.AtlaspackConfig,
45
48
  RequestGraph: _RequestTracker.RequestGraph
46
- // $FlowFixMe[unclear-type]
47
49
  })) {
48
50
  (0, _buildCache().registerSerializableClass)(packageVersion + ':' + name, ctor);
49
51
  }
@@ -26,6 +26,13 @@ function _nullthrows() {
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 _utils() {
30
37
  const data = require("@atlaspack/utils");
31
38
  _utils = function () {
@@ -66,9 +73,10 @@ function createAssetGraphRequest(requestInput) {
66
73
  run: async input => {
67
74
  let prevResult = await input.api.getPreviousResult();
68
75
  let builder = new AssetGraphBuilder(input, prevResult);
69
- let assetGraphRequest = await await builder.build();
76
+ let assetGraphRequest = await builder.build();
70
77
 
71
78
  // early break for incremental bundling if production or flag is off;
79
+ assetGraphRequest.assetGraph.setDisableIncrementalBundling(!input.options.shouldBundleIncrementally || input.options.mode === 'production');
72
80
  if (!input.options.shouldBundleIncrementally || input.options.mode === 'production') {
73
81
  assetGraphRequest.assetGraph.safeToIncrementallyBundle = false;
74
82
  }
@@ -116,8 +124,16 @@ class AssetGraphBuilder {
116
124
  this.shouldBuildLazily = shouldBuildLazily ?? false;
117
125
  this.lazyIncludes = lazyIncludes ?? [];
118
126
  this.lazyExcludes = lazyExcludes ?? [];
119
- this.cacheKey = (0, _rust().hashString)(`${_constants.ATLASPACK_VERSION}${name}${JSON.stringify(entries) ?? ''}${options.mode}${options.shouldBuildLazily ? 'lazy' : 'eager'}`) + '-AssetGraph';
120
- this.isSingleChangeRebuild = api.getInvalidSubRequests().filter(req => req.requestType === 'asset_request').length === 1;
127
+ this.skipSymbolProp = input.skipSymbolProp ?? false;
128
+ if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
129
+ const key = (0, _rust().hashString)(`${_constants.ATLASPACK_VERSION}${name}${JSON.stringify(entries) ?? ''}${options.mode}${options.shouldBuildLazily ? 'lazy' : 'eager'}`);
130
+ this.cacheKey = `AssetGraph/${_constants.ATLASPACK_VERSION}/${options.mode}/${key}`;
131
+ } else {
132
+ this.cacheKey = (0, _rust().hashString)(`${_constants.ATLASPACK_VERSION}${name}${JSON.stringify(entries) ?? ''}${options.mode}${options.shouldBuildLazily ? 'lazy' : 'eager'}`) + '-AssetGraph';
133
+ }
134
+ this.isSingleChangeRebuild = api.getInvalidSubRequests()
135
+ // @ts-expect-error TS2367
136
+ .filter(req => req.requestType === 'asset_request').length === 1;
121
137
  this.queue = new (_utils().PromiseQueue)();
122
138
  assetGraph.onNodeRemoved = nodeId => {
123
139
  this.assetGroupsWithRemovedParents.delete(nodeId);
@@ -156,7 +172,9 @@ class AssetGraphBuilder {
156
172
  const visitChildren = nodeId => {
157
173
  for (let childNodeId of this.assetGraph.getNodeIdsConnectedFrom(nodeId)) {
158
174
  let child = (0, _nullthrows().default)(this.assetGraph.getNode(childNodeId));
159
- if ((!visited.has(childNodeId) || child.hasDeferred) && this.shouldVisitChild(nodeId, childNodeId)) {
175
+ if (
176
+ // @ts-expect-error TS2339
177
+ (!visited.has(childNodeId) || child.hasDeferred) && this.shouldVisitChild(nodeId, childNodeId)) {
160
178
  if (child.type === 'asset_group') {
161
179
  visitedAssetGroups.add(childNodeId);
162
180
  }
@@ -199,34 +217,43 @@ class AssetGraphBuilder {
199
217
  }
200
218
  if (this.assetGraph.nodes.length > 1) {
201
219
  await (0, _dumpGraphToGraphViz.default)(this.assetGraph, 'AssetGraph_' + this.name + '_before_prop');
202
- try {
203
- let errors = (0, _SymbolPropagation.propagateSymbols)({
204
- options: this.options,
205
- assetGraph: this.assetGraph,
206
- changedAssetsPropagation: this.changedAssetsPropagation,
207
- assetGroupsWithRemovedParents: this.assetGroupsWithRemovedParents,
208
- previousErrors: this.previousSymbolPropagationErrors
220
+
221
+ // Skip symbol propagation for runtime assets - they have pre-computed symbol data
222
+ if (this.skipSymbolProp) {
223
+ _logger().default.verbose({
224
+ origin: '@atlaspack/core',
225
+ message: 'Skipping symbol propagation for runtime asset graph'
209
226
  });
210
- this.changedAssetsPropagation.clear();
211
- if (errors.size > 0) {
212
- this.api.storeResult({
227
+ } else {
228
+ try {
229
+ let errors = (0, _SymbolPropagation.propagateSymbols)({
230
+ options: this.options,
213
231
  assetGraph: this.assetGraph,
214
- changedAssets: this.changedAssets,
215
232
  changedAssetsPropagation: this.changedAssetsPropagation,
216
233
  assetGroupsWithRemovedParents: this.assetGroupsWithRemovedParents,
217
- previousSymbolPropagationErrors: errors,
218
- assetRequests: []
219
- }, this.cacheKey);
220
-
221
- // Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
222
- // determining which failing export is the root cause is nontrivial (because of circular dependencies).
223
- throw new (_diagnostic().default)({
224
- diagnostic: [...errors.values()][0]
234
+ previousErrors: this.previousSymbolPropagationErrors
225
235
  });
236
+ this.changedAssetsPropagation.clear();
237
+ if (errors.size > 0) {
238
+ this.api.storeResult({
239
+ assetGraph: this.assetGraph,
240
+ changedAssets: this.changedAssets,
241
+ changedAssetsPropagation: this.changedAssetsPropagation,
242
+ assetGroupsWithRemovedParents: this.assetGroupsWithRemovedParents,
243
+ previousSymbolPropagationErrors: errors,
244
+ assetRequests: []
245
+ }, this.cacheKey);
246
+
247
+ // Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
248
+ // determining which failing export is the root cause is nontrivial (because of circular dependencies).
249
+ throw new (_diagnostic().default)({
250
+ diagnostic: [...errors.values()][0]
251
+ });
252
+ }
253
+ } catch (e) {
254
+ await (0, _dumpGraphToGraphViz.default)(this.assetGraph, 'AssetGraph_' + this.name + '_failed');
255
+ throw e;
226
256
  }
227
- } catch (e) {
228
- await (0, _dumpGraphToGraphViz.default)(this.assetGraph, 'AssetGraph_' + this.name + '_failed');
229
- throw e;
230
257
  }
231
258
  }
232
259
  await (0, _dumpGraphToGraphViz.default)(this.assetGraph, 'AssetGraph_' + this.name);
@@ -317,7 +344,14 @@ class AssetGraphBuilder {
317
344
  }
318
345
  shouldSkipRequest(nodeId) {
319
346
  let node = (0, _nullthrows().default)(this.assetGraph.getNode(nodeId));
320
- return node.complete === true || !typesWithRequests.has(node.type) || node.correspondingRequest != null && this.api.canSkipSubrequest(node.correspondingRequest);
347
+ return (
348
+ // @ts-expect-error TS2339
349
+ node.complete === true || !typesWithRequests.has(node.type) ||
350
+ // @ts-expect-error TS2339
351
+ node.correspondingRequest != null &&
352
+ // @ts-expect-error TS2339
353
+ this.api.canSkipSubrequest(node.correspondingRequest)
354
+ );
321
355
  }
322
356
  queueCorrespondingRequest(nodeId, errors) {
323
357
  let promise;
@@ -356,6 +390,7 @@ class AssetGraphBuilder {
356
390
  let didEntriesChange = prevEntries.length !== currentEntries.length || prevEntries.every((entryId, index) => entryId === currentEntries[index]);
357
391
  if (didEntriesChange) {
358
392
  this.assetGraph.safeToIncrementallyBundle = false;
393
+ this.assetGraph.setNeedsBundling();
359
394
  }
360
395
  }
361
396
  }
@@ -378,6 +413,7 @@ class AssetGraphBuilder {
378
413
  }
379
414
  async runAssetRequest(input) {
380
415
  this.assetRequests.push(input);
416
+ // @ts-expect-error TS2345
381
417
  let request = (0, _AssetRequest.default)({
382
418
  ...input,
383
419
  name: this.name,
@@ -389,16 +425,26 @@ class AssetGraphBuilder {
389
425
  });
390
426
  if (assets != null) {
391
427
  for (let asset of assets) {
428
+ // Pass the runtimeAssetRequiringExecutionOnLoad flag from the asset
429
+ // group down to the asset itself, for reading in the packager.
430
+ if (input.runtimeAssetRequiringExecutionOnLoad) {
431
+ asset.meta = {
432
+ ...(asset.meta ?? {}),
433
+ runtimeAssetRequiringExecutionOnLoad: input.runtimeAssetRequiringExecutionOnLoad
434
+ };
435
+ }
392
436
  if (this.assetGraph.safeToIncrementallyBundle) {
393
437
  let otherAsset = this.assetGraph.getNodeByContentKey(asset.id);
394
438
  if (otherAsset != null) {
395
439
  (0, _assert().default)(otherAsset.type === 'asset');
396
440
  if (!this._areDependenciesEqualForAssets(asset, otherAsset.value)) {
397
441
  this.assetGraph.safeToIncrementallyBundle = false;
442
+ this.assetGraph.setNeedsBundling();
398
443
  }
399
444
  } else {
400
445
  // adding a new entry or dependency
401
446
  this.assetGraph.safeToIncrementallyBundle = false;
447
+ this.assetGraph.setNeedsBundling();
402
448
  }
403
449
  }
404
450
  this.changedAssets.set(asset.id, asset);
@@ -407,6 +453,7 @@ class AssetGraphBuilder {
407
453
  this.assetGraph.resolveAssetGroup(input, assets, request.id);
408
454
  } else {
409
455
  this.assetGraph.safeToIncrementallyBundle = false;
456
+ this.assetGraph.setNeedsBundling();
410
457
  }
411
458
  this.isSingleChangeRebuild = false;
412
459
  }