@atlaspack/core 2.16.2-canary.27 → 2.16.2-canary.270

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 (358) hide show
  1. package/CHANGELOG.md +665 -0
  2. package/dist/AssetGraph.js +591 -0
  3. package/dist/Atlaspack.js +658 -0
  4. package/dist/AtlaspackConfig.js +324 -0
  5. package/dist/AtlaspackConfig.schema.js +108 -0
  6. package/dist/BundleGraph.js +1635 -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 +490 -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 +297 -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 +262 -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 +445 -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 +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 +81 -37
  84. package/lib/AtlaspackConfig.js +15 -3
  85. package/lib/AtlaspackConfig.schema.js +7 -5
  86. package/lib/BundleGraph.js +90 -32
  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 +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 +26 -10
  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 +43 -7
  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 +42 -5
  137. package/lib/requests/AssetGraphRequestRust.js +126 -62
  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 +34 -19
  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 +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 +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 +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 +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 +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 +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 +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} +114 -61
  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} +231 -140
  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} +178 -86
  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} +71 -62
  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} +102 -66
  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} +84 -49
  297. package/src/requests/AssetGraphRequestRust.ts +352 -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} +71 -58
  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} +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} +75 -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} +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.js → AssetGraphRequestRust.test.ts} +164 -134
  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 +57 -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/index.js +0 -13
  354. package/src/requests/AssetGraphRequestRust.js +0 -263
  355. package/src/types.js +0 -600
  356. package/test/Environment.test.js +0 -119
  357. package/test/PackagerRunner.test.js +0 -27
  358. package/test/PublicEnvironment.test.js +0 -27
@@ -0,0 +1,12 @@
1
+ import type { NapiWorkerPool as INapiWorkerPool } from '@atlaspack/types';
2
+ import type { Transferable } from '@atlaspack/rust';
3
+ export type NapiWorkerPoolOptions = {
4
+ workerCount?: number;
5
+ };
6
+ export declare class NapiWorkerPool implements INapiWorkerPool {
7
+ #private;
8
+ constructor({ workerCount }?: NapiWorkerPoolOptions);
9
+ workerCount(): number;
10
+ getWorkers(): Promise<Array<Transferable>>;
11
+ shutdown(): void;
12
+ }
@@ -0,0 +1,12 @@
1
+ import type { FileSystem, JsCallable } from '@atlaspack/rust';
2
+ import type { Encoding, FilePath, FileSystem as IFileSystem } from '@atlaspack/types';
3
+ export declare class FileSystemV3 implements FileSystem {
4
+ #private;
5
+ constructor(fs: IFileSystem);
6
+ canonicalize: JsCallable<[FilePath], FilePath>;
7
+ createDirectory: JsCallable<[FilePath], Promise<undefined>>;
8
+ cwd: JsCallable<[], FilePath>;
9
+ isFile: JsCallable<[FilePath], boolean>;
10
+ isDir: JsCallable<[FilePath], boolean>;
11
+ readFile: JsCallable<[FilePath, Encoding], string>;
12
+ }
@@ -0,0 +1,5 @@
1
+ export { FileSystemV3 } from './fs';
2
+ export { AtlaspackV3 } from './AtlaspackV3';
3
+ export { NapiWorkerPool } from './NapiWorkerPool';
4
+ export * from './AtlaspackV3';
5
+ export * from './NapiWorkerPool';
@@ -0,0 +1 @@
1
+ export declare function jsCallable<Args extends ReadonlyArray<unknown>, Return>(fn: (...rest: Args) => Return | Promise<Return>): (...rest: Args) => Promise<Return>;
@@ -0,0 +1,51 @@
1
+ import type { Symbol as NapiSymbol } from '@atlaspack/rust';
2
+ import type { AssetSymbols as IAssetSymbols, MutableAssetSymbols as IMutableAssetSymbols, MutableDependencySymbols as IMutableDependencySymbols, Symbol, SourceLocation, Meta } from '@atlaspack/types';
3
+ export declare class MutableDependencySymbols implements IMutableDependencySymbols {
4
+ #private;
5
+ get isCleared(): boolean;
6
+ constructor(inner: NapiSymbol[] | null | undefined | null);
7
+ ensure(): void;
8
+ get(exportSymbol: Symbol): DependencyAssetSymbol | null | undefined;
9
+ hasExportSymbol(exportSymbol: Symbol): boolean;
10
+ hasLocalSymbol(local: Symbol): boolean;
11
+ exportSymbols(): Iterable<Symbol>;
12
+ set(exportSymbol: Symbol, local: Symbol, loc?: SourceLocation | null, isWeak?: boolean | null): void;
13
+ delete(exportSymbol: Symbol): void;
14
+ [Symbol.iterator](): MapIterator<DependencyAssetSymbol>;
15
+ }
16
+ export declare class AssetSymbols implements IAssetSymbols {
17
+ #private;
18
+ get isCleared(): boolean;
19
+ constructor(inner: NapiSymbol[] | null | undefined | null);
20
+ get(exportSymbol: Symbol): AssetSymbol | null | undefined;
21
+ hasExportSymbol(exportSymbol: Symbol): boolean;
22
+ hasLocalSymbol(local: Symbol): boolean;
23
+ exportSymbols(): Iterable<Symbol>;
24
+ intoNapi(): NapiSymbol[];
25
+ [Symbol.iterator](): MapIterator<AssetSymbol>;
26
+ }
27
+ export declare class MutableAssetSymbols implements IMutableAssetSymbols {
28
+ #private;
29
+ get isCleared(): boolean;
30
+ constructor(inner: NapiSymbol[] | null | undefined | null);
31
+ intoNapi(): NapiSymbol[];
32
+ ensure(): void;
33
+ set(exportSymbol: Symbol, local: Symbol, loc?: SourceLocation | null, meta?: Meta | null): void;
34
+ get(exportSymbol: Symbol): AssetSymbol | null | undefined;
35
+ hasExportSymbol(exportSymbol: Symbol): boolean;
36
+ hasLocalSymbol(local: Symbol): boolean;
37
+ exportSymbols(): Iterable<Symbol>;
38
+ delete(exportSymbol: Symbol): void;
39
+ [Symbol.iterator](): MapIterator<AssetSymbol>;
40
+ }
41
+ export type AssetSymbol = {
42
+ local: Symbol;
43
+ loc: SourceLocation | null | undefined;
44
+ meta?: Meta | null | undefined;
45
+ };
46
+ export type DependencyAssetSymbol = {
47
+ local: Symbol;
48
+ loc: SourceLocation | null | undefined;
49
+ meta?: Meta | null | undefined;
50
+ isWeak: boolean;
51
+ };
@@ -0,0 +1,15 @@
1
+ import type { BundleBehavior, DependencyPriority, SpecifierType } from '@atlaspack/types';
2
+ export declare class BitFlags<K, V> {
3
+ #private;
4
+ constructor(source: Partial<Record<K, V>>);
5
+ into(key: K): V;
6
+ intoNullable(key?: K | null): V | null | undefined;
7
+ intoArray(keys: K[]): V[];
8
+ from(key: V): K;
9
+ fromNullable(key?: V | null): K | null | undefined;
10
+ fromArray(keys: V[]): K[];
11
+ }
12
+ export declare const bundleBehaviorMap: BitFlags<BundleBehavior, number>;
13
+ export declare const dependencyPriorityMap: BitFlags<DependencyPriority, number>;
14
+ export declare const packageConditionsMap: BitFlags<string, number>;
15
+ export declare const specifierTypeMap: BitFlags<SpecifierType, number>;
@@ -0,0 +1,25 @@
1
+ import type { Dependency as NapiDependency } from '@atlaspack/rust';
2
+ import type { Dependency as IDependency, DependencySpecifier, SpecifierType, DependencyPriority, BundleBehavior, SourceLocation, Environment as IEnvironment, Meta, Target as ITarget, FilePath, SemverRange, MutableDependencySymbols as IMutableDependencySymbols } from '@atlaspack/types';
3
+ export declare class Dependency implements IDependency {
4
+ env: IEnvironment;
5
+ meta: Meta;
6
+ target: ITarget | null | undefined;
7
+ symbols: IMutableDependencySymbols;
8
+ specifier: DependencySpecifier;
9
+ specifierType: SpecifierType;
10
+ priority: DependencyPriority;
11
+ bundleBehavior: BundleBehavior | null | undefined;
12
+ needsStableName: boolean;
13
+ isOptional: boolean;
14
+ isEntry: boolean;
15
+ loc: SourceLocation | null | undefined;
16
+ packageConditions: Array<string> | null | undefined;
17
+ sourceAssetId: string | null | undefined;
18
+ sourcePath: FilePath | null | undefined;
19
+ sourceAssetType: string | null | undefined;
20
+ resolveFrom: FilePath | null | undefined;
21
+ range: SemverRange | null | undefined;
22
+ pipeline: string | null | undefined;
23
+ get id(): string;
24
+ constructor(inner: NapiDependency, env: IEnvironment);
25
+ }
@@ -0,0 +1,27 @@
1
+ import type { Environment as NapiEnvironment } from '@atlaspack/rust';
2
+ import type { Environment as IEnvironment, EnvironmentContext, Engines, PackageName, OutputFormat, SourceType, TargetSourceMapOptions, SourceLocation, VersionMap, EnvironmentFeature, EnvMap } from '@atlaspack/types';
3
+ export declare class Environment implements IEnvironment {
4
+ id: string;
5
+ includeNodeModules: boolean | Array<PackageName> | Partial<Record<PackageName, boolean>>;
6
+ context: EnvironmentContext;
7
+ engines: Engines;
8
+ outputFormat: OutputFormat;
9
+ sourceType: SourceType;
10
+ isLibrary: boolean;
11
+ shouldOptimize: boolean;
12
+ shouldScopeHoist: boolean;
13
+ sourceMap: TargetSourceMapOptions | null | undefined;
14
+ loc: SourceLocation | null | undefined;
15
+ unstableSingleFileOutput: boolean;
16
+ customEnv: EnvMap | null | undefined;
17
+ constructor(inner: NapiEnvironment);
18
+ isBrowser(): boolean;
19
+ isNode(): boolean;
20
+ isElectron(): boolean;
21
+ isWorker(): boolean;
22
+ isWorklet(): boolean;
23
+ isTesseract(): boolean;
24
+ isIsolated(): boolean;
25
+ matchesEngines(minVersions: VersionMap, defaultValue?: boolean): boolean;
26
+ supports(feature: EnvironmentFeature, defaultValue?: boolean): boolean;
27
+ }
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  export * from './bitflags';
3
2
  export * from './dependency';
4
3
  export * from './environment';
@@ -0,0 +1,49 @@
1
+ import SourceMap from '@parcel/source-map';
2
+ import * as napi from '@atlaspack/rust';
3
+ import { Readable } from 'stream';
4
+ import type { MutableAsset as IMutableAsset, Stats, FileSystem, FilePath, Environment, Meta, BundleBehavior, ASTGenerator, AST, Dependency, DependencyOptions, FileCreateInvalidation, EnvironmentOptions } from '@atlaspack/types';
5
+ import { MutableAssetSymbols } from './asset-symbols';
6
+ export type InnerAsset = napi.Asset;
7
+ export declare class MutableAsset implements IMutableAsset {
8
+ #private;
9
+ bundleBehavior: BundleBehavior | null | undefined;
10
+ env: Environment;
11
+ filePath: FilePath;
12
+ fs: FileSystem;
13
+ id: string;
14
+ isBundleSplittable: boolean;
15
+ isMapDirty: boolean;
16
+ isSource: boolean;
17
+ meta: Meta;
18
+ pipeline: string | null | undefined;
19
+ query: URLSearchParams;
20
+ sideEffects: boolean;
21
+ stats: Stats;
22
+ symbols: MutableAssetSymbols;
23
+ type: string;
24
+ uniqueKey: string | null | undefined;
25
+ get astGenerator(): ASTGenerator | null | undefined;
26
+ set astGenerator(value?: ASTGenerator | null);
27
+ constructor(asset: InnerAsset, contents: Buffer, env: Environment, fs: FileSystem, map: string | null | undefined, projectRoot: string);
28
+ getAST(): Promise<AST | null | undefined>;
29
+ setAST(ast: AST): void;
30
+ isASTDirty(): boolean;
31
+ getCode(): Promise<string>;
32
+ setCode(code: string): void;
33
+ getBuffer(): Promise<Buffer>;
34
+ setBuffer(buf: Buffer): void;
35
+ getStream(): Readable;
36
+ setStream(stream: Readable): void;
37
+ getMap(): Promise<SourceMap | null | undefined>;
38
+ setMap(sourceMap?: SourceMap | null): void;
39
+ getMapBuffer(): Promise<Buffer | null | undefined>;
40
+ getDependencies(): ReadonlyArray<Dependency>;
41
+ addDependency(options: DependencyOptions): string;
42
+ addURLDependency(url: string, opts: Partial<DependencyOptions>): string;
43
+ setEnvironment(opts: EnvironmentOptions): void;
44
+ invalidateOnFileChange(invalidation: FilePath): void;
45
+ invalidateOnFileCreate(invalidation: FileCreateInvalidation): void;
46
+ invalidateOnEnvChange(invalidation: string): void;
47
+ invalidateOnStartup(): void;
48
+ invalidateOnBuild(): void;
49
+ }
@@ -0,0 +1,37 @@
1
+ import type { Config as IPluginConfig, DevDepOptions, FilePath, Environment, FileCreateInvalidation, ConfigResultWithFilePath, PackageJSON, PackageManager as IPackageManager } from '@atlaspack/types';
2
+ import type { FileSystem as IFileSystem } from '@atlaspack/fs';
3
+ export type PluginConfigOptions = {
4
+ isSource: boolean;
5
+ searchPath: FilePath;
6
+ projectRoot: FilePath;
7
+ env: Environment;
8
+ fs: IFileSystem;
9
+ packageManager: IPackageManager;
10
+ };
11
+ export declare class PluginConfig implements IPluginConfig {
12
+ #private;
13
+ isSource: boolean;
14
+ searchPath: FilePath;
15
+ env: Environment;
16
+ constructor({ env, isSource, searchPath, projectRoot, fs, packageManager, }: PluginConfigOptions);
17
+ invalidateOnFileChange(filePath: FilePath): void;
18
+ invalidateOnFileCreate(invalidations: FileCreateInvalidation): void;
19
+ invalidateOnEnvChange(invalidation: string): void;
20
+ invalidateOnStartup(): void;
21
+ invalidateOnBuild(): void;
22
+ addDevDependency(options: DevDepOptions): void;
23
+ setCacheKey(key: string): void;
24
+ getConfig<T>(filePaths: Array<FilePath>, options?: {
25
+ packageKey?: string;
26
+ parse?: boolean;
27
+ exclude?: boolean;
28
+ }): Promise<ConfigResultWithFilePath<T> | null | undefined>;
29
+ getConfigFrom<T>(searchPath: FilePath, filePaths: Array<FilePath>, options?: {
30
+ packageKey?: string;
31
+ parse?: boolean;
32
+ exclude?: boolean;
33
+ } | {
34
+ readTracking?: boolean;
35
+ }): Promise<ConfigResultWithFilePath<T> | null | undefined>;
36
+ getPackage(): Promise<PackageJSON | null | undefined>;
37
+ }
@@ -0,0 +1,9 @@
1
+ import type { PluginLogger as IPlguinLogger } from '@atlaspack/types';
2
+ import type { Diagnostifiable, DiagnosticWithoutOrigin } from '@atlaspack/diagnostic';
3
+ export declare class PluginLogger implements IPlguinLogger {
4
+ verbose(diagnostic: DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>): void;
5
+ info(diagnostic: DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>): void;
6
+ log(diagnostic: DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>): void;
7
+ warn(diagnostic: DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>): void;
8
+ error(input: Diagnostifiable | DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>): void;
9
+ }
@@ -0,0 +1,22 @@
1
+ import type { PluginOptions as IPluginOptions, LogLevel, FileSystem, PackageManager, EnvMap, FilePath, HMROptions, ServerOptions, DetailedReportOptions, BuildMode } from '@atlaspack/types';
2
+ import type { FeatureFlags } from '@atlaspack/feature-flags';
3
+ export declare class PluginOptions implements IPluginOptions {
4
+ #private;
5
+ get env(): EnvMap;
6
+ get projectRoot(): FilePath;
7
+ get packageManager(): PackageManager;
8
+ get mode(): BuildMode;
9
+ get parcelVersion(): string;
10
+ get hmrOptions(): HMROptions | null | undefined;
11
+ get serveOptions(): ServerOptions | false;
12
+ get shouldBuildLazily(): boolean;
13
+ get shouldAutoInstall(): boolean;
14
+ get logLevel(): LogLevel;
15
+ get cacheDir(): string;
16
+ get inputFS(): FileSystem;
17
+ get outputFS(): FileSystem;
18
+ get instanceId(): string;
19
+ get detailedReport(): DetailedReportOptions | null | undefined;
20
+ get featureFlags(): FeatureFlags;
21
+ constructor(options: Partial<IPluginOptions>);
22
+ }
@@ -0,0 +1,5 @@
1
+ import type { PluginTracer as IPluginTracer } from '@atlaspack/types';
2
+ export declare class PluginTracer implements IPluginTracer {
3
+ enabled: false;
4
+ createMeasurement(): void;
5
+ }
@@ -0,0 +1,11 @@
1
+ import type { Target as NapiTarget } from '@atlaspack/rust';
2
+ import type { Target as ITarget, FilePath, Environment, SourceLocation } from '@atlaspack/types';
3
+ export declare class Target implements ITarget {
4
+ distEntry: FilePath | null | undefined;
5
+ distDir: FilePath;
6
+ env: Environment;
7
+ name: string;
8
+ publicUrl: string;
9
+ loc: SourceLocation | null | undefined;
10
+ constructor(inner: NapiTarget, env: Environment);
11
+ }
@@ -0,0 +1,60 @@
1
+ import * as napi from '@atlaspack/rust';
2
+ import type { JsCallable } from '@atlaspack/rust';
3
+ import type { FilePath } from '@atlaspack/types';
4
+ import { FeatureFlags } from '@atlaspack/feature-flags';
5
+ export declare class AtlaspackWorker {
6
+ #private;
7
+ constructor();
8
+ loadPlugin: JsCallable<[LoadPluginOptions], Promise<undefined>>;
9
+ runResolverResolve: JsCallable<[
10
+ RunResolverResolveOptions
11
+ ], Promise<RunResolverResolveResult>>;
12
+ runTransformerTransform: JsCallable<[
13
+ RunTransformerTransformOptions,
14
+ Buffer,
15
+ string | null | undefined
16
+ ], Promise<RunTransformerTransformResult>>;
17
+ }
18
+ type LoadPluginOptions = {
19
+ kind: 'resolver' | 'transformer';
20
+ specifier: string;
21
+ resolveFrom: string;
22
+ featureFlags?: FeatureFlags;
23
+ };
24
+ type RpcPluginOptions = {
25
+ projectRoot: string;
26
+ mode: string;
27
+ };
28
+ type RunResolverResolveOptions = {
29
+ key: string;
30
+ dependency: napi.Dependency;
31
+ specifier: FilePath;
32
+ pipeline: string | null | undefined;
33
+ pluginOptions: RpcPluginOptions;
34
+ };
35
+ type RunResolverResolveResult = {
36
+ invalidations: Array<any>;
37
+ resolution: {
38
+ type: 'unresolved';
39
+ } | {
40
+ type: 'excluded';
41
+ } | {
42
+ type: 'resolved';
43
+ canDefer: boolean;
44
+ filePath: string;
45
+ sideEffects: boolean;
46
+ code?: string;
47
+ meta?: unknown;
48
+ pipeline?: string;
49
+ priority?: number | null | undefined;
50
+ query?: string;
51
+ };
52
+ };
53
+ type RunTransformerTransformOptions = {
54
+ key: string;
55
+ env: napi.Environment;
56
+ options: RpcPluginOptions;
57
+ asset: napi.Asset;
58
+ };
59
+ type RunTransformerTransformResult = [napi.RpcAssetResult, Buffer, string];
60
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare const ATLASPACK_VERSION: string;
2
+ export declare const HASH_REF_PREFIX = "HASH_REF_";
3
+ export declare const HASH_REF_HASH_LEN = 16;
4
+ export declare const HASH_REF_REGEX: RegExp;
5
+ export declare const VALID = 0;
6
+ export declare const INITIAL_BUILD: number;
7
+ export declare const FILE_CREATE: number;
8
+ export declare const FILE_UPDATE: number;
9
+ export declare const FILE_DELETE: number;
10
+ export declare const ENV_CHANGE: number;
11
+ export declare const OPTION_CHANGE: number;
12
+ export declare const STARTUP: number;
13
+ export declare const ERROR: number;
@@ -0,0 +1,10 @@
1
+ import type { Asset, BundleBehavior } from '@atlaspack/types';
2
+ import type { Graph } from '@atlaspack/graph';
3
+ import type { AssetGraphNode, BundleGraphNode } from './types';
4
+ import { bundleGraphEdgeTypes } from './BundleGraph';
5
+ import { requestGraphEdgeTypes } from './RequestTracker';
6
+ export default function dumpGraphToGraphViz(graph: Graph<AssetGraphNode> | Graph<{
7
+ assets: Set<Asset>;
8
+ sourceBundles: Set<number>;
9
+ bundleBehavior?: BundleBehavior | null | undefined;
10
+ }> | Graph<BundleGraphNode>, name: string, edgeTypes?: typeof bundleGraphEdgeTypes | typeof requestGraphEdgeTypes): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import * as EnvironmentManager from './EnvironmentManager';
2
+ export { default, default as Atlaspack, default as Parcel, BuildError, createWorkerFarm, INTERNAL_RESOLVE, INTERNAL_TRANSFORM, WORKER_PATH, } from './Atlaspack';
3
+ export { ATLASPACK_VERSION } from './constants';
4
+ export { default as resolveOptions } from './resolveOptions';
5
+ export { createEnvironment } from './Environment';
6
+ export { default as Environment } from './public/Environment';
7
+ export * from './atlaspack-v3';
8
+ export { EnvironmentManager };
@@ -0,0 +1,8 @@
1
+ import type { FilePath, PackageName, Semver } from '@atlaspack/types';
2
+ import type { AtlaspackOptions } from './types';
3
+ import { ProjectPath } from './projectPath';
4
+ export default function loadPlugin<T>(pluginName: PackageName, configPath: FilePath, keyPath: string | null | undefined, options: AtlaspackOptions): Promise<{
5
+ plugin: T;
6
+ version: Semver;
7
+ resolveFrom: ProjectPath;
8
+ }>;
@@ -0,0 +1,3 @@
1
+ import type { FileSystem } from '@atlaspack/fs';
2
+ import type { EnvMap, FilePath } from '@atlaspack/types';
3
+ export default function loadEnv(env: EnvMap, fs: FileSystem, filePath: FilePath, projectRoot: FilePath): Promise<EnvMap>;
@@ -0,0 +1,19 @@
1
+ import type { FilePath } from '@atlaspack/types';
2
+ /**
3
+ * A path that's relative to the project root.
4
+ */
5
+ export type ProjectPath = string;
6
+ export declare const toProjectPath: ((projectRoot: FilePath, p: FilePath) => ProjectPath) & ((projectRoot: FilePath, p: FilePath | undefined) => ProjectPath | undefined) & ((projectRoot: FilePath, p?: FilePath | null | undefined) => ProjectPath | null | undefined);
7
+ export declare const fromProjectPath: ((projectRoot: FilePath, p: ProjectPath) => FilePath) & ((projectRoot: FilePath, p?: ProjectPath | null | undefined) => FilePath | null | undefined);
8
+ /**
9
+ * Returns a path relative to the project root. This should be used when computing cache keys
10
+ */
11
+ export declare function fromProjectPathRelative(p: ProjectPath): FilePath;
12
+ /**
13
+ * This function should be avoided, it doesn't change the actual value.
14
+ */
15
+ export declare function toProjectPathUnsafe(p: FilePath): ProjectPath;
16
+ /**
17
+ * Joins a project root with relative paths (similar to `path.join`)
18
+ */
19
+ export declare function joinProjectPath(a: ProjectPath, ...b: Array<FilePath>): ProjectPath;
@@ -0,0 +1,74 @@
1
+ import type SourceMap from '@parcel/source-map';
2
+ import type { Readable } from 'stream';
3
+ import type { FileSystem } from '@atlaspack/fs';
4
+ import type { Asset as IAsset, AST, ASTGenerator, Dependency as IDependency, DependencyOptions, Environment as IEnvironment, EnvironmentOptions, FileCreateInvalidation, FilePath, Meta, MutableAsset as IMutableAsset, Stats, MutableAssetSymbols as IMutableAssetSymbols, AssetSymbols as IAssetSymbols, BundleBehavior } from '@atlaspack/types';
5
+ import type { Asset as AssetValue, AtlaspackOptions } from '../types';
6
+ import UncommittedAsset from '../UncommittedAsset';
7
+ import CommittedAsset from '../CommittedAsset';
8
+ declare const inspect: unique symbol;
9
+ export declare function assetToAssetValue(asset: IAsset | IMutableAsset): AssetValue;
10
+ export declare function mutableAssetToUncommittedAsset(mutableAsset: IMutableAsset): UncommittedAsset;
11
+ export declare function assetFromValue(value: AssetValue, options: AtlaspackOptions): Asset;
12
+ declare class BaseAsset {
13
+ #private;
14
+ constructor(asset: CommittedAsset | UncommittedAsset);
15
+ [inspect](): string;
16
+ get id(): string;
17
+ get type(): string;
18
+ get env(): IEnvironment;
19
+ get fs(): FileSystem;
20
+ get filePath(): FilePath;
21
+ get query(): URLSearchParams;
22
+ get meta(): Meta;
23
+ get bundleBehavior(): BundleBehavior | null | undefined;
24
+ get isBundleSplittable(): boolean;
25
+ get isSource(): boolean;
26
+ get sideEffects(): boolean;
27
+ get symbols(): IAssetSymbols;
28
+ get uniqueKey(): string | null | undefined;
29
+ get astGenerator(): ASTGenerator | null | undefined;
30
+ get pipeline(): string | null | undefined;
31
+ getDependencies(): ReadonlyArray<IDependency>;
32
+ getCode(): Promise<string>;
33
+ getBuffer(): Promise<Buffer>;
34
+ getStream(): Readable;
35
+ getMap(): Promise<SourceMap | null | undefined>;
36
+ getAST(): Promise<AST | null | undefined>;
37
+ getMapBuffer(): Promise<Buffer | null | undefined>;
38
+ }
39
+ export declare class Asset extends BaseAsset implements IAsset {
40
+ #private;
41
+ constructor(asset: CommittedAsset | UncommittedAsset);
42
+ get env(): IEnvironment;
43
+ get stats(): Stats;
44
+ }
45
+ export declare class MutableAsset extends BaseAsset implements IMutableAsset {
46
+ #private;
47
+ constructor(asset: UncommittedAsset);
48
+ setMap(map?: SourceMap | null): void;
49
+ get type(): string;
50
+ set type(type: string): void;
51
+ get bundleBehavior(): BundleBehavior | null | undefined;
52
+ set bundleBehavior(bundleBehavior?: BundleBehavior | null): void;
53
+ get isBundleSplittable(): boolean;
54
+ set isBundleSplittable(isBundleSplittable: boolean): void;
55
+ get sideEffects(): boolean;
56
+ set sideEffects(sideEffects: boolean): void;
57
+ get uniqueKey(): string | null | undefined;
58
+ set uniqueKey(uniqueKey?: string | null): void;
59
+ get symbols(): IMutableAssetSymbols;
60
+ addDependency(dep: DependencyOptions): string;
61
+ invalidateOnFileChange(filePath: FilePath): void;
62
+ invalidateOnFileCreate(invalidation: FileCreateInvalidation): void;
63
+ invalidateOnEnvChange(env: string): void;
64
+ invalidateOnStartup(): void;
65
+ invalidateOnBuild(): void;
66
+ isASTDirty(): boolean;
67
+ setBuffer(buffer: Buffer): void;
68
+ setCode(code: string): void;
69
+ setStream(stream: Readable): void;
70
+ setAST(ast: AST): void;
71
+ addURLDependency(url: string, opts: Partial<DependencyOptions>): string;
72
+ setEnvironment(env: EnvironmentOptions): void;
73
+ }
74
+ export {};
@@ -0,0 +1,45 @@
1
+ import type { Bundle as InternalBundle, AtlaspackOptions, PackagedBundleInfo } from '../types';
2
+ import type { Asset as IAsset, Bundle as IBundle, BundleTraversable, Dependency as IDependency, Environment as IEnvironment, GraphVisitor, NamedBundle as INamedBundle, PackagedBundle as IPackagedBundle, Stats, Target as ITarget, BundleBehavior } from '@atlaspack/types';
3
+ import type BundleGraph from '../BundleGraph';
4
+ declare const inspect: unique symbol;
5
+ export declare function bundleToInternalBundle(bundle: IBundle): InternalBundle;
6
+ export declare function bundleToInternalBundleGraph(bundle: IBundle): BundleGraph;
7
+ export declare class Bundle implements IBundle {
8
+ #private;
9
+ [inspect](): string;
10
+ constructor(sentinel: unknown, bundle: InternalBundle, bundleGraph: BundleGraph, options: AtlaspackOptions);
11
+ static get(internalBundle: InternalBundle, bundleGraph: BundleGraph, options: AtlaspackOptions): Bundle;
12
+ get id(): string;
13
+ get hashReference(): string;
14
+ get type(): string;
15
+ get env(): IEnvironment;
16
+ get needsStableName(): boolean | null | undefined;
17
+ get bundleBehavior(): BundleBehavior | null | undefined;
18
+ get isSplittable(): boolean | null | undefined;
19
+ get manualSharedBundle(): string | null | undefined;
20
+ get target(): ITarget;
21
+ hasAsset(asset: IAsset): boolean;
22
+ hasDependency(dep: IDependency): boolean;
23
+ getEntryAssets(): Array<IAsset>;
24
+ getMainEntry(): IAsset | null | undefined;
25
+ traverse<TContext>(visit: GraphVisitor<BundleTraversable, TContext>): TContext | null | undefined;
26
+ traverseAssets<TContext>(visit: GraphVisitor<IAsset, TContext>, startAsset?: IAsset): TContext | null | undefined;
27
+ }
28
+ export declare class NamedBundle extends Bundle implements INamedBundle {
29
+ #private;
30
+ constructor(sentinel: unknown, bundle: InternalBundle, bundleGraph: BundleGraph, options: AtlaspackOptions);
31
+ static get(internalBundle: InternalBundle, bundleGraph: BundleGraph, options: AtlaspackOptions): NamedBundle;
32
+ get name(): string;
33
+ get displayName(): string;
34
+ get publicId(): string;
35
+ }
36
+ export declare class PackagedBundle extends NamedBundle implements IPackagedBundle {
37
+ #private;
38
+ constructor(sentinel: unknown, bundle: InternalBundle, bundleGraph: BundleGraph, options: AtlaspackOptions);
39
+ static get(internalBundle: InternalBundle, bundleGraph: BundleGraph, options: AtlaspackOptions): PackagedBundle;
40
+ static getWithInfo(internalBundle: InternalBundle, bundleGraph: BundleGraph, options: AtlaspackOptions, bundleInfo?: PackagedBundleInfo | null): PackagedBundle;
41
+ get filePath(): string;
42
+ get type(): string;
43
+ get stats(): Stats;
44
+ }
45
+ export {};
@@ -0,0 +1,70 @@
1
+ import type { Asset as IAsset, Bundle as IBundle, BundleGraph as IBundleGraph, BundleGraphTraversable, BundleGroup as IBundleGroup, Dependency as IDependency, ExportSymbolResolution, FilePath, GraphVisitor, NamedBundle, SymbolResolution, Symbol, Target } from '@atlaspack/types';
2
+ import type { Bundle as InternalBundle, AtlaspackOptions } from '../types';
3
+ import type InternalBundleGraph from '../BundleGraph';
4
+ import { Asset } from './Asset';
5
+ export declare function bundleGraphToInternalBundleGraph(bundleGraph: IBundleGraph<IBundle>): InternalBundleGraph;
6
+ type BundleFactory<TBundle extends IBundle> = (arg1: InternalBundle, arg2: InternalBundleGraph, arg3: AtlaspackOptions) => TBundle;
7
+ export default class BundleGraph<TBundle extends IBundle> implements IBundleGraph<TBundle> {
8
+ #private;
9
+ constructor(graph: InternalBundleGraph, createBundle: BundleFactory<TBundle>, options: AtlaspackOptions);
10
+ getAssetById(id: string): Asset;
11
+ getAssetPublicId(asset: IAsset): string;
12
+ isDependencySkipped(dep: IDependency): boolean;
13
+ getResolvedAsset(dep: IDependency, bundle?: IBundle | null): IAsset | null | undefined;
14
+ getIncomingDependencies(asset: IAsset): Array<IDependency>;
15
+ getAssetWithDependency(dep: IDependency): IAsset | null | undefined;
16
+ getBundleGroupsContainingBundle(bundle: IBundle): Array<IBundleGroup>;
17
+ getReferencedBundles(bundle: IBundle, opts?: {
18
+ recursive?: boolean;
19
+ includeInline?: boolean;
20
+ }): Array<TBundle>;
21
+ getReferencingBundles(bundle: IBundle): Array<TBundle>;
22
+ resolveAsyncDependency(dependency: IDependency, bundle?: IBundle | null): {
23
+ type: 'bundle_group';
24
+ value: IBundleGroup;
25
+ } | {
26
+ type: 'asset';
27
+ value: IAsset;
28
+ } | null | undefined;
29
+ getReferencedBundle(dependency: IDependency, bundle: IBundle): TBundle | null | undefined;
30
+ getDependencies(asset: IAsset): Array<IDependency>;
31
+ isAssetReachableFromBundle(asset: IAsset, bundle: IBundle): boolean;
32
+ isAssetReferenced(bundle: IBundle, asset: IAsset): boolean;
33
+ hasParentBundleOfType(bundle: IBundle, type: string): boolean;
34
+ getBundlesInBundleGroup(bundleGroup: IBundleGroup, opts?: {
35
+ includeInline: boolean;
36
+ }): Array<TBundle>;
37
+ getBundles(opts?: {
38
+ includeInline: boolean;
39
+ }): Array<TBundle>;
40
+ isEntryBundleGroup(bundleGroup: IBundleGroup): boolean;
41
+ getChildBundles(bundle: IBundle): Array<TBundle>;
42
+ getParentBundles(bundle: IBundle): Array<TBundle>;
43
+ getSymbolResolution(asset: IAsset, symbol: Symbol, boundary?: IBundle | null): SymbolResolution;
44
+ getExportedSymbols(asset: IAsset, boundary?: IBundle | null): Array<ExportSymbolResolution>;
45
+ traverse<TContext>(visit: GraphVisitor<BundleGraphTraversable, TContext>, start?: IAsset | null, opts?: {
46
+ skipUnusedDependencies?: boolean;
47
+ } | null): TContext | null | undefined;
48
+ traverseBundles<TContext>(visit: GraphVisitor<TBundle, TContext>, startBundle?: IBundle | null): TContext | null | undefined;
49
+ getBundlesWithAsset(asset: IAsset): Array<TBundle>;
50
+ getBundlesWithDependency(dependency: IDependency): Array<TBundle>;
51
+ getUsedSymbols(v: IAsset | IDependency): ReadonlySet<Symbol> | null | undefined;
52
+ getEntryRoot(target: Target): FilePath;
53
+ getConditionsForDependencies(deps: Array<IDependency>, bundle: NamedBundle): Set<{
54
+ publicId: string;
55
+ key: string;
56
+ ifTrueDependency: IDependency;
57
+ ifFalseDependency: IDependency;
58
+ ifTrueBundles: Array<TBundle>;
59
+ ifFalseBundles: Array<TBundle>;
60
+ ifTrueAssetId: string;
61
+ ifFalseAssetId: string;
62
+ }>;
63
+ getConditionalBundleMapping(): Map<string, Map<string, {
64
+ bundle: TBundle;
65
+ ifTrueBundles: Array<TBundle>;
66
+ ifFalseBundles: Array<TBundle>;
67
+ }>>;
68
+ getReferencedConditionalBundles(bundle: IBundle): Array<TBundle>;
69
+ }
70
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { BundleGroup as IBundleGroup, Target as ITarget } from '@atlaspack/types';
2
+ import type { BundleGroup as InternalBundleGroup, AtlaspackOptions } from '../types';
3
+ export declare function bundleGroupToInternalBundleGroup(target: IBundleGroup): InternalBundleGroup;
4
+ declare const inspect: unique symbol;
5
+ export default class BundleGroup implements IBundleGroup {
6
+ #private;
7
+ constructor(bundleGroup: InternalBundleGroup, options: AtlaspackOptions);
8
+ get target(): ITarget;
9
+ get entryAssetId(): string;
10
+ [inspect](): string;
11
+ }
12
+ export {};