@atlaspack/core 2.20.0 → 2.20.1-typescript-5ad950d33.0

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 (266) hide show
  1. package/LICENSE +201 -0
  2. package/lib/AssetGraph.d.ts +80 -0
  3. package/lib/AssetGraph.js +25 -10
  4. package/lib/Atlaspack.d.ts +52 -0
  5. package/lib/Atlaspack.js +47 -7
  6. package/lib/AtlaspackConfig.d.ts +65 -0
  7. package/lib/AtlaspackConfig.js +24 -6
  8. package/lib/AtlaspackConfig.schema.d.ts +46 -0
  9. package/lib/AtlaspackConfig.schema.js +0 -4
  10. package/lib/BundleGraph.d.ts +182 -0
  11. package/lib/BundleGraph.js +78 -17
  12. package/lib/CommittedAsset.d.ts +23 -0
  13. package/lib/CommittedAsset.js +6 -0
  14. package/lib/Dependency.d.ts +44 -0
  15. package/lib/Dependency.js +2 -0
  16. package/lib/Environment.d.ts +10 -0
  17. package/lib/Environment.js +2 -2
  18. package/lib/EnvironmentManager.d.ts +37 -0
  19. package/lib/EnvironmentManager.js +6 -0
  20. package/lib/IdentifierRegistry.d.ts +6 -0
  21. package/lib/IdentifierRegistry.js +1 -3
  22. package/lib/InternalConfig.d.ts +24 -0
  23. package/lib/PackagerRunner.d.ts +80 -0
  24. package/lib/PackagerRunner.js +10 -5
  25. package/lib/ReporterRunner.d.ts +25 -0
  26. package/lib/ReporterRunner.js +6 -9
  27. package/lib/RequestTracker.d.ts +385 -0
  28. package/lib/RequestTracker.js +28 -11
  29. package/lib/SymbolPropagation.d.ts +11 -0
  30. package/lib/SymbolPropagation.js +52 -7
  31. package/lib/TargetDescriptor.schema.d.ts +5 -0
  32. package/lib/Transformation.d.ts +72 -0
  33. package/lib/Transformation.js +15 -7
  34. package/lib/UncommittedAsset.d.ts +61 -0
  35. package/lib/UncommittedAsset.js +10 -7
  36. package/lib/Validation.d.ts +37 -0
  37. package/lib/Validation.js +18 -2
  38. package/lib/applyRuntimes.d.ts +25 -0
  39. package/lib/applyRuntimes.js +5 -0
  40. package/lib/assetUtils.d.ts +42 -0
  41. package/lib/assetUtils.js +5 -3
  42. package/lib/atlaspack-v3/AtlaspackV3.d.ts +26 -0
  43. package/lib/atlaspack-v3/AtlaspackV3.js +10 -2
  44. package/lib/atlaspack-v3/NapiWorkerPool.d.ts +12 -0
  45. package/lib/atlaspack-v3/NapiWorkerPool.js +3 -0
  46. package/lib/atlaspack-v3/fs.d.ts +12 -0
  47. package/lib/atlaspack-v3/fs.js +3 -1
  48. package/lib/atlaspack-v3/index.d.ts +5 -0
  49. package/lib/atlaspack-v3/index.js +28 -1
  50. package/lib/atlaspack-v3/jsCallable.d.ts +1 -0
  51. package/lib/atlaspack-v3/jsCallable.js +0 -2
  52. package/lib/atlaspack-v3/worker/compat/asset-symbols.d.ts +51 -0
  53. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +5 -3
  54. package/lib/atlaspack-v3/worker/compat/bitflags.d.ts +15 -0
  55. package/lib/atlaspack-v3/worker/compat/bitflags.js +5 -5
  56. package/lib/atlaspack-v3/worker/compat/dependency.d.ts +25 -0
  57. package/lib/atlaspack-v3/worker/compat/dependency.js +3 -0
  58. package/lib/atlaspack-v3/worker/compat/environment.d.ts +25 -0
  59. package/lib/atlaspack-v3/worker/compat/environment.js +2 -3
  60. package/{src/atlaspack-v3/worker/compat/index.js → lib/atlaspack-v3/worker/compat/index.d.ts} +0 -1
  61. package/lib/atlaspack-v3/worker/compat/mutable-asset.d.ts +49 -0
  62. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +8 -3
  63. package/lib/atlaspack-v3/worker/compat/plugin-config.d.ts +37 -0
  64. package/lib/atlaspack-v3/worker/compat/plugin-config.js +3 -5
  65. package/lib/atlaspack-v3/worker/compat/plugin-logger.d.ts +9 -0
  66. package/lib/atlaspack-v3/worker/compat/plugin-options.d.ts +22 -0
  67. package/lib/atlaspack-v3/worker/compat/plugin-options.js +1 -0
  68. package/lib/atlaspack-v3/worker/compat/plugin-tracer.d.ts +5 -0
  69. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +3 -0
  70. package/lib/atlaspack-v3/worker/compat/target.d.ts +11 -0
  71. package/lib/atlaspack-v3/worker/compat/target.js +2 -0
  72. package/lib/atlaspack-v3/worker/worker.d.ts +58 -0
  73. package/lib/atlaspack-v3/worker/worker.js +18 -5
  74. package/lib/constants.d.ts +13 -0
  75. package/lib/constants.js +0 -1
  76. package/lib/dumpGraphToGraphViz.d.ts +10 -0
  77. package/lib/dumpGraphToGraphViz.js +70 -15
  78. package/lib/index.d.ts +8 -0
  79. package/lib/index.js +17 -1
  80. package/lib/loadAtlaspackPlugin.d.ts +8 -0
  81. package/lib/loadAtlaspackPlugin.js +3 -0
  82. package/lib/loadDotEnv.d.ts +3 -0
  83. package/lib/loadDotEnv.js +4 -1
  84. package/lib/projectPath.d.ts +19 -0
  85. package/lib/projectPath.js +5 -0
  86. package/lib/public/Asset.d.ts +74 -0
  87. package/lib/public/Asset.js +14 -2
  88. package/lib/public/Bundle.d.ts +45 -0
  89. package/lib/public/Bundle.js +3 -3
  90. package/lib/public/BundleGraph.d.ts +70 -0
  91. package/lib/public/BundleGraph.js +7 -2
  92. package/lib/public/BundleGroup.d.ts +12 -0
  93. package/lib/public/BundleGroup.js +2 -2
  94. package/lib/public/Config.d.ts +75 -0
  95. package/lib/public/Config.js +27 -13
  96. package/lib/public/Dependency.d.ts +32 -0
  97. package/lib/public/Dependency.js +4 -2
  98. package/lib/public/Environment.d.ts +32 -0
  99. package/lib/public/Environment.js +2 -2
  100. package/lib/public/MutableBundleGraph.d.ts +26 -0
  101. package/lib/public/MutableBundleGraph.js +29 -6
  102. package/lib/public/PluginOptions.d.ts +25 -0
  103. package/lib/public/PluginOptions.js +1 -0
  104. package/lib/public/Symbols.d.ts +81 -0
  105. package/lib/public/Symbols.js +63 -14
  106. package/lib/public/Target.d.ts +16 -0
  107. package/lib/public/Target.js +3 -2
  108. package/lib/registerCoreWithSerializer.d.ts +2 -0
  109. package/lib/registerCoreWithSerializer.js +5 -3
  110. package/lib/requests/AssetGraphRequest.d.ts +74 -0
  111. package/lib/requests/AssetGraphRequest.js +15 -3
  112. package/lib/requests/AssetGraphRequestRust.d.ts +21 -0
  113. package/lib/requests/AssetGraphRequestRust.js +7 -4
  114. package/lib/requests/AssetRequest.d.ts +16 -0
  115. package/lib/requests/AssetRequest.js +21 -5
  116. package/lib/requests/AtlaspackBuildRequest.d.ts +29 -0
  117. package/lib/requests/AtlaspackBuildRequest.js +6 -2
  118. package/lib/requests/AtlaspackConfigRequest.d.ts +45 -0
  119. package/lib/requests/AtlaspackConfigRequest.js +15 -11
  120. package/lib/requests/BundleGraphRequest.d.ts +28 -0
  121. package/lib/requests/BundleGraphRequest.js +6 -6
  122. package/lib/requests/ConfigRequest.d.ts +59 -0
  123. package/lib/requests/ConfigRequest.js +1 -0
  124. package/lib/requests/DevDepRequest.d.ts +30 -0
  125. package/lib/requests/DevDepRequest.js +20 -4
  126. package/lib/requests/EntryRequest.d.ts +36 -0
  127. package/lib/requests/EntryRequest.js +9 -0
  128. package/lib/requests/PackageRequest.d.ts +27 -0
  129. package/lib/requests/PackageRequest.js +7 -2
  130. package/lib/requests/PathRequest.d.ts +48 -0
  131. package/lib/requests/PathRequest.js +20 -5
  132. package/lib/requests/TargetRequest.d.ts +48 -0
  133. package/lib/requests/TargetRequest.js +72 -40
  134. package/lib/requests/ValidationRequest.d.ts +20 -0
  135. package/lib/requests/ValidationRequest.js +5 -1
  136. package/lib/requests/WriteBundleRequest.d.ts +28 -0
  137. package/lib/requests/WriteBundleRequest.js +24 -8
  138. package/lib/requests/WriteBundlesRequest.d.ts +26 -0
  139. package/lib/requests/WriteBundlesRequest.js +26 -6
  140. package/lib/requests/asset-graph-diff.d.ts +1 -0
  141. package/lib/requests/asset-graph-diff.js +8 -3
  142. package/lib/requests/asset-graph-dot.d.ts +9 -0
  143. package/lib/requests/asset-graph-dot.js +1 -7
  144. package/lib/resolveOptions.d.ts +3 -0
  145. package/lib/rustWorkerThreadDylibHack.d.ts +9 -0
  146. package/lib/rustWorkerThreadDylibHack.js +0 -1
  147. package/lib/serializerCore.browser.d.ts +3 -0
  148. package/lib/summarizeRequest.d.ts +10 -0
  149. package/lib/types.d.ts +490 -0
  150. package/lib/types.js +6 -0
  151. package/lib/utils.d.ts +23 -0
  152. package/lib/utils.js +17 -2
  153. package/lib/worker.d.ts +44 -0
  154. package/lib/worker.js +12 -6
  155. package/package.json +27 -25
  156. package/src/{AssetGraph.js → AssetGraph.ts} +53 -47
  157. package/src/{Atlaspack.js → Atlaspack.ts} +75 -38
  158. package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +16 -19
  159. package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +81 -54
  160. package/src/{BundleGraph.js → BundleGraph.ts} +189 -121
  161. package/src/{CommittedAsset.js → CommittedAsset.ts} +14 -12
  162. package/src/{Dependency.js → Dependency.ts} +48 -39
  163. package/src/{Environment.js → Environment.ts} +8 -9
  164. package/src/{EnvironmentManager.js → EnvironmentManager.ts} +14 -5
  165. package/src/{IdentifierRegistry.js → IdentifierRegistry.ts} +1 -4
  166. package/src/{InternalConfig.js → InternalConfig.ts} +18 -20
  167. package/src/{PackagerRunner.js → PackagerRunner.ts} +67 -59
  168. package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
  169. package/src/{RequestTracker.js → RequestTracker.ts} +255 -206
  170. package/src/{SymbolPropagation.js → SymbolPropagation.ts} +157 -44
  171. package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +0 -1
  172. package/src/{Transformation.js → Transformation.ts} +67 -61
  173. package/src/{UncommittedAsset.js → UncommittedAsset.ts} +34 -33
  174. package/src/{Validation.js → Validation.ts} +32 -17
  175. package/src/{applyRuntimes.js → applyRuntimes.ts} +27 -25
  176. package/src/{assetUtils.js → assetUtils.ts} +44 -33
  177. package/src/atlaspack-v3/{AtlaspackV3.js → AtlaspackV3.ts} +20 -15
  178. package/src/atlaspack-v3/{NapiWorkerPool.js → NapiWorkerPool.ts} +10 -5
  179. package/src/atlaspack-v3/{fs.js → fs.ts} +3 -4
  180. package/src/atlaspack-v3/{index.js → index.ts} +2 -4
  181. package/src/atlaspack-v3/jsCallable.ts +14 -0
  182. package/src/atlaspack-v3/worker/compat/{asset-symbols.js → asset-symbols.ts} +52 -49
  183. package/src/atlaspack-v3/worker/compat/{bitflags.js → bitflags.ts} +8 -10
  184. package/src/atlaspack-v3/worker/compat/{dependency.js → dependency.ts} +12 -12
  185. package/src/atlaspack-v3/worker/compat/{environment.js → environment.ts} +4 -8
  186. package/src/atlaspack-v3/worker/compat/index.ts +9 -0
  187. package/src/atlaspack-v3/worker/compat/{mutable-asset.js → mutable-asset.ts} +20 -19
  188. package/src/atlaspack-v3/worker/compat/{plugin-config.js → plugin-config.ts} +26 -29
  189. package/src/atlaspack-v3/worker/compat/{plugin-logger.js → plugin-logger.ts} +0 -2
  190. package/src/atlaspack-v3/worker/compat/{plugin-options.js → plugin-options.ts} +4 -5
  191. package/src/atlaspack-v3/worker/compat/{plugin-tracer.js → plugin-tracer.ts} +2 -2
  192. package/src/atlaspack-v3/worker/compat/{target.js → target.ts} +3 -4
  193. package/src/atlaspack-v3/worker/{worker.js → worker.ts} +78 -64
  194. package/src/{constants.js → constants.ts} +0 -3
  195. package/src/{dumpGraphToGraphViz.js → dumpGraphToGraphViz.ts} +73 -28
  196. package/src/{index.js → index.ts} +2 -1
  197. package/src/{loadAtlaspackPlugin.js → loadAtlaspackPlugin.ts} +11 -9
  198. package/src/{loadDotEnv.js → loadDotEnv.ts} +2 -2
  199. package/src/{projectPath.js → projectPath.ts} +20 -9
  200. package/src/public/{Asset.js → Asset.ts} +29 -23
  201. package/src/public/{Bundle.js → Bundle.ts} +17 -19
  202. package/src/public/{BundleGraph.js → BundleGraph.ts} +71 -48
  203. package/src/public/{BundleGroup.js → BundleGroup.ts} +5 -8
  204. package/src/public/{Config.js → Config.ts} +63 -39
  205. package/src/public/{Dependency.js → Dependency.ts} +16 -14
  206. package/src/public/{Environment.js → Environment.ts} +11 -14
  207. package/src/public/{MutableBundleGraph.js → MutableBundleGraph.ts} +37 -21
  208. package/src/public/{PluginOptions.js → PluginOptions.ts} +5 -5
  209. package/src/public/{Symbols.js → Symbols.ts} +109 -36
  210. package/src/public/{Target.js → Target.ts} +6 -5
  211. package/src/{registerCoreWithSerializer.js → registerCoreWithSerializer.ts} +9 -7
  212. package/src/requests/{AssetGraphRequest.js → AssetGraphRequest.ts} +51 -45
  213. package/src/requests/{AssetGraphRequestRust.js → AssetGraphRequestRust.ts} +18 -19
  214. package/src/requests/{AssetRequest.js → AssetRequest.ts} +22 -17
  215. package/src/requests/{AtlaspackBuildRequest.js → AtlaspackBuildRequest.ts} +30 -31
  216. package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +61 -51
  217. package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +38 -41
  218. package/src/requests/{ConfigRequest.js → ConfigRequest.ts} +40 -43
  219. package/src/requests/{DevDepRequest.js → DevDepRequest.ts} +42 -30
  220. package/src/requests/{EntryRequest.js → EntryRequest.ts} +43 -31
  221. package/src/requests/{PackageRequest.js → PackageRequest.ts} +21 -21
  222. package/src/requests/{PathRequest.js → PathRequest.ts} +45 -37
  223. package/src/requests/{TargetRequest.js → TargetRequest.ts} +196 -153
  224. package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
  225. package/src/requests/{WriteBundleRequest.js → WriteBundleRequest.ts} +63 -41
  226. package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +38 -27
  227. package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +14 -14
  228. package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
  229. package/src/{resolveOptions.js → resolveOptions.ts} +6 -8
  230. package/src/{rustWorkerThreadDylibHack.js → rustWorkerThreadDylibHack.ts} +1 -4
  231. package/src/{serializerCore.browser.js → serializerCore.browser.ts} +2 -3
  232. package/src/{summarizeRequest.js → summarizeRequest.ts} +17 -5
  233. package/src/types.ts +644 -0
  234. package/src/{utils.js → utils.ts} +52 -21
  235. package/src/{worker.js → worker.ts} +51 -35
  236. package/test/{AssetGraph.test.js → AssetGraph.test.ts} +4 -8
  237. package/test/{Atlaspack.test.js → Atlaspack.test.ts} +5 -10
  238. package/test/{AtlaspackConfig.test.js → AtlaspackConfig.test.ts} +0 -5
  239. package/test/{AtlaspackConfigRequest.test.js → AtlaspackConfigRequest.test.ts} +3 -15
  240. package/test/{BundleGraph.test.js → BundleGraph.test.ts} +8 -13
  241. package/test/{Dependency.test.js → Dependency.test.ts} +2 -3
  242. package/test/{EntryRequest.test.js → EntryRequest.test.ts} +1 -6
  243. package/test/{Environment.test.js → Environment.test.ts} +2 -5
  244. package/test/{EnvironmentManager.test.js → EnvironmentManager.test.ts} +7 -9
  245. package/test/{IdentifierRegistry.test.js → IdentifierRegistry.test.ts} +2 -4
  246. package/test/{InternalAsset.test.js → InternalAsset.test.ts} +2 -7
  247. package/test/PackagerRunner.test.ts +0 -0
  248. package/test/{PublicAsset.test.js → PublicAsset.test.ts} +2 -7
  249. package/test/{PublicBundle.test.js → PublicBundle.test.ts} +1 -2
  250. package/test/{PublicDependency.test.js → PublicDependency.test.ts} +0 -2
  251. package/test/{PublicEnvironment.test.js → PublicEnvironment.test.ts} +0 -2
  252. package/test/{PublicMutableBundleGraph.test.js → PublicMutableBundleGraph.test.ts} +6 -11
  253. package/test/{RequestTracker.test.js → RequestTracker.test.ts} +26 -36
  254. package/test/{SymbolPropagation.test.js → SymbolPropagation.test.ts} +124 -74
  255. package/test/{TargetRequest.test.js → TargetRequest.test.ts} +3 -17
  256. package/test/public/{Config.test.js → Config.test.ts} +7 -11
  257. package/test/requests/{AssetGraphRequestRust.test.js → AssetGraphRequestRust.test.ts} +0 -1
  258. package/test/requests/{ConfigRequest.test.js → ConfigRequest.test.ts} +19 -22
  259. package/test/requests/{DevDepRequest.test.js → DevDepRequest.test.ts} +0 -2
  260. package/test/{test-utils.js → test-utils.ts} +0 -2
  261. package/test/{utils.test.js → utils.test.ts} +1 -3
  262. package/tsconfig.json +4 -0
  263. package/index.d.ts +0 -34
  264. package/src/atlaspack-v3/jsCallable.js +0 -18
  265. package/src/types.js +0 -603
  266. package/test/PackagerRunner.test.js +0 -27
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright (c) 2024 Atlassian US., Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,80 @@
1
+ import type { GraphVisitor } from '@atlaspack/types';
2
+ import type { ContentGraphOpts, ContentKey, NodeId, SerializedContentGraph } from '@atlaspack/graph';
3
+ import type { Asset, AssetGraphNode, AssetGroup, AssetGroupNode, AssetNode, Dependency, DependencyNode, Entry, EntryFileNode, EntrySpecifierNode, Environment, Target } from './types';
4
+ import { ContentGraph } from '@atlaspack/graph';
5
+ import { ProjectPath } from './projectPath';
6
+ type InitOpts = {
7
+ entries?: Array<ProjectPath>;
8
+ targets?: Array<Target>;
9
+ assetGroups?: Array<AssetGroup>;
10
+ };
11
+ type AssetGraphOpts = ContentGraphOpts<AssetGraphNode> & {
12
+ bundlingVersion?: number;
13
+ disableIncrementalBundling?: boolean;
14
+ hash?: string | null | undefined;
15
+ };
16
+ type SerializedAssetGraph = SerializedContentGraph<AssetGraphNode> & {
17
+ bundlingVersion: number;
18
+ disableIncrementalBundling: boolean;
19
+ hash?: string | null | undefined;
20
+ };
21
+ export declare function nodeFromDep(dep: Dependency): DependencyNode;
22
+ export declare function nodeFromAssetGroup(assetGroup: AssetGroup): AssetGroupNode;
23
+ export declare function nodeFromAsset(asset: Asset): AssetNode;
24
+ export declare function nodeFromEntrySpecifier(entry: ProjectPath): EntrySpecifierNode;
25
+ export declare function nodeFromEntryFile(entry: Entry): EntryFileNode;
26
+ export default class AssetGraph extends ContentGraph<AssetGraphNode> {
27
+ #private;
28
+ onNodeRemoved: ((nodeId: NodeId) => unknown) | null | undefined;
29
+ hash: string | null | undefined;
30
+ envCache: Map<string, Environment>;
31
+ /**
32
+ * @deprecated
33
+ */
34
+ safeToIncrementallyBundle: boolean;
35
+ undeferredDependencies: Set<Dependency>;
36
+ constructor(opts?: AssetGraphOpts | null);
37
+ static deserialize(opts: AssetGraphOpts): AssetGraph;
38
+ serialize(): SerializedAssetGraph;
39
+ /**
40
+ * Force incremental bundling to be disabled.
41
+ */
42
+ setDisableIncrementalBundling(disable: boolean): void;
43
+ testing_getDisableIncrementalBundling(): boolean;
44
+ /**
45
+ * Make sure this asset graph is marked as needing a full bundling pass.
46
+ */
47
+ setNeedsBundling(): void;
48
+ /**
49
+ * Get the current bundling version.
50
+ *
51
+ * Each bundle pass should keep this version around. Whenever an asset graph has a new version,
52
+ * bundling should be re-run.
53
+ */
54
+ getBundlingVersion(): number;
55
+ /**
56
+ * If the `bundlingVersion` has not changed since the last bundling pass,
57
+ * we can incrementally bundle, which will not require a full bundling pass
58
+ * but just update assets into the bundle graph output.
59
+ */
60
+ canIncrementallyBundle(lastVersion: number): boolean;
61
+ normalizeEnvironment(input: Asset | Dependency | AssetGroup): void;
62
+ setRootConnections({ entries, assetGroups }: InitOpts): void;
63
+ addNode(node: AssetGraphNode): NodeId;
64
+ removeNode(nodeId: NodeId): void;
65
+ resolveEntry(entry: ProjectPath, resolved: Array<Entry>, correspondingRequest: ContentKey): void;
66
+ resolveTargets(entry: Entry, targets: Array<Target>, correspondingRequest: string): void;
67
+ resolveDependency(dependency: Dependency, assetGroup: AssetGroup | null | undefined, correspondingRequest: string): void;
68
+ shouldVisitChild(nodeId: NodeId, childNodeId: NodeId): boolean;
69
+ markParentsWithHasDeferred(nodeId: NodeId): void;
70
+ unmarkParentsWithHasDeferred(nodeId: NodeId): void;
71
+ shouldDeferDependency(dependency: Dependency, sideEffects: boolean | null | undefined, canDefer: boolean): boolean;
72
+ resolveAssetGroup(assetGroup: AssetGroup, assets: Array<Asset>, correspondingRequest: ContentKey): void;
73
+ resolveAsset(assetNode: AssetNode, dependentAssets: Array<Asset>): void;
74
+ getIncomingDependencies(asset: Asset): Array<Dependency>;
75
+ traverseAssets<TContext>(visit: GraphVisitor<Asset, TContext>, startNodeId?: NodeId | null): TContext | null | undefined;
76
+ getEntryAssetGroupNodes(): Array<AssetGroupNode>;
77
+ getEntryAssets(): Array<Asset>;
78
+ getHash(): string;
79
+ }
80
+ export {};
package/lib/AssetGraph.js CHANGED
@@ -71,7 +71,11 @@ function nodeFromDep(dep) {
71
71
  }
72
72
  function nodeFromAssetGroup(assetGroup) {
73
73
  return {
74
- id: (0, _rust().hashString)((0, _projectPath.fromProjectPathRelative)(assetGroup.filePath) + (0, _EnvironmentManager.toEnvironmentId)(assetGroup.env) + String(assetGroup.isSource) + String(assetGroup.sideEffects) + (assetGroup.code ?? '') + ':' + (assetGroup.pipeline ?? '') + ':' + (assetGroup.query ?? '')),
74
+ id: (0, _rust().hashString)(
75
+ // @ts-expect-error TS2345
76
+ (0, _projectPath.fromProjectPathRelative)(assetGroup.filePath) +
77
+ // @ts-expect-error TS2345
78
+ (0, _EnvironmentManager.toEnvironmentId)(assetGroup.env) + String(assetGroup.isSource) + String(assetGroup.sideEffects) + (assetGroup.code ?? '') + ':' + (assetGroup.pipeline ?? '') + ':' + (assetGroup.query ?? '')),
75
79
  type: 'asset_group',
76
80
  value: assetGroup,
77
81
  usedSymbolsDownDirty: true
@@ -101,6 +105,8 @@ function nodeFromEntryFile(entry) {
101
105
  value: entry
102
106
  };
103
107
  }
108
+
109
+ // @ts-expect-error TS2417
104
110
  class AssetGraph extends _graph().ContentGraph {
105
111
  /**
106
112
  * Incremented when the asset graph is modified such that it requires a bundling pass.
@@ -138,13 +144,9 @@ class AssetGraph extends _graph().ContentGraph {
138
144
  this.undeferredDependencies = new Set();
139
145
  this.envCache = new Map();
140
146
  }
141
-
142
- // $FlowFixMe[prop-missing]
143
147
  static deserialize(opts) {
144
148
  return new AssetGraph(opts);
145
149
  }
146
-
147
- // $FlowFixMe[prop-missing]
148
150
  serialize() {
149
151
  return {
150
152
  ...super.serialize(),
@@ -206,6 +208,8 @@ class AssetGraph extends _graph().ContentGraph {
206
208
  if ((0, _featureFlags().getFeatureFlag)('environmentDeduplication')) {
207
209
  return;
208
210
  }
211
+
212
+ // @ts-expect-error TS2345
209
213
  let {
210
214
  id,
211
215
  context
@@ -215,6 +219,7 @@ class AssetGraph extends _graph().ContentGraph {
215
219
  if (env) {
216
220
  input.env = (0, _EnvironmentManager.toEnvironmentRef)(env);
217
221
  } else {
222
+ // @ts-expect-error TS2345
218
223
  this.envCache.set(idAndContext, (0, _EnvironmentManager.fromEnvironmentId)(input.env));
219
224
  }
220
225
  }
@@ -242,8 +247,6 @@ class AssetGraph extends _graph().ContentGraph {
242
247
  let existing = this.getNodeByContentKey(node.id);
243
248
  if (existing != null) {
244
249
  (0, _assert().default)(existing.type === node.type);
245
- // $FlowFixMe[incompatible-type] Checked above
246
- // $FlowFixMe[prop-missing]
247
250
  existing.value = node.value;
248
251
  let existingId = this.getNodeIdByContentKey(node.id);
249
252
  this.updateNode(existingId, existing);
@@ -275,6 +278,7 @@ class AssetGraph extends _graph().ContentGraph {
275
278
  env: target.env,
276
279
  isEntry: true,
277
280
  needsStableName: true,
281
+ // @ts-expect-error TS2322
278
282
  symbols: (0, _EnvironmentManager.fromEnvironmentId)(target.env).isLibrary ? new Map([['*', {
279
283
  local: '*',
280
284
  isWeak: true,
@@ -283,7 +287,9 @@ class AssetGraph extends _graph().ContentGraph {
283
287
  }));
284
288
  if ((0, _EnvironmentManager.fromEnvironmentId)(node.value.env).isLibrary) {
285
289
  // in library mode, all of the entry's symbols are "used"
290
+ // @ts-expect-error TS2345
286
291
  node.usedSymbolsDown.add('*');
292
+ // @ts-expect-error TS2345
287
293
  node.usedSymbolsUp.set('*', undefined);
288
294
  }
289
295
  return node;
@@ -361,7 +367,10 @@ class AssetGraph extends _graph().ContentGraph {
361
367
  if (traversedNode.type === 'asset') {
362
368
  let hasDeferred = this.getNodeIdsConnectedFrom(traversedNodeId).some(childNodeId => {
363
369
  let childNode = (0, _nullthrows().default)(this.getNode(childNodeId));
364
- return childNode.hasDeferred == null ? false : childNode.hasDeferred;
370
+ // @ts-expect-error TS2339
371
+ return childNode.hasDeferred == null ? false :
372
+ // @ts-expect-error TS2339
373
+ childNode.hasDeferred;
365
374
  });
366
375
  if (!hasDeferred) {
367
376
  delete traversedNode.hasDeferred;
@@ -370,6 +379,7 @@ class AssetGraph extends _graph().ContentGraph {
370
379
  hasDeferred
371
380
  };
372
381
  } else if (traversedNode.type === 'asset_group' && nodeId !== traversedNodeId) {
382
+ // @ts-expect-error TS2339
373
383
  if (!(ctx !== null && ctx !== void 0 && ctx.hasDeferred)) {
374
384
  this.safeToIncrementallyBundle = false;
375
385
  this.setNeedsBundling();
@@ -400,7 +410,9 @@ class AssetGraph extends _graph().ContentGraph {
400
410
  }
401
411
  let isDeferrable = [...dependencySymbols].every(([, {
402
412
  isWeak
403
- }]) => isWeak) && sideEffects === false && canDefer && !dependencySymbols.has('*');
413
+ }]) => isWeak) && sideEffects === false && canDefer &&
414
+ // @ts-expect-error TS2345
415
+ !dependencySymbols.has('*');
404
416
  if (!isDeferrable) {
405
417
  return false;
406
418
  }
@@ -426,7 +438,9 @@ class AssetGraph extends _graph().ContentGraph {
426
438
  if (this.undeferredDependencies.has(d)) {
427
439
  return false;
428
440
  }
429
- let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) && !d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
441
+ let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) &&
442
+ // @ts-expect-error TS2345
443
+ !d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
430
444
  var _resolvedAsset$symbol;
431
445
  let assetSymbol = (_resolvedAsset$symbol = resolvedAsset.symbols) === null || _resolvedAsset$symbol === void 0 || (_resolvedAsset$symbol = _resolvedAsset$symbol.get(symbol)) === null || _resolvedAsset$symbol === void 0 ? void 0 : _resolvedAsset$symbol.local;
432
446
  return assetSymbol != null && symbols.has(assetSymbol);
@@ -441,6 +455,7 @@ class AssetGraph extends _graph().ContentGraph {
441
455
  resolveAssetGroup(assetGroup, assets, correspondingRequest) {
442
456
  this.normalizeEnvironment(assetGroup);
443
457
  let assetGroupNode = nodeFromAssetGroup(assetGroup);
458
+ // @ts-expect-error TS2322
444
459
  assetGroupNode = this.getNodeByContentKey(assetGroupNode.id);
445
460
  if (!assetGroupNode) {
446
461
  return;
@@ -0,0 +1,52 @@
1
+ import type { Asset, AsyncSubscription, BuildEvent, BuildSuccessEvent, InitialAtlaspackOptions, AtlaspackTransformOptions, AtlaspackResolveOptions, AtlaspackResolveResult } from '@atlaspack/types';
2
+ import type { AtlaspackOptions } from './types';
3
+ import type { FarmOptions } from '@atlaspack/workers';
4
+ import type { Diagnostic } from '@atlaspack/diagnostic';
5
+ import ThrowableDiagnostic from '@atlaspack/diagnostic';
6
+ import WorkerFarm from '@atlaspack/workers';
7
+ import { AtlaspackV3 } from './atlaspack-v3';
8
+ import type { AssetGraphRequestResult } from './requests/AssetGraphRequest';
9
+ export declare const INTERNAL_TRANSFORM: symbol;
10
+ export declare const INTERNAL_RESOLVE: symbol;
11
+ export declare let WORKER_PATH: string;
12
+ export default class Atlaspack {
13
+ #private;
14
+ rustAtlaspack: AtlaspackV3 | null | undefined;
15
+ isProfiling: boolean;
16
+ constructor(options: InitialAtlaspackOptions);
17
+ _init(): Promise<void>;
18
+ run(): Promise<BuildSuccessEvent>;
19
+ _end(): Promise<void>;
20
+ writeRequestTrackerToCache(): Promise<void>;
21
+ _startNextBuild(): Promise<BuildEvent | null | undefined>;
22
+ watch(cb?: (err?: Error | null | undefined, buildEvent?: BuildEvent) => unknown): Promise<AsyncSubscription>;
23
+ _build({ signal, startTime, }?: {
24
+ signal?: AbortSignal;
25
+ startTime?: number;
26
+ }): Promise<BuildEvent>;
27
+ _getWatcherSubscription(): Promise<AsyncSubscription>;
28
+ _getResolvedAtlaspackOptions(): AtlaspackOptions;
29
+ startProfiling(): Promise<void>;
30
+ stopProfiling(): Promise<void>;
31
+ takeHeapSnapshot(): Promise<void>;
32
+ /**
33
+ * Must be called between builds otherwise there is global state that will
34
+ * break things unexpectedly.
35
+ */
36
+ clearBuildCaches(): Promise<void>;
37
+ unstable_invalidate(): Promise<void>;
38
+ /**
39
+ * Build the asset graph
40
+ */
41
+ unstable_buildAssetGraph(writeToCache?: boolean): Promise<AssetGraphRequestResult>;
42
+ /**
43
+ * Copy the cache to a new directory and compact it.
44
+ */
45
+ unstable_compactCache(): Promise<void>;
46
+ unstable_transform(options: AtlaspackTransformOptions): Promise<Array<Asset>>;
47
+ unstable_resolve(request: AtlaspackResolveOptions): Promise<AtlaspackResolveResult | null | undefined>;
48
+ }
49
+ export declare class BuildError extends ThrowableDiagnostic {
50
+ constructor(diagnostic: Array<Diagnostic> | Diagnostic);
51
+ }
52
+ export declare function createWorkerFarm(options?: Partial<FarmOptions>): WorkerFarm;
package/lib/Atlaspack.js CHANGED
@@ -123,28 +123,43 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
123
123
  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; }
124
124
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
125
125
  // eslint-disable-next-line no-unused-vars
126
+
126
127
  (0, _registerCoreWithSerializer.registerCoreWithSerializer)();
127
128
  const INTERNAL_TRANSFORM = exports.INTERNAL_TRANSFORM = Symbol('internal_transform');
128
129
  const INTERNAL_RESOLVE = exports.INTERNAL_RESOLVE = Symbol('internal_resolve');
129
- const WORKER_PATH = exports.WORKER_PATH = _path().default.join(__dirname, 'worker.js');
130
+ let WORKER_PATH = exports.WORKER_PATH = _path().default.join(__dirname, 'worker.js');
131
+ if (process.env.ATLASPACK_REGISTER_USE_SRC === 'true') {
132
+ exports.WORKER_PATH = WORKER_PATH = _path().default.join(__dirname, 'worker.ts');
133
+ }
130
134
  class Atlaspack {
135
+ // @ts-expect-error TS2564
131
136
  #requestTracker;
137
+ // @ts-expect-error TS2564
132
138
  #config;
139
+ // @ts-expect-error TS2564
133
140
  #farm;
134
141
  #initialized = false;
142
+ // @ts-expect-error TS2564
135
143
  #disposable;
136
144
  #initialOptions;
145
+ // @ts-expect-error TS2564
137
146
  #reporterRunner;
138
147
  #resolvedOptions = null;
148
+ // @ts-expect-error TS2564
139
149
  #optionsRef;
150
+ // @ts-expect-error TS2564
140
151
  #watchAbortController;
141
152
  #watchQueue = new (_utils2().PromiseQueue)({
142
153
  maxConcurrent: 1
143
154
  });
155
+ // @ts-expect-error TS2564
144
156
  #watchEvents;
145
157
  #watcherSubscription;
146
158
  #watcherCount = 0;
147
159
  #requestedAssetIds = new Set();
160
+
161
+ // @ts-expect-error TS2564
162
+
148
163
  constructor(options) {
149
164
  this.#initialOptions = options;
150
165
  }
@@ -194,8 +209,6 @@ class Atlaspack {
194
209
  throw new Error('Atlaspack v3 must be run with lmdb lite cache');
195
210
  }
196
211
  const lmdb = resolvedOptions.cache.getNativeRef();
197
-
198
- // $FlowFixMe
199
212
  const version = require('../package.json').version;
200
213
  await lmdb.put('current_session_version', Buffer.from(version));
201
214
  let threads = undefined;
@@ -206,12 +219,12 @@ class Atlaspack {
206
219
  }
207
220
  rustAtlaspack = await _atlaspackV.AtlaspackV3.create({
208
221
  ...options,
222
+ // @ts-expect-error TS2353
209
223
  corePath: _path().default.join(__dirname, '..'),
210
224
  threads,
211
225
  entries: Array.isArray(entries) ? entries : entries == null ? undefined : [entries],
212
226
  env: resolvedOptions.env,
213
227
  fs: inputFS && new _atlaspackV.FileSystemV3(inputFS),
214
- // $FlowFixMe ProjectPath is a string
215
228
  defaultTargetOptions: resolvedOptions.defaultTargetOptions,
216
229
  lmdb
217
230
  });
@@ -221,6 +234,7 @@ class Atlaspack {
221
234
  });
222
235
  }
223
236
  }
237
+ // @ts-expect-error TS2454
224
238
  this.rustAtlaspack = rustAtlaspack;
225
239
  let {
226
240
  config
@@ -266,6 +280,7 @@ class Atlaspack {
266
280
  this.#requestTracker = await _RequestTracker.default.init({
267
281
  farm: this.#farm,
268
282
  options: resolvedOptions,
283
+ // @ts-expect-error TS2454
269
284
  rustAtlaspack
270
285
  });
271
286
  this.#initialized = true;
@@ -332,6 +347,8 @@ class Atlaspack {
332
347
  if (!this.#initialized) {
333
348
  await this._init();
334
349
  }
350
+
351
+ // @ts-expect-error TS7034
335
352
  let watchEventsDisposable;
336
353
  if (cb) {
337
354
  watchEventsDisposable = this.#watchEvents.addListener(({
@@ -351,8 +368,11 @@ class Atlaspack {
351
368
  this.#watchQueue.run();
352
369
  }
353
370
  this.#watcherCount++;
371
+
372
+ // @ts-expect-error TS7034
354
373
  let unsubscribePromise;
355
374
  const unsubscribe = async () => {
375
+ // @ts-expect-error TS7005
356
376
  if (watchEventsDisposable) {
357
377
  watchEventsDisposable.dispose();
358
378
  }
@@ -370,9 +390,12 @@ class Atlaspack {
370
390
  };
371
391
  return {
372
392
  unsubscribe() {
393
+ // @ts-expect-error TS7005
373
394
  if (unsubscribePromise == null) {
374
395
  unsubscribePromise = unsubscribe();
375
396
  }
397
+
398
+ // @ts-expect-error TS7005
376
399
  return unsubscribePromise;
377
400
  }
378
401
  };
@@ -415,13 +438,14 @@ class Atlaspack {
415
438
  });
416
439
  this.#requestedAssetIds.clear();
417
440
  await (0, _dumpGraphToGraphViz.default)(
418
- // $FlowFixMe
441
+ // @ts-expect-error TS2345
419
442
  this.#requestTracker.graph, 'RequestGraph', _RequestTracker.requestGraphEdgeTypes);
420
443
  let event = {
421
444
  type: 'buildSuccess',
422
445
  changedAssets: new Map(Array.from(changedAssets).map(([id, asset]) => [id, (0, _Asset.assetFromValue)(asset, options)])),
423
446
  bundleGraph: new _BundleGraph.default(bundleGraph, (bundle, bundleGraph, options) => _Bundle.PackagedBundle.getWithInfo(bundle, bundleGraph, options, bundleInfo.get(bundle.id)), options),
424
447
  buildTime: Date.now() - startTime,
448
+ // @ts-expect-error TS7006
425
449
  requestBundle: async bundle => {
426
450
  let bundleNode = bundleGraph._graph.getNodeByContentKey(bundle.id);
427
451
  (0, _assert().default)((bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.type) === 'bundle', 'Bundle does not exist');
@@ -447,15 +471,21 @@ class Atlaspack {
447
471
  }
448
472
  let results = await this.#watchQueue.run();
449
473
  let result = results.filter(Boolean).pop();
474
+ // @ts-expect-error TS18049
450
475
  if (result.type === 'buildFailure') {
476
+ // @ts-expect-error TS18049
451
477
  throw new BuildError(result.diagnostics);
452
478
  }
453
479
  return result;
454
480
  },
455
481
  unstable_requestStats: this.#requestTracker.flushStats()
456
482
  };
483
+
484
+ // @ts-expect-error TS2345
457
485
  await this.#reporterRunner.report(event);
458
- await this.#requestTracker.runRequest((0, _ValidationRequest.default)({
486
+ await this.#requestTracker.runRequest(
487
+ // @ts-expect-error TS2345
488
+ (0, _ValidationRequest.default)({
459
489
  optionsRef: this.#optionsRef,
460
490
  assetRequests
461
491
  }), {
@@ -464,6 +494,8 @@ class Atlaspack {
464
494
  if (this.#reporterRunner.errors.length) {
465
495
  throw this.#reporterRunner.errors;
466
496
  }
497
+
498
+ // @ts-expect-error TS2322
467
499
  return event;
468
500
  } catch (e) {
469
501
  if (e instanceof _utils.BuildAbortError) {
@@ -475,7 +507,10 @@ class Atlaspack {
475
507
  diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
476
508
  unstable_requestStats: this.#requestTracker.flushStats()
477
509
  };
510
+
511
+ // @ts-expect-error TS2345
478
512
  await this.#reporterRunner.report(event);
513
+ // @ts-expect-error TS2322
479
514
  return event;
480
515
  } finally {
481
516
  if (this.isProfiling) {
@@ -588,7 +623,11 @@ class Atlaspack {
588
623
  requestedAssetIds: this.#requestedAssetIds
589
624
  };
590
625
  const start = Date.now();
591
- const result = await this.#requestTracker.runRequest(this.rustAtlaspack != null ? (0, _AssetGraphRequestRust.createAssetGraphRequestRust)(this.rustAtlaspack)(input) : (0, _AssetGraphRequest.default)(input), {
626
+ const result = await this.#requestTracker.runRequest(this.rustAtlaspack != null ?
627
+ // @ts-expect-error TS2345
628
+ (0, _AssetGraphRequestRust.createAssetGraphRequestRust)(this.rustAtlaspack)(input) :
629
+ // @ts-expect-error TS2345
630
+ (0, _AssetGraphRequest.default)(input), {
592
631
  force: true
593
632
  });
594
633
  const duration = Date.now() - start;
@@ -675,6 +714,7 @@ class Atlaspack {
675
714
  return null;
676
715
  }
677
716
  return {
717
+ // @ts-expect-error TS2322
678
718
  filePath: (0, _projectPath.fromProjectPath)(projectRoot, res.filePath),
679
719
  code: res.code,
680
720
  query: res.query,