//#region ../../node_modules/@oxc-project/types/types.d.ts // Auto-generated code, DO NOT EDIT DIRECTLY! // To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`. interface Program extends Span { type: "Program"; body: Array; sourceType: ModuleKind; hashbang: Hashbang | null; parent?: null; } 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; interface IdentifierName extends Span { type: "Identifier"; decorators?: []; name: string; optional?: false; typeAnnotation?: null; parent?: Node; } interface IdentifierReference extends Span { type: "Identifier"; decorators?: []; name: string; optional?: false; typeAnnotation?: null; parent?: Node; } interface BindingIdentifier extends Span { type: "Identifier"; decorators?: []; name: string; optional?: false; typeAnnotation?: null; parent?: Node; } interface LabelIdentifier extends Span { type: "Identifier"; decorators?: []; name: string; optional?: false; typeAnnotation?: null; parent?: Node; } interface ThisExpression extends Span { type: "ThisExpression"; parent?: Node; } interface ArrayExpression extends Span { type: "ArrayExpression"; elements: Array; parent?: Node; } type ArrayExpressionElement = SpreadElement | null | Expression; interface ObjectExpression extends Span { type: "ObjectExpression"; properties: Array; parent?: Node; } type ObjectPropertyKind = ObjectProperty | SpreadElement; interface ObjectProperty extends Span { type: "Property"; kind: PropertyKind; key: PropertyKey; value: Expression; method: boolean; shorthand: boolean; computed: boolean; optional?: false; parent?: Node; } type PropertyKey = IdentifierName | PrivateIdentifier | Expression; type PropertyKind = "init" | "get" | "set"; interface TemplateLiteral extends Span { type: "TemplateLiteral"; quasis: Array; expressions: Array; parent?: Node; } interface TaggedTemplateExpression extends Span { type: "TaggedTemplateExpression"; tag: Expression; typeArguments?: TSTypeParameterInstantiation | null; quasi: TemplateLiteral; parent?: Node; } interface TemplateElement extends Span { type: "TemplateElement"; value: TemplateElementValue; tail: boolean; parent?: Node; } interface TemplateElementValue { raw: string; cooked: string | null; } type MemberExpression = ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression; interface ComputedMemberExpression extends Span { type: "MemberExpression"; object: Expression; property: Expression; optional: boolean; computed: true; parent?: Node; } interface StaticMemberExpression extends Span { type: "MemberExpression"; object: Expression; property: IdentifierName; optional: boolean; computed: false; parent?: Node; } interface PrivateFieldExpression extends Span { type: "MemberExpression"; object: Expression; property: PrivateIdentifier; optional: boolean; computed: false; parent?: Node; } interface CallExpression extends Span { type: "CallExpression"; callee: Expression; typeArguments?: TSTypeParameterInstantiation | null; arguments: Array; optional: boolean; parent?: Node; } interface NewExpression extends Span { type: "NewExpression"; callee: Expression; typeArguments?: TSTypeParameterInstantiation | null; arguments: Array; parent?: Node; } interface MetaProperty extends Span { type: "MetaProperty"; meta: IdentifierName; property: IdentifierName; parent?: Node; } interface SpreadElement extends Span { type: "SpreadElement"; argument: Expression; parent?: Node; } type Argument = SpreadElement | Expression; interface UpdateExpression extends Span { type: "UpdateExpression"; operator: UpdateOperator; prefix: boolean; argument: SimpleAssignmentTarget; parent?: Node; } interface UnaryExpression extends Span { type: "UnaryExpression"; operator: UnaryOperator; argument: Expression; prefix: true; parent?: Node; } interface BinaryExpression extends Span { type: "BinaryExpression"; left: Expression; operator: BinaryOperator; right: Expression; parent?: Node; } interface PrivateInExpression extends Span { type: "BinaryExpression"; left: PrivateIdentifier; operator: "in"; right: Expression; parent?: Node; } interface LogicalExpression extends Span { type: "LogicalExpression"; left: Expression; operator: LogicalOperator; right: Expression; parent?: Node; } interface ConditionalExpression extends Span { type: "ConditionalExpression"; test: Expression; consequent: Expression; alternate: Expression; parent?: Node; } interface AssignmentExpression extends Span { type: "AssignmentExpression"; operator: AssignmentOperator; left: AssignmentTarget; right: Expression; parent?: Node; } type AssignmentTarget = SimpleAssignmentTarget | AssignmentTargetPattern; type SimpleAssignmentTarget = IdentifierReference | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | MemberExpression; type AssignmentTargetPattern = ArrayAssignmentTarget | ObjectAssignmentTarget; interface ArrayAssignmentTarget extends Span { type: "ArrayPattern"; decorators?: []; elements: Array; optional?: false; typeAnnotation?: null; parent?: Node; } interface ObjectAssignmentTarget extends Span { type: "ObjectPattern"; decorators?: []; properties: Array; optional?: false; typeAnnotation?: null; parent?: Node; } interface AssignmentTargetRest extends Span { type: "RestElement"; decorators?: []; argument: AssignmentTarget; optional?: false; typeAnnotation?: null; value?: null; parent?: Node; } type AssignmentTargetMaybeDefault = AssignmentTargetWithDefault | AssignmentTarget; interface AssignmentTargetWithDefault extends Span { type: "AssignmentPattern"; decorators?: []; left: AssignmentTarget; right: Expression; optional?: false; typeAnnotation?: null; parent?: Node; } type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty; interface AssignmentTargetPropertyIdentifier extends Span { type: "Property"; kind: "init"; key: IdentifierReference; value: IdentifierReference | AssignmentTargetWithDefault; method: false; shorthand: true; computed: false; optional?: false; parent?: Node; } interface AssignmentTargetPropertyProperty extends Span { type: "Property"; kind: "init"; key: PropertyKey; value: AssignmentTargetMaybeDefault; method: false; shorthand: false; computed: boolean; optional?: false; parent?: Node; } interface SequenceExpression extends Span { type: "SequenceExpression"; expressions: Array; parent?: Node; } interface Super extends Span { type: "Super"; parent?: Node; } interface AwaitExpression extends Span { type: "AwaitExpression"; argument: Expression; parent?: Node; } interface ChainExpression extends Span { type: "ChainExpression"; expression: ChainElement; parent?: Node; } type ChainElement = CallExpression | TSNonNullExpression | MemberExpression; interface ParenthesizedExpression extends Span { type: "ParenthesizedExpression"; expression: Expression; parent?: Node; } type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | WithStatement | Declaration | ModuleDeclaration; interface Directive extends Span { type: "ExpressionStatement"; expression: StringLiteral; directive: string; parent?: Node; } interface Hashbang extends Span { type: "Hashbang"; value: string; parent?: Node; } interface BlockStatement extends Span { type: "BlockStatement"; body: Array; parent?: Node; } type Declaration = VariableDeclaration | Function | Class | TSTypeAliasDeclaration | TSInterfaceDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSGlobalDeclaration | TSImportEqualsDeclaration; interface VariableDeclaration extends Span { type: "VariableDeclaration"; kind: VariableDeclarationKind; declarations: Array; declare?: boolean; parent?: Node; } type VariableDeclarationKind = "var" | "let" | "const" | "using" | "await using"; interface VariableDeclarator extends Span { type: "VariableDeclarator"; id: BindingPattern; init: Expression | null; definite?: boolean; parent?: Node; } interface EmptyStatement extends Span { type: "EmptyStatement"; parent?: Node; } interface ExpressionStatement extends Span { type: "ExpressionStatement"; expression: Expression; directive?: string | null; parent?: Node; } interface IfStatement extends Span { type: "IfStatement"; test: Expression; consequent: Statement; alternate: Statement | null; parent?: Node; } interface DoWhileStatement extends Span { type: "DoWhileStatement"; body: Statement; test: Expression; parent?: Node; } interface WhileStatement extends Span { type: "WhileStatement"; test: Expression; body: Statement; parent?: Node; } interface ForStatement extends Span { type: "ForStatement"; init: ForStatementInit | null; test: Expression | null; update: Expression | null; body: Statement; parent?: Node; } type ForStatementInit = VariableDeclaration | Expression; interface ForInStatement extends Span { type: "ForInStatement"; left: ForStatementLeft; right: Expression; body: Statement; parent?: Node; } type ForStatementLeft = VariableDeclaration | AssignmentTarget; interface ForOfStatement extends Span { type: "ForOfStatement"; await: boolean; left: ForStatementLeft; right: Expression; body: Statement; parent?: Node; } interface ContinueStatement extends Span { type: "ContinueStatement"; label: LabelIdentifier | null; parent?: Node; } interface BreakStatement extends Span { type: "BreakStatement"; label: LabelIdentifier | null; parent?: Node; } interface ReturnStatement extends Span { type: "ReturnStatement"; argument: Expression | null; parent?: Node; } interface WithStatement extends Span { type: "WithStatement"; object: Expression; body: Statement; parent?: Node; } interface SwitchStatement extends Span { type: "SwitchStatement"; discriminant: Expression; cases: Array; parent?: Node; } interface SwitchCase extends Span { type: "SwitchCase"; test: Expression | null; consequent: Array; parent?: Node; } interface LabeledStatement extends Span { type: "LabeledStatement"; label: LabelIdentifier; body: Statement; parent?: Node; } interface ThrowStatement extends Span { type: "ThrowStatement"; argument: Expression; parent?: Node; } interface TryStatement extends Span { type: "TryStatement"; block: BlockStatement; handler: CatchClause | null; finalizer: BlockStatement | null; parent?: Node; } interface CatchClause extends Span { type: "CatchClause"; param: BindingPattern | null; body: BlockStatement; parent?: Node; } interface DebuggerStatement extends Span { type: "DebuggerStatement"; parent?: Node; } type BindingPattern = { optional?: boolean; typeAnnotation?: TSTypeAnnotation | null; } & (BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern); type BindingPatternKind = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern; interface AssignmentPattern extends Span { type: "AssignmentPattern"; decorators?: []; left: BindingPattern; right: Expression; optional?: false; typeAnnotation?: null; parent?: Node; } interface ObjectPattern extends Span { type: "ObjectPattern"; decorators?: []; properties: Array; optional?: false; typeAnnotation?: null; parent?: Node; } interface BindingProperty extends Span { type: "Property"; kind: "init"; key: PropertyKey; value: BindingPattern; method: false; shorthand: boolean; computed: boolean; optional?: false; parent?: Node; } interface ArrayPattern extends Span { type: "ArrayPattern"; decorators?: []; elements: Array; optional?: false; typeAnnotation?: null; parent?: Node; } interface BindingRestElement extends Span { type: "RestElement"; decorators?: []; argument: BindingPattern; optional?: false; typeAnnotation?: null; value?: null; parent?: Node; } interface Function extends Span { type: FunctionType; id: BindingIdentifier | null; generator: boolean; async: boolean; declare?: boolean; typeParameters?: TSTypeParameterDeclaration | null; params: ParamPattern[]; returnType?: TSTypeAnnotation | null; body: FunctionBody | null; expression: false; parent?: Node; } type ParamPattern = FormalParameter | TSParameterProperty | FormalParameterRest; type FunctionType = "FunctionDeclaration" | "FunctionExpression" | "TSDeclareFunction" | "TSEmptyBodyFunctionExpression"; interface FormalParameterRest extends Span { type: "RestElement"; argument: BindingPatternKind; decorators?: []; optional?: boolean; typeAnnotation?: TSTypeAnnotation | null; value?: null; parent?: Node; } type FormalParameter = { decorators?: Array; } & BindingPattern; interface TSParameterProperty extends Span { type: "TSParameterProperty"; accessibility: TSAccessibility | null; decorators: Array; override: boolean; parameter: FormalParameter; readonly: boolean; static: boolean; parent?: Node; } interface FunctionBody extends Span { type: "BlockStatement"; body: Array; parent?: Node; } interface ArrowFunctionExpression extends Span { type: "ArrowFunctionExpression"; expression: boolean; async: boolean; typeParameters?: TSTypeParameterDeclaration | null; params: ParamPattern[]; returnType?: TSTypeAnnotation | null; body: FunctionBody | Expression; id: null; generator: false; parent?: Node; } interface YieldExpression extends Span { type: "YieldExpression"; delegate: boolean; argument: Expression | null; parent?: Node; } interface Class extends Span { type: ClassType; decorators: Array; id: BindingIdentifier | null; typeParameters?: TSTypeParameterDeclaration | null; superClass: Expression | null; superTypeArguments?: TSTypeParameterInstantiation | null; implements?: Array; body: ClassBody; abstract?: boolean; declare?: boolean; parent?: Node; } type ClassType = "ClassDeclaration" | "ClassExpression"; interface ClassBody extends Span { type: "ClassBody"; body: Array; parent?: Node; } type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition | AccessorProperty | TSIndexSignature; interface MethodDefinition extends Span { type: MethodDefinitionType; decorators: Array; key: PropertyKey; value: Function; kind: MethodDefinitionKind; computed: boolean; static: boolean; override?: boolean; optional?: boolean; accessibility?: TSAccessibility | null; parent?: Node; } type MethodDefinitionType = "MethodDefinition" | "TSAbstractMethodDefinition"; interface PropertyDefinition extends Span { type: PropertyDefinitionType; decorators: Array; key: PropertyKey; typeAnnotation?: TSTypeAnnotation | null; value: Expression | null; computed: boolean; static: boolean; declare?: boolean; override?: boolean; optional?: boolean; definite?: boolean; readonly?: boolean; accessibility?: TSAccessibility | null; parent?: Node; } type PropertyDefinitionType = "PropertyDefinition" | "TSAbstractPropertyDefinition"; type MethodDefinitionKind = "constructor" | "method" | "get" | "set"; interface PrivateIdentifier extends Span { type: "PrivateIdentifier"; name: string; parent?: Node; } interface StaticBlock extends Span { type: "StaticBlock"; body: Array; parent?: Node; } type ModuleDeclaration = ImportDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | TSExportAssignment | TSNamespaceExportDeclaration; type AccessorPropertyType = "AccessorProperty" | "TSAbstractAccessorProperty"; interface AccessorProperty extends Span { type: AccessorPropertyType; decorators: Array; key: PropertyKey; typeAnnotation?: TSTypeAnnotation | null; value: Expression | null; computed: boolean; static: boolean; override?: boolean; definite?: boolean; accessibility?: TSAccessibility | null; declare?: false; optional?: false; readonly?: false; parent?: Node; } interface ImportExpression extends Span { type: "ImportExpression"; source: Expression; options: Expression | null; phase: ImportPhase | null; parent?: Node; } interface ImportDeclaration extends Span { type: "ImportDeclaration"; specifiers: Array; source: StringLiteral; phase: ImportPhase | null; attributes: Array; importKind?: ImportOrExportKind; parent?: Node; } type ImportPhase = "source" | "defer"; type ImportDeclarationSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier; interface ImportSpecifier extends Span { type: "ImportSpecifier"; imported: ModuleExportName; local: BindingIdentifier; importKind?: ImportOrExportKind; parent?: Node; } interface ImportDefaultSpecifier extends Span { type: "ImportDefaultSpecifier"; local: BindingIdentifier; parent?: Node; } interface ImportNamespaceSpecifier extends Span { type: "ImportNamespaceSpecifier"; local: BindingIdentifier; parent?: Node; } interface ImportAttribute extends Span { type: "ImportAttribute"; key: ImportAttributeKey; value: StringLiteral; parent?: Node; } type ImportAttributeKey = IdentifierName | StringLiteral; interface ExportNamedDeclaration extends Span { type: "ExportNamedDeclaration"; declaration: Declaration | null; specifiers: Array; source: StringLiteral | null; exportKind?: ImportOrExportKind; attributes: Array; parent?: Node; } interface ExportDefaultDeclaration extends Span { type: "ExportDefaultDeclaration"; declaration: ExportDefaultDeclarationKind; exportKind?: "value"; parent?: Node; } interface ExportAllDeclaration extends Span { type: "ExportAllDeclaration"; exported: ModuleExportName | null; source: StringLiteral; attributes: Array; exportKind?: ImportOrExportKind; parent?: Node; } interface ExportSpecifier extends Span { type: "ExportSpecifier"; local: ModuleExportName; exported: ModuleExportName; exportKind?: ImportOrExportKind; parent?: Node; } type ExportDefaultDeclarationKind = Function | Class | TSInterfaceDeclaration | Expression; type ModuleExportName = IdentifierName | IdentifierReference | StringLiteral; interface V8IntrinsicExpression extends Span { type: "V8IntrinsicExpression"; name: IdentifierName; arguments: Array; parent?: Node; } interface BooleanLiteral extends Span { type: "Literal"; value: boolean; raw: string | null; parent?: Node; } interface NullLiteral extends Span { type: "Literal"; value: null; raw: "null" | null; parent?: Node; } interface NumericLiteral extends Span { type: "Literal"; value: number; raw: string | null; parent?: Node; } interface StringLiteral extends Span { type: "Literal"; value: string; raw: string | null; parent?: Node; } interface BigIntLiteral extends Span { type: "Literal"; value: bigint; raw: string | null; bigint: string; parent?: Node; } interface RegExpLiteral extends Span { type: "Literal"; value: RegExp | null; raw: string | null; regex: { pattern: string; flags: string; }; parent?: Node; } interface JSXElement extends Span { type: "JSXElement"; openingElement: JSXOpeningElement; children: Array; closingElement: JSXClosingElement | null; parent?: Node; } interface JSXOpeningElement extends Span { type: "JSXOpeningElement"; name: JSXElementName; typeArguments?: TSTypeParameterInstantiation | null; attributes: Array; selfClosing: boolean; parent?: Node; } interface JSXClosingElement extends Span { type: "JSXClosingElement"; name: JSXElementName; parent?: Node; } interface JSXFragment extends Span { type: "JSXFragment"; openingFragment: JSXOpeningFragment; children: Array; closingFragment: JSXClosingFragment; parent?: Node; } interface JSXOpeningFragment extends Span { type: "JSXOpeningFragment"; attributes?: []; selfClosing?: false; parent?: Node; } interface JSXClosingFragment extends Span { type: "JSXClosingFragment"; parent?: Node; } type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression; interface JSXNamespacedName extends Span { type: "JSXNamespacedName"; namespace: JSXIdentifier; name: JSXIdentifier; parent?: Node; } interface JSXMemberExpression extends Span { type: "JSXMemberExpression"; object: JSXMemberExpressionObject; property: JSXIdentifier; parent?: Node; } type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression; interface JSXExpressionContainer extends Span { type: "JSXExpressionContainer"; expression: JSXExpression; parent?: Node; } type JSXExpression = JSXEmptyExpression | Expression; interface JSXEmptyExpression extends Span { type: "JSXEmptyExpression"; parent?: Node; } type JSXAttributeItem = JSXAttribute | JSXSpreadAttribute; interface JSXAttribute extends Span { type: "JSXAttribute"; name: JSXAttributeName; value: JSXAttributeValue | null; parent?: Node; } interface JSXSpreadAttribute extends Span { type: "JSXSpreadAttribute"; argument: Expression; parent?: Node; } type JSXAttributeName = JSXIdentifier | JSXNamespacedName; type JSXAttributeValue = StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment; interface JSXIdentifier extends Span { type: "JSXIdentifier"; name: string; parent?: Node; } type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild; interface JSXSpreadChild extends Span { type: "JSXSpreadChild"; expression: Expression; parent?: Node; } interface JSXText extends Span { type: "JSXText"; value: string; raw: string | null; parent?: Node; } interface TSThisParameter extends Span { type: "Identifier"; decorators: []; name: "this"; optional: false; typeAnnotation: TSTypeAnnotation | null; parent?: Node; } interface TSEnumDeclaration extends Span { type: "TSEnumDeclaration"; id: BindingIdentifier; body: TSEnumBody; const: boolean; declare: boolean; parent?: Node; } interface TSEnumBody extends Span { type: "TSEnumBody"; members: Array; parent?: Node; } interface TSEnumMember extends Span { type: "TSEnumMember"; id: TSEnumMemberName; initializer: Expression | null; computed: boolean; parent?: Node; } type TSEnumMemberName = IdentifierName | StringLiteral | TemplateLiteral; interface TSTypeAnnotation extends Span { type: "TSTypeAnnotation"; typeAnnotation: TSType; parent?: Node; } interface TSLiteralType extends Span { type: "TSLiteralType"; literal: TSLiteral; parent?: Node; } type TSLiteral = BooleanLiteral | NumericLiteral | BigIntLiteral | StringLiteral | TemplateLiteral | UnaryExpression; 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; interface TSConditionalType extends Span { type: "TSConditionalType"; checkType: TSType; extendsType: TSType; trueType: TSType; falseType: TSType; parent?: Node; } interface TSUnionType extends Span { type: "TSUnionType"; types: Array; parent?: Node; } interface TSIntersectionType extends Span { type: "TSIntersectionType"; types: Array; parent?: Node; } interface TSParenthesizedType extends Span { type: "TSParenthesizedType"; typeAnnotation: TSType; parent?: Node; } interface TSTypeOperator extends Span { type: "TSTypeOperator"; operator: TSTypeOperatorOperator; typeAnnotation: TSType; parent?: Node; } type TSTypeOperatorOperator = "keyof" | "unique" | "readonly"; interface TSArrayType extends Span { type: "TSArrayType"; elementType: TSType; parent?: Node; } interface TSIndexedAccessType extends Span { type: "TSIndexedAccessType"; objectType: TSType; indexType: TSType; parent?: Node; } interface TSTupleType extends Span { type: "TSTupleType"; elementTypes: Array; parent?: Node; } interface TSNamedTupleMember extends Span { type: "TSNamedTupleMember"; label: IdentifierName; elementType: TSTupleElement; optional: boolean; parent?: Node; } interface TSOptionalType extends Span { type: "TSOptionalType"; typeAnnotation: TSType; parent?: Node; } interface TSRestType extends Span { type: "TSRestType"; typeAnnotation: TSType; parent?: Node; } type TSTupleElement = TSOptionalType | TSRestType | TSType; interface TSAnyKeyword extends Span { type: "TSAnyKeyword"; parent?: Node; } interface TSStringKeyword extends Span { type: "TSStringKeyword"; parent?: Node; } interface TSBooleanKeyword extends Span { type: "TSBooleanKeyword"; parent?: Node; } interface TSNumberKeyword extends Span { type: "TSNumberKeyword"; parent?: Node; } interface TSNeverKeyword extends Span { type: "TSNeverKeyword"; parent?: Node; } interface TSIntrinsicKeyword extends Span { type: "TSIntrinsicKeyword"; parent?: Node; } interface TSUnknownKeyword extends Span { type: "TSUnknownKeyword"; parent?: Node; } interface TSNullKeyword extends Span { type: "TSNullKeyword"; parent?: Node; } interface TSUndefinedKeyword extends Span { type: "TSUndefinedKeyword"; parent?: Node; } interface TSVoidKeyword extends Span { type: "TSVoidKeyword"; parent?: Node; } interface TSSymbolKeyword extends Span { type: "TSSymbolKeyword"; parent?: Node; } interface TSThisType extends Span { type: "TSThisType"; parent?: Node; } interface TSObjectKeyword extends Span { type: "TSObjectKeyword"; parent?: Node; } interface TSBigIntKeyword extends Span { type: "TSBigIntKeyword"; parent?: Node; } interface TSTypeReference extends Span { type: "TSTypeReference"; typeName: TSTypeName; typeArguments: TSTypeParameterInstantiation | null; parent?: Node; } type TSTypeName = IdentifierReference | TSQualifiedName | ThisExpression; interface TSQualifiedName extends Span { type: "TSQualifiedName"; left: TSTypeName; right: IdentifierName; parent?: Node; } interface TSTypeParameterInstantiation extends Span { type: "TSTypeParameterInstantiation"; params: Array; parent?: Node; } interface TSTypeParameter extends Span { type: "TSTypeParameter"; name: BindingIdentifier; constraint: TSType | null; default: TSType | null; in: boolean; out: boolean; const: boolean; parent?: Node; } interface TSTypeParameterDeclaration extends Span { type: "TSTypeParameterDeclaration"; params: Array; parent?: Node; } interface TSTypeAliasDeclaration extends Span { type: "TSTypeAliasDeclaration"; id: BindingIdentifier; typeParameters: TSTypeParameterDeclaration | null; typeAnnotation: TSType; declare: boolean; parent?: Node; } type TSAccessibility = "private" | "protected" | "public"; interface TSClassImplements extends Span { type: "TSClassImplements"; expression: IdentifierReference | ThisExpression | MemberExpression; typeArguments: TSTypeParameterInstantiation | null; parent?: Node; } interface TSInterfaceDeclaration extends Span { type: "TSInterfaceDeclaration"; id: BindingIdentifier; typeParameters: TSTypeParameterDeclaration | null; extends: Array; body: TSInterfaceBody; declare: boolean; parent?: Node; } interface TSInterfaceBody extends Span { type: "TSInterfaceBody"; body: Array; parent?: Node; } interface TSPropertySignature extends Span { type: "TSPropertySignature"; computed: boolean; optional: boolean; readonly: boolean; key: PropertyKey; typeAnnotation: TSTypeAnnotation | null; accessibility: null; static: false; parent?: Node; } type TSSignature = TSIndexSignature | TSPropertySignature | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSMethodSignature; interface TSIndexSignature extends Span { type: "TSIndexSignature"; parameters: Array; typeAnnotation: TSTypeAnnotation; readonly: boolean; static: boolean; accessibility: null; parent?: Node; } interface TSCallSignatureDeclaration extends Span { type: "TSCallSignatureDeclaration"; typeParameters: TSTypeParameterDeclaration | null; params: ParamPattern[]; returnType: TSTypeAnnotation | null; parent?: Node; } type TSMethodSignatureKind = "method" | "get" | "set"; interface TSMethodSignature extends Span { type: "TSMethodSignature"; key: PropertyKey; computed: boolean; optional: boolean; kind: TSMethodSignatureKind; typeParameters: TSTypeParameterDeclaration | null; params: ParamPattern[]; returnType: TSTypeAnnotation | null; accessibility: null; readonly: false; static: false; parent?: Node; } interface TSConstructSignatureDeclaration extends Span { type: "TSConstructSignatureDeclaration"; typeParameters: TSTypeParameterDeclaration | null; params: ParamPattern[]; returnType: TSTypeAnnotation | null; parent?: Node; } interface TSIndexSignatureName extends Span { type: "Identifier"; decorators: []; name: string; optional: false; typeAnnotation: TSTypeAnnotation; parent?: Node; } interface TSInterfaceHeritage extends Span { type: "TSInterfaceHeritage"; expression: Expression; typeArguments: TSTypeParameterInstantiation | null; parent?: Node; } interface TSTypePredicate extends Span { type: "TSTypePredicate"; parameterName: TSTypePredicateName; asserts: boolean; typeAnnotation: TSTypeAnnotation | null; parent?: Node; } type TSTypePredicateName = IdentifierName | TSThisType; interface TSModuleDeclaration extends Span { type: "TSModuleDeclaration"; id: BindingIdentifier | StringLiteral | TSQualifiedName; body: TSModuleBlock | null; kind: TSModuleDeclarationKind; declare: boolean; global: false; parent?: Node; } type TSModuleDeclarationKind = "module" | "namespace"; interface TSGlobalDeclaration extends Span { type: "TSModuleDeclaration"; id: IdentifierName; body: TSModuleBlock; kind: "global"; declare: boolean; global: true; parent?: Node; } interface TSModuleBlock extends Span { type: "TSModuleBlock"; body: Array; parent?: Node; } interface TSTypeLiteral extends Span { type: "TSTypeLiteral"; members: Array; parent?: Node; } interface TSInferType extends Span { type: "TSInferType"; typeParameter: TSTypeParameter; parent?: Node; } interface TSTypeQuery extends Span { type: "TSTypeQuery"; exprName: TSTypeQueryExprName; typeArguments: TSTypeParameterInstantiation | null; parent?: Node; } type TSTypeQueryExprName = TSImportType | TSTypeName; interface TSImportType extends Span { type: "TSImportType"; source: StringLiteral; options: ObjectExpression | null; qualifier: TSImportTypeQualifier | null; typeArguments: TSTypeParameterInstantiation | null; parent?: Node; } type TSImportTypeQualifier = IdentifierName | TSImportTypeQualifiedName; interface TSImportTypeQualifiedName extends Span { type: "TSQualifiedName"; left: TSImportTypeQualifier; right: IdentifierName; parent?: Node; } interface TSFunctionType extends Span { type: "TSFunctionType"; typeParameters: TSTypeParameterDeclaration | null; params: ParamPattern[]; returnType: TSTypeAnnotation; parent?: Node; } interface TSConstructorType extends Span { type: "TSConstructorType"; abstract: boolean; typeParameters: TSTypeParameterDeclaration | null; params: ParamPattern[]; returnType: TSTypeAnnotation; parent?: Node; } interface TSMappedType extends Span { type: "TSMappedType"; key: TSTypeParameter["name"]; constraint: TSTypeParameter["constraint"]; nameType: TSType | null; typeAnnotation: TSType | null; optional: TSMappedTypeModifierOperator | false; readonly: TSMappedTypeModifierOperator | null; parent?: Node; } type TSMappedTypeModifierOperator = true | "+" | "-"; interface TSTemplateLiteralType extends Span { type: "TSTemplateLiteralType"; quasis: Array; types: Array; parent?: Node; } interface TSAsExpression extends Span { type: "TSAsExpression"; expression: Expression; typeAnnotation: TSType; parent?: Node; } interface TSSatisfiesExpression extends Span { type: "TSSatisfiesExpression"; expression: Expression; typeAnnotation: TSType; parent?: Node; } interface TSTypeAssertion extends Span { type: "TSTypeAssertion"; typeAnnotation: TSType; expression: Expression; parent?: Node; } interface TSImportEqualsDeclaration extends Span { type: "TSImportEqualsDeclaration"; id: BindingIdentifier; moduleReference: TSModuleReference; importKind: ImportOrExportKind; parent?: Node; } type TSModuleReference = TSExternalModuleReference | TSTypeName; interface TSExternalModuleReference extends Span { type: "TSExternalModuleReference"; expression: StringLiteral; parent?: Node; } interface TSNonNullExpression extends Span { type: "TSNonNullExpression"; expression: Expression; parent?: Node; } interface Decorator extends Span { type: "Decorator"; expression: Expression; parent?: Node; } interface TSExportAssignment extends Span { type: "TSExportAssignment"; expression: Expression; parent?: Node; } interface TSNamespaceExportDeclaration extends Span { type: "TSNamespaceExportDeclaration"; id: IdentifierName; parent?: Node; } interface TSInstantiationExpression extends Span { type: "TSInstantiationExpression"; expression: Expression; typeArguments: TSTypeParameterInstantiation; parent?: Node; } type ImportOrExportKind = "value" | "type"; interface JSDocNullableType extends Span { type: "TSJSDocNullableType"; typeAnnotation: TSType; postfix: boolean; parent?: Node; } interface JSDocNonNullableType extends Span { type: "TSJSDocNonNullableType"; typeAnnotation: TSType; postfix: boolean; parent?: Node; } interface JSDocUnknownType extends Span { type: "TSJSDocUnknownType"; parent?: Node; } type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??="; type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "**" | "<<" | ">>" | ">>>" | "|" | "^" | "&" | "in" | "instanceof"; type LogicalOperator = "||" | "&&" | "??"; type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete"; type UpdateOperator = "++" | "--"; interface Span { start: number; end: number; range?: [number, number]; } type ModuleKind = "script" | "module"; 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; //#endregion //#region ../../node_modules/rolldown/dist/shared/binding-CY7Z709f.d.mts interface CodegenOptions { /** * Remove whitespace. * * @default true */ removeWhitespace?: boolean; } interface CompressOptions { /** * Set desired EcmaScript standard version for output. * * Set `esnext` to enable all target highering. * * Example: * * * `'es2015'` * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']` * * @default 'esnext' * * @see [esbuild#target](https://esbuild.github.io/api/#target) */ target?: string | Array; /** * Pass true to discard calls to `console.*`. * * @default false */ dropConsole?: boolean; /** * Remove `debugger;` statements. * * @default true */ dropDebugger?: boolean; /** * Pass `true` to drop unreferenced functions and variables. * * Simple direct variable assignments do not count as references unless set to `keep_assign`. * @default true */ unused?: boolean | 'keep_assign'; /** Keep function / class names. */ keepNames?: CompressOptionsKeepNames; /** * Join consecutive var, let and const statements. * * @default true */ joinVars?: boolean; /** * Join consecutive simple statements using the comma operator. * * `a; b` -> `a, b` * * @default true */ sequences?: boolean; /** * Set of label names to drop from the code. * * Labeled statements matching these names will be removed during minification. * * @default [] */ dropLabels?: Array; /** Limit the maximum number of iterations for debugging purpose. */ maxIterations?: number; /** Treeshake options. */ treeshake?: TreeShakeOptions; } interface CompressOptionsKeepNames { /** * Keep function names so that `Function.prototype.name` is preserved. * * This does not guarantee that the `undefined` name is preserved. * * @default false */ function: boolean; /** * Keep class names so that `Class.prototype.name` is preserved. * * This does not guarantee that the `undefined` name is preserved. * * @default false */ class: boolean; } interface MangleOptions { /** * Pass `true` to mangle names declared in the top level scope. * * @default false */ toplevel?: boolean; /** * Preserve `name` property for functions and classes. * * @default false */ keepNames?: boolean | MangleOptionsKeepNames; /** Debug mangled names. */ debug?: boolean; } interface MangleOptionsKeepNames { /** * Preserve `name` property for functions. * * @default false */ function: boolean; /** * Preserve `name` property for classes. * * @default false */ class: boolean; } /** * Minify asynchronously. * * Note: This function can be slower than `minifySync` due to the overhead of spawning a thread. */ interface MinifyOptions { /** Use when minifying an ES module. */ module?: boolean; compress?: boolean | CompressOptions; mangle?: boolean | MangleOptions; codegen?: boolean | CodegenOptions; sourcemap?: boolean; } interface TreeShakeOptions { /** * Whether to respect the pure annotations. * * Pure annotations are comments that mark an expression as pure. * For example: @__PURE__ or #__NO_SIDE_EFFECTS__. * * @default true */ annotations?: boolean; /** * Whether to treat this function call as pure. * * This function is called for normal function calls, new calls, and * tagged template calls. */ manualPureFunctions?: Array; /** * Whether property read accesses have side effects. * * @default 'always' */ propertyReadSideEffects?: boolean | 'always'; /** * Whether accessing a global variable has side effects. * * Accessing a non-existing global variable will throw an error. * Global variable may be a getter that has side effects. * * @default true */ unknownGlobalSideEffects?: boolean; } interface ParserOptions { /** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'; /** Treat the source text as `script` or `module` code. */ sourceType?: 'script' | 'module' | 'unambiguous' | undefined; /** * Return an AST which includes TypeScript-related properties, or excludes them. * * `'js'` is default for JS / JSX files. * `'ts'` is default for TS / TSX files. * The type of the file is determined from `lang` option, or extension of provided `filename`. */ astType?: 'js' | 'ts'; /** * Controls whether the `range` property is included on AST nodes. * The `range` property is a `[number, number]` which indicates the start/end offsets * of the node in the file contents. * * @default false */ range?: boolean; /** * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. * * If this option is true, parenthesized expressions are represented by * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that * have a single `expression` property containing the expression inside parentheses. * * @default true */ preserveParens?: boolean; /** * Produce semantic errors with an additional AST pass. * Semantic errors depend on symbols and scopes, where the parser does not construct. * This adds a small performance overhead. * * @default false */ showSemanticErrors?: boolean; } interface CompilerAssumptions { ignoreFunctionLength?: boolean; noDocumentAll?: boolean; objectRestNoSymbols?: boolean; pureGetters?: boolean; /** * When using public class fields, assume that they don't shadow any getter in the current class, * in its subclasses or in its superclass. Thus, it's safe to assign them rather than using * `Object.defineProperty`. * * For example: * * Input: * ```js * class Test { * field = 2; * * static staticField = 3; * } * ``` * * When `set_public_class_fields` is `true`, the output will be: * ```js * class Test { * constructor() { * this.field = 2; * } * } * Test.staticField = 3; * ``` * * Otherwise, the output will be: * ```js * import _defineProperty from "@oxc-project/runtime/helpers/defineProperty"; * class Test { * constructor() { * _defineProperty(this, "field", 2); * } * } * _defineProperty(Test, "staticField", 3); * ``` * * NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should * set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`] * to `true`. */ setPublicClassFields?: boolean; } interface DecoratorOptions { /** * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process. * * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification. * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39. * * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators * @default false */ legacy?: boolean; /** * Enables emitting decorator metadata. * * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata) * in TypeScript, and it only works when `legacy` is true. * * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata * @default false */ emitDecoratorMetadata?: boolean; } type HelperMode = /** * Runtime mode (default): Helper functions are imported from a runtime package. * * Example: * * ```js * import helperName from "@oxc-project/runtime/helpers/helperName"; * helperName(...arguments); * ``` */ 'Runtime' | /** * External mode: Helper functions are accessed from a global `babelHelpers` object. * * Example: * * ```js * babelHelpers.helperName(...arguments); * ``` */ 'External'; interface Helpers { mode?: HelperMode; } /** * TypeScript Isolated Declarations for Standalone DTS Emit (async) * * Note: This function can be slower than `isolatedDeclarationSync` due to the overhead of spawning a thread. */ interface IsolatedDeclarationsOptions { /** * Do not emit declarations for code that has an @internal annotation in its JSDoc comment. * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid. * * Default: `false` * * See */ stripInternal?: boolean; sourcemap?: boolean; } /** * Configure how TSX and JSX are transformed. * * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options} */ interface JsxOptions { /** * Decides which runtime to use. * * - 'automatic' - auto-import the correct JSX factories * - 'classic' - no auto-import * * @default 'automatic' */ runtime?: 'classic' | 'automatic'; /** * Emit development-specific information, such as `__source` and `__self`. * * @default false * * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development} */ development?: boolean; /** * Toggles whether or not to throw an error if an XML namespaced tag name * is used. * * Though the JSX spec allows this, it is disabled by default since React's * JSX does not currently have support for it. * * @default true */ throwIfNamespace?: boolean; /** * Enables `@babel/plugin-transform-react-pure-annotations`. * * It will mark JSX elements and top-level React method calls as pure for tree shaking. * * @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations} * * @default true */ pure?: boolean; /** * Replaces the import source when importing functions. * * @default 'react' */ importSource?: string; /** * Replace the function used when compiling JSX expressions. It should be a * qualified name (e.g. `React.createElement`) or an identifier (e.g. * `createElement`). * * Only used for `classic` {@link runtime}. * * @default 'React.createElement' */ pragma?: string; /** * Replace the component used when compiling JSX fragments. It should be a * valid JSX tag name. * * Only used for `classic` {@link runtime}. * * @default 'React.Fragment' */ pragmaFrag?: string; /** * When spreading props, use `Object.assign` directly instead of an extend helper. * * Only used for `classic` {@link runtime}. * * @default false */ useBuiltIns?: boolean; /** * When spreading props, use inline object with spread elements directly * instead of an extend helper or Object.assign. * * Only used for `classic` {@link runtime}. * * @default false */ useSpread?: boolean; /** * Enable React Fast Refresh . * * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh} * * @default false */ refresh?: boolean | ReactRefreshOptions; } /** * Transform JavaScript code to a Vite Node runnable module. * * @param filename The name of the file being transformed. * @param sourceText the source code itself * @param options The options for the transformation. See {@link * ModuleRunnerTransformOptions} for more information. * * @returns an object containing the transformed code, source maps, and any * errors that occurred during parsing or transformation. * * Note: This function can be slower than `moduleRunnerTransformSync` due to the overhead of spawning a thread. * * @deprecated Only works for Vite. */ interface PluginsOptions { styledComponents?: StyledComponentsOptions; taggedTemplateEscape?: boolean; } interface ReactRefreshOptions { /** * Specify the identifier of the refresh registration variable. * * @default `$RefreshReg$`. */ refreshReg?: string; /** * Specify the identifier of the refresh signature variable. * * @default `$RefreshSig$`. */ refreshSig?: string; emitFullSignatures?: boolean; } /** * Configure how styled-components are transformed. * * @see {@link https://styled-components.com/docs/tooling#babel-plugin} */ interface StyledComponentsOptions { /** * Enhances the attached CSS class name on each component with richer output to help * identify your components in the DOM without React DevTools. * * @default true */ displayName?: boolean; /** * Controls whether the `displayName` of a component will be prefixed with the filename * to make the component name as unique as possible. * * @default true */ fileName?: boolean; /** * Adds a unique identifier to every styled component to avoid checksum mismatches * due to different class generation on the client and server during server-side rendering. * * @default true */ ssr?: boolean; /** * Transpiles styled-components tagged template literals to a smaller representation * than what Babel normally creates, helping to reduce bundle size. * * @default true */ transpileTemplateLiterals?: boolean; /** * Minifies CSS content by removing all whitespace and comments from your CSS, * keeping valuable bytes out of your bundles. * * @default true */ minify?: boolean; /** * Enables transformation of JSX `css` prop when using styled-components. * * **Note: This feature is not yet implemented in oxc.** * * @default true */ cssProp?: boolean; /** * Enables "pure annotation" to aid dead code elimination by bundlers. * * @default false */ pure?: boolean; /** * Adds a namespace prefix to component identifiers to ensure class names are unique. * * Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"` */ namespace?: string; /** * List of file names that are considered meaningless for component naming purposes. * * When the `fileName` option is enabled and a component is in a file with a name * from this list, the directory name will be used instead of the file name for * the component's display name. * * @default `["index"]` */ meaninglessFileNames?: Array; /** * Import paths to be considered as styled-components imports at the top level. * * **Note: This feature is not yet implemented in oxc.** */ topLevelImportPaths?: Array; } /** * Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously. * * Note: This function can be slower than `transform` due to the overhead of spawning a thread. * * @param filename The name of the file being transformed. If this is a * relative path, consider setting the {@link TransformOptions#cwd} option. * @param sourceText the source code itself * @param options The options for the transformation. See {@link * TransformOptions} for more information. * * @returns a promise that resolves to an object containing the transformed code, * source maps, and any errors that occurred during parsing or transformation. */ /** * Options for transforming a JavaScript or TypeScript file. * * @see {@link transform} */ interface TransformOptions { /** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'; /** Treat the source text as `script` or `module` code. */ sourceType?: 'script' | 'module' | 'unambiguous' | undefined; /** * The current working directory. Used to resolve relative paths in other * options. */ cwd?: string; /** * Enable source map generation. * * When `true`, the `sourceMap` field of transform result objects will be populated. * * @default false * * @see {@link SourceMap} */ sourcemap?: boolean; /** Set assumptions in order to produce smaller output. */ assumptions?: CompilerAssumptions; /** Configure how TypeScript is transformed. */ typescript?: TypeScriptOptions; /** Configure how TSX and JSX are transformed. */ jsx?: 'preserve' | JsxOptions; /** * Sets the target environment for the generated JavaScript. * * The lowest target is `es2015`. * * Example: * * * `'es2015'` * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']` * * @default `esnext` (No transformation) * * @see [esbuild#target](https://esbuild.github.io/api/#target) */ target?: string | Array; /** Behaviour for runtime helpers. */ helpers?: Helpers; /** Define Plugin */ define?: Record; /** Inject Plugin */ inject?: Record; /** Decorator plugin */ decorator?: DecoratorOptions; /** Third-party plugins to use. */ plugins?: PluginsOptions; } interface TypeScriptOptions { jsxPragma?: string; jsxPragmaFrag?: string; onlyRemoveTypeImports?: boolean; allowNamespaces?: boolean; /** * When enabled, type-only class fields are only removed if they are prefixed with the declare modifier: * * @deprecated * * Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields * without initializer, you can use `remove_class_fields_without_initializer: true` instead. */ allowDeclareFields?: boolean; /** * When enabled, class fields without initializers are removed. * * For example: * ```ts * class Foo { * x: number; * y: number = 0; * } * ``` * // transform into * ```js * class Foo { * x: number; * } * ``` * * The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option. * When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`] * to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is * equivalent to `useDefineForClassFields: false` in TypeScript. * * When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into: * * ```js * class Foo { * constructor() { * this.y = 0; * } * } * ``` * * Defaults to `false`. */ removeClassFieldsWithoutInitializer?: boolean; /** * Also generate a `.d.ts` declaration file for TypeScript files. * * The source file must be compliant with all * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations) * requirements. * * @default false */ declaration?: IsolatedDeclarationsOptions; /** * Rewrite or remove TypeScript import/export declaration extensions. * * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively. * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely. * - When set to `true`, it's equivalent to `rewrite`. * - When set to `false` or omitted, no changes will be made to the extensions. * * @default false */ rewriteImportExtensions?: 'rewrite' | 'remove' | boolean; } declare class BindingMagicString { constructor(source: string); replace(from: string, to: string): void; replaceAll(from: string, to: string): void; prepend(content: string): void; append(content: string): void; prependLeft(index: number, content: string): void; prependRight(index: number, content: string): void; appendLeft(index: number, content: string): void; appendRight(index: number, content: string): void; overwrite(start: number, end: number, content: string): void; toString(): string; hasChanged(): boolean; length(): number; isEmpty(): boolean; remove(start: number, end: number): void; update(start: number, end: number, content: string): void; relocate(start: number, end: number, to: number): void; indent(indentor?: string | undefined | null): void; } declare class BindingRenderedChunk { get name(): string; get isEntry(): boolean; get isDynamicEntry(): boolean; get facadeModuleId(): string | null; get moduleIds(): Array; get exports(): Array; get fileName(): string; get modules(): BindingModules; get imports(): Array; get dynamicImports(): Array; } declare class BindingRenderedModule { get code(): string | null; get renderedExports(): Array; } 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'; interface BindingHookResolveIdExtraArgs { custom?: number; isEntry: boolean; /** * - `import-statement`: `import { foo } from './lib.js';` * - `dynamic-import`: `import('./lib.js')` * - `require-call`: `require('./lib.js')` * - `import-rule`: `@import 'bg-color.css'` * - `url-token`: `url('./icon.png')` * - `new-url`: `new URL('./worker.js', import.meta.url)` * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})` */ kind: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept'; } interface BindingModules { values: Array; keys: Array; } interface BindingTransformHookExtraArgs { moduleType: string; } interface ExternalMemoryStatus { freed: boolean; reason?: string; } /** Error emitted from native side, it only contains kind and message, no stack trace. */ interface PreRenderedChunk { name: string; isEntry: boolean; isDynamicEntry: boolean; facadeModuleId?: string; moduleIds: Array; exports: Array; } //#endregion //#endregion //#region ../../node_modules/@rolldown/pluginutils/dist/composable-filters.d.ts type StringOrRegExp$1 = string | RegExp; type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {}); type FilterExpression = And | Or | Not | Id | ModuleType$1 | Code | Query; type TopLevelFilterExpression = Include | Exclude$1; declare class And { kind: 'and'; args: FilterExpression[]; constructor(...args: FilterExpression[]); } declare class Or { kind: 'or'; args: FilterExpression[]; constructor(...args: FilterExpression[]); } declare class Not { kind: 'not'; expr: FilterExpression; constructor(expr: FilterExpression); } interface IdParams { cleanUrl?: boolean; } declare class Id { kind: 'id'; pattern: StringOrRegExp$1; params: IdParams; constructor(pattern: StringOrRegExp$1, params?: IdParams); } declare class ModuleType$1 { kind: 'moduleType'; pattern: PluginModuleType; constructor(pattern: PluginModuleType); } declare class Code { kind: 'code'; pattern: StringOrRegExp$1; constructor(expr: StringOrRegExp$1); } declare class Query { kind: 'query'; key: string; pattern: StringOrRegExp$1 | boolean; constructor(key: string, pattern: StringOrRegExp$1 | boolean); } declare class Include { kind: 'include'; expr: FilterExpression; constructor(expr: FilterExpression); } declare class Exclude$1 { kind: 'exclude'; expr: FilterExpression; constructor(expr: FilterExpression); } //#endregion //#region ../../node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts //#region src/log/logging.d.ts type LogLevel = "info" | "debug" | "warn"; type LogLevelOption = LogLevel | "silent"; type LogLevelWithError = LogLevel | "error"; interface RollupLog { binding?: string; cause?: unknown; code?: string; exporter?: string; frame?: string; hook?: string; id?: string; ids?: string[]; loc?: { column: number; file?: string; line: number; }; message: string; meta?: any; names?: string[]; plugin?: string; pluginCode?: unknown; pos?: number; reexporter?: string; stack?: string; url?: string; } type RollupLogWithString = RollupLog | string; interface RollupError extends RollupLog { name?: string; stack?: string; watchFiles?: string[]; } type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void; //#endregion //#region src/types/misc.d.ts type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string; type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean; //#endregion //#region src/types/module-info.d.ts interface ModuleInfo extends ModuleOptions { /** * Unsupported at rolldown */ ast: any; code: string | null; id: string; importers: string[]; dynamicImporters: string[]; importedIds: string[]; dynamicallyImportedIds: string[]; exports: string[]; isEntry: boolean; } //#endregion //#region src/utils/asset-source.d.ts type AssetSource = string | Uint8Array; //#endregion //#region src/types/external-memory-handle.d.ts declare const symbolForExternalMemoryHandle: "__rolldown_external_memory_handle__"; /** * Interface for objects that hold external memory that can be explicitly freed. */ interface ExternalMemoryHandle { /** * Frees the external memory held by this object. * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory. * This will take time but prevents errors when accessing properties after freeing. * @returns Status object with `freed` boolean and optional `reason` string. * @internal */ [symbolForExternalMemoryHandle]: (keepDataAlive?: boolean) => ExternalMemoryStatus; } /** * Frees the external memory held by the given handle. * * This is useful when you want to manually release memory held by Rust objects * (like `OutputChunk` or `OutputAsset`) before they are garbage collected. * * @param handle - The object with external memory to free * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false). * This will take time to copy data from Rust to JavaScript, but prevents errors * when accessing properties after the memory is freed. * @returns Status object with `freed` boolean and optional `reason` string. * - `{ freed: true }` if memory was successfully freed * - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist) * * @example * ```typescript * import { freeExternalMemory } from 'rolldown/experimental'; * * const output = await bundle.generate(); * const chunk = output.output[0]; * * // Use the chunk... * * // Manually free the memory (fast, but accessing properties after will throw) * const status = freeExternalMemory(chunk); // { freed: true } * const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" } * * // Keep data alive before freeing (slower, but data remains accessible) * freeExternalMemory(chunk, true); // Evaluates all lazy fields first * console.log(chunk.code); // OK - data was copied to JavaScript before freeing * * // Without keepDataAlive, accessing chunk properties after freeing will throw an error * ``` */ //#endregion //#region src/types/rolldown-output.d.ts interface OutputAsset extends ExternalMemoryHandle { type: "asset"; fileName: string; /** @deprecated Use "originalFileNames" instead. */ originalFileName: string | null; originalFileNames: string[]; source: AssetSource; /** @deprecated Use "names" instead. */ name: string | undefined; names: string[]; } interface SourceMap { file: string; mappings: string; names: string[]; sources: string[]; sourcesContent: string[]; version: number; debugId?: string; x_google_ignoreList?: number[]; toString(): string; toUrl(): string; } interface RenderedModule { readonly code: string | null; renderedLength: number; renderedExports: string[]; } interface RenderedChunk extends Omit { type: "chunk"; modules: { [id: string]: RenderedModule; }; name: string; isEntry: boolean; isDynamicEntry: boolean; facadeModuleId: string | null; moduleIds: Array; exports: Array; fileName: string; imports: Array; dynamicImports: Array; } interface OutputChunk extends ExternalMemoryHandle { type: "chunk"; code: string; name: string; isEntry: boolean; exports: string[]; fileName: string; modules: { [id: string]: RenderedModule; }; imports: string[]; dynamicImports: string[]; facadeModuleId: string | null; isDynamicEntry: boolean; moduleIds: string[]; map: SourceMap | null; sourcemapFileName: string | null; preliminaryFileName: string; } interface RolldownOutput extends ExternalMemoryHandle { output: [OutputChunk, ...(OutputChunk | OutputAsset)[]]; } //#endregion //#region src/types/utils.d.ts type MaybePromise = T | Promise; type NullValue = T | undefined | null | void; type PartialNull = { [P in keyof T]: T[P] | null }; type MakeAsync = Function_ extends ((this: infer This, ...parameters: infer Arguments) => infer Return) ? (this: This, ...parameters: Arguments) => Return | Promise : never; type MaybeArray = T | T[]; type StringOrRegExp = string | RegExp; //#endregion //#region src/options/output-options.d.ts type GeneratedCodePreset = "es5" | "es2015"; interface GeneratedCodeOptions { /** * Whether to use Symbol.toStringTag for namespace objects. * @default false */ symbols?: boolean; /** * Allows choosing one of the presets listed above while overriding some options. * * ```js * export default { * output: { * generatedCode: { * preset: 'es2015', * symbols: false * } * } * }; * ``` */ preset?: GeneratedCodePreset; /** * Whether to add readable names to internal variables for profiling purposes. * * When enabled, generated code will use descriptive variable names that correspond * to the original module names, making it easier to profile and debug the bundled code. * * Note: Enabling this option makes the output more difficult to minify effectively. * * @default false */ profilerNames?: boolean; } type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd"; type AddonFunction = (chunk: RenderedChunk) => string | Promise; type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string; type SanitizeFileNameFunction = (name: string) => string; interface PreRenderedAsset { type: "asset"; name?: string; names: string[]; originalFileName?: string; originalFileNames: string[]; source: string | Uint8Array; } type AssetFileNamesFunction = (chunkInfo: PreRenderedAsset) => string; type PathsFunction$1 = (id: string) => string; type ManualChunksFunction = (moduleId: string, meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null; }) => string | NullValue; type GlobalsFunction = (name: string) => string; type AdvancedChunksNameFunction = (moduleId: string, ctx: ChunkingContext) => string | NullValue; type AdvancedChunksTestFunction = (id: string) => boolean | undefined | void; type MinifyOptions$1 = Omit; interface ChunkingContext { getModuleInfo(moduleId: string): ModuleInfo | null; } interface OutputOptions { dir?: string; file?: string; exports?: "auto" | "named" | "default" | "none"; hashCharacters?: "base64" | "base36" | "hex"; /** * Expected format of generated code. * - `'es'`, `'esm'` and `'module'` are the same format, all stand for ES module. * - `'cjs'` and `'commonjs'` are the same format, all stand for CommonJS module. * - `'iife'` stands for [Immediately Invoked Function Expression](https://developer.mozilla.org/en-US/docs/Glossary/IIFE). * - `'umd'` stands for [Universal Module Definition](https://github.com/umdjs/umd). * * @default 'esm' */ format?: ModuleFormat; sourcemap?: boolean | "inline" | "hidden"; sourcemapBaseUrl?: string; sourcemapDebugIds?: boolean; /** * Control which source files are included in the sourcemap ignore list. * Files in the ignore list are excluded from debugger stepping and error stack traces. * * - `false`: Include all source files in the ignore list * - `true`: Include no source files in the ignore list * - `string`: Files containing this string in their path will be included in the ignore list * - `RegExp`: Files matching this regular expression will be included in the ignore list * - `function`: Custom function `(source: string, sourcemapPath: string) => boolean` to determine if a source should be ignored * * :::tip Performance * Using static values (`boolean`, `string`, or `RegExp`) is significantly more performant than functions. * Calling JavaScript functions from Rust has extremely high overhead, so prefer static patterns when possible. * ::: * * ## Examples * ```js * // ✅ Preferred: Use RegExp for better performance * sourcemapIgnoreList: /node_modules/ * * // ✅ Preferred: Use string pattern for better performance * sourcemapIgnoreList: "vendor" * * // ! Use sparingly: Function calls have high overhead * sourcemapIgnoreList: (source, sourcemapPath) => { * return source.includes('node_modules') || source.includes('.min.'); * } * ``` * * **default**: /node_modules/ */ sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | StringOrRegExp; sourcemapPathTransform?: SourcemapPathTransformOption; banner?: string | AddonFunction; footer?: string | AddonFunction; intro?: string | AddonFunction; outro?: string | AddonFunction; extend?: boolean; esModule?: boolean | "if-default-prop"; assetFileNames?: string | AssetFileNamesFunction; entryFileNames?: string | ChunkFileNamesFunction; chunkFileNames?: string | ChunkFileNamesFunction; cssEntryFileNames?: string | ChunkFileNamesFunction; cssChunkFileNames?: string | ChunkFileNamesFunction; sanitizeFileName?: boolean | SanitizeFileNameFunction; /** * Control code minification. * * - `true`: Enable full minification including code compression and dead code elimination * - `false`: Disable minification (default) * - `'dce-only'`: Only perform dead code elimination without code compression * - `MinifyOptions`: Fine-grained control over minification settings * * @default false */ minify?: boolean | "dce-only" | MinifyOptions$1; name?: string; globals?: Record | GlobalsFunction; /** * Maps external module IDs to paths. * * Allows customizing the path used when importing external dependencies. * This is particularly useful for loading dependencies from CDNs or custom locations. * * - Object form: Maps module IDs to their replacement paths * - Function form: Takes a module ID and returns its replacement path * * @example * ```js * { * paths: { * 'd3': 'https://cdn.jsdelivr.net/npm/d3@7' * } * } * ``` * * @example * ```js * { * paths: (id) => { * if (id.startsWith('lodash')) { * return `https://cdn.jsdelivr.net/npm/${id}` * } * return id * } * } * ``` */ paths?: Record | PathsFunction$1; generatedCode?: Partial; externalLiveBindings?: boolean; inlineDynamicImports?: boolean; /** * - Type: `((moduleId: string, meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue)` * - Object form is not supported. * * :::warning * - This option is deprecated. Please use `advancedChunks` instead. * - If `manualChunks` and `advancedChunks` are both specified, `manualChunks` option will be ignored. * ::: * * You could use this option for migration purpose. Under the hood, * * ```js * { * manualChunks: (moduleId, meta) => { * if (moduleId.includes('node_modules')) { * return 'vendor'; * } * return null; * } * } * ``` * * will be transformed to * * ```js * { * advancedChunks: { * groups: [ * { * name(moduleId) { * if (moduleId.includes('node_modules')) { * return 'vendor'; * } * return null; * }, * }, * ], * } * } * * ``` * * @deprecated Please use `advancedChunks` instead. */ manualChunks?: ManualChunksFunction; /** * Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/in-depth/advanced-chunks). */ advancedChunks?: { /** * - Type: `boolean` * - Default: `true` * * By default, each group will also include captured modules' dependencies. This reduces the chance of generating circular chunks. * * If you want to disable this behavior, it's recommended to both set * - `preserveEntrySignatures: false | 'allow-extension'` * - `strictExecutionOrder: true` * * to avoid generating invalid chunks. */ includeDependenciesRecursively?: boolean; /** * - Type: `number` * * Global fallback of [`{group}.minSize`](#advancedchunks-groups-minsize), if it's not specified in the group. */ minSize?: number; /** * - Type: `number` * * Global fallback of [`{group}.maxSize`](#advancedchunks-groups-maxsize), if it's not specified in the group. */ maxSize?: number; /** * - Type: `number` * * Global fallback of [`{group}.maxModuleSize`](#advancedchunks-groups-maxmodulesize), if it's not specified in the group. */ maxModuleSize?: number; /** * - Type: `number` * * Global fallback of [`{group}.minModuleSize`](#advancedchunks-groups-minmodulesize), if it's not specified in the group. */ minModuleSize?: number; /** * - Type: `number` * * Global fallback of [`{group}.minShareCount`](#advancedchunks-groups-minsharecount), if it's not specified in the group. */ minShareCount?: number; /** * Groups to be used for advanced chunking. */ groups?: { /** * - Type: `string | ((moduleId: string, ctx: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue)` * * Name of the group. It will be also used as the name of the chunk and replaced the `[name]` placeholder in the `chunkFileNames` option. * * For example, * * ```js * import { defineConfig } from 'rolldown'; * * export default defineConfig({ * advancedChunks: { * groups: [ * { * name: 'libs', * test: /node_modules/, * }, * ], * }, * }); * ``` * will create a chunk named `libs-[hash].js` in the end. * * It's ok to have the same name for different groups. Rolldown will deduplicate the chunk names if necessary. * * # Dynamic `name()` * * 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. * * Notice, each returned new name will be treated as a separate group. * * For example, * * ```js * import { defineConfig } from 'rolldown'; * * export default defineConfig({ * advancedChunks: { * groups: [ * { * name: (moduleId) => moduleId.includes('node_modules') ? 'libs' : 'app', * minSize: 100 * 1024, * }, * ], * }, * }); * ``` * * :::warning * Constraints like `minSize`, `maxSize`, etc. are applied separately for different names returned by the function. * ::: */ name: string | AdvancedChunksNameFunction; /** * - Type: `string | RegExp | ((id: string) => boolean | undefined | void);` * * Controls which modules are captured in this group. * * - If `test` is a string, the module whose id contains the string will be captured. * - If `test` is a regular expression, the module whose id matches the regular expression will be captured. * - If `test` is a function, modules for which `test(id)` returns `true` will be captured. * - If `test` is empty, any module will be considered as matched. * * :::warning * When using regular expression, it's recommended to use `[\\/]` to match the path separator instead of `/` to avoid potential issues on Windows. * - ✅ Recommended: `/node_modules[\\/]react/` * - ❌ Not recommended: `/node_modules/react/` * ::: */ test?: StringOrRegExp | AdvancedChunksTestFunction; /** * - Type: `number` * - Default: `0` * * 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. * * If two groups have the same priority, the group whose index is smaller will be chosen. * * For example, * * ```js * import { defineConfig } from 'rolldown'; * * export default defineConfig({ * advancedChunks: { * groups: [ * { * name: 'react', * test: /node_modules[\\/]react/, * priority: 1, * }, * { * name: 'other-libs', * test: /node_modules/, * priority: 2, * }, * ], * }); * ``` * * 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. */ priority?: number; /** * - Type: `number` * - Default: `0` * * 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. */ minSize?: number; /** * - Type: `number` * - Default: `1` * * Controls if a module should be captured based on how many entry chunks reference it. */ minShareCount?: number; /** * - Type: `number` * - Default: `Infinity` * * 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. */ maxSize?: number; /** * - Type: `number` * - Default: `Infinity` * * Controls a module could only be captured if its size in bytes is smaller or equal than this value. */ maxModuleSize?: number; /** * - Type: `number` * - Default: `0` * * Controls a module could only be captured if its size in bytes is larger or equal than this value. */ minModuleSize?: number; }[]; }; /** * Control comments in the output. * * - `none`: no comments * - `inline`: preserve comments that contain `@license`, `@preserve` or starts with `//!` `/*!` */ legalComments?: "none" | "inline"; plugins?: RolldownOutputPluginOption; polyfillRequire?: boolean; hoistTransitiveImports?: false; preserveModules?: boolean; virtualDirname?: string; preserveModulesRoot?: string; topLevelVar?: boolean; /** * - Type: `boolean` * - Default: `true` for format `es` or if `output.minify` is `true` or object, `false` otherwise * * Whether to minify internal exports. */ minifyInternalExports?: boolean; /** * - Type: `boolean` * - Default: `false` * * Clean output directory before emitting output. */ cleanDir?: boolean; /** Keep function and class names after bundling. * * When enabled, the bundler will preserve the original names of functions and classes * in the output, which is useful for debugging and error stack traces. * * @default false */ keepNames?: boolean; } //#endregion //#region src/api/build.d.ts //#endregion //#region src/log/log-handler.d.ts type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void; type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | { column: number; line: number; }) => void; //#endregion //#region src/options/normalized-input-options.d.ts interface NormalizedInputOptions { input: string[] | Record; cwd: string | undefined; platform: InputOptions["platform"]; shimMissingExports: boolean; context: string; } //#endregion //#region src/options/normalized-output-options.d.ts type PathsFunction = (id: string) => string; type InternalModuleFormat = "es" | "cjs" | "iife" | "umd"; interface NormalizedOutputOptions { name: string | undefined; file: string | undefined; dir: string | undefined; entryFileNames: string | ChunkFileNamesFunction; chunkFileNames: string | ChunkFileNamesFunction; assetFileNames: string | AssetFileNamesFunction; format: InternalModuleFormat; exports: NonNullable; sourcemap: boolean | "inline" | "hidden"; sourcemapBaseUrl: string | undefined; cssEntryFileNames: string | ChunkFileNamesFunction; cssChunkFileNames: string | ChunkFileNamesFunction; inlineDynamicImports: boolean; externalLiveBindings: boolean; banner: AddonFunction; footer: AddonFunction; intro: AddonFunction; outro: AddonFunction; esModule: boolean | "if-default-prop"; extend: boolean; globals: Record | GlobalsFunction; paths: Record | PathsFunction | undefined; hashCharacters: "base64" | "base36" | "hex"; sourcemapDebugIds: boolean; sourcemapIgnoreList: boolean | SourcemapIgnoreListOption | StringOrRegExp | undefined; sourcemapPathTransform: SourcemapPathTransformOption | undefined; minify: false | MinifyOptions$1 | "dce-only"; legalComments: "none" | "inline"; polyfillRequire: boolean; plugins: RolldownPlugin[]; preserveModules: boolean; virtualDirname: string; preserveModulesRoot?: string; topLevelVar?: boolean; minifyInternalExports?: boolean; } //#endregion //#region src/plugin/fs.d.ts interface RolldownFsModule { appendFile(path: string, data: string | Uint8Array, options?: { encoding?: BufferEncoding | null; mode?: string | number; flag?: string | number; }): Promise; copyFile(source: string, destination: string, mode?: string | number): Promise; mkdir(path: string, options?: { recursive?: boolean; mode?: string | number; }): Promise; mkdtemp(prefix: string): Promise; readdir(path: string, options?: { withFileTypes?: false; }): Promise; readdir(path: string, options?: { withFileTypes: true; }): Promise; readFile(path: string, options?: { encoding?: null; flag?: string | number; signal?: AbortSignal; }): Promise; readFile(path: string, options?: { encoding: BufferEncoding; flag?: string | number; signal?: AbortSignal; }): Promise; realpath(path: string): Promise; rename(oldPath: string, newPath: string): Promise; rmdir(path: string, options?: { recursive?: boolean; }): Promise; stat(path: string): Promise; lstat(path: string): Promise; unlink(path: string): Promise; writeFile(path: string, data: string | Uint8Array, options?: { encoding?: BufferEncoding | null; mode?: string | number; flag?: string | number; }): Promise; } type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "base64url" | "latin1" | "binary" | "hex"; interface RolldownDirectoryEntry { isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; name: string; } interface RolldownFileStats { isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; size: number; mtime: Date; ctime: Date; atime: Date; birthtime: Date; } //#endregion //#region src/plugin/hook-filter.d.ts type GeneralHookFilter = MaybeArray | { include?: MaybeArray; exclude?: MaybeArray; }; interface FormalModuleTypeFilter { include?: ModuleType[]; } type ModuleTypeFilter = ModuleType[] | FormalModuleTypeFilter; interface HookFilter { /** * This filter is used to do a pre-test to determine whether the hook should be called. * * @example * Include all `id`s that contain `node_modules` in the path. * ```js * { id: '**'+'/node_modules/**' } * ``` * @example * Include all `id`s that contain `node_modules` or `src` in the path. * ```js * { id: ['**'+'/node_modules/**', '**'+'/src/**'] } * ``` * @example * Include all `id`s that start with `http` * ```js * { id: /^http/ } * ``` * @example * Exclude all `id`s that contain `node_modules` in the path. * ```js * { id: { exclude: '**'+'/node_modules/**' } } * ``` * @example * Formal pattern to define includes and excludes. * ``` * { id : { * include: ['**'+'/foo/**', /bar/], * exclude: ['**'+'/baz/**', /qux/] * }} * ``` */ id?: GeneralHookFilter; moduleType?: ModuleTypeFilter; code?: GeneralHookFilter; } type TUnionWithTopLevelFilterExpressionArray = T | TopLevelFilterExpression[]; //#endregion //#region src/plugin/minimal-plugin-context.d.ts interface PluginContextMeta { rollupVersion: string; rolldownVersion: string; watchMode: boolean; } interface MinimalPluginContext { readonly pluginName: string; error: (e: RollupError | string) => never; info: LoggingFunction; warn: LoggingFunction; debug: LoggingFunction; meta: PluginContextMeta; } //#endregion //#region src/plugin/parallel-plugin.d.ts type ParallelPlugin = { /** @internal */ _parallel: { fileUrl: string; options: unknown; }; }; //#endregion //#region src/plugin/plugin-context.d.ts interface EmittedAsset { type: "asset"; name?: string; fileName?: string; originalFileName?: string; source: AssetSource; } interface EmittedChunk { type: "chunk"; name?: string; fileName?: string; preserveSignature?: "strict" | "allow-extension" | "exports-only" | false; id: string; importer?: string; } type EmittedFile = EmittedAsset | EmittedChunk; interface PluginContextResolveOptions { isEntry?: boolean; skipSelf?: boolean; custom?: CustomPluginOptions; } type GetModuleInfo = (moduleId: string) => ModuleInfo | null; interface PluginContext extends MinimalPluginContext { fs: RolldownFsModule; emitFile(file: EmittedFile): string; getFileName(referenceId: string): string; getModuleIds(): IterableIterator; getModuleInfo: GetModuleInfo; addWatchFile(id: string): void; load(options: { id: string; resolveDependencies?: boolean; } & Partial>): Promise; parse(input: string, options?: ParserOptions | null): Program; resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise; } //#endregion //#region src/plugin/transform-plugin-context.d.ts interface TransformPluginContext extends PluginContext { debug: LoggingFunctionWithPosition; info: LoggingFunctionWithPosition; warn: LoggingFunctionWithPosition; error(e: RollupError | string, pos?: number | { column: number; line: number; }): never; getCombinedSourcemap(): SourceMap; } //#endregion //#region src/types/module-side-effects.d.ts interface ModuleSideEffectsRule { test?: RegExp; external?: boolean; sideEffects: boolean; } type ModuleSideEffectsOption = boolean | readonly string[] | ModuleSideEffectsRule[] | ((id: string, external: boolean) => boolean | undefined) | "no-external"; type TreeshakingOptions = { moduleSideEffects?: ModuleSideEffectsOption; annotations?: boolean; manualPureFunctions?: readonly string[]; unknownGlobalSideEffects?: boolean; commonjs?: boolean; propertyReadSideEffects?: false | "always"; propertyWriteSideEffects?: false | "always"; }; //#endregion //#region src/types/output-bundle.d.ts interface OutputBundle { [fileName: string]: OutputAsset | OutputChunk; } //#endregion //#region src/types/rolldown-options-function.d.ts //#endregion //#region src/types/sourcemap.d.ts interface ExistingRawSourceMap { file?: string | null; mappings: string; names?: string[]; sources?: (string | null)[]; sourcesContent?: (string | null)[]; sourceRoot?: string; version?: number; x_google_ignoreList?: number[]; } type SourceMapInput = ExistingRawSourceMap | string | null; //#endregion //#region src/version.d.ts //#endregion //#region src/builtin-plugin/utils.d.ts declare class BuiltinPlugin { name: BindingBuiltinPluginName; _options?: unknown; constructor(name: BindingBuiltinPluginName, _options?: unknown); } //#endregion //#region src/constants/plugin.d.ts declare const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES: readonly ["options", "buildStart", "resolveId", "load", "transform", "moduleParsed", "buildEnd", "onLog", "resolveDynamicImport", "closeBundle", "closeWatcher", "watchChange"]; declare const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES: readonly ["augmentChunkHash", "outputOptions", "renderChunk", "renderStart", "renderError", "writeBundle", "generateBundle"]; declare const ENUMERATED_PLUGIN_HOOK_NAMES: [...typeof ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...typeof ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, "footer", "banner", "intro", "outro"]; /** * Names of all defined hooks. It's like * ```ts * type DefinedHookNames = { * options: 'options', * buildStart: 'buildStart', * ... * } * ``` */ type DefinedHookNames = { readonly [K in typeof ENUMERATED_PLUGIN_HOOK_NAMES[number]]: K }; /** * Names of all defined hooks. It's like * ```js * const DEFINED_HOOK_NAMES ={ * options: 'options', * buildStart: 'buildStart', * ... * } * ``` */ declare const DEFINED_HOOK_NAMES: DefinedHookNames; //#endregion //#region src/plugin/with-filter.d.ts //#endregion //#region src/plugin/index.d.ts type ModuleSideEffects = boolean | "no-treeshake" | null; type ModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {}); interface CustomPluginOptions { [plugin: string]: any; } interface ModuleOptions { moduleSideEffects: ModuleSideEffects; meta: CustomPluginOptions; invalidate?: boolean; packageJsonPath?: string; } interface ResolvedId extends ModuleOptions { external: boolean | "absolute"; id: string; } interface PartialResolvedId extends Partial> { external?: boolean | "absolute" | "relative"; id: string; } interface SourceDescription extends Partial> { code: string; map?: SourceMapInput; moduleType?: ModuleType; } interface ResolveIdExtraOptions { custom?: CustomPluginOptions; isEntry: boolean; kind: BindingHookResolveIdExtraArgs["kind"]; } type ResolveIdResult = string | NullValue | false | PartialResolvedId; type LoadResult = NullValue | string | SourceDescription; type TransformResult = NullValue | string | (Omit & { code?: string | BindingMagicString; }); type RenderedChunkMeta = { chunks: Record; }; interface FunctionPluginHooks { [DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean; [DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions; [DEFINED_HOOK_NAMES.outputOptions]: (this: MinimalPluginContext, options: OutputOptions) => NullValue | OutputOptions; [DEFINED_HOOK_NAMES.buildStart]: (this: PluginContext, options: NormalizedInputOptions) => void; [DEFINED_HOOK_NAMES.resolveId]: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult; /** * @deprecated * This hook is only for rollup plugin compatibility. Please use `resolveId` instead. */ [DEFINED_HOOK_NAMES.resolveDynamicImport]: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult; [DEFINED_HOOK_NAMES.load]: (this: PluginContext, id: string) => MaybePromise; [DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & { moduleType: ModuleType; magicString?: BindingMagicString; ast?: Program; }) => TransformResult; [DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void; [DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void; [DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void; [DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions, meta: RenderedChunkMeta) => NullValue | string | { code: string; map?: SourceMapInput; }; [DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk: RenderedChunk) => string | void; [DEFINED_HOOK_NAMES.renderError]: (this: PluginContext, error: Error) => void; [DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void; [DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void; [DEFINED_HOOK_NAMES.closeBundle]: (this: PluginContext) => void; [DEFINED_HOOK_NAMES.watchChange]: (this: PluginContext, id: string, event: { event: ChangeEvent; }) => void; [DEFINED_HOOK_NAMES.closeWatcher]: (this: PluginContext) => void; } type ChangeEvent = "create" | "update" | "delete"; type PluginOrder = "pre" | "post" | null; type ObjectHookMeta = { order?: PluginOrder; }; type ObjectHook = T | ({ handler: T; } & ObjectHookMeta & O); type SyncPluginHooks = DefinedHookNames["augmentChunkHash" | "onLog" | "outputOptions"]; type AsyncPluginHooks = Exclude; type FirstPluginHooks = DefinedHookNames["load" | "resolveDynamicImport" | "resolveId"]; type SequentialPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "onLog" | "options" | "outputOptions" | "renderChunk" | "transform"]; type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"]; type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"]; type ParallelPluginHooks = Exclude; type HookFilterExtension = K$1 extends "transform" ? { filter?: TUnionWithTopLevelFilterExpressionArray; } : K$1 extends "load" ? { filter?: TUnionWithTopLevelFilterExpressionArray>; } : K$1 extends "resolveId" ? { filter?: TUnionWithTopLevelFilterExpressionArray<{ id?: GeneralHookFilter; }>; } : K$1 extends "renderChunk" ? { filter?: TUnionWithTopLevelFilterExpressionArray>; } : {}; type PluginHooks = { [K in keyof FunctionPluginHooks]: ObjectHook : FunctionPluginHooks[K], HookFilterExtension & (K extends ParallelPluginHooks ? { /** * @deprecated * this is only for rollup Plugin type compatibility. * hooks always work as `sequential: true`. */ sequential?: boolean; } : {})> }; type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise; type AddonHook = string | AddonHookFunction; interface OutputPlugin extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook }> { name: string; } interface Plugin extends OutputPlugin, Partial { api?: A; } type RolldownPlugin = Plugin | BuiltinPlugin | ParallelPlugin; type RolldownPluginOption = MaybePromise> | { name: string; } | false | RolldownPluginOption[]>; type RolldownOutputPlugin = OutputPlugin | BuiltinPlugin; type RolldownOutputPluginOption = MaybePromise | { name: string; } | false | RolldownOutputPluginOption[]>; //#endregion //#region src/options/generated/checks-options.d.ts interface ChecksOptions { /** * Whether to emit warning when detecting circular dependency * @default false */ circularDependency?: boolean; /** * Whether to emit warning when detecting eval * @default true */ eval?: boolean; /** * Whether to emit warning when detecting missing global name * @default true */ missingGlobalName?: boolean; /** * Whether to emit warning when detecting missing name option for iife export * @default true */ missingNameOptionForIifeExport?: boolean; /** * Whether to emit warning when detecting mixed export * @default true */ mixedExport?: boolean; /** * Whether to emit warning when detecting unresolved entry * @default true */ unresolvedEntry?: boolean; /** * Whether to emit warning when detecting unresolved import * @default true */ unresolvedImport?: boolean; /** * Whether to emit warning when detecting filename conflict * @default true */ filenameConflict?: boolean; /** * Whether to emit warning when detecting common js variable in esm * @default true */ commonJsVariableInEsm?: boolean; /** * Whether to emit warning when detecting import is undefined * @default true */ importIsUndefined?: boolean; /** * Whether to emit warning when detecting empty import meta * @default true */ emptyImportMeta?: boolean; /** * Whether to emit warning when detecting configuration field conflict * @default true */ configurationFieldConflict?: boolean; /** * Whether to emit warning when detecting prefer builtin feature * @default true */ preferBuiltinFeature?: boolean; /** * Whether to emit warning when detecting could not clean directory * @default true */ couldNotCleanDirectory?: boolean; } //#endregion //#region src/options/transform-options.d.ts interface TransformOptions$1 extends Omit { /** * Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values. * * # Examples * * - Replace the global variable `IS_PROD` with `true` * * ```js rolldown.config.js * export default defineConfig({ transform: { define: { IS_PROD: 'true' } } }) * ``` * * Result: * * ```js * // Input * if (IS_PROD) { * console.log('Production mode') * } * * // After bundling * if (true) { * console.log('Production mode') * } * ``` * * - Replace the property accessor `process.env.NODE_ENV` with `'production'` * * ```js rolldown.config.js * export default defineConfig({ transform: { define: { 'process.env.NODE_ENV': "'production'" } } }) * ``` * * Result: * * ```js * // Input * if (process.env.NODE_ENV === 'production') { * console.log('Production mode') * } * * // After bundling * if ('production' === 'production') { * console.log('Production mode') * } * * ``` */ define?: Record; /** * Inject import statements on demand. * * The API is aligned with `@rollup/plugin-inject`. * * ## Supported patterns * ```js * { * // import { Promise } from 'es6-promise' * Promise: ['es6-promise', 'Promise'], * * // import { Promise as P } from 'es6-promise' * P: ['es6-promise', 'Promise'], * * // import $ from 'jquery' * $: 'jquery', * * // import * as fs from 'node:fs' * fs: ['node:fs', '*'], * * // Inject shims for property access pattern * 'Object.assign': path.resolve( 'src/helpers/object-assign.js' ), * } * ``` */ inject?: Record; /** * Remove labeled statements with these label names. * * Labeled statements are JavaScript statements prefixed with a label identifier. * This option allows you to strip specific labeled statements from the output, * which is useful for removing debug-only code in production builds. * * ## Example * * ```js rolldown.config.js * export default defineConfig({ transform: { dropLabels: ['DEBUG', 'DEV'] } }) * ``` * * Result: * * ```js * // Input * DEBUG: console.log('Debug info'); * DEV: { * console.log('Development mode'); * } * console.log('Production code'); * * // After bundling * console.log('Production code'); * ``` */ dropLabels?: string[]; jsx?: false | "react" | "react-jsx" | "preserve" | JsxOptions; } //#endregion //#region src/options/input-options.d.ts type InputOption = string | string[] | Record; type ExternalOptionFunction = (id: string, parentId: string | undefined, isResolved: boolean) => NullValue; type ExternalOption = StringOrRegExp | StringOrRegExp[] | ExternalOptionFunction; type ModuleTypes = Record; interface WatcherOptions { skipWrite?: boolean; buildDelay?: number; notify?: { pollInterval?: number; compareContents?: boolean; }; include?: StringOrRegExp | StringOrRegExp[]; exclude?: StringOrRegExp | StringOrRegExp[]; onInvalidate?: (id: string) => void; clearScreen?: boolean; } type MakeAbsoluteExternalsRelative = boolean | "ifRelativeSource"; type HmrOptions = boolean | { host?: string; port?: number; implement?: string; }; type OptimizationOptions = { /** * Inline imported constant values during bundling instead of preserving variable references. * * When enabled, constant values from imported modules will be inlined at their usage sites, * potentially reducing bundle size and improving runtime performance by eliminating variable lookups. * **options**: * - `true`: equivalent to `{ mode: 'all', pass: 1 }`, enabling constant inlining for all eligible constants with a single pass. * - `false`: Disable constant inlining * - `{ mode: 'smart' | 'all', pass?: number }`: * - `mode: 'smart'`: Only inline constants in specific scenarios where it is likely to reduce bundle size and improve performance. * Smart mode inlines constants in these specific scenarios: * 1. `if (test) {} else {}` - condition expressions in if statements * 2. `test ? a : b` - condition expressions in ternary operators * 3. `test1 || test2` - logical OR expressions * 4. `test1 && test2` - logical AND expressions * 5. `test1 ?? test2` - nullish coalescing expressions * - `mode: 'all'`: Inline all imported constants wherever they are used. * - `pass`: Number of passes to perform for inlining constants. * * **example** * ```js * // Input files: * // constants.js * export const API_URL = 'https://api.example.com'; * * // main.js * import { API_URL } from './constants.js'; * console.log(API_URL); * * // With inlineConst: true, the bundled output becomes: * console.log('https://api.example.com'); * * // Instead of: * const API_URL = 'https://api.example.com'; * console.log(API_URL); * ``` * * @default false */ inlineConst?: boolean | { mode?: "all" | "smart"; pass?: number; }; /** * Use PIFE pattern for module wrappers */ pifeForModuleWrappers?: boolean; }; type AttachDebugOptions = "none" | "simple" | "full"; type ChunkModulesOrder = "exec-order" | "module-id"; type OnLogFunction = (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void; type OnwarnFunction = (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void; interface InputOptions { input?: InputOption; plugins?: RolldownPluginOption; external?: ExternalOption; resolve?: { /** * > [!WARNING] * > `resolve.alias` will not call `resolveId` hooks of other plugin. * > If you want to call `resolveId` hooks of other plugin, use `viteAliasPlugin` from `rolldown/experimental` instead. * > You could find more discussion in [this issue](https://github.com/rolldown/rolldown/issues/3615) */ alias?: Record; aliasFields?: string[][]; conditionNames?: string[]; /** * Map of extensions to alternative extensions. * * With writing `import './foo.js'` in a file, you want to resolve it to `foo.ts` instead of `foo.js`. * You can achieve this by setting: `extensionAlias: { '.js': ['.ts', '.js'] }`. */ extensionAlias?: Record; exportsFields?: string[][]; extensions?: string[]; mainFields?: string[]; mainFiles?: string[]; modules?: string[]; symlinks?: boolean; /** * @deprecated Use the top-level `tsconfig` option instead. */ tsconfigFilename?: string; }; cwd?: string; /** * Expected platform where the code run. * * When the platform is set to neutral: * - 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. * - 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. * - The conditions setting does not automatically include any platform-specific values. * * @default * - 'node' if the format is 'cjs' * - 'browser' for other formats */ platform?: "node" | "browser" | "neutral"; shimMissingExports?: boolean; treeshake?: boolean | TreeshakingOptions; logLevel?: LogLevelOption; onLog?: OnLogFunction; onwarn?: OnwarnFunction; moduleTypes?: ModuleTypes; experimental?: { /** * Lets modules be executed in the order they are declared. * * - Type: `boolean` * - Default: `false` * * 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. * * > [!WARNING] * > Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary. */ strictExecutionOrder?: boolean; disableLiveBindings?: boolean; viteMode?: boolean; resolveNewUrlToAsset?: boolean; hmr?: HmrOptions; /** * Control which order should use when rendering modules in chunk * * - Type: `'exec-order' | 'module-id' * - Default: `'exec-order'` * * - `exec-order`: Almost equivalent to the topological order of the module graph, but specially handling when module graph has cycle. * - `module-id`: This is more friendly for gzip compression, especially for some javascript static asset lib (e.g. icon library) * > [!NOTE] * > 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). */ chunkModulesOrder?: ChunkModulesOrder; /** * Attach debug information to the output bundle. * * - Type: `'none' | 'simple' | 'full'` * - Default: `'simple'` * * - `none`: No debug information is attached. * - `simple`: Attach comments indicating which files the bundled code comes from. These comments could be removed by the minifier. * - `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. * * > [!WARNING] * > You shouldn't use `full` in the production build. */ attachDebugInfo?: AttachDebugOptions; /** * Enables automatic generation of a chunk import map asset during build. * * This map only includes chunks with hashed filenames, where keys are derived from the facade module * name or primary chunk name. It produces stable and unique hash-based filenames, effectively preventing * cascading cache invalidation caused by content hashes and maximizing browser cache reuse. * * The output defaults to `importmap.json` unless overridden via `fileName`. A base URL prefix * (default `"/"`) can be applied to all paths. The resulting JSON is a valid import map and can be * directly injected into HTML via `