@rspack-debug/core 1.3.14

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 (392) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +15 -0
  3. package/compiled/@swc/types/index.d.ts +2109 -0
  4. package/compiled/@swc/types/index.js +19 -0
  5. package/compiled/@swc/types/license +201 -0
  6. package/compiled/@swc/types/package.json +1 -0
  7. package/compiled/browserslist-load-config/index.d.ts +10 -0
  8. package/compiled/browserslist-load-config/index.js +266 -0
  9. package/compiled/browserslist-load-config/license +21 -0
  10. package/compiled/browserslist-load-config/package.json +1 -0
  11. package/compiled/enhanced-resolve/CachedInputFileSystem.d.ts +0 -0
  12. package/compiled/enhanced-resolve/CachedInputFileSystem.js +664 -0
  13. package/compiled/enhanced-resolve/index.d.ts +1124 -0
  14. package/compiled/enhanced-resolve/license +20 -0
  15. package/compiled/enhanced-resolve/package.json +1 -0
  16. package/compiled/graceful-fs/index.d.ts +13 -0
  17. package/compiled/graceful-fs/index.js +1063 -0
  18. package/compiled/graceful-fs/license +15 -0
  19. package/compiled/graceful-fs/package.json +1 -0
  20. package/compiled/tinypool/LICENSE +24 -0
  21. package/compiled/tinypool/README.md +212 -0
  22. package/compiled/tinypool/dist/chunk-6LX4VMOV.js +31 -0
  23. package/compiled/tinypool/dist/chunk-ACQHDOFQ.js +12 -0
  24. package/compiled/tinypool/dist/chunk-E2J7JLFN.js +53 -0
  25. package/compiled/tinypool/dist/chunk-UBWFVGJX.js +38 -0
  26. package/compiled/tinypool/dist/entry/process.d.ts +2 -0
  27. package/compiled/tinypool/dist/entry/process.js +92 -0
  28. package/compiled/tinypool/dist/entry/utils.d.ts +5 -0
  29. package/compiled/tinypool/dist/entry/utils.js +9 -0
  30. package/compiled/tinypool/dist/entry/worker.d.ts +2 -0
  31. package/compiled/tinypool/dist/entry/worker.js +103 -0
  32. package/compiled/tinypool/dist/index.d.ts +188 -0
  33. package/compiled/tinypool/dist/index.js +1080 -0
  34. package/compiled/tinypool/package.json +55 -0
  35. package/compiled/watchpack/index.d.ts +216 -0
  36. package/compiled/watchpack/index.js +2127 -0
  37. package/compiled/watchpack/license +20 -0
  38. package/compiled/watchpack/package.json +1 -0
  39. package/compiled/webpack-sources/index.js +4720 -0
  40. package/compiled/webpack-sources/license +21 -0
  41. package/compiled/webpack-sources/package.json +1 -0
  42. package/compiled/webpack-sources/types.d.ts +320 -0
  43. package/compiled/zod/dist/types/index.d.ts +3 -0
  44. package/compiled/zod/dist/types/v3/ZodError.d.ts +164 -0
  45. package/compiled/zod/dist/types/v3/benchmarks/datetime.d.ts +5 -0
  46. package/compiled/zod/dist/types/v3/benchmarks/discriminatedUnion.d.ts +5 -0
  47. package/compiled/zod/dist/types/v3/benchmarks/index.d.ts +1 -0
  48. package/compiled/zod/dist/types/v3/benchmarks/ipv4.d.ts +5 -0
  49. package/compiled/zod/dist/types/v3/benchmarks/object.d.ts +5 -0
  50. package/compiled/zod/dist/types/v3/benchmarks/primitives.d.ts +5 -0
  51. package/compiled/zod/dist/types/v3/benchmarks/realworld.d.ts +5 -0
  52. package/compiled/zod/dist/types/v3/benchmarks/string.d.ts +5 -0
  53. package/compiled/zod/dist/types/v3/benchmarks/union.d.ts +5 -0
  54. package/compiled/zod/dist/types/v3/errors.d.ts +5 -0
  55. package/compiled/zod/dist/types/v3/external.d.ts +6 -0
  56. package/compiled/zod/dist/types/v3/helpers/enumUtil.d.ts +8 -0
  57. package/compiled/zod/dist/types/v3/helpers/errorUtil.d.ts +9 -0
  58. package/compiled/zod/dist/types/v3/helpers/parseUtil.d.ts +78 -0
  59. package/compiled/zod/dist/types/v3/helpers/partialUtil.d.ts +8 -0
  60. package/compiled/zod/dist/types/v3/helpers/typeAliases.d.ts +2 -0
  61. package/compiled/zod/dist/types/v3/helpers/util.d.ts +85 -0
  62. package/compiled/zod/dist/types/v3/index.d.ts +4 -0
  63. package/compiled/zod/dist/types/v3/locales/en.d.ts +3 -0
  64. package/compiled/zod/dist/types/v3/standard-schema.d.ts +102 -0
  65. package/compiled/zod/dist/types/v3/tests/Mocker.d.ts +17 -0
  66. package/compiled/zod/dist/types/v3/types.d.ts +1031 -0
  67. package/compiled/zod/dist/types/v4/classic/checks.d.ts +1 -0
  68. package/compiled/zod/dist/types/v4/classic/coerce.d.ts +17 -0
  69. package/compiled/zod/dist/types/v4/classic/compat.d.ts +48 -0
  70. package/compiled/zod/dist/types/v4/classic/errors.d.ts +30 -0
  71. package/compiled/zod/dist/types/v4/classic/external.d.ts +13 -0
  72. package/compiled/zod/dist/types/v4/classic/index.d.ts +4 -0
  73. package/compiled/zod/dist/types/v4/classic/iso.d.ts +22 -0
  74. package/compiled/zod/dist/types/v4/classic/parse.d.ts +23 -0
  75. package/compiled/zod/dist/types/v4/classic/schemas.d.ts +619 -0
  76. package/compiled/zod/dist/types/v4/core/api.d.ts +273 -0
  77. package/compiled/zod/dist/types/v4/core/checks.d.ts +277 -0
  78. package/compiled/zod/dist/types/v4/core/config.d.ts +9 -0
  79. package/compiled/zod/dist/types/v4/core/core.d.ts +47 -0
  80. package/compiled/zod/dist/types/v4/core/doc.d.ts +14 -0
  81. package/compiled/zod/dist/types/v4/core/errors.d.ts +204 -0
  82. package/compiled/zod/dist/types/v4/core/function.d.ts +52 -0
  83. package/compiled/zod/dist/types/v4/core/index.d.ts +15 -0
  84. package/compiled/zod/dist/types/v4/core/json-schema.d.ts +100 -0
  85. package/compiled/zod/dist/types/v4/core/parse.d.ts +25 -0
  86. package/compiled/zod/dist/types/v4/core/regexes.d.ts +62 -0
  87. package/compiled/zod/dist/types/v4/core/registries.d.ts +37 -0
  88. package/compiled/zod/dist/types/v4/core/schemas.d.ts +1011 -0
  89. package/compiled/zod/dist/types/v4/core/standard-schema.d.ts +55 -0
  90. package/compiled/zod/dist/types/v4/core/to-json-schema.d.ts +84 -0
  91. package/compiled/zod/dist/types/v4/core/util.d.ts +182 -0
  92. package/compiled/zod/dist/types/v4/core/versions.d.ts +5 -0
  93. package/compiled/zod/dist/types/v4/core/zsf.d.ts +91 -0
  94. package/compiled/zod/dist/types/v4/index.d.ts +3 -0
  95. package/compiled/zod/dist/types/v4/locales/ar.d.ts +4 -0
  96. package/compiled/zod/dist/types/v4/locales/az.d.ts +4 -0
  97. package/compiled/zod/dist/types/v4/locales/be.d.ts +4 -0
  98. package/compiled/zod/dist/types/v4/locales/ca.d.ts +4 -0
  99. package/compiled/zod/dist/types/v4/locales/cs.d.ts +4 -0
  100. package/compiled/zod/dist/types/v4/locales/de.d.ts +4 -0
  101. package/compiled/zod/dist/types/v4/locales/en.d.ts +5 -0
  102. package/compiled/zod/dist/types/v4/locales/es.d.ts +4 -0
  103. package/compiled/zod/dist/types/v4/locales/fa.d.ts +4 -0
  104. package/compiled/zod/dist/types/v4/locales/fi.d.ts +4 -0
  105. package/compiled/zod/dist/types/v4/locales/fr-CA.d.ts +4 -0
  106. package/compiled/zod/dist/types/v4/locales/fr.d.ts +4 -0
  107. package/compiled/zod/dist/types/v4/locales/he.d.ts +4 -0
  108. package/compiled/zod/dist/types/v4/locales/hu.d.ts +4 -0
  109. package/compiled/zod/dist/types/v4/locales/id.d.ts +4 -0
  110. package/compiled/zod/dist/types/v4/locales/index.d.ts +37 -0
  111. package/compiled/zod/dist/types/v4/locales/it.d.ts +4 -0
  112. package/compiled/zod/dist/types/v4/locales/ja.d.ts +4 -0
  113. package/compiled/zod/dist/types/v4/locales/kh.d.ts +4 -0
  114. package/compiled/zod/dist/types/v4/locales/ko.d.ts +4 -0
  115. package/compiled/zod/dist/types/v4/locales/mk.d.ts +4 -0
  116. package/compiled/zod/dist/types/v4/locales/ms.d.ts +4 -0
  117. package/compiled/zod/dist/types/v4/locales/nl.d.ts +4 -0
  118. package/compiled/zod/dist/types/v4/locales/no.d.ts +4 -0
  119. package/compiled/zod/dist/types/v4/locales/ota.d.ts +4 -0
  120. package/compiled/zod/dist/types/v4/locales/pl.d.ts +4 -0
  121. package/compiled/zod/dist/types/v4/locales/pt.d.ts +4 -0
  122. package/compiled/zod/dist/types/v4/locales/ru.d.ts +4 -0
  123. package/compiled/zod/dist/types/v4/locales/sl.d.ts +4 -0
  124. package/compiled/zod/dist/types/v4/locales/sv.d.ts +4 -0
  125. package/compiled/zod/dist/types/v4/locales/ta.d.ts +4 -0
  126. package/compiled/zod/dist/types/v4/locales/th.d.ts +4 -0
  127. package/compiled/zod/dist/types/v4/locales/tr.d.ts +5 -0
  128. package/compiled/zod/dist/types/v4/locales/ua.d.ts +4 -0
  129. package/compiled/zod/dist/types/v4/locales/ur.d.ts +4 -0
  130. package/compiled/zod/dist/types/v4/locales/vi.d.ts +4 -0
  131. package/compiled/zod/dist/types/v4/locales/zh-CN.d.ts +4 -0
  132. package/compiled/zod/dist/types/v4/locales/zh-TW.d.ts +4 -0
  133. package/compiled/zod/dist/types/v4/mini/checks.d.ts +1 -0
  134. package/compiled/zod/dist/types/v4/mini/coerce.d.ts +7 -0
  135. package/compiled/zod/dist/types/v4/mini/external.d.ts +11 -0
  136. package/compiled/zod/dist/types/v4/mini/index.d.ts +3 -0
  137. package/compiled/zod/dist/types/v4/mini/iso.d.ts +22 -0
  138. package/compiled/zod/dist/types/v4/mini/parse.d.ts +1 -0
  139. package/compiled/zod/dist/types/v4/mini/schemas.d.ts +398 -0
  140. package/compiled/zod/index.js +4513 -0
  141. package/compiled/zod/license +21 -0
  142. package/compiled/zod/package.json +1 -0
  143. package/compiled/zod/v3/index.d.ts +3 -0
  144. package/compiled/zod/v4/core/index.d.ts +1 -0
  145. package/compiled/zod/v4/index.d.ts +3 -0
  146. package/compiled/zod/v4/locales/en.d.ts +2 -0
  147. package/compiled/zod/v4/locales/index.d.ts +1 -0
  148. package/compiled/zod/v4-mini/index.d.ts +1 -0
  149. package/dist/Chunk.d.ts +35 -0
  150. package/dist/ChunkGraph.d.ts +23 -0
  151. package/dist/ChunkGroup.d.ts +33 -0
  152. package/dist/Chunks.d.ts +13 -0
  153. package/dist/CodeGenerationResults.d.ts +1 -0
  154. package/dist/Compilation.d.ts +411 -0
  155. package/dist/Compiler.d.ts +192 -0
  156. package/dist/ConcatenatedModule.d.ts +1 -0
  157. package/dist/ContextModule.d.ts +1 -0
  158. package/dist/ContextModuleFactory.d.ts +13 -0
  159. package/dist/Diagnostics.d.ts +7 -0
  160. package/dist/Entrypoint.d.ts +10 -0
  161. package/dist/ErrorHelpers.d.ts +1 -0
  162. package/dist/ExecuteModulePlugin.d.ts +4 -0
  163. package/dist/ExportsInfo.d.ts +20 -0
  164. package/dist/ExternalModule.d.ts +1 -0
  165. package/dist/FileSystem.d.ts +29 -0
  166. package/dist/FileSystemInfo.d.ts +5 -0
  167. package/dist/Module.d.ts +66 -0
  168. package/dist/ModuleGraph.d.ts +19 -0
  169. package/dist/ModuleTypeConstants.d.ts +8 -0
  170. package/dist/MultiCompiler.d.ts +75 -0
  171. package/dist/MultiStats.d.ts +22 -0
  172. package/dist/MultiWatching.d.ts +26 -0
  173. package/dist/NormalModule.d.ts +15 -0
  174. package/dist/NormalModuleFactory.d.ts +23 -0
  175. package/dist/Resolver.d.ts +18 -0
  176. package/dist/ResolverFactory.d.ts +14 -0
  177. package/dist/RspackError.d.ts +9 -0
  178. package/dist/RuleSetCompiler.d.ts +9 -0
  179. package/dist/RuntimeGlobals.d.ts +325 -0
  180. package/dist/RuntimeModule.d.ts +32 -0
  181. package/dist/Stats.d.ts +17 -0
  182. package/dist/Template.d.ts +77 -0
  183. package/dist/Watching.d.ts +38 -0
  184. package/dist/builtin-loader/index.d.ts +1 -0
  185. package/dist/builtin-loader/lightningcss/index.d.ts +117 -0
  186. package/dist/builtin-loader/swc/index.d.ts +3 -0
  187. package/dist/builtin-loader/swc/pluginImport.d.ts +68 -0
  188. package/dist/builtin-loader/swc/types.d.ts +2315 -0
  189. package/dist/builtin-plugin/APIPlugin.d.ts +10 -0
  190. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +10 -0
  191. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +10 -0
  192. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +10 -0
  193. package/dist/builtin-plugin/BannerPlugin.d.ts +40 -0
  194. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +15 -0
  195. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +10 -0
  196. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +59 -0
  197. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +10 -0
  198. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +10 -0
  199. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +14 -0
  200. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +19 -0
  201. package/dist/builtin-plugin/CssModulesPlugin.d.ts +10 -0
  202. package/dist/builtin-plugin/DataUriPlugin.d.ts +10 -0
  203. package/dist/builtin-plugin/DefinePlugin.d.ts +17 -0
  204. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +8 -0
  205. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +8 -0
  206. package/dist/builtin-plugin/DllEntryPlugin.d.ts +13 -0
  207. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +11 -0
  208. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +12 -0
  209. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +10 -0
  210. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +26 -0
  211. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -0
  212. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +10 -0
  213. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +10 -0
  214. package/dist/builtin-plugin/EntryPlugin.d.ts +32 -0
  215. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +11 -0
  216. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +10 -0
  217. package/dist/builtin-plugin/ExternalsPlugin.d.ts +10 -0
  218. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +10 -0
  219. package/dist/builtin-plugin/FileUriPlugin.d.ts +10 -0
  220. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +10 -0
  221. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +10 -0
  222. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +10 -0
  223. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +7 -0
  224. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +10 -0
  225. package/dist/builtin-plugin/HttpUriPlugin.d.ts +36 -0
  226. package/dist/builtin-plugin/IgnorePlugin.d.ts +19 -0
  227. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +10 -0
  228. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +15 -0
  229. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +11 -0
  230. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +10 -0
  231. package/dist/builtin-plugin/LibManifestPlugin.d.ts +18 -0
  232. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +33 -0
  233. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +15 -0
  234. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +10 -0
  235. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +10 -0
  236. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +10 -0
  237. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +8 -0
  238. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +10 -0
  239. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +10 -0
  240. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +10 -0
  241. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +8 -0
  242. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +8 -0
  243. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +10 -0
  244. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +10 -0
  245. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +10 -0
  246. package/dist/builtin-plugin/ProgressPlugin.d.ts +11 -0
  247. package/dist/builtin-plugin/ProvidePlugin.d.ts +11 -0
  248. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +10 -0
  249. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +10 -0
  250. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +10 -0
  251. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +45 -0
  252. package/dist/builtin-plugin/RstestPlugin.d.ts +11 -0
  253. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
  254. package/dist/builtin-plugin/RuntimePlugin.d.ts +28 -0
  255. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +10 -0
  256. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +20 -0
  257. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +11 -0
  258. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +11 -0
  259. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +40 -0
  260. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +213 -0
  261. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +10 -0
  262. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +7 -0
  263. package/dist/builtin-plugin/WorkerPlugin.d.ts +13 -0
  264. package/dist/builtin-plugin/base.d.ts +21 -0
  265. package/dist/builtin-plugin/css-extract/index.d.ts +24 -0
  266. package/dist/builtin-plugin/css-extract/loader.d.ts +21 -0
  267. package/dist/builtin-plugin/css-extract/utils.d.ts +6 -0
  268. package/dist/builtin-plugin/html-plugin/hooks.d.ts +32 -0
  269. package/dist/builtin-plugin/html-plugin/index.d.ts +2 -0
  270. package/dist/builtin-plugin/html-plugin/options.d.ts +83 -0
  271. package/dist/builtin-plugin/html-plugin/plugin.d.ts +24 -0
  272. package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
  273. package/dist/builtin-plugin/index.d.ts +79 -0
  274. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +25 -0
  275. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +4 -0
  276. package/dist/config/adapter.d.ts +8 -0
  277. package/dist/config/adapterRuleUse.d.ts +333 -0
  278. package/dist/config/browserslistTargetHandler.d.ts +15 -0
  279. package/dist/config/defaults.d.ts +13 -0
  280. package/dist/config/devServer.d.ts +207 -0
  281. package/dist/config/index.d.ts +4 -0
  282. package/dist/config/normalization.d.ts +148 -0
  283. package/dist/config/target.d.ts +89 -0
  284. package/dist/config/types.d.ts +2228 -0
  285. package/dist/config/utils.d.ts +16 -0
  286. package/dist/config/zod.d.ts +4228 -0
  287. package/dist/container/ContainerPlugin.d.ts +40 -0
  288. package/dist/container/ContainerReferencePlugin.d.ts +33 -0
  289. package/dist/container/ModuleFederationPlugin.d.ts +13 -0
  290. package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
  291. package/dist/container/ModuleFederationRuntimePlugin.d.ts +10 -0
  292. package/dist/container/options.d.ts +3 -0
  293. package/dist/cssExtractHmr.js +125 -0
  294. package/dist/cssExtractLoader.js +161 -0
  295. package/dist/error/ConcurrentCompilationError.d.ts +14 -0
  296. package/dist/exports.d.ts +191 -0
  297. package/dist/index.d.ts +10 -0
  298. package/dist/index.js +13559 -0
  299. package/dist/lib/AbstractMethodError.d.ts +23 -0
  300. package/dist/lib/Cache.d.ts +65 -0
  301. package/dist/lib/CacheFacade.d.ts +139 -0
  302. package/dist/lib/DllPlugin.d.ts +42 -0
  303. package/dist/lib/DllReferencePlugin.d.ts +119 -0
  304. package/dist/lib/EntryOptionPlugin.d.ts +33 -0
  305. package/dist/lib/EnvironmentPlugin.d.ts +22 -0
  306. package/dist/lib/HookWebpackError.d.ts +40 -0
  307. package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
  308. package/dist/lib/LoaderOptionsPlugin.d.ts +28 -0
  309. package/dist/lib/LoaderTargetPlugin.d.ts +24 -0
  310. package/dist/lib/ModuleFilenameHelpers.d.ts +53 -0
  311. package/dist/lib/NormalModuleReplacementPlugin.d.ts +29 -0
  312. package/dist/lib/WebpackError.d.ts +23 -0
  313. package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
  314. package/dist/lib/cache/getLazyHashedEtag.d.ts +35 -0
  315. package/dist/lib/cache/mergeEtags.d.ts +17 -0
  316. package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
  317. package/dist/loader-runner/index.d.ts +43 -0
  318. package/dist/loader-runner/loadLoader.d.ts +11 -0
  319. package/dist/loader-runner/service.d.ts +71 -0
  320. package/dist/loader-runner/utils.d.ts +6 -0
  321. package/dist/loader-runner/worker.d.ts +14 -0
  322. package/dist/logging/Logger.d.ts +61 -0
  323. package/dist/logging/createConsoleLogger.d.ts +35 -0
  324. package/dist/logging/truncateArgs.d.ts +16 -0
  325. package/dist/moduleFederationDefaultRuntime.js +1 -0
  326. package/dist/node/NodeEnvironmentPlugin.d.ts +10 -0
  327. package/dist/node/NodeTemplatePlugin.d.ts +18 -0
  328. package/dist/node/NodeWatchFileSystem.d.ts +18 -0
  329. package/dist/node/nodeConsole.d.ts +15 -0
  330. package/dist/rspack.d.ts +16 -0
  331. package/dist/rspackOptionsApply.d.ts +4 -0
  332. package/dist/runtime/cssExtractHmr.d.ts +4 -0
  333. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
  334. package/dist/sharing/ConsumeSharedPlugin.d.ts +41 -0
  335. package/dist/sharing/ProvideSharedPlugin.d.ts +34 -0
  336. package/dist/sharing/SharePlugin.d.ts +51 -0
  337. package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
  338. package/dist/sharing/utils.d.ts +1 -0
  339. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +4 -0
  340. package/dist/stats/DefaultStatsPresetPlugin.d.ts +4 -0
  341. package/dist/stats/DefaultStatsPrinterPlugin.d.ts +13 -0
  342. package/dist/stats/StatsFactory.d.ts +57 -0
  343. package/dist/stats/StatsPrinter.d.ts +57 -0
  344. package/dist/stats/statsFactoryUtils.d.ts +325 -0
  345. package/dist/swc.d.ts +5 -0
  346. package/dist/taps/compilation.d.ts +8 -0
  347. package/dist/taps/compiler.d.ts +2 -0
  348. package/dist/taps/contextModuleFactory.d.ts +2 -0
  349. package/dist/taps/index.d.ts +6 -0
  350. package/dist/taps/javascriptModules.d.ts +2 -0
  351. package/dist/taps/normalModuleFactory.d.ts +2 -0
  352. package/dist/taps/types.d.ts +11 -0
  353. package/dist/trace/index.d.ts +42 -0
  354. package/dist/trace/traceHookPlugin.d.ts +5 -0
  355. package/dist/util/ArrayQueue.d.ts +45 -0
  356. package/dist/util/AsyncTask.d.ts +7 -0
  357. package/dist/util/MergeCaller.d.ts +10 -0
  358. package/dist/util/SizeFormatHelpers.d.ts +10 -0
  359. package/dist/util/SplitChunkSize.d.ts +5 -0
  360. package/dist/util/assertNotNil.d.ts +1 -0
  361. package/dist/util/assetCondition.d.ts +2 -0
  362. package/dist/util/asyncLib.d.ts +54 -0
  363. package/dist/util/bindingVersionCheck.d.ts +5 -0
  364. package/dist/util/cleverMerge.d.ts +24 -0
  365. package/dist/util/comparators.d.ts +16 -0
  366. package/dist/util/createHash.d.ts +16 -0
  367. package/dist/util/createReadonlyMap.d.ts +1 -0
  368. package/dist/util/fake.d.ts +9 -0
  369. package/dist/util/fs.d.ts +342 -0
  370. package/dist/util/hash/index.d.ts +26 -0
  371. package/dist/util/hash/md4.d.ts +11 -0
  372. package/dist/util/hash/wasm-hash.d.ts +51 -0
  373. package/dist/util/hash/xxhash64.d.ts +11 -0
  374. package/dist/util/identifier.d.ts +31 -0
  375. package/dist/util/index.d.ts +13 -0
  376. package/dist/util/memoize.d.ts +2 -0
  377. package/dist/util/runtime.d.ts +2 -0
  378. package/dist/util/smartGrouping.d.ts +21 -0
  379. package/dist/util/source.d.ts +7 -0
  380. package/dist/util/validate.d.ts +9 -0
  381. package/dist/worker.js +937 -0
  382. package/hot/dev-server.js +75 -0
  383. package/hot/emitter.js +21 -0
  384. package/hot/lazy-compilation-node.js +54 -0
  385. package/hot/lazy-compilation-web.js +79 -0
  386. package/hot/log-apply-result.js +49 -0
  387. package/hot/log.js +79 -0
  388. package/hot/only-dev-server.js +103 -0
  389. package/hot/poll.js +40 -0
  390. package/hot/signal.js +66 -0
  391. package/module.d.ts +276 -0
  392. package/package.json +78 -0
@@ -0,0 +1,2109 @@
1
+ interface Assumptions {
2
+ /**
3
+ * https://babeljs.io/docs/en/assumptions#arraylikeisiterable
4
+ */
5
+ arrayLikeIsIterable?: boolean;
6
+ /**
7
+ * https://babeljs.io/docs/en/assumptions#constantreexports
8
+ */
9
+ constantReexports?: boolean;
10
+ /**
11
+ * https://babeljs.io/docs/en/assumptions#constantsuper
12
+ */
13
+ constantSuper?: boolean;
14
+ /**
15
+ * https://babeljs.io/docs/en/assumptions#enumerablemodulemeta
16
+ */
17
+ enumerableModuleMeta?: boolean;
18
+ /**
19
+ * https://babeljs.io/docs/en/assumptions#ignorefunctionlength
20
+ */
21
+ ignoreFunctionLength?: boolean;
22
+ ignoreFunctionName?: boolean;
23
+ /**
24
+ * https://babeljs.io/docs/en/assumptions#ignoretoprimitivehint
25
+ */
26
+ ignoreToPrimitiveHint?: boolean;
27
+ /**
28
+ * https://babeljs.io/docs/en/assumptions#iterableisarray
29
+ */
30
+ iterableIsArray?: boolean;
31
+ /**
32
+ * https://babeljs.io/docs/en/assumptions#mutabletemplateobject
33
+ */
34
+ mutableTemplateObject?: boolean;
35
+ /**
36
+ * https://babeljs.io/docs/en/assumptions#noclasscalls
37
+ */
38
+ noClassCalls?: boolean;
39
+ /**
40
+ * https://babeljs.io/docs/en/assumptions#nodocumentall
41
+ */
42
+ noDocumentAll?: boolean;
43
+ /**
44
+ * https://babeljs.io/docs/en/assumptions#noincompletensimportdetection
45
+ */
46
+ noIncompleteNsImportDetection?: boolean;
47
+ /**
48
+ * https://babeljs.io/docs/en/assumptions#nonewarrows
49
+ */
50
+ noNewArrows?: boolean;
51
+ /**
52
+ * https://babeljs.io/docs/en/assumptions#objectrestnosymbols
53
+ */
54
+ objectRestNoSymbols?: boolean;
55
+ /**
56
+ * https://babeljs.io/docs/en/assumptions#privatefieldsasproperties
57
+ */
58
+ privateFieldsAsProperties?: boolean;
59
+ /**
60
+ * https://babeljs.io/docs/en/assumptions#puregetters
61
+ */
62
+ pureGetters?: boolean;
63
+ /**
64
+ * https://babeljs.io/docs/en/assumptions#setclassmethods
65
+ */
66
+ setClassMethods?: boolean;
67
+ /**
68
+ * https://babeljs.io/docs/en/assumptions#setcomputedproperties
69
+ */
70
+ setComputedProperties?: boolean;
71
+ /**
72
+ * https://babeljs.io/docs/en/assumptions#setpublicclassfields
73
+ */
74
+ setPublicClassFields?: boolean;
75
+ /**
76
+ * https://babeljs.io/docs/en/assumptions#setspreadproperties
77
+ */
78
+ setSpreadProperties?: boolean;
79
+ /**
80
+ * https://babeljs.io/docs/en/assumptions#skipforofiteratorclosing
81
+ */
82
+ skipForOfIteratorClosing?: boolean;
83
+ /**
84
+ * https://babeljs.io/docs/en/assumptions#superiscallableconstructor
85
+ */
86
+ superIsCallableConstructor?: boolean;
87
+ /**
88
+ * @deprecated This value will be always true
89
+ */
90
+ tsEnumIsReadonly?: boolean;
91
+ }
92
+
93
+ interface Plugin {
94
+ (module: Program): Program;
95
+ }
96
+ type ParseOptions = ParserConfig & {
97
+ comments?: boolean;
98
+ script?: boolean;
99
+ /**
100
+ * Defaults to es3.
101
+ */
102
+ target?: JscTarget;
103
+ };
104
+ type TerserEcmaVersion = 5 | 2015 | 2016 | string | number;
105
+ interface JsMinifyOptions {
106
+ compress?: TerserCompressOptions | boolean;
107
+ format?: JsFormatOptions & ToSnakeCaseProperties<JsFormatOptions>;
108
+ mangle?: TerserMangleOptions | boolean;
109
+ ecma?: TerserEcmaVersion;
110
+ keep_classnames?: boolean;
111
+ keep_fnames?: boolean;
112
+ module?: boolean | "unknown";
113
+ safari10?: boolean;
114
+ toplevel?: boolean;
115
+ sourceMap?: boolean;
116
+ outputPath?: string;
117
+ inlineSourcesContent?: boolean;
118
+ }
119
+ /**
120
+ * @example ToSnakeCase<'indentLevel'> == 'indent_level'
121
+ */
122
+ type ToSnakeCase<T extends string> = T extends `${infer A}${infer B}` ? `${A extends Lowercase<A> ? A : `_${Lowercase<A>}`}${ToSnakeCase<B>}` : T;
123
+ /**
124
+ * @example ToSnakeCaseProperties<{indentLevel: 3}> == {indent_level: 3}
125
+ */
126
+ type ToSnakeCaseProperties<T> = {
127
+ [K in keyof T as K extends string ? ToSnakeCase<K> : K]: T[K];
128
+ };
129
+ /**
130
+ * These properties are mostly not implemented yet,
131
+ * but it exists to support passing terser config to swc minify
132
+ * without modification.
133
+ */
134
+ interface JsFormatOptions {
135
+ /**
136
+ * Currently noop.
137
+ * @default false
138
+ * @alias ascii_only
139
+ */
140
+ asciiOnly?: boolean;
141
+ /**
142
+ * Currently noop.
143
+ * @default false
144
+ */
145
+ beautify?: boolean;
146
+ /**
147
+ * Currently noop.
148
+ * @default false
149
+ */
150
+ braces?: boolean;
151
+ /**
152
+ * - `false`: removes all comments
153
+ * - `'some'`: preserves some comments
154
+ * - `'all'`: preserves all comments
155
+ * @default false
156
+ */
157
+ comments?: false | "some" | "all";
158
+ /**
159
+ * Currently noop.
160
+ * @default 5
161
+ */
162
+ ecma?: TerserEcmaVersion;
163
+ /**
164
+ * Currently noop.
165
+ * @alias indent_level
166
+ */
167
+ indentLevel?: number;
168
+ /**
169
+ * Currently noop.
170
+ * @alias indent_start
171
+ */
172
+ indentStart?: number;
173
+ /**
174
+ * Currently noop.
175
+ * @alias inline_script
176
+ */
177
+ inlineScript?: boolean;
178
+ /**
179
+ * Currently noop.
180
+ * @alias keep_numbers
181
+ */
182
+ keepNumbers?: number;
183
+ /**
184
+ * Currently noop.
185
+ * @alias keep_quoted_props
186
+ */
187
+ keepQuotedProps?: boolean;
188
+ /**
189
+ * Currently noop.
190
+ * @alias max_line_len
191
+ */
192
+ maxLineLen?: number | false;
193
+ /**
194
+ * Currently noop.
195
+ */
196
+ preamble?: string;
197
+ /**
198
+ * Currently noop.
199
+ * @alias quote_keys
200
+ */
201
+ quoteKeys?: boolean;
202
+ /**
203
+ * Currently noop.
204
+ * @alias quote_style
205
+ */
206
+ quoteStyle?: boolean;
207
+ /**
208
+ * Currently noop.
209
+ * @alias preserve_annotations
210
+ */
211
+ preserveAnnotations?: boolean;
212
+ /**
213
+ * Currently noop.
214
+ */
215
+ safari10?: boolean;
216
+ /**
217
+ * Currently noop.
218
+ */
219
+ semicolons?: boolean;
220
+ /**
221
+ * Currently noop.
222
+ */
223
+ shebang?: boolean;
224
+ /**
225
+ * Currently noop.
226
+ */
227
+ webkit?: boolean;
228
+ /**
229
+ * Currently noop.
230
+ * @alias wrap_iife
231
+ */
232
+ wrapIife?: boolean;
233
+ /**
234
+ * Currently noop.
235
+ * @alias wrap_func_args
236
+ */
237
+ wrapFuncArgs?: boolean;
238
+ }
239
+ interface TerserCompressOptions {
240
+ arguments?: boolean;
241
+ arrows?: boolean;
242
+ booleans?: boolean;
243
+ booleans_as_integers?: boolean;
244
+ collapse_vars?: boolean;
245
+ comparisons?: boolean;
246
+ computed_props?: boolean;
247
+ conditionals?: boolean;
248
+ dead_code?: boolean;
249
+ defaults?: boolean;
250
+ directives?: boolean;
251
+ drop_console?: boolean;
252
+ drop_debugger?: boolean;
253
+ ecma?: TerserEcmaVersion;
254
+ evaluate?: boolean;
255
+ expression?: boolean;
256
+ global_defs?: any;
257
+ hoist_funs?: boolean;
258
+ hoist_props?: boolean;
259
+ hoist_vars?: boolean;
260
+ ie8?: boolean;
261
+ if_return?: boolean;
262
+ inline?: 0 | 1 | 2 | 3;
263
+ join_vars?: boolean;
264
+ keep_classnames?: boolean;
265
+ keep_fargs?: boolean;
266
+ keep_fnames?: boolean;
267
+ keep_infinity?: boolean;
268
+ loops?: boolean;
269
+ negate_iife?: boolean;
270
+ passes?: number;
271
+ properties?: boolean;
272
+ pure_getters?: any;
273
+ pure_funcs?: string[];
274
+ reduce_funcs?: boolean;
275
+ reduce_vars?: boolean;
276
+ sequences?: any;
277
+ side_effects?: boolean;
278
+ switches?: boolean;
279
+ top_retain?: any;
280
+ toplevel?: any;
281
+ typeofs?: boolean;
282
+ unsafe?: boolean;
283
+ unsafe_passes?: boolean;
284
+ unsafe_arrows?: boolean;
285
+ unsafe_comps?: boolean;
286
+ unsafe_function?: boolean;
287
+ unsafe_math?: boolean;
288
+ unsafe_symbols?: boolean;
289
+ unsafe_methods?: boolean;
290
+ unsafe_proto?: boolean;
291
+ unsafe_regexp?: boolean;
292
+ unsafe_undefined?: boolean;
293
+ unused?: boolean;
294
+ const_to_let?: boolean;
295
+ module?: boolean;
296
+ }
297
+ interface TerserMangleOptions {
298
+ props?: TerserManglePropertiesOptions;
299
+ /**
300
+ * Pass `true` to mangle names declared in the top level scope.
301
+ */
302
+ topLevel?: boolean;
303
+ /**
304
+ * @deprecated An alias for compatibility with terser.
305
+ */
306
+ toplevel?: boolean;
307
+ /**
308
+ * Pass `true` to not mangle class names.
309
+ */
310
+ keepClassNames?: boolean;
311
+ /**
312
+ * @deprecated An alias for compatibility with terser.
313
+ */
314
+ keep_classnames?: boolean;
315
+ /**
316
+ * Pass `true` to not mangle function names.
317
+ */
318
+ keepFnNames?: boolean;
319
+ /**
320
+ * @deprecated An alias for compatibility with terser.
321
+ */
322
+ keep_fnames?: boolean;
323
+ /**
324
+ * Pass `true` to not mangle private props.
325
+ */
326
+ keepPrivateProps?: boolean;
327
+ /**
328
+ * @deprecated An alias for compatibility with terser.
329
+ */
330
+ keep_private_props?: boolean;
331
+ ie8?: boolean;
332
+ safari10?: boolean;
333
+ reserved?: string[];
334
+ }
335
+ interface TerserManglePropertiesOptions {
336
+ }
337
+ /**
338
+ * Programmatic options.
339
+ */
340
+ interface Options extends Config {
341
+ /**
342
+ * If true, a file is parsed as a script instead of module.
343
+ */
344
+ script?: boolean;
345
+ /**
346
+ * The working directory that all paths in the programmatic
347
+ * options will be resolved relative to.
348
+ *
349
+ * Defaults to `process.cwd()`.
350
+ */
351
+ cwd?: string;
352
+ caller?: CallerOptions;
353
+ /** The filename associated with the code currently being compiled,
354
+ * if there is one. The filename is optional, but not all of Swc's
355
+ * functionality is available when the filename is unknown, because a
356
+ * subset of options rely on the filename for their functionality.
357
+ *
358
+ * The three primary cases users could run into are:
359
+ *
360
+ * - The filename is exposed to plugins. Some plugins may require the
361
+ * presence of the filename.
362
+ * - Options like "test", "exclude", and "ignore" require the filename
363
+ * for string/RegExp matching.
364
+ * - .swcrc files are loaded relative to the file being compiled.
365
+ * If this option is omitted, Swc will behave as if swcrc: false has been set.
366
+ */
367
+ filename?: string;
368
+ /**
369
+ * The initial path that will be processed based on the "rootMode" to
370
+ * determine the conceptual root folder for the current Swc project.
371
+ * This is used in two primary cases:
372
+ *
373
+ * - The base directory when checking for the default "configFile" value
374
+ * - The default value for "swcrcRoots".
375
+ *
376
+ * Defaults to `opts.cwd`
377
+ */
378
+ root?: string;
379
+ /**
380
+ * This option, combined with the "root" value, defines how Swc chooses
381
+ * its project root. The different modes define different ways that Swc
382
+ * can process the "root" value to get the final project root.
383
+ *
384
+ * "root" - Passes the "root" value through as unchanged.
385
+ * "upward" - Walks upward from the "root" directory, looking for a directory
386
+ * containing a swc.config.js file, and throws an error if a swc.config.js
387
+ * is not found.
388
+ * "upward-optional" - Walk upward from the "root" directory, looking for
389
+ * a directory containing a swc.config.js file, and falls back to "root"
390
+ * if a swc.config.js is not found.
391
+ *
392
+ *
393
+ * "root" is the default mode because it avoids the risk that Swc
394
+ * will accidentally load a swc.config.js that is entirely outside
395
+ * of the current project folder. If you use "upward-optional",
396
+ * be aware that it will walk up the directory structure all the
397
+ * way to the filesystem root, and it is always possible that someone
398
+ * will have a forgotten swc.config.js in their home directory,
399
+ * which could cause unexpected errors in your builds.
400
+ *
401
+ *
402
+ * Users with monorepo project structures that run builds/tests on a
403
+ * per-package basis may well want to use "upward" since monorepos
404
+ * often have a swc.config.js in the project root. Running Swc
405
+ * in a monorepo subdirectory without "upward", will cause Swc
406
+ * to skip loading any swc.config.js files in the project root,
407
+ * which can lead to unexpected errors and compilation failure.
408
+ */
409
+ rootMode?: "root" | "upward" | "upward-optional";
410
+ /**
411
+ * The current active environment used during configuration loading.
412
+ * This value is used as the key when resolving "env" configs,
413
+ * and is also available inside configuration functions, plugins,
414
+ * and presets, via the api.env() function.
415
+ *
416
+ * Defaults to `process.env.SWC_ENV || process.env.NODE_ENV || "development"`
417
+ */
418
+ envName?: string;
419
+ /**
420
+ * Defaults to searching for a default `.swcrc` file, but can
421
+ * be passed the path of any JS or JSON5 config file.
422
+ *
423
+ *
424
+ * NOTE: This option does not affect loading of .swcrc files,
425
+ * so while it may be tempting to do configFile: "./foo/.swcrc",
426
+ * it is not recommended. If the given .swcrc is loaded via the
427
+ * standard file-relative logic, you'll end up loading the same
428
+ * config file twice, merging it with itself. If you are linking
429
+ * a specific config file, it is recommended to stick with a
430
+ * naming scheme that is independent of the "swcrc" name.
431
+ *
432
+ * Defaults to `path.resolve(opts.root, ".swcrc")`
433
+ */
434
+ configFile?: string | boolean;
435
+ /**
436
+ * true will enable searching for configuration files relative to the "filename" provided to Swc.
437
+ *
438
+ * A swcrc value passed in the programmatic options will override one set within a configuration file.
439
+ *
440
+ * Note: .swcrc files are only loaded if the current "filename" is inside of
441
+ * a package that matches one of the "swcrcRoots" packages.
442
+ *
443
+ *
444
+ * Defaults to true as long as the filename option has been specified
445
+ */
446
+ swcrc?: boolean;
447
+ /**
448
+ * By default, Babel will only search for .babelrc files within the "root" package
449
+ * because otherwise Babel cannot know if a given .babelrc is meant to be loaded,
450
+ * or if it's "plugins" and "presets" have even been installed, since the file
451
+ * being compiled could be inside node_modules, or have been symlinked into the project.
452
+ *
453
+ *
454
+ * This option allows users to provide a list of other packages that should be
455
+ * considered "root" packages when considering whether to load .babelrc files.
456
+ *
457
+ *
458
+ * For example, a monorepo setup that wishes to allow individual packages
459
+ * to have their own configs might want to do
460
+ *
461
+ *
462
+ *
463
+ * Defaults to `opts.root`
464
+ */
465
+ swcrcRoots?: boolean | MatchPattern | MatchPattern[];
466
+ /**
467
+ * `true` will attempt to load an input sourcemap from the file itself, if it
468
+ * contains a //# sourceMappingURL=... comment. If no map is found, or the
469
+ * map fails to load and parse, it will be silently discarded.
470
+ *
471
+ * If an object is provided, it will be treated as the source map object itself.
472
+ *
473
+ * Defaults to `true`.
474
+ */
475
+ inputSourceMap?: boolean | string;
476
+ /**
477
+ * The name to use for the file inside the source map object.
478
+ *
479
+ * Defaults to `path.basename(opts.filenameRelative)` when available, or `"unknown"`.
480
+ */
481
+ sourceFileName?: string;
482
+ /**
483
+ * The sourceRoot fields to set in the generated source map, if one is desired.
484
+ */
485
+ sourceRoot?: string;
486
+ plugin?: Plugin;
487
+ isModule?: boolean | "unknown";
488
+ /**
489
+ * Destination path. Note that this value is used only to fix source path
490
+ * of source map files and swc does not write output to this path.
491
+ */
492
+ outputPath?: string;
493
+ }
494
+ interface CallerOptions {
495
+ name: string;
496
+ [key: string]: any;
497
+ }
498
+ type Swcrc = Config | Config[];
499
+ /**
500
+ * .swcrc
501
+ */
502
+ interface Config {
503
+ /**
504
+ * Note: The type is string because it follows rust's regex syntax.
505
+ */
506
+ test?: string | string[];
507
+ /**
508
+ * Note: The type is string because it follows rust's regex syntax.
509
+ */
510
+ exclude?: string | string[];
511
+ env?: EnvConfig;
512
+ jsc?: JscConfig;
513
+ module?: ModuleConfig;
514
+ minify?: boolean;
515
+ /**
516
+ * - true to generate a sourcemap for the code and include it in the result object.
517
+ * - "inline" to generate a sourcemap and append it as a data URL to the end of the code, but not include it in the result object.
518
+ *
519
+ * `swc-cli` overloads some of these to also affect how maps are written to disk:
520
+ *
521
+ * - true will write the map to a .map file on disk
522
+ * - "inline" will write the file directly, so it will have a data: containing the map
523
+ * - Note: These options are bit weird, so it may make the most sense to just use true
524
+ * and handle the rest in your own code, depending on your use case.
525
+ */
526
+ sourceMaps?: boolean | "inline";
527
+ inlineSourcesContent?: boolean;
528
+ }
529
+ /**
530
+ * Configuration ported from babel-preset-env
531
+ */
532
+ interface EnvConfig {
533
+ mode?: "usage" | "entry";
534
+ debug?: boolean;
535
+ dynamicImport?: boolean;
536
+ loose?: boolean;
537
+ /**
538
+ * Transpiles the broken syntax to the closest non-broken modern syntax
539
+ *
540
+ * Defaults to false.
541
+ */
542
+ bugfixes?: boolean;
543
+ skip?: string[];
544
+ include?: string[];
545
+ exclude?: string[];
546
+ /**
547
+ * The version of the used core js.
548
+ *
549
+ */
550
+ coreJs?: string;
551
+ targets?: any;
552
+ path?: string;
553
+ shippedProposals?: boolean;
554
+ /**
555
+ * Enable all transforms
556
+ */
557
+ forceAllTransforms?: boolean;
558
+ }
559
+ interface JscConfig {
560
+ assumptions?: Assumptions;
561
+ loose?: boolean;
562
+ /**
563
+ * Defaults to EsParserConfig
564
+ */
565
+ parser?: ParserConfig;
566
+ transform?: TransformConfig;
567
+ /**
568
+ * Use `@swc/helpers` instead of inline helpers.
569
+ */
570
+ externalHelpers?: boolean;
571
+ /**
572
+ * Defaults to `es3` (which enabled **all** pass).
573
+ */
574
+ target?: JscTarget;
575
+ /**
576
+ * Keep class names.
577
+ */
578
+ keepClassNames?: boolean;
579
+ /**
580
+ * This is experimental, and can be removed without a major version bump.
581
+ */
582
+ experimental?: {
583
+ optimizeHygiene?: boolean;
584
+ /**
585
+ * Preserve `with` in imports and exports.
586
+ *
587
+ * @deprecated Use `keepImportAssertions` instead.
588
+ */
589
+ keepImportAttributes?: boolean;
590
+ /**
591
+ * Use `assert` instead of `with` for imports and exports.
592
+ * This option only works when `keepImportAttributes` is `true`.
593
+ */
594
+ emitAssertForImportAttributes?: boolean;
595
+ /**
596
+ * Specify the location where SWC stores its intermediate cache files.
597
+ * Currently only transform plugin uses this. If not specified, SWC will
598
+ * create `.swc` directories.
599
+ */
600
+ cacheRoot?: string;
601
+ /**
602
+ * List of custom transform plugins written in WebAssembly.
603
+ * First parameter of tuple indicates the name of the plugin - it can be either
604
+ * a name of the npm package can be resolved, or absolute path to .wasm binary.
605
+ *
606
+ * Second parameter of tuple is JSON based configuration for the plugin.
607
+ */
608
+ plugins?: WasmPlugin[];
609
+ /**
610
+ * Run Wasm plugins before stripping TypeScript or decorators.
611
+ *
612
+ * See https://github.com/swc-project/swc/issues/9132 for more details.
613
+ */
614
+ runPluginFirst?: boolean;
615
+ /**
616
+ * Disable builtin transforms. If enabled, only Wasm plugins are used.
617
+ */
618
+ disableBuiltinTransformsForInternalTesting?: boolean;
619
+ /**
620
+ * Emit isolated dts files for each module.
621
+ */
622
+ emitIsolatedDts?: boolean;
623
+ /**
624
+ * Disable all lint rules.
625
+ */
626
+ disableAllLints?: boolean;
627
+ /**
628
+ * Keep import assertions.
629
+ */
630
+ keepImportAssertions?: boolean;
631
+ };
632
+ baseUrl?: string;
633
+ paths?: {
634
+ [from: string]: string[];
635
+ };
636
+ minify?: JsMinifyOptions;
637
+ preserveAllComments?: boolean;
638
+ }
639
+ type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "es2023" | "es2024" | "esnext";
640
+ type ParserConfig = TsParserConfig | EsParserConfig;
641
+ interface TsParserConfig {
642
+ syntax: "typescript";
643
+ /**
644
+ * Defaults to `false`.
645
+ */
646
+ tsx?: boolean;
647
+ /**
648
+ * Defaults to `false`.
649
+ */
650
+ decorators?: boolean;
651
+ /**
652
+ * @deprecated Always true because it's in ecmascript spec.
653
+ */
654
+ dynamicImport?: boolean;
655
+ }
656
+ interface EsParserConfig {
657
+ syntax: "ecmascript";
658
+ /**
659
+ * Defaults to false.
660
+ */
661
+ jsx?: boolean;
662
+ /**
663
+ * @deprecated Always true because it's in ecmascript spec.
664
+ */
665
+ numericSeparator?: boolean;
666
+ /**
667
+ * @deprecated Always true because it's in ecmascript spec.
668
+ */
669
+ classPrivateProperty?: boolean;
670
+ /**
671
+ * @deprecated Always true because it's in ecmascript spec.
672
+ */
673
+ privateMethod?: boolean;
674
+ /**
675
+ * @deprecated Always true because it's in ecmascript spec.
676
+ */
677
+ classProperty?: boolean;
678
+ /**
679
+ * Defaults to `false`
680
+ */
681
+ functionBind?: boolean;
682
+ /**
683
+ * Defaults to `false`
684
+ */
685
+ decorators?: boolean;
686
+ /**
687
+ * Defaults to `false`
688
+ */
689
+ decoratorsBeforeExport?: boolean;
690
+ /**
691
+ * Defaults to `false`
692
+ */
693
+ exportDefaultFrom?: boolean;
694
+ /**
695
+ * @deprecated Always true because it's in ecmascript spec.
696
+ */
697
+ exportNamespaceFrom?: boolean;
698
+ /**
699
+ * @deprecated Always true because it's in ecmascript spec.
700
+ */
701
+ dynamicImport?: boolean;
702
+ /**
703
+ * @deprecated Always true because it's in ecmascript spec.
704
+ */
705
+ nullishCoalescing?: boolean;
706
+ /**
707
+ * @deprecated Always true because it's in ecmascript spec.
708
+ */
709
+ optionalChaining?: boolean;
710
+ /**
711
+ * @deprecated Always true because it's in ecmascript spec.
712
+ */
713
+ importMeta?: boolean;
714
+ /**
715
+ * @deprecated Always true because it's in ecmascript spec.
716
+ */
717
+ topLevelAwait?: boolean;
718
+ /**
719
+ * @deprecated An alias of `importAttributes`
720
+ */
721
+ importAssertions?: boolean;
722
+ /**
723
+ * Defaults to `false`
724
+ */
725
+ importAttributes?: boolean;
726
+ /**
727
+ * Defaults to `false`
728
+ */
729
+ allowSuperOutsideMethod?: boolean;
730
+ /**
731
+ * Defaults to `false`
732
+ */
733
+ allowReturnOutsideFunction?: boolean;
734
+ /**
735
+ * Defaults to `false`
736
+ */
737
+ autoAccessors?: boolean;
738
+ /**
739
+ * Defaults to `false`
740
+ */
741
+ explicitResourceManagement?: boolean;
742
+ }
743
+ /**
744
+ * Options for transform.
745
+ */
746
+ interface TransformConfig {
747
+ /**
748
+ * Effective only if `syntax` supports ƒ.
749
+ */
750
+ react?: ReactConfig;
751
+ constModules?: ConstModulesConfig;
752
+ /**
753
+ * Defaults to null, which skips optimizer pass.
754
+ */
755
+ optimizer?: OptimizerConfig;
756
+ /**
757
+ * https://swc.rs/docs/configuration/compilation#jsctransformlegacydecorator
758
+ */
759
+ legacyDecorator?: boolean;
760
+ /**
761
+ * https://swc.rs/docs/configuration/compilation#jsctransformdecoratormetadata
762
+ */
763
+ decoratorMetadata?: boolean;
764
+ /**
765
+ * https://swc.rs/docs/configuration/compilation#jsctransformdecoratorversion
766
+ */
767
+ decoratorVersion?: "2021-12" | "2022-03";
768
+ treatConstEnumAsEnum?: boolean;
769
+ /**
770
+ * https://www.typescriptlang.org/tsconfig#useDefineForClassFields
771
+ */
772
+ useDefineForClassFields?: boolean;
773
+ /**
774
+ * https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
775
+ */
776
+ verbatimModuleSyntax?: boolean;
777
+ }
778
+ interface ReactConfig {
779
+ /**
780
+ * Replace the function used when compiling JSX expressions.
781
+ *
782
+ * Defaults to `React.createElement`.
783
+ */
784
+ pragma?: string;
785
+ /**
786
+ * Replace the component used when compiling JSX fragments.
787
+ *
788
+ * Defaults to `React.Fragment`
789
+ */
790
+ pragmaFrag?: string;
791
+ /**
792
+ * Toggles whether or not to throw an error if a XML namespaced tag name is used. For example:
793
+ * `<f:image />`
794
+ *
795
+ * Though the JSX spec allows this, it is disabled by default since React's
796
+ * JSX does not currently have support for it.
797
+ *
798
+ */
799
+ throwIfNamespace?: boolean;
800
+ /**
801
+ * Toggles plugins that aid in development, such as @swc/plugin-transform-react-jsx-self
802
+ * and @swc/plugin-transform-react-jsx-source.
803
+ *
804
+ * Defaults to `false`,
805
+ *
806
+ */
807
+ development?: boolean;
808
+ /**
809
+ * Use `Object.assign()` instead of `_extends`. Defaults to false.
810
+ * @deprecated
811
+ */
812
+ useBuiltins?: boolean;
813
+ /**
814
+ * Enable fast refresh feature for React app
815
+ */
816
+ refresh?: boolean | {
817
+ /**
818
+ * Identifier for the `react-refresh` register function.
819
+ *
820
+ * Defaults to `$RefreshReg$`
821
+ */
822
+ refreshReg?: string;
823
+ /**
824
+ * Identifier for the `react-refresh` signature function.
825
+ *
826
+ * Defaults to `$RefreshSig$`
827
+ */
828
+ refreshSig?: string;
829
+ /**
830
+ * Flag to emit full signatures.
831
+ *
832
+ * Defaults to `false`
833
+ */
834
+ emitFullSignatures?: boolean;
835
+ };
836
+ /**
837
+ * jsx runtime
838
+ */
839
+ runtime?: "automatic" | "classic";
840
+ /**
841
+ * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic'
842
+ */
843
+ importSource?: string;
844
+ }
845
+ /**
846
+ * - `import { DEBUG } from '@ember/env-flags';`
847
+ * - `import { FEATURE_A, FEATURE_B } from '@ember/features';`
848
+ *
849
+ * See: https://github.com/swc-project/swc/issues/18#issuecomment-466272558
850
+ */
851
+ interface ConstModulesConfig {
852
+ globals?: {
853
+ [module: string]: {
854
+ [name: string]: string;
855
+ };
856
+ };
857
+ }
858
+ interface OptimizerConfig {
859
+ simplify?: boolean;
860
+ globals?: GlobalPassOption;
861
+ jsonify?: {
862
+ minCost: number;
863
+ };
864
+ }
865
+ /**
866
+ * Options for inline-global pass.
867
+ */
868
+ interface GlobalPassOption {
869
+ /**
870
+ * Global variables that should be inlined with passed value.
871
+ *
872
+ * e.g. `{ __DEBUG__: true }`
873
+ */
874
+ vars?: Record<string, string>;
875
+ /**
876
+ * Names of environment variables that should be inlined with the value of corresponding env during build.
877
+ *
878
+ * Defaults to `["NODE_ENV", "SWC_ENV"]`
879
+ */
880
+ envs?: string[] | Record<string, string>;
881
+ /**
882
+ * Replaces typeof calls for passed variables with corresponding value
883
+ *
884
+ * e.g. `{ window: 'object' }`
885
+ */
886
+ typeofs?: Record<string, string>;
887
+ }
888
+ type ModuleConfig = Es6Config | CommonJsConfig | UmdConfig | AmdConfig | NodeNextConfig | SystemjsConfig;
889
+ interface BaseModuleConfig {
890
+ /**
891
+ * By default, when using exports with babel a non-enumerable `__esModule`
892
+ * property is exported. In some cases this property is used to determine
893
+ * if the import is the default export or if it contains the default export.
894
+ *
895
+ * In order to prevent the __esModule property from being exported, you
896
+ * can set the strict option to true.
897
+ *
898
+ * Defaults to `false`.
899
+ */
900
+ strict?: boolean;
901
+ /**
902
+ * Emits 'use strict' directive.
903
+ *
904
+ * Defaults to `true`.
905
+ */
906
+ strictMode?: boolean;
907
+ /**
908
+ * Changes Babel's compiled import statements to be lazily evaluated when their imported bindings are used for the first time.
909
+ *
910
+ * This can improve initial load time of your module because evaluating dependencies up
911
+ * front is sometimes entirely un-necessary. This is especially the case when implementing
912
+ * a library module.
913
+ *
914
+ *
915
+ * The value of `lazy` has a few possible effects:
916
+ *
917
+ * - `false` - No lazy initialization of any imported module.
918
+ * - `true` - Do not lazy-initialize local `./foo` imports, but lazy-init `foo` dependencies.
919
+ *
920
+ * Local paths are much more likely to have circular dependencies, which may break if loaded lazily,
921
+ * so they are not lazy by default, whereas dependencies between independent modules are rarely cyclical.
922
+ *
923
+ * - `Array<string>` - Lazy-initialize all imports with source matching one of the given strings.
924
+ *
925
+ * -----
926
+ *
927
+ * The two cases where imports can never be lazy are:
928
+ *
929
+ * - `import "foo";`
930
+ *
931
+ * Side-effect imports are automatically non-lazy since their very existence means
932
+ * that there is no binding to later kick off initialization.
933
+ *
934
+ * - `export * from "foo"`
935
+ *
936
+ * Re-exporting all names requires up-front execution because otherwise there is no
937
+ * way to know what names need to be exported.
938
+ *
939
+ * Defaults to `false`.
940
+ */
941
+ lazy?: boolean | string[];
942
+ /**
943
+ * @deprecated Use the `importInterop` option instead.
944
+ *
945
+ * By default, when using exports with swc a non-enumerable __esModule property is exported.
946
+ * This property is then used to determine if the import is the default export or if
947
+ * it contains the default export.
948
+ *
949
+ * In cases where the auto-unwrapping of default is not needed, you can set the noInterop option
950
+ * to true to avoid the usage of the interopRequireDefault helper (shown in inline form above).
951
+ *
952
+ * Defaults to `false`.
953
+ */
954
+ noInterop?: boolean;
955
+ /**
956
+ * Defaults to `swc`.
957
+ *
958
+ * CommonJS modules and ECMAScript modules are not fully compatible.
959
+ * However, compilers, bundlers and JavaScript runtimes developed different strategies
960
+ * to make them work together as well as possible.
961
+ *
962
+ * - `swc` (alias: `babel`)
963
+ *
964
+ * When using exports with `swc` a non-enumerable `__esModule` property is exported
965
+ * This property is then used to determine if the import is the default export
966
+ * or if it contains the default export.
967
+ *
968
+ * ```javascript
969
+ * import foo from "foo";
970
+ * import { bar } from "bar";
971
+ * foo;
972
+ * bar;
973
+ *
974
+ * // Is compiled to ...
975
+ *
976
+ * "use strict";
977
+ *
978
+ * function _interop_require_default(obj) {
979
+ * return obj && obj.__esModule ? obj : { default: obj };
980
+ * }
981
+ *
982
+ * var _foo = _interop_require_default(require("foo"));
983
+ * var _bar = require("bar");
984
+ *
985
+ * _foo.default;
986
+ * _bar.bar;
987
+ * ```
988
+ *
989
+ * When this import interop is used, if both the imported and the importer module are compiled
990
+ * with swc they behave as if none of them was compiled.
991
+ *
992
+ * This is the default behavior.
993
+ *
994
+ * - `node`
995
+ *
996
+ * When importing CommonJS files (either directly written in CommonJS, or generated with a compiler)
997
+ * Node.js always binds the `default` export to the value of `module.exports`.
998
+ *
999
+ * ```javascript
1000
+ * import foo from "foo";
1001
+ * import { bar } from "bar";
1002
+ * foo;
1003
+ * bar;
1004
+ *
1005
+ * // Is compiled to ...
1006
+ *
1007
+ * "use strict";
1008
+ *
1009
+ * var _foo = require("foo");
1010
+ * var _bar = require("bar");
1011
+ *
1012
+ * _foo;
1013
+ * _bar.bar;
1014
+ * ```
1015
+ * This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports`
1016
+ * as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`.
1017
+ * However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`.
1018
+ *
1019
+ * - `none`
1020
+ *
1021
+ * If you know that the imported file has been transformed with a compiler that stores the `default` export on
1022
+ * `exports.default` (such as swc or Babel), you can safely omit the `_interop_require_default` helper.
1023
+ *
1024
+ * ```javascript
1025
+ * import foo from "foo";
1026
+ * import { bar } from "bar";
1027
+ * foo;
1028
+ * bar;
1029
+ *
1030
+ * // Is compiled to ...
1031
+ *
1032
+ * "use strict";
1033
+ *
1034
+ * var _foo = require("foo");
1035
+ * var _bar = require("bar");
1036
+ *
1037
+ * _foo.default;
1038
+ * _bar.bar;
1039
+ * ```
1040
+ */
1041
+ importInterop?: "swc" | "babel" | "node" | "none";
1042
+ /**
1043
+ * Output extension for generated files.
1044
+ *
1045
+ * Defaults to `js`.
1046
+ */
1047
+ outFileExtension?: "js" | "mjs" | "cjs";
1048
+ /**
1049
+ * Emits `cjs-module-lexer` annotation
1050
+ * `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM.
1051
+ * swc will emit `cjs-module-lexer` detectable annotation with this option enabled.
1052
+ *
1053
+ * Defaults to `true` if import_interop is Node, else `false`
1054
+ */
1055
+ exportInteropAnnotation?: boolean;
1056
+ /**
1057
+ * If set to true, dynamic imports will be preserved.
1058
+ */
1059
+ ignoreDynamic?: boolean;
1060
+ allowTopLevelThis?: boolean;
1061
+ preserveImportMeta?: boolean;
1062
+ }
1063
+ interface Es6Config extends BaseModuleConfig {
1064
+ type: "es6";
1065
+ }
1066
+ interface NodeNextConfig extends BaseModuleConfig {
1067
+ type: "nodenext";
1068
+ }
1069
+ interface CommonJsConfig extends BaseModuleConfig {
1070
+ type: "commonjs";
1071
+ }
1072
+ interface UmdConfig extends BaseModuleConfig {
1073
+ type: "umd";
1074
+ globals?: {
1075
+ [key: string]: string;
1076
+ };
1077
+ }
1078
+ interface AmdConfig extends BaseModuleConfig {
1079
+ type: "amd";
1080
+ moduleId?: string;
1081
+ }
1082
+ interface SystemjsConfig {
1083
+ type: "systemjs";
1084
+ allowTopLevelThis?: boolean;
1085
+ }
1086
+ interface Output {
1087
+ /**
1088
+ * Transformed code
1089
+ */
1090
+ code: string;
1091
+ /**
1092
+ * Sourcemap (**not** base64 encoded)
1093
+ */
1094
+ map?: string;
1095
+ }
1096
+ interface MatchPattern {
1097
+ }
1098
+ interface Span {
1099
+ start: number;
1100
+ end: number;
1101
+ ctxt: number;
1102
+ }
1103
+ interface Node {
1104
+ type: string;
1105
+ }
1106
+ interface HasSpan {
1107
+ span: Span;
1108
+ }
1109
+ interface HasDecorator {
1110
+ decorators?: Decorator[];
1111
+ }
1112
+ interface Class extends HasSpan, HasDecorator {
1113
+ body: ClassMember[];
1114
+ superClass?: Expression;
1115
+ isAbstract: boolean;
1116
+ typeParams?: TsTypeParameterDeclaration;
1117
+ superTypeParams?: TsTypeParameterInstantiation;
1118
+ implements: TsExpressionWithTypeArguments[];
1119
+ }
1120
+ type ClassMember = Constructor | ClassMethod | PrivateMethod | ClassProperty | PrivateProperty | TsIndexSignature | EmptyStatement | StaticBlock;
1121
+ interface ClassPropertyBase extends Node, HasSpan, HasDecorator {
1122
+ value?: Expression;
1123
+ typeAnnotation?: TsTypeAnnotation;
1124
+ isStatic: boolean;
1125
+ accessibility?: Accessibility;
1126
+ isOptional: boolean;
1127
+ isOverride: boolean;
1128
+ readonly: boolean;
1129
+ definite: boolean;
1130
+ }
1131
+ interface ClassProperty extends ClassPropertyBase {
1132
+ type: "ClassProperty";
1133
+ key: PropertyName;
1134
+ isAbstract: boolean;
1135
+ declare: boolean;
1136
+ }
1137
+ interface PrivateProperty extends ClassPropertyBase {
1138
+ type: "PrivateProperty";
1139
+ key: PrivateName;
1140
+ }
1141
+ interface Param extends Node, HasSpan, HasDecorator {
1142
+ type: "Parameter";
1143
+ pat: Pattern;
1144
+ }
1145
+ interface Constructor extends Node, HasSpan {
1146
+ type: "Constructor";
1147
+ key: PropertyName;
1148
+ params: (TsParameterProperty | Param)[];
1149
+ body?: BlockStatement;
1150
+ accessibility?: Accessibility;
1151
+ isOptional: boolean;
1152
+ }
1153
+ interface ClassMethodBase extends Node, HasSpan {
1154
+ function: Fn;
1155
+ kind: MethodKind;
1156
+ isStatic: boolean;
1157
+ accessibility?: Accessibility;
1158
+ isAbstract: boolean;
1159
+ isOptional: boolean;
1160
+ isOverride: boolean;
1161
+ }
1162
+ interface ClassMethod extends ClassMethodBase {
1163
+ type: "ClassMethod";
1164
+ key: PropertyName;
1165
+ }
1166
+ interface PrivateMethod extends ClassMethodBase {
1167
+ type: "PrivateMethod";
1168
+ key: PrivateName;
1169
+ }
1170
+ interface StaticBlock extends Node, HasSpan {
1171
+ type: "StaticBlock";
1172
+ body: BlockStatement;
1173
+ }
1174
+ interface Decorator extends Node, HasSpan {
1175
+ type: "Decorator";
1176
+ expression: Expression;
1177
+ }
1178
+ type MethodKind = "method" | "getter" | "setter";
1179
+ type Declaration = ClassDeclaration | FunctionDeclaration | VariableDeclaration | TsInterfaceDeclaration | TsTypeAliasDeclaration | TsEnumDeclaration | TsModuleDeclaration;
1180
+ interface FunctionDeclaration extends Fn {
1181
+ type: "FunctionDeclaration";
1182
+ identifier: Identifier;
1183
+ declare: boolean;
1184
+ }
1185
+ interface ClassDeclaration extends Class, Node {
1186
+ type: "ClassDeclaration";
1187
+ identifier: Identifier;
1188
+ declare: boolean;
1189
+ }
1190
+ interface VariableDeclaration extends Node, HasSpan {
1191
+ type: "VariableDeclaration";
1192
+ kind: VariableDeclarationKind;
1193
+ declare: boolean;
1194
+ declarations: VariableDeclarator[];
1195
+ }
1196
+ type VariableDeclarationKind = "var" | "let" | "const";
1197
+ interface VariableDeclarator extends Node, HasSpan {
1198
+ type: "VariableDeclarator";
1199
+ id: Pattern;
1200
+ init?: Expression;
1201
+ definite: boolean;
1202
+ }
1203
+ type Expression = ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | MemberExpression | SuperPropExpression | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Identifier | Literal | TemplateLiteral | TaggedTemplateExpression | ArrowFunctionExpression | ClassExpression | YieldExpression | MetaProperty | AwaitExpression | ParenthesisExpression | JSXMemberExpression | JSXNamespacedName | JSXEmptyExpression | JSXElement | JSXFragment | TsTypeAssertion | TsConstAssertion | TsNonNullExpression | TsAsExpression | TsSatisfiesExpression | TsInstantiation | PrivateName | OptionalChainingExpression | Invalid;
1204
+ interface ExpressionBase extends Node, HasSpan {
1205
+ }
1206
+ interface Identifier extends ExpressionBase {
1207
+ type: "Identifier";
1208
+ value: string;
1209
+ optional: boolean;
1210
+ }
1211
+ interface OptionalChainingExpression extends ExpressionBase {
1212
+ type: "OptionalChainingExpression";
1213
+ questionDotToken: Span;
1214
+ /**
1215
+ * Call expression or member expression.
1216
+ */
1217
+ base: MemberExpression | OptionalChainingCall;
1218
+ }
1219
+ interface OptionalChainingCall extends ExpressionBase {
1220
+ type: "CallExpression";
1221
+ callee: Expression;
1222
+ arguments: ExprOrSpread[];
1223
+ typeArguments?: TsTypeParameterInstantiation;
1224
+ }
1225
+ interface ThisExpression extends ExpressionBase {
1226
+ type: "ThisExpression";
1227
+ }
1228
+ interface ArrayExpression extends ExpressionBase {
1229
+ type: "ArrayExpression";
1230
+ elements: (ExprOrSpread | undefined)[];
1231
+ }
1232
+ interface ExprOrSpread {
1233
+ spread?: Span;
1234
+ expression: Expression;
1235
+ }
1236
+ interface ObjectExpression extends ExpressionBase {
1237
+ type: "ObjectExpression";
1238
+ properties: (SpreadElement | Property)[];
1239
+ }
1240
+ interface Argument {
1241
+ spread?: Span;
1242
+ expression: Expression;
1243
+ }
1244
+ interface SpreadElement extends Node {
1245
+ type: "SpreadElement";
1246
+ spread: Span;
1247
+ arguments: Expression;
1248
+ }
1249
+ interface UnaryExpression extends ExpressionBase {
1250
+ type: "UnaryExpression";
1251
+ operator: UnaryOperator;
1252
+ argument: Expression;
1253
+ }
1254
+ interface UpdateExpression extends ExpressionBase {
1255
+ type: "UpdateExpression";
1256
+ operator: UpdateOperator;
1257
+ prefix: boolean;
1258
+ argument: Expression;
1259
+ }
1260
+ interface BinaryExpression extends ExpressionBase {
1261
+ type: "BinaryExpression";
1262
+ operator: BinaryOperator;
1263
+ left: Expression;
1264
+ right: Expression;
1265
+ }
1266
+ interface FunctionExpression extends Fn, ExpressionBase {
1267
+ type: "FunctionExpression";
1268
+ identifier?: Identifier;
1269
+ }
1270
+ interface ClassExpression extends Class, ExpressionBase {
1271
+ type: "ClassExpression";
1272
+ identifier?: Identifier;
1273
+ }
1274
+ interface AssignmentExpression extends ExpressionBase {
1275
+ type: "AssignmentExpression";
1276
+ operator: AssignmentOperator;
1277
+ left: Expression | Pattern;
1278
+ right: Expression;
1279
+ }
1280
+ interface MemberExpression extends ExpressionBase {
1281
+ type: "MemberExpression";
1282
+ object: Expression;
1283
+ property: Identifier | PrivateName | ComputedPropName;
1284
+ }
1285
+ interface SuperPropExpression extends ExpressionBase {
1286
+ type: "SuperPropExpression";
1287
+ obj: Super;
1288
+ property: Identifier | ComputedPropName;
1289
+ }
1290
+ interface ConditionalExpression extends ExpressionBase {
1291
+ type: "ConditionalExpression";
1292
+ test: Expression;
1293
+ consequent: Expression;
1294
+ alternate: Expression;
1295
+ }
1296
+ interface Super extends Node, HasSpan {
1297
+ type: "Super";
1298
+ }
1299
+ interface Import extends Node, HasSpan {
1300
+ type: "Import";
1301
+ }
1302
+ interface CallExpression extends ExpressionBase {
1303
+ type: "CallExpression";
1304
+ callee: Super | Import | Expression;
1305
+ arguments: Argument[];
1306
+ typeArguments?: TsTypeParameterInstantiation;
1307
+ }
1308
+ interface NewExpression extends ExpressionBase {
1309
+ type: "NewExpression";
1310
+ callee: Expression;
1311
+ arguments?: Argument[];
1312
+ typeArguments?: TsTypeParameterInstantiation;
1313
+ }
1314
+ interface SequenceExpression extends ExpressionBase {
1315
+ type: "SequenceExpression";
1316
+ expressions: Expression[];
1317
+ }
1318
+ interface ArrowFunctionExpression extends ExpressionBase {
1319
+ type: "ArrowFunctionExpression";
1320
+ params: Pattern[];
1321
+ body: BlockStatement | Expression;
1322
+ async: boolean;
1323
+ generator: boolean;
1324
+ typeParameters?: TsTypeParameterDeclaration;
1325
+ returnType?: TsTypeAnnotation;
1326
+ }
1327
+ interface YieldExpression extends ExpressionBase {
1328
+ type: "YieldExpression";
1329
+ argument?: Expression;
1330
+ delegate: boolean;
1331
+ }
1332
+ interface MetaProperty extends Node, HasSpan {
1333
+ type: "MetaProperty";
1334
+ kind: "new.target" | "import.meta";
1335
+ }
1336
+ interface AwaitExpression extends ExpressionBase {
1337
+ type: "AwaitExpression";
1338
+ argument: Expression;
1339
+ }
1340
+ interface TemplateLiteral extends ExpressionBase {
1341
+ type: "TemplateLiteral";
1342
+ expressions: Expression[];
1343
+ quasis: TemplateElement[];
1344
+ }
1345
+ interface TaggedTemplateExpression extends ExpressionBase {
1346
+ type: "TaggedTemplateExpression";
1347
+ tag: Expression;
1348
+ typeParameters?: TsTypeParameterInstantiation;
1349
+ template: TemplateLiteral;
1350
+ }
1351
+ interface TemplateElement extends ExpressionBase {
1352
+ type: "TemplateElement";
1353
+ tail: boolean;
1354
+ cooked?: string;
1355
+ raw: string;
1356
+ }
1357
+ interface ParenthesisExpression extends ExpressionBase {
1358
+ type: "ParenthesisExpression";
1359
+ expression: Expression;
1360
+ }
1361
+ interface Fn extends HasSpan, HasDecorator {
1362
+ params: Param[];
1363
+ body?: BlockStatement;
1364
+ generator: boolean;
1365
+ async: boolean;
1366
+ typeParameters?: TsTypeParameterDeclaration;
1367
+ returnType?: TsTypeAnnotation;
1368
+ }
1369
+ interface PatternBase extends Node, HasSpan {
1370
+ typeAnnotation?: TsTypeAnnotation;
1371
+ }
1372
+ interface PrivateName extends ExpressionBase {
1373
+ type: "PrivateName";
1374
+ id: Identifier;
1375
+ }
1376
+ type JSXObject = JSXMemberExpression | Identifier;
1377
+ interface JSXMemberExpression extends Node {
1378
+ type: "JSXMemberExpression";
1379
+ object: JSXObject;
1380
+ property: Identifier;
1381
+ }
1382
+ /**
1383
+ * XML-based namespace syntax:
1384
+ */
1385
+ interface JSXNamespacedName extends Node {
1386
+ type: "JSXNamespacedName";
1387
+ namespace: Identifier;
1388
+ name: Identifier;
1389
+ }
1390
+ interface JSXEmptyExpression extends Node, HasSpan {
1391
+ type: "JSXEmptyExpression";
1392
+ }
1393
+ interface JSXExpressionContainer extends Node, HasSpan {
1394
+ type: "JSXExpressionContainer";
1395
+ expression: JSXExpression;
1396
+ }
1397
+ type JSXExpression = JSXEmptyExpression | Expression;
1398
+ interface JSXSpreadChild extends Node, HasSpan {
1399
+ type: "JSXSpreadChild";
1400
+ expression: Expression;
1401
+ }
1402
+ type JSXElementName = Identifier | JSXMemberExpression | JSXNamespacedName;
1403
+ interface JSXOpeningElement extends Node, HasSpan {
1404
+ type: "JSXOpeningElement";
1405
+ name: JSXElementName;
1406
+ attributes: JSXAttributeOrSpread[];
1407
+ selfClosing: boolean;
1408
+ typeArguments?: TsTypeParameterInstantiation;
1409
+ }
1410
+ type JSXAttributeOrSpread = JSXAttribute | SpreadElement;
1411
+ interface JSXClosingElement extends Node, HasSpan {
1412
+ type: "JSXClosingElement";
1413
+ name: JSXElementName;
1414
+ }
1415
+ interface JSXAttribute extends Node, HasSpan {
1416
+ type: "JSXAttribute";
1417
+ name: JSXAttributeName;
1418
+ value?: JSXAttrValue;
1419
+ }
1420
+ type JSXAttributeName = Identifier | JSXNamespacedName;
1421
+ type JSXAttrValue = Literal | JSXExpressionContainer | JSXElement | JSXFragment;
1422
+ interface JSXText extends Node, HasSpan {
1423
+ type: "JSXText";
1424
+ value: string;
1425
+ raw: string;
1426
+ }
1427
+ interface JSXElement extends Node, HasSpan {
1428
+ type: "JSXElement";
1429
+ opening: JSXOpeningElement;
1430
+ children: JSXElementChild[];
1431
+ closing?: JSXClosingElement;
1432
+ }
1433
+ type JSXElementChild = JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment;
1434
+ interface JSXFragment extends Node, HasSpan {
1435
+ type: "JSXFragment";
1436
+ opening: JSXOpeningFragment;
1437
+ children: JSXElementChild[];
1438
+ closing: JSXClosingFragment;
1439
+ }
1440
+ interface JSXOpeningFragment extends Node, HasSpan {
1441
+ type: "JSXOpeningFragment";
1442
+ }
1443
+ interface JSXClosingFragment extends Node, HasSpan {
1444
+ type: "JSXClosingFragment";
1445
+ }
1446
+ type Literal = StringLiteral | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | JSXText;
1447
+ interface StringLiteral extends Node, HasSpan {
1448
+ type: "StringLiteral";
1449
+ value: string;
1450
+ raw?: string;
1451
+ }
1452
+ interface BooleanLiteral extends Node, HasSpan {
1453
+ type: "BooleanLiteral";
1454
+ value: boolean;
1455
+ }
1456
+ interface NullLiteral extends Node, HasSpan {
1457
+ type: "NullLiteral";
1458
+ }
1459
+ interface RegExpLiteral extends Node, HasSpan {
1460
+ type: "RegExpLiteral";
1461
+ pattern: string;
1462
+ flags: string;
1463
+ }
1464
+ interface NumericLiteral extends Node, HasSpan {
1465
+ type: "NumericLiteral";
1466
+ value: number;
1467
+ raw?: string;
1468
+ }
1469
+ interface BigIntLiteral extends Node, HasSpan {
1470
+ type: "BigIntLiteral";
1471
+ value: bigint;
1472
+ raw?: string;
1473
+ }
1474
+ type ModuleDeclaration = ImportDeclaration | ExportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportDefaultExpression | ExportAllDeclaration | TsImportEqualsDeclaration | TsExportAssignment | TsNamespaceExportDeclaration;
1475
+ interface ExportDefaultExpression extends Node, HasSpan {
1476
+ type: "ExportDefaultExpression";
1477
+ expression: Expression;
1478
+ }
1479
+ interface ExportDeclaration extends Node, HasSpan {
1480
+ type: "ExportDeclaration";
1481
+ declaration: Declaration;
1482
+ }
1483
+ interface ImportDeclaration extends Node, HasSpan {
1484
+ type: "ImportDeclaration";
1485
+ specifiers: ImportSpecifier[];
1486
+ source: StringLiteral;
1487
+ typeOnly: boolean;
1488
+ asserts?: ObjectExpression;
1489
+ }
1490
+ interface ExportAllDeclaration extends Node, HasSpan {
1491
+ type: "ExportAllDeclaration";
1492
+ source: StringLiteral;
1493
+ asserts?: ObjectExpression;
1494
+ }
1495
+ /**
1496
+ * - `export { foo } from 'mod'`
1497
+ * - `export { foo as bar } from 'mod'`
1498
+ */
1499
+ interface ExportNamedDeclaration extends Node, HasSpan {
1500
+ type: "ExportNamedDeclaration";
1501
+ specifiers: ExportSpecifier[];
1502
+ source?: StringLiteral;
1503
+ typeOnly: boolean;
1504
+ asserts?: ObjectExpression;
1505
+ }
1506
+ interface ExportDefaultDeclaration extends Node, HasSpan {
1507
+ type: "ExportDefaultDeclaration";
1508
+ decl: DefaultDecl;
1509
+ }
1510
+ type DefaultDecl = ClassExpression | FunctionExpression | TsInterfaceDeclaration;
1511
+ type ImportSpecifier = NamedImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
1512
+ /**
1513
+ * e.g. `import foo from 'mod.js'`
1514
+ */
1515
+ interface ImportDefaultSpecifier extends Node, HasSpan {
1516
+ type: "ImportDefaultSpecifier";
1517
+ local: Identifier;
1518
+ }
1519
+ /**
1520
+ * e.g. `import * as foo from 'mod.js'`.
1521
+ */
1522
+ interface ImportNamespaceSpecifier extends Node, HasSpan {
1523
+ type: "ImportNamespaceSpecifier";
1524
+ local: Identifier;
1525
+ }
1526
+ /**
1527
+ * e.g. - `import { foo } from 'mod.js'`
1528
+ *
1529
+ * local = foo, imported = None
1530
+ *
1531
+ * e.g. `import { foo as bar } from 'mod.js'`
1532
+ *
1533
+ * local = bar, imported = Some(foo) for
1534
+ */
1535
+ interface NamedImportSpecifier extends Node, HasSpan {
1536
+ type: "ImportSpecifier";
1537
+ local: Identifier;
1538
+ imported?: ModuleExportName;
1539
+ isTypeOnly: boolean;
1540
+ }
1541
+ type ModuleExportName = Identifier | StringLiteral;
1542
+ type ExportSpecifier = ExportNamespaceSpecifier | ExportDefaultSpecifier | NamedExportSpecifier;
1543
+ /**
1544
+ * `export * as foo from 'src';`
1545
+ */
1546
+ interface ExportNamespaceSpecifier extends Node, HasSpan {
1547
+ type: "ExportNamespaceSpecifier";
1548
+ name: ModuleExportName;
1549
+ }
1550
+ interface ExportDefaultSpecifier extends Node, HasSpan {
1551
+ type: "ExportDefaultSpecifier";
1552
+ exported: Identifier;
1553
+ }
1554
+ interface NamedExportSpecifier extends Node, HasSpan {
1555
+ type: "ExportSpecifier";
1556
+ orig: ModuleExportName;
1557
+ /**
1558
+ * `Some(bar)` in `export { foo as bar }`
1559
+ */
1560
+ exported?: ModuleExportName;
1561
+ isTypeOnly: boolean;
1562
+ }
1563
+ interface HasInterpreter {
1564
+ /**
1565
+ * e.g. `/usr/bin/node` for `#!/usr/bin/node`
1566
+ */
1567
+ interpreter: string;
1568
+ }
1569
+ type Program = Module | Script;
1570
+ interface Module extends Node, HasSpan, HasInterpreter {
1571
+ type: "Module";
1572
+ body: ModuleItem[];
1573
+ }
1574
+ interface Script extends Node, HasSpan, HasInterpreter {
1575
+ type: "Script";
1576
+ body: Statement[];
1577
+ }
1578
+ type ModuleItem = ModuleDeclaration | Statement;
1579
+ type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "||" | "&&" | "in" | "instanceof" | "**" | "??";
1580
+ type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "&&=" | "||=" | "??=";
1581
+ type UpdateOperator = "++" | "--";
1582
+ type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
1583
+ type Pattern = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern | AssignmentPattern | Invalid | Expression;
1584
+ interface BindingIdentifier extends PatternBase {
1585
+ type: "Identifier";
1586
+ value: string;
1587
+ optional: boolean;
1588
+ }
1589
+ interface ArrayPattern extends PatternBase {
1590
+ type: "ArrayPattern";
1591
+ elements: (Pattern | undefined)[];
1592
+ optional: boolean;
1593
+ }
1594
+ interface ObjectPattern extends PatternBase {
1595
+ type: "ObjectPattern";
1596
+ properties: ObjectPatternProperty[];
1597
+ optional: boolean;
1598
+ }
1599
+ interface AssignmentPattern extends PatternBase {
1600
+ type: "AssignmentPattern";
1601
+ left: Pattern;
1602
+ right: Expression;
1603
+ }
1604
+ interface RestElement extends PatternBase {
1605
+ type: "RestElement";
1606
+ rest: Span;
1607
+ argument: Pattern;
1608
+ }
1609
+ type ObjectPatternProperty = KeyValuePatternProperty | AssignmentPatternProperty | RestElement;
1610
+ /**
1611
+ * `{key: value}`
1612
+ */
1613
+ interface KeyValuePatternProperty extends Node {
1614
+ type: "KeyValuePatternProperty";
1615
+ key: PropertyName;
1616
+ value: Pattern;
1617
+ }
1618
+ /**
1619
+ * `{key}` or `{key = value}`
1620
+ */
1621
+ interface AssignmentPatternProperty extends Node, HasSpan {
1622
+ type: "AssignmentPatternProperty";
1623
+ key: Identifier;
1624
+ value?: Expression;
1625
+ }
1626
+ /** Identifier is `a` in `{ a, }` */
1627
+ type Property = Identifier | KeyValueProperty | AssignmentProperty | GetterProperty | SetterProperty | MethodProperty;
1628
+ interface PropBase extends Node {
1629
+ key: PropertyName;
1630
+ }
1631
+ interface KeyValueProperty extends PropBase {
1632
+ type: "KeyValueProperty";
1633
+ value: Expression;
1634
+ }
1635
+ interface AssignmentProperty extends Node {
1636
+ type: "AssignmentProperty";
1637
+ key: Identifier;
1638
+ value: Expression;
1639
+ }
1640
+ interface GetterProperty extends PropBase, HasSpan {
1641
+ type: "GetterProperty";
1642
+ typeAnnotation?: TsTypeAnnotation;
1643
+ body?: BlockStatement;
1644
+ }
1645
+ interface SetterProperty extends PropBase, HasSpan {
1646
+ type: "SetterProperty";
1647
+ param: Pattern;
1648
+ body?: BlockStatement;
1649
+ }
1650
+ interface MethodProperty extends PropBase, Fn {
1651
+ type: "MethodProperty";
1652
+ }
1653
+ type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropName | BigIntLiteral;
1654
+ interface ComputedPropName extends Node, HasSpan {
1655
+ type: "Computed";
1656
+ expression: Expression;
1657
+ }
1658
+ interface BlockStatement extends Node, HasSpan {
1659
+ type: "BlockStatement";
1660
+ stmts: Statement[];
1661
+ }
1662
+ interface ExpressionStatement extends Node, HasSpan {
1663
+ type: "ExpressionStatement";
1664
+ expression: Expression;
1665
+ }
1666
+ type Statement = BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration | ExpressionStatement;
1667
+ interface EmptyStatement extends Node, HasSpan {
1668
+ type: "EmptyStatement";
1669
+ }
1670
+ interface DebuggerStatement extends Node, HasSpan {
1671
+ type: "DebuggerStatement";
1672
+ }
1673
+ interface WithStatement extends Node, HasSpan {
1674
+ type: "WithStatement";
1675
+ object: Expression;
1676
+ body: Statement;
1677
+ }
1678
+ interface ReturnStatement extends Node, HasSpan {
1679
+ type: "ReturnStatement";
1680
+ argument?: Expression;
1681
+ }
1682
+ interface LabeledStatement extends Node, HasSpan {
1683
+ type: "LabeledStatement";
1684
+ label: Identifier;
1685
+ body: Statement;
1686
+ }
1687
+ interface BreakStatement extends Node, HasSpan {
1688
+ type: "BreakStatement";
1689
+ label?: Identifier;
1690
+ }
1691
+ interface ContinueStatement extends Node, HasSpan {
1692
+ type: "ContinueStatement";
1693
+ label?: Identifier;
1694
+ }
1695
+ interface IfStatement extends Node, HasSpan {
1696
+ type: "IfStatement";
1697
+ test: Expression;
1698
+ consequent: Statement;
1699
+ alternate?: Statement;
1700
+ }
1701
+ interface SwitchStatement extends Node, HasSpan {
1702
+ type: "SwitchStatement";
1703
+ discriminant: Expression;
1704
+ cases: SwitchCase[];
1705
+ }
1706
+ interface ThrowStatement extends Node, HasSpan {
1707
+ type: "ThrowStatement";
1708
+ argument: Expression;
1709
+ }
1710
+ interface TryStatement extends Node, HasSpan {
1711
+ type: "TryStatement";
1712
+ block: BlockStatement;
1713
+ handler?: CatchClause;
1714
+ finalizer?: BlockStatement;
1715
+ }
1716
+ interface WhileStatement extends Node, HasSpan {
1717
+ type: "WhileStatement";
1718
+ test: Expression;
1719
+ body: Statement;
1720
+ }
1721
+ interface DoWhileStatement extends Node, HasSpan {
1722
+ type: "DoWhileStatement";
1723
+ test: Expression;
1724
+ body: Statement;
1725
+ }
1726
+ interface ForStatement extends Node, HasSpan {
1727
+ type: "ForStatement";
1728
+ init?: VariableDeclaration | Expression;
1729
+ test?: Expression;
1730
+ update?: Expression;
1731
+ body: Statement;
1732
+ }
1733
+ interface ForInStatement extends Node, HasSpan {
1734
+ type: "ForInStatement";
1735
+ left: VariableDeclaration | Pattern;
1736
+ right: Expression;
1737
+ body: Statement;
1738
+ }
1739
+ interface ForOfStatement extends Node, HasSpan {
1740
+ type: "ForOfStatement";
1741
+ /**
1742
+ * Span of the await token.
1743
+ *
1744
+ * es2018 for-await-of statements, e.g., `for await (const x of xs) {`
1745
+ */
1746
+ await?: Span;
1747
+ left: VariableDeclaration | Pattern;
1748
+ right: Expression;
1749
+ body: Statement;
1750
+ }
1751
+ interface SwitchCase extends Node, HasSpan {
1752
+ type: "SwitchCase";
1753
+ /**
1754
+ * Undefined for default case
1755
+ */
1756
+ test?: Expression;
1757
+ consequent: Statement[];
1758
+ }
1759
+ interface CatchClause extends Node, HasSpan {
1760
+ type: "CatchClause";
1761
+ /**
1762
+ * The param is `undefined` if the catch binding is omitted. E.g., `try { foo() } catch {}`
1763
+ */
1764
+ param?: Pattern;
1765
+ body: BlockStatement;
1766
+ }
1767
+ interface TsTypeAnnotation extends Node, HasSpan {
1768
+ type: "TsTypeAnnotation";
1769
+ typeAnnotation: TsType;
1770
+ }
1771
+ interface TsTypeParameterDeclaration extends Node, HasSpan {
1772
+ type: "TsTypeParameterDeclaration";
1773
+ parameters: TsTypeParameter[];
1774
+ }
1775
+ interface TsTypeParameter extends Node, HasSpan {
1776
+ type: "TsTypeParameter";
1777
+ name: Identifier;
1778
+ in: boolean;
1779
+ out: boolean;
1780
+ constraint?: TsType;
1781
+ default?: TsType;
1782
+ }
1783
+ interface TsTypeParameterInstantiation extends Node, HasSpan {
1784
+ type: "TsTypeParameterInstantiation";
1785
+ params: TsType[];
1786
+ }
1787
+ interface TsParameterProperty extends Node, HasSpan, HasDecorator {
1788
+ type: "TsParameterProperty";
1789
+ accessibility?: Accessibility;
1790
+ override: boolean;
1791
+ readonly: boolean;
1792
+ param: TsParameterPropertyParameter;
1793
+ }
1794
+ type TsParameterPropertyParameter = BindingIdentifier | AssignmentPattern;
1795
+ interface TsQualifiedName extends Node {
1796
+ type: "TsQualifiedName";
1797
+ left: TsEntityName;
1798
+ right: Identifier;
1799
+ }
1800
+ type TsEntityName = TsQualifiedName | Identifier;
1801
+ type TsTypeElement = TsCallSignatureDeclaration | TsConstructSignatureDeclaration | TsPropertySignature | TsGetterSignature | TsSetterSignature | TsMethodSignature | TsIndexSignature;
1802
+ interface TsCallSignatureDeclaration extends Node, HasSpan {
1803
+ type: "TsCallSignatureDeclaration";
1804
+ params: TsFnParameter[];
1805
+ typeAnnotation?: TsTypeAnnotation;
1806
+ typeParams?: TsTypeParameterDeclaration;
1807
+ }
1808
+ interface TsConstructSignatureDeclaration extends Node, HasSpan {
1809
+ type: "TsConstructSignatureDeclaration";
1810
+ params: TsFnParameter[];
1811
+ typeAnnotation?: TsTypeAnnotation;
1812
+ typeParams?: TsTypeParameterDeclaration;
1813
+ }
1814
+ interface TsPropertySignature extends Node, HasSpan {
1815
+ type: "TsPropertySignature";
1816
+ readonly: boolean;
1817
+ key: Expression;
1818
+ computed: boolean;
1819
+ optional: boolean;
1820
+ typeAnnotation?: TsTypeAnnotation;
1821
+ }
1822
+ interface TsGetterSignature extends Node, HasSpan {
1823
+ type: "TsGetterSignature";
1824
+ readonly: boolean;
1825
+ key: Expression;
1826
+ computed: boolean;
1827
+ optional: boolean;
1828
+ typeAnnotation?: TsTypeAnnotation;
1829
+ }
1830
+ interface TsSetterSignature extends Node, HasSpan {
1831
+ type: "TsSetterSignature";
1832
+ readonly: boolean;
1833
+ key: Expression;
1834
+ computed: boolean;
1835
+ optional: boolean;
1836
+ param: TsFnParameter;
1837
+ }
1838
+ interface TsMethodSignature extends Node, HasSpan {
1839
+ type: "TsMethodSignature";
1840
+ readonly: boolean;
1841
+ key: Expression;
1842
+ computed: boolean;
1843
+ optional: boolean;
1844
+ params: TsFnParameter[];
1845
+ typeAnn?: TsTypeAnnotation;
1846
+ typeParams?: TsTypeParameterDeclaration;
1847
+ }
1848
+ interface TsIndexSignature extends Node, HasSpan {
1849
+ type: "TsIndexSignature";
1850
+ params: TsFnParameter[];
1851
+ typeAnnotation?: TsTypeAnnotation;
1852
+ readonly: boolean;
1853
+ static: boolean;
1854
+ }
1855
+ type TsType = TsKeywordType | TsThisType | TsFnOrConstructorType | TsTypeReference | TsTypeQuery | TsTypeLiteral | TsArrayType | TsTupleType | TsOptionalType | TsRestType | TsUnionOrIntersectionType | TsConditionalType | TsInferType | TsParenthesizedType | TsTypeOperator | TsIndexedAccessType | TsMappedType | TsLiteralType | TsTypePredicate | TsImportType;
1856
+ type TsFnOrConstructorType = TsFunctionType | TsConstructorType;
1857
+ interface TsKeywordType extends Node, HasSpan {
1858
+ type: "TsKeywordType";
1859
+ kind: TsKeywordTypeKind;
1860
+ }
1861
+ type TsKeywordTypeKind = "any" | "unknown" | "number" | "object" | "boolean" | "bigint" | "string" | "symbol" | "void" | "undefined" | "null" | "never" | "intrinsic";
1862
+ interface TsThisType extends Node, HasSpan {
1863
+ type: "TsThisType";
1864
+ }
1865
+ type TsFnParameter = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern;
1866
+ interface TsFunctionType extends Node, HasSpan {
1867
+ type: "TsFunctionType";
1868
+ params: TsFnParameter[];
1869
+ typeParams?: TsTypeParameterDeclaration;
1870
+ typeAnnotation: TsTypeAnnotation;
1871
+ }
1872
+ interface TsConstructorType extends Node, HasSpan {
1873
+ type: "TsConstructorType";
1874
+ params: TsFnParameter[];
1875
+ typeParams?: TsTypeParameterDeclaration;
1876
+ typeAnnotation: TsTypeAnnotation;
1877
+ isAbstract: boolean;
1878
+ }
1879
+ interface TsTypeReference extends Node, HasSpan {
1880
+ type: "TsTypeReference";
1881
+ typeName: TsEntityName;
1882
+ typeParams?: TsTypeParameterInstantiation;
1883
+ }
1884
+ interface TsTypePredicate extends Node, HasSpan {
1885
+ type: "TsTypePredicate";
1886
+ asserts: boolean;
1887
+ paramName: TsThisTypeOrIdent;
1888
+ typeAnnotation?: TsTypeAnnotation;
1889
+ }
1890
+ type TsThisTypeOrIdent = TsThisType | Identifier;
1891
+ interface TsImportType extends Node, HasSpan {
1892
+ type: "TsImportType";
1893
+ argument: StringLiteral;
1894
+ qualifier?: TsEntityName;
1895
+ typeArguments?: TsTypeParameterInstantiation;
1896
+ }
1897
+ /**
1898
+ * `typeof` operator
1899
+ */
1900
+ interface TsTypeQuery extends Node, HasSpan {
1901
+ type: "TsTypeQuery";
1902
+ exprName: TsTypeQueryExpr;
1903
+ typeArguments?: TsTypeParameterInstantiation;
1904
+ }
1905
+ type TsTypeQueryExpr = TsEntityName | TsImportType;
1906
+ interface TsTypeLiteral extends Node, HasSpan {
1907
+ type: "TsTypeLiteral";
1908
+ members: TsTypeElement[];
1909
+ }
1910
+ interface TsArrayType extends Node, HasSpan {
1911
+ type: "TsArrayType";
1912
+ elemType: TsType;
1913
+ }
1914
+ interface TsTupleType extends Node, HasSpan {
1915
+ type: "TsTupleType";
1916
+ elemTypes: TsTupleElement[];
1917
+ }
1918
+ interface TsTupleElement extends Node, HasSpan {
1919
+ type: "TsTupleElement";
1920
+ label?: Pattern;
1921
+ ty: TsType;
1922
+ }
1923
+ interface TsOptionalType extends Node, HasSpan {
1924
+ type: "TsOptionalType";
1925
+ typeAnnotation: TsType;
1926
+ }
1927
+ interface TsRestType extends Node, HasSpan {
1928
+ type: "TsRestType";
1929
+ typeAnnotation: TsType;
1930
+ }
1931
+ type TsUnionOrIntersectionType = TsUnionType | TsIntersectionType;
1932
+ interface TsUnionType extends Node, HasSpan {
1933
+ type: "TsUnionType";
1934
+ types: TsType[];
1935
+ }
1936
+ interface TsIntersectionType extends Node, HasSpan {
1937
+ type: "TsIntersectionType";
1938
+ types: TsType[];
1939
+ }
1940
+ interface TsConditionalType extends Node, HasSpan {
1941
+ type: "TsConditionalType";
1942
+ checkType: TsType;
1943
+ extendsType: TsType;
1944
+ trueType: TsType;
1945
+ falseType: TsType;
1946
+ }
1947
+ interface TsInferType extends Node, HasSpan {
1948
+ type: "TsInferType";
1949
+ typeParam: TsTypeParameter;
1950
+ }
1951
+ interface TsParenthesizedType extends Node, HasSpan {
1952
+ type: "TsParenthesizedType";
1953
+ typeAnnotation: TsType;
1954
+ }
1955
+ interface TsTypeOperator extends Node, HasSpan {
1956
+ type: "TsTypeOperator";
1957
+ op: TsTypeOperatorOp;
1958
+ typeAnnotation: TsType;
1959
+ }
1960
+ type TsTypeOperatorOp = "keyof" | "unique" | "readonly";
1961
+ interface TsIndexedAccessType extends Node, HasSpan {
1962
+ type: "TsIndexedAccessType";
1963
+ readonly: boolean;
1964
+ objectType: TsType;
1965
+ indexType: TsType;
1966
+ }
1967
+ type TruePlusMinus = true | "+" | "-";
1968
+ interface TsMappedType extends Node, HasSpan {
1969
+ type: "TsMappedType";
1970
+ readonly?: TruePlusMinus;
1971
+ typeParam: TsTypeParameter;
1972
+ nameType?: TsType;
1973
+ optional?: TruePlusMinus;
1974
+ typeAnnotation?: TsType;
1975
+ }
1976
+ interface TsLiteralType extends Node, HasSpan {
1977
+ type: "TsLiteralType";
1978
+ literal: TsLiteral;
1979
+ }
1980
+ type TsLiteral = NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TsTemplateLiteralType;
1981
+ interface TsTemplateLiteralType extends Node, HasSpan {
1982
+ type: "TemplateLiteral";
1983
+ types: TsType[];
1984
+ quasis: TemplateElement[];
1985
+ }
1986
+ interface TsInterfaceDeclaration extends Node, HasSpan {
1987
+ type: "TsInterfaceDeclaration";
1988
+ id: Identifier;
1989
+ declare: boolean;
1990
+ typeParams?: TsTypeParameterDeclaration;
1991
+ extends: TsExpressionWithTypeArguments[];
1992
+ body: TsInterfaceBody;
1993
+ }
1994
+ interface TsInterfaceBody extends Node, HasSpan {
1995
+ type: "TsInterfaceBody";
1996
+ body: TsTypeElement[];
1997
+ }
1998
+ interface TsExpressionWithTypeArguments extends Node, HasSpan {
1999
+ type: "TsExpressionWithTypeArguments";
2000
+ expression: Expression;
2001
+ typeArguments?: TsTypeParameterInstantiation;
2002
+ }
2003
+ interface TsTypeAliasDeclaration extends Node, HasSpan {
2004
+ type: "TsTypeAliasDeclaration";
2005
+ declare: boolean;
2006
+ id: Identifier;
2007
+ typeParams?: TsTypeParameterDeclaration;
2008
+ typeAnnotation: TsType;
2009
+ }
2010
+ interface TsEnumDeclaration extends Node, HasSpan {
2011
+ type: "TsEnumDeclaration";
2012
+ declare: boolean;
2013
+ isConst: boolean;
2014
+ id: Identifier;
2015
+ members: TsEnumMember[];
2016
+ }
2017
+ interface TsEnumMember extends Node, HasSpan {
2018
+ type: "TsEnumMember";
2019
+ id: TsEnumMemberId;
2020
+ init?: Expression;
2021
+ }
2022
+ type TsEnumMemberId = Identifier | StringLiteral;
2023
+ interface TsModuleDeclaration extends Node, HasSpan {
2024
+ type: "TsModuleDeclaration";
2025
+ declare: boolean;
2026
+ global: boolean;
2027
+ id: TsModuleName;
2028
+ body?: TsNamespaceBody;
2029
+ }
2030
+ /**
2031
+ * `namespace A.B { }` is a namespace named `A` with another TsNamespaceDecl as its body.
2032
+ */
2033
+ type TsNamespaceBody = TsModuleBlock | TsNamespaceDeclaration;
2034
+ interface TsModuleBlock extends Node, HasSpan {
2035
+ type: "TsModuleBlock";
2036
+ body: ModuleItem[];
2037
+ }
2038
+ interface TsNamespaceDeclaration extends Node, HasSpan {
2039
+ type: "TsNamespaceDeclaration";
2040
+ declare: boolean;
2041
+ global: boolean;
2042
+ id: Identifier;
2043
+ body: TsNamespaceBody;
2044
+ }
2045
+ type TsModuleName = Identifier | StringLiteral;
2046
+ interface TsImportEqualsDeclaration extends Node, HasSpan {
2047
+ type: "TsImportEqualsDeclaration";
2048
+ declare: boolean;
2049
+ isExport: boolean;
2050
+ isTypeOnly: boolean;
2051
+ id: Identifier;
2052
+ moduleRef: TsModuleReference;
2053
+ }
2054
+ type TsModuleReference = TsEntityName | TsExternalModuleReference;
2055
+ interface TsExternalModuleReference extends Node, HasSpan {
2056
+ type: "TsExternalModuleReference";
2057
+ expression: StringLiteral;
2058
+ }
2059
+ interface TsExportAssignment extends Node, HasSpan {
2060
+ type: "TsExportAssignment";
2061
+ expression: Expression;
2062
+ }
2063
+ interface TsNamespaceExportDeclaration extends Node, HasSpan {
2064
+ type: "TsNamespaceExportDeclaration";
2065
+ id: Identifier;
2066
+ }
2067
+ interface TsAsExpression extends ExpressionBase {
2068
+ type: "TsAsExpression";
2069
+ expression: Expression;
2070
+ typeAnnotation: TsType;
2071
+ }
2072
+ interface TsSatisfiesExpression extends ExpressionBase {
2073
+ type: "TsSatisfiesExpression";
2074
+ expression: Expression;
2075
+ typeAnnotation: TsType;
2076
+ }
2077
+ interface TsInstantiation extends Node, HasSpan {
2078
+ type: "TsInstantiation";
2079
+ expression: Expression;
2080
+ typeArguments: TsTypeParameterInstantiation;
2081
+ }
2082
+ interface TsTypeAssertion extends ExpressionBase {
2083
+ type: "TsTypeAssertion";
2084
+ expression: Expression;
2085
+ typeAnnotation: TsType;
2086
+ }
2087
+ interface TsConstAssertion extends ExpressionBase {
2088
+ type: "TsConstAssertion";
2089
+ expression: Expression;
2090
+ }
2091
+ interface TsNonNullExpression extends ExpressionBase {
2092
+ type: "TsNonNullExpression";
2093
+ expression: Expression;
2094
+ }
2095
+ type Accessibility = "public" | "protected" | "private";
2096
+ interface Invalid extends Node, HasSpan {
2097
+ type: "Invalid";
2098
+ }
2099
+ type WasmAnalysisOptions = {
2100
+ parser?: ParserConfig;
2101
+ module?: true | false | 'unknown';
2102
+ filename?: string;
2103
+ errorFormat?: 'json' | 'normal';
2104
+ cacheRoot?: string;
2105
+ plugins: WasmPlugin[];
2106
+ };
2107
+ type WasmPlugin = [wasmPackage: string, config: Record<string, any>];
2108
+
2109
+ export type { Accessibility, AmdConfig, Argument, ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentOperator, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BaseModuleConfig, BigIntLiteral, BinaryExpression, BinaryOperator, BindingIdentifier, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CallerOptions, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassMethodBase, ClassProperty, ClassPropertyBase, CommonJsConfig, ComputedPropName, ConditionalExpression, Config, ConstModulesConfig, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, EnvConfig, Es6Config, EsParserConfig, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, ExprOrSpread, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, GlobalPassOption, HasDecorator, HasSpan, Identifier, IfStatement, Import, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, Invalid, JSXAttrValue, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, JsFormatOptions, JsMinifyOptions, JscConfig, JscTarget, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, Literal, MatchPattern, MemberExpression, MetaProperty, MethodKind, MethodProperty, Module, ModuleConfig, ModuleDeclaration, ModuleExportName, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, Node, NodeNextConfig, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptimizerConfig, OptionalChainingCall, OptionalChainingExpression, Options, Output, Param, ParenthesisExpression, ParseOptions, ParserConfig, Pattern, Plugin, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, ReactConfig, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, Span, SpreadElement, Statement, StaticBlock, StringLiteral, Super, SuperPropExpression, Swcrc, SwitchCase, SwitchStatement, SystemjsConfig, TaggedTemplateExpression, TemplateElement, TemplateLiteral, TerserCompressOptions, TerserEcmaVersion, TerserMangleOptions, TerserManglePropertiesOptions, ThisExpression, ThrowStatement, TransformConfig, TruePlusMinus, TryStatement, TsArrayType, TsAsExpression, TsCallSignatureDeclaration, TsConditionalType, TsConstAssertion, TsConstructSignatureDeclaration, TsConstructorType, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnOrConstructorType, TsFnParameter, TsFunctionType, TsGetterSignature, TsImportEqualsDeclaration, TsImportType, TsIndexSignature, TsIndexedAccessType, TsInferType, TsInstantiation, TsInterfaceBody, TsInterfaceDeclaration, TsIntersectionType, TsKeywordType, TsKeywordTypeKind, TsLiteral, TsLiteralType, TsMappedType, TsMethodSignature, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsOptionalType, TsParameterProperty, TsParameterPropertyParameter, TsParenthesizedType, TsParserConfig, TsPropertySignature, TsQualifiedName, TsRestType, TsSatisfiesExpression, TsSetterSignature, TsTemplateLiteralType, TsThisType, TsThisTypeOrIdent, TsTupleElement, TsTupleType, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeLiteral, TsTypeOperator, TsTypeOperatorOp, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, TsTypePredicate, TsTypeQuery, TsTypeQueryExpr, TsTypeReference, TsUnionOrIntersectionType, TsUnionType, UmdConfig, UnaryExpression, UnaryOperator, UpdateExpression, UpdateOperator, VariableDeclaration, VariableDeclarationKind, VariableDeclarator, WasmAnalysisOptions, WasmPlugin, WhileStatement, WithStatement, YieldExpression };