unplugin-cloudflare-tunnel 0.0.4 → 0.0.5

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.
@@ -1,8 +1,3686 @@
1
1
  import { CloudflareTunnelOptions } from "./index.mjs";
2
- import * as rolldown0 from "rolldown";
3
2
 
3
+ //#region node_modules/rolldown/dist/shared/logging-BpAvp7KV.d.mts
4
+ //#region src/log/logging.d.ts
5
+ type LogLevel = "info" | "debug" | "warn";
6
+ type LogLevelOption = LogLevel | "silent";
7
+ type LogLevelWithError = LogLevel | "error";
8
+ interface RollupLog {
9
+ binding?: string;
10
+ cause?: unknown;
11
+ code?: string;
12
+ exporter?: string;
13
+ frame?: string;
14
+ hook?: string;
15
+ id?: string;
16
+ ids?: string[];
17
+ loc?: {
18
+ column: number;
19
+ file?: string;
20
+ line: number;
21
+ };
22
+ message: string;
23
+ meta?: any;
24
+ names?: string[];
25
+ plugin?: string;
26
+ pluginCode?: unknown;
27
+ pos?: number;
28
+ reexporter?: string;
29
+ stack?: string;
30
+ url?: string;
31
+ }
32
+ type RollupLogWithString = RollupLog | string;
33
+ interface RollupError extends RollupLog {
34
+ name?: string;
35
+ stack?: string;
36
+ watchFiles?: string[];
37
+ }
38
+ type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void; //#endregion
39
+ //#endregion
40
+ //#region node_modules/@oxc-project/types/types.d.ts
41
+ // Auto-generated code, DO NOT EDIT DIRECTLY!
42
+ // To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`.
43
+ interface Program extends Span {
44
+ type: "Program";
45
+ body: Array<Directive | Statement>;
46
+ sourceType: ModuleKind;
47
+ hashbang: Hashbang | null;
48
+ parent?: null;
49
+ }
50
+ type Expression = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | V8IntrinsicExpression | MemberExpression;
51
+ interface IdentifierName extends Span {
52
+ type: "Identifier";
53
+ decorators?: [];
54
+ name: string;
55
+ optional?: false;
56
+ typeAnnotation?: null;
57
+ parent?: Node;
58
+ }
59
+ interface IdentifierReference extends Span {
60
+ type: "Identifier";
61
+ decorators?: [];
62
+ name: string;
63
+ optional?: false;
64
+ typeAnnotation?: null;
65
+ parent?: Node;
66
+ }
67
+ interface BindingIdentifier extends Span {
68
+ type: "Identifier";
69
+ decorators?: [];
70
+ name: string;
71
+ optional?: false;
72
+ typeAnnotation?: null;
73
+ parent?: Node;
74
+ }
75
+ interface LabelIdentifier extends Span {
76
+ type: "Identifier";
77
+ decorators?: [];
78
+ name: string;
79
+ optional?: false;
80
+ typeAnnotation?: null;
81
+ parent?: Node;
82
+ }
83
+ interface ThisExpression extends Span {
84
+ type: "ThisExpression";
85
+ parent?: Node;
86
+ }
87
+ interface ArrayExpression extends Span {
88
+ type: "ArrayExpression";
89
+ elements: Array<ArrayExpressionElement>;
90
+ parent?: Node;
91
+ }
92
+ type ArrayExpressionElement = SpreadElement | null | Expression;
93
+ interface ObjectExpression extends Span {
94
+ type: "ObjectExpression";
95
+ properties: Array<ObjectPropertyKind>;
96
+ parent?: Node;
97
+ }
98
+ type ObjectPropertyKind = ObjectProperty | SpreadElement;
99
+ interface ObjectProperty extends Span {
100
+ type: "Property";
101
+ kind: PropertyKind;
102
+ key: PropertyKey;
103
+ value: Expression;
104
+ method: boolean;
105
+ shorthand: boolean;
106
+ computed: boolean;
107
+ optional?: false;
108
+ parent?: Node;
109
+ }
110
+ type PropertyKey = IdentifierName | PrivateIdentifier | Expression;
111
+ type PropertyKind = "init" | "get" | "set";
112
+ interface TemplateLiteral extends Span {
113
+ type: "TemplateLiteral";
114
+ quasis: Array<TemplateElement>;
115
+ expressions: Array<Expression>;
116
+ parent?: Node;
117
+ }
118
+ interface TaggedTemplateExpression extends Span {
119
+ type: "TaggedTemplateExpression";
120
+ tag: Expression;
121
+ typeArguments?: TSTypeParameterInstantiation | null;
122
+ quasi: TemplateLiteral;
123
+ parent?: Node;
124
+ }
125
+ interface TemplateElement extends Span {
126
+ type: "TemplateElement";
127
+ value: TemplateElementValue;
128
+ tail: boolean;
129
+ parent?: Node;
130
+ }
131
+ interface TemplateElementValue {
132
+ raw: string;
133
+ cooked: string | null;
134
+ }
135
+ type MemberExpression = ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;
136
+ interface ComputedMemberExpression extends Span {
137
+ type: "MemberExpression";
138
+ object: Expression;
139
+ property: Expression;
140
+ optional: boolean;
141
+ computed: true;
142
+ parent?: Node;
143
+ }
144
+ interface StaticMemberExpression extends Span {
145
+ type: "MemberExpression";
146
+ object: Expression;
147
+ property: IdentifierName;
148
+ optional: boolean;
149
+ computed: false;
150
+ parent?: Node;
151
+ }
152
+ interface PrivateFieldExpression extends Span {
153
+ type: "MemberExpression";
154
+ object: Expression;
155
+ property: PrivateIdentifier;
156
+ optional: boolean;
157
+ computed: false;
158
+ parent?: Node;
159
+ }
160
+ interface CallExpression extends Span {
161
+ type: "CallExpression";
162
+ callee: Expression;
163
+ typeArguments?: TSTypeParameterInstantiation | null;
164
+ arguments: Array<Argument>;
165
+ optional: boolean;
166
+ parent?: Node;
167
+ }
168
+ interface NewExpression extends Span {
169
+ type: "NewExpression";
170
+ callee: Expression;
171
+ typeArguments?: TSTypeParameterInstantiation | null;
172
+ arguments: Array<Argument>;
173
+ parent?: Node;
174
+ }
175
+ interface MetaProperty extends Span {
176
+ type: "MetaProperty";
177
+ meta: IdentifierName;
178
+ property: IdentifierName;
179
+ parent?: Node;
180
+ }
181
+ interface SpreadElement extends Span {
182
+ type: "SpreadElement";
183
+ argument: Expression;
184
+ parent?: Node;
185
+ }
186
+ type Argument = SpreadElement | Expression;
187
+ interface UpdateExpression extends Span {
188
+ type: "UpdateExpression";
189
+ operator: UpdateOperator;
190
+ prefix: boolean;
191
+ argument: SimpleAssignmentTarget;
192
+ parent?: Node;
193
+ }
194
+ interface UnaryExpression extends Span {
195
+ type: "UnaryExpression";
196
+ operator: UnaryOperator;
197
+ argument: Expression;
198
+ prefix: true;
199
+ parent?: Node;
200
+ }
201
+ interface BinaryExpression extends Span {
202
+ type: "BinaryExpression";
203
+ left: Expression;
204
+ operator: BinaryOperator;
205
+ right: Expression;
206
+ parent?: Node;
207
+ }
208
+ interface PrivateInExpression extends Span {
209
+ type: "BinaryExpression";
210
+ left: PrivateIdentifier;
211
+ operator: "in";
212
+ right: Expression;
213
+ parent?: Node;
214
+ }
215
+ interface LogicalExpression extends Span {
216
+ type: "LogicalExpression";
217
+ left: Expression;
218
+ operator: LogicalOperator;
219
+ right: Expression;
220
+ parent?: Node;
221
+ }
222
+ interface ConditionalExpression extends Span {
223
+ type: "ConditionalExpression";
224
+ test: Expression;
225
+ consequent: Expression;
226
+ alternate: Expression;
227
+ parent?: Node;
228
+ }
229
+ interface AssignmentExpression extends Span {
230
+ type: "AssignmentExpression";
231
+ operator: AssignmentOperator;
232
+ left: AssignmentTarget;
233
+ right: Expression;
234
+ parent?: Node;
235
+ }
236
+ type AssignmentTarget = SimpleAssignmentTarget | AssignmentTargetPattern;
237
+ type SimpleAssignmentTarget = IdentifierReference | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | MemberExpression;
238
+ type AssignmentTargetPattern = ArrayAssignmentTarget | ObjectAssignmentTarget;
239
+ interface ArrayAssignmentTarget extends Span {
240
+ type: "ArrayPattern";
241
+ decorators?: [];
242
+ elements: Array<AssignmentTargetMaybeDefault | AssignmentTargetRest | null>;
243
+ optional?: false;
244
+ typeAnnotation?: null;
245
+ parent?: Node;
246
+ }
247
+ interface ObjectAssignmentTarget extends Span {
248
+ type: "ObjectPattern";
249
+ decorators?: [];
250
+ properties: Array<AssignmentTargetProperty | AssignmentTargetRest>;
251
+ optional?: false;
252
+ typeAnnotation?: null;
253
+ parent?: Node;
254
+ }
255
+ interface AssignmentTargetRest extends Span {
256
+ type: "RestElement";
257
+ decorators?: [];
258
+ argument: AssignmentTarget;
259
+ optional?: false;
260
+ typeAnnotation?: null;
261
+ value?: null;
262
+ parent?: Node;
263
+ }
264
+ type AssignmentTargetMaybeDefault = AssignmentTargetWithDefault | AssignmentTarget;
265
+ interface AssignmentTargetWithDefault extends Span {
266
+ type: "AssignmentPattern";
267
+ decorators?: [];
268
+ left: AssignmentTarget;
269
+ right: Expression;
270
+ optional?: false;
271
+ typeAnnotation?: null;
272
+ parent?: Node;
273
+ }
274
+ type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty;
275
+ interface AssignmentTargetPropertyIdentifier extends Span {
276
+ type: "Property";
277
+ kind: "init";
278
+ key: IdentifierReference;
279
+ value: IdentifierReference | AssignmentTargetWithDefault;
280
+ method: false;
281
+ shorthand: true;
282
+ computed: false;
283
+ optional?: false;
284
+ parent?: Node;
285
+ }
286
+ interface AssignmentTargetPropertyProperty extends Span {
287
+ type: "Property";
288
+ kind: "init";
289
+ key: PropertyKey;
290
+ value: AssignmentTargetMaybeDefault;
291
+ method: false;
292
+ shorthand: false;
293
+ computed: boolean;
294
+ optional?: false;
295
+ parent?: Node;
296
+ }
297
+ interface SequenceExpression extends Span {
298
+ type: "SequenceExpression";
299
+ expressions: Array<Expression>;
300
+ parent?: Node;
301
+ }
302
+ interface Super extends Span {
303
+ type: "Super";
304
+ parent?: Node;
305
+ }
306
+ interface AwaitExpression extends Span {
307
+ type: "AwaitExpression";
308
+ argument: Expression;
309
+ parent?: Node;
310
+ }
311
+ interface ChainExpression extends Span {
312
+ type: "ChainExpression";
313
+ expression: ChainElement;
314
+ parent?: Node;
315
+ }
316
+ type ChainElement = CallExpression | TSNonNullExpression | MemberExpression;
317
+ interface ParenthesizedExpression extends Span {
318
+ type: "ParenthesizedExpression";
319
+ expression: Expression;
320
+ parent?: Node;
321
+ }
322
+ type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | WithStatement | Declaration | ModuleDeclaration;
323
+ interface Directive extends Span {
324
+ type: "ExpressionStatement";
325
+ expression: StringLiteral;
326
+ directive: string;
327
+ parent?: Node;
328
+ }
329
+ interface Hashbang extends Span {
330
+ type: "Hashbang";
331
+ value: string;
332
+ parent?: Node;
333
+ }
334
+ interface BlockStatement extends Span {
335
+ type: "BlockStatement";
336
+ body: Array<Statement>;
337
+ parent?: Node;
338
+ }
339
+ type Declaration = VariableDeclaration | Function | Class | TSTypeAliasDeclaration | TSInterfaceDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSGlobalDeclaration | TSImportEqualsDeclaration;
340
+ interface VariableDeclaration extends Span {
341
+ type: "VariableDeclaration";
342
+ kind: VariableDeclarationKind;
343
+ declarations: Array<VariableDeclarator>;
344
+ declare?: boolean;
345
+ parent?: Node;
346
+ }
347
+ type VariableDeclarationKind = "var" | "let" | "const" | "using" | "await using";
348
+ interface VariableDeclarator extends Span {
349
+ type: "VariableDeclarator";
350
+ id: BindingPattern;
351
+ init: Expression | null;
352
+ definite?: boolean;
353
+ parent?: Node;
354
+ }
355
+ interface EmptyStatement extends Span {
356
+ type: "EmptyStatement";
357
+ parent?: Node;
358
+ }
359
+ interface ExpressionStatement extends Span {
360
+ type: "ExpressionStatement";
361
+ expression: Expression;
362
+ directive?: string | null;
363
+ parent?: Node;
364
+ }
365
+ interface IfStatement extends Span {
366
+ type: "IfStatement";
367
+ test: Expression;
368
+ consequent: Statement;
369
+ alternate: Statement | null;
370
+ parent?: Node;
371
+ }
372
+ interface DoWhileStatement extends Span {
373
+ type: "DoWhileStatement";
374
+ body: Statement;
375
+ test: Expression;
376
+ parent?: Node;
377
+ }
378
+ interface WhileStatement extends Span {
379
+ type: "WhileStatement";
380
+ test: Expression;
381
+ body: Statement;
382
+ parent?: Node;
383
+ }
384
+ interface ForStatement extends Span {
385
+ type: "ForStatement";
386
+ init: ForStatementInit | null;
387
+ test: Expression | null;
388
+ update: Expression | null;
389
+ body: Statement;
390
+ parent?: Node;
391
+ }
392
+ type ForStatementInit = VariableDeclaration | Expression;
393
+ interface ForInStatement extends Span {
394
+ type: "ForInStatement";
395
+ left: ForStatementLeft;
396
+ right: Expression;
397
+ body: Statement;
398
+ parent?: Node;
399
+ }
400
+ type ForStatementLeft = VariableDeclaration | AssignmentTarget;
401
+ interface ForOfStatement extends Span {
402
+ type: "ForOfStatement";
403
+ await: boolean;
404
+ left: ForStatementLeft;
405
+ right: Expression;
406
+ body: Statement;
407
+ parent?: Node;
408
+ }
409
+ interface ContinueStatement extends Span {
410
+ type: "ContinueStatement";
411
+ label: LabelIdentifier | null;
412
+ parent?: Node;
413
+ }
414
+ interface BreakStatement extends Span {
415
+ type: "BreakStatement";
416
+ label: LabelIdentifier | null;
417
+ parent?: Node;
418
+ }
419
+ interface ReturnStatement extends Span {
420
+ type: "ReturnStatement";
421
+ argument: Expression | null;
422
+ parent?: Node;
423
+ }
424
+ interface WithStatement extends Span {
425
+ type: "WithStatement";
426
+ object: Expression;
427
+ body: Statement;
428
+ parent?: Node;
429
+ }
430
+ interface SwitchStatement extends Span {
431
+ type: "SwitchStatement";
432
+ discriminant: Expression;
433
+ cases: Array<SwitchCase>;
434
+ parent?: Node;
435
+ }
436
+ interface SwitchCase extends Span {
437
+ type: "SwitchCase";
438
+ test: Expression | null;
439
+ consequent: Array<Statement>;
440
+ parent?: Node;
441
+ }
442
+ interface LabeledStatement extends Span {
443
+ type: "LabeledStatement";
444
+ label: LabelIdentifier;
445
+ body: Statement;
446
+ parent?: Node;
447
+ }
448
+ interface ThrowStatement extends Span {
449
+ type: "ThrowStatement";
450
+ argument: Expression;
451
+ parent?: Node;
452
+ }
453
+ interface TryStatement extends Span {
454
+ type: "TryStatement";
455
+ block: BlockStatement;
456
+ handler: CatchClause | null;
457
+ finalizer: BlockStatement | null;
458
+ parent?: Node;
459
+ }
460
+ interface CatchClause extends Span {
461
+ type: "CatchClause";
462
+ param: BindingPattern | null;
463
+ body: BlockStatement;
464
+ parent?: Node;
465
+ }
466
+ interface DebuggerStatement extends Span {
467
+ type: "DebuggerStatement";
468
+ parent?: Node;
469
+ }
470
+ type BindingPattern = {
471
+ optional?: boolean;
472
+ typeAnnotation?: TSTypeAnnotation | null;
473
+ } & (BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern);
474
+ type BindingPatternKind = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern;
475
+ interface AssignmentPattern extends Span {
476
+ type: "AssignmentPattern";
477
+ decorators?: [];
478
+ left: BindingPattern;
479
+ right: Expression;
480
+ optional?: false;
481
+ typeAnnotation?: null;
482
+ parent?: Node;
483
+ }
484
+ interface ObjectPattern extends Span {
485
+ type: "ObjectPattern";
486
+ decorators?: [];
487
+ properties: Array<BindingProperty | BindingRestElement>;
488
+ optional?: false;
489
+ typeAnnotation?: null;
490
+ parent?: Node;
491
+ }
492
+ interface BindingProperty extends Span {
493
+ type: "Property";
494
+ kind: "init";
495
+ key: PropertyKey;
496
+ value: BindingPattern;
497
+ method: false;
498
+ shorthand: boolean;
499
+ computed: boolean;
500
+ optional?: false;
501
+ parent?: Node;
502
+ }
503
+ interface ArrayPattern extends Span {
504
+ type: "ArrayPattern";
505
+ decorators?: [];
506
+ elements: Array<BindingPattern | BindingRestElement | null>;
507
+ optional?: false;
508
+ typeAnnotation?: null;
509
+ parent?: Node;
510
+ }
511
+ interface BindingRestElement extends Span {
512
+ type: "RestElement";
513
+ decorators?: [];
514
+ argument: BindingPattern;
515
+ optional?: false;
516
+ typeAnnotation?: null;
517
+ value?: null;
518
+ parent?: Node;
519
+ }
520
+ interface Function extends Span {
521
+ type: FunctionType;
522
+ id: BindingIdentifier | null;
523
+ generator: boolean;
524
+ async: boolean;
525
+ declare?: boolean;
526
+ typeParameters?: TSTypeParameterDeclaration | null;
527
+ params: ParamPattern[];
528
+ returnType?: TSTypeAnnotation | null;
529
+ body: FunctionBody | null;
530
+ expression: false;
531
+ parent?: Node;
532
+ }
533
+ type ParamPattern = FormalParameter | TSParameterProperty | FormalParameterRest;
534
+ type FunctionType = "FunctionDeclaration" | "FunctionExpression" | "TSDeclareFunction" | "TSEmptyBodyFunctionExpression";
535
+ interface FormalParameterRest extends Span {
536
+ type: "RestElement";
537
+ argument: BindingPatternKind;
538
+ decorators?: [];
539
+ optional?: boolean;
540
+ typeAnnotation?: TSTypeAnnotation | null;
541
+ value?: null;
542
+ parent?: Node;
543
+ }
544
+ type FormalParameter = {
545
+ decorators?: Array<Decorator>;
546
+ } & BindingPattern;
547
+ interface TSParameterProperty extends Span {
548
+ type: "TSParameterProperty";
549
+ accessibility: TSAccessibility | null;
550
+ decorators: Array<Decorator>;
551
+ override: boolean;
552
+ parameter: FormalParameter;
553
+ readonly: boolean;
554
+ static: boolean;
555
+ parent?: Node;
556
+ }
557
+ interface FunctionBody extends Span {
558
+ type: "BlockStatement";
559
+ body: Array<Directive | Statement>;
560
+ parent?: Node;
561
+ }
562
+ interface ArrowFunctionExpression extends Span {
563
+ type: "ArrowFunctionExpression";
564
+ expression: boolean;
565
+ async: boolean;
566
+ typeParameters?: TSTypeParameterDeclaration | null;
567
+ params: ParamPattern[];
568
+ returnType?: TSTypeAnnotation | null;
569
+ body: FunctionBody | Expression;
570
+ id: null;
571
+ generator: false;
572
+ parent?: Node;
573
+ }
574
+ interface YieldExpression extends Span {
575
+ type: "YieldExpression";
576
+ delegate: boolean;
577
+ argument: Expression | null;
578
+ parent?: Node;
579
+ }
580
+ interface Class extends Span {
581
+ type: ClassType;
582
+ decorators: Array<Decorator>;
583
+ id: BindingIdentifier | null;
584
+ typeParameters?: TSTypeParameterDeclaration | null;
585
+ superClass: Expression | null;
586
+ superTypeArguments?: TSTypeParameterInstantiation | null;
587
+ implements?: Array<TSClassImplements>;
588
+ body: ClassBody;
589
+ abstract?: boolean;
590
+ declare?: boolean;
591
+ parent?: Node;
592
+ }
593
+ type ClassType = "ClassDeclaration" | "ClassExpression";
594
+ interface ClassBody extends Span {
595
+ type: "ClassBody";
596
+ body: Array<ClassElement>;
597
+ parent?: Node;
598
+ }
599
+ type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition | AccessorProperty | TSIndexSignature;
600
+ interface MethodDefinition extends Span {
601
+ type: MethodDefinitionType;
602
+ decorators: Array<Decorator>;
603
+ key: PropertyKey;
604
+ value: Function;
605
+ kind: MethodDefinitionKind;
606
+ computed: boolean;
607
+ static: boolean;
608
+ override?: boolean;
609
+ optional?: boolean;
610
+ accessibility?: TSAccessibility | null;
611
+ parent?: Node;
612
+ }
613
+ type MethodDefinitionType = "MethodDefinition" | "TSAbstractMethodDefinition";
614
+ interface PropertyDefinition extends Span {
615
+ type: PropertyDefinitionType;
616
+ decorators: Array<Decorator>;
617
+ key: PropertyKey;
618
+ typeAnnotation?: TSTypeAnnotation | null;
619
+ value: Expression | null;
620
+ computed: boolean;
621
+ static: boolean;
622
+ declare?: boolean;
623
+ override?: boolean;
624
+ optional?: boolean;
625
+ definite?: boolean;
626
+ readonly?: boolean;
627
+ accessibility?: TSAccessibility | null;
628
+ parent?: Node;
629
+ }
630
+ type PropertyDefinitionType = "PropertyDefinition" | "TSAbstractPropertyDefinition";
631
+ type MethodDefinitionKind = "constructor" | "method" | "get" | "set";
632
+ interface PrivateIdentifier extends Span {
633
+ type: "PrivateIdentifier";
634
+ name: string;
635
+ parent?: Node;
636
+ }
637
+ interface StaticBlock extends Span {
638
+ type: "StaticBlock";
639
+ body: Array<Statement>;
640
+ parent?: Node;
641
+ }
642
+ type ModuleDeclaration = ImportDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | TSExportAssignment | TSNamespaceExportDeclaration;
643
+ type AccessorPropertyType = "AccessorProperty" | "TSAbstractAccessorProperty";
644
+ interface AccessorProperty extends Span {
645
+ type: AccessorPropertyType;
646
+ decorators: Array<Decorator>;
647
+ key: PropertyKey;
648
+ typeAnnotation?: TSTypeAnnotation | null;
649
+ value: Expression | null;
650
+ computed: boolean;
651
+ static: boolean;
652
+ override?: boolean;
653
+ definite?: boolean;
654
+ accessibility?: TSAccessibility | null;
655
+ declare?: false;
656
+ optional?: false;
657
+ readonly?: false;
658
+ parent?: Node;
659
+ }
660
+ interface ImportExpression extends Span {
661
+ type: "ImportExpression";
662
+ source: Expression;
663
+ options: Expression | null;
664
+ phase: ImportPhase | null;
665
+ parent?: Node;
666
+ }
667
+ interface ImportDeclaration extends Span {
668
+ type: "ImportDeclaration";
669
+ specifiers: Array<ImportDeclarationSpecifier>;
670
+ source: StringLiteral;
671
+ phase: ImportPhase | null;
672
+ attributes: Array<ImportAttribute>;
673
+ importKind?: ImportOrExportKind;
674
+ parent?: Node;
675
+ }
676
+ type ImportPhase = "source" | "defer";
677
+ type ImportDeclarationSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
678
+ interface ImportSpecifier extends Span {
679
+ type: "ImportSpecifier";
680
+ imported: ModuleExportName;
681
+ local: BindingIdentifier;
682
+ importKind?: ImportOrExportKind;
683
+ parent?: Node;
684
+ }
685
+ interface ImportDefaultSpecifier extends Span {
686
+ type: "ImportDefaultSpecifier";
687
+ local: BindingIdentifier;
688
+ parent?: Node;
689
+ }
690
+ interface ImportNamespaceSpecifier extends Span {
691
+ type: "ImportNamespaceSpecifier";
692
+ local: BindingIdentifier;
693
+ parent?: Node;
694
+ }
695
+ interface ImportAttribute extends Span {
696
+ type: "ImportAttribute";
697
+ key: ImportAttributeKey;
698
+ value: StringLiteral;
699
+ parent?: Node;
700
+ }
701
+ type ImportAttributeKey = IdentifierName | StringLiteral;
702
+ interface ExportNamedDeclaration extends Span {
703
+ type: "ExportNamedDeclaration";
704
+ declaration: Declaration | null;
705
+ specifiers: Array<ExportSpecifier>;
706
+ source: StringLiteral | null;
707
+ exportKind?: ImportOrExportKind;
708
+ attributes: Array<ImportAttribute>;
709
+ parent?: Node;
710
+ }
711
+ interface ExportDefaultDeclaration extends Span {
712
+ type: "ExportDefaultDeclaration";
713
+ declaration: ExportDefaultDeclarationKind;
714
+ exportKind?: "value";
715
+ parent?: Node;
716
+ }
717
+ interface ExportAllDeclaration extends Span {
718
+ type: "ExportAllDeclaration";
719
+ exported: ModuleExportName | null;
720
+ source: StringLiteral;
721
+ attributes: Array<ImportAttribute>;
722
+ exportKind?: ImportOrExportKind;
723
+ parent?: Node;
724
+ }
725
+ interface ExportSpecifier extends Span {
726
+ type: "ExportSpecifier";
727
+ local: ModuleExportName;
728
+ exported: ModuleExportName;
729
+ exportKind?: ImportOrExportKind;
730
+ parent?: Node;
731
+ }
732
+ type ExportDefaultDeclarationKind = Function | Class | TSInterfaceDeclaration | Expression;
733
+ type ModuleExportName = IdentifierName | IdentifierReference | StringLiteral;
734
+ interface V8IntrinsicExpression extends Span {
735
+ type: "V8IntrinsicExpression";
736
+ name: IdentifierName;
737
+ arguments: Array<Argument>;
738
+ parent?: Node;
739
+ }
740
+ interface BooleanLiteral extends Span {
741
+ type: "Literal";
742
+ value: boolean;
743
+ raw: string | null;
744
+ parent?: Node;
745
+ }
746
+ interface NullLiteral extends Span {
747
+ type: "Literal";
748
+ value: null;
749
+ raw: "null" | null;
750
+ parent?: Node;
751
+ }
752
+ interface NumericLiteral extends Span {
753
+ type: "Literal";
754
+ value: number;
755
+ raw: string | null;
756
+ parent?: Node;
757
+ }
758
+ interface StringLiteral extends Span {
759
+ type: "Literal";
760
+ value: string;
761
+ raw: string | null;
762
+ parent?: Node;
763
+ }
764
+ interface BigIntLiteral extends Span {
765
+ type: "Literal";
766
+ value: bigint;
767
+ raw: string | null;
768
+ bigint: string;
769
+ parent?: Node;
770
+ }
771
+ interface RegExpLiteral extends Span {
772
+ type: "Literal";
773
+ value: RegExp | null;
774
+ raw: string | null;
775
+ regex: {
776
+ pattern: string;
777
+ flags: string;
778
+ };
779
+ parent?: Node;
780
+ }
781
+ interface JSXElement extends Span {
782
+ type: "JSXElement";
783
+ openingElement: JSXOpeningElement;
784
+ children: Array<JSXChild>;
785
+ closingElement: JSXClosingElement | null;
786
+ parent?: Node;
787
+ }
788
+ interface JSXOpeningElement extends Span {
789
+ type: "JSXOpeningElement";
790
+ name: JSXElementName;
791
+ typeArguments?: TSTypeParameterInstantiation | null;
792
+ attributes: Array<JSXAttributeItem>;
793
+ selfClosing: boolean;
794
+ parent?: Node;
795
+ }
796
+ interface JSXClosingElement extends Span {
797
+ type: "JSXClosingElement";
798
+ name: JSXElementName;
799
+ parent?: Node;
800
+ }
801
+ interface JSXFragment extends Span {
802
+ type: "JSXFragment";
803
+ openingFragment: JSXOpeningFragment;
804
+ children: Array<JSXChild>;
805
+ closingFragment: JSXClosingFragment;
806
+ parent?: Node;
807
+ }
808
+ interface JSXOpeningFragment extends Span {
809
+ type: "JSXOpeningFragment";
810
+ attributes?: [];
811
+ selfClosing?: false;
812
+ parent?: Node;
813
+ }
814
+ interface JSXClosingFragment extends Span {
815
+ type: "JSXClosingFragment";
816
+ parent?: Node;
817
+ }
818
+ type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression;
819
+ interface JSXNamespacedName extends Span {
820
+ type: "JSXNamespacedName";
821
+ namespace: JSXIdentifier;
822
+ name: JSXIdentifier;
823
+ parent?: Node;
824
+ }
825
+ interface JSXMemberExpression extends Span {
826
+ type: "JSXMemberExpression";
827
+ object: JSXMemberExpressionObject;
828
+ property: JSXIdentifier;
829
+ parent?: Node;
830
+ }
831
+ type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression;
832
+ interface JSXExpressionContainer extends Span {
833
+ type: "JSXExpressionContainer";
834
+ expression: JSXExpression;
835
+ parent?: Node;
836
+ }
837
+ type JSXExpression = JSXEmptyExpression | Expression;
838
+ interface JSXEmptyExpression extends Span {
839
+ type: "JSXEmptyExpression";
840
+ parent?: Node;
841
+ }
842
+ type JSXAttributeItem = JSXAttribute | JSXSpreadAttribute;
843
+ interface JSXAttribute extends Span {
844
+ type: "JSXAttribute";
845
+ name: JSXAttributeName;
846
+ value: JSXAttributeValue | null;
847
+ parent?: Node;
848
+ }
849
+ interface JSXSpreadAttribute extends Span {
850
+ type: "JSXSpreadAttribute";
851
+ argument: Expression;
852
+ parent?: Node;
853
+ }
854
+ type JSXAttributeName = JSXIdentifier | JSXNamespacedName;
855
+ type JSXAttributeValue = StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment;
856
+ interface JSXIdentifier extends Span {
857
+ type: "JSXIdentifier";
858
+ name: string;
859
+ parent?: Node;
860
+ }
861
+ type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild;
862
+ interface JSXSpreadChild extends Span {
863
+ type: "JSXSpreadChild";
864
+ expression: Expression;
865
+ parent?: Node;
866
+ }
867
+ interface JSXText extends Span {
868
+ type: "JSXText";
869
+ value: string;
870
+ raw: string | null;
871
+ parent?: Node;
872
+ }
873
+ interface TSThisParameter extends Span {
874
+ type: "Identifier";
875
+ decorators: [];
876
+ name: "this";
877
+ optional: false;
878
+ typeAnnotation: TSTypeAnnotation | null;
879
+ parent?: Node;
880
+ }
881
+ interface TSEnumDeclaration extends Span {
882
+ type: "TSEnumDeclaration";
883
+ id: BindingIdentifier;
884
+ body: TSEnumBody;
885
+ const: boolean;
886
+ declare: boolean;
887
+ parent?: Node;
888
+ }
889
+ interface TSEnumBody extends Span {
890
+ type: "TSEnumBody";
891
+ members: Array<TSEnumMember>;
892
+ parent?: Node;
893
+ }
894
+ interface TSEnumMember extends Span {
895
+ type: "TSEnumMember";
896
+ id: TSEnumMemberName;
897
+ initializer: Expression | null;
898
+ computed: boolean;
899
+ parent?: Node;
900
+ }
901
+ type TSEnumMemberName = IdentifierName | StringLiteral | TemplateLiteral;
902
+ interface TSTypeAnnotation extends Span {
903
+ type: "TSTypeAnnotation";
904
+ typeAnnotation: TSType;
905
+ parent?: Node;
906
+ }
907
+ interface TSLiteralType extends Span {
908
+ type: "TSLiteralType";
909
+ literal: TSLiteral;
910
+ parent?: Node;
911
+ }
912
+ type TSLiteral = BooleanLiteral | NumericLiteral | BigIntLiteral | StringLiteral | TemplateLiteral | UnaryExpression;
913
+ type TSType = TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSArrayType | TSConditionalType | TSConstructorType | TSFunctionType | TSImportType | TSIndexedAccessType | TSInferType | TSIntersectionType | TSLiteralType | TSMappedType | TSNamedTupleMember | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUnionType | TSParenthesizedType | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType;
914
+ interface TSConditionalType extends Span {
915
+ type: "TSConditionalType";
916
+ checkType: TSType;
917
+ extendsType: TSType;
918
+ trueType: TSType;
919
+ falseType: TSType;
920
+ parent?: Node;
921
+ }
922
+ interface TSUnionType extends Span {
923
+ type: "TSUnionType";
924
+ types: Array<TSType>;
925
+ parent?: Node;
926
+ }
927
+ interface TSIntersectionType extends Span {
928
+ type: "TSIntersectionType";
929
+ types: Array<TSType>;
930
+ parent?: Node;
931
+ }
932
+ interface TSParenthesizedType extends Span {
933
+ type: "TSParenthesizedType";
934
+ typeAnnotation: TSType;
935
+ parent?: Node;
936
+ }
937
+ interface TSTypeOperator extends Span {
938
+ type: "TSTypeOperator";
939
+ operator: TSTypeOperatorOperator;
940
+ typeAnnotation: TSType;
941
+ parent?: Node;
942
+ }
943
+ type TSTypeOperatorOperator = "keyof" | "unique" | "readonly";
944
+ interface TSArrayType extends Span {
945
+ type: "TSArrayType";
946
+ elementType: TSType;
947
+ parent?: Node;
948
+ }
949
+ interface TSIndexedAccessType extends Span {
950
+ type: "TSIndexedAccessType";
951
+ objectType: TSType;
952
+ indexType: TSType;
953
+ parent?: Node;
954
+ }
955
+ interface TSTupleType extends Span {
956
+ type: "TSTupleType";
957
+ elementTypes: Array<TSTupleElement>;
958
+ parent?: Node;
959
+ }
960
+ interface TSNamedTupleMember extends Span {
961
+ type: "TSNamedTupleMember";
962
+ label: IdentifierName;
963
+ elementType: TSTupleElement;
964
+ optional: boolean;
965
+ parent?: Node;
966
+ }
967
+ interface TSOptionalType extends Span {
968
+ type: "TSOptionalType";
969
+ typeAnnotation: TSType;
970
+ parent?: Node;
971
+ }
972
+ interface TSRestType extends Span {
973
+ type: "TSRestType";
974
+ typeAnnotation: TSType;
975
+ parent?: Node;
976
+ }
977
+ type TSTupleElement = TSOptionalType | TSRestType | TSType;
978
+ interface TSAnyKeyword extends Span {
979
+ type: "TSAnyKeyword";
980
+ parent?: Node;
981
+ }
982
+ interface TSStringKeyword extends Span {
983
+ type: "TSStringKeyword";
984
+ parent?: Node;
985
+ }
986
+ interface TSBooleanKeyword extends Span {
987
+ type: "TSBooleanKeyword";
988
+ parent?: Node;
989
+ }
990
+ interface TSNumberKeyword extends Span {
991
+ type: "TSNumberKeyword";
992
+ parent?: Node;
993
+ }
994
+ interface TSNeverKeyword extends Span {
995
+ type: "TSNeverKeyword";
996
+ parent?: Node;
997
+ }
998
+ interface TSIntrinsicKeyword extends Span {
999
+ type: "TSIntrinsicKeyword";
1000
+ parent?: Node;
1001
+ }
1002
+ interface TSUnknownKeyword extends Span {
1003
+ type: "TSUnknownKeyword";
1004
+ parent?: Node;
1005
+ }
1006
+ interface TSNullKeyword extends Span {
1007
+ type: "TSNullKeyword";
1008
+ parent?: Node;
1009
+ }
1010
+ interface TSUndefinedKeyword extends Span {
1011
+ type: "TSUndefinedKeyword";
1012
+ parent?: Node;
1013
+ }
1014
+ interface TSVoidKeyword extends Span {
1015
+ type: "TSVoidKeyword";
1016
+ parent?: Node;
1017
+ }
1018
+ interface TSSymbolKeyword extends Span {
1019
+ type: "TSSymbolKeyword";
1020
+ parent?: Node;
1021
+ }
1022
+ interface TSThisType extends Span {
1023
+ type: "TSThisType";
1024
+ parent?: Node;
1025
+ }
1026
+ interface TSObjectKeyword extends Span {
1027
+ type: "TSObjectKeyword";
1028
+ parent?: Node;
1029
+ }
1030
+ interface TSBigIntKeyword extends Span {
1031
+ type: "TSBigIntKeyword";
1032
+ parent?: Node;
1033
+ }
1034
+ interface TSTypeReference extends Span {
1035
+ type: "TSTypeReference";
1036
+ typeName: TSTypeName;
1037
+ typeArguments: TSTypeParameterInstantiation | null;
1038
+ parent?: Node;
1039
+ }
1040
+ type TSTypeName = IdentifierReference | TSQualifiedName | ThisExpression;
1041
+ interface TSQualifiedName extends Span {
1042
+ type: "TSQualifiedName";
1043
+ left: TSTypeName;
1044
+ right: IdentifierName;
1045
+ parent?: Node;
1046
+ }
1047
+ interface TSTypeParameterInstantiation extends Span {
1048
+ type: "TSTypeParameterInstantiation";
1049
+ params: Array<TSType>;
1050
+ parent?: Node;
1051
+ }
1052
+ interface TSTypeParameter extends Span {
1053
+ type: "TSTypeParameter";
1054
+ name: BindingIdentifier;
1055
+ constraint: TSType | null;
1056
+ default: TSType | null;
1057
+ in: boolean;
1058
+ out: boolean;
1059
+ const: boolean;
1060
+ parent?: Node;
1061
+ }
1062
+ interface TSTypeParameterDeclaration extends Span {
1063
+ type: "TSTypeParameterDeclaration";
1064
+ params: Array<TSTypeParameter>;
1065
+ parent?: Node;
1066
+ }
1067
+ interface TSTypeAliasDeclaration extends Span {
1068
+ type: "TSTypeAliasDeclaration";
1069
+ id: BindingIdentifier;
1070
+ typeParameters: TSTypeParameterDeclaration | null;
1071
+ typeAnnotation: TSType;
1072
+ declare: boolean;
1073
+ parent?: Node;
1074
+ }
1075
+ type TSAccessibility = "private" | "protected" | "public";
1076
+ interface TSClassImplements extends Span {
1077
+ type: "TSClassImplements";
1078
+ expression: IdentifierReference | ThisExpression | MemberExpression;
1079
+ typeArguments: TSTypeParameterInstantiation | null;
1080
+ parent?: Node;
1081
+ }
1082
+ interface TSInterfaceDeclaration extends Span {
1083
+ type: "TSInterfaceDeclaration";
1084
+ id: BindingIdentifier;
1085
+ typeParameters: TSTypeParameterDeclaration | null;
1086
+ extends: Array<TSInterfaceHeritage>;
1087
+ body: TSInterfaceBody;
1088
+ declare: boolean;
1089
+ parent?: Node;
1090
+ }
1091
+ interface TSInterfaceBody extends Span {
1092
+ type: "TSInterfaceBody";
1093
+ body: Array<TSSignature>;
1094
+ parent?: Node;
1095
+ }
1096
+ interface TSPropertySignature extends Span {
1097
+ type: "TSPropertySignature";
1098
+ computed: boolean;
1099
+ optional: boolean;
1100
+ readonly: boolean;
1101
+ key: PropertyKey;
1102
+ typeAnnotation: TSTypeAnnotation | null;
1103
+ accessibility: null;
1104
+ static: false;
1105
+ parent?: Node;
1106
+ }
1107
+ type TSSignature = TSIndexSignature | TSPropertySignature | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSMethodSignature;
1108
+ interface TSIndexSignature extends Span {
1109
+ type: "TSIndexSignature";
1110
+ parameters: Array<TSIndexSignatureName>;
1111
+ typeAnnotation: TSTypeAnnotation;
1112
+ readonly: boolean;
1113
+ static: boolean;
1114
+ accessibility: null;
1115
+ parent?: Node;
1116
+ }
1117
+ interface TSCallSignatureDeclaration extends Span {
1118
+ type: "TSCallSignatureDeclaration";
1119
+ typeParameters: TSTypeParameterDeclaration | null;
1120
+ params: ParamPattern[];
1121
+ returnType: TSTypeAnnotation | null;
1122
+ parent?: Node;
1123
+ }
1124
+ type TSMethodSignatureKind = "method" | "get" | "set";
1125
+ interface TSMethodSignature extends Span {
1126
+ type: "TSMethodSignature";
1127
+ key: PropertyKey;
1128
+ computed: boolean;
1129
+ optional: boolean;
1130
+ kind: TSMethodSignatureKind;
1131
+ typeParameters: TSTypeParameterDeclaration | null;
1132
+ params: ParamPattern[];
1133
+ returnType: TSTypeAnnotation | null;
1134
+ accessibility: null;
1135
+ readonly: false;
1136
+ static: false;
1137
+ parent?: Node;
1138
+ }
1139
+ interface TSConstructSignatureDeclaration extends Span {
1140
+ type: "TSConstructSignatureDeclaration";
1141
+ typeParameters: TSTypeParameterDeclaration | null;
1142
+ params: ParamPattern[];
1143
+ returnType: TSTypeAnnotation | null;
1144
+ parent?: Node;
1145
+ }
1146
+ interface TSIndexSignatureName extends Span {
1147
+ type: "Identifier";
1148
+ decorators: [];
1149
+ name: string;
1150
+ optional: false;
1151
+ typeAnnotation: TSTypeAnnotation;
1152
+ parent?: Node;
1153
+ }
1154
+ interface TSInterfaceHeritage extends Span {
1155
+ type: "TSInterfaceHeritage";
1156
+ expression: Expression;
1157
+ typeArguments: TSTypeParameterInstantiation | null;
1158
+ parent?: Node;
1159
+ }
1160
+ interface TSTypePredicate extends Span {
1161
+ type: "TSTypePredicate";
1162
+ parameterName: TSTypePredicateName;
1163
+ asserts: boolean;
1164
+ typeAnnotation: TSTypeAnnotation | null;
1165
+ parent?: Node;
1166
+ }
1167
+ type TSTypePredicateName = IdentifierName | TSThisType;
1168
+ interface TSModuleDeclaration extends Span {
1169
+ type: "TSModuleDeclaration";
1170
+ id: BindingIdentifier | StringLiteral | TSQualifiedName;
1171
+ body: TSModuleBlock | null;
1172
+ kind: TSModuleDeclarationKind;
1173
+ declare: boolean;
1174
+ global: false;
1175
+ parent?: Node;
1176
+ }
1177
+ type TSModuleDeclarationKind = "module" | "namespace";
1178
+ interface TSGlobalDeclaration extends Span {
1179
+ type: "TSModuleDeclaration";
1180
+ id: IdentifierName;
1181
+ body: TSModuleBlock;
1182
+ kind: "global";
1183
+ declare: boolean;
1184
+ global: true;
1185
+ parent?: Node;
1186
+ }
1187
+ interface TSModuleBlock extends Span {
1188
+ type: "TSModuleBlock";
1189
+ body: Array<Directive | Statement>;
1190
+ parent?: Node;
1191
+ }
1192
+ interface TSTypeLiteral extends Span {
1193
+ type: "TSTypeLiteral";
1194
+ members: Array<TSSignature>;
1195
+ parent?: Node;
1196
+ }
1197
+ interface TSInferType extends Span {
1198
+ type: "TSInferType";
1199
+ typeParameter: TSTypeParameter;
1200
+ parent?: Node;
1201
+ }
1202
+ interface TSTypeQuery extends Span {
1203
+ type: "TSTypeQuery";
1204
+ exprName: TSTypeQueryExprName;
1205
+ typeArguments: TSTypeParameterInstantiation | null;
1206
+ parent?: Node;
1207
+ }
1208
+ type TSTypeQueryExprName = TSImportType | TSTypeName;
1209
+ interface TSImportType extends Span {
1210
+ type: "TSImportType";
1211
+ source: StringLiteral;
1212
+ options: ObjectExpression | null;
1213
+ qualifier: TSImportTypeQualifier | null;
1214
+ typeArguments: TSTypeParameterInstantiation | null;
1215
+ parent?: Node;
1216
+ }
1217
+ type TSImportTypeQualifier = IdentifierName | TSImportTypeQualifiedName;
1218
+ interface TSImportTypeQualifiedName extends Span {
1219
+ type: "TSQualifiedName";
1220
+ left: TSImportTypeQualifier;
1221
+ right: IdentifierName;
1222
+ parent?: Node;
1223
+ }
1224
+ interface TSFunctionType extends Span {
1225
+ type: "TSFunctionType";
1226
+ typeParameters: TSTypeParameterDeclaration | null;
1227
+ params: ParamPattern[];
1228
+ returnType: TSTypeAnnotation;
1229
+ parent?: Node;
1230
+ }
1231
+ interface TSConstructorType extends Span {
1232
+ type: "TSConstructorType";
1233
+ abstract: boolean;
1234
+ typeParameters: TSTypeParameterDeclaration | null;
1235
+ params: ParamPattern[];
1236
+ returnType: TSTypeAnnotation;
1237
+ parent?: Node;
1238
+ }
1239
+ interface TSMappedType extends Span {
1240
+ type: "TSMappedType";
1241
+ key: TSTypeParameter["name"];
1242
+ constraint: TSTypeParameter["constraint"];
1243
+ nameType: TSType | null;
1244
+ typeAnnotation: TSType | null;
1245
+ optional: TSMappedTypeModifierOperator | false;
1246
+ readonly: TSMappedTypeModifierOperator | null;
1247
+ parent?: Node;
1248
+ }
1249
+ type TSMappedTypeModifierOperator = true | "+" | "-";
1250
+ interface TSTemplateLiteralType extends Span {
1251
+ type: "TSTemplateLiteralType";
1252
+ quasis: Array<TemplateElement>;
1253
+ types: Array<TSType>;
1254
+ parent?: Node;
1255
+ }
1256
+ interface TSAsExpression extends Span {
1257
+ type: "TSAsExpression";
1258
+ expression: Expression;
1259
+ typeAnnotation: TSType;
1260
+ parent?: Node;
1261
+ }
1262
+ interface TSSatisfiesExpression extends Span {
1263
+ type: "TSSatisfiesExpression";
1264
+ expression: Expression;
1265
+ typeAnnotation: TSType;
1266
+ parent?: Node;
1267
+ }
1268
+ interface TSTypeAssertion extends Span {
1269
+ type: "TSTypeAssertion";
1270
+ typeAnnotation: TSType;
1271
+ expression: Expression;
1272
+ parent?: Node;
1273
+ }
1274
+ interface TSImportEqualsDeclaration extends Span {
1275
+ type: "TSImportEqualsDeclaration";
1276
+ id: BindingIdentifier;
1277
+ moduleReference: TSModuleReference;
1278
+ importKind: ImportOrExportKind;
1279
+ parent?: Node;
1280
+ }
1281
+ type TSModuleReference = TSExternalModuleReference | TSTypeName;
1282
+ interface TSExternalModuleReference extends Span {
1283
+ type: "TSExternalModuleReference";
1284
+ expression: StringLiteral;
1285
+ parent?: Node;
1286
+ }
1287
+ interface TSNonNullExpression extends Span {
1288
+ type: "TSNonNullExpression";
1289
+ expression: Expression;
1290
+ parent?: Node;
1291
+ }
1292
+ interface Decorator extends Span {
1293
+ type: "Decorator";
1294
+ expression: Expression;
1295
+ parent?: Node;
1296
+ }
1297
+ interface TSExportAssignment extends Span {
1298
+ type: "TSExportAssignment";
1299
+ expression: Expression;
1300
+ parent?: Node;
1301
+ }
1302
+ interface TSNamespaceExportDeclaration extends Span {
1303
+ type: "TSNamespaceExportDeclaration";
1304
+ id: IdentifierName;
1305
+ parent?: Node;
1306
+ }
1307
+ interface TSInstantiationExpression extends Span {
1308
+ type: "TSInstantiationExpression";
1309
+ expression: Expression;
1310
+ typeArguments: TSTypeParameterInstantiation;
1311
+ parent?: Node;
1312
+ }
1313
+ type ImportOrExportKind = "value" | "type";
1314
+ interface JSDocNullableType extends Span {
1315
+ type: "TSJSDocNullableType";
1316
+ typeAnnotation: TSType;
1317
+ postfix: boolean;
1318
+ parent?: Node;
1319
+ }
1320
+ interface JSDocNonNullableType extends Span {
1321
+ type: "TSJSDocNonNullableType";
1322
+ typeAnnotation: TSType;
1323
+ postfix: boolean;
1324
+ parent?: Node;
1325
+ }
1326
+ interface JSDocUnknownType extends Span {
1327
+ type: "TSJSDocUnknownType";
1328
+ parent?: Node;
1329
+ }
1330
+ type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
1331
+ type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "**" | "<<" | ">>" | ">>>" | "|" | "^" | "&" | "in" | "instanceof";
1332
+ type LogicalOperator = "||" | "&&" | "??";
1333
+ type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
1334
+ type UpdateOperator = "++" | "--";
1335
+ interface Span {
1336
+ start: number;
1337
+ end: number;
1338
+ range?: [number, number];
1339
+ }
1340
+ type ModuleKind = "script" | "module";
1341
+ type Node = Program | IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | ThisExpression | ArrayExpression | ObjectExpression | ObjectProperty | TemplateLiteral | TaggedTemplateExpression | TemplateElement | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | CallExpression | NewExpression | MetaProperty | SpreadElement | UpdateExpression | UnaryExpression | BinaryExpression | PrivateInExpression | LogicalExpression | ConditionalExpression | AssignmentExpression | ArrayAssignmentTarget | ObjectAssignmentTarget | AssignmentTargetRest | AssignmentTargetWithDefault | AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty | SequenceExpression | Super | AwaitExpression | ChainExpression | ParenthesizedExpression | Directive | Hashbang | BlockStatement | VariableDeclaration | VariableDeclarator | EmptyStatement | ExpressionStatement | IfStatement | DoWhileStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | ContinueStatement | BreakStatement | ReturnStatement | WithStatement | SwitchStatement | SwitchCase | LabeledStatement | ThrowStatement | TryStatement | CatchClause | DebuggerStatement | AssignmentPattern | ObjectPattern | BindingProperty | ArrayPattern | BindingRestElement | Function | FunctionBody | ArrowFunctionExpression | YieldExpression | Class | ClassBody | MethodDefinition | PropertyDefinition | PrivateIdentifier | StaticBlock | AccessorProperty | ImportExpression | ImportDeclaration | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportAttribute | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExportSpecifier | V8IntrinsicExpression | BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXOpeningFragment | JSXClosingFragment | JSXNamespacedName | JSXMemberExpression | JSXExpressionContainer | JSXEmptyExpression | JSXAttribute | JSXSpreadAttribute | JSXIdentifier | JSXSpreadChild | JSXText | TSThisParameter | TSEnumDeclaration | TSEnumBody | TSEnumMember | TSTypeAnnotation | TSLiteralType | TSConditionalType | TSUnionType | TSIntersectionType | TSParenthesizedType | TSTypeOperator | TSArrayType | TSIndexedAccessType | TSTupleType | TSNamedTupleMember | TSOptionalType | TSRestType | TSAnyKeyword | TSStringKeyword | TSBooleanKeyword | TSNumberKeyword | TSNeverKeyword | TSIntrinsicKeyword | TSUnknownKeyword | TSNullKeyword | TSUndefinedKeyword | TSVoidKeyword | TSSymbolKeyword | TSThisType | TSObjectKeyword | TSBigIntKeyword | TSTypeReference | TSQualifiedName | TSTypeParameterInstantiation | TSTypeParameter | TSTypeParameterDeclaration | TSTypeAliasDeclaration | TSClassImplements | TSInterfaceDeclaration | TSInterfaceBody | TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration | TSMethodSignature | TSConstructSignatureDeclaration | TSIndexSignatureName | TSInterfaceHeritage | TSTypePredicate | TSModuleDeclaration | TSGlobalDeclaration | TSModuleBlock | TSTypeLiteral | TSInferType | TSTypeQuery | TSImportType | TSImportTypeQualifiedName | TSFunctionType | TSConstructorType | TSMappedType | TSTemplateLiteralType | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | Decorator | TSExportAssignment | TSNamespaceExportDeclaration | TSInstantiationExpression | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType | ParamPattern;
1342
+ //#endregion
1343
+ //#region node_modules/rolldown/dist/shared/binding-CDyF6W3D.d.mts
1344
+ interface CodegenOptions {
1345
+ /**
1346
+ * Remove whitespace.
1347
+ *
1348
+ * @default true
1349
+ */
1350
+ removeWhitespace?: boolean;
1351
+ }
1352
+ interface CompressOptions {
1353
+ /**
1354
+ * Set desired EcmaScript standard version for output.
1355
+ *
1356
+ * Set `esnext` to enable all target highering.
1357
+ *
1358
+ * Example:
1359
+ *
1360
+ * * `'es2015'`
1361
+ * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
1362
+ *
1363
+ * @default 'esnext'
1364
+ *
1365
+ * @see [esbuild#target](https://esbuild.github.io/api/#target)
1366
+ */
1367
+ target?: string | Array<string>;
1368
+ /**
1369
+ * Pass true to discard calls to `console.*`.
1370
+ *
1371
+ * @default false
1372
+ */
1373
+ dropConsole?: boolean;
1374
+ /**
1375
+ * Remove `debugger;` statements.
1376
+ *
1377
+ * @default true
1378
+ */
1379
+ dropDebugger?: boolean;
1380
+ /**
1381
+ * Pass `true` to drop unreferenced functions and variables.
1382
+ *
1383
+ * Simple direct variable assignments do not count as references unless set to `keep_assign`.
1384
+ * @default true
1385
+ */
1386
+ unused?: boolean | 'keep_assign';
1387
+ /** Keep function / class names. */
1388
+ keepNames?: CompressOptionsKeepNames;
1389
+ /**
1390
+ * Join consecutive var, let and const statements.
1391
+ *
1392
+ * @default true
1393
+ */
1394
+ joinVars?: boolean;
1395
+ /**
1396
+ * Join consecutive simple statements using the comma operator.
1397
+ *
1398
+ * `a; b` -> `a, b`
1399
+ *
1400
+ * @default true
1401
+ */
1402
+ sequences?: boolean;
1403
+ /**
1404
+ * Set of label names to drop from the code.
1405
+ *
1406
+ * Labeled statements matching these names will be removed during minification.
1407
+ *
1408
+ * @default []
1409
+ */
1410
+ dropLabels?: Array<string>;
1411
+ /** Limit the maximum number of iterations for debugging purpose. */
1412
+ maxIterations?: number;
1413
+ /** Treeshake options. */
1414
+ treeshake?: TreeShakeOptions;
1415
+ }
1416
+ interface CompressOptionsKeepNames {
1417
+ /**
1418
+ * Keep function names so that `Function.prototype.name` is preserved.
1419
+ *
1420
+ * This does not guarantee that the `undefined` name is preserved.
1421
+ *
1422
+ * @default false
1423
+ */
1424
+ function: boolean;
1425
+ /**
1426
+ * Keep class names so that `Class.prototype.name` is preserved.
1427
+ *
1428
+ * This does not guarantee that the `undefined` name is preserved.
1429
+ *
1430
+ * @default false
1431
+ */
1432
+ class: boolean;
1433
+ }
1434
+ interface MangleOptions {
1435
+ /**
1436
+ * Pass `true` to mangle names declared in the top level scope.
1437
+ *
1438
+ * @default false
1439
+ */
1440
+ toplevel?: boolean;
1441
+ /**
1442
+ * Preserve `name` property for functions and classes.
1443
+ *
1444
+ * @default false
1445
+ */
1446
+ keepNames?: boolean | MangleOptionsKeepNames;
1447
+ /** Debug mangled names. */
1448
+ debug?: boolean;
1449
+ }
1450
+ interface MangleOptionsKeepNames {
1451
+ /**
1452
+ * Preserve `name` property for functions.
1453
+ *
1454
+ * @default false
1455
+ */
1456
+ function: boolean;
1457
+ /**
1458
+ * Preserve `name` property for classes.
1459
+ *
1460
+ * @default false
1461
+ */
1462
+ class: boolean;
1463
+ }
1464
+ /**
1465
+ * Minify asynchronously.
1466
+ *
1467
+ * Note: This function can be slower than `minifySync` due to the overhead of spawning a thread.
1468
+ */
1469
+ interface MinifyOptions$1 {
1470
+ /** Use when minifying an ES module. */
1471
+ module?: boolean;
1472
+ compress?: boolean | CompressOptions;
1473
+ mangle?: boolean | MangleOptions;
1474
+ codegen?: boolean | CodegenOptions;
1475
+ sourcemap?: boolean;
1476
+ }
1477
+ interface TreeShakeOptions {
1478
+ /**
1479
+ * Whether to respect the pure annotations.
1480
+ *
1481
+ * Pure annotations are comments that mark an expression as pure.
1482
+ * For example: @__PURE__ or #__NO_SIDE_EFFECTS__.
1483
+ *
1484
+ * @default true
1485
+ */
1486
+ annotations?: boolean;
1487
+ /**
1488
+ * Whether to treat this function call as pure.
1489
+ *
1490
+ * This function is called for normal function calls, new calls, and
1491
+ * tagged template calls.
1492
+ */
1493
+ manualPureFunctions?: Array<string>;
1494
+ /**
1495
+ * Whether property read accesses have side effects.
1496
+ *
1497
+ * @default 'always'
1498
+ */
1499
+ propertyReadSideEffects?: boolean | 'always';
1500
+ /**
1501
+ * Whether accessing a global variable has side effects.
1502
+ *
1503
+ * Accessing a non-existing global variable will throw an error.
1504
+ * Global variable may be a getter that has side effects.
1505
+ *
1506
+ * @default true
1507
+ */
1508
+ unknownGlobalSideEffects?: boolean;
1509
+ }
1510
+ interface ParserOptions {
1511
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */
1512
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
1513
+ /** Treat the source text as `script` or `module` code. */
1514
+ sourceType?: 'script' | 'module' | 'unambiguous' | undefined;
1515
+ /**
1516
+ * Return an AST which includes TypeScript-related properties, or excludes them.
1517
+ *
1518
+ * `'js'` is default for JS / JSX files.
1519
+ * `'ts'` is default for TS / TSX files.
1520
+ * The type of the file is determined from `lang` option, or extension of provided `filename`.
1521
+ */
1522
+ astType?: 'js' | 'ts';
1523
+ /**
1524
+ * Controls whether the `range` property is included on AST nodes.
1525
+ * The `range` property is a `[number, number]` which indicates the start/end offsets
1526
+ * of the node in the file contents.
1527
+ *
1528
+ * @default false
1529
+ */
1530
+ range?: boolean;
1531
+ /**
1532
+ * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
1533
+ *
1534
+ * If this option is true, parenthesized expressions are represented by
1535
+ * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
1536
+ * have a single `expression` property containing the expression inside parentheses.
1537
+ *
1538
+ * @default true
1539
+ */
1540
+ preserveParens?: boolean;
1541
+ /**
1542
+ * Produce semantic errors with an additional AST pass.
1543
+ * Semantic errors depend on symbols and scopes, where the parser does not construct.
1544
+ * This adds a small performance overhead.
1545
+ *
1546
+ * @default false
1547
+ */
1548
+ showSemanticErrors?: boolean;
1549
+ }
1550
+ interface CompilerAssumptions {
1551
+ ignoreFunctionLength?: boolean;
1552
+ noDocumentAll?: boolean;
1553
+ objectRestNoSymbols?: boolean;
1554
+ pureGetters?: boolean;
1555
+ /**
1556
+ * When using public class fields, assume that they don't shadow any getter in the current class,
1557
+ * in its subclasses or in its superclass. Thus, it's safe to assign them rather than using
1558
+ * `Object.defineProperty`.
1559
+ *
1560
+ * For example:
1561
+ *
1562
+ * Input:
1563
+ * ```js
1564
+ * class Test {
1565
+ * field = 2;
1566
+ *
1567
+ * static staticField = 3;
1568
+ * }
1569
+ * ```
1570
+ *
1571
+ * When `set_public_class_fields` is `true`, the output will be:
1572
+ * ```js
1573
+ * class Test {
1574
+ * constructor() {
1575
+ * this.field = 2;
1576
+ * }
1577
+ * }
1578
+ * Test.staticField = 3;
1579
+ * ```
1580
+ *
1581
+ * Otherwise, the output will be:
1582
+ * ```js
1583
+ * import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
1584
+ * class Test {
1585
+ * constructor() {
1586
+ * _defineProperty(this, "field", 2);
1587
+ * }
1588
+ * }
1589
+ * _defineProperty(Test, "staticField", 3);
1590
+ * ```
1591
+ *
1592
+ * NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should
1593
+ * set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`]
1594
+ * to `true`.
1595
+ */
1596
+ setPublicClassFields?: boolean;
1597
+ }
1598
+ interface DecoratorOptions {
1599
+ /**
1600
+ * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
1601
+ *
1602
+ * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
1603
+ * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
1604
+ *
1605
+ * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
1606
+ * @default false
1607
+ */
1608
+ legacy?: boolean;
1609
+ /**
1610
+ * Enables emitting decorator metadata.
1611
+ *
1612
+ * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
1613
+ * in TypeScript, and it only works when `legacy` is true.
1614
+ *
1615
+ * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
1616
+ * @default false
1617
+ */
1618
+ emitDecoratorMetadata?: boolean;
1619
+ }
1620
+ type HelperMode =
1621
+ /**
1622
+ * Runtime mode (default): Helper functions are imported from a runtime package.
1623
+ *
1624
+ * Example:
1625
+ *
1626
+ * ```js
1627
+ * import helperName from "@oxc-project/runtime/helpers/helperName";
1628
+ * helperName(...arguments);
1629
+ * ```
1630
+ */
1631
+ 'Runtime' |
1632
+ /**
1633
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
1634
+ *
1635
+ * Example:
1636
+ *
1637
+ * ```js
1638
+ * babelHelpers.helperName(...arguments);
1639
+ * ```
1640
+ */
1641
+ 'External';
1642
+ interface Helpers {
1643
+ mode?: HelperMode;
1644
+ }
1645
+ /**
1646
+ * TypeScript Isolated Declarations for Standalone DTS Emit (async)
1647
+ *
1648
+ * Note: This function can be slower than `isolatedDeclarationSync` due to the overhead of spawning a thread.
1649
+ */
1650
+ interface IsolatedDeclarationsOptions {
1651
+ /**
1652
+ * Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
1653
+ * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
1654
+ *
1655
+ * Default: `false`
1656
+ *
1657
+ * See <https://www.typescriptlang.org/tsconfig/#stripInternal>
1658
+ */
1659
+ stripInternal?: boolean;
1660
+ sourcemap?: boolean;
1661
+ }
1662
+ /**
1663
+ * Configure how TSX and JSX are transformed.
1664
+ *
1665
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
1666
+ */
1667
+ interface JsxOptions {
1668
+ /**
1669
+ * Decides which runtime to use.
1670
+ *
1671
+ * - 'automatic' - auto-import the correct JSX factories
1672
+ * - 'classic' - no auto-import
1673
+ *
1674
+ * @default 'automatic'
1675
+ */
1676
+ runtime?: 'classic' | 'automatic';
1677
+ /**
1678
+ * Emit development-specific information, such as `__source` and `__self`.
1679
+ *
1680
+ * @default false
1681
+ *
1682
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
1683
+ */
1684
+ development?: boolean;
1685
+ /**
1686
+ * Toggles whether or not to throw an error if an XML namespaced tag name
1687
+ * is used.
1688
+ *
1689
+ * Though the JSX spec allows this, it is disabled by default since React's
1690
+ * JSX does not currently have support for it.
1691
+ *
1692
+ * @default true
1693
+ */
1694
+ throwIfNamespace?: boolean;
1695
+ /**
1696
+ * Enables `@babel/plugin-transform-react-pure-annotations`.
1697
+ *
1698
+ * It will mark JSX elements and top-level React method calls as pure for tree shaking.
1699
+ *
1700
+ * @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
1701
+ *
1702
+ * @default true
1703
+ */
1704
+ pure?: boolean;
1705
+ /**
1706
+ * Replaces the import source when importing functions.
1707
+ *
1708
+ * @default 'react'
1709
+ */
1710
+ importSource?: string;
1711
+ /**
1712
+ * Replace the function used when compiling JSX expressions. It should be a
1713
+ * qualified name (e.g. `React.createElement`) or an identifier (e.g.
1714
+ * `createElement`).
1715
+ *
1716
+ * Only used for `classic` {@link runtime}.
1717
+ *
1718
+ * @default 'React.createElement'
1719
+ */
1720
+ pragma?: string;
1721
+ /**
1722
+ * Replace the component used when compiling JSX fragments. It should be a
1723
+ * valid JSX tag name.
1724
+ *
1725
+ * Only used for `classic` {@link runtime}.
1726
+ *
1727
+ * @default 'React.Fragment'
1728
+ */
1729
+ pragmaFrag?: string;
1730
+ /**
1731
+ * When spreading props, use `Object.assign` directly instead of an extend helper.
1732
+ *
1733
+ * Only used for `classic` {@link runtime}.
1734
+ *
1735
+ * @default false
1736
+ */
1737
+ useBuiltIns?: boolean;
1738
+ /**
1739
+ * When spreading props, use inline object with spread elements directly
1740
+ * instead of an extend helper or Object.assign.
1741
+ *
1742
+ * Only used for `classic` {@link runtime}.
1743
+ *
1744
+ * @default false
1745
+ */
1746
+ useSpread?: boolean;
1747
+ /**
1748
+ * Enable React Fast Refresh .
1749
+ *
1750
+ * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
1751
+ *
1752
+ * @default false
1753
+ */
1754
+ refresh?: boolean | ReactRefreshOptions;
1755
+ }
1756
+ /**
1757
+ * Transform JavaScript code to a Vite Node runnable module.
1758
+ *
1759
+ * @param filename The name of the file being transformed.
1760
+ * @param sourceText the source code itself
1761
+ * @param options The options for the transformation. See {@link
1762
+ * ModuleRunnerTransformOptions} for more information.
1763
+ *
1764
+ * @returns an object containing the transformed code, source maps, and any
1765
+ * errors that occurred during parsing or transformation.
1766
+ *
1767
+ * Note: This function can be slower than `moduleRunnerTransformSync` due to the overhead of spawning a thread.
1768
+ *
1769
+ * @deprecated Only works for Vite.
1770
+ */
1771
+ interface PluginsOptions {
1772
+ styledComponents?: StyledComponentsOptions;
1773
+ taggedTemplateEscape?: boolean;
1774
+ }
1775
+ interface ReactRefreshOptions {
1776
+ /**
1777
+ * Specify the identifier of the refresh registration variable.
1778
+ *
1779
+ * @default `$RefreshReg$`.
1780
+ */
1781
+ refreshReg?: string;
1782
+ /**
1783
+ * Specify the identifier of the refresh signature variable.
1784
+ *
1785
+ * @default `$RefreshSig$`.
1786
+ */
1787
+ refreshSig?: string;
1788
+ emitFullSignatures?: boolean;
1789
+ }
1790
+ /**
1791
+ * Configure how styled-components are transformed.
1792
+ *
1793
+ * @see {@link https://styled-components.com/docs/tooling#babel-plugin}
1794
+ */
1795
+ interface StyledComponentsOptions {
1796
+ /**
1797
+ * Enhances the attached CSS class name on each component with richer output to help
1798
+ * identify your components in the DOM without React DevTools.
1799
+ *
1800
+ * @default true
1801
+ */
1802
+ displayName?: boolean;
1803
+ /**
1804
+ * Controls whether the `displayName` of a component will be prefixed with the filename
1805
+ * to make the component name as unique as possible.
1806
+ *
1807
+ * @default true
1808
+ */
1809
+ fileName?: boolean;
1810
+ /**
1811
+ * Adds a unique identifier to every styled component to avoid checksum mismatches
1812
+ * due to different class generation on the client and server during server-side rendering.
1813
+ *
1814
+ * @default true
1815
+ */
1816
+ ssr?: boolean;
1817
+ /**
1818
+ * Transpiles styled-components tagged template literals to a smaller representation
1819
+ * than what Babel normally creates, helping to reduce bundle size.
1820
+ *
1821
+ * @default true
1822
+ */
1823
+ transpileTemplateLiterals?: boolean;
1824
+ /**
1825
+ * Minifies CSS content by removing all whitespace and comments from your CSS,
1826
+ * keeping valuable bytes out of your bundles.
1827
+ *
1828
+ * @default true
1829
+ */
1830
+ minify?: boolean;
1831
+ /**
1832
+ * Enables transformation of JSX `css` prop when using styled-components.
1833
+ *
1834
+ * **Note: This feature is not yet implemented in oxc.**
1835
+ *
1836
+ * @default true
1837
+ */
1838
+ cssProp?: boolean;
1839
+ /**
1840
+ * Enables "pure annotation" to aid dead code elimination by bundlers.
1841
+ *
1842
+ * @default false
1843
+ */
1844
+ pure?: boolean;
1845
+ /**
1846
+ * Adds a namespace prefix to component identifiers to ensure class names are unique.
1847
+ *
1848
+ * Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"`
1849
+ */
1850
+ namespace?: string;
1851
+ /**
1852
+ * List of file names that are considered meaningless for component naming purposes.
1853
+ *
1854
+ * When the `fileName` option is enabled and a component is in a file with a name
1855
+ * from this list, the directory name will be used instead of the file name for
1856
+ * the component's display name.
1857
+ *
1858
+ * @default `["index"]`
1859
+ */
1860
+ meaninglessFileNames?: Array<string>;
1861
+ /**
1862
+ * Import paths to be considered as styled-components imports at the top level.
1863
+ *
1864
+ * **Note: This feature is not yet implemented in oxc.**
1865
+ */
1866
+ topLevelImportPaths?: Array<string>;
1867
+ }
1868
+ /**
1869
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
1870
+ *
1871
+ * Note: This function can be slower than `transform` due to the overhead of spawning a thread.
1872
+ *
1873
+ * @param filename The name of the file being transformed. If this is a
1874
+ * relative path, consider setting the {@link TransformOptions#cwd} option.
1875
+ * @param sourceText the source code itself
1876
+ * @param options The options for the transformation. See {@link
1877
+ * TransformOptions} for more information.
1878
+ *
1879
+ * @returns a promise that resolves to an object containing the transformed code,
1880
+ * source maps, and any errors that occurred during parsing or transformation.
1881
+ */
1882
+ /**
1883
+ * Options for transforming a JavaScript or TypeScript file.
1884
+ *
1885
+ * @see {@link transform}
1886
+ */
1887
+ interface TransformOptions$1 {
1888
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */
1889
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
1890
+ /** Treat the source text as `script` or `module` code. */
1891
+ sourceType?: 'script' | 'module' | 'unambiguous' | undefined;
1892
+ /**
1893
+ * The current working directory. Used to resolve relative paths in other
1894
+ * options.
1895
+ */
1896
+ cwd?: string;
1897
+ /**
1898
+ * Enable source map generation.
1899
+ *
1900
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
1901
+ *
1902
+ * @default false
1903
+ *
1904
+ * @see {@link SourceMap}
1905
+ */
1906
+ sourcemap?: boolean;
1907
+ /** Set assumptions in order to produce smaller output. */
1908
+ assumptions?: CompilerAssumptions;
1909
+ /** Configure how TypeScript is transformed. */
1910
+ typescript?: TypeScriptOptions;
1911
+ /** Configure how TSX and JSX are transformed. */
1912
+ jsx?: 'preserve' | JsxOptions;
1913
+ /**
1914
+ * Sets the target environment for the generated JavaScript.
1915
+ *
1916
+ * The lowest target is `es2015`.
1917
+ *
1918
+ * Example:
1919
+ *
1920
+ * * `'es2015'`
1921
+ * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
1922
+ *
1923
+ * @default `esnext` (No transformation)
1924
+ *
1925
+ * @see [esbuild#target](https://esbuild.github.io/api/#target)
1926
+ */
1927
+ target?: string | Array<string>;
1928
+ /** Behaviour for runtime helpers. */
1929
+ helpers?: Helpers;
1930
+ /** Define Plugin */
1931
+ define?: Record<string, string>;
1932
+ /** Inject Plugin */
1933
+ inject?: Record<string, string | [string, string]>;
1934
+ /** Decorator plugin */
1935
+ decorator?: DecoratorOptions;
1936
+ /** Third-party plugins to use. */
1937
+ plugins?: PluginsOptions;
1938
+ }
1939
+ interface TypeScriptOptions {
1940
+ jsxPragma?: string;
1941
+ jsxPragmaFrag?: string;
1942
+ onlyRemoveTypeImports?: boolean;
1943
+ allowNamespaces?: boolean;
1944
+ /**
1945
+ * When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:
1946
+ *
1947
+ * @deprecated
1948
+ *
1949
+ * Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields
1950
+ * without initializer, you can use `remove_class_fields_without_initializer: true` instead.
1951
+ */
1952
+ allowDeclareFields?: boolean;
1953
+ /**
1954
+ * When enabled, class fields without initializers are removed.
1955
+ *
1956
+ * For example:
1957
+ * ```ts
1958
+ * class Foo {
1959
+ * x: number;
1960
+ * y: number = 0;
1961
+ * }
1962
+ * ```
1963
+ * // transform into
1964
+ * ```js
1965
+ * class Foo {
1966
+ * x: number;
1967
+ * }
1968
+ * ```
1969
+ *
1970
+ * The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option.
1971
+ * When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`]
1972
+ * to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is
1973
+ * equivalent to `useDefineForClassFields: false` in TypeScript.
1974
+ *
1975
+ * When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into:
1976
+ *
1977
+ * ```js
1978
+ * class Foo {
1979
+ * constructor() {
1980
+ * this.y = 0;
1981
+ * }
1982
+ * }
1983
+ * ```
1984
+ *
1985
+ * Defaults to `false`.
1986
+ */
1987
+ removeClassFieldsWithoutInitializer?: boolean;
1988
+ /**
1989
+ * Also generate a `.d.ts` declaration file for TypeScript files.
1990
+ *
1991
+ * The source file must be compliant with all
1992
+ * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
1993
+ * requirements.
1994
+ *
1995
+ * @default false
1996
+ */
1997
+ declaration?: IsolatedDeclarationsOptions;
1998
+ /**
1999
+ * Rewrite or remove TypeScript import/export declaration extensions.
2000
+ *
2001
+ * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
2002
+ * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
2003
+ * - When set to `true`, it's equivalent to `rewrite`.
2004
+ * - When set to `false` or omitted, no changes will be made to the extensions.
2005
+ *
2006
+ * @default false
2007
+ */
2008
+ rewriteImportExtensions?: 'rewrite' | 'remove' | boolean;
2009
+ }
2010
+ declare class BindingMagicString {
2011
+ constructor(source: string);
2012
+ replace(from: string, to: string): void;
2013
+ replaceAll(from: string, to: string): void;
2014
+ prepend(content: string): void;
2015
+ append(content: string): void;
2016
+ prependLeft(index: number, content: string): void;
2017
+ prependRight(index: number, content: string): void;
2018
+ appendLeft(index: number, content: string): void;
2019
+ appendRight(index: number, content: string): void;
2020
+ overwrite(start: number, end: number, content: string): void;
2021
+ toString(): string;
2022
+ hasChanged(): boolean;
2023
+ length(): number;
2024
+ isEmpty(): boolean;
2025
+ remove(start: number, end: number): void;
2026
+ update(start: number, end: number, content: string): void;
2027
+ relocate(start: number, end: number, to: number): void;
2028
+ indent(indentor?: string | undefined | null): void;
2029
+ }
2030
+ declare class BindingRenderedChunk {
2031
+ get name(): string;
2032
+ get isEntry(): boolean;
2033
+ get isDynamicEntry(): boolean;
2034
+ get facadeModuleId(): string | null;
2035
+ get moduleIds(): Array<string>;
2036
+ get exports(): Array<string>;
2037
+ get fileName(): string;
2038
+ get modules(): BindingModules;
2039
+ get imports(): Array<string>;
2040
+ get dynamicImports(): Array<string>;
2041
+ }
2042
+ declare class BindingRenderedModule {
2043
+ get code(): string | null;
2044
+ get renderedExports(): Array<string>;
2045
+ }
2046
+ type BindingBuiltinPluginName = 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-asset' | 'builtin:vite-asset-import-meta-url' | 'builtin:vite-build-import-analysis' | 'builtin:vite-css' | 'builtin:vite-css-post' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-html' | 'builtin:vite-html-inline-proxy' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-wasm-fallback' | 'builtin:vite-wasm-helper' | 'builtin:vite-web-worker-post';
2047
+ interface BindingHookResolveIdExtraArgs {
2048
+ custom?: number;
2049
+ isEntry: boolean;
2050
+ /**
2051
+ * - `import-statement`: `import { foo } from './lib.js';`
2052
+ * - `dynamic-import`: `import('./lib.js')`
2053
+ * - `require-call`: `require('./lib.js')`
2054
+ * - `import-rule`: `@import 'bg-color.css'`
2055
+ * - `url-token`: `url('./icon.png')`
2056
+ * - `new-url`: `new URL('./worker.js', import.meta.url)`
2057
+ * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
2058
+ */
2059
+ kind: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept';
2060
+ }
2061
+ interface BindingModules {
2062
+ values: Array<BindingRenderedModule>;
2063
+ keys: Array<string>;
2064
+ }
2065
+ interface BindingTransformHookExtraArgs {
2066
+ moduleType: string;
2067
+ }
2068
+ interface ExternalMemoryStatus {
2069
+ freed: boolean;
2070
+ reason?: string;
2071
+ }
2072
+ /** Error emitted from native side, it only contains kind and message, no stack trace. */
2073
+ interface PreRenderedChunk {
2074
+ name: string;
2075
+ isEntry: boolean;
2076
+ isDynamicEntry: boolean;
2077
+ facadeModuleId?: string;
2078
+ moduleIds: Array<string>;
2079
+ exports: Array<string>;
2080
+ } //#endregion
2081
+ //#endregion
2082
+ //#region node_modules/@rolldown/pluginutils/dist/filter/composable-filters.d.ts
2083
+ type StringOrRegExp$1 = string | RegExp;
2084
+ type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
2085
+ type FilterExpression = And | Or | Not | Id | ImporterId | ModuleType$1 | Code | Query;
2086
+ type TopLevelFilterExpression = Include | Exclude$1;
2087
+ declare class And {
2088
+ kind: 'and';
2089
+ args: FilterExpression[];
2090
+ constructor(...args: FilterExpression[]);
2091
+ }
2092
+ declare class Or {
2093
+ kind: 'or';
2094
+ args: FilterExpression[];
2095
+ constructor(...args: FilterExpression[]);
2096
+ }
2097
+ declare class Not {
2098
+ kind: 'not';
2099
+ expr: FilterExpression;
2100
+ constructor(expr: FilterExpression);
2101
+ }
2102
+ interface IdParams {
2103
+ cleanUrl?: boolean;
2104
+ }
2105
+ declare class Id {
2106
+ kind: 'id';
2107
+ pattern: StringOrRegExp$1;
2108
+ params: IdParams;
2109
+ constructor(pattern: StringOrRegExp$1, params?: IdParams);
2110
+ }
2111
+ declare class ImporterId {
2112
+ kind: 'importerId';
2113
+ pattern: StringOrRegExp$1;
2114
+ params: IdParams;
2115
+ constructor(pattern: StringOrRegExp$1, params?: IdParams);
2116
+ }
2117
+ declare class ModuleType$1 {
2118
+ kind: 'moduleType';
2119
+ pattern: PluginModuleType;
2120
+ constructor(pattern: PluginModuleType);
2121
+ }
2122
+ declare class Code {
2123
+ kind: 'code';
2124
+ pattern: StringOrRegExp$1;
2125
+ constructor(expr: StringOrRegExp$1);
2126
+ }
2127
+ declare class Query {
2128
+ kind: 'query';
2129
+ key: string;
2130
+ pattern: StringOrRegExp$1 | boolean;
2131
+ constructor(key: string, pattern: StringOrRegExp$1 | boolean);
2132
+ }
2133
+ declare class Include {
2134
+ kind: 'include';
2135
+ expr: FilterExpression;
2136
+ constructor(expr: FilterExpression);
2137
+ }
2138
+ declare class Exclude$1 {
2139
+ kind: 'exclude';
2140
+ expr: FilterExpression;
2141
+ constructor(expr: FilterExpression);
2142
+ }
2143
+ //#endregion
2144
+ //#region node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts
2145
+ //#region src/types/misc.d.ts
2146
+ type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
2147
+ type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean; //#endregion
2148
+ //#region src/types/module-info.d.ts
2149
+ interface ModuleInfo extends ModuleOptions {
2150
+ /**
2151
+ * Unsupported at rolldown
2152
+ */
2153
+ ast: any;
2154
+ code: string | null;
2155
+ id: string;
2156
+ importers: string[];
2157
+ dynamicImporters: string[];
2158
+ importedIds: string[];
2159
+ dynamicallyImportedIds: string[];
2160
+ exports: string[];
2161
+ isEntry: boolean;
2162
+ } //#endregion
2163
+ //#region src/utils/asset-source.d.ts
2164
+ type AssetSource = string | Uint8Array; //#endregion
2165
+ //#region src/types/external-memory-handle.d.ts
2166
+ declare const symbolForExternalMemoryHandle: "__rolldown_external_memory_handle__";
2167
+ /**
2168
+ * Interface for objects that hold external memory that can be explicitly freed.
2169
+ */
2170
+ interface ExternalMemoryHandle {
2171
+ /**
2172
+ * Frees the external memory held by this object.
2173
+ * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory.
2174
+ * This will take time but prevents errors when accessing properties after freeing.
2175
+ * @returns Status object with `freed` boolean and optional `reason` string.
2176
+ * @internal
2177
+ */
2178
+ [symbolForExternalMemoryHandle]: (keepDataAlive?: boolean) => ExternalMemoryStatus;
2179
+ }
2180
+ /**
2181
+ * Frees the external memory held by the given handle.
2182
+ *
2183
+ * This is useful when you want to manually release memory held by Rust objects
2184
+ * (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
2185
+ *
2186
+ * @param handle - The object with external memory to free
2187
+ * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
2188
+ * This will take time to copy data from Rust to JavaScript, but prevents errors
2189
+ * when accessing properties after the memory is freed.
2190
+ * @returns Status object with `freed` boolean and optional `reason` string.
2191
+ * - `{ freed: true }` if memory was successfully freed
2192
+ * - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
2193
+ *
2194
+ * @example
2195
+ * ```typescript
2196
+ * import { freeExternalMemory } from 'rolldown/experimental';
2197
+ *
2198
+ * const output = await bundle.generate();
2199
+ * const chunk = output.output[0];
2200
+ *
2201
+ * // Use the chunk...
2202
+ *
2203
+ * // Manually free the memory (fast, but accessing properties after will throw)
2204
+ * const status = freeExternalMemory(chunk); // { freed: true }
2205
+ * const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
2206
+ *
2207
+ * // Keep data alive before freeing (slower, but data remains accessible)
2208
+ * freeExternalMemory(chunk, true); // Evaluates all lazy fields first
2209
+ * console.log(chunk.code); // OK - data was copied to JavaScript before freeing
2210
+ *
2211
+ * // Without keepDataAlive, accessing chunk properties after freeing will throw an error
2212
+ * ```
2213
+ */
2214
+ //#endregion
2215
+ //#region src/types/rolldown-output.d.ts
2216
+ interface OutputAsset extends ExternalMemoryHandle {
2217
+ type: "asset";
2218
+ fileName: string;
2219
+ /** @deprecated Use "originalFileNames" instead. */
2220
+ originalFileName: string | null;
2221
+ originalFileNames: string[];
2222
+ source: AssetSource;
2223
+ /** @deprecated Use "names" instead. */
2224
+ name: string | undefined;
2225
+ names: string[];
2226
+ }
2227
+ interface SourceMap {
2228
+ file: string;
2229
+ mappings: string;
2230
+ names: string[];
2231
+ sources: string[];
2232
+ sourcesContent: string[];
2233
+ version: number;
2234
+ debugId?: string;
2235
+ x_google_ignoreList?: number[];
2236
+ toString(): string;
2237
+ toUrl(): string;
2238
+ }
2239
+ interface RenderedModule {
2240
+ readonly code: string | null;
2241
+ renderedLength: number;
2242
+ renderedExports: string[];
2243
+ }
2244
+ interface RenderedChunk extends Omit<BindingRenderedChunk, "modules"> {
2245
+ type: "chunk";
2246
+ modules: {
2247
+ [id: string]: RenderedModule;
2248
+ };
2249
+ name: string;
2250
+ isEntry: boolean;
2251
+ isDynamicEntry: boolean;
2252
+ facadeModuleId: string | null;
2253
+ moduleIds: Array<string>;
2254
+ exports: Array<string>;
2255
+ fileName: string;
2256
+ imports: Array<string>;
2257
+ dynamicImports: Array<string>;
2258
+ }
2259
+ interface OutputChunk extends ExternalMemoryHandle {
2260
+ type: "chunk";
2261
+ code: string;
2262
+ name: string;
2263
+ isEntry: boolean;
2264
+ exports: string[];
2265
+ fileName: string;
2266
+ modules: {
2267
+ [id: string]: RenderedModule;
2268
+ };
2269
+ imports: string[];
2270
+ dynamicImports: string[];
2271
+ facadeModuleId: string | null;
2272
+ isDynamicEntry: boolean;
2273
+ moduleIds: string[];
2274
+ map: SourceMap | null;
2275
+ sourcemapFileName: string | null;
2276
+ preliminaryFileName: string;
2277
+ }
2278
+ //#endregion
2279
+ //#region src/types/utils.d.ts
2280
+ type MaybePromise<T> = T | Promise<T>;
2281
+ type NullValue<T = void> = T | undefined | null | void;
2282
+ type PartialNull<T> = { [P in keyof T]: T[P] | null };
2283
+ type MakeAsync<Function_> = Function_ extends ((this: infer This, ...parameters: infer Arguments) => infer Return) ? (this: This, ...parameters: Arguments) => Return | Promise<Return> : never;
2284
+ type MaybeArray<T> = T | T[];
2285
+ type StringOrRegExp = string | RegExp; //#endregion
2286
+ //#region src/options/output-options.d.ts
2287
+ type GeneratedCodePreset = "es5" | "es2015";
2288
+ interface GeneratedCodeOptions {
2289
+ /**
2290
+ * Whether to use Symbol.toStringTag for namespace objects.
2291
+ * @default false
2292
+ */
2293
+ symbols?: boolean;
2294
+ /**
2295
+ * Allows choosing one of the presets listed above while overriding some options.
2296
+ *
2297
+ * ```js
2298
+ * export default {
2299
+ * output: {
2300
+ * generatedCode: {
2301
+ * preset: 'es2015',
2302
+ * symbols: false
2303
+ * }
2304
+ * }
2305
+ * };
2306
+ * ```
2307
+ */
2308
+ preset?: GeneratedCodePreset;
2309
+ /**
2310
+ * Whether to add readable names to internal variables for profiling purposes.
2311
+ *
2312
+ * When enabled, generated code will use descriptive variable names that correspond
2313
+ * to the original module names, making it easier to profile and debug the bundled code.
2314
+ *
2315
+ * Note: Enabling this option makes the output more difficult to minify effectively.
2316
+ *
2317
+ * @default false
2318
+ */
2319
+ profilerNames?: boolean;
2320
+ }
2321
+ type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd";
2322
+ type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
2323
+ type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
2324
+ type SanitizeFileNameFunction = (name: string) => string;
2325
+ interface PreRenderedAsset {
2326
+ type: "asset";
2327
+ name?: string;
2328
+ names: string[];
2329
+ originalFileName?: string;
2330
+ originalFileNames: string[];
2331
+ source: string | Uint8Array;
2332
+ }
2333
+ type AssetFileNamesFunction = (chunkInfo: PreRenderedAsset) => string;
2334
+ type PathsFunction$1 = (id: string) => string;
2335
+ type ManualChunksFunction = (moduleId: string, meta: {
2336
+ getModuleInfo: (moduleId: string) => ModuleInfo | null;
2337
+ }) => string | NullValue;
2338
+ type GlobalsFunction = (name: string) => string;
2339
+ type AdvancedChunksNameFunction = (moduleId: string, ctx: ChunkingContext) => string | NullValue;
2340
+ type AdvancedChunksTestFunction = (id: string) => boolean | undefined | void;
2341
+ type MinifyOptions = Omit<MinifyOptions$1, "module" | "sourcemap">;
2342
+ interface ChunkingContext {
2343
+ getModuleInfo(moduleId: string): ModuleInfo | null;
2344
+ }
2345
+ interface OutputOptions {
2346
+ dir?: string;
2347
+ file?: string;
2348
+ exports?: "auto" | "named" | "default" | "none";
2349
+ hashCharacters?: "base64" | "base36" | "hex";
2350
+ /**
2351
+ * Expected format of generated code.
2352
+ * - `'es'`, `'esm'` and `'module'` are the same format, all stand for ES module.
2353
+ * - `'cjs'` and `'commonjs'` are the same format, all stand for CommonJS module.
2354
+ * - `'iife'` stands for [Immediately Invoked Function Expression](https://developer.mozilla.org/en-US/docs/Glossary/IIFE).
2355
+ * - `'umd'` stands for [Universal Module Definition](https://github.com/umdjs/umd).
2356
+ *
2357
+ * @default 'esm'
2358
+ */
2359
+ format?: ModuleFormat;
2360
+ sourcemap?: boolean | "inline" | "hidden";
2361
+ sourcemapBaseUrl?: string;
2362
+ sourcemapDebugIds?: boolean;
2363
+ /**
2364
+ * Control which source files are included in the sourcemap ignore list.
2365
+ * Files in the ignore list are excluded from debugger stepping and error stack traces.
2366
+ *
2367
+ * - `false`: Include all source files in the ignore list
2368
+ * - `true`: Include no source files in the ignore list
2369
+ * - `string`: Files containing this string in their path will be included in the ignore list
2370
+ * - `RegExp`: Files matching this regular expression will be included in the ignore list
2371
+ * - `function`: Custom function `(source: string, sourcemapPath: string) => boolean` to determine if a source should be ignored
2372
+ *
2373
+ * :::tip Performance
2374
+ * Using static values (`boolean`, `string`, or `RegExp`) is significantly more performant than functions.
2375
+ * Calling JavaScript functions from Rust has extremely high overhead, so prefer static patterns when possible.
2376
+ * :::
2377
+ *
2378
+ * ## Examples
2379
+ * ```js
2380
+ * // ✅ Preferred: Use RegExp for better performance
2381
+ * sourcemapIgnoreList: /node_modules/
2382
+ *
2383
+ * // ✅ Preferred: Use string pattern for better performance
2384
+ * sourcemapIgnoreList: "vendor"
2385
+ *
2386
+ * // ! Use sparingly: Function calls have high overhead
2387
+ * sourcemapIgnoreList: (source, sourcemapPath) => {
2388
+ * return source.includes('node_modules') || source.includes('.min.');
2389
+ * }
2390
+ * ```
2391
+ *
2392
+ * **default**: /node_modules/
2393
+ */
2394
+ sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | StringOrRegExp;
2395
+ sourcemapPathTransform?: SourcemapPathTransformOption;
2396
+ banner?: string | AddonFunction;
2397
+ footer?: string | AddonFunction;
2398
+ /**
2399
+ * Similar to `banner` option, but will run after the `renderChunk` hook and builtin minification.
2400
+ */
2401
+ postBanner?: string | AddonFunction;
2402
+ /**
2403
+ * Similar to `footer` option, but will run after the `renderChunk` hook and builtin minification.
2404
+ */
2405
+ postFooter?: string | AddonFunction;
2406
+ intro?: string | AddonFunction;
2407
+ outro?: string | AddonFunction;
2408
+ extend?: boolean;
2409
+ esModule?: boolean | "if-default-prop";
2410
+ assetFileNames?: string | AssetFileNamesFunction;
2411
+ entryFileNames?: string | ChunkFileNamesFunction;
2412
+ chunkFileNames?: string | ChunkFileNamesFunction;
2413
+ cssEntryFileNames?: string | ChunkFileNamesFunction;
2414
+ cssChunkFileNames?: string | ChunkFileNamesFunction;
2415
+ sanitizeFileName?: boolean | SanitizeFileNameFunction;
2416
+ /**
2417
+ * Control code minification.
2418
+ *
2419
+ * - `true`: Enable full minification including code compression and dead code elimination
2420
+ * - `false`: Disable minification (default)
2421
+ * - `'dce-only'`: Only perform dead code elimination without code compression
2422
+ * - `MinifyOptions`: Fine-grained control over minification settings
2423
+ *
2424
+ * @default false
2425
+ */
2426
+ minify?: boolean | "dce-only" | MinifyOptions;
2427
+ name?: string;
2428
+ globals?: Record<string, string> | GlobalsFunction;
2429
+ /**
2430
+ * Maps external module IDs to paths.
2431
+ *
2432
+ * Allows customizing the path used when importing external dependencies.
2433
+ * This is particularly useful for loading dependencies from CDNs or custom locations.
2434
+ *
2435
+ * - Object form: Maps module IDs to their replacement paths
2436
+ * - Function form: Takes a module ID and returns its replacement path
2437
+ *
2438
+ * @example
2439
+ * ```js
2440
+ * {
2441
+ * paths: {
2442
+ * 'd3': 'https://cdn.jsdelivr.net/npm/d3@7'
2443
+ * }
2444
+ * }
2445
+ * ```
2446
+ *
2447
+ * @example
2448
+ * ```js
2449
+ * {
2450
+ * paths: (id) => {
2451
+ * if (id.startsWith('lodash')) {
2452
+ * return `https://cdn.jsdelivr.net/npm/${id}`
2453
+ * }
2454
+ * return id
2455
+ * }
2456
+ * }
2457
+ * ```
2458
+ */
2459
+ paths?: Record<string, string> | PathsFunction$1;
2460
+ generatedCode?: Partial<GeneratedCodeOptions>;
2461
+ externalLiveBindings?: boolean;
2462
+ inlineDynamicImports?: boolean;
2463
+ /**
2464
+ * - Type: `((moduleId: string, meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue)`
2465
+ * - Object form is not supported.
2466
+ *
2467
+ * :::warning
2468
+ * - This option is deprecated. Please use `advancedChunks` instead.
2469
+ * - If `manualChunks` and `advancedChunks` are both specified, `manualChunks` option will be ignored.
2470
+ * :::
2471
+ *
2472
+ * You could use this option for migration purpose. Under the hood,
2473
+ *
2474
+ * ```js
2475
+ * {
2476
+ * manualChunks: (moduleId, meta) => {
2477
+ * if (moduleId.includes('node_modules')) {
2478
+ * return 'vendor';
2479
+ * }
2480
+ * return null;
2481
+ * }
2482
+ * }
2483
+ * ```
2484
+ *
2485
+ * will be transformed to
2486
+ *
2487
+ * ```js
2488
+ * {
2489
+ * advancedChunks: {
2490
+ * groups: [
2491
+ * {
2492
+ * name(moduleId) {
2493
+ * if (moduleId.includes('node_modules')) {
2494
+ * return 'vendor';
2495
+ * }
2496
+ * return null;
2497
+ * },
2498
+ * },
2499
+ * ],
2500
+ * }
2501
+ * }
2502
+ *
2503
+ * ```
2504
+ *
2505
+ * @deprecated Please use `advancedChunks` instead.
2506
+ */
2507
+ manualChunks?: ManualChunksFunction;
2508
+ /**
2509
+ * Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/in-depth/advanced-chunks).
2510
+ */
2511
+ advancedChunks?: {
2512
+ /**
2513
+ * - Type: `boolean`
2514
+ * - Default: `true`
2515
+ *
2516
+ * By default, each group will also include captured modules' dependencies. This reduces the chance of generating circular chunks.
2517
+ *
2518
+ * If you want to disable this behavior, it's recommended to both set
2519
+ * - `preserveEntrySignatures: false | 'allow-extension'`
2520
+ * - `strictExecutionOrder: true`
2521
+ *
2522
+ * to avoid generating invalid chunks.
2523
+ */
2524
+ includeDependenciesRecursively?: boolean;
2525
+ /**
2526
+ * - Type: `number`
2527
+ *
2528
+ * Global fallback of [`{group}.minSize`](#advancedchunks-groups-minsize), if it's not specified in the group.
2529
+ */
2530
+ minSize?: number;
2531
+ /**
2532
+ * - Type: `number`
2533
+ *
2534
+ * Global fallback of [`{group}.maxSize`](#advancedchunks-groups-maxsize), if it's not specified in the group.
2535
+ */
2536
+ maxSize?: number;
2537
+ /**
2538
+ * - Type: `number`
2539
+ *
2540
+ * Global fallback of [`{group}.maxModuleSize`](#advancedchunks-groups-maxmodulesize), if it's not specified in the group.
2541
+ */
2542
+ maxModuleSize?: number;
2543
+ /**
2544
+ * - Type: `number`
2545
+ *
2546
+ * Global fallback of [`{group}.minModuleSize`](#advancedchunks-groups-minmodulesize), if it's not specified in the group.
2547
+ */
2548
+ minModuleSize?: number;
2549
+ /**
2550
+ * - Type: `number`
2551
+ *
2552
+ * Global fallback of [`{group}.minShareCount`](#advancedchunks-groups-minsharecount), if it's not specified in the group.
2553
+ */
2554
+ minShareCount?: number;
2555
+ /**
2556
+ * Groups to be used for advanced chunking.
2557
+ */
2558
+ groups?: {
2559
+ /**
2560
+ * - Type: `string | ((moduleId: string, ctx: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue)`
2561
+ *
2562
+ * Name of the group. It will be also used as the name of the chunk and replaced the `[name]` placeholder in the `chunkFileNames` option.
2563
+ *
2564
+ * For example,
2565
+ *
2566
+ * ```js
2567
+ * import { defineConfig } from 'rolldown';
2568
+ *
2569
+ * export default defineConfig({
2570
+ * advancedChunks: {
2571
+ * groups: [
2572
+ * {
2573
+ * name: 'libs',
2574
+ * test: /node_modules/,
2575
+ * },
2576
+ * ],
2577
+ * },
2578
+ * });
2579
+ * ```
2580
+ * will create a chunk named `libs-[hash].js` in the end.
2581
+ *
2582
+ * It's ok to have the same name for different groups. Rolldown will deduplicate the chunk names if necessary.
2583
+ *
2584
+ * # Dynamic `name()`
2585
+ *
2586
+ * If `name` is a function, it will be called with the module id as the argument. The function should return a string or `null`. If it returns `null`, the module will be ignored by this group.
2587
+ *
2588
+ * Notice, each returned new name will be treated as a separate group.
2589
+ *
2590
+ * For example,
2591
+ *
2592
+ * ```js
2593
+ * import { defineConfig } from 'rolldown';
2594
+ *
2595
+ * export default defineConfig({
2596
+ * advancedChunks: {
2597
+ * groups: [
2598
+ * {
2599
+ * name: (moduleId) => moduleId.includes('node_modules') ? 'libs' : 'app',
2600
+ * minSize: 100 * 1024,
2601
+ * },
2602
+ * ],
2603
+ * },
2604
+ * });
2605
+ * ```
2606
+ *
2607
+ * :::warning
2608
+ * Constraints like `minSize`, `maxSize`, etc. are applied separately for different names returned by the function.
2609
+ * :::
2610
+ */
2611
+ name: string | AdvancedChunksNameFunction;
2612
+ /**
2613
+ * - Type: `string | RegExp | ((id: string) => boolean | undefined | void);`
2614
+ *
2615
+ * Controls which modules are captured in this group.
2616
+ *
2617
+ * - If `test` is a string, the module whose id contains the string will be captured.
2618
+ * - If `test` is a regular expression, the module whose id matches the regular expression will be captured.
2619
+ * - If `test` is a function, modules for which `test(id)` returns `true` will be captured.
2620
+ * - If `test` is empty, any module will be considered as matched.
2621
+ *
2622
+ * :::warning
2623
+ * When using regular expression, it's recommended to use `[\\/]` to match the path separator instead of `/` to avoid potential issues on Windows.
2624
+ * - ✅ Recommended: `/node_modules[\\/]react/`
2625
+ * - ❌ Not recommended: `/node_modules/react/`
2626
+ * :::
2627
+ */
2628
+ test?: StringOrRegExp | AdvancedChunksTestFunction;
2629
+ /**
2630
+ * - Type: `number`
2631
+ * - Default: `0`
2632
+ *
2633
+ * Priority of the group. Group with higher priority will be chosen first to match modules and create chunks. When converting the group to a chunk, modules of that group will be removed from other groups.
2634
+ *
2635
+ * If two groups have the same priority, the group whose index is smaller will be chosen.
2636
+ *
2637
+ * For example,
2638
+ *
2639
+ * ```js
2640
+ * import { defineConfig } from 'rolldown';
2641
+ *
2642
+ * export default defineConfig({
2643
+ * advancedChunks: {
2644
+ * groups: [
2645
+ * {
2646
+ * name: 'react',
2647
+ * test: /node_modules[\\/]react/,
2648
+ * priority: 1,
2649
+ * },
2650
+ * {
2651
+ * name: 'other-libs',
2652
+ * test: /node_modules/,
2653
+ * priority: 2,
2654
+ * },
2655
+ * ],
2656
+ * });
2657
+ * ```
2658
+ *
2659
+ * This is a clearly __incorrect__ example. Though `react` group is defined before `other-libs`, it has a lower priority, so the modules in `react` group will be captured in `other-libs` group.
2660
+ */
2661
+ priority?: number;
2662
+ /**
2663
+ * - Type: `number`
2664
+ * - Default: `0`
2665
+ *
2666
+ * Minimum size in bytes of the desired chunk. If the accumulated size of the captured modules by this group is smaller than this value, it will be ignored. Modules in this group will fall back to the `automatic chunking` if they are not captured by any other group.
2667
+ */
2668
+ minSize?: number;
2669
+ /**
2670
+ * - Type: `number`
2671
+ * - Default: `1`
2672
+ *
2673
+ * Controls if a module should be captured based on how many entry chunks reference it.
2674
+ */
2675
+ minShareCount?: number;
2676
+ /**
2677
+ * - Type: `number`
2678
+ * - Default: `Infinity`
2679
+ *
2680
+ * If the accumulated size in bytes of the captured modules by this group is larger than this value, this group will be split into multiple groups that each has size close to this value.
2681
+ */
2682
+ maxSize?: number;
2683
+ /**
2684
+ * - Type: `number`
2685
+ * - Default: `Infinity`
2686
+ *
2687
+ * Controls a module could only be captured if its size in bytes is smaller or equal than this value.
2688
+ */
2689
+ maxModuleSize?: number;
2690
+ /**
2691
+ * - Type: `number`
2692
+ * - Default: `0`
2693
+ *
2694
+ * Controls a module could only be captured if its size in bytes is larger or equal than this value.
2695
+ */
2696
+ minModuleSize?: number;
2697
+ }[];
2698
+ };
2699
+ /**
2700
+ * Control comments in the output.
2701
+ *
2702
+ * - `none`: no comments
2703
+ * - `inline`: preserve comments that contain `@license`, `@preserve` or starts with `//!` `/*!`
2704
+ */
2705
+ legalComments?: "none" | "inline";
2706
+ plugins?: RolldownOutputPluginOption;
2707
+ polyfillRequire?: boolean;
2708
+ hoistTransitiveImports?: false;
2709
+ preserveModules?: boolean;
2710
+ virtualDirname?: string;
2711
+ preserveModulesRoot?: string;
2712
+ topLevelVar?: boolean;
2713
+ /**
2714
+ * - Type: `boolean`
2715
+ * - Default: `true` for format `es` or if `output.minify` is `true` or object, `false` otherwise
2716
+ *
2717
+ * Whether to minify internal exports.
2718
+ */
2719
+ minifyInternalExports?: boolean;
2720
+ /**
2721
+ * - Type: `boolean`
2722
+ * - Default: `false`
2723
+ *
2724
+ * Clean output directory before emitting output.
2725
+ */
2726
+ cleanDir?: boolean;
2727
+ /** Keep function and class names after bundling.
2728
+ *
2729
+ * When enabled, the bundler will preserve the original names of functions and classes
2730
+ * in the output, which is useful for debugging and error stack traces.
2731
+ *
2732
+ * @default false
2733
+ */
2734
+ keepNames?: boolean;
2735
+ } //#endregion
2736
+ //#region src/api/build.d.ts
2737
+ //#endregion
2738
+ //#region src/log/log-handler.d.ts
2739
+ type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
2740
+ type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
2741
+ column: number;
2742
+ line: number;
2743
+ }) => void;
2744
+ //#endregion
2745
+ //#region src/options/normalized-input-options.d.ts
2746
+ interface NormalizedInputOptions {
2747
+ input: string[] | Record<string, string>;
2748
+ cwd: string;
2749
+ platform: InputOptions["platform"];
2750
+ shimMissingExports: boolean;
2751
+ context: string;
2752
+ } //#endregion
2753
+ //#region src/options/normalized-output-options.d.ts
2754
+ type PathsFunction = (id: string) => string;
2755
+ type InternalModuleFormat = "es" | "cjs" | "iife" | "umd";
2756
+ interface NormalizedOutputOptions {
2757
+ name: string | undefined;
2758
+ file: string | undefined;
2759
+ dir: string | undefined;
2760
+ entryFileNames: string | ChunkFileNamesFunction;
2761
+ chunkFileNames: string | ChunkFileNamesFunction;
2762
+ assetFileNames: string | AssetFileNamesFunction;
2763
+ format: InternalModuleFormat;
2764
+ exports: NonNullable<OutputOptions["exports"]>;
2765
+ sourcemap: boolean | "inline" | "hidden";
2766
+ sourcemapBaseUrl: string | undefined;
2767
+ cssEntryFileNames: string | ChunkFileNamesFunction;
2768
+ cssChunkFileNames: string | ChunkFileNamesFunction;
2769
+ inlineDynamicImports: boolean;
2770
+ externalLiveBindings: boolean;
2771
+ banner: AddonFunction;
2772
+ footer: AddonFunction;
2773
+ postBanner: AddonFunction;
2774
+ postFooter: AddonFunction;
2775
+ intro: AddonFunction;
2776
+ outro: AddonFunction;
2777
+ esModule: boolean | "if-default-prop";
2778
+ extend: boolean;
2779
+ globals: Record<string, string> | GlobalsFunction;
2780
+ paths: Record<string, string> | PathsFunction | undefined;
2781
+ hashCharacters: "base64" | "base36" | "hex";
2782
+ sourcemapDebugIds: boolean;
2783
+ sourcemapIgnoreList: boolean | SourcemapIgnoreListOption | StringOrRegExp | undefined;
2784
+ sourcemapPathTransform: SourcemapPathTransformOption | undefined;
2785
+ minify: false | MinifyOptions | "dce-only";
2786
+ legalComments: "none" | "inline";
2787
+ polyfillRequire: boolean;
2788
+ plugins: RolldownPlugin[];
2789
+ preserveModules: boolean;
2790
+ virtualDirname: string;
2791
+ preserveModulesRoot?: string;
2792
+ topLevelVar?: boolean;
2793
+ minifyInternalExports?: boolean;
2794
+ } //#endregion
2795
+ //#region src/plugin/fs.d.ts
2796
+ interface RolldownFsModule {
2797
+ appendFile(path: string, data: string | Uint8Array, options?: {
2798
+ encoding?: BufferEncoding | null;
2799
+ mode?: string | number;
2800
+ flag?: string | number;
2801
+ }): Promise<void>;
2802
+ copyFile(source: string, destination: string, mode?: string | number): Promise<void>;
2803
+ mkdir(path: string, options?: {
2804
+ recursive?: boolean;
2805
+ mode?: string | number;
2806
+ }): Promise<void>;
2807
+ mkdtemp(prefix: string): Promise<string>;
2808
+ readdir(path: string, options?: {
2809
+ withFileTypes?: false;
2810
+ }): Promise<string[]>;
2811
+ readdir(path: string, options?: {
2812
+ withFileTypes: true;
2813
+ }): Promise<RolldownDirectoryEntry[]>;
2814
+ readFile(path: string, options?: {
2815
+ encoding?: null;
2816
+ flag?: string | number;
2817
+ signal?: AbortSignal;
2818
+ }): Promise<Uint8Array>;
2819
+ readFile(path: string, options?: {
2820
+ encoding: BufferEncoding;
2821
+ flag?: string | number;
2822
+ signal?: AbortSignal;
2823
+ }): Promise<string>;
2824
+ realpath(path: string): Promise<string>;
2825
+ rename(oldPath: string, newPath: string): Promise<void>;
2826
+ rmdir(path: string, options?: {
2827
+ recursive?: boolean;
2828
+ }): Promise<void>;
2829
+ stat(path: string): Promise<RolldownFileStats>;
2830
+ lstat(path: string): Promise<RolldownFileStats>;
2831
+ unlink(path: string): Promise<void>;
2832
+ writeFile(path: string, data: string | Uint8Array, options?: {
2833
+ encoding?: BufferEncoding | null;
2834
+ mode?: string | number;
2835
+ flag?: string | number;
2836
+ }): Promise<void>;
2837
+ }
2838
+ type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "base64url" | "latin1" | "binary" | "hex";
2839
+ interface RolldownDirectoryEntry {
2840
+ isFile(): boolean;
2841
+ isDirectory(): boolean;
2842
+ isSymbolicLink(): boolean;
2843
+ name: string;
2844
+ }
2845
+ interface RolldownFileStats {
2846
+ isFile(): boolean;
2847
+ isDirectory(): boolean;
2848
+ isSymbolicLink(): boolean;
2849
+ size: number;
2850
+ mtime: Date;
2851
+ ctime: Date;
2852
+ atime: Date;
2853
+ birthtime: Date;
2854
+ } //#endregion
2855
+ //#region src/plugin/hook-filter.d.ts
2856
+ type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
2857
+ include?: MaybeArray<Value>;
2858
+ exclude?: MaybeArray<Value>;
2859
+ };
2860
+ interface FormalModuleTypeFilter {
2861
+ include?: ModuleType[];
2862
+ }
2863
+ type ModuleTypeFilter = ModuleType[] | FormalModuleTypeFilter;
2864
+ interface HookFilter {
2865
+ /**
2866
+ * This filter is used to do a pre-test to determine whether the hook should be called.
2867
+ *
2868
+ * @example
2869
+ * Include all `id`s that contain `node_modules` in the path.
2870
+ * ```js
2871
+ * { id: '**'+'/node_modules/**' }
2872
+ * ```
2873
+ * @example
2874
+ * Include all `id`s that contain `node_modules` or `src` in the path.
2875
+ * ```js
2876
+ * { id: ['**'+'/node_modules/**', '**'+'/src/**'] }
2877
+ * ```
2878
+ * @example
2879
+ * Include all `id`s that start with `http`
2880
+ * ```js
2881
+ * { id: /^http/ }
2882
+ * ```
2883
+ * @example
2884
+ * Exclude all `id`s that contain `node_modules` in the path.
2885
+ * ```js
2886
+ * { id: { exclude: '**'+'/node_modules/**' } }
2887
+ * ```
2888
+ * @example
2889
+ * Formal pattern to define includes and excludes.
2890
+ * ```
2891
+ * { id : {
2892
+ * include: ['**'+'/foo/**', /bar/],
2893
+ * exclude: ['**'+'/baz/**', /qux/]
2894
+ * }}
2895
+ * ```
2896
+ */
2897
+ id?: GeneralHookFilter;
2898
+ moduleType?: ModuleTypeFilter;
2899
+ code?: GeneralHookFilter;
2900
+ }
2901
+ type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[]; //#endregion
2902
+ //#region src/plugin/minimal-plugin-context.d.ts
2903
+ interface PluginContextMeta {
2904
+ rollupVersion: string;
2905
+ rolldownVersion: string;
2906
+ watchMode: boolean;
2907
+ }
2908
+ interface MinimalPluginContext {
2909
+ readonly pluginName: string;
2910
+ error: (e: RollupError | string) => never;
2911
+ info: LoggingFunction;
2912
+ warn: LoggingFunction;
2913
+ debug: LoggingFunction;
2914
+ meta: PluginContextMeta;
2915
+ } //#endregion
2916
+ //#region src/plugin/parallel-plugin.d.ts
2917
+ type ParallelPlugin = {
2918
+ /** @internal */_parallel: {
2919
+ fileUrl: string;
2920
+ options: unknown;
2921
+ };
2922
+ };
2923
+ //#endregion
2924
+ //#region src/plugin/plugin-context.d.ts
2925
+ interface EmittedAsset {
2926
+ type: "asset";
2927
+ name?: string;
2928
+ fileName?: string;
2929
+ originalFileName?: string;
2930
+ source: AssetSource;
2931
+ }
2932
+ interface EmittedChunk {
2933
+ type: "chunk";
2934
+ name?: string;
2935
+ fileName?: string;
2936
+ preserveSignature?: "strict" | "allow-extension" | "exports-only" | false;
2937
+ id: string;
2938
+ importer?: string;
2939
+ }
2940
+ interface EmittedPrebuiltChunk {
2941
+ type: "prebuilt-chunk";
2942
+ fileName: string;
2943
+ code: string;
2944
+ exports?: string[];
2945
+ map?: SourceMap;
2946
+ sourcemapFileName?: string;
2947
+ }
2948
+ type EmittedFile = EmittedAsset | EmittedChunk | EmittedPrebuiltChunk;
2949
+ interface PluginContextResolveOptions {
2950
+ isEntry?: boolean;
2951
+ skipSelf?: boolean;
2952
+ custom?: CustomPluginOptions;
2953
+ }
2954
+ type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
2955
+ interface PluginContext extends MinimalPluginContext {
2956
+ fs: RolldownFsModule;
2957
+ emitFile(file: EmittedFile): string;
2958
+ getFileName(referenceId: string): string;
2959
+ getModuleIds(): IterableIterator<string>;
2960
+ getModuleInfo: GetModuleInfo;
2961
+ addWatchFile(id: string): void;
2962
+ load(options: {
2963
+ id: string;
2964
+ resolveDependencies?: boolean;
2965
+ } & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
2966
+ parse(input: string, options?: ParserOptions | null): Program;
2967
+ resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
2968
+ } //#endregion
2969
+ //#region src/plugin/transform-plugin-context.d.ts
2970
+ interface TransformPluginContext extends PluginContext {
2971
+ debug: LoggingFunctionWithPosition;
2972
+ info: LoggingFunctionWithPosition;
2973
+ warn: LoggingFunctionWithPosition;
2974
+ error(e: RollupError | string, pos?: number | {
2975
+ column: number;
2976
+ line: number;
2977
+ }): never;
2978
+ getCombinedSourcemap(): SourceMap;
2979
+ } //#endregion
2980
+ //#region src/types/module-side-effects.d.ts
2981
+ interface ModuleSideEffectsRule {
2982
+ test?: RegExp;
2983
+ external?: boolean;
2984
+ sideEffects: boolean;
2985
+ }
2986
+ type ModuleSideEffectsOption = boolean | readonly string[] | ModuleSideEffectsRule[] | ((id: string, external: boolean) => boolean | undefined) | "no-external";
2987
+ type TreeshakingOptions = {
2988
+ moduleSideEffects?: ModuleSideEffectsOption;
2989
+ annotations?: boolean;
2990
+ manualPureFunctions?: readonly string[];
2991
+ unknownGlobalSideEffects?: boolean;
2992
+ commonjs?: boolean;
2993
+ propertyReadSideEffects?: false | "always";
2994
+ propertyWriteSideEffects?: false | "always";
2995
+ }; //#endregion
2996
+ //#region src/types/output-bundle.d.ts
2997
+ interface OutputBundle {
2998
+ [fileName: string]: OutputAsset | OutputChunk;
2999
+ } //#endregion
3000
+ //#region src/types/rolldown-options-function.d.ts
3001
+ //#endregion
3002
+ //#region src/types/sourcemap.d.ts
3003
+ interface ExistingRawSourceMap {
3004
+ file?: string | null;
3005
+ mappings: string;
3006
+ names?: string[];
3007
+ sources?: (string | null)[];
3008
+ sourcesContent?: (string | null)[];
3009
+ sourceRoot?: string;
3010
+ version?: number;
3011
+ x_google_ignoreList?: number[];
3012
+ }
3013
+ type SourceMapInput = ExistingRawSourceMap | string | null; //#endregion
3014
+ //#region src/version.d.ts
3015
+ //#endregion
3016
+ //#region src/builtin-plugin/utils.d.ts
3017
+ declare class BuiltinPlugin {
3018
+ name: BindingBuiltinPluginName;
3019
+ _options?: unknown;
3020
+ /** Vite-specific option to control plugin ordering */
3021
+ enforce?: "pre" | "post";
3022
+ constructor(name: BindingBuiltinPluginName, _options?: unknown);
3023
+ } //#endregion
3024
+ //#region src/constants/plugin.d.ts
3025
+ declare const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES: readonly ["options", "buildStart", "resolveId", "load", "transform", "moduleParsed", "buildEnd", "onLog", "resolveDynamicImport", "closeBundle", "closeWatcher", "watchChange"];
3026
+ declare const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES: readonly ["augmentChunkHash", "outputOptions", "renderChunk", "renderStart", "renderError", "writeBundle", "generateBundle"];
3027
+ declare const ENUMERATED_PLUGIN_HOOK_NAMES: [...typeof ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...typeof ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, "footer", "banner", "intro", "outro"];
3028
+ /**
3029
+ * Names of all defined hooks. It's like
3030
+ * ```ts
3031
+ * type DefinedHookNames = {
3032
+ * options: 'options',
3033
+ * buildStart: 'buildStart',
3034
+ * ...
3035
+ * }
3036
+ * ```
3037
+ */
3038
+ type DefinedHookNames = { readonly [K in typeof ENUMERATED_PLUGIN_HOOK_NAMES[number]]: K };
3039
+ /**
3040
+ * Names of all defined hooks. It's like
3041
+ * ```js
3042
+ * const DEFINED_HOOK_NAMES ={
3043
+ * options: 'options',
3044
+ * buildStart: 'buildStart',
3045
+ * ...
3046
+ * }
3047
+ * ```
3048
+ */
3049
+ declare const DEFINED_HOOK_NAMES: DefinedHookNames; //#endregion
3050
+ //#region src/plugin/with-filter.d.ts
3051
+ //#endregion
3052
+ //#region src/plugin/index.d.ts
3053
+ type ModuleSideEffects = boolean | "no-treeshake" | null;
3054
+ type ModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
3055
+ interface CustomPluginOptions {
3056
+ [plugin: string]: any;
3057
+ }
3058
+ interface ModuleOptions {
3059
+ moduleSideEffects: ModuleSideEffects;
3060
+ meta: CustomPluginOptions;
3061
+ invalidate?: boolean;
3062
+ packageJsonPath?: string;
3063
+ }
3064
+ interface ResolvedId extends ModuleOptions {
3065
+ external: boolean | "absolute";
3066
+ id: string;
3067
+ }
3068
+ interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
3069
+ external?: boolean | "absolute" | "relative";
3070
+ id: string;
3071
+ }
3072
+ interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
3073
+ code: string;
3074
+ map?: SourceMapInput;
3075
+ moduleType?: ModuleType;
3076
+ }
3077
+ interface ResolveIdExtraOptions {
3078
+ custom?: CustomPluginOptions;
3079
+ isEntry: boolean;
3080
+ kind: BindingHookResolveIdExtraArgs["kind"];
3081
+ }
3082
+ type ResolveIdResult = string | NullValue | false | PartialResolvedId;
3083
+ type LoadResult = NullValue | string | SourceDescription;
3084
+ type TransformResult = NullValue | string | (Omit<SourceDescription, "code"> & {
3085
+ code?: string | BindingMagicString;
3086
+ });
3087
+ type RenderedChunkMeta = {
3088
+ chunks: Record<string, RenderedChunk>;
3089
+ };
3090
+ interface FunctionPluginHooks {
3091
+ [DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
3092
+ [DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
3093
+ [DEFINED_HOOK_NAMES.outputOptions]: (this: MinimalPluginContext, options: OutputOptions) => NullValue | OutputOptions;
3094
+ [DEFINED_HOOK_NAMES.buildStart]: (this: PluginContext, options: NormalizedInputOptions) => void;
3095
+ [DEFINED_HOOK_NAMES.resolveId]: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult;
3096
+ /**
3097
+ * @deprecated
3098
+ * This hook is only for rollup plugin compatibility. Please use `resolveId` instead.
3099
+ */
3100
+ [DEFINED_HOOK_NAMES.resolveDynamicImport]: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult;
3101
+ [DEFINED_HOOK_NAMES.load]: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
3102
+ [DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
3103
+ moduleType: ModuleType;
3104
+ magicString?: BindingMagicString;
3105
+ ast?: Program;
3106
+ }) => TransformResult;
3107
+ [DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
3108
+ [DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
3109
+ [DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
3110
+ [DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions, meta: RenderedChunkMeta) => NullValue | string | {
3111
+ code: string;
3112
+ map?: SourceMapInput;
3113
+ };
3114
+ [DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk: RenderedChunk) => string | void;
3115
+ [DEFINED_HOOK_NAMES.renderError]: (this: PluginContext, error: Error) => void;
3116
+ [DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
3117
+ [DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
3118
+ [DEFINED_HOOK_NAMES.closeBundle]: (this: PluginContext) => void;
3119
+ [DEFINED_HOOK_NAMES.watchChange]: (this: PluginContext, id: string, event: {
3120
+ event: ChangeEvent;
3121
+ }) => void;
3122
+ [DEFINED_HOOK_NAMES.closeWatcher]: (this: PluginContext) => void;
3123
+ }
3124
+ type ChangeEvent = "create" | "update" | "delete";
3125
+ type PluginOrder = "pre" | "post" | null;
3126
+ type ObjectHookMeta = {
3127
+ order?: PluginOrder;
3128
+ };
3129
+ type ObjectHook<T, O = {}> = T | ({
3130
+ handler: T;
3131
+ } & ObjectHookMeta & O);
3132
+ type SyncPluginHooks = DefinedHookNames["augmentChunkHash" | "onLog" | "outputOptions"];
3133
+ type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
3134
+ type FirstPluginHooks = DefinedHookNames["load" | "resolveDynamicImport" | "resolveId"];
3135
+ type SequentialPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "onLog" | "options" | "outputOptions" | "renderChunk" | "transform"];
3136
+ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
3137
+ type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
3138
+ type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
3139
+ type HookFilterExtension<K$1 extends keyof FunctionPluginHooks> = K$1 extends "transform" ? {
3140
+ filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>;
3141
+ } : K$1 extends "load" ? {
3142
+ filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>;
3143
+ } : K$1 extends "resolveId" ? {
3144
+ filter?: TUnionWithTopLevelFilterExpressionArray<{
3145
+ id?: GeneralHookFilter<RegExp>;
3146
+ }>;
3147
+ } : K$1 extends "renderChunk" ? {
3148
+ filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>;
3149
+ } : {};
3150
+ type PluginHooks = { [K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
3151
+ /**
3152
+ * @deprecated
3153
+ * this is only for rollup Plugin type compatibility.
3154
+ * hooks always work as `sequential: true`.
3155
+ */
3156
+ sequential?: boolean;
3157
+ } : {})> };
3158
+ type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
3159
+ type AddonHook = string | AddonHookFunction;
3160
+ interface OutputPlugin extends Partial<{ [K in keyof PluginHooks as K & OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
3161
+ name: string;
3162
+ }
3163
+ interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
3164
+ api?: A;
3165
+ }
3166
+ type RolldownPlugin<A = any> = Plugin<A> | BuiltinPlugin | ParallelPlugin;
3167
+ type RolldownPluginOption<A = any> = MaybePromise<NullValue<RolldownPlugin<A>> | {
3168
+ name: string;
3169
+ } | false | RolldownPluginOption[]>;
3170
+ type RolldownOutputPlugin = OutputPlugin | BuiltinPlugin;
3171
+ type RolldownOutputPluginOption = MaybePromise<NullValue<RolldownOutputPlugin> | {
3172
+ name: string;
3173
+ } | false | RolldownOutputPluginOption[]>; //#endregion
3174
+ //#region src/options/generated/checks-options.d.ts
3175
+ interface ChecksOptions {
3176
+ /**
3177
+ * Whether to emit warning when detecting circular dependency
3178
+ * @default false
3179
+ */
3180
+ circularDependency?: boolean;
3181
+ /**
3182
+ * Whether to emit warning when detecting eval
3183
+ * @default true
3184
+ */
3185
+ eval?: boolean;
3186
+ /**
3187
+ * Whether to emit warning when detecting missing global name
3188
+ * @default true
3189
+ */
3190
+ missingGlobalName?: boolean;
3191
+ /**
3192
+ * Whether to emit warning when detecting missing name option for iife export
3193
+ * @default true
3194
+ */
3195
+ missingNameOptionForIifeExport?: boolean;
3196
+ /**
3197
+ * Whether to emit warning when detecting mixed exports
3198
+ * @default true
3199
+ */
3200
+ mixedExports?: boolean;
3201
+ /**
3202
+ * Whether to emit warning when detecting unresolved entry
3203
+ * @default true
3204
+ */
3205
+ unresolvedEntry?: boolean;
3206
+ /**
3207
+ * Whether to emit warning when detecting unresolved import
3208
+ * @default true
3209
+ */
3210
+ unresolvedImport?: boolean;
3211
+ /**
3212
+ * Whether to emit warning when detecting filename conflict
3213
+ * @default true
3214
+ */
3215
+ filenameConflict?: boolean;
3216
+ /**
3217
+ * Whether to emit warning when detecting common js variable in esm
3218
+ * @default true
3219
+ */
3220
+ commonJsVariableInEsm?: boolean;
3221
+ /**
3222
+ * Whether to emit warning when detecting import is undefined
3223
+ * @default true
3224
+ */
3225
+ importIsUndefined?: boolean;
3226
+ /**
3227
+ * Whether to emit warning when detecting empty import meta
3228
+ * @default true
3229
+ */
3230
+ emptyImportMeta?: boolean;
3231
+ /**
3232
+ * Whether to emit warning when detecting cannot call namespace
3233
+ * @default true
3234
+ */
3235
+ cannotCallNamespace?: boolean;
3236
+ /**
3237
+ * Whether to emit warning when detecting configuration field conflict
3238
+ * @default true
3239
+ */
3240
+ configurationFieldConflict?: boolean;
3241
+ /**
3242
+ * Whether to emit warning when detecting prefer builtin feature
3243
+ * @default true
3244
+ */
3245
+ preferBuiltinFeature?: boolean;
3246
+ /**
3247
+ * Whether to emit warning when detecting could not clean directory
3248
+ * @default true
3249
+ */
3250
+ couldNotCleanDirectory?: boolean;
3251
+ /**
3252
+ * Whether to emit warning when detecting plugin timings
3253
+ * @default true
3254
+ */
3255
+ pluginTimings?: boolean;
3256
+ } //#endregion
3257
+ //#region src/options/transform-options.d.ts
3258
+ interface TransformOptions extends Omit<TransformOptions$1, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject" | "jsx"> {
3259
+ /**
3260
+ * Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values.
3261
+ *
3262
+ * # Examples
3263
+ *
3264
+ * - Replace the global variable `IS_PROD` with `true`
3265
+ *
3266
+ * ```js rolldown.config.js
3267
+ * export default defineConfig({ transform: { define: { IS_PROD: 'true' } } })
3268
+ * ```
3269
+ *
3270
+ * Result:
3271
+ *
3272
+ * ```js
3273
+ * // Input
3274
+ * if (IS_PROD) {
3275
+ * console.log('Production mode')
3276
+ * }
3277
+ *
3278
+ * // After bundling
3279
+ * if (true) {
3280
+ * console.log('Production mode')
3281
+ * }
3282
+ * ```
3283
+ *
3284
+ * - Replace the property accessor `process.env.NODE_ENV` with `'production'`
3285
+ *
3286
+ * ```js rolldown.config.js
3287
+ * export default defineConfig({ transform: { define: { 'process.env.NODE_ENV': "'production'" } } })
3288
+ * ```
3289
+ *
3290
+ * Result:
3291
+ *
3292
+ * ```js
3293
+ * // Input
3294
+ * if (process.env.NODE_ENV === 'production') {
3295
+ * console.log('Production mode')
3296
+ * }
3297
+ *
3298
+ * // After bundling
3299
+ * if ('production' === 'production') {
3300
+ * console.log('Production mode')
3301
+ * }
3302
+ *
3303
+ * ```
3304
+ */
3305
+ define?: Record<string, string>;
3306
+ /**
3307
+ * Inject import statements on demand.
3308
+ *
3309
+ * The API is aligned with `@rollup/plugin-inject`.
3310
+ *
3311
+ * ## Supported patterns
3312
+ * ```js
3313
+ * {
3314
+ * // import { Promise } from 'es6-promise'
3315
+ * Promise: ['es6-promise', 'Promise'],
3316
+ *
3317
+ * // import { Promise as P } from 'es6-promise'
3318
+ * P: ['es6-promise', 'Promise'],
3319
+ *
3320
+ * // import $ from 'jquery'
3321
+ * $: 'jquery',
3322
+ *
3323
+ * // import * as fs from 'node:fs'
3324
+ * fs: ['node:fs', '*'],
3325
+ *
3326
+ * // Inject shims for property access pattern
3327
+ * 'Object.assign': path.resolve( 'src/helpers/object-assign.js' ),
3328
+ * }
3329
+ * ```
3330
+ */
3331
+ inject?: Record<string, string | [string, string]>;
3332
+ /**
3333
+ * Remove labeled statements with these label names.
3334
+ *
3335
+ * Labeled statements are JavaScript statements prefixed with a label identifier.
3336
+ * This option allows you to strip specific labeled statements from the output,
3337
+ * which is useful for removing debug-only code in production builds.
3338
+ *
3339
+ * ## Example
3340
+ *
3341
+ * ```js rolldown.config.js
3342
+ * export default defineConfig({ transform: { dropLabels: ['DEBUG', 'DEV'] } })
3343
+ * ```
3344
+ *
3345
+ * Result:
3346
+ *
3347
+ * ```js
3348
+ * // Input
3349
+ * DEBUG: console.log('Debug info');
3350
+ * DEV: {
3351
+ * console.log('Development mode');
3352
+ * }
3353
+ * console.log('Production code');
3354
+ *
3355
+ * // After bundling
3356
+ * console.log('Production code');
3357
+ * ```
3358
+ */
3359
+ dropLabels?: string[];
3360
+ jsx?: false | "react" | "react-jsx" | "preserve" | JsxOptions;
3361
+ } //#endregion
3362
+ //#region src/options/input-options.d.ts
3363
+ type InputOption = string | string[] | Record<string, string>;
3364
+ type ExternalOptionFunction = (id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>;
3365
+ type ExternalOption = StringOrRegExp | StringOrRegExp[] | ExternalOptionFunction;
3366
+ type ModuleTypes = Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css" | "asset">;
3367
+ interface WatcherOptions {
3368
+ skipWrite?: boolean;
3369
+ buildDelay?: number;
3370
+ notify?: {
3371
+ pollInterval?: number;
3372
+ compareContents?: boolean;
3373
+ };
3374
+ include?: StringOrRegExp | StringOrRegExp[];
3375
+ exclude?: StringOrRegExp | StringOrRegExp[];
3376
+ onInvalidate?: (id: string) => void;
3377
+ clearScreen?: boolean;
3378
+ }
3379
+ type MakeAbsoluteExternalsRelative = boolean | "ifRelativeSource";
3380
+ type DevModeOptions = boolean | {
3381
+ host?: string;
3382
+ port?: number;
3383
+ implement?: string;
3384
+ lazy?: boolean;
3385
+ };
3386
+ type OptimizationOptions = {
3387
+ /**
3388
+ * Inline imported constant values during bundling instead of preserving variable references.
3389
+ *
3390
+ * When enabled, constant values from imported modules will be inlined at their usage sites,
3391
+ * potentially reducing bundle size and improving runtime performance by eliminating variable lookups.
3392
+ * **options**:
3393
+ * - `true`: equivalent to `{ mode: 'all', pass: 1 }`, enabling constant inlining for all eligible constants with a single pass.
3394
+ * - `false`: Disable constant inlining
3395
+ * - `{ mode: 'smart' | 'all', pass?: number }`:
3396
+ * - `mode: 'smart'`: Only inline constants in specific scenarios where it is likely to reduce bundle size and improve performance.
3397
+ * Smart mode inlines constants in these specific scenarios:
3398
+ * 1. `if (test) {} else {}` - condition expressions in if statements
3399
+ * 2. `test ? a : b` - condition expressions in ternary operators
3400
+ * 3. `test1 || test2` - logical OR expressions
3401
+ * 4. `test1 && test2` - logical AND expressions
3402
+ * 5. `test1 ?? test2` - nullish coalescing expressions
3403
+ * - `mode: 'all'`: Inline all imported constants wherever they are used.
3404
+ * - `pass`: Number of passes to perform for inlining constants.
3405
+ *
3406
+ * **example**
3407
+ * ```js
3408
+ * // Input files:
3409
+ * // constants.js
3410
+ * export const API_URL = 'https://api.example.com';
3411
+ *
3412
+ * // main.js
3413
+ * import { API_URL } from './constants.js';
3414
+ * console.log(API_URL);
3415
+ *
3416
+ * // With inlineConst: true, the bundled output becomes:
3417
+ * console.log('https://api.example.com');
3418
+ *
3419
+ * // Instead of:
3420
+ * const API_URL = 'https://api.example.com';
3421
+ * console.log(API_URL);
3422
+ * ```
3423
+ *
3424
+ * @default false
3425
+ */
3426
+ inlineConst?: boolean | {
3427
+ mode?: "all" | "smart";
3428
+ pass?: number;
3429
+ };
3430
+ /**
3431
+ * Use PIFE pattern for module wrappers
3432
+ */
3433
+ pifeForModuleWrappers?: boolean;
3434
+ };
3435
+ type AttachDebugOptions = "none" | "simple" | "full";
3436
+ type ChunkModulesOrder = "exec-order" | "module-id";
3437
+ type OnLogFunction = (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
3438
+ type OnwarnFunction = (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
3439
+ interface InputOptions {
3440
+ input?: InputOption;
3441
+ plugins?: RolldownPluginOption;
3442
+ external?: ExternalOption;
3443
+ resolve?: {
3444
+ /**
3445
+ * > [!WARNING]
3446
+ * > `resolve.alias` will not call `resolveId` hooks of other plugin.
3447
+ * > If you want to call `resolveId` hooks of other plugin, use `viteAliasPlugin` from `rolldown/experimental` instead.
3448
+ * > You could find more discussion in [this issue](https://github.com/rolldown/rolldown/issues/3615)
3449
+ */
3450
+ alias?: Record<string, string[] | string | false>;
3451
+ aliasFields?: string[][];
3452
+ conditionNames?: string[];
3453
+ /**
3454
+ * Map of extensions to alternative extensions.
3455
+ *
3456
+ * With writing `import './foo.js'` in a file, you want to resolve it to `foo.ts` instead of `foo.js`.
3457
+ * You can achieve this by setting: `extensionAlias: { '.js': ['.ts', '.js'] }`.
3458
+ */
3459
+ extensionAlias?: Record<string, string[]>;
3460
+ exportsFields?: string[][];
3461
+ extensions?: string[];
3462
+ mainFields?: string[];
3463
+ mainFiles?: string[];
3464
+ modules?: string[];
3465
+ symlinks?: boolean;
3466
+ /**
3467
+ * @deprecated Use the top-level `tsconfig` option instead.
3468
+ */
3469
+ tsconfigFilename?: string;
3470
+ };
3471
+ cwd?: string;
3472
+ /**
3473
+ * Expected platform where the code run.
3474
+ *
3475
+ * When the platform is set to neutral:
3476
+ * - When bundling is enabled the default output format is set to esm, which uses the export syntax introduced with ECMAScript 2015 (i.e. ES6). You can change the output format if this default is not appropriate.
3477
+ * - The main fields setting is empty by default. If you want to use npm-style packages, you will likely have to configure this to be something else such as main for the standard main field used by node.
3478
+ * - The conditions setting does not automatically include any platform-specific values.
3479
+ *
3480
+ * @default
3481
+ * - 'node' if the format is 'cjs'
3482
+ * - 'browser' for other formats
3483
+ */
3484
+ platform?: "node" | "browser" | "neutral";
3485
+ shimMissingExports?: boolean;
3486
+ treeshake?: boolean | TreeshakingOptions;
3487
+ logLevel?: LogLevelOption;
3488
+ onLog?: OnLogFunction;
3489
+ onwarn?: OnwarnFunction;
3490
+ moduleTypes?: ModuleTypes;
3491
+ experimental?: {
3492
+ /**
3493
+ * Lets modules be executed in the order they are declared.
3494
+ *
3495
+ * - Type: `boolean`
3496
+ * - Default: `false`
3497
+ *
3498
+ * This is done by injecting runtime helpers to ensure that modules are executed in the order they are imported. External modules won't be affected.
3499
+ *
3500
+ * > [!WARNING]
3501
+ * > Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary.
3502
+ */
3503
+ strictExecutionOrder?: boolean;
3504
+ disableLiveBindings?: boolean;
3505
+ viteMode?: boolean;
3506
+ resolveNewUrlToAsset?: boolean;
3507
+ devMode?: DevModeOptions;
3508
+ /**
3509
+ * Control which order should use when rendering modules in chunk
3510
+ *
3511
+ * - Type: `'exec-order' | 'module-id'
3512
+ * - Default: `'exec-order'`
3513
+ *
3514
+ * - `exec-order`: Almost equivalent to the topological order of the module graph, but specially handling when module graph has cycle.
3515
+ * - `module-id`: This is more friendly for gzip compression, especially for some javascript static asset lib (e.g. icon library)
3516
+ * > [!NOTE]
3517
+ * > Try to sort the modules by their module id if possible(Since rolldown scope hoist all modules in the chunk, we only try to sort those modules by module id if we could ensure runtime behavior is correct after sorting).
3518
+ */
3519
+ chunkModulesOrder?: ChunkModulesOrder;
3520
+ /**
3521
+ * Attach debug information to the output bundle.
3522
+ *
3523
+ * - Type: `'none' | 'simple' | 'full'`
3524
+ * - Default: `'simple'`
3525
+ *
3526
+ * - `none`: No debug information is attached.
3527
+ * - `simple`: Attach comments indicating which files the bundled code comes from. These comments could be removed by the minifier.
3528
+ * - `full`: Attach detailed debug information to the output bundle. These comments are using legal comment syntax, so they won't be removed by the minifier.
3529
+ *
3530
+ * > [!WARNING]
3531
+ * > You shouldn't use `full` in the production build.
3532
+ */
3533
+ attachDebugInfo?: AttachDebugOptions;
3534
+ /**
3535
+ * Enables automatic generation of a chunk import map asset during build.
3536
+ *
3537
+ * This map only includes chunks with hashed filenames, where keys are derived from the facade module
3538
+ * name or primary chunk name. It produces stable and unique hash-based filenames, effectively preventing
3539
+ * cascading cache invalidation caused by content hashes and maximizing browser cache reuse.
3540
+ *
3541
+ * The output defaults to `importmap.json` unless overridden via `fileName`. A base URL prefix
3542
+ * (default `"/"`) can be applied to all paths. The resulting JSON is a valid import map and can be
3543
+ * directly injected into HTML via `<script type="importmap">`.
3544
+ *
3545
+ * Example configuration snippet:
3546
+ *
3547
+ * ```js
3548
+ * {
3549
+ * experimental: {
3550
+ * chunkImportMap: {
3551
+ * baseUrl: '/',
3552
+ * fileName: 'importmap.json'
3553
+ * }
3554
+ * },
3555
+ * plugins: [
3556
+ * {
3557
+ * name: 'inject-import-map',
3558
+ * generateBundle(_, bundle) {
3559
+ * const chunkImportMap = bundle['importmap.json'];
3560
+ * if (chunkImportMap?.type === 'asset') {
3561
+ * const htmlPath = path.resolve('index.html');
3562
+ * let html = fs.readFileSync(htmlPath, 'utf-8');
3563
+ *
3564
+ * html = html.replace(
3565
+ * /<script\s+type="importmap"[^>]*>[\s\S]*?<\/script>/i,
3566
+ * `<script type="importmap">${chunkImportMap.source}<\/script>`
3567
+ * );
3568
+ *
3569
+ * fs.writeFileSync(htmlPath, html);
3570
+ * delete bundle['importmap.json'];
3571
+ * }
3572
+ * }
3573
+ * }
3574
+ * ]
3575
+ * }
3576
+ * ```
3577
+ *
3578
+ * > [!NOTE]
3579
+ * > If you want to learn more, you can check out the example here: [examples/chunk-import-map](https://github.com/rolldown/rolldown/tree/main/examples/chunk-import-map)
3580
+ */
3581
+ chunkImportMap?: boolean | {
3582
+ baseUrl?: string;
3583
+ fileName?: string;
3584
+ };
3585
+ onDemandWrapping?: boolean;
3586
+ /**
3587
+ * Required to be used with `watch` mode.
3588
+ */
3589
+ incrementalBuild?: boolean;
3590
+ transformHiresSourcemap?: boolean | "boundary";
3591
+ /**
3592
+ * Use native Rust implementation of MagicString for source map generation.
3593
+ *
3594
+ * - Type: `boolean`
3595
+ * - Default: `false`
3596
+ *
3597
+ * [MagicString](https://github.com/rich-harris/magic-string) is a JavaScript library commonly used by bundlers
3598
+ * for string manipulation and source map generation. When enabled, rolldown will use a native Rust
3599
+ * implementation of MagicString instead of the JavaScript version, providing significantly better performance
3600
+ * during source map generation and code transformation.
3601
+ *
3602
+ * ## Benefits
3603
+ *
3604
+ * - **Improved Performance**: The native Rust implementation is typically faster than the JavaScript version,
3605
+ * especially for large codebases with extensive source maps.
3606
+ * - **Background Processing**: Source map generation is performed asynchronously in a background thread,
3607
+ * allowing the main bundling process to continue without blocking. This parallel processing can significantly
3608
+ * reduce overall build times when working with JavaScript transform hooks.
3609
+ * - **Better Integration**: Seamless integration with rolldown's native Rust architecture.
3610
+ *
3611
+ * ## Example
3612
+ *
3613
+ * ```js
3614
+ * export default {
3615
+ * experimental: {
3616
+ * nativeMagicString: true
3617
+ * },
3618
+ * output: {
3619
+ * sourcemap: true
3620
+ * }
3621
+ * }
3622
+ * ```
3623
+ *
3624
+ * > [!NOTE]
3625
+ * > This is an experimental feature. While it aims to provide identical behavior to the JavaScript
3626
+ * > implementation, there may be edge cases. Please report any discrepancies you encounter.
3627
+ * > For a complete working example, see [examples/native-magic-string](https://github.com/rolldown/rolldown/tree/main/examples/native-magic-string)
3628
+ */
3629
+ nativeMagicString?: boolean;
3630
+ };
3631
+ /**
3632
+ * Configure how the code is transformed. This process happens after the `transform` hook.
3633
+ *
3634
+ * To transpile [legacy decorators](https://github.com/tc39/proposal-decorators/tree/4ac0f4cd31bd0f2e8170cb4c5136e51671e46c8d), you could use
3635
+ *
3636
+ * ```js
3637
+ * export default defineConfig({
3638
+ * transform: {
3639
+ * decorator: {
3640
+ * legacy: true,
3641
+ * },
3642
+ * },
3643
+ * })
3644
+ * ```
3645
+ *
3646
+ * For latest decorators proposal, rolldown is able to bundle them but doesn't support transpiling them yet.
3647
+ */
3648
+ transform?: TransformOptions;
3649
+ watch?: WatcherOptions | false;
3650
+ checks?: ChecksOptions;
3651
+ makeAbsoluteExternalsRelative?: MakeAbsoluteExternalsRelative;
3652
+ debug?: {
3653
+ sessionId?: string;
3654
+ };
3655
+ preserveEntrySignatures?: false | "strict" | "allow-extension" | "exports-only";
3656
+ optimization?: OptimizationOptions;
3657
+ context?: string;
3658
+ /**
3659
+ * Configures TypeScript configuration file resolution and usage.
3660
+ *
3661
+ * ## Options
3662
+ *
3663
+ * - `true`: Auto-discovery mode (similar to Vite). For each module, both resolver and transformer
3664
+ * will find the nearest tsconfig.json. If the tsconfig has `references`, the file extension is
3665
+ * allowed, and the tsconfig's `include`/`exclude` patterns don't match the file, the referenced
3666
+ * tsconfigs will be searched for a match. Falls back to the original tsconfig if no match is found.
3667
+ * - `string`: Path to a specific tsconfig.json file (relative to cwd or absolute path).
3668
+ *
3669
+ * ## What's used from tsconfig
3670
+ *
3671
+ * - **Resolver**: Uses `compilerOptions.paths` and `compilerOptions.baseUrl` for path mapping
3672
+ * - **Transformer**: Uses select compiler options (jsx, decorators, typescript, etc.)
3673
+ *
3674
+ * > [!NOTE]
3675
+ * > Priority: Top-level `transform` options always take precedence over tsconfig settings.
3676
+ *
3677
+ * @default undefined (no tsconfig resolution)
3678
+ */
3679
+ tsconfig?: true | string;
3680
+ } //#endregion
3681
+ //#region src/types/rolldown-options.d.ts
3682
+ //#endregion
4
3683
  //#region src/rolldown.d.ts
5
-
6
3684
  /**
7
3685
  * This entry file is for Rolldown plugin.
8
3686
  *
@@ -21,6 +3699,6 @@ import * as rolldown0 from "rolldown";
21
3699
  * }
22
3700
  * ```
23
3701
  */
24
- declare const rolldown: (options?: CloudflareTunnelOptions | undefined) => rolldown0.Plugin<any>;
3702
+ declare const rolldown: (options?: CloudflareTunnelOptions | undefined) => Plugin<any>;
25
3703
  //#endregion
26
3704
  export { rolldown as default, rolldown as "module.exports" };