@rolldown/binding-wasm32-wasi 1.2.0 → 1.2.1

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.
@@ -0,0 +1,3112 @@
1
+ type MaybePromise<T> = T | Promise<T>
2
+ type Nullable<T> = T | null | undefined
3
+ type VoidNullable<T = void> = T | null | undefined | void
4
+ export type BindingStringOrRegex = string | RegExp
5
+ export type BindingResult<T> = { errors: BindingError[], isBindingErrors: boolean } | T
6
+
7
+ export interface CodegenOptions {
8
+ /**
9
+ * Remove whitespace.
10
+ *
11
+ * @default true
12
+ */
13
+ removeWhitespace?: boolean
14
+ /**
15
+ * How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
16
+ *
17
+ * * `"none"` - Do not preserve any legal comments.
18
+ * * `"inline"` - Preserve all legal comments inline.
19
+ * * `"eof"` - Move all legal comments to the end of the file.
20
+ * * `"external"` - Extract legal comments without linking.
21
+ * * `{ linked: "path/to/legal.txt" }` - Extract legal comments and add a link comment to the given path.
22
+ *
23
+ * @default "none" (when minifying)
24
+ */
25
+ legalComments?: 'none' | 'inline' | 'eof' | 'external' | { linked: string }
26
+ }
27
+
28
+ export interface CompressOptions {
29
+ /**
30
+ * Set desired EcmaScript standard version for output.
31
+ *
32
+ * Set `esnext` to enable all target highering.
33
+ *
34
+ * Example:
35
+ *
36
+ * * `'es2015'`
37
+ * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
38
+ *
39
+ * @default 'esnext'
40
+ *
41
+ * @see [oxc#target](https://oxc.rs/docs/guide/usage/transformer/lowering#target)
42
+ */
43
+ target?: string | Array<string>
44
+ /**
45
+ * Pass true to discard calls to `console.*`.
46
+ *
47
+ * @default false
48
+ */
49
+ dropConsole?: boolean
50
+ /**
51
+ * Remove `debugger;` statements.
52
+ *
53
+ * @default true
54
+ */
55
+ dropDebugger?: boolean
56
+ /**
57
+ * Pass `true` to drop unreferenced functions and variables.
58
+ *
59
+ * Simple direct variable assignments do not count as references unless set to `keep_assign`.
60
+ * @default true
61
+ */
62
+ unused?: boolean | 'keep_assign'
63
+ /** Keep function / class names. */
64
+ keepNames?: CompressOptionsKeepNames
65
+ /**
66
+ * Join consecutive var, let and const statements.
67
+ *
68
+ * @default true
69
+ */
70
+ joinVars?: boolean
71
+ /**
72
+ * Join consecutive simple statements using the comma operator.
73
+ *
74
+ * `a; b` -> `a, b`
75
+ *
76
+ * @default true
77
+ */
78
+ sequences?: boolean
79
+ /**
80
+ * Set of label names to drop from the code.
81
+ *
82
+ * Labeled statements matching these names will be removed during minification.
83
+ *
84
+ * @default []
85
+ */
86
+ dropLabels?: Array<string>
87
+ /** Limit the maximum number of iterations for debugging purpose. */
88
+ maxIterations?: number
89
+ /** Treeshake options. */
90
+ treeshake?: TreeShakeOptions
91
+ }
92
+
93
+ export interface CompressOptionsKeepNames {
94
+ /**
95
+ * Keep function names so that `Function.prototype.name` is preserved.
96
+ *
97
+ * This does not guarantee that the `undefined` name is preserved.
98
+ *
99
+ * @default false
100
+ */
101
+ function: boolean
102
+ /**
103
+ * Keep class names so that `Class.prototype.name` is preserved.
104
+ *
105
+ * This does not guarantee that the `undefined` name is preserved.
106
+ *
107
+ * @default false
108
+ */
109
+ class: boolean
110
+ }
111
+
112
+ export interface LegalCommentsLinked {
113
+ /**
114
+ * Extract legal comments and write them to the given path, with a link
115
+ * comment appended to the generated code.
116
+ */
117
+ linked: string
118
+ }
119
+
120
+ export type LegalCommentsMode = /** Do not preserve any legal comments. */
121
+ 'none'|
122
+ /** Preserve all legal comments inline. */
123
+ 'inline'|
124
+ /** Move all legal comments to the end of the file. */
125
+ 'eof'|
126
+ /** Extract legal comments without linking. */
127
+ 'external';
128
+
129
+ export interface MangleOptions {
130
+ /**
131
+ * Pass `true` to mangle names declared in the top level scope.
132
+ *
133
+ * @default true for modules and commonjs, otherwise false
134
+ */
135
+ toplevel?: boolean
136
+ /**
137
+ * Preserve `name` property for functions and classes.
138
+ *
139
+ * @default false
140
+ */
141
+ keepNames?: boolean | MangleOptionsKeepNames
142
+ /**
143
+ * Names that bindings must not be renamed to, and that bindings already
144
+ * carrying them keep. Equivalent to terser's `mangle.reserved`.
145
+ *
146
+ * Pass `['exports', 'module']` when minifying prebuilt CommonJS / UMD files
147
+ * that Node consumers `import` directly, so Node's cjs-module-lexer can still
148
+ * detect the mangled module's named exports.
149
+ *
150
+ * @default []
151
+ */
152
+ reserved?: Array<string>
153
+ /** Debug mangled names. */
154
+ debug?: boolean
155
+ }
156
+
157
+ export interface MangleOptionsKeepNames {
158
+ /**
159
+ * Preserve `name` property for functions.
160
+ *
161
+ * @default false
162
+ */
163
+ function: boolean
164
+ /**
165
+ * Preserve `name` property for classes.
166
+ *
167
+ * @default false
168
+ */
169
+ class: boolean
170
+ }
171
+
172
+ /**
173
+ * Minify asynchronously.
174
+ *
175
+ * Note: This function can be slower than `minifySync` due to the overhead of spawning a thread.
176
+ */
177
+ export declare function minify(filename: string, sourceText: string, options?: MinifyOptions | undefined | null): Promise<MinifyResult>
178
+
179
+ export interface MinifyOptions {
180
+ /** Use when minifying an ES module. */
181
+ module?: boolean
182
+ compress?: boolean | CompressOptions
183
+ mangle?: boolean | MangleOptions
184
+ codegen?: boolean | CodegenOptions
185
+ sourcemap?: boolean
186
+ }
187
+
188
+ export interface MinifyResult {
189
+ code: string
190
+ map?: SourceMap
191
+ errors: Array<OxcError>
192
+ /**
193
+ * Legal comments extracted from the source code.
194
+ * Only populated when `codegen.legalComments` is `"linked"` or `"external"`.
195
+ */
196
+ legalComments: Array<string>
197
+ }
198
+
199
+ /** Minify synchronously. */
200
+ export declare function minifySync(filename: string, sourceText: string, options?: MinifyOptions | undefined | null): MinifyResult
201
+
202
+ export interface TreeShakeOptions {
203
+ /**
204
+ * Whether to respect the pure annotations.
205
+ *
206
+ * Pure annotations are comments that mark an expression as pure.
207
+ * For example: @__PURE__ or #__NO_SIDE_EFFECTS__.
208
+ *
209
+ * @default true
210
+ */
211
+ annotations?: boolean
212
+ /**
213
+ * Whether to treat this function call as pure.
214
+ *
215
+ * This function is called for normal function calls, new calls, and
216
+ * tagged template calls.
217
+ */
218
+ manualPureFunctions?: Array<string>
219
+ /**
220
+ * Whether property read accesses have side effects.
221
+ *
222
+ * @default 'always'
223
+ */
224
+ propertyReadSideEffects?: boolean | 'always'
225
+ /**
226
+ * Whether property write accesses (assignments to member expressions) have side effects.
227
+ *
228
+ * When false, assignments like `obj.prop = value` are considered side-effect-free
229
+ * (assuming the object and value expressions themselves are side-effect-free).
230
+ *
231
+ * @default true
232
+ */
233
+ propertyWriteSideEffects?: boolean
234
+ /**
235
+ * Whether accessing a global variable has side effects.
236
+ *
237
+ * Accessing a non-existing global variable will throw an error.
238
+ * Global variable may be a getter that has side effects.
239
+ *
240
+ * @default true
241
+ */
242
+ unknownGlobalSideEffects?: boolean
243
+ /**
244
+ * Whether invalid import statements have side effects.
245
+ *
246
+ * Accessing a non-existing import name will throw an error.
247
+ * Also import statements that cannot be resolved will throw an error.
248
+ *
249
+ * @default true
250
+ */
251
+ invalidImportSideEffects?: boolean
252
+ }
253
+ export interface Comment {
254
+ type: 'Line' | 'Block'
255
+ value: string
256
+ start: number
257
+ end: number
258
+ }
259
+
260
+ export interface ErrorLabel {
261
+ message: string | null
262
+ start: number
263
+ end: number
264
+ }
265
+
266
+ export interface OxcError {
267
+ severity: Severity
268
+ message: string
269
+ labels: Array<ErrorLabel>
270
+ helpMessage: string | null
271
+ codeframe: string | null
272
+ }
273
+
274
+ export type Severity = 'Error'|
275
+ 'Warning'|
276
+ 'Advice';
277
+ export declare class ParseResult {
278
+ get program(): import("@oxc-project/types").Program
279
+ get module(): EcmaScriptModule
280
+ get comments(): Array<Comment>
281
+ get errors(): Array<OxcError>
282
+ }
283
+
284
+ export interface DynamicImport {
285
+ start: number
286
+ end: number
287
+ moduleRequest: Span
288
+ }
289
+
290
+ export interface EcmaScriptModule {
291
+ /**
292
+ * Has ESM syntax.
293
+ *
294
+ * i.e. `import` and `export` statements, and `import.meta`.
295
+ *
296
+ * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
297
+ */
298
+ hasModuleSyntax: boolean
299
+ /** Import statements. */
300
+ staticImports: Array<StaticImport>
301
+ /** Export statements. */
302
+ staticExports: Array<StaticExport>
303
+ /** Dynamic import expressions. */
304
+ dynamicImports: Array<DynamicImport>
305
+ /** Span positions` of `import.meta` */
306
+ importMetas: Array<Span>
307
+ }
308
+
309
+ export interface ExportExportName {
310
+ kind: ExportExportNameKind
311
+ name: string | null
312
+ start: number | null
313
+ end: number | null
314
+ }
315
+
316
+ export type ExportExportNameKind = /** `export { name } */
317
+ 'Name'|
318
+ /** `export default expression` */
319
+ 'Default'|
320
+ /** `export * from "mod" */
321
+ 'None';
322
+
323
+ export interface ExportImportName {
324
+ kind: ExportImportNameKind
325
+ name: string | null
326
+ start: number | null
327
+ end: number | null
328
+ }
329
+
330
+ export type ExportImportNameKind = /** `export { name } */
331
+ 'Name'|
332
+ /** `export * as ns from "mod"` */
333
+ 'All'|
334
+ /** `export * from "mod"` */
335
+ 'AllButDefault'|
336
+ /** Does not have a specifier. */
337
+ 'None';
338
+
339
+ export interface ExportLocalName {
340
+ kind: ExportLocalNameKind
341
+ name: string | null
342
+ start: number | null
343
+ end: number | null
344
+ }
345
+
346
+ export type ExportLocalNameKind = /** `export { name } */
347
+ 'Name'|
348
+ /** `export default expression` */
349
+ 'Default'|
350
+ /**
351
+ * If the exported value is not locally accessible from within the module.
352
+ * `export default function () {}`
353
+ */
354
+ 'None';
355
+
356
+ export interface ImportName {
357
+ kind: ImportNameKind
358
+ name: string | null
359
+ start: number | null
360
+ end: number | null
361
+ }
362
+
363
+ export type ImportNameKind = /** `import { x } from "mod"` */
364
+ 'Name'|
365
+ /** `import * as ns from "mod"` */
366
+ 'NamespaceObject'|
367
+ /** `import defaultExport from "mod"` */
368
+ 'Default';
369
+
370
+ /**
371
+ * Parse JS/TS source asynchronously on a separate thread.
372
+ *
373
+ * Note that not all of the workload can happen on a separate thread.
374
+ * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
375
+ * has to happen on current thread. This synchronous deserialization work typically outweighs
376
+ * the asynchronous parsing by a factor of between 3 and 20.
377
+ *
378
+ * i.e. the majority of the workload cannot be parallelized by using this method.
379
+ *
380
+ * Generally `parseSync` is preferable to use as it does not have the overhead of spawning a thread.
381
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads.
382
+ */
383
+ export declare function parse(filename: string, sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>
384
+
385
+ export interface ParserOptions {
386
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */
387
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'
388
+ /** Treat the source text as `script` or `module` code. */
389
+ sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined
390
+ /**
391
+ * Return an AST which includes TypeScript-related properties, or excludes them.
392
+ *
393
+ * `'js'` is default for JS / JSX files.
394
+ * `'ts'` is default for TS / TSX files.
395
+ * The type of the file is determined from `lang` option, or extension of provided `filename`.
396
+ */
397
+ astType?: 'js' | 'ts'
398
+ /**
399
+ * Controls whether the `range` property is included on AST nodes.
400
+ * The `range` property is a `[number, number]` which indicates the start/end offsets
401
+ * of the node in the file contents.
402
+ *
403
+ * @default false
404
+ */
405
+ range?: boolean
406
+ /**
407
+ * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
408
+ *
409
+ * If this option is true, parenthesized expressions are represented by
410
+ * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
411
+ * have a single `expression` property containing the expression inside parentheses.
412
+ *
413
+ * @default true
414
+ */
415
+ preserveParens?: boolean
416
+ /**
417
+ * Produce semantic errors with an additional AST pass.
418
+ * Semantic errors depend on symbols and scopes, where the parser does not construct.
419
+ * This adds a small performance overhead.
420
+ *
421
+ * @default false
422
+ */
423
+ showSemanticErrors?: boolean
424
+ }
425
+
426
+ /**
427
+ * Parse JS/TS source synchronously on current thread.
428
+ *
429
+ * This is generally preferable over `parse` (async) as it does not have the overhead
430
+ * of spawning a thread, and the majority of the workload cannot be parallelized anyway
431
+ * (see `parse` documentation for details).
432
+ *
433
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads
434
+ * with `parseSync` rather than using `parse`.
435
+ */
436
+ export declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): ParseResult
437
+
438
+ /** Returns `true` if raw transfer is supported on this platform. */
439
+ export declare function rawTransferSupported(): boolean
440
+
441
+ export interface Span {
442
+ start: number
443
+ end: number
444
+ }
445
+
446
+ export interface StaticExport {
447
+ start: number
448
+ end: number
449
+ entries: Array<StaticExportEntry>
450
+ }
451
+
452
+ export interface StaticExportEntry {
453
+ start: number
454
+ end: number
455
+ moduleRequest: ValueSpan | null
456
+ /** The name under which the desired binding is exported by the module`. */
457
+ importName: ExportImportName
458
+ /** The name used to export this binding by this module. */
459
+ exportName: ExportExportName
460
+ /** The name that is used to locally access the exported value from within the importing module. */
461
+ localName: ExportLocalName
462
+ /**
463
+ * Whether the export is a TypeScript `export type`.
464
+ *
465
+ * Examples:
466
+ *
467
+ * ```ts
468
+ * export type * from 'mod';
469
+ * export type * as ns from 'mod';
470
+ * export type { foo };
471
+ * export { type foo }:
472
+ * export type { foo } from 'mod';
473
+ * ```
474
+ */
475
+ isType: boolean
476
+ }
477
+
478
+ export interface StaticImport {
479
+ /** Start of import statement. */
480
+ start: number
481
+ /** End of import statement. */
482
+ end: number
483
+ /**
484
+ * Import source.
485
+ *
486
+ * ```js
487
+ * import { foo } from "mod";
488
+ * // ^^^
489
+ * ```
490
+ */
491
+ moduleRequest: ValueSpan
492
+ /**
493
+ * Import specifiers.
494
+ *
495
+ * Empty for `import "mod"`.
496
+ */
497
+ entries: Array<StaticImportEntry>
498
+ }
499
+
500
+ export interface StaticImportEntry {
501
+ /**
502
+ * The name under which the desired binding is exported by the module.
503
+ *
504
+ * ```js
505
+ * import { foo } from "mod";
506
+ * // ^^^
507
+ * import { foo as bar } from "mod";
508
+ * // ^^^
509
+ * ```
510
+ */
511
+ importName: ImportName
512
+ /**
513
+ * The name that is used to locally access the imported value from within the importing module.
514
+ * ```js
515
+ * import { foo } from "mod";
516
+ * // ^^^
517
+ * import { foo as bar } from "mod";
518
+ * // ^^^
519
+ * ```
520
+ */
521
+ localName: ValueSpan
522
+ /**
523
+ * Whether this binding is for a TypeScript type-only import.
524
+ *
525
+ * `true` for the following imports:
526
+ * ```ts
527
+ * import type { foo } from "mod";
528
+ * import { type foo } from "mod";
529
+ * ```
530
+ */
531
+ isType: boolean
532
+ }
533
+
534
+ export interface ValueSpan {
535
+ value: string
536
+ start: number
537
+ end: number
538
+ }
539
+ export declare class ResolverFactory {
540
+ constructor(options?: NapiResolveOptions | undefined | null)
541
+ static default(): ResolverFactory
542
+ /** Clone the resolver using the same underlying cache. */
543
+ cloneWithOptions(options: NapiResolveOptions): ResolverFactory
544
+ /**
545
+ * Clear the underlying cache.
546
+ *
547
+ * Warning: The caller must ensure that there're no ongoing resolution operations when calling this method. Otherwise, it may cause those operations to return an incorrect result.
548
+ */
549
+ clearCache(): void
550
+ /** Synchronously resolve `specifier` at an absolute path to a `directory`. */
551
+ sync(directory: string, request: string): ResolveResult
552
+ /** Asynchronously resolve `specifier` at an absolute path to a `directory`. */
553
+ async(directory: string, request: string): Promise<ResolveResult>
554
+ /**
555
+ * Synchronously resolve `specifier` at an absolute path to a `file`.
556
+ *
557
+ * This method automatically discovers tsconfig.json by traversing parent directories.
558
+ */
559
+ resolveFileSync(file: string, request: string): ResolveResult
560
+ /**
561
+ * Asynchronously resolve `specifier` at an absolute path to a `file`.
562
+ *
563
+ * This method automatically discovers tsconfig.json by traversing parent directories.
564
+ */
565
+ resolveFileAsync(file: string, request: string): Promise<ResolveResult>
566
+ /**
567
+ * Synchronously resolve `specifier` for TypeScript declaration files.
568
+ *
569
+ * `file` is the absolute path to the containing file.
570
+ * Uses TypeScript's `moduleResolution: "bundler"` algorithm.
571
+ */
572
+ resolveDtsSync(file: string, request: string): ResolveResult
573
+ /**
574
+ * Asynchronously resolve `specifier` for TypeScript declaration files.
575
+ *
576
+ * `file` is the absolute path to the containing file.
577
+ * Uses TypeScript's `moduleResolution: "bundler"` algorithm.
578
+ */
579
+ resolveDtsAsync(file: string, request: string): Promise<ResolveResult>
580
+ }
581
+
582
+ /** Node.js builtin module when `Options::builtin_modules` is enabled. */
583
+ export interface Builtin {
584
+ /**
585
+ * Resolved module.
586
+ *
587
+ * Always prefixed with "node:" in compliance with the ESM specification.
588
+ */
589
+ resolved: string
590
+ /**
591
+ * Whether the request was prefixed with `node:` or not.
592
+ * `fs` -> `false`.
593
+ * `node:fs` returns `true`.
594
+ */
595
+ isRuntimeModule: boolean
596
+ }
597
+
598
+ export declare enum EnforceExtension {
599
+ Auto = 0,
600
+ Enabled = 1,
601
+ Disabled = 2
602
+ }
603
+
604
+ export type ModuleType = 'module'|
605
+ 'commonjs'|
606
+ 'json'|
607
+ 'wasm'|
608
+ 'addon';
609
+
610
+ /**
611
+ * Module Resolution Options
612
+ *
613
+ * Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options).
614
+ *
615
+ * See [webpack resolve](https://webpack.js.org/configuration/resolve/) for information and examples
616
+ */
617
+ export interface NapiResolveOptions {
618
+ /**
619
+ * Discover tsconfig automatically or use the specified tsconfig.json path.
620
+ *
621
+ * Default `None`
622
+ */
623
+ tsconfig?: 'auto' | TsconfigOptions
624
+ /**
625
+ * Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
626
+ *
627
+ * For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) ->
628
+ * AliasValue::Path(String)`
629
+ * Create aliases to import or require certain modules more easily.
630
+ * A trailing $ can also be added to the given object's keys to signify an exact match.
631
+ * Default `{}`
632
+ */
633
+ alias?: Record<string, Array<string | undefined | null>>
634
+ /**
635
+ * A list of alias fields in description files.
636
+ * Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec).
637
+ * Can be a path to json object such as `["path", "to", "exports"]`.
638
+ *
639
+ * Default `[]`
640
+ */
641
+ aliasFields?: (string | string[])[]
642
+ /**
643
+ * Condition names for exports field which defines entry points of a package.
644
+ * The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries.
645
+ *
646
+ * Default `[]`
647
+ */
648
+ conditionNames?: Array<string>
649
+ /**
650
+ * If true, it will not allow extension-less files.
651
+ * So by default `require('./foo')` works if `./foo` has a `.js` extension,
652
+ * but with this enabled only `require('./foo.js')` will work.
653
+ *
654
+ * Default to `true` when [ResolveOptions::extensions] contains an empty string.
655
+ * Use `Some(false)` to disable the behavior.
656
+ * See <https://github.com/webpack/enhanced-resolve/pull/285>
657
+ *
658
+ * Default None, which is the same as `Some(false)` when the above empty rule is not applied.
659
+ */
660
+ enforceExtension?: EnforceExtension
661
+ /**
662
+ * A list of exports fields in description files.
663
+ * Can be a path to json object such as `["path", "to", "exports"]`.
664
+ *
665
+ * Default `[["exports"]]`.
666
+ */
667
+ exportsFields?: (string | string[])[]
668
+ /**
669
+ * Fields from `package.json` which are used to provide the internal requests of a package
670
+ * (requests starting with # are considered internal).
671
+ *
672
+ * Can be a path to a JSON object such as `["path", "to", "imports"]`.
673
+ *
674
+ * Default `[["imports"]]`.
675
+ */
676
+ importsFields?: (string | string[])[]
677
+ /**
678
+ * An object which maps extension to extension aliases.
679
+ *
680
+ * Default `{}`
681
+ */
682
+ extensionAlias?: Record<string, Array<string>>
683
+ /**
684
+ * Attempt to resolve these extensions in order.
685
+ * If multiple files share the same name but have different extensions,
686
+ * will resolve the one with the extension listed first in the array and skip the rest.
687
+ *
688
+ * Default `[".js", ".json", ".node"]`
689
+ */
690
+ extensions?: Array<string>
691
+ /**
692
+ * Redirect module requests when normal resolving fails.
693
+ *
694
+ * Default `{}`
695
+ */
696
+ fallback?: Record<string, Array<string | undefined | null>>
697
+ /**
698
+ * 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).
699
+ *
700
+ * See also webpack configuration [resolve.fullySpecified](https://webpack.js.org/configuration/module/#resolvefullyspecified)
701
+ *
702
+ * Default `false`
703
+ */
704
+ fullySpecified?: boolean
705
+ /**
706
+ * A list of main fields in description files
707
+ *
708
+ * Default `["main"]`.
709
+ */
710
+ mainFields?: string | string[]
711
+ /**
712
+ * The filename to be used while resolving directories.
713
+ *
714
+ * Default `["index"]`
715
+ */
716
+ mainFiles?: Array<string>
717
+ /**
718
+ * A list of directories to resolve modules from, can be absolute path or folder name.
719
+ *
720
+ * Default `["node_modules"]`
721
+ */
722
+ modules?: string | string[]
723
+ /**
724
+ * Resolve to a context instead of a file.
725
+ *
726
+ * Default `false`
727
+ */
728
+ resolveToContext?: boolean
729
+ /**
730
+ * Prefer to resolve module requests as relative requests instead of using modules from node_modules directories.
731
+ *
732
+ * Default `false`
733
+ */
734
+ preferRelative?: boolean
735
+ /**
736
+ * Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots.
737
+ *
738
+ * Default `false`
739
+ */
740
+ preferAbsolute?: boolean
741
+ /**
742
+ * A list of resolve restrictions to restrict the paths that a request can be resolved on.
743
+ *
744
+ * Default `[]`
745
+ */
746
+ restrictions?: Array<Restriction>
747
+ /**
748
+ * A list of directories where requests of server-relative URLs (starting with '/') are resolved.
749
+ * On non-Windows systems these requests are resolved as an absolute path first.
750
+ *
751
+ * Default `[]`
752
+ */
753
+ roots?: Array<string>
754
+ /**
755
+ * Whether to resolve symlinks to their symlinked location.
756
+ * When enabled, symlinked resources are resolved to their real path, not their symlinked location.
757
+ * Note that this may cause module resolution to fail when using tools that symlink packages (like npm link).
758
+ *
759
+ * Default `true`
760
+ */
761
+ symlinks?: boolean
762
+ /**
763
+ * Whether to read the `NODE_PATH` environment variable and append its entries to `modules`.
764
+ *
765
+ * `NODE_PATH` is a deprecated Node.js feature that is not part of ESM resolution.
766
+ * Set this to `false` to disable the behavior.
767
+ *
768
+ * Default `true`
769
+ */
770
+ nodePath?: boolean
771
+ /**
772
+ * Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not.
773
+ * For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true.
774
+ *
775
+ * Default `false`
776
+ */
777
+ builtinModules?: boolean
778
+ /**
779
+ * Resolve [ResolveResult::moduleType].
780
+ *
781
+ * Default `false`
782
+ */
783
+ moduleType?: boolean
784
+ /**
785
+ * Allow `exports` field in `require('../directory')`.
786
+ *
787
+ * This is not part of the spec but some vite projects rely on this behavior.
788
+ * See
789
+ * * <https://github.com/vitejs/vite/pull/20252>
790
+ * * <https://github.com/nodejs/node/issues/58827>
791
+ *
792
+ * Default: `false`
793
+ */
794
+ allowPackageExportsInDirectoryResolve?: boolean
795
+ }
796
+
797
+ export interface ResolveResult {
798
+ path?: string
799
+ error?: string
800
+ builtin?: Builtin
801
+ /**
802
+ * Module type for this path.
803
+ *
804
+ * Enable with `ResolveOptions#moduleType`.
805
+ *
806
+ * 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).
807
+ *
808
+ * The algorithm uses the file extension or finds the closest `package.json` with the `type` field.
809
+ */
810
+ moduleType?: ModuleType
811
+ /** `package.json` path for the given module. */
812
+ packageJsonPath?: string
813
+ }
814
+
815
+ /**
816
+ * Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback].
817
+ * Use struct because napi don't support structured union now
818
+ */
819
+ export interface Restriction {
820
+ path?: string
821
+ regex?: string
822
+ }
823
+
824
+ export declare function sync(path: string, request: string): ResolveResult
825
+
826
+ /**
827
+ * Tsconfig Options
828
+ *
829
+ * Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options)
830
+ */
831
+ export interface TsconfigOptions {
832
+ /**
833
+ * Allows you to specify where to find the TypeScript configuration file.
834
+ * You may provide
835
+ * * a relative path to the configuration file. It will be resolved relative to cwd.
836
+ * * an absolute path to the configuration file.
837
+ */
838
+ configFile: string
839
+ /**
840
+ * Support for Typescript Project References.
841
+ *
842
+ * * `'auto'`: use the `references` field from tsconfig of `config_file`.
843
+ */
844
+ references?: 'auto'
845
+ }
846
+ export interface SourceMap {
847
+ file?: string
848
+ mappings: string
849
+ names: Array<string>
850
+ sourceRoot?: string
851
+ sources: Array<string>
852
+ sourcesContent?: Array<string>
853
+ version: number
854
+ x_google_ignoreList?: Array<number>
855
+ }
856
+ export interface ArrowFunctionsOptions {
857
+ /**
858
+ * This option enables the following:
859
+ * * Wrap the generated function in .bind(this) and keeps uses of this inside the function as-is, instead of using a renamed this.
860
+ * * Add a runtime check to ensure the functions are not instantiated.
861
+ * * Add names to arrow functions.
862
+ *
863
+ * @default false
864
+ */
865
+ spec?: boolean
866
+ }
867
+
868
+ export interface CompilerAssumptions {
869
+ ignoreFunctionLength?: boolean
870
+ noDocumentAll?: boolean
871
+ objectRestNoSymbols?: boolean
872
+ pureGetters?: boolean
873
+ /**
874
+ * When using public class fields, assume that they don't shadow any getter in the current class,
875
+ * in its subclasses or in its superclass. Thus, it's safe to assign them rather than using
876
+ * `Object.defineProperty`.
877
+ *
878
+ * For example:
879
+ *
880
+ * Input:
881
+ * ```js
882
+ * class Test {
883
+ * field = 2;
884
+ *
885
+ * static staticField = 3;
886
+ * }
887
+ * ```
888
+ *
889
+ * When `set_public_class_fields` is `true`, the output will be:
890
+ * ```js
891
+ * class Test {
892
+ * constructor() {
893
+ * this.field = 2;
894
+ * }
895
+ * }
896
+ * Test.staticField = 3;
897
+ * ```
898
+ *
899
+ * Otherwise, the output will be:
900
+ * ```js
901
+ * import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
902
+ * class Test {
903
+ * constructor() {
904
+ * _defineProperty(this, "field", 2);
905
+ * }
906
+ * }
907
+ * _defineProperty(Test, "staticField", 3);
908
+ * ```
909
+ *
910
+ * NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should
911
+ * set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`]
912
+ * to `true`.
913
+ */
914
+ setPublicClassFields?: boolean
915
+ }
916
+
917
+ export interface DecoratorOptions {
918
+ /**
919
+ * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
920
+ *
921
+ * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
922
+ * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
923
+ *
924
+ * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
925
+ * @default false
926
+ */
927
+ legacy?: boolean
928
+ /**
929
+ * Enables emitting decorator metadata.
930
+ *
931
+ * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
932
+ * in TypeScript, and it only works when `legacy` is true.
933
+ *
934
+ * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
935
+ * @default false
936
+ */
937
+ emitDecoratorMetadata?: boolean
938
+ /**
939
+ * Aligns nullable-union `design:type` emission with `--strictNullChecks`.
940
+ *
941
+ * When `true` (default), `T | null` and `T | undefined` emit `Object`, matching tsc strict.
942
+ * When `false`, `null` and `undefined` are elided from the union so the underlying
943
+ * primitive constructor is emitted, matching tsc with `--strictNullChecks=false`
944
+ * and `babel-plugin-transform-typescript-metadata`.
945
+ *
946
+ * @see https://www.typescriptlang.org/tsconfig/#strictNullChecks
947
+ * @default true
948
+ */
949
+ strictNullChecks?: boolean
950
+ }
951
+
952
+ export interface Es2015Options {
953
+ /** Transform arrow functions into function expressions. */
954
+ arrowFunction?: ArrowFunctionsOptions
955
+ }
956
+
957
+ export type HelperMode = /**
958
+ * Runtime mode (default): Helper functions are imported from a runtime package.
959
+ *
960
+ * Example:
961
+ *
962
+ * ```js
963
+ * import helperName from "@oxc-project/runtime/helpers/helperName";
964
+ * helperName(...arguments);
965
+ * ```
966
+ */
967
+ 'Runtime'|
968
+ /**
969
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
970
+ *
971
+ * Example:
972
+ *
973
+ * ```js
974
+ * babelHelpers.helperName(...arguments);
975
+ * ```
976
+ */
977
+ 'External';
978
+
979
+ export interface Helpers {
980
+ mode?: HelperMode
981
+ }
982
+
983
+ /**
984
+ * TypeScript Isolated Declarations for Standalone DTS Emit (async)
985
+ *
986
+ * Note: This function can be slower than `isolatedDeclarationSync` due to the overhead of spawning a thread.
987
+ */
988
+ export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): Promise<IsolatedDeclarationsResult>
989
+
990
+ export interface IsolatedDeclarationsOptions {
991
+ /**
992
+ * Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
993
+ * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
994
+ *
995
+ * Default: `false`
996
+ *
997
+ * See <https://www.typescriptlang.org/tsconfig/#stripInternal>
998
+ */
999
+ stripInternal?: boolean
1000
+ sourcemap?: boolean
1001
+ }
1002
+
1003
+ export interface IsolatedDeclarationsResult {
1004
+ code: string
1005
+ map?: SourceMap
1006
+ errors: Array<OxcError>
1007
+ }
1008
+
1009
+ /** TypeScript Isolated Declarations for Standalone DTS Emit */
1010
+ export declare function isolatedDeclarationSync(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
1011
+
1012
+ /**
1013
+ * Configure how TSX and JSX are transformed.
1014
+ *
1015
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
1016
+ */
1017
+ export interface JsxOptions {
1018
+ /**
1019
+ * Decides which runtime to use.
1020
+ *
1021
+ * - 'automatic' - auto-import the correct JSX factories
1022
+ * - 'classic' - no auto-import
1023
+ *
1024
+ * @default 'automatic'
1025
+ */
1026
+ runtime?: 'classic' | 'automatic'
1027
+ /**
1028
+ * Emit development-specific information, such as `__source` and `__self`.
1029
+ *
1030
+ * @default false
1031
+ */
1032
+ development?: boolean
1033
+ /**
1034
+ * Toggles whether or not to throw an error if an XML namespaced tag name
1035
+ * is used.
1036
+ *
1037
+ * Though the JSX spec allows this, it is disabled by default since React's
1038
+ * JSX does not currently have support for it.
1039
+ *
1040
+ * @default true
1041
+ */
1042
+ throwIfNamespace?: boolean
1043
+ /**
1044
+ * Mark JSX elements and top-level React method calls as pure for tree shaking.
1045
+ *
1046
+ * @default true
1047
+ */
1048
+ pure?: boolean
1049
+ /**
1050
+ * Replaces the import source when importing functions.
1051
+ *
1052
+ * @default 'react'
1053
+ */
1054
+ importSource?: string
1055
+ /**
1056
+ * Replace the function used when compiling JSX expressions. It should be a
1057
+ * qualified name (e.g. `React.createElement`) or an identifier (e.g.
1058
+ * `createElement`).
1059
+ *
1060
+ * Only used for `classic` {@link runtime}.
1061
+ *
1062
+ * @default 'React.createElement'
1063
+ */
1064
+ pragma?: string
1065
+ /**
1066
+ * Replace the component used when compiling JSX fragments. It should be a
1067
+ * valid JSX tag name.
1068
+ *
1069
+ * Only used for `classic` {@link runtime}.
1070
+ *
1071
+ * @default 'React.Fragment'
1072
+ */
1073
+ pragmaFrag?: string
1074
+ /**
1075
+ * Enable React Fast Refresh .
1076
+ *
1077
+ * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
1078
+ *
1079
+ * @default false
1080
+ */
1081
+ refresh?: boolean | ReactRefreshOptions
1082
+ }
1083
+
1084
+ /**
1085
+ * Transform JavaScript code to a Vite Node runnable module.
1086
+ *
1087
+ * @param filename The name of the file being transformed.
1088
+ * @param sourceText the source code itself
1089
+ * @param options The options for the transformation. See {@link
1090
+ * ModuleRunnerTransformOptions} for more information.
1091
+ *
1092
+ * @returns an object containing the transformed code, source maps, and any
1093
+ * errors that occurred during parsing or transformation.
1094
+ *
1095
+ * Note: This function can be slower than `moduleRunnerTransformSync` due to the overhead of spawning a thread.
1096
+ *
1097
+ * @deprecated Only works for Vite.
1098
+ */
1099
+ export declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): Promise<ModuleRunnerTransformResult>
1100
+
1101
+ export interface ModuleRunnerTransformOptions {
1102
+ /**
1103
+ * Enable source map generation.
1104
+ *
1105
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
1106
+ *
1107
+ * @default false
1108
+ *
1109
+ * @see {@link SourceMap}
1110
+ */
1111
+ sourcemap?: boolean
1112
+ }
1113
+
1114
+ export interface ModuleRunnerTransformResult {
1115
+ /**
1116
+ * The transformed code.
1117
+ *
1118
+ * If parsing failed, this will be an empty string.
1119
+ */
1120
+ code: string
1121
+ /**
1122
+ * The source map for the transformed code.
1123
+ *
1124
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
1125
+ */
1126
+ map?: SourceMap
1127
+ deps: Array<string>
1128
+ dynamicDeps: Array<string>
1129
+ /**
1130
+ * Parse and transformation errors.
1131
+ *
1132
+ * Oxc's parser recovers from common syntax errors, meaning that
1133
+ * transformed code may still be available even if there are errors in this
1134
+ * list.
1135
+ */
1136
+ errors: Array<OxcError>
1137
+ }
1138
+
1139
+ /** @deprecated Only works for Vite. */
1140
+ export declare function moduleRunnerTransformSync(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): ModuleRunnerTransformResult
1141
+
1142
+ export interface PluginsOptions {
1143
+ styledComponents?: StyledComponentsOptions
1144
+ taggedTemplateEscape?: boolean
1145
+ }
1146
+
1147
+ export interface ReactRefreshOptions {
1148
+ /**
1149
+ * Specify the identifier of the refresh registration variable.
1150
+ *
1151
+ * @default `$RefreshReg$`.
1152
+ */
1153
+ refreshReg?: string
1154
+ /**
1155
+ * Specify the identifier of the refresh signature variable.
1156
+ *
1157
+ * @default `$RefreshSig$`.
1158
+ */
1159
+ refreshSig?: string
1160
+ emitFullSignatures?: boolean
1161
+ }
1162
+
1163
+ /**
1164
+ * Configure how styled-components are transformed.
1165
+ *
1166
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins#styled-components}
1167
+ */
1168
+ export interface StyledComponentsOptions {
1169
+ /**
1170
+ * Enhances the attached CSS class name on each component with richer output to help
1171
+ * identify your components in the DOM without React DevTools.
1172
+ *
1173
+ * @default true
1174
+ */
1175
+ displayName?: boolean
1176
+ /**
1177
+ * Controls whether the `displayName` of a component will be prefixed with the filename
1178
+ * to make the component name as unique as possible.
1179
+ *
1180
+ * @default true
1181
+ */
1182
+ fileName?: boolean
1183
+ /**
1184
+ * Adds a unique identifier to every styled component to avoid checksum mismatches
1185
+ * due to different class generation on the client and server during server-side rendering.
1186
+ *
1187
+ * @default true
1188
+ */
1189
+ ssr?: boolean
1190
+ /**
1191
+ * Transpiles styled-components tagged template literals to a smaller representation
1192
+ * than what Babel normally creates, helping to reduce bundle size.
1193
+ *
1194
+ * Disabled by default because Oxc does not down-level template literals, so this
1195
+ * transform only increases output size.
1196
+ *
1197
+ * @default false
1198
+ */
1199
+ transpileTemplateLiterals?: boolean
1200
+ /**
1201
+ * Minifies CSS content by removing all whitespace and comments from your CSS,
1202
+ * keeping valuable bytes out of your bundles.
1203
+ *
1204
+ * @default true
1205
+ */
1206
+ minify?: boolean
1207
+ /**
1208
+ * Enables transformation of JSX `css` prop when using styled-components.
1209
+ *
1210
+ * **Note: This feature is not yet implemented in oxc.**
1211
+ *
1212
+ * @default true
1213
+ */
1214
+ cssProp?: boolean
1215
+ /**
1216
+ * Enables "pure annotation" to aid dead code elimination by bundlers.
1217
+ *
1218
+ * @default false
1219
+ */
1220
+ pure?: boolean
1221
+ /**
1222
+ * Adds a namespace prefix to component identifiers to ensure class names are unique.
1223
+ *
1224
+ * Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"`
1225
+ */
1226
+ namespace?: string
1227
+ /**
1228
+ * List of file names that are considered meaningless for component naming purposes.
1229
+ *
1230
+ * When the `fileName` option is enabled and a component is in a file with a name
1231
+ * from this list, the directory name will be used instead of the file name for
1232
+ * the component's display name.
1233
+ *
1234
+ * @default `["index"]`
1235
+ */
1236
+ meaninglessFileNames?: Array<string>
1237
+ /**
1238
+ * Import paths to be considered as styled-components imports at the top level.
1239
+ *
1240
+ * **Note: This feature is not yet implemented in oxc.**
1241
+ */
1242
+ topLevelImportPaths?: Array<string>
1243
+ }
1244
+
1245
+ /**
1246
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
1247
+ *
1248
+ * Note: This function can be slower than `transform` due to the overhead of spawning a thread.
1249
+ *
1250
+ * @param filename The name of the file being transformed. If this is a
1251
+ * relative path, consider setting the {@link TransformOptions#cwd} option.
1252
+ * @param sourceText the source code itself
1253
+ * @param options The options for the transformation. See {@link
1254
+ * TransformOptions} for more information.
1255
+ *
1256
+ * @returns a promise that resolves to an object containing the transformed code,
1257
+ * source maps, and any errors that occurred during parsing or transformation.
1258
+ */
1259
+ export declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): Promise<TransformResult>
1260
+
1261
+ /**
1262
+ * Options for transforming a JavaScript or TypeScript file.
1263
+ *
1264
+ * Options are listed in evaluation order: the source is parsed (`lang`,
1265
+ * `sourceType`), declarations are emitted (`typescript.declaration`), then
1266
+ * transforms run (`typescript`, `decorator`, `plugins`,
1267
+ * `jsx`, `target`), followed by the `inject` and `define` plugins, and
1268
+ * finally codegen (`sourcemap`). `helpers` configures the runtime helpers
1269
+ * the transforms emit.
1270
+ *
1271
+ * @see {@link transform}
1272
+ */
1273
+ export interface TransformOptions {
1274
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */
1275
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'
1276
+ /** Treat the source text as `script` or `module` code. */
1277
+ sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined
1278
+ /**
1279
+ * The current working directory. Used to resolve relative paths in other
1280
+ * options.
1281
+ */
1282
+ cwd?: string
1283
+ /** Set assumptions in order to produce smaller output. */
1284
+ assumptions?: CompilerAssumptions
1285
+ /**
1286
+ * Configure how TypeScript is transformed.
1287
+ *
1288
+ * `typescript.declaration` is evaluated before all transforms.
1289
+ *
1290
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
1291
+ */
1292
+ typescript?: TypeScriptOptions
1293
+ /** Decorator plugin */
1294
+ decorator?: DecoratorOptions
1295
+ /**
1296
+ * Third-party plugins to use.
1297
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
1298
+ */
1299
+ plugins?: PluginsOptions
1300
+ /**
1301
+ * Configure how TSX and JSX are transformed.
1302
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
1303
+ */
1304
+ jsx?: 'preserve' | JsxOptions
1305
+ /**
1306
+ * Sets the target environment for the generated JavaScript.
1307
+ *
1308
+ * The lowest target is `es2015`.
1309
+ *
1310
+ * Example:
1311
+ *
1312
+ * * `'es2015'`
1313
+ * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
1314
+ *
1315
+ * @default `esnext` (No transformation)
1316
+ *
1317
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target}
1318
+ */
1319
+ target?: string | Array<string>
1320
+ /** Behaviour for runtime helpers. */
1321
+ helpers?: Helpers
1322
+ /**
1323
+ * Inject Plugin
1324
+ *
1325
+ * Runs after all transforms.
1326
+ *
1327
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
1328
+ */
1329
+ inject?: Record<string, string | [string, string]>
1330
+ /**
1331
+ * Define Plugin
1332
+ *
1333
+ * Runs after the inject plugin.
1334
+ *
1335
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
1336
+ */
1337
+ define?: Record<string, string>
1338
+ /**
1339
+ * Enable source map generation.
1340
+ *
1341
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
1342
+ *
1343
+ * @default false
1344
+ *
1345
+ * @see {@link SourceMap}
1346
+ */
1347
+ sourcemap?: boolean
1348
+ }
1349
+
1350
+ export interface TransformResult {
1351
+ /**
1352
+ * The transformed code.
1353
+ *
1354
+ * If parsing failed, this will be an empty string.
1355
+ */
1356
+ code: string
1357
+ /**
1358
+ * The source map for the transformed code.
1359
+ *
1360
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
1361
+ */
1362
+ map?: SourceMap
1363
+ /**
1364
+ * The `.d.ts` declaration file for the transformed code. Declarations are
1365
+ * only generated if `declaration` is set to `true` and a TypeScript file
1366
+ * is provided.
1367
+ *
1368
+ * If parsing failed and `declaration` is set, this will be an empty string.
1369
+ *
1370
+ * @see {@link TypeScriptOptions#declaration}
1371
+ * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
1372
+ */
1373
+ declaration?: string
1374
+ /**
1375
+ * Declaration source map. Only generated if both
1376
+ * {@link TypeScriptOptions#declaration declaration} and
1377
+ * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
1378
+ */
1379
+ declarationMap?: SourceMap
1380
+ /**
1381
+ * Helpers used.
1382
+ *
1383
+ * @internal
1384
+ *
1385
+ * Example:
1386
+ *
1387
+ * ```text
1388
+ * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
1389
+ * ```
1390
+ */
1391
+ helpersUsed: Record<string, string>
1392
+ /**
1393
+ * Parse and transformation errors.
1394
+ *
1395
+ * Oxc's parser recovers from common syntax errors, meaning that
1396
+ * transformed code may still be available even if there are errors in this
1397
+ * list.
1398
+ */
1399
+ errors: Array<OxcError>
1400
+ }
1401
+
1402
+ /**
1403
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
1404
+ *
1405
+ * @param filename The name of the file being transformed. If this is a
1406
+ * relative path, consider setting the {@link TransformOptions#cwd} option..
1407
+ * @param sourceText the source code itself
1408
+ * @param options The options for the transformation. See {@link
1409
+ * TransformOptions} for more information.
1410
+ *
1411
+ * @returns an object containing the transformed code, source maps, and any
1412
+ * errors that occurred during parsing or transformation.
1413
+ */
1414
+ export declare function transformSync(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult
1415
+
1416
+ export interface TypeScriptOptions {
1417
+ jsxPragma?: string
1418
+ jsxPragmaFrag?: string
1419
+ onlyRemoveTypeImports?: boolean
1420
+ allowNamespaces?: boolean
1421
+ /**
1422
+ * When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:
1423
+ *
1424
+ * @deprecated
1425
+ *
1426
+ * Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields
1427
+ * without initializer, you can use `remove_class_fields_without_initializer: true` instead.
1428
+ */
1429
+ allowDeclareFields?: boolean
1430
+ /**
1431
+ * When enabled, class fields without initializers are removed.
1432
+ *
1433
+ * For example:
1434
+ * ```ts
1435
+ * class Foo {
1436
+ * x: number;
1437
+ * y: number = 0;
1438
+ * }
1439
+ * ```
1440
+ * // transform into
1441
+ * ```js
1442
+ * class Foo {
1443
+ * x: number;
1444
+ * }
1445
+ * ```
1446
+ *
1447
+ * The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option.
1448
+ * When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`]
1449
+ * to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is
1450
+ * equivalent to `useDefineForClassFields: false` in TypeScript.
1451
+ *
1452
+ * When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into:
1453
+ *
1454
+ * ```js
1455
+ * class Foo {
1456
+ * constructor() {
1457
+ * this.y = 0;
1458
+ * }
1459
+ * }
1460
+ * ```
1461
+ *
1462
+ * Defaults to `false`.
1463
+ */
1464
+ removeClassFieldsWithoutInitializer?: boolean
1465
+ /**
1466
+ * When true, optimize const enums by inlining their values at usage sites
1467
+ * and removing the enum declaration.
1468
+ *
1469
+ * @default false
1470
+ */
1471
+ optimizeConstEnums?: boolean
1472
+ /**
1473
+ * When true, optimize regular (non-const) enums by inlining their member
1474
+ * accesses at usage sites when the member value is statically known.
1475
+ *
1476
+ * Non-exported enum declarations are also removed when all members are
1477
+ * evaluable and no references to the enum as a runtime value exist
1478
+ * (e.g., `console.log(Foo)`, `typeof Foo`, or passing the enum as an argument).
1479
+ *
1480
+ * @default false
1481
+ */
1482
+ optimizeEnums?: boolean
1483
+ /**
1484
+ * Also generate a `.d.ts` declaration file for TypeScript files.
1485
+ *
1486
+ * The source file must be compliant with all
1487
+ * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
1488
+ * requirements.
1489
+ *
1490
+ * @default false
1491
+ */
1492
+ declaration?: IsolatedDeclarationsOptions
1493
+ /**
1494
+ * Rewrite or remove TypeScript import/export declaration extensions.
1495
+ *
1496
+ * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
1497
+ * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
1498
+ * - When set to `true`, it's equivalent to `rewrite`.
1499
+ * - When set to `false` or omitted, no changes will be made to the extensions.
1500
+ *
1501
+ * @default false
1502
+ */
1503
+ rewriteImportExtensions?: 'rewrite' | 'remove' | boolean
1504
+ }
1505
+ export declare class BindingBundleEndEventData {
1506
+ output: string
1507
+ duration: number
1508
+ get result(): BindingWatcherBundler
1509
+ }
1510
+
1511
+ export declare class BindingBundleErrorEventData {
1512
+ get result(): BindingWatcherBundler
1513
+ get error(): Array<BindingError>
1514
+ }
1515
+
1516
+ export declare class BindingBundler {
1517
+ constructor()
1518
+ generate(options: BindingBundlerOptions): Promise<BindingResult<BindingOutputs>>
1519
+ write(options: BindingBundlerOptions): Promise<BindingResult<BindingOutputs>>
1520
+ scan(options: BindingBundlerOptions): Promise<BindingResult<undefined>>
1521
+ close(): Promise<undefined>
1522
+ get closed(): boolean
1523
+ getWatchFiles(): Array<string>
1524
+ }
1525
+
1526
+ export declare class BindingCallableBuiltinPlugin {
1527
+ constructor(plugin: BindingBuiltinPlugin)
1528
+ getOrder(hookName: string): string | null
1529
+ resolveId(id: string, importer?: string | undefined | null, options?: BindingHookJsResolveIdOptions | undefined | null): Promise<BindingHookJsResolveIdOutput | undefined | null>
1530
+ load(id: string): Promise<BindingHookJsLoadOutput | undefined | null>
1531
+ transform(code: string, id: string, options: BindingTransformHookExtraArgs): Promise<BindingHookTransformOutput | undefined | null>
1532
+ watchChange(path: string, event: BindingJsWatchChangeEvent): Promise<undefined>
1533
+ }
1534
+
1535
+ export declare class BindingChunkingContext {
1536
+ getModuleInfo(moduleId: string): BindingModuleInfo | null
1537
+ }
1538
+
1539
+ /** A decoded source map with mappings as an array of arrays instead of VLQ-encoded string. */
1540
+ export declare class BindingDecodedMap {
1541
+ /** The source map version (always 3). */
1542
+ get version(): number
1543
+ /** The generated file name. */
1544
+ get file(): string | null
1545
+ /** The list of original source files. */
1546
+ get sources(): Array<string>
1547
+ /** The original source contents (if `includeContent` was true). */
1548
+ get sourcesContent(): Array<string | undefined | null>
1549
+ /** The list of symbol names used in mappings. */
1550
+ get names(): Array<string>
1551
+ /**
1552
+ * The decoded mappings as an array of line arrays.
1553
+ * Each line is an array of segments, where each segment is [generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex?].
1554
+ */
1555
+ get mappings(): Array<Array<Array<number>>>
1556
+ /** The list of source indices that should be excluded from debugging. */
1557
+ get x_google_ignoreList(): Array<number> | null
1558
+ }
1559
+
1560
+ export declare class BindingDevEngine {
1561
+ constructor(options: BindingBundlerOptions, devOptions?: BindingDevOptions | undefined | null)
1562
+ run(): Promise<void>
1563
+ ensureCurrentBuildFinish(): Promise<void>
1564
+ getBundleState(): Promise<BindingBundleState>
1565
+ ensureLatestBuildOutput(): Promise<BindingResult<undefined>>
1566
+ triggerFullBuild(): void
1567
+ /**
1568
+ * Client-connect signal (the clientId hello): creates the per-client session
1569
+ * with an empty ship map. Reconnects arrive as fresh clientIds.
1570
+ */
1571
+ registerClient(clientId: string): Promise<void>
1572
+ /**
1573
+ * Delivery notification from the serving middleware: the response for
1574
+ * `filename` completed, so record its modules as shipped to that client.
1575
+ */
1576
+ notifyPayloadDelivered(filename: string): Promise<void>
1577
+ removeClient(clientId: string): Promise<void>
1578
+ close(): Promise<void>
1579
+ /**
1580
+ * Compile a lazy entry module and return HMR-style patch code.
1581
+ *
1582
+ * This is called when a dynamically imported module is first requested at runtime.
1583
+ * The module was previously stubbed with a proxy, and now we need to compile the
1584
+ * actual module and its dependencies.
1585
+ */
1586
+ compileEntry(moduleId: string, clientId: string): Promise<BindingLazyChunkOutput>
1587
+ }
1588
+
1589
+ export declare class BindingLoadPluginContext {
1590
+ inner(): BindingPluginContext
1591
+ addWatchFile(file: string): void
1592
+ }
1593
+
1594
+ export declare class BindingMagicString {
1595
+ constructor(source: string, options?: BindingMagicStringOptions | undefined | null)
1596
+ get original(): string
1597
+ get filename(): string | null
1598
+ get indentExclusionRanges(): Array<Array<number>> | Array<number> | null
1599
+ get ignoreList(): boolean
1600
+ get offset(): number
1601
+ set offset(offset: number)
1602
+ replace(from: string, to: string): this
1603
+ replaceAll(from: string, to: string): this
1604
+ /**
1605
+ * Returns the UTF-16 offset past the last match, or -1 if no match was found.
1606
+ * The JS wrapper uses this to update `lastIndex` on the caller's RegExp.
1607
+ * Global/sticky behavior is derived from the regex's own flags.
1608
+ */
1609
+ replaceRegex(from: RegExp, to: string): number
1610
+ prepend(content: string): this
1611
+ append(content: string): this
1612
+ prependLeft(index: number, content: string): this
1613
+ prependRight(index: number, content: string): this
1614
+ appendLeft(index: number, content: string): this
1615
+ appendRight(index: number, content: string): this
1616
+ overwrite(start: number, end: number, content: string, options?: BindingOverwriteOptions | undefined | null): this
1617
+ toString(): string
1618
+ hasChanged(): boolean
1619
+ length(): number
1620
+ isEmpty(): boolean
1621
+ remove(start: number, end: number): this
1622
+ update(start: number, end: number, content: string, options?: BindingUpdateOptions | undefined | null): this
1623
+ relocate(start: number, end: number, to: number): this
1624
+ /**
1625
+ * Alias for `relocate` to match the original magic-string API.
1626
+ * Moves the characters from `start` to `end` to `index`.
1627
+ * Returns `this` for method chaining.
1628
+ */
1629
+ move(start: number, end: number, index: number): this
1630
+ indent(indentor?: string | undefined | null, options?: BindingIndentOptions | undefined | null): this
1631
+ /** Trims whitespace or specified characters from the start and end. */
1632
+ trim(charType?: string | undefined | null): this
1633
+ /** Trims whitespace or specified characters from the start. */
1634
+ trimStart(charType?: string | undefined | null): this
1635
+ /** Trims whitespace or specified characters from the end. */
1636
+ trimEnd(charType?: string | undefined | null): this
1637
+ /** Trims newlines from the start and end. */
1638
+ trimLines(): this
1639
+ /**
1640
+ * Deprecated method that throws an error directing users to use prependRight or appendLeft.
1641
+ * This matches the original magic-string API which deprecated this method.
1642
+ */
1643
+ insert(index: number, content: string): void
1644
+ /** Returns a clone of the MagicString instance. */
1645
+ clone(): BindingMagicString
1646
+ /** Returns the last character of the generated string, or an empty string if empty. */
1647
+ lastChar(): string
1648
+ /** Returns the content after the last newline in the generated string. */
1649
+ lastLine(): string
1650
+ /** Returns the guessed indentation string, or `\t` if none is found. */
1651
+ getIndentString(): string
1652
+ /** Returns a clone with content outside the specified range removed. */
1653
+ snip(start: number, end: number): BindingMagicString
1654
+ /**
1655
+ * Resets the portion of the string from `start` to `end` to its original content.
1656
+ * This undoes any modifications made to that range.
1657
+ * Supports negative indices (counting from the end).
1658
+ */
1659
+ reset(start: number, end: number): this
1660
+ /**
1661
+ * Returns the content between the specified UTF-16 code unit positions (JS string indices).
1662
+ * Supports negative indices (counting from the end).
1663
+ *
1664
+ * When an index falls in the middle of a surrogate pair, the lone surrogate is
1665
+ * included in the result (matching the original magic-string / JS behavior).
1666
+ * This is done by returning a UTF-16 encoded JS string via `napi_create_string_utf16`.
1667
+ */
1668
+ slice(start?: number | undefined | null, end?: number | undefined | null): string
1669
+ /**
1670
+ * Generates a source map for the transformations applied to this MagicString.
1671
+ * Returns a BindingSourceMap object with version, file, sources, sourcesContent, names, mappings.
1672
+ */
1673
+ generateMap(options?: BindingSourceMapOptions | undefined | null): BindingSourceMap
1674
+ /**
1675
+ * Generates a decoded source map for the transformations applied to this MagicString.
1676
+ * Returns a BindingDecodedMap object with mappings as an array of arrays.
1677
+ */
1678
+ generateDecodedMap(options?: BindingSourceMapOptions | undefined | null): BindingDecodedMap
1679
+ }
1680
+
1681
+ export declare class BindingModuleInfo {
1682
+ id: string
1683
+ importers: Array<string>
1684
+ dynamicImporters: Array<string>
1685
+ importedIds: Array<string>
1686
+ dynamicallyImportedIds: Array<string>
1687
+ exports: Array<string>
1688
+ isEntry: boolean
1689
+ inputFormat: 'es' | 'cjs' | 'unknown'
1690
+ get code(): string | null
1691
+ }
1692
+
1693
+ export declare class BindingNormalizedOptions {
1694
+ get input(): Array<string> | Record<string, string>
1695
+ get cwd(): string
1696
+ get platform(): 'node' | 'browser' | 'neutral'
1697
+ get shimMissingExports(): boolean
1698
+ get name(): string | null
1699
+ get entryFilenames(): string | undefined
1700
+ get chunkFilenames(): string | undefined
1701
+ get sourcemapFilenames(): string | undefined
1702
+ get assetFilenames(): string | undefined
1703
+ get dir(): string | null
1704
+ get file(): string | null
1705
+ get format(): 'es' | 'cjs' | 'iife' | 'umd'
1706
+ get exports(): 'default' | 'named' | 'none' | 'auto'
1707
+ get esModule(): boolean | 'if-default-prop'
1708
+ get codeSplitting(): boolean
1709
+ get dynamicImportInCjs(): boolean
1710
+ get sourcemap(): boolean | 'inline' | 'hidden'
1711
+ get sourcemapBaseUrl(): string | null
1712
+ get banner(): string | undefined | null | undefined
1713
+ get footer(): string | undefined | null | undefined
1714
+ get intro(): string | undefined | null | undefined
1715
+ get outro(): string | undefined | null | undefined
1716
+ get postBanner(): string | undefined | null | undefined
1717
+ get postFooter(): string | undefined | null | undefined
1718
+ get externalLiveBindings(): boolean
1719
+ get extend(): boolean
1720
+ get globals(): Record<string, string> | undefined
1721
+ get hashCharacters(): 'base64' | 'base36' | 'hex'
1722
+ get sourcemapDebugIds(): boolean
1723
+ get sourcemapExcludeSources(): boolean
1724
+ get polyfillRequire(): boolean
1725
+ get minify(): false | 'dce-only' | MinifyOptions
1726
+ get legalComments(): 'none' | 'inline'
1727
+ get comments(): BindingCommentsOptions
1728
+ get preserveModules(): boolean
1729
+ get preserveModulesRoot(): string | undefined
1730
+ get virtualDirname(): string
1731
+ get topLevelVar(): boolean
1732
+ get minifyInternalExports(): boolean
1733
+ get context(): string
1734
+ }
1735
+
1736
+ export declare class BindingOutputAsset {
1737
+ dropInner(): ExternalMemoryStatus
1738
+ getFileName(): string
1739
+ getOriginalFileName(): string | null
1740
+ getOriginalFileNames(): Array<string>
1741
+ getSource(): BindingAssetSource
1742
+ getName(): string | null
1743
+ getNames(): Array<string>
1744
+ }
1745
+
1746
+ export declare class BindingOutputChunk {
1747
+ dropInner(): ExternalMemoryStatus
1748
+ getIsEntry(): boolean
1749
+ getIsDynamicEntry(): boolean
1750
+ getFacadeModuleId(): string | null
1751
+ getModuleIds(): Array<string>
1752
+ getExports(): Array<string>
1753
+ getFileName(): string
1754
+ getModules(): BindingModules
1755
+ getImports(): Array<string>
1756
+ getDynamicImports(): Array<string>
1757
+ getCode(): string
1758
+ getMap(): string | null
1759
+ getSourcemapFileName(): string | null
1760
+ getPreliminaryFileName(): string
1761
+ getName(): string
1762
+ }
1763
+
1764
+ export declare class BindingPluginContext {
1765
+ load(specifier: string, sideEffects: boolean | 'no-treeshake' | undefined, packageJsonPath?: string): Promise<void>
1766
+ resolve(specifier: string, importer?: string | undefined | null, extraOptions?: BindingPluginContextResolveOptions | undefined | null): Promise<BindingPluginContextResolvedId | null>
1767
+ emitFile(file: BindingEmittedAsset, assetFilename?: string | undefined | null, fnSanitizedFileName?: string | undefined | null): string
1768
+ emitChunk(file: BindingEmittedChunk): string
1769
+ emitPrebuiltChunk(file: BindingEmittedPrebuiltChunk): string
1770
+ getFileName(referenceId: string): string
1771
+ getModuleInfo(moduleId: string): BindingModuleInfo | null
1772
+ getModuleIds(): Array<string>
1773
+ addWatchFile(file: string): void
1774
+ }
1775
+
1776
+ export declare class BindingRenderedChunk {
1777
+ get name(): string
1778
+ get isEntry(): boolean
1779
+ get isDynamicEntry(): boolean
1780
+ get facadeModuleId(): string | null
1781
+ get moduleIds(): Array<string>
1782
+ get exports(): Array<string>
1783
+ get fileName(): string
1784
+ get modules(): BindingModules
1785
+ get imports(): Array<string>
1786
+ get dynamicImports(): Array<string>
1787
+ }
1788
+
1789
+ export declare class BindingRenderedChunkMeta {
1790
+ get chunks(): Record<string, BindingRenderedChunk>
1791
+ }
1792
+
1793
+ export declare class BindingRenderedModule {
1794
+ get code(): string | null
1795
+ get renderedExports(): Array<string>
1796
+ }
1797
+
1798
+ /** A source map object with properties matching the SourceMap V3 specification. */
1799
+ export declare class BindingSourceMap {
1800
+ /** The source map version (always 3). */
1801
+ get version(): number
1802
+ /** The generated file name. */
1803
+ get file(): string | null
1804
+ /** The list of original source files. */
1805
+ get sources(): Array<string>
1806
+ /** The original source contents (if `includeContent` was true). */
1807
+ get sourcesContent(): Array<string | undefined | null>
1808
+ /** The list of symbol names used in mappings. */
1809
+ get names(): Array<string>
1810
+ /** The VLQ-encoded mappings string. */
1811
+ get mappings(): string
1812
+ /** The list of source indices that should be excluded from debugging. */
1813
+ get x_google_ignoreList(): Array<number> | null
1814
+ /** Returns the source map as a JSON string. */
1815
+ toString(): string
1816
+ /** Returns the source map as a base64-encoded data URL. */
1817
+ toUrl(): string
1818
+ }
1819
+
1820
+ export declare class BindingTransformPluginContext {
1821
+ getCombinedSourcemap(): string
1822
+ inner(): BindingPluginContext
1823
+ addWatchFile(file: string): void
1824
+ sendMagicString(magicString: BindingMagicString): string | null
1825
+ }
1826
+
1827
+ export declare class BindingWatcher {
1828
+ constructor(options: BindingBundlerOptions[], listener: (data: BindingWatcherEvent) => void)
1829
+ run(): Promise<void>
1830
+ /**
1831
+ * Gives consumers a reliable way to await the watcher's completion.
1832
+ * The Node.js layer relies on the pending Promise to keep the process from exiting.
1833
+ */
1834
+ waitForClose(): Promise<void>
1835
+ close(): Promise<void>
1836
+ }
1837
+
1838
+ /**
1839
+ * Minimal wrapper around a `BundleHandle` for watcher events.
1840
+ * This is returned from watcher event data to allow calling `result.close()`.
1841
+ */
1842
+ export declare class BindingWatcherBundler {
1843
+ close(): Promise<void>
1844
+ }
1845
+
1846
+ export declare class BindingWatcherChangeData {
1847
+ path: string
1848
+ kind: string
1849
+ }
1850
+
1851
+ export declare class BindingWatcherEvent {
1852
+ eventKind(): string
1853
+ bundleEventKind(): string
1854
+ bundleEndData(): BindingBundleEndEventData
1855
+ bundleErrorData(): BindingBundleErrorEventData
1856
+ watchChangeData(): BindingWatcherChangeData
1857
+ }
1858
+
1859
+ export declare class ParallelJsPluginRegistry {
1860
+ id: number
1861
+ workerCount: number
1862
+ constructor(workerCount: number)
1863
+ }
1864
+
1865
+ export declare class TraceSubscriberGuard {
1866
+ close(): void
1867
+ }
1868
+
1869
+ export declare class TsconfigCache {
1870
+ /** Create a new transform cache with auto tsconfig discovery enabled. */
1871
+ constructor(yarnPnp: boolean)
1872
+ /**
1873
+ * Clear the cache.
1874
+ *
1875
+ * Call this when tsconfig files have changed to ensure fresh resolution.
1876
+ */
1877
+ clear(): void
1878
+ /** Get the number of cached entries. */
1879
+ size(): number
1880
+ }
1881
+
1882
+ export interface AliasItem {
1883
+ find: string
1884
+ replacements: Array<string | undefined | null>
1885
+ }
1886
+
1887
+ export interface BindingAssetSource {
1888
+ inner: string | Uint8Array
1889
+ }
1890
+
1891
+ export declare enum BindingAttachDebugInfo {
1892
+ None = 0,
1893
+ Simple = 1,
1894
+ Full = 2
1895
+ }
1896
+
1897
+ export interface BindingBuiltinPlugin {
1898
+ __name: BindingBuiltinPluginName
1899
+ options?: unknown
1900
+ }
1901
+
1902
+ export type BindingBuiltinPluginName = 'builtin:bundle-analyzer'|
1903
+ 'builtin:esm-external-require'|
1904
+ 'builtin:isolated-declaration'|
1905
+ 'builtin:replace'|
1906
+ 'builtin:vite-alias'|
1907
+ 'builtin:vite-build-import-analysis'|
1908
+ 'builtin:vite-dynamic-import-vars'|
1909
+ 'builtin:vite-import-glob'|
1910
+ 'builtin:vite-json'|
1911
+ 'builtin:vite-load-fallback'|
1912
+ 'builtin:vite-manifest'|
1913
+ 'builtin:vite-module-preload-polyfill'|
1914
+ 'builtin:vite-react-refresh-wrapper'|
1915
+ 'builtin:vite-reporter'|
1916
+ 'builtin:vite-resolve'|
1917
+ 'builtin:vite-transform'|
1918
+ 'builtin:vite-web-worker-post'|
1919
+ 'builtin:oxc-runtime';
1920
+
1921
+ export interface BindingBundleAnalyzerPluginConfig {
1922
+ /** Output filename for the bundle analysis data (default: "analyze-data.json") */
1923
+ fileName?: string
1924
+ /** Output format: "json" (default) or "md" for LLM-friendly markdown */
1925
+ format?: 'json' | 'md'
1926
+ }
1927
+
1928
+ export interface BindingBundlerOptions {
1929
+ inputOptions: BindingInputOptions
1930
+ outputOptions: BindingOutputOptions
1931
+ parallelPluginsRegistry?: ParallelJsPluginRegistry
1932
+ }
1933
+
1934
+ export interface BindingBundleState {
1935
+ lastBuildErrored: boolean
1936
+ /**
1937
+ * The stage of the last incremental failure, when `last_build_errored`
1938
+ * is true and the engine is in an incremental-failure state. Absent on
1939
+ * success and for an initial full-build failure (use
1940
+ * `last_build_errored` to detect that). The consumer can force a full
1941
+ * rebuild on the next page load when this is `Hmr`. See
1942
+ * `internal-docs/dev-engine/implementation.md` §12.
1943
+ */
1944
+ lastErrorStage?: BindingErrorStage
1945
+ hasStaleOutput: boolean
1946
+ }
1947
+
1948
+ export interface BindingChecksOptions {
1949
+ circularDependency?: boolean
1950
+ eval?: boolean
1951
+ missingGlobalName?: boolean
1952
+ missingNameOptionForIifeExport?: boolean
1953
+ invalidAnnotation?: boolean
1954
+ mixedExports?: boolean
1955
+ unresolvedEntry?: boolean
1956
+ unresolvedImport?: boolean
1957
+ filenameConflict?: boolean
1958
+ commonJsVariableInEsm?: boolean
1959
+ importIsUndefined?: boolean
1960
+ emptyImportMeta?: boolean
1961
+ toleratedTransform?: boolean
1962
+ cannotCallNamespace?: boolean
1963
+ configurationFieldConflict?: boolean
1964
+ preferBuiltinFeature?: boolean
1965
+ couldNotCleanDirectory?: boolean
1966
+ pluginTimings?: boolean
1967
+ duplicateShebang?: boolean
1968
+ unsupportedTsconfigOption?: boolean
1969
+ ineffectiveDynamicImport?: boolean
1970
+ largeBarrelModules?: boolean
1971
+ sourcemapBroken?: boolean
1972
+ }
1973
+
1974
+ export interface BindingChunkImportMap {
1975
+ baseUrl?: string
1976
+ fileName?: string
1977
+ }
1978
+
1979
+ export declare enum BindingChunkModuleOrderBy {
1980
+ ModuleId = 0,
1981
+ ExecOrder = 1
1982
+ }
1983
+
1984
+ export interface BindingChunkOptimizationOptions {
1985
+ mergeCommonChunks?: boolean
1986
+ avoidRedundantChunkLoads?: boolean
1987
+ }
1988
+
1989
+ export interface BindingClientHmrUpdate {
1990
+ clientId: string
1991
+ update: BindingHmrUpdate
1992
+ }
1993
+
1994
+ export interface BindingCommentsOptions {
1995
+ legal?: boolean
1996
+ annotation?: boolean
1997
+ jsdoc?: boolean
1998
+ }
1999
+
2000
+ export interface BindingCompilerOptions {
2001
+ baseUrl?: string
2002
+ paths?: Record<string, Array<string>>
2003
+ experimentalDecorators?: boolean
2004
+ emitDecoratorMetadata?: boolean
2005
+ useDefineForClassFields?: boolean
2006
+ rewriteRelativeImportExtensions?: boolean
2007
+ jsx?: string
2008
+ jsxFactory?: string
2009
+ jsxFragmentFactory?: string
2010
+ jsxImportSource?: string
2011
+ verbatimModuleSyntax?: boolean
2012
+ preserveValueImports?: boolean
2013
+ importsNotUsedAsValues?: string
2014
+ target?: string
2015
+ module?: string
2016
+ allowJs?: boolean
2017
+ rootDirs?: Array<string>
2018
+ }
2019
+
2020
+ export interface BindingDeferSyncScanData {
2021
+ /** ModuleId */
2022
+ id: string
2023
+ sideEffects?: boolean | 'no-treeshake'
2024
+ }
2025
+
2026
+ export interface BindingDevOptions {
2027
+ onHmrUpdates?: undefined | ((result: BindingResult<[BindingClientHmrUpdate[], string[]]>) => void | Promise<void>)
2028
+ onOutput?: undefined | ((result: BindingResult<BindingOutputs>) => void | Promise<void>)
2029
+ /**
2030
+ * Called with assets emitted while generating an HMR patch or compiling a
2031
+ * lazy entry. These never go through `on_output`, so a consumer (e.g. Vite)
2032
+ * must register this to serve them (e.g. write them to its in-memory files).
2033
+ */
2034
+ onAdditionalAssets?: undefined | ((output: BindingOutputs) => void | Promise<void>)
2035
+ rebuildStrategy?: BindingRebuildStrategy
2036
+ watch?: BindingDevWatchOptions
2037
+ }
2038
+
2039
+ export interface BindingDevtoolsOptions {
2040
+ sessionId?: string
2041
+ }
2042
+
2043
+ export interface BindingDevWatchOptions {
2044
+ enabled?: boolean
2045
+ skipWrite?: boolean
2046
+ usePolling?: boolean
2047
+ pollInterval?: number
2048
+ useDebounce?: boolean
2049
+ debounceDuration?: number
2050
+ compareContentsForPolling?: boolean
2051
+ debounceTickRate?: number
2052
+ include?: Array<BindingStringOrRegex>
2053
+ exclude?: Array<BindingStringOrRegex>
2054
+ }
2055
+
2056
+ export interface BindingEmittedAsset {
2057
+ name?: string
2058
+ fileName?: string
2059
+ originalFileName?: string
2060
+ source: BindingAssetSource
2061
+ }
2062
+
2063
+ export interface BindingEmittedChunk {
2064
+ name?: string
2065
+ fileName?: string
2066
+ id: string
2067
+ importer?: string
2068
+ preserveEntrySignatures?: BindingPreserveEntrySignatures
2069
+ }
2070
+
2071
+ export interface BindingEmittedPrebuiltChunk {
2072
+ fileName: string
2073
+ name?: string
2074
+ code: string
2075
+ exports?: Array<string>
2076
+ map?: BindingSourcemap
2077
+ sourcemapFileName?: string
2078
+ facadeModuleId?: string
2079
+ isEntry?: boolean
2080
+ isDynamicEntry?: boolean
2081
+ }
2082
+
2083
+ /** Enhanced transform options with tsconfig and inputMap support. */
2084
+ export interface BindingEnhancedTransformOptions {
2085
+ /** Treat the source text as 'js', 'jsx', 'ts', 'tsx', or 'dts'. */
2086
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'
2087
+ /** Treat the source text as 'script', 'module', 'commonjs', or 'unambiguous'. */
2088
+ sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined
2089
+ /**
2090
+ * The current working directory. Used to resolve relative paths in other
2091
+ * options.
2092
+ */
2093
+ cwd?: string
2094
+ /**
2095
+ * Enable source map generation.
2096
+ *
2097
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
2098
+ *
2099
+ * @default false
2100
+ */
2101
+ sourcemap?: boolean
2102
+ /** Set assumptions in order to produce smaller output. */
2103
+ assumptions?: CompilerAssumptions
2104
+ /**
2105
+ * Configure how TypeScript is transformed.
2106
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
2107
+ */
2108
+ typescript?: TypeScriptOptions
2109
+ /**
2110
+ * Configure how TSX and JSX are transformed.
2111
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
2112
+ */
2113
+ jsx?: 'preserve' | JsxOptions
2114
+ /**
2115
+ * Sets the target environment for the generated JavaScript.
2116
+ *
2117
+ * The lowest target is `es2015`.
2118
+ *
2119
+ * Example:
2120
+ *
2121
+ * * `'es2015'`
2122
+ * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
2123
+ *
2124
+ * @default `esnext` (No transformation)
2125
+ *
2126
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target}
2127
+ */
2128
+ target?: string | Array<string>
2129
+ /** Behaviour for runtime helpers. */
2130
+ helpers?: Helpers
2131
+ /**
2132
+ * Define Plugin
2133
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
2134
+ */
2135
+ define?: Record<string, string>
2136
+ /**
2137
+ * Inject Plugin
2138
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
2139
+ */
2140
+ inject?: Record<string, string | [string, string]>
2141
+ /** Decorator plugin */
2142
+ decorator?: DecoratorOptions
2143
+ /**
2144
+ * Third-party plugins to use.
2145
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
2146
+ */
2147
+ plugins?: PluginsOptions
2148
+ /**
2149
+ * Configure tsconfig handling.
2150
+ * - true: Auto-discover and load the nearest tsconfig.json
2151
+ * - TsconfigRawOptions: Use the provided inline tsconfig options
2152
+ */
2153
+ tsconfig?: boolean | BindingTsconfigRawOptions
2154
+ /** An input source map to collapse with the output source map. */
2155
+ inputMap?: SourceMap
2156
+ }
2157
+
2158
+ /** Result of the enhanced transform API. */
2159
+ export interface BindingEnhancedTransformResult {
2160
+ /**
2161
+ * The transformed code.
2162
+ *
2163
+ * If parsing failed, this will be an empty string.
2164
+ */
2165
+ code: string
2166
+ /**
2167
+ * The source map for the transformed code.
2168
+ *
2169
+ * This will be set if {@link BindingEnhancedTransformOptions#sourcemap} is `true`.
2170
+ */
2171
+ map?: SourceMap
2172
+ /**
2173
+ * The `.d.ts` declaration file for the transformed code. Declarations are
2174
+ * only generated if `declaration` is set to `true` and a TypeScript file
2175
+ * is provided.
2176
+ *
2177
+ * If parsing failed and `declaration` is set, this will be an empty string.
2178
+ *
2179
+ * @see {@link TypeScriptOptions#declaration}
2180
+ * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
2181
+ */
2182
+ declaration?: string
2183
+ /**
2184
+ * Declaration source map. Only generated if both
2185
+ * {@link TypeScriptOptions#declaration declaration} and
2186
+ * {@link BindingEnhancedTransformOptions#sourcemap sourcemap} are set to `true`.
2187
+ */
2188
+ declarationMap?: SourceMap
2189
+ /**
2190
+ * Helpers used.
2191
+ *
2192
+ * @internal
2193
+ *
2194
+ * Example:
2195
+ *
2196
+ * ```text
2197
+ * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
2198
+ * ```
2199
+ */
2200
+ helpersUsed: Record<string, string>
2201
+ /** Parse and transformation errors. */
2202
+ errors: Array<BindingError>
2203
+ /** Parse and transformation warnings. */
2204
+ warnings: Array<BindingError>
2205
+ /** Paths to tsconfig files that were loaded during transformation. */
2206
+ tsconfigFilePaths: Array<string>
2207
+ }
2208
+
2209
+ export type BindingError =
2210
+ | { type: 'JsError', field0: Error }
2211
+ | { type: 'NativeError', field0: NativeError }
2212
+
2213
+ export interface BindingErrors {
2214
+ errors: Array<BindingError>
2215
+ isBindingErrors: boolean
2216
+ }
2217
+
2218
+ /**
2219
+ * Which stage of an incremental dev build produced the last error.
2220
+ *
2221
+ * Mirrors `rolldown_dev::ErrorStage`. Surfaced on
2222
+ * [`crate::binding_dev_engine::BindingBundleState`] so the consumer can
2223
+ * treat an `Hmr`-stage failure as recoverable by forcing a full rebuild
2224
+ * on the next page load (HMR generation may itself be buggy). See
2225
+ * `internal-docs/dev-engine/implementation.md` §12.
2226
+ */
2227
+ export type BindingErrorStage = 'Hmr'|
2228
+ 'Rebuild';
2229
+
2230
+ export interface BindingEsmExternalRequirePluginConfig {
2231
+ external: Array<BindingStringOrRegex>
2232
+ skipDuplicateCheck?: boolean
2233
+ }
2234
+
2235
+ export interface BindingExperimentalDevModeOptions {
2236
+ host?: string
2237
+ port?: number
2238
+ implement: string
2239
+ /** @deprecated Common runtime injection will be disabled by default in the future. */
2240
+ skipCommonRuntimeInjection?: boolean
2241
+ lazy?: boolean
2242
+ }
2243
+
2244
+ export interface BindingExperimentalOptions {
2245
+ viteMode?: boolean
2246
+ resolveNewUrlToAsset?: boolean
2247
+ devMode?: BindingExperimentalDevModeOptions
2248
+ attachDebugInfo?: BindingAttachDebugInfo
2249
+ chunkModulesOrder?: BindingChunkModuleOrderBy
2250
+ chunkImportMap?: boolean | BindingChunkImportMap
2251
+ onDemandWrapping?: boolean
2252
+ incrementalBuild?: boolean
2253
+ nativeMagicString?: boolean
2254
+ chunkOptimization?: boolean | BindingChunkOptimizationOptions
2255
+ lazyBarrel?: boolean
2256
+ }
2257
+
2258
+ export interface BindingFilterToken {
2259
+ kind: FilterTokenKind
2260
+ payload?: BindingStringOrRegex | number | boolean
2261
+ }
2262
+
2263
+ export interface BindingGeneratedCodeOptions {
2264
+ symbols?: boolean
2265
+ preset?: string
2266
+ }
2267
+
2268
+ export type BindingHmrUpdate =
2269
+ | { type: 'Patch', code: string, filename: string, sourcemap?: string, sourcemapFilename?: string, /**
2270
+ * Stable ids of the changed modules — the `changedIds` of the push envelope.
2271
+ * The client walks from these on its own graph.
2272
+ */
2273
+ changedIds: Array<string>, /** Per-client envelope sequence number. */
2274
+ seq: number }
2275
+ | { type: 'FullReload', reason?: string }
2276
+ | { type: 'Noop' }
2277
+
2278
+ export interface BindingHookFilter {
2279
+ value?: Array<Array<BindingFilterToken>>
2280
+ }
2281
+
2282
+ export interface BindingHookJsLoadOutput {
2283
+ code: string
2284
+ map?: string
2285
+ moduleSideEffects?: boolean | 'no-treeshake'
2286
+ }
2287
+
2288
+ export interface BindingHookJsResolveIdOptions {
2289
+ isEntry?: boolean
2290
+ /**
2291
+ * - `import-statement`: `import { foo } from './lib.js';`
2292
+ * - `dynamic-import`: `import('./lib.js')`
2293
+ * - `require-call`: `require('./lib.js')`
2294
+ * - `import-rule`: `@import 'bg-color.css'`
2295
+ * - `url-token`: `url('./icon.png')`
2296
+ * - `new-url`: `new URL('./worker.js', import.meta.url)`
2297
+ * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
2298
+ */
2299
+ kind?: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept'
2300
+ scan?: boolean
2301
+ custom?: BindingVitePluginCustom
2302
+ }
2303
+
2304
+ export interface BindingHookJsResolveIdOutput {
2305
+ id: string
2306
+ external?: boolean | 'absolute' | 'relative'
2307
+ moduleSideEffects?: boolean | 'no-treeshake'
2308
+ }
2309
+
2310
+ export interface BindingHookLoadOutput {
2311
+ code: string
2312
+ moduleSideEffects?: boolean | 'no-treeshake'
2313
+ map?: BindingSourcemap
2314
+ moduleType?: string
2315
+ }
2316
+
2317
+ export interface BindingHookRenderChunkOutput {
2318
+ code: string
2319
+ /**
2320
+ * A sourcemap, or `null` to explicitly signal "no sourcemap" (distinct from
2321
+ * omitting the field, which mirrors Rollup's "possibly broken" semantics).
2322
+ */
2323
+ map?: BindingSourcemap | null
2324
+ }
2325
+
2326
+ export interface BindingHookResolveFileUrlArgs {
2327
+ /** Preliminary filename of the chunk containing the reference. */
2328
+ chunkId: string
2329
+ /** Filename of the emitted file, relative to the output directory. */
2330
+ fileName: string
2331
+ format: 'es' | 'cjs' | 'iife' | 'umd'
2332
+ /** Id of the module containing the `import.meta.ROLLDOWN_FILE_URL_*` reference. */
2333
+ moduleId: string
2334
+ referenceId: string
2335
+ /** Path from the chunk to the emitted file. */
2336
+ relativePath: string
2337
+ /**
2338
+ * The `<urlId>` of `import.meta.ROLLDOWN_FILE_URL_<referenceId>_<urlId>`, if present.
2339
+ * Only the rolldown-specific form carries it; the `ROLLUP_FILE_URL_` alias never does.
2340
+ */
2341
+ urlId?: string
2342
+ }
2343
+
2344
+ export interface BindingHookResolveIdExtraArgs {
2345
+ custom?: number
2346
+ isEntry: boolean
2347
+ /**
2348
+ * - `import-statement`: `import { foo } from './lib.js';`
2349
+ * - `dynamic-import`: `import('./lib.js')`
2350
+ * - `require-call`: `require('./lib.js')`
2351
+ * - `import-rule`: `@import 'bg-color.css'`
2352
+ * - `url-token`: `url('./icon.png')`
2353
+ * - `new-url`: `new URL('./worker.js', import.meta.url)`
2354
+ * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
2355
+ */
2356
+ kind: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept'
2357
+ }
2358
+
2359
+ export interface BindingHookResolveIdOutput {
2360
+ id: string
2361
+ external?: BindingResolvedExternal
2362
+ normalizeExternalId?: boolean
2363
+ moduleSideEffects?: boolean | 'no-treeshake'
2364
+ /**
2365
+ * @internal Used to store package json path resolved by oxc resolver,
2366
+ * we could get the related package json object via the path string.
2367
+ */
2368
+ packageJsonPath?: string | null
2369
+ }
2370
+
2371
+ export type BindingHookSideEffects =
2372
+ boolean | string
2373
+
2374
+ export interface BindingHookTransformOutput {
2375
+ code?: string
2376
+ moduleSideEffects?: BindingHookSideEffects
2377
+ /**
2378
+ * A sourcemap, or `null` to explicitly signal "no sourcemap" (distinct from
2379
+ * omitting the field, which mirrors Rollup's "possibly broken" semantics).
2380
+ */
2381
+ map?: BindingSourcemap | null
2382
+ moduleType?: string
2383
+ }
2384
+
2385
+ export interface BindingHotUpdateArgs {
2386
+ kind: 'create' | 'update' | 'delete'
2387
+ /** Normalized absolute path of the changed file. */
2388
+ file: string
2389
+ /** The affected module ids as currently computed (raw module ids). */
2390
+ modules: Array<string>
2391
+ }
2392
+
2393
+ export interface BindingIndentOptions {
2394
+ exclude?: Array<Array<number>> | Array<number>
2395
+ }
2396
+
2397
+ export type BindingInjectImport =
2398
+ BindingInjectImportNamed | BindingInjectImportNamespace
2399
+
2400
+ export interface BindingInjectImportNamed {
2401
+ tagNamed: true
2402
+ imported: string
2403
+ alias?: string
2404
+ from: string
2405
+ }
2406
+
2407
+ export interface BindingInjectImportNamespace {
2408
+ tagNamespace: true
2409
+ alias: string
2410
+ from: string
2411
+ }
2412
+
2413
+ export interface BindingInlineConstConfig {
2414
+ mode?: string
2415
+ pass?: number
2416
+ }
2417
+
2418
+ export interface BindingInputItem {
2419
+ name?: string
2420
+ import: string
2421
+ }
2422
+
2423
+ export interface BindingInputOptions {
2424
+ external?: Array<string | RegExp> | ((source: string, importer: string | undefined, isResolved: boolean) => boolean)
2425
+ input: Array<BindingInputItem>
2426
+ plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
2427
+ resolve?: BindingResolveOptions
2428
+ shimMissingExports?: boolean
2429
+ platform?: 'node' | 'browser' | 'neutral'
2430
+ logLevel: BindingLogLevel
2431
+ onLog: (logLevel: 'debug' | 'warn' | 'info', log: BindingLog) => void
2432
+ cwd: string
2433
+ treeshake?: BindingTreeshake
2434
+ moduleTypes?: Record<string, string>
2435
+ define?: Array<[string, string]>
2436
+ dropLabels?: Array<string>
2437
+ inject?: Array<BindingInjectImport>
2438
+ experimental?: BindingExperimentalOptions
2439
+ profilerNames?: boolean
2440
+ transform?: TransformOptions
2441
+ watch?: BindingWatchOption
2442
+ keepNames?: boolean
2443
+ checks?: BindingChecksOptions
2444
+ deferSyncScanData?: undefined | (() => BindingDeferSyncScanData[])
2445
+ makeAbsoluteExternalsRelative?: BindingMakeAbsoluteExternalsRelative
2446
+ devtools?: BindingDevtoolsOptions
2447
+ invalidateJsSideCache?: () => void
2448
+ preserveEntrySignatures?: BindingPreserveEntrySignatures
2449
+ optimization?: BindingOptimization
2450
+ context?: string
2451
+ tsconfig?: boolean | string
2452
+ }
2453
+
2454
+ export interface BindingIsolatedDeclarationPluginConfig {
2455
+ stripInternal?: boolean
2456
+ }
2457
+
2458
+ export interface BindingJsonSourcemap {
2459
+ file?: string
2460
+ mappings?: string
2461
+ sourceRoot?: string
2462
+ sources?: Array<string | undefined | null>
2463
+ sourcesContent?: Array<string | undefined | null>
2464
+ names?: Array<string>
2465
+ debugId?: string
2466
+ x_google_ignoreList?: Array<number>
2467
+ }
2468
+
2469
+ export interface BindingJsWatchChangeEvent {
2470
+ event: string
2471
+ }
2472
+
2473
+ /**
2474
+ * The client-facing slice of a lazy-compile result. The carried modules and
2475
+ * stamps stay server-side as the engine's pending-payload entry.
2476
+ */
2477
+ export interface BindingLazyChunkOutput {
2478
+ code: string
2479
+ filename: string
2480
+ /**
2481
+ * The chunk's sourcemap, when `sourcemap` is `File` or `Hidden`. Serve it
2482
+ * under `sourcemapFilename`, which is what the chunk's `sourceMappingURL`
2483
+ * refers to.
2484
+ */
2485
+ sourcemap?: string
2486
+ sourcemapFilename?: string
2487
+ }
2488
+
2489
+ export interface BindingLog {
2490
+ message: string
2491
+ id?: string
2492
+ code?: string
2493
+ exporter?: string
2494
+ plugin?: string
2495
+ /** Location information (line, column, file) */
2496
+ loc?: BindingLogLocation
2497
+ /** Position in the source file in UTF-16 code units */
2498
+ pos?: number
2499
+ /** List of module IDs (used for CIRCULAR_DEPENDENCY warnings) */
2500
+ ids?: Array<string>
2501
+ }
2502
+
2503
+ export declare enum BindingLogLevel {
2504
+ Silent = 0,
2505
+ Warn = 1,
2506
+ Info = 2,
2507
+ Debug = 3
2508
+ }
2509
+
2510
+ export interface BindingLogLocation {
2511
+ /** 1-based */
2512
+ line: number
2513
+ /** 0-based position in the line in UTF-16 code units */
2514
+ column: number
2515
+ file?: string
2516
+ }
2517
+
2518
+ export interface BindingMagicStringOptions {
2519
+ filename?: string
2520
+ offset?: number
2521
+ indentExclusionRanges?: Array<Array<number>> | Array<number>
2522
+ ignoreList?: boolean
2523
+ }
2524
+
2525
+ export type BindingMakeAbsoluteExternalsRelative =
2526
+ | { type: 'Bool', field0: boolean }
2527
+ | { type: 'IfRelativeSource' }
2528
+
2529
+ export interface BindingManualCodeSplittingOptions {
2530
+ includeDependenciesRecursively?: boolean
2531
+ minSize?: number
2532
+ minShareCount?: number
2533
+ groups?: Array<BindingMatchGroup>
2534
+ maxSize?: number
2535
+ minModuleSize?: number
2536
+ maxModuleSize?: number
2537
+ }
2538
+
2539
+ export interface BindingMatchGroup {
2540
+ name: string | ((id: string, ctx: BindingChunkingContext) => VoidNullable<string>)
2541
+ test?: string | RegExp | ((id: string) => VoidNullable<boolean>)
2542
+ priority?: number
2543
+ minSize?: number
2544
+ minShareCount?: number
2545
+ minModuleSize?: number
2546
+ maxModuleSize?: number
2547
+ maxSize?: number
2548
+ entriesAware?: boolean
2549
+ entriesAwareMergeThreshold?: number
2550
+ tags?: Array<string>
2551
+ includeDependenciesRecursively?: boolean
2552
+ }
2553
+
2554
+ export interface BindingModules {
2555
+ values: Array<BindingRenderedModule>
2556
+ keys: Array<string>
2557
+ }
2558
+
2559
+ export interface BindingModuleSideEffectsRule {
2560
+ test?: RegExp | undefined
2561
+ sideEffects: boolean
2562
+ external?: boolean
2563
+ }
2564
+
2565
+ export interface BindingOptimization {
2566
+ inlineConst?: boolean | BindingInlineConstConfig
2567
+ pifeForModuleWrappers?: boolean
2568
+ }
2569
+
2570
+ export interface BindingOutputOptions {
2571
+ name?: string
2572
+ assetFileNames?: string | ((chunk: BindingPreRenderedAsset) => string)
2573
+ entryFileNames?: string | ((chunk: PreRenderedChunk) => string)
2574
+ chunkFileNames?: string | ((chunk: PreRenderedChunk) => string)
2575
+ sanitizeFileName?: boolean | ((name: string) => string)
2576
+ banner?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>)
2577
+ postBanner?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>)
2578
+ footer?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>)
2579
+ postFooter?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>)
2580
+ dir?: string
2581
+ file?: string
2582
+ esModule?: boolean | 'if-default-prop'
2583
+ exports?: 'default' | 'named' | 'none' | 'auto'
2584
+ extend?: boolean
2585
+ externalLiveBindings?: boolean
2586
+ format?: 'es' | 'cjs' | 'iife' | 'umd'
2587
+ generatedCode?: BindingGeneratedCodeOptions
2588
+ globals?: Record<string, string> | ((name: string) => string)
2589
+ hashCharacters?: 'base64' | 'base36' | 'hex'
2590
+ inlineDynamicImports?: boolean
2591
+ dynamicImportInCjs?: boolean
2592
+ intro?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>)
2593
+ outro?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>)
2594
+ paths?: Record<string, string> | ((id: string) => string)
2595
+ plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
2596
+ sourcemap?: 'file' | 'inline' | 'hidden'
2597
+ sourcemapFileNames?: string | ((chunk: PreRenderedChunk) => string)
2598
+ sourcemapBaseUrl?: string
2599
+ sourcemapIgnoreList?: boolean | string | RegExp | ((source: string, sourcemapPath: string) => boolean)
2600
+ sourcemapDebugIds?: boolean
2601
+ sourcemapPathTransform?: (source: string, sourcemapPath: string) => string
2602
+ sourcemapExcludeSources?: boolean
2603
+ strict?: boolean | 'auto'
2604
+ minify?: boolean | 'dce-only' | MinifyOptions
2605
+ manualCodeSplitting?: BindingManualCodeSplittingOptions
2606
+ legalComments?: 'none' | 'inline'
2607
+ comments?: boolean | BindingCommentsOptions
2608
+ polyfillRequire?: boolean
2609
+ preserveModules?: boolean
2610
+ virtualDirname?: string
2611
+ preserveModulesRoot?: string
2612
+ topLevelVar?: boolean
2613
+ minifyInternalExports?: boolean
2614
+ cleanDir?: boolean
2615
+ strictExecutionOrder?: boolean
2616
+ }
2617
+
2618
+ export interface BindingOutputs {
2619
+ chunks: Array<BindingOutputChunk>
2620
+ assets: Array<BindingOutputAsset>
2621
+ }
2622
+
2623
+ export interface BindingOverwriteOptions {
2624
+ contentOnly?: boolean
2625
+ /** Stores the replaced content in the generated sourcemap's `names` field. */
2626
+ storeName?: boolean
2627
+ }
2628
+
2629
+ export interface BindingPluginContextResolvedId {
2630
+ id: string
2631
+ packageJsonPath?: string
2632
+ external: boolean | 'absolute' | 'relative'
2633
+ moduleSideEffects?: boolean | 'no-treeshake'
2634
+ }
2635
+
2636
+ export interface BindingPluginContextResolveOptions {
2637
+ /**
2638
+ * - `import-statement`: `import { foo } from './lib.js';`
2639
+ * - `dynamic-import`: `import('./lib.js')`
2640
+ * - `require-call`: `require('./lib.js')`
2641
+ * - `import-rule`: `@import 'bg-color.css'`
2642
+ * - `url-token`: `url('./icon.png')`
2643
+ * - `new-url`: `new URL('./worker.js', import.meta.url)`
2644
+ * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
2645
+ */
2646
+ importKind?: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept'
2647
+ isEntry?: boolean
2648
+ skipSelf?: boolean
2649
+ custom?: number
2650
+ vitePluginCustom?: BindingVitePluginCustom
2651
+ }
2652
+
2653
+ export interface BindingPluginHookMeta {
2654
+ order?: BindingPluginOrder
2655
+ }
2656
+
2657
+ export interface BindingPluginOptions {
2658
+ name: string
2659
+ hookUsage: number
2660
+ buildStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable>
2661
+ buildStartMeta?: BindingPluginHookMeta
2662
+ resolveId?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>, options: BindingHookResolveIdExtraArgs) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
2663
+ resolveIdMeta?: BindingPluginHookMeta
2664
+ resolveIdFilter?: BindingHookFilter
2665
+ resolveDynamicImport?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
2666
+ resolveDynamicImportMeta?: BindingPluginHookMeta
2667
+ load?: (ctx: BindingLoadPluginContext, id: string) => MaybePromise<VoidNullable<BindingHookLoadOutput>>
2668
+ loadMeta?: BindingPluginHookMeta
2669
+ loadFilter?: BindingHookFilter
2670
+ transform?: (ctx: BindingTransformPluginContext, id: string, code: string, module_type: BindingTransformHookExtraArgs) => MaybePromise<VoidNullable<BindingHookTransformOutput>>
2671
+ transformMeta?: BindingPluginHookMeta
2672
+ transformFilter?: BindingHookFilter
2673
+ moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
2674
+ moduleParsedMeta?: BindingPluginHookMeta
2675
+ buildEnd?: (ctx: BindingPluginContext, error?: BindingError[]) => MaybePromise<VoidNullable>
2676
+ buildEndMeta?: BindingPluginHookMeta
2677
+ renderChunk?: (ctx: BindingPluginContext, code: string, chunk: BindingRenderedChunk, opts: BindingNormalizedOptions, meta: BindingRenderedChunkMeta) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
2678
+ renderChunkMeta?: BindingPluginHookMeta
2679
+ renderChunkFilter?: BindingHookFilter
2680
+ augmentChunkHash?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => MaybePromise<void | string>
2681
+ augmentChunkHashMeta?: BindingPluginHookMeta
2682
+ resolveFileUrl?: (ctx: BindingPluginContext, args: BindingHookResolveFileUrlArgs) => MaybePromise<void | string | null>
2683
+ resolveFileUrlMeta?: BindingPluginHookMeta
2684
+ renderStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => void
2685
+ renderStartMeta?: BindingPluginHookMeta
2686
+ renderError?: (ctx: BindingPluginContext, error: BindingError[]) => void
2687
+ renderErrorMeta?: BindingPluginHookMeta
2688
+ generateBundle?: (ctx: BindingPluginContext, bundle: BindingErrorsOr<BindingOutputs>, isWrite: boolean, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
2689
+ generateBundleMeta?: BindingPluginHookMeta
2690
+ writeBundle?: (ctx: BindingPluginContext, bundle: BindingErrorsOr<BindingOutputs>, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
2691
+ writeBundleMeta?: BindingPluginHookMeta
2692
+ closeBundle?: (ctx: BindingPluginContext, error?: BindingError[]) => MaybePromise<VoidNullable>
2693
+ closeBundleMeta?: BindingPluginHookMeta
2694
+ watchChange?: (ctx: BindingPluginContext, path: string, event: string) => MaybePromise<VoidNullable>
2695
+ watchChangeMeta?: BindingPluginHookMeta
2696
+ hotUpdate?: (ctx: BindingPluginContext, args: BindingHotUpdateArgs) => MaybePromise<VoidNullable<Array<string>>>
2697
+ hotUpdateMeta?: BindingPluginHookMeta
2698
+ closeWatcher?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
2699
+ closeWatcherMeta?: BindingPluginHookMeta
2700
+ banner?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void
2701
+ bannerMeta?: BindingPluginHookMeta
2702
+ footer?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void
2703
+ footerMeta?: BindingPluginHookMeta
2704
+ intro?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void
2705
+ introMeta?: BindingPluginHookMeta
2706
+ outro?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void
2707
+ outroMeta?: BindingPluginHookMeta
2708
+ }
2709
+
2710
+ export declare enum BindingPluginOrder {
2711
+ Pre = 0,
2712
+ Post = 1
2713
+ }
2714
+
2715
+ export interface BindingPluginWithIndex {
2716
+ index: number
2717
+ plugin: BindingPluginOptions
2718
+ }
2719
+
2720
+ export interface BindingPreRenderedAsset {
2721
+ name?: string
2722
+ names: Array<string>
2723
+ originalFileName?: string
2724
+ originalFileNames: Array<string>
2725
+ source: BindingAssetSource
2726
+ }
2727
+
2728
+ export type BindingPreserveEntrySignatures =
2729
+ | { type: 'Bool', field0: boolean }
2730
+ | { type: 'String', field0: string }
2731
+
2732
+ export declare enum BindingPropertyReadSideEffects {
2733
+ Always = 0,
2734
+ False = 1
2735
+ }
2736
+
2737
+ export declare enum BindingPropertyWriteSideEffects {
2738
+ Always = 0,
2739
+ False = 1
2740
+ }
2741
+
2742
+ export declare enum BindingRebuildStrategy {
2743
+ Always = 0,
2744
+ Never = 1
2745
+ }
2746
+
2747
+ export interface BindingReplacePluginConfig {
2748
+ values: Record<string, string>
2749
+ delimiters?: [string, string]
2750
+ preventAssignment?: boolean
2751
+ objectGuards?: boolean
2752
+ sourcemap?: boolean
2753
+ }
2754
+
2755
+ export type BindingResolvedExternal =
2756
+ boolean | string
2757
+
2758
+ export interface BindingResolveOptions {
2759
+ alias?: Array<AliasItem>
2760
+ aliasFields?: Array<Array<string>>
2761
+ conditionNames?: Array<string>
2762
+ exportsFields?: Array<Array<string>>
2763
+ extensions?: Array<string>
2764
+ extensionAlias?: Array<ExtensionAliasItem>
2765
+ mainFields?: Array<string>
2766
+ mainFiles?: Array<string>
2767
+ modules?: Array<string>
2768
+ symlinks?: boolean
2769
+ yarnPnp?: boolean
2770
+ }
2771
+
2772
+ export interface BindingSourcemap {
2773
+ inner: string | BindingJsonSourcemap
2774
+ }
2775
+
2776
+ export interface BindingSourceMapOptions {
2777
+ /** The filename for the generated file (goes into `map.file`) */
2778
+ file?: string
2779
+ /** The filename of the original source (goes into `map.sources`) */
2780
+ source?: string
2781
+ includeContent?: boolean
2782
+ /**
2783
+ * Accepts boolean or string: true, false, "boundary"
2784
+ * - true: high-resolution sourcemaps (character-level)
2785
+ * - false: low-resolution sourcemaps (line-level) - default
2786
+ * - "boundary": high-resolution only at word boundaries
2787
+ */
2788
+ hires?: boolean | string
2789
+ }
2790
+
2791
+ export interface BindingTransformHookExtraArgs {
2792
+ moduleType: string
2793
+ }
2794
+
2795
+ export interface BindingTreeshake {
2796
+ moduleSideEffects: boolean | ReadonlyArray<string> | BindingModuleSideEffectsRule[] | ((id: string, external: boolean) => boolean | undefined)
2797
+ annotations?: boolean
2798
+ manualPureFunctions?: ReadonlyArray<string>
2799
+ unknownGlobalSideEffects?: boolean
2800
+ invalidImportSideEffects?: boolean
2801
+ commonjs?: boolean
2802
+ propertyReadSideEffects?: BindingPropertyReadSideEffects
2803
+ propertyWriteSideEffects?: BindingPropertyWriteSideEffects
2804
+ }
2805
+
2806
+ export interface BindingTsconfig {
2807
+ files?: Array<string>
2808
+ include?: Array<string>
2809
+ exclude?: Array<string>
2810
+ compilerOptions: BindingCompilerOptions
2811
+ }
2812
+
2813
+ /**
2814
+ * TypeScript compiler options for inline tsconfig configuration.
2815
+ *
2816
+ * @category Utilities
2817
+ */
2818
+ export interface BindingTsconfigCompilerOptions {
2819
+ /** Specifies the JSX factory function to use. */
2820
+ jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve' | 'react-native'
2821
+ /** Specifies the JSX factory function. */
2822
+ jsxFactory?: string
2823
+ /** Specifies the JSX fragment factory function. */
2824
+ jsxFragmentFactory?: string
2825
+ /** Specifies the module specifier for JSX imports. */
2826
+ jsxImportSource?: string
2827
+ /** Enables experimental decorators. */
2828
+ experimentalDecorators?: boolean
2829
+ /** Enables decorator metadata emission. */
2830
+ emitDecoratorMetadata?: boolean
2831
+ /** Enables all strict type-checking options. Used as the fallback for `strictNullChecks`. */
2832
+ strict?: boolean
2833
+ /**
2834
+ * Enables strict null checks. Controls whether `null`/`undefined` are elided from
2835
+ * nullable-union `design:type` decorator metadata.
2836
+ */
2837
+ strictNullChecks?: boolean
2838
+ /** Preserves module structure of imports/exports. */
2839
+ verbatimModuleSyntax?: boolean
2840
+ /** Configures how class fields are emitted. */
2841
+ useDefineForClassFields?: boolean
2842
+ /** The ECMAScript target version. */
2843
+ target?: string
2844
+ /** @deprecated Use verbatimModuleSyntax instead. */
2845
+ preserveValueImports?: boolean
2846
+ /** @deprecated Use verbatimModuleSyntax instead. */
2847
+ importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
2848
+ }
2849
+
2850
+ /**
2851
+ * Raw tsconfig options for inline configuration.
2852
+ *
2853
+ * @category Utilities
2854
+ */
2855
+ export interface BindingTsconfigRawOptions {
2856
+ /** TypeScript compiler options. */
2857
+ compilerOptions?: BindingTsconfigCompilerOptions
2858
+ }
2859
+
2860
+ export interface BindingTsconfigResult {
2861
+ tsconfig: BindingTsconfig
2862
+ tsconfigFilePaths: Array<string>
2863
+ }
2864
+
2865
+ export interface BindingUpdateOptions {
2866
+ overwrite?: boolean
2867
+ /** Stores the replaced content in the generated sourcemap's `names` field. */
2868
+ storeName?: boolean
2869
+ }
2870
+
2871
+ export interface BindingViteAliasPluginAlias {
2872
+ find: BindingStringOrRegex
2873
+ replacement: string
2874
+ }
2875
+
2876
+ export interface BindingViteAliasPluginConfig {
2877
+ entries: Array<BindingViteAliasPluginAlias>
2878
+ }
2879
+
2880
+ export interface BindingViteBuildImportAnalysisPluginConfig {
2881
+ preloadCode: string
2882
+ insertPreload: boolean
2883
+ optimizeModulePreloadRelativePaths: boolean
2884
+ renderBuiltUrl: boolean
2885
+ isRelativeBase: boolean
2886
+ }
2887
+
2888
+ export interface BindingViteDynamicImportVarsPluginConfig {
2889
+ sourcemap?: boolean
2890
+ include?: Array<BindingStringOrRegex>
2891
+ exclude?: Array<BindingStringOrRegex>
2892
+ resolver?: (id: string, importer: string) => MaybePromise<string | undefined>
2893
+ }
2894
+
2895
+ export interface BindingViteImportGlobPluginConfig {
2896
+ root?: string
2897
+ sourcemap?: boolean
2898
+ restoreQueryExtension?: boolean
2899
+ }
2900
+
2901
+ export interface BindingViteJsonPluginConfig {
2902
+ minify?: boolean
2903
+ namedExports?: boolean
2904
+ stringify?: BindingViteJsonPluginStringify
2905
+ }
2906
+
2907
+ export type BindingViteJsonPluginStringify =
2908
+ boolean | string
2909
+
2910
+ export interface BindingViteManifestPluginConfig {
2911
+ root: string
2912
+ outPath: string
2913
+ isLegacy?: (args: BindingNormalizedOptions) => boolean
2914
+ cssEntries: () => Record<string, string>
2915
+ }
2916
+
2917
+ export interface BindingViteModulePreloadPolyfillPluginConfig {
2918
+ isServer?: boolean
2919
+ }
2920
+
2921
+ export interface BindingVitePluginCustom {
2922
+ 'vite:import-glob'?: ViteImportGlobMeta
2923
+ }
2924
+
2925
+ export interface BindingViteReactRefreshWrapperPluginConfig {
2926
+ cwd: string
2927
+ include?: Array<BindingStringOrRegex>
2928
+ exclude?: Array<BindingStringOrRegex>
2929
+ jsxImportSource: string
2930
+ reactRefreshHost: string
2931
+ }
2932
+
2933
+ export interface BindingViteReporterPluginConfig {
2934
+ root: string
2935
+ isTty: boolean
2936
+ isLib: boolean
2937
+ assetsDir: string
2938
+ chunkLimit: number
2939
+ warnLargeChunks: boolean
2940
+ reportCompressedSize: boolean
2941
+ logInfo?: (msg: string) => void
2942
+ }
2943
+
2944
+ export interface BindingViteResolvePluginConfig {
2945
+ resolveOptions: BindingViteResolvePluginResolveOptions
2946
+ environmentConsumer: string
2947
+ environmentName: string
2948
+ builtins: Array<BindingStringOrRegex>
2949
+ external: true | string[]
2950
+ noExternal: true | Array<string | RegExp>
2951
+ dedupe: Array<string>
2952
+ disableCache?: boolean
2953
+ legacyInconsistentCjsInterop?: boolean
2954
+ finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
2955
+ finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
2956
+ resolveSubpathImports: (id: string, importer: string, isRequire: boolean, scan: boolean) => VoidNullable<string>
2957
+ onWarn?: (message: string) => void
2958
+ onDebug?: (message: string) => void
2959
+ yarnPnp: boolean
2960
+ }
2961
+
2962
+ export interface BindingViteResolvePluginResolveOptions {
2963
+ isBuild: boolean
2964
+ isProduction: boolean
2965
+ asSrc: boolean
2966
+ preferRelative: boolean
2967
+ isRequire?: boolean
2968
+ root: string
2969
+ scan: boolean
2970
+ mainFields: Array<string>
2971
+ conditions: Array<string>
2972
+ externalConditions: Array<string>
2973
+ extensions: Array<string>
2974
+ tryIndex: boolean
2975
+ tryPrefix?: string
2976
+ preserveSymlinks: boolean
2977
+ tsconfigPaths: boolean
2978
+ }
2979
+
2980
+ export interface BindingViteTransformPluginConfig {
2981
+ root: string
2982
+ include?: Array<BindingStringOrRegex>
2983
+ exclude?: Array<BindingStringOrRegex>
2984
+ jsxRefreshInclude?: Array<BindingStringOrRegex>
2985
+ jsxRefreshExclude?: Array<BindingStringOrRegex>
2986
+ isServerConsumer?: boolean
2987
+ jsxInject?: string
2988
+ transformOptions?: TransformOptions
2989
+ yarnPnp?: boolean
2990
+ }
2991
+
2992
+ export interface BindingWatchOption {
2993
+ skipWrite?: boolean
2994
+ include?: Array<BindingStringOrRegex>
2995
+ exclude?: Array<BindingStringOrRegex>
2996
+ buildDelay?: number
2997
+ usePolling?: boolean
2998
+ pollInterval?: number
2999
+ compareContentsForPolling?: boolean
3000
+ useDebounce?: boolean
3001
+ debounceDelay?: number
3002
+ debounceTickRate?: number
3003
+ onInvalidate?: ((id: string) => void) | undefined
3004
+ }
3005
+
3006
+ export declare function collapseSourcemaps(sourcemapChain: Array<BindingSourcemap>): BindingJsonSourcemap
3007
+
3008
+ export declare function enhancedTransform(filename: string, sourceText: string, options: BindingEnhancedTransformOptions | undefined | null, cache: TsconfigCache | undefined | null, yarnPnp: boolean): Promise<BindingEnhancedTransformResult>
3009
+
3010
+ export declare function enhancedTransformSync(filename: string, sourceText: string, options: BindingEnhancedTransformOptions | undefined | null, cache: TsconfigCache | undefined | null, yarnPnp: boolean): BindingEnhancedTransformResult
3011
+
3012
+ export interface ExtensionAliasItem {
3013
+ target: string
3014
+ replacements: Array<string>
3015
+ }
3016
+
3017
+ export interface ExternalMemoryStatus {
3018
+ freed: boolean
3019
+ reason?: string
3020
+ }
3021
+
3022
+ export type FilterTokenKind = 'Id'|
3023
+ 'ImporterId'|
3024
+ 'Code'|
3025
+ 'ModuleType'|
3026
+ 'And'|
3027
+ 'Or'|
3028
+ 'Not'|
3029
+ 'Include'|
3030
+ 'Exclude'|
3031
+ 'CleanUrl'|
3032
+ 'QueryKey'|
3033
+ 'QueryValue';
3034
+
3035
+ export declare function initTraceSubscriber(): TraceSubscriberGuard | null
3036
+
3037
+ export interface JsChangedOutputs {
3038
+ deleted: Set<string>
3039
+ changes: Record<string, JsOutputChunk | JsOutputAsset>
3040
+ }
3041
+
3042
+ export interface JsOutputAsset {
3043
+ names: Array<string>
3044
+ originalFileNames: Array<string>
3045
+ filename: string
3046
+ source: BindingAssetSource
3047
+ }
3048
+
3049
+ export interface JsOutputChunk {
3050
+ name: string
3051
+ isEntry: boolean
3052
+ isDynamicEntry: boolean
3053
+ facadeModuleId?: string
3054
+ moduleIds: Array<string>
3055
+ exports: Array<string>
3056
+ filename: string
3057
+ modules: Record<string, BindingRenderedModule>
3058
+ imports: Array<string>
3059
+ dynamicImports: Array<string>
3060
+ code: string
3061
+ map?: BindingSourcemap
3062
+ sourcemapFilename?: string
3063
+ preliminaryFilename: string
3064
+ }
3065
+
3066
+ /** Error emitted from native side, it only contains kind and message, no stack trace. */
3067
+ export interface NativeError {
3068
+ kind: string
3069
+ message: string
3070
+ /** The id of the file associated with the error */
3071
+ id?: string
3072
+ /** The exporter associated with the error (for import/export errors) */
3073
+ exporter?: string
3074
+ /** Location information (line, column, file) */
3075
+ loc?: BindingLogLocation
3076
+ /** Position in the source file in UTF-16 code units */
3077
+ pos?: number
3078
+ }
3079
+
3080
+ export interface PreRenderedChunk {
3081
+ /** The name of this chunk, which is used in naming patterns. */
3082
+ name: string
3083
+ /** Whether this chunk is a static entry point. */
3084
+ isEntry: boolean
3085
+ /** Whether this chunk is a dynamic entry point. */
3086
+ isDynamicEntry: boolean
3087
+ /** The id of a module that this chunk corresponds to. */
3088
+ facadeModuleId?: string
3089
+ /** The list of ids of modules included in this chunk. */
3090
+ moduleIds: Array<string>
3091
+ /** Exported variable names from this chunk. */
3092
+ exports: Array<string>
3093
+ }
3094
+
3095
+ export declare function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void
3096
+
3097
+ export declare function resolveTsconfig(filename: string, cache: TsconfigCache | undefined | null, yarnPnp: boolean): BindingTsconfigResult | null
3098
+
3099
+ /**
3100
+ * Release one holder of the tokio runtime, shutting it down once none are left.
3101
+ *
3102
+ * This is required for the wasm target with `tokio_unstable` cfg.
3103
+ * In the wasm runtime, the `park` threads will hang there until the tokio::Runtime is shutdown.
3104
+ */
3105
+ export declare function shutdownAsyncRuntime(): void
3106
+
3107
+ /** Acquire one holder of the tokio runtime, starting it if it is not running. */
3108
+ export declare function startAsyncRuntime(): void
3109
+
3110
+ export interface ViteImportGlobMeta {
3111
+ isSubImportsPattern?: boolean
3112
+ }