rolldown 1.0.0-beta.2-commit.2666b23 → 1.0.0-beta.20

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 (236) hide show
  1. package/bin/cli.mjs +2 -0
  2. package/dist/{cjs/cli.cjs → cli.cjs} +630 -603
  3. package/dist/cli.d.cts +1 -0
  4. package/dist/cli.d.mts +1 -0
  5. package/dist/{esm/cli.mjs → cli.mjs} +605 -575
  6. package/dist/config.cjs +12 -0
  7. package/dist/config.d.cts +10 -0
  8. package/dist/config.d.mts +10 -0
  9. package/dist/config.mjs +10 -0
  10. package/dist/experimental-index.cjs +107 -0
  11. package/dist/experimental-index.d.cts +63 -0
  12. package/dist/experimental-index.d.mts +63 -0
  13. package/dist/experimental-index.mjs +82 -0
  14. package/dist/experimental-runtime-types.d.ts +52 -0
  15. package/dist/filter-index.cjs +105 -0
  16. package/dist/filter-index.d.cts +4 -0
  17. package/dist/filter-index.d.mts +4 -0
  18. package/dist/filter-index.mjs +44 -0
  19. package/dist/index.cjs +9 -0
  20. package/dist/index.d.cts +3 -0
  21. package/dist/index.d.mts +3 -0
  22. package/dist/index.mjs +5 -0
  23. package/dist/{cjs/parallel-plugin-worker.cjs → parallel-plugin-worker.cjs} +6 -14
  24. package/dist/parallel-plugin-worker.d.cts +1 -0
  25. package/dist/parallel-plugin-worker.d.mts +1 -0
  26. package/dist/{esm/parallel-plugin-worker.mjs → parallel-plugin-worker.mjs} +5 -12
  27. package/dist/{cjs/parallel-plugin.cjs → parallel-plugin.cjs} +1 -2
  28. package/dist/parallel-plugin.d.cts +14 -0
  29. package/dist/parallel-plugin.d.mts +14 -0
  30. package/dist/{esm/parallel-plugin.mjs → parallel-plugin.mjs} +0 -1
  31. package/dist/parse-ast-index.cjs +4 -0
  32. package/dist/parse-ast-index.d.cts +9 -0
  33. package/dist/parse-ast-index.d.mts +9 -0
  34. package/dist/parse-ast-index.mjs +3 -0
  35. package/dist/shared/binding-5O9lFYtz.d.mts +1215 -0
  36. package/dist/shared/binding-BvKFOCZr.d.cts +1215 -0
  37. package/dist/shared/{chunk-qZFfknuJ.cjs → chunk-DDkG_k5U.cjs} +0 -1
  38. package/dist/shared/define-config-BOD4oRSZ.d.cts +1204 -0
  39. package/dist/shared/define-config-DdVYel_V.d.mts +1204 -0
  40. package/dist/shared/load-config-B_hPIyxu.mjs +119 -0
  41. package/dist/shared/load-config-BdY850xq.cjs +125 -0
  42. package/dist/shared/misc-BKp5iIef.cjs +67 -0
  43. package/dist/shared/misc-BN0nse6C.mjs +25 -0
  44. package/dist/shared/parse-ast-index-CVVmsBjK.cjs +738 -0
  45. package/dist/shared/parse-ast-index-DW8kbzjr.mjs +616 -0
  46. package/dist/shared/{prompt-Nfm4Xz36.mjs → prompt-C5jz26Zn.mjs} +247 -246
  47. package/dist/shared/{prompt-B7tq3GL9.cjs → prompt-QNI93ne7.cjs} +250 -250
  48. package/dist/shared/src-CZ0tgOug.cjs +4851 -0
  49. package/dist/shared/src-DHXNdTPA.mjs +4647 -0
  50. package/package.json +63 -67
  51. package/bin/cli.js +0 -2
  52. package/dist/cjs/experimental-index.cjs +0 -79
  53. package/dist/cjs/index.cjs +0 -8
  54. package/dist/cjs/parse-ast-index.cjs +0 -57
  55. package/dist/esm/experimental-index.mjs +0 -56
  56. package/dist/esm/index.mjs +0 -4
  57. package/dist/esm/parse-ast-index.mjs +0 -55
  58. package/dist/shared/binding-l7VLSKnB.mjs +0 -610
  59. package/dist/shared/binding-orkvONpS.cjs +0 -661
  60. package/dist/shared/src-BC6S-BmL.cjs +0 -2828
  61. package/dist/shared/src-mupmacNC.mjs +0 -2647
  62. package/dist/types/api/build.d.ts +0 -18
  63. package/dist/types/api/build.js +0 -22
  64. package/dist/types/api/experimental.d.ts +0 -7
  65. package/dist/types/api/experimental.js +0 -13
  66. package/dist/types/api/rolldown/index.d.ts +0 -3
  67. package/dist/types/api/rolldown/index.js +0 -7
  68. package/dist/types/api/rolldown/rolldown-build.d.ts +0 -12
  69. package/dist/types/api/rolldown/rolldown-build.js +0 -43
  70. package/dist/types/api/watch/index.d.ts +0 -3
  71. package/dist/types/api/watch/index.js +0 -8
  72. package/dist/types/api/watch/watch-emitter.d.ts +0 -31
  73. package/dist/types/api/watch/watch-emitter.js +0 -69
  74. package/dist/types/api/watch/watcher.d.ts +0 -13
  75. package/dist/types/api/watch/watcher.js +0 -66
  76. package/dist/types/binding.d.ts +0 -1327
  77. package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
  78. package/dist/types/builtin-plugin/alias-plugin.js +0 -4
  79. package/dist/types/builtin-plugin/constructors.d.ts +0 -20
  80. package/dist/types/builtin-plugin/constructors.js +0 -68
  81. package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -28
  82. package/dist/types/builtin-plugin/replace-plugin.js +0 -29
  83. package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
  84. package/dist/types/builtin-plugin/transform-plugin.js +0 -16
  85. package/dist/types/builtin-plugin/utils.d.ts +0 -8
  86. package/dist/types/builtin-plugin/utils.js +0 -19
  87. package/dist/types/cli/arguments/alias.d.ts +0 -16
  88. package/dist/types/cli/arguments/alias.js +0 -63
  89. package/dist/types/cli/arguments/index.d.ts +0 -15
  90. package/dist/types/cli/arguments/index.js +0 -127
  91. package/dist/types/cli/arguments/normalize.d.ts +0 -12
  92. package/dist/types/cli/arguments/normalize.js +0 -48
  93. package/dist/types/cli/arguments/utils.d.ts +0 -8
  94. package/dist/types/cli/arguments/utils.js +0 -67
  95. package/dist/types/cli/colors.d.ts +0 -11
  96. package/dist/types/cli/colors.js +0 -17
  97. package/dist/types/cli/commands/bundle.d.ts +0 -3
  98. package/dist/types/cli/commands/bundle.js +0 -203
  99. package/dist/types/cli/commands/help.d.ts +0 -1
  100. package/dist/types/cli/commands/help.js +0 -88
  101. package/dist/types/cli/index.d.ts +0 -1
  102. package/dist/types/cli/index.js +0 -27
  103. package/dist/types/cli/load-config.d.ts +0 -3
  104. package/dist/types/cli/load-config.js +0 -95
  105. package/dist/types/cli/logger.d.ts +0 -5
  106. package/dist/types/cli/logger.js +0 -35
  107. package/dist/types/constants/plugin-context.d.ts +0 -7
  108. package/dist/types/constants/plugin-context.js +0 -7
  109. package/dist/types/constants/plugin.d.ts +0 -45
  110. package/dist/types/constants/plugin.js +0 -69
  111. package/dist/types/experimental-index.d.ts +0 -9
  112. package/dist/types/experimental-index.js +0 -9
  113. package/dist/types/index.d.ts +0 -28
  114. package/dist/types/index.js +0 -7
  115. package/dist/types/log/logHandler.d.ts +0 -4
  116. package/dist/types/log/logHandler.js +0 -25
  117. package/dist/types/log/logger.d.ts +0 -6
  118. package/dist/types/log/logger.js +0 -107
  119. package/dist/types/log/logging.d.ts +0 -11
  120. package/dist/types/log/logging.js +0 -11
  121. package/dist/types/log/logs.d.ts +0 -18
  122. package/dist/types/log/logs.js +0 -86
  123. package/dist/types/options/input-options.d.ts +0 -170
  124. package/dist/types/options/input-options.js +0 -1
  125. package/dist/types/options/normalized-input-options.d.ts +0 -18
  126. package/dist/types/options/normalized-input-options.js +0 -21
  127. package/dist/types/options/normalized-output-options.d.ts +0 -67
  128. package/dist/types/options/normalized-output-options.js +0 -99
  129. package/dist/types/options/output-options.d.ts +0 -86
  130. package/dist/types/options/output-options.js +0 -1
  131. package/dist/types/options/watch-options.d.ts +0 -5
  132. package/dist/types/options/watch-options.js +0 -1
  133. package/dist/types/parallel-plugin-worker.d.ts +0 -1
  134. package/dist/types/parallel-plugin-worker.js +0 -31
  135. package/dist/types/parallel-plugin.d.ts +0 -1
  136. package/dist/types/parallel-plugin.js +0 -1
  137. package/dist/types/parse-ast-index.d.ts +0 -4
  138. package/dist/types/parse-ast-index.js +0 -73
  139. package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
  140. package/dist/types/plugin/bindingify-build-hooks.js +0 -213
  141. package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
  142. package/dist/types/plugin/bindingify-hook-filter.js +0 -39
  143. package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
  144. package/dist/types/plugin/bindingify-output-hooks.js +0 -189
  145. package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
  146. package/dist/types/plugin/bindingify-plugin-hook-meta.js +0 -19
  147. package/dist/types/plugin/bindingify-plugin.d.ts +0 -15
  148. package/dist/types/plugin/bindingify-plugin.js +0 -124
  149. package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
  150. package/dist/types/plugin/bindingify-watch-hooks.js +0 -29
  151. package/dist/types/plugin/hook-filter.d.ts +0 -48
  152. package/dist/types/plugin/hook-filter.js +0 -1
  153. package/dist/types/plugin/index.d.ts +0 -126
  154. package/dist/types/plugin/index.js +0 -1
  155. package/dist/types/plugin/minimal-plugin-context.d.ts +0 -15
  156. package/dist/types/plugin/minimal-plugin-context.js +0 -25
  157. package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
  158. package/dist/types/plugin/parallel-plugin-implementation.js +0 -3
  159. package/dist/types/plugin/parallel-plugin.d.ts +0 -9
  160. package/dist/types/plugin/parallel-plugin.js +0 -6
  161. package/dist/types/plugin/plugin-context-data.d.ts +0 -16
  162. package/dist/types/plugin/plugin-context-data.js +0 -55
  163. package/dist/types/plugin/plugin-context.d.ts +0 -52
  164. package/dist/types/plugin/plugin-context.js +0 -108
  165. package/dist/types/plugin/plugin-driver.d.ts +0 -8
  166. package/dist/types/plugin/plugin-driver.js +0 -88
  167. package/dist/types/plugin/transform-plugin-context.d.ts +0 -17
  168. package/dist/types/plugin/transform-plugin-context.js +0 -37
  169. package/dist/types/types/assert.d.ts +0 -13
  170. package/dist/types/types/assert.js +0 -1
  171. package/dist/types/types/config-export.d.ts +0 -5
  172. package/dist/types/types/config-export.js +0 -1
  173. package/dist/types/types/misc.d.ts +0 -40
  174. package/dist/types/types/misc.js +0 -1
  175. package/dist/types/types/module-info.d.ts +0 -15
  176. package/dist/types/types/module-info.js +0 -1
  177. package/dist/types/types/module-side-effects.d.ts +0 -10
  178. package/dist/types/types/module-side-effects.js +0 -1
  179. package/dist/types/types/output-bundle.d.ts +0 -4
  180. package/dist/types/types/output-bundle.js +0 -1
  181. package/dist/types/types/rolldown-options.d.ts +0 -5
  182. package/dist/types/types/rolldown-options.js +0 -1
  183. package/dist/types/types/rolldown-output.d.ts +0 -63
  184. package/dist/types/types/rolldown-output.js +0 -1
  185. package/dist/types/types/schema.d.ts +0 -33
  186. package/dist/types/types/schema.js +0 -1
  187. package/dist/types/types/sourcemap.d.ts +0 -13
  188. package/dist/types/types/sourcemap.js +0 -16
  189. package/dist/types/types/utils.d.ts +0 -13
  190. package/dist/types/types/utils.js +0 -1
  191. package/dist/types/utils/asset-source.d.ts +0 -4
  192. package/dist/types/utils/asset-source.js +0 -8
  193. package/dist/types/utils/async-flatten.d.ts +0 -1
  194. package/dist/types/utils/async-flatten.js +0 -7
  195. package/dist/types/utils/bindingify-input-options.d.ts +0 -7
  196. package/dist/types/utils/bindingify-input-options.js +0 -225
  197. package/dist/types/utils/bindingify-output-options.d.ts +0 -3
  198. package/dist/types/utils/bindingify-output-options.js +0 -92
  199. package/dist/types/utils/code-frame.d.ts +0 -1
  200. package/dist/types/utils/code-frame.js +0 -46
  201. package/dist/types/utils/compose-js-plugins.d.ts +0 -2
  202. package/dist/types/utils/compose-js-plugins.js +0 -400
  203. package/dist/types/utils/create-bundler-option.d.ts +0 -11
  204. package/dist/types/utils/create-bundler-option.js +0 -53
  205. package/dist/types/utils/create-bundler.d.ts +0 -8
  206. package/dist/types/utils/create-bundler.js +0 -15
  207. package/dist/types/utils/define-config.d.ts +0 -5
  208. package/dist/types/utils/define-config.js +0 -3
  209. package/dist/types/utils/error.d.ts +0 -2
  210. package/dist/types/utils/error.js +0 -65
  211. package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -19
  212. package/dist/types/utils/initialize-parallel-plugins.js +0 -54
  213. package/dist/types/utils/misc.d.ts +0 -6
  214. package/dist/types/utils/misc.js +0 -22
  215. package/dist/types/utils/normalize-hook.d.ts +0 -7
  216. package/dist/types/utils/normalize-hook.js +0 -21
  217. package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
  218. package/dist/types/utils/normalize-plugin-option.js +0 -35
  219. package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
  220. package/dist/types/utils/normalize-string-or-regex.js +0 -14
  221. package/dist/types/utils/plugin/index.d.ts +0 -2
  222. package/dist/types/utils/plugin/index.js +0 -7
  223. package/dist/types/utils/transform-module-info.d.ts +0 -4
  224. package/dist/types/utils/transform-module-info.js +0 -19
  225. package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
  226. package/dist/types/utils/transform-rendered-chunk.js +0 -43
  227. package/dist/types/utils/transform-rendered-module.d.ts +0 -3
  228. package/dist/types/utils/transform-rendered-module.js +0 -10
  229. package/dist/types/utils/transform-side-effects.d.ts +0 -3
  230. package/dist/types/utils/transform-side-effects.js +0 -16
  231. package/dist/types/utils/transform-sourcemap.d.ts +0 -3
  232. package/dist/types/utils/transform-sourcemap.js +0 -29
  233. package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
  234. package/dist/types/utils/transform-to-rollup-output.js +0 -165
  235. package/dist/types/utils/validator.d.ts +0 -7
  236. package/dist/types/utils/validator.js +0 -275
@@ -0,0 +1,1215 @@
1
+ import * as _oxc_project_types0 from "@oxc-project/types";
2
+
3
+ //#region src/binding.d.ts
4
+ type MaybePromise<T> = T | Promise<T>;
5
+ type VoidNullable<T = void> = T | null | undefined | void;
6
+ type BindingStringOrRegex = string | RegExp;
7
+ interface Comment {
8
+ type: 'Line' | 'Block';
9
+ value: string;
10
+ start: number;
11
+ end: number;
12
+ }
13
+ interface ErrorLabel {
14
+ message?: string;
15
+ start: number;
16
+ end: number;
17
+ }
18
+ interface OxcError {
19
+ severity: Severity;
20
+ message: string;
21
+ labels: Array<ErrorLabel>;
22
+ helpMessage?: string;
23
+ codeframe?: string;
24
+ }
25
+ type Severity = 'Error' | 'Warning' | 'Advice';
26
+ declare class ParseResult {
27
+ get program(): _oxc_project_types0.Program;
28
+ get module(): EcmaScriptModule;
29
+ get comments(): Array<Comment>;
30
+ get errors(): Array<OxcError>;
31
+ }
32
+ interface DynamicImport {
33
+ start: number;
34
+ end: number;
35
+ moduleRequest: Span;
36
+ }
37
+ interface EcmaScriptModule {
38
+ /**
39
+ * Has ESM syntax.
40
+ *
41
+ * i.e. `import` and `export` statements, and `import.meta`.
42
+ *
43
+ * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
44
+ */
45
+ hasModuleSyntax: boolean;
46
+ /** Import statements. */
47
+ staticImports: Array<StaticImport>;
48
+ /** Export statements. */
49
+ staticExports: Array<StaticExport>;
50
+ /** Dynamic import expressions. */
51
+ dynamicImports: Array<DynamicImport>;
52
+ /** Span positions` of `import.meta` */
53
+ importMetas: Array<Span>;
54
+ }
55
+ interface ExportExportName {
56
+ kind: ExportExportNameKind;
57
+ name?: string;
58
+ start?: number;
59
+ end?: number;
60
+ }
61
+ type ExportExportNameKind = /** `export { name } */
62
+ 'Name' | /** `export default expression` */
63
+ 'Default' | /** `export * from "mod" */
64
+ 'None';
65
+ interface ExportImportName {
66
+ kind: ExportImportNameKind;
67
+ name?: string;
68
+ start?: number;
69
+ end?: number;
70
+ }
71
+ type ExportImportNameKind = /** `export { name } */
72
+ 'Name' | /** `export * as ns from "mod"` */
73
+ 'All' | /** `export * from "mod"` */
74
+ 'AllButDefault' | /** Does not have a specifier. */
75
+ 'None';
76
+ interface ExportLocalName {
77
+ kind: ExportLocalNameKind;
78
+ name?: string;
79
+ start?: number;
80
+ end?: number;
81
+ }
82
+ type ExportLocalNameKind = /** `export { name } */
83
+ 'Name' | /** `export default expression` */
84
+ 'Default' |
85
+ /**
86
+ * If the exported value is not locally accessible from within the module.
87
+ * `export default function () {}`
88
+ */
89
+ 'None';
90
+
91
+ /**
92
+ * Get offset within a `Uint8Array` which is aligned on 4 GiB.
93
+ *
94
+ * Does not check that the offset is within bounds of `buffer`.
95
+ * To ensure it always is, provide a `Uint8Array` of at least 4 GiB size.
96
+ */
97
+
98
+ interface ImportName {
99
+ kind: ImportNameKind;
100
+ name?: string;
101
+ start?: number;
102
+ end?: number;
103
+ }
104
+ type ImportNameKind = /** `import { x } from "mod"` */
105
+ 'Name' | /** `import * as ns from "mod"` */
106
+ 'NamespaceObject' | /** `import defaultExport from "mod"` */
107
+ 'Default';
108
+
109
+ /**
110
+ * Parse asynchronously.
111
+ *
112
+ * Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
113
+ */
114
+
115
+ interface ParserOptions {
116
+ /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
117
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx';
118
+ /** Treat the source text as `script` or `module` code. */
119
+ sourceType?: 'script' | 'module' | 'unambiguous' | undefined;
120
+ /**
121
+ * Return an AST which includes TypeScript-related properties, or excludes them.
122
+ *
123
+ * `'js'` is default for JS / JSX files.
124
+ * `'ts'` is default for TS / TSX files.
125
+ * The type of the file is determined from `lang` option, or extension of provided `filename`.
126
+ */
127
+ astType?: 'js' | 'ts';
128
+ /**
129
+ * Controls whether the `range` property is included on AST nodes.
130
+ * The `range` property is a `[number, number]` which indicates the start/end offsets
131
+ * of the node in the file contents.
132
+ *
133
+ * @default false
134
+ */
135
+ range?: boolean;
136
+ /**
137
+ * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
138
+ *
139
+ * If this option is true, parenthesized expressions are represented by
140
+ * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
141
+ * have a single `expression` property containing the expression inside parentheses.
142
+ *
143
+ * @default true
144
+ */
145
+ preserveParens?: boolean;
146
+ /**
147
+ * Produce semantic errors with an additional AST pass.
148
+ * Semantic errors depend on symbols and scopes, where the parser does not construct.
149
+ * This adds a small performance overhead.
150
+ *
151
+ * @default false
152
+ */
153
+ showSemanticErrors?: boolean;
154
+ }
155
+
156
+ /** Parse synchronously. */
157
+
158
+ interface Span {
159
+ start: number;
160
+ end: number;
161
+ }
162
+ interface StaticExport {
163
+ start: number;
164
+ end: number;
165
+ entries: Array<StaticExportEntry>;
166
+ }
167
+ interface StaticExportEntry {
168
+ start: number;
169
+ end: number;
170
+ moduleRequest?: ValueSpan;
171
+ /** The name under which the desired binding is exported by the module`. */
172
+ importName: ExportImportName;
173
+ /** The name used to export this binding by this module. */
174
+ exportName: ExportExportName;
175
+ /** The name that is used to locally access the exported value from within the importing module. */
176
+ localName: ExportLocalName;
177
+ /**
178
+ * Whether the export is a TypeScript `export type`.
179
+ *
180
+ * Examples:
181
+ *
182
+ * ```ts
183
+ * export type * from 'mod';
184
+ * export type * as ns from 'mod';
185
+ * export type { foo };
186
+ * export { type foo }:
187
+ * export type { foo } from 'mod';
188
+ * ```
189
+ */
190
+ isType: boolean;
191
+ }
192
+ interface StaticImport {
193
+ /** Start of import statement. */
194
+ start: number;
195
+ /** End of import statement. */
196
+ end: number;
197
+ /**
198
+ * Import source.
199
+ *
200
+ * ```js
201
+ * import { foo } from "mod";
202
+ * // ^^^
203
+ * ```
204
+ */
205
+ moduleRequest: ValueSpan;
206
+ /**
207
+ * Import specifiers.
208
+ *
209
+ * Empty for `import "mod"`.
210
+ */
211
+ entries: Array<StaticImportEntry>;
212
+ }
213
+ interface StaticImportEntry {
214
+ /**
215
+ * The name under which the desired binding is exported by the module.
216
+ *
217
+ * ```js
218
+ * import { foo } from "mod";
219
+ * // ^^^
220
+ * import { foo as bar } from "mod";
221
+ * // ^^^
222
+ * ```
223
+ */
224
+ importName: ImportName;
225
+ /**
226
+ * The name that is used to locally access the imported value from within the importing module.
227
+ * ```js
228
+ * import { foo } from "mod";
229
+ * // ^^^
230
+ * import { foo as bar } from "mod";
231
+ * // ^^^
232
+ * ```
233
+ */
234
+ localName: ValueSpan;
235
+ /**
236
+ * Whether this binding is for a TypeScript type-only import.
237
+ *
238
+ * `true` for the following imports:
239
+ * ```ts
240
+ * import type { foo } from "mod";
241
+ * import { type foo } from "mod";
242
+ * ```
243
+ */
244
+ isType: boolean;
245
+ }
246
+ interface ValueSpan {
247
+ value: string;
248
+ start: number;
249
+ end: number;
250
+ }
251
+ declare class ResolverFactory {
252
+ constructor(options?: NapiResolveOptions | undefined | null);
253
+ static default(): ResolverFactory;
254
+ /** Clone the resolver using the same underlying cache. */
255
+ cloneWithOptions(options: NapiResolveOptions): ResolverFactory;
256
+ /** Clear the underlying cache. */
257
+ clearCache(): void;
258
+ /** Synchronously resolve `specifier` at an absolute path to a `directory`. */
259
+ sync(directory: string, request: string): ResolveResult;
260
+ /** Asynchronously resolve `specifier` at an absolute path to a `directory`. */
261
+ async(directory: string, request: string): Promise<ResolveResult>;
262
+ }
263
+ declare enum EnforceExtension {
264
+ Auto = 0,
265
+ Enabled = 1,
266
+ Disabled = 2,
267
+ }
268
+ type ModuleType = 'module' | 'commonjs' | 'json' | 'wasm' | 'addon';
269
+
270
+ /**
271
+ * Module Resolution Options
272
+ *
273
+ * Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options).
274
+ *
275
+ * See [webpack resolve](https://webpack.js.org/configuration/resolve/) for information and examples
276
+ */
277
+ interface NapiResolveOptions {
278
+ /**
279
+ * Path to TypeScript configuration file.
280
+ *
281
+ * Default `None`
282
+ */
283
+ tsconfig?: TsconfigOptions;
284
+ /**
285
+ * Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
286
+ *
287
+ * For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) ->
288
+ * AliasValue::Path(String)`
289
+ * Create aliases to import or require certain modules more easily.
290
+ * A trailing $ can also be added to the given object's keys to signify an exact match.
291
+ */
292
+ alias?: Record<string, Array<string | undefined | null>>;
293
+ /**
294
+ * A list of alias fields in description files.
295
+ * Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec).
296
+ * Can be a path to json object such as `["path", "to", "exports"]`.
297
+ *
298
+ * Default `[]`
299
+ */
300
+ aliasFields?: (string | string[])[];
301
+ /**
302
+ * Condition names for exports field which defines entry points of a package.
303
+ * The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries.
304
+ *
305
+ * Default `[]`
306
+ */
307
+ conditionNames?: Array<string>;
308
+ /**
309
+ * If true, it will not allow extension-less files.
310
+ * So by default `require('./foo')` works if `./foo` has a `.js` extension,
311
+ * but with this enabled only `require('./foo.js')` will work.
312
+ *
313
+ * Default to `true` when [ResolveOptions::extensions] contains an empty string.
314
+ * Use `Some(false)` to disable the behavior.
315
+ * See <https://github.com/webpack/enhanced-resolve/pull/285>
316
+ *
317
+ * Default None, which is the same as `Some(false)` when the above empty rule is not applied.
318
+ */
319
+ enforceExtension?: EnforceExtension;
320
+ /**
321
+ * A list of exports fields in description files.
322
+ * Can be a path to json object such as `["path", "to", "exports"]`.
323
+ *
324
+ * Default `[["exports"]]`.
325
+ */
326
+ exportsFields?: (string | string[])[];
327
+ /**
328
+ * Fields from `package.json` which are used to provide the internal requests of a package
329
+ * (requests starting with # are considered internal).
330
+ *
331
+ * Can be a path to a JSON object such as `["path", "to", "imports"]`.
332
+ *
333
+ * Default `[["imports"]]`.
334
+ */
335
+ importsFields?: (string | string[])[];
336
+ /**
337
+ * An object which maps extension to extension aliases.
338
+ *
339
+ * Default `{}`
340
+ */
341
+ extensionAlias?: Record<string, Array<string>>;
342
+ /**
343
+ * Attempt to resolve these extensions in order.
344
+ * If multiple files share the same name but have different extensions,
345
+ * will resolve the one with the extension listed first in the array and skip the rest.
346
+ *
347
+ * Default `[".js", ".json", ".node"]`
348
+ */
349
+ extensions?: Array<string>;
350
+ /**
351
+ * Redirect module requests when normal resolving fails.
352
+ *
353
+ * Default `[]`
354
+ */
355
+ fallback?: Record<string, Array<string | undefined | null>>;
356
+ /**
357
+ * Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests).
358
+ *
359
+ * See also webpack configuration [resolve.fullySpecified](https://webpack.js.org/configuration/module/#resolvefullyspecified)
360
+ *
361
+ * Default `false`
362
+ */
363
+ fullySpecified?: boolean;
364
+ /**
365
+ * A list of main fields in description files
366
+ *
367
+ * Default `["main"]`.
368
+ */
369
+ mainFields?: string | string[];
370
+ /**
371
+ * The filename to be used while resolving directories.
372
+ *
373
+ * Default `["index"]`
374
+ */
375
+ mainFiles?: Array<string>;
376
+ /**
377
+ * A list of directories to resolve modules from, can be absolute path or folder name.
378
+ *
379
+ * Default `["node_modules"]`
380
+ */
381
+ modules?: string | string[];
382
+ /**
383
+ * Resolve to a context instead of a file.
384
+ *
385
+ * Default `false`
386
+ */
387
+ resolveToContext?: boolean;
388
+ /**
389
+ * Prefer to resolve module requests as relative requests instead of using modules from node_modules directories.
390
+ *
391
+ * Default `false`
392
+ */
393
+ preferRelative?: boolean;
394
+ /**
395
+ * Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots.
396
+ *
397
+ * Default `false`
398
+ */
399
+ preferAbsolute?: boolean;
400
+ /**
401
+ * A list of resolve restrictions to restrict the paths that a request can be resolved on.
402
+ *
403
+ * Default `[]`
404
+ */
405
+ restrictions?: Array<Restriction>;
406
+ /**
407
+ * A list of directories where requests of server-relative URLs (starting with '/') are resolved.
408
+ * On non-Windows systems these requests are resolved as an absolute path first.
409
+ *
410
+ * Default `[]`
411
+ */
412
+ roots?: Array<string>;
413
+ /**
414
+ * Whether to resolve symlinks to their symlinked location.
415
+ * When enabled, symlinked resources are resolved to their real path, not their symlinked location.
416
+ * Note that this may cause module resolution to fail when using tools that symlink packages (like npm link).
417
+ *
418
+ * Default `true`
419
+ */
420
+ symlinks?: boolean;
421
+ /**
422
+ * Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not.
423
+ * For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true.
424
+ *
425
+ * Default `false`
426
+ */
427
+ builtinModules?: boolean;
428
+ /**
429
+ * Resolve [ResolveResult::moduleType].
430
+ *
431
+ * Default `false`
432
+ */
433
+ moduleType?: boolean;
434
+ }
435
+ interface ResolveResult {
436
+ path?: string;
437
+ error?: string;
438
+ /**
439
+ * Module type for this path.
440
+ *
441
+ * Enable with `ResolveOptions#moduleType`.
442
+ *
443
+ * The module type is computed `ESM_FILE_FORMAT` from the [ESM resolution algorithm specification](https://nodejs.org/docs/latest/api/esm.html#resolution-algorithm-specification).
444
+ *
445
+ * The algorithm uses the file extension or finds the closest `package.json` with the `type` field.
446
+ */
447
+ moduleType?: ModuleType;
448
+ /** `package.json` path for the given module. */
449
+ packageJsonPath?: string;
450
+ }
451
+
452
+ /**
453
+ * Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback].
454
+ * Use struct because napi don't support structured union now
455
+ */
456
+ interface Restriction {
457
+ path?: string;
458
+ regex?: string;
459
+ }
460
+ /**
461
+ * Tsconfig Options
462
+ *
463
+ * Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options)
464
+ */
465
+ interface TsconfigOptions {
466
+ /**
467
+ * Allows you to specify where to find the TypeScript configuration file.
468
+ * You may provide
469
+ * * a relative path to the configuration file. It will be resolved relative to cwd.
470
+ * * an absolute path to the configuration file.
471
+ */
472
+ configFile: string;
473
+ /**
474
+ * Support for Typescript Project References.
475
+ *
476
+ * * `'auto'`: use the `references` field from tsconfig of `config_file`.
477
+ * * `string[]`: manually provided relative or absolute path.
478
+ */
479
+ references?: 'auto' | string[];
480
+ }
481
+ interface SourceMap {
482
+ file?: string;
483
+ mappings: string;
484
+ names: Array<string>;
485
+ sourceRoot?: string;
486
+ sources: Array<string>;
487
+ sourcesContent?: Array<string>;
488
+ version: number;
489
+ x_google_ignoreList?: Array<number>;
490
+ }
491
+ interface CompilerAssumptions {
492
+ ignoreFunctionLength?: boolean;
493
+ noDocumentAll?: boolean;
494
+ objectRestNoSymbols?: boolean;
495
+ pureGetters?: boolean;
496
+ /**
497
+ * When using public class fields, assume that they don't shadow any getter in the current class,
498
+ * in its subclasses or in its superclass. Thus, it's safe to assign them rather than using
499
+ * `Object.defineProperty`.
500
+ *
501
+ * For example:
502
+ *
503
+ * Input:
504
+ * ```js
505
+ * class Test {
506
+ * field = 2;
507
+ *
508
+ * static staticField = 3;
509
+ * }
510
+ * ```
511
+ *
512
+ * When `set_public_class_fields` is `true`, the output will be:
513
+ * ```js
514
+ * class Test {
515
+ * constructor() {
516
+ * this.field = 2;
517
+ * }
518
+ * }
519
+ * Test.staticField = 3;
520
+ * ```
521
+ *
522
+ * Otherwise, the output will be:
523
+ * ```js
524
+ * import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
525
+ * class Test {
526
+ * constructor() {
527
+ * _defineProperty(this, "field", 2);
528
+ * }
529
+ * }
530
+ * _defineProperty(Test, "staticField", 3);
531
+ * ```
532
+ *
533
+ * NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should
534
+ * set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`]
535
+ * to `true`.
536
+ */
537
+ setPublicClassFields?: boolean;
538
+ }
539
+ interface DecoratorOptions {
540
+ /**
541
+ * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
542
+ *
543
+ * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
544
+ * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
545
+ *
546
+ * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
547
+ * @default false
548
+ */
549
+ legacy?: boolean;
550
+ /**
551
+ * Enables emitting decorator metadata.
552
+ *
553
+ * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
554
+ * in TypeScript, and it only works when `legacy` is true.
555
+ *
556
+ * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
557
+ * @default false
558
+ */
559
+ emitDecoratorMetadata?: boolean;
560
+ }
561
+ type HelperMode =
562
+ /**
563
+ * Runtime mode (default): Helper functions are imported from a runtime package.
564
+ *
565
+ * Example:
566
+ *
567
+ * ```js
568
+ * import helperName from "@oxc-project/runtime/helpers/helperName";
569
+ * helperName(...arguments);
570
+ * ```
571
+ */
572
+ 'Runtime' |
573
+ /**
574
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
575
+ *
576
+ * Example:
577
+ *
578
+ * ```js
579
+ * babelHelpers.helperName(...arguments);
580
+ * ```
581
+ */
582
+ 'External';
583
+ interface Helpers {
584
+ mode?: HelperMode;
585
+ }
586
+
587
+ /** TypeScript Isolated Declarations for Standalone DTS Emit */
588
+ declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult;
589
+ interface IsolatedDeclarationsOptions {
590
+ /**
591
+ * Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
592
+ * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
593
+ *
594
+ * Default: `false`
595
+ *
596
+ * See <https://www.typescriptlang.org/tsconfig/#stripInternal>
597
+ */
598
+ stripInternal?: boolean;
599
+ sourcemap?: boolean;
600
+ }
601
+ interface IsolatedDeclarationsResult {
602
+ code: string;
603
+ map?: SourceMap;
604
+ errors: Array<OxcError>;
605
+ }
606
+
607
+ /**
608
+ * Configure how TSX and JSX are transformed.
609
+ *
610
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
611
+ */
612
+ interface JsxOptions {
613
+ /**
614
+ * Decides which runtime to use.
615
+ *
616
+ * - 'automatic' - auto-import the correct JSX factories
617
+ * - 'classic' - no auto-import
618
+ *
619
+ * @default 'automatic'
620
+ */
621
+ runtime?: 'classic' | 'automatic';
622
+ /**
623
+ * Emit development-specific information, such as `__source` and `__self`.
624
+ *
625
+ * @default false
626
+ *
627
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
628
+ */
629
+ development?: boolean;
630
+ /**
631
+ * Toggles whether or not to throw an error if an XML namespaced tag name
632
+ * is used.
633
+ *
634
+ * Though the JSX spec allows this, it is disabled by default since React's
635
+ * JSX does not currently have support for it.
636
+ *
637
+ * @default true
638
+ */
639
+ throwIfNamespace?: boolean;
640
+ /**
641
+ * Enables `@babel/plugin-transform-react-pure-annotations`.
642
+ *
643
+ * It will mark top-level React method calls as pure for tree shaking.
644
+ *
645
+ * @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
646
+ *
647
+ * @default true
648
+ */
649
+ pure?: boolean;
650
+ /**
651
+ * Replaces the import source when importing functions.
652
+ *
653
+ * @default 'react'
654
+ */
655
+ importSource?: string;
656
+ /**
657
+ * Replace the function used when compiling JSX expressions. It should be a
658
+ * qualified name (e.g. `React.createElement`) or an identifier (e.g.
659
+ * `createElement`).
660
+ *
661
+ * Only used for `classic` {@link runtime}.
662
+ *
663
+ * @default 'React.createElement'
664
+ */
665
+ pragma?: string;
666
+ /**
667
+ * Replace the component used when compiling JSX fragments. It should be a
668
+ * valid JSX tag name.
669
+ *
670
+ * Only used for `classic` {@link runtime}.
671
+ *
672
+ * @default 'React.Fragment'
673
+ */
674
+ pragmaFrag?: string;
675
+ /**
676
+ * When spreading props, use `Object.assign` directly instead of an extend helper.
677
+ *
678
+ * Only used for `classic` {@link runtime}.
679
+ *
680
+ * @default false
681
+ */
682
+ useBuiltIns?: boolean;
683
+ /**
684
+ * When spreading props, use inline object with spread elements directly
685
+ * instead of an extend helper or Object.assign.
686
+ *
687
+ * Only used for `classic` {@link runtime}.
688
+ *
689
+ * @default false
690
+ */
691
+ useSpread?: boolean;
692
+ /**
693
+ * Enable React Fast Refresh .
694
+ *
695
+ * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
696
+ *
697
+ * @default false
698
+ */
699
+ refresh?: boolean | ReactRefreshOptions;
700
+ }
701
+
702
+ /**
703
+ * Transform JavaScript code to a Vite Node runnable module.
704
+ *
705
+ * @param filename The name of the file being transformed.
706
+ * @param sourceText the source code itself
707
+ * @param options The options for the transformation. See {@link
708
+ * ModuleRunnerTransformOptions} for more information.
709
+ *
710
+ * @returns an object containing the transformed code, source maps, and any
711
+ * errors that occurred during parsing or transformation.
712
+ *
713
+ * @deprecated Only works for Vite.
714
+ */
715
+ declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): ModuleRunnerTransformResult;
716
+ interface ModuleRunnerTransformOptions {
717
+ /**
718
+ * Enable source map generation.
719
+ *
720
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
721
+ *
722
+ * @default false
723
+ *
724
+ * @see {@link SourceMap}
725
+ */
726
+ sourcemap?: boolean;
727
+ }
728
+ interface ModuleRunnerTransformResult {
729
+ /**
730
+ * The transformed code.
731
+ *
732
+ * If parsing failed, this will be an empty string.
733
+ */
734
+ code: string;
735
+ /**
736
+ * The source map for the transformed code.
737
+ *
738
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
739
+ */
740
+ map?: SourceMap;
741
+ deps: Array<string>;
742
+ dynamicDeps: Array<string>;
743
+ /**
744
+ * Parse and transformation errors.
745
+ *
746
+ * Oxc's parser recovers from common syntax errors, meaning that
747
+ * transformed code may still be available even if there are errors in this
748
+ * list.
749
+ */
750
+ errors: Array<OxcError>;
751
+ }
752
+ interface ReactRefreshOptions {
753
+ /**
754
+ * Specify the identifier of the refresh registration variable.
755
+ *
756
+ * @default `$RefreshReg$`.
757
+ */
758
+ refreshReg?: string;
759
+ /**
760
+ * Specify the identifier of the refresh signature variable.
761
+ *
762
+ * @default `$RefreshSig$`.
763
+ */
764
+ refreshSig?: string;
765
+ emitFullSignatures?: boolean;
766
+ }
767
+
768
+ /**
769
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
770
+ *
771
+ * @param filename The name of the file being transformed. If this is a
772
+ * relative path, consider setting the {@link TransformOptions#cwd} option..
773
+ * @param sourceText the source code itself
774
+ * @param options The options for the transformation. See {@link
775
+ * TransformOptions} for more information.
776
+ *
777
+ * @returns an object containing the transformed code, source maps, and any
778
+ * errors that occurred during parsing or transformation.
779
+ */
780
+ declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult;
781
+
782
+ /**
783
+ * Options for transforming a JavaScript or TypeScript file.
784
+ *
785
+ * @see {@link transform}
786
+ */
787
+ interface TransformOptions {
788
+ /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
789
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx';
790
+ /** Treat the source text as `script` or `module` code. */
791
+ sourceType?: 'script' | 'module' | 'unambiguous' | undefined;
792
+ /**
793
+ * The current working directory. Used to resolve relative paths in other
794
+ * options.
795
+ */
796
+ cwd?: string;
797
+ /**
798
+ * Enable source map generation.
799
+ *
800
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
801
+ *
802
+ * @default false
803
+ *
804
+ * @see {@link SourceMap}
805
+ */
806
+ sourcemap?: boolean;
807
+ /** Set assumptions in order to produce smaller output. */
808
+ assumptions?: CompilerAssumptions;
809
+ /** Configure how TypeScript is transformed. */
810
+ typescript?: TypeScriptOptions;
811
+ /** Configure how TSX and JSX are transformed. */
812
+ jsx?: 'preserve' | JsxOptions;
813
+ /**
814
+ * Sets the target environment for the generated JavaScript.
815
+ *
816
+ * The lowest target is `es2015`.
817
+ *
818
+ * Example:
819
+ *
820
+ * * 'es2015'
821
+ * * ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']
822
+ *
823
+ * @default `esnext` (No transformation)
824
+ *
825
+ * @see [esbuild#target](https://esbuild.github.io/api/#target)
826
+ */
827
+ target?: string | Array<string>;
828
+ /** Behaviour for runtime helpers. */
829
+ helpers?: Helpers;
830
+ /** Define Plugin */
831
+ define?: Record<string, string>;
832
+ /** Inject Plugin */
833
+ inject?: Record<string, string | [string, string]>;
834
+ /** Decorator plugin */
835
+ decorator?: DecoratorOptions;
836
+ }
837
+ interface TransformResult {
838
+ /**
839
+ * The transformed code.
840
+ *
841
+ * If parsing failed, this will be an empty string.
842
+ */
843
+ code: string;
844
+ /**
845
+ * The source map for the transformed code.
846
+ *
847
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
848
+ */
849
+ map?: SourceMap;
850
+ /**
851
+ * The `.d.ts` declaration file for the transformed code. Declarations are
852
+ * only generated if `declaration` is set to `true` and a TypeScript file
853
+ * is provided.
854
+ *
855
+ * If parsing failed and `declaration` is set, this will be an empty string.
856
+ *
857
+ * @see {@link TypeScriptOptions#declaration}
858
+ * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
859
+ */
860
+ declaration?: string;
861
+ /**
862
+ * Declaration source map. Only generated if both
863
+ * {@link TypeScriptOptions#declaration declaration} and
864
+ * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
865
+ */
866
+ declarationMap?: SourceMap;
867
+ /**
868
+ * Helpers used.
869
+ *
870
+ * @internal
871
+ *
872
+ * Example:
873
+ *
874
+ * ```text
875
+ * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
876
+ * ```
877
+ */
878
+ helpersUsed: Record<string, string>;
879
+ /**
880
+ * Parse and transformation errors.
881
+ *
882
+ * Oxc's parser recovers from common syntax errors, meaning that
883
+ * transformed code may still be available even if there are errors in this
884
+ * list.
885
+ */
886
+ errors: Array<OxcError>;
887
+ }
888
+ interface TypeScriptOptions {
889
+ jsxPragma?: string;
890
+ jsxPragmaFrag?: string;
891
+ onlyRemoveTypeImports?: boolean;
892
+ allowNamespaces?: boolean;
893
+ /**
894
+ * When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:
895
+ *
896
+ * @deprecated
897
+ *
898
+ * Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields
899
+ * without initializer, you can use `remove_class_fields_without_initializer: true` instead.
900
+ */
901
+ allowDeclareFields?: boolean;
902
+ /**
903
+ * When enabled, class fields without initializers are removed.
904
+ *
905
+ * For example:
906
+ * ```ts
907
+ * class Foo {
908
+ * x: number;
909
+ * y: number = 0;
910
+ * }
911
+ * ```
912
+ * // transform into
913
+ * ```js
914
+ * class Foo {
915
+ * x: number;
916
+ * }
917
+ * ```
918
+ *
919
+ * The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option.
920
+ * When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`]
921
+ * to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is
922
+ * equivalent to `useDefineForClassFields: false` in TypeScript.
923
+ *
924
+ * When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into:
925
+ *
926
+ * ```js
927
+ * class Foo {
928
+ * constructor() {
929
+ * this.y = 0;
930
+ * }
931
+ * }
932
+ * ```
933
+ *
934
+ * Defaults to `false`.
935
+ */
936
+ removeClassFieldsWithoutInitializer?: boolean;
937
+ /**
938
+ * Also generate a `.d.ts` declaration file for TypeScript files.
939
+ *
940
+ * The source file must be compliant with all
941
+ * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
942
+ * requirements.
943
+ *
944
+ * @default false
945
+ */
946
+ declaration?: IsolatedDeclarationsOptions;
947
+ /**
948
+ * Rewrite or remove TypeScript import/export declaration extensions.
949
+ *
950
+ * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
951
+ * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
952
+ * - When set to `true`, it's equivalent to `rewrite`.
953
+ * - When set to `false` or omitted, no changes will be made to the extensions.
954
+ *
955
+ * @default false
956
+ */
957
+ rewriteImportExtensions?: 'rewrite' | 'remove' | boolean;
958
+ }
959
+ declare class BindingBundleEndEventData {
960
+ output: string;
961
+ duration: number;
962
+ get result(): BindingBundlerImpl;
963
+ }
964
+ declare class BindingBundleErrorEventData {
965
+ get result(): BindingBundlerImpl;
966
+ get error(): Array<Error | BindingError>;
967
+ }
968
+ declare class BindingBundlerImpl {
969
+ write(): Promise<BindingOutputs>;
970
+ generate(): Promise<BindingOutputs>;
971
+ scan(): Promise<BindingOutputs>;
972
+ close(): Promise<void>;
973
+ get closed(): boolean;
974
+ getWatchFiles(): Promise<Array<string>>;
975
+ generateHmrPatch(changedFiles: Array<string>): Promise<BindingHmrOutput>;
976
+ hmrInvalidate(file: string, firstInvalidatedBy?: string | undefined | null): Promise<BindingHmrOutput>;
977
+ }
978
+ declare class BindingError {
979
+ kind: string;
980
+ message: string;
981
+ }
982
+ declare class BindingHmrOutput {
983
+ get patch(): BindingHmrOutputPatch | null;
984
+ get errors(): Array<Error | BindingError>;
985
+ }
986
+ declare class BindingOutputAsset {
987
+ get fileName(): string;
988
+ get originalFileName(): string | null;
989
+ get originalFileNames(): Array<string>;
990
+ get source(): BindingAssetSource;
991
+ get name(): string | null;
992
+ get names(): Array<string>;
993
+ }
994
+ declare class BindingOutputChunk {
995
+ get isEntry(): boolean;
996
+ get isDynamicEntry(): boolean;
997
+ get facadeModuleId(): string | null;
998
+ get moduleIds(): Array<string>;
999
+ get exports(): Array<string>;
1000
+ get fileName(): string;
1001
+ get modules(): BindingModules;
1002
+ get imports(): Array<string>;
1003
+ get dynamicImports(): Array<string>;
1004
+ get code(): string;
1005
+ get map(): string | null;
1006
+ get sourcemapFileName(): string | null;
1007
+ get preliminaryFileName(): string;
1008
+ get name(): string;
1009
+ }
1010
+ declare class BindingOutputs {
1011
+ get chunks(): Array<BindingOutputChunk>;
1012
+ get assets(): Array<BindingOutputAsset>;
1013
+ get errors(): Array<Error | BindingError>;
1014
+ }
1015
+ declare class BindingRenderedChunk {
1016
+ get name(): string;
1017
+ get isEntry(): boolean;
1018
+ get isDynamicEntry(): boolean;
1019
+ get facadeModuleId(): string | null;
1020
+ get moduleIds(): Array<string>;
1021
+ get exports(): Array<string>;
1022
+ get fileName(): string;
1023
+ get modules(): BindingModules;
1024
+ get imports(): Array<string>;
1025
+ get dynamicImports(): Array<string>;
1026
+ }
1027
+ declare class BindingRenderedModule {
1028
+ get code(): string | null;
1029
+ get renderedExports(): Array<string>;
1030
+ }
1031
+ declare class BindingWatcherChangeData {
1032
+ path: string;
1033
+ kind: string;
1034
+ }
1035
+ declare class BindingWatcherEvent {
1036
+ eventKind(): string;
1037
+ watchChangeData(): BindingWatcherChangeData;
1038
+ bundleEndData(): BindingBundleEndEventData;
1039
+ bundleEventKind(): string;
1040
+ bundleErrorData(): BindingBundleErrorEventData;
1041
+ }
1042
+ interface BindingAssetPluginConfig {
1043
+ isServer?: boolean;
1044
+ urlBase?: string;
1045
+ publicDir?: string;
1046
+ assetsInclude?: Array<BindingStringOrRegex>;
1047
+ }
1048
+ interface BindingAssetSource {
1049
+ inner: string | Uint8Array;
1050
+ }
1051
+ interface BindingBuildImportAnalysisPluginConfig {
1052
+ preloadCode: string;
1053
+ insertPreload: boolean;
1054
+ optimizeModulePreloadRelativePaths: boolean;
1055
+ renderBuiltUrl: boolean;
1056
+ isRelativeBase: boolean;
1057
+ }
1058
+ type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-federation' | 'builtin:module-preload-polyfill' | 'builtin:oxc-runtime' | 'builtin:reporter' | 'builtin:replace' | 'builtin:transform' | 'builtin:vite-resolve' | 'builtin:wasm-fallback' | 'builtin:wasm-helper' | 'builtin:web-worker-post';
1059
+ interface BindingDynamicImportVarsPluginConfig {
1060
+ include?: Array<BindingStringOrRegex>;
1061
+ exclude?: Array<BindingStringOrRegex>;
1062
+ resolver?: (id: string, importer: string) => MaybePromise<string | undefined>;
1063
+ }
1064
+ interface BindingHmrBoundaryOutput {
1065
+ boundary: string;
1066
+ acceptedVia: string;
1067
+ }
1068
+ interface BindingHmrOutputPatch {
1069
+ code: string;
1070
+ filename: string;
1071
+ sourcemap?: string;
1072
+ sourcemapFilename?: string;
1073
+ hmrBoundaries: Array<BindingHmrBoundaryOutput>;
1074
+ fullReload: boolean;
1075
+ firstInvalidatedBy?: string;
1076
+ isSelfAccepting: boolean;
1077
+ fullReloadReason?: string;
1078
+ }
1079
+ interface BindingHookResolveIdExtraArgs {
1080
+ custom?: number;
1081
+ isEntry: boolean;
1082
+ /**
1083
+ * - `import-statement`: `import { foo } from './lib.js';`
1084
+ * - `dynamic-import`: `import('./lib.js')`
1085
+ * - `require-call`: `require('./lib.js')`
1086
+ * - `import-rule`: `@import 'bg-color.css'`
1087
+ * - `url-token`: `url('./icon.png')`
1088
+ * - `new-url`: `new URL('./worker.js', import.meta.url)`
1089
+ * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
1090
+ */
1091
+ kind: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept';
1092
+ }
1093
+ interface BindingImportGlobPluginConfig {
1094
+ root?: string;
1095
+ restoreQueryExtension?: boolean;
1096
+ }
1097
+ interface BindingIsolatedDeclarationPluginConfig {
1098
+ stripInternal?: boolean;
1099
+ }
1100
+ interface BindingJsonPluginConfig {
1101
+ minify?: boolean;
1102
+ namedExports?: boolean;
1103
+ stringify?: BindingJsonPluginStringify;
1104
+ }
1105
+ type BindingJsonPluginStringify = boolean | string;
1106
+ interface BindingManifestPluginConfig {
1107
+ root: string;
1108
+ outPath: string;
1109
+ }
1110
+ interface BindingMfManifest {
1111
+ filePath?: string;
1112
+ disableAssetsAnalyze?: boolean;
1113
+ fileName?: string;
1114
+ }
1115
+ interface BindingMinifyOptions {
1116
+ mangle?: boolean;
1117
+ compress?: boolean;
1118
+ removeWhitespace?: boolean;
1119
+ }
1120
+ interface BindingModuleFederationPluginOption {
1121
+ name: string;
1122
+ filename?: string;
1123
+ exposes?: Record<string, string>;
1124
+ remotes?: Array<BindingRemote>;
1125
+ shared?: Record<string, BindingShared>;
1126
+ runtimePlugins?: Array<string>;
1127
+ manifest?: BindingMfManifest;
1128
+ getPublicPath?: string;
1129
+ }
1130
+ interface BindingModulePreloadPolyfillPluginConfig {
1131
+ isServer?: boolean;
1132
+ }
1133
+ interface BindingModules {
1134
+ values: Array<BindingRenderedModule>;
1135
+ keys: Array<string>;
1136
+ }
1137
+ interface BindingRemote {
1138
+ type?: string;
1139
+ entry: string;
1140
+ name: string;
1141
+ entryGlobalName?: string;
1142
+ shareScope?: string;
1143
+ }
1144
+ interface BindingReplacePluginConfig {
1145
+ values: Record<string, string>;
1146
+ delimiters?: [string, string];
1147
+ preventAssignment?: boolean;
1148
+ objectGuards?: boolean;
1149
+ sourcemap?: boolean;
1150
+ }
1151
+ interface BindingReporterPluginConfig {
1152
+ isTty: boolean;
1153
+ isLib: boolean;
1154
+ assetsDir: string;
1155
+ chunkLimit: number;
1156
+ shouldLogInfo: boolean;
1157
+ reportCompressedSize: boolean;
1158
+ }
1159
+ interface BindingShared {
1160
+ version?: string;
1161
+ shareScope?: string;
1162
+ singleton?: boolean;
1163
+ requiredVersion?: string;
1164
+ strictVersion?: boolean;
1165
+ }
1166
+ interface BindingTransformHookExtraArgs {
1167
+ moduleType: string;
1168
+ }
1169
+ interface BindingTransformPluginConfig {
1170
+ include?: Array<BindingStringOrRegex>;
1171
+ exclude?: Array<BindingStringOrRegex>;
1172
+ jsxRefreshInclude?: Array<BindingStringOrRegex>;
1173
+ jsxRefreshExclude?: Array<BindingStringOrRegex>;
1174
+ isServerConsumer?: boolean;
1175
+ runtimeResolveBase?: string;
1176
+ jsxInject?: string;
1177
+ transformOptions?: TransformOptions;
1178
+ }
1179
+ interface BindingViteResolvePluginConfig {
1180
+ resolveOptions: BindingViteResolvePluginResolveOptions;
1181
+ environmentConsumer: string;
1182
+ environmentName: string;
1183
+ builtins: Array<BindingStringOrRegex>;
1184
+ external: true | string[];
1185
+ noExternal: true | Array<string | RegExp>;
1186
+ dedupe: Array<string>;
1187
+ finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>;
1188
+ finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>;
1189
+ }
1190
+ interface BindingViteResolvePluginResolveOptions {
1191
+ isBuild: boolean;
1192
+ isProduction: boolean;
1193
+ asSrc: boolean;
1194
+ preferRelative: boolean;
1195
+ isRequire?: boolean;
1196
+ root: string;
1197
+ scan: boolean;
1198
+ mainFields: Array<string>;
1199
+ conditions: Array<string>;
1200
+ externalConditions: Array<string>;
1201
+ extensions: Array<string>;
1202
+ tryIndex: boolean;
1203
+ tryPrefix?: string;
1204
+ preserveSymlinks: boolean;
1205
+ }
1206
+ interface PreRenderedChunk {
1207
+ name: string;
1208
+ isEntry: boolean;
1209
+ isDynamicEntry: boolean;
1210
+ facadeModuleId?: string;
1211
+ moduleIds: Array<string>;
1212
+ exports: Array<string>;
1213
+ }
1214
+ //#endregion
1215
+ export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingDynamicImportVarsPluginConfig, BindingHmrOutputPatch, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWatcherEvent, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ParseResult, ParserOptions, PreRenderedChunk, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform };