@rolldown/browser 1.0.0-rc.1 → 1.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +705 -1101
- package/dist/config.d.mts +9 -4
- package/dist/config.mjs +4 -13
- package/dist/{shared/constructors-BTW-c3jX.mjs → constructors-LtcP0f-6.js} +14 -7
- package/dist/error-nyELQq9T.js +157 -0
- package/dist/experimental-index.browser.mjs +74 -15
- package/dist/experimental-index.d.mts +128 -56
- package/dist/experimental-index.mjs +76 -17
- package/dist/filter-index.d.mts +1 -1
- package/dist/filter-index.mjs +25 -6
- package/dist/get-log-filter.d.mts +3 -7
- package/dist/get-log-filter.mjs +23 -3
- package/dist/index.browser.mjs +70 -75
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +6 -12
- package/dist/{normalize-string-or-regex-CL-PJZI7.js → normalize-string-or-regex-Db8ibFkp.js} +25 -23
- package/dist/parallel-plugin-worker.mjs +3 -7
- package/dist/parallel-plugin.d.mts +4 -4
- package/dist/parallel-plugin.mjs +1 -2
- package/dist/parse-ast-index.d.mts +27 -3
- package/dist/parse-ast-index.mjs +60 -3
- package/dist/plugins-index.browser.mjs +8 -7
- package/dist/plugins-index.d.mts +7 -4
- package/dist/plugins-index.mjs +8 -7
- package/dist/resolve-tsconfig-CkWJwi9L.js +112 -0
- package/dist/rolldown-binding.wasi-browser.js +6 -1
- package/dist/rolldown-binding.wasi.cjs +6 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/{rolldown-build-C4tDS_XC.js → rolldown-build-BPQtF2AA.js} +1063 -745
- package/dist/shared/{bindingify-input-options-Bp2kpiI8.mjs → bindingify-input-options-CSSx7s5e.mjs} +124 -165
- package/dist/shared/{composable-filters-CIxSuZSM.mjs → composable-filters-B2ByPP8y.mjs} +1 -4
- package/dist/{constructors-B8gqcrFr.js → shared/constructors-BGLoUvKR.mjs} +14 -7
- package/dist/shared/{constructors-5bt5oBhE.d.mts → constructors-BVnf_fH1.d.mts} +13 -4
- package/dist/shared/define-config-Cr6054d_.d.mts +3869 -0
- package/dist/shared/{define-config-Dlptvz3X.mjs → define-config-DJOr6Iwt.mjs} +1 -2
- package/dist/shared/error-CQ6njWsV.mjs +86 -0
- package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
- package/dist/shared/{load-config-BBZgIUGN.mjs → load-config-CXtSVabV.mjs} +11 -5
- package/dist/shared/{logging-Nvu645a7.d.mts → logging-C6h4g8dA.d.mts} +6 -6
- package/dist/shared/{logs-B2CASPcx.mjs → logs-D80CXhvg.mjs} +6 -9
- package/dist/shared/{normalize-string-or-regex-DIwprzLy.mjs → normalize-string-or-regex-D0o84ejN.mjs} +21 -16
- package/dist/shared/parse-B_jvq8dU.mjs +73 -0
- package/dist/shared/{prompt-B6NrDD1-.mjs → prompt-BYQIwEjg.mjs} +4 -6
- package/dist/shared/resolve-tsconfig-Cwoo4h_o.mjs +112 -0
- package/dist/shared/{rolldown-C0_W0QdY.mjs → rolldown-D-bh1N9N.mjs} +2 -4
- package/dist/shared/rolldown-build-Bysdmf-9.mjs +3320 -0
- package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
- package/dist/shared/{types-CIYK49jr.d.mts → types-K2r0mx6Y.d.mts} +11 -9
- package/dist/shared/{watch-eIop0yN6.mjs → watch-V9eI6ua1.mjs} +71 -76
- package/dist/utils-index.browser.mjs +2414 -0
- package/dist/utils-index.d.mts +1673 -0
- package/dist/utils-index.mjs +2414 -0
- package/package.json +1 -1
- package/dist/cli-setup.d.mts +0 -1
- package/dist/cli-setup.mjs +0 -16
- package/dist/shared/define-config-CDlEOpr1.d.mts +0 -3531
- package/dist/shared/parse-ast-index-2ahkCVK6.mjs +0 -98
- package/dist/shared/rolldown-build-DLuUhuNw.mjs +0 -2368
- /package/dist/shared/{utils-CqMTwlsR.d.mts → utils-6wxe_LMG.d.mts} +0 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { a as RolldownLog } from "./logging-C6h4g8dA.mjs";
|
|
2
|
+
import { BindingEnhancedTransformOptions, BindingEnhancedTransformResult, BindingTsconfigCompilerOptions as TsconfigCompilerOptions, BindingTsconfigRawOptions as TsconfigRawOptions, BindingTsconfigResult, MinifyOptions, MinifyResult, ParseResult, ParserOptions, SourceMap, TsconfigCache } from "../binding.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/resolve-tsconfig.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Cache for tsconfig resolution to avoid redundant file system operations.
|
|
7
|
+
*
|
|
8
|
+
* The cache stores resolved tsconfig configurations keyed by their file paths.
|
|
9
|
+
* When transforming multiple files in the same project, tsconfig lookups are
|
|
10
|
+
* deduplicated, improving performance.
|
|
11
|
+
*
|
|
12
|
+
* @category Utilities
|
|
13
|
+
* @experimental
|
|
14
|
+
*/
|
|
15
|
+
declare class TsconfigCache$1 extends TsconfigCache {
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
/** @hidden This is only expected to be used by Vite */
|
|
19
|
+
declare function resolveTsconfig(filename: string, cache?: TsconfigCache$1 | null): BindingTsconfigResult | null;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/utils/parse.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* Result of parsing a code
|
|
24
|
+
*
|
|
25
|
+
* @category Utilities
|
|
26
|
+
*/
|
|
27
|
+
interface ParseResult$1 extends ParseResult {}
|
|
28
|
+
/**
|
|
29
|
+
* Options for parsing a code
|
|
30
|
+
*
|
|
31
|
+
* @category Utilities
|
|
32
|
+
*/
|
|
33
|
+
interface ParserOptions$1 extends ParserOptions {}
|
|
34
|
+
/**
|
|
35
|
+
* Parse JS/TS source asynchronously on a separate thread.
|
|
36
|
+
*
|
|
37
|
+
* Note that not all of the workload can happen on a separate thread.
|
|
38
|
+
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
|
|
39
|
+
* has to happen on current thread. This synchronous deserialization work typically outweighs
|
|
40
|
+
* the asynchronous parsing by a factor of between 3 and 20.
|
|
41
|
+
*
|
|
42
|
+
* i.e. the majority of the workload cannot be parallelized by using this method.
|
|
43
|
+
*
|
|
44
|
+
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
|
|
45
|
+
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
|
|
46
|
+
*
|
|
47
|
+
* @category Utilities
|
|
48
|
+
*/
|
|
49
|
+
declare function parse(filename: string, sourceText: string, options?: ParserOptions$1 | null): Promise<ParseResult$1>;
|
|
50
|
+
/**
|
|
51
|
+
* Parse JS/TS source synchronously on current thread.
|
|
52
|
+
*
|
|
53
|
+
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
|
|
54
|
+
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
|
|
55
|
+
* (see {@linkcode parse} documentation for details).
|
|
56
|
+
*
|
|
57
|
+
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
|
|
58
|
+
* with {@linkcode parseSync} rather than using {@linkcode parse}.
|
|
59
|
+
*
|
|
60
|
+
* @category Utilities
|
|
61
|
+
*/
|
|
62
|
+
declare function parseSync(filename: string, sourceText: string, options?: ParserOptions$1 | null): ParseResult$1;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/utils/minify.d.ts
|
|
65
|
+
/**
|
|
66
|
+
* Options for minification.
|
|
67
|
+
*
|
|
68
|
+
* @category Utilities
|
|
69
|
+
*/
|
|
70
|
+
interface MinifyOptions$1 extends MinifyOptions {
|
|
71
|
+
inputMap?: SourceMap;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The result of minification.
|
|
75
|
+
*
|
|
76
|
+
* @category Utilities
|
|
77
|
+
*/
|
|
78
|
+
interface MinifyResult$1 extends MinifyResult {}
|
|
79
|
+
/**
|
|
80
|
+
* Minify asynchronously.
|
|
81
|
+
*
|
|
82
|
+
* Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
|
|
83
|
+
*
|
|
84
|
+
* @category Utilities
|
|
85
|
+
* @experimental
|
|
86
|
+
*/
|
|
87
|
+
declare function minify(filename: string, sourceText: string, options?: MinifyOptions$1 | null): Promise<MinifyResult$1>;
|
|
88
|
+
/**
|
|
89
|
+
* Minify synchronously.
|
|
90
|
+
*
|
|
91
|
+
* @category Utilities
|
|
92
|
+
* @experimental
|
|
93
|
+
*/
|
|
94
|
+
declare function minifySync(filename: string, sourceText: string, options?: MinifyOptions$1 | null): MinifyResult$1;
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/utils/transform.d.ts
|
|
97
|
+
/**
|
|
98
|
+
* Options for transforming a code.
|
|
99
|
+
*
|
|
100
|
+
* @category Utilities
|
|
101
|
+
*/
|
|
102
|
+
interface TransformOptions$1 extends BindingEnhancedTransformOptions {}
|
|
103
|
+
/**
|
|
104
|
+
* Result of transforming a code.
|
|
105
|
+
*
|
|
106
|
+
* @category Utilities
|
|
107
|
+
*/
|
|
108
|
+
type TransformResult = Omit<BindingEnhancedTransformResult, "errors" | "warnings"> & {
|
|
109
|
+
errors: Error[];
|
|
110
|
+
warnings: RolldownLog[];
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
|
|
114
|
+
*
|
|
115
|
+
* Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
|
|
116
|
+
*
|
|
117
|
+
* @param filename The name of the file being transformed. If this is a
|
|
118
|
+
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
|
|
119
|
+
* @param sourceText The source code to transform.
|
|
120
|
+
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
|
|
121
|
+
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
|
|
122
|
+
* Only used when `options.tsconfig` is `true`.
|
|
123
|
+
*
|
|
124
|
+
* @returns a promise that resolves to an object containing the transformed code,
|
|
125
|
+
* source maps, and any errors that occurred during parsing or transformation.
|
|
126
|
+
*
|
|
127
|
+
* @category Utilities
|
|
128
|
+
* @experimental
|
|
129
|
+
*/
|
|
130
|
+
declare function transform(filename: string, sourceText: string, options?: TransformOptions$1 | null, cache?: TsconfigCache$1 | null): Promise<TransformResult>;
|
|
131
|
+
/**
|
|
132
|
+
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
|
|
133
|
+
*
|
|
134
|
+
* @param filename The name of the file being transformed. If this is a
|
|
135
|
+
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
|
|
136
|
+
* @param sourceText The source code to transform.
|
|
137
|
+
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
|
|
138
|
+
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
|
|
139
|
+
* Only used when `options.tsconfig` is `true`.
|
|
140
|
+
*
|
|
141
|
+
* @returns an object containing the transformed code, source maps, and any errors
|
|
142
|
+
* that occurred during parsing or transformation.
|
|
143
|
+
*
|
|
144
|
+
* @category Utilities
|
|
145
|
+
* @experimental
|
|
146
|
+
*/
|
|
147
|
+
declare function transformSync(filename: string, sourceText: string, options?: TransformOptions$1 | null, cache?: TsconfigCache$1 | null): TransformResult;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { transform as a, MinifyResult$1 as c, ParseResult$1 as d, ParserOptions$1 as f, resolveTsconfig as g, TsconfigCache$1 as h, TsconfigRawOptions as i, minify as l, parseSync as m, TransformResult as n, transformSync as o, parse as p, TsconfigCompilerOptions as r, MinifyOptions$1 as s, TransformOptions$1 as t, minifySync as u };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
declare namespace types_d_exports {
|
|
2
|
+
export { AccessorProperty, AccessorPropertyType, Argument, ArrayAssignmentTarget, ArrayExpression, ArrayExpressionElement, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentOperator, AssignmentPattern, AssignmentTarget, AssignmentTargetMaybeDefault, AssignmentTargetPattern, AssignmentTargetProperty, AssignmentTargetPropertyIdentifier, AssignmentTargetPropertyProperty, AssignmentTargetRest, AssignmentTargetWithDefault, AwaitExpression, BigIntLiteral, BinaryExpression, BinaryOperator, BindingIdentifier, BindingPattern, BindingProperty, BindingRestElement, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, ChainElement, ChainExpression, Class, ClassBody, ClassElement, ClassType, ComputedMemberExpression, ConditionalExpression, ContinueStatement, DebuggerStatement, Declaration, Decorator, Directive, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclaration, ExportDefaultDeclarationKind, ExportNamedDeclaration, ExportSpecifier, Expression, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, ForStatementInit, ForStatementLeft, FormalParameter, FormalParameterRest, Function, FunctionBody, FunctionType, Hashbang, IdentifierName, IdentifierReference, IfStatement, ImportAttribute, ImportAttributeKey, ImportDeclaration, ImportDeclarationSpecifier, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportOrExportKind, ImportPhase, ImportSpecifier, JSDocNonNullableType, JSDocNullableType, JSDocUnknownType, JSXAttribute, JSXAttributeItem, JSXAttributeName, JSXAttributeValue, JSXChild, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementName, JSXEmptyExpression, JSXExpression, JSXExpressionContainer, JSXFragment, JSXIdentifier, JSXMemberExpression, JSXMemberExpressionObject, JSXNamespacedName, JSXOpeningElement, JSXOpeningFragment, JSXSpreadAttribute, JSXSpreadChild, JSXText, LabelIdentifier, LabeledStatement, LogicalExpression, LogicalOperator, MemberExpression, MetaProperty, MethodDefinition, MethodDefinitionKind, MethodDefinitionType, ModuleDeclaration, ModuleExportName, ModuleKind, NewExpression, Node, NullLiteral, NumericLiteral, ObjectAssignmentTarget, ObjectExpression, ObjectPattern, ObjectProperty, ObjectPropertyKind, ParamPattern, ParenthesizedExpression, PrivateFieldExpression, PrivateIdentifier, PrivateInExpression, Program, PropertyDefinition, PropertyDefinitionType, PropertyKey, PropertyKind, RegExpLiteral, ReturnStatement, SequenceExpression, SimpleAssignmentTarget, Span, SpreadElement, Statement, StaticBlock, StaticMemberExpression, StringLiteral, Super, SwitchCase, SwitchStatement, TSAccessibility, TSAnyKeyword, TSArrayType, TSAsExpression, TSBigIntKeyword, TSBooleanKeyword, TSCallSignatureDeclaration, TSClassImplements, TSConditionalType, TSConstructSignatureDeclaration, TSConstructorType, TSEnumBody, TSEnumDeclaration, TSEnumMember, TSEnumMemberName, TSExportAssignment, TSExternalModuleReference, TSFunctionType, TSGlobalDeclaration, TSImportEqualsDeclaration, TSImportType, TSImportTypeQualifiedName, TSImportTypeQualifier, TSIndexSignature, TSIndexSignatureName, TSIndexedAccessType, TSInferType, TSInstantiationExpression, TSInterfaceBody, TSInterfaceDeclaration, TSInterfaceHeritage, TSIntersectionType, TSIntrinsicKeyword, TSLiteral, TSLiteralType, TSMappedType, TSMappedTypeModifierOperator, TSMethodSignature, TSMethodSignatureKind, TSModuleBlock, TSModuleDeclaration, TSModuleDeclarationKind, TSModuleReference, TSNamedTupleMember, TSNamespaceExportDeclaration, TSNeverKeyword, TSNonNullExpression, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSOptionalType, TSParameterProperty, TSParenthesizedType, TSPropertySignature, TSQualifiedName, TSRestType, TSSatisfiesExpression, TSSignature, TSStringKeyword, TSSymbolKeyword, TSTemplateLiteralType, TSThisParameter, TSThisType, TSTupleElement, TSTupleType, TSType, TSTypeAliasDeclaration, TSTypeAnnotation, TSTypeAssertion, TSTypeLiteral, TSTypeName, TSTypeOperator, TSTypeOperatorOperator, TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TSTypePredicate, TSTypePredicateName, TSTypeQuery, TSTypeQueryExprName, TSTypeReference, TSUndefinedKeyword, TSUnionType, TSUnknownKeyword, TSVoidKeyword, TaggedTemplateExpression, TemplateElement, TemplateElementValue, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, UnaryExpression, UnaryOperator, UpdateExpression, UpdateOperator, V8IntrinsicExpression, VariableDeclaration, VariableDeclarationKind, VariableDeclarator, WhileStatement, WithStatement, YieldExpression };
|
|
3
|
+
}
|
|
2
4
|
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
|
3
5
|
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`.
|
|
4
6
|
interface Program extends Span {
|
|
@@ -1235,7 +1237,7 @@ interface TSImportEqualsDeclaration extends Span {
|
|
|
1235
1237
|
importKind: ImportOrExportKind;
|
|
1236
1238
|
parent?: Node;
|
|
1237
1239
|
}
|
|
1238
|
-
type TSModuleReference = TSExternalModuleReference |
|
|
1240
|
+
type TSModuleReference = TSExternalModuleReference | IdentifierReference | TSQualifiedName;
|
|
1239
1241
|
interface TSExternalModuleReference extends Span {
|
|
1240
1242
|
type: "TSExternalModuleReference";
|
|
1241
1243
|
expression: StringLiteral;
|
|
@@ -1284,17 +1286,17 @@ interface JSDocUnknownType extends Span {
|
|
|
1284
1286
|
type: "TSJSDocUnknownType";
|
|
1285
1287
|
parent?: Node;
|
|
1286
1288
|
}
|
|
1287
|
-
type
|
|
1288
|
-
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "**" | "<<" | ">>" | ">>>" | "|" | "^" | "&" | "in" | "instanceof";
|
|
1289
|
-
type LogicalOperator = "||" | "&&" | "??";
|
|
1290
|
-
type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
|
|
1291
|
-
type UpdateOperator = "++" | "--";
|
|
1289
|
+
type ModuleKind = "script" | "module" | "commonjs";
|
|
1292
1290
|
interface Span {
|
|
1293
1291
|
start: number;
|
|
1294
1292
|
end: number;
|
|
1295
1293
|
range?: [number, number];
|
|
1296
1294
|
}
|
|
1297
|
-
type
|
|
1295
|
+
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
1296
|
+
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "**" | "<<" | ">>" | ">>>" | "|" | "^" | "&" | "in" | "instanceof";
|
|
1297
|
+
type LogicalOperator = "||" | "&&" | "??";
|
|
1298
|
+
type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
|
|
1299
|
+
type UpdateOperator = "++" | "--";
|
|
1298
1300
|
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;
|
|
1299
1301
|
//#endregion
|
|
1300
|
-
export { Program as t };
|
|
1302
|
+
export { types_d_exports as n, Program as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as
|
|
2
|
-
import {
|
|
3
|
-
import { h as arraify } from "./composable-filters-
|
|
4
|
-
import {
|
|
1
|
+
import { o as logMultipleWatcherOption } from "./logs-D80CXhvg.mjs";
|
|
2
|
+
import { v as LOG_LEVEL_WARN } from "./bindingify-input-options-CSSx7s5e.mjs";
|
|
3
|
+
import { h as arraify } from "./composable-filters-B2ByPP8y.mjs";
|
|
4
|
+
import { n as createBundlerOptions, u as PluginDriver } from "./rolldown-build-Bysdmf-9.mjs";
|
|
5
|
+
import { t as aggregateBindingErrorsIntoJsError } from "./error-CQ6njWsV.mjs";
|
|
5
6
|
import { BindingWatcher, shutdownAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
6
|
-
|
|
7
7
|
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
8
8
|
/**
|
|
9
9
|
* This is not the set of all possible signals.
|
|
@@ -35,7 +35,6 @@ const signals = [];
|
|
|
35
35
|
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
36
36
|
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
37
37
|
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
38
|
-
|
|
39
38
|
//#endregion
|
|
40
39
|
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
41
40
|
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
|
|
@@ -203,7 +202,6 @@ var SignalExit = class extends SignalExitBase {
|
|
|
203
202
|
};
|
|
204
203
|
const process$1 = globalThis.process;
|
|
205
204
|
const { onExit: onExit$1, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
206
|
-
|
|
207
205
|
//#endregion
|
|
208
206
|
//#region src/utils/signal-exit.ts
|
|
209
207
|
function onExit(...args) {
|
|
@@ -215,15 +213,10 @@ function onExit(...args) {
|
|
|
215
213
|
}
|
|
216
214
|
onExit$1(...args);
|
|
217
215
|
}
|
|
218
|
-
|
|
219
216
|
//#endregion
|
|
220
217
|
//#region src/api/watch/watch-emitter.ts
|
|
221
218
|
var WatcherEmitter = class {
|
|
222
219
|
listeners = /* @__PURE__ */ new Map();
|
|
223
|
-
timer;
|
|
224
|
-
constructor() {
|
|
225
|
-
this.timer = setInterval(() => {}, 1e9);
|
|
226
|
-
}
|
|
227
220
|
on(event, listener) {
|
|
228
221
|
const listeners = this.listeners.get(event);
|
|
229
222
|
if (listeners) listeners.push(listener);
|
|
@@ -239,58 +232,55 @@ var WatcherEmitter = class {
|
|
|
239
232
|
return this;
|
|
240
233
|
}
|
|
241
234
|
clear(event) {
|
|
242
|
-
|
|
235
|
+
this.listeners.delete(event);
|
|
243
236
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
for (const listener of listeners) await listener();
|
|
250
|
-
break;
|
|
251
|
-
case "event":
|
|
252
|
-
for (const listener of listeners) {
|
|
253
|
-
const code = event.bundleEventKind();
|
|
254
|
-
switch (code) {
|
|
255
|
-
case "BUNDLE_END":
|
|
256
|
-
const { duration, output, result } = event.bundleEndData();
|
|
257
|
-
await listener({
|
|
258
|
-
code: "BUNDLE_END",
|
|
259
|
-
duration,
|
|
260
|
-
output: [output],
|
|
261
|
-
result
|
|
262
|
-
});
|
|
263
|
-
break;
|
|
264
|
-
case "ERROR":
|
|
265
|
-
const data = event.bundleErrorData();
|
|
266
|
-
await listener({
|
|
267
|
-
code: "ERROR",
|
|
268
|
-
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
269
|
-
result: data.result
|
|
270
|
-
});
|
|
271
|
-
break;
|
|
272
|
-
default:
|
|
273
|
-
await listener({ code });
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
break;
|
|
278
|
-
case "change":
|
|
279
|
-
for (const listener of listeners) {
|
|
280
|
-
const { path, kind } = event.watchChangeData();
|
|
281
|
-
await listener(path, { event: kind });
|
|
282
|
-
}
|
|
283
|
-
break;
|
|
284
|
-
default: throw new Error(`Unknown event: ${event}`);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
async close() {
|
|
288
|
-
clearInterval(this.timer);
|
|
237
|
+
/** Async emit — sequential dispatch so side effects from earlier handlers
|
|
238
|
+
* (e.g. `event.result.close()` triggering `closeBundle`) are visible to later handlers. */
|
|
239
|
+
async emit(event, ...args) {
|
|
240
|
+
const handlers = this.listeners.get(event);
|
|
241
|
+
if (handlers?.length) for (const h of handlers) await h(...args);
|
|
289
242
|
}
|
|
243
|
+
async close() {}
|
|
290
244
|
};
|
|
291
|
-
|
|
292
245
|
//#endregion
|
|
293
246
|
//#region src/api/watch/watcher.ts
|
|
247
|
+
function createEventCallback(emitter) {
|
|
248
|
+
return async (event) => {
|
|
249
|
+
switch (event.eventKind()) {
|
|
250
|
+
case "event": {
|
|
251
|
+
const code = event.bundleEventKind();
|
|
252
|
+
if (code === "BUNDLE_END") {
|
|
253
|
+
const { duration, output, result } = event.bundleEndData();
|
|
254
|
+
await emitter.emit("event", {
|
|
255
|
+
code: "BUNDLE_END",
|
|
256
|
+
duration,
|
|
257
|
+
output: [output],
|
|
258
|
+
result
|
|
259
|
+
});
|
|
260
|
+
} else if (code === "ERROR") {
|
|
261
|
+
const data = event.bundleErrorData();
|
|
262
|
+
await emitter.emit("event", {
|
|
263
|
+
code: "ERROR",
|
|
264
|
+
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
265
|
+
result: data.result
|
|
266
|
+
});
|
|
267
|
+
} else await emitter.emit("event", { code });
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
case "change": {
|
|
271
|
+
const { path, kind } = event.watchChangeData();
|
|
272
|
+
await emitter.emit("change", path, { event: kind });
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case "restart":
|
|
276
|
+
await emitter.emit("restart");
|
|
277
|
+
break;
|
|
278
|
+
case "close":
|
|
279
|
+
await emitter.emit("close");
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
294
284
|
var Watcher = class {
|
|
295
285
|
closed;
|
|
296
286
|
inner;
|
|
@@ -306,6 +296,7 @@ var Watcher = class {
|
|
|
306
296
|
originClose();
|
|
307
297
|
};
|
|
308
298
|
this.stopWorkers = stopWorkers;
|
|
299
|
+
process.nextTick(() => this.run());
|
|
309
300
|
}
|
|
310
301
|
async close() {
|
|
311
302
|
if (this.closed) return;
|
|
@@ -314,8 +305,9 @@ var Watcher = class {
|
|
|
314
305
|
await this.inner.close();
|
|
315
306
|
shutdownAsyncRuntime();
|
|
316
307
|
}
|
|
317
|
-
|
|
318
|
-
|
|
308
|
+
async run() {
|
|
309
|
+
await this.inner.run();
|
|
310
|
+
this.inner.waitForClose();
|
|
319
311
|
}
|
|
320
312
|
};
|
|
321
313
|
async function createWatcher(emitter, input) {
|
|
@@ -323,20 +315,24 @@ async function createWatcher(emitter, input) {
|
|
|
323
315
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
324
316
|
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
325
317
|
})).flat());
|
|
326
|
-
|
|
327
|
-
|
|
318
|
+
warnMultiplePollingOptions(bundlerOptions);
|
|
319
|
+
const callback = createEventCallback(emitter);
|
|
320
|
+
new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), callback), bundlerOptions.map((option) => option.stopWorkers));
|
|
328
321
|
}
|
|
329
|
-
function
|
|
330
|
-
let
|
|
331
|
-
for (const option of bundlerOptions)
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
322
|
+
function warnMultiplePollingOptions(bundlerOptions) {
|
|
323
|
+
let found = false;
|
|
324
|
+
for (const option of bundlerOptions) {
|
|
325
|
+
const watch = option.inputOptions.watch;
|
|
326
|
+
const watcher = watch && typeof watch === "object" ? watch.watcher ?? watch.notify : void 0;
|
|
327
|
+
if (watcher && (watcher.usePolling != null || watcher.pollInterval != null)) {
|
|
328
|
+
if (found) {
|
|
329
|
+
option.onLog(LOG_LEVEL_WARN, logMultipleWatcherOption());
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
found = true;
|
|
333
|
+
}
|
|
337
334
|
}
|
|
338
335
|
}
|
|
339
|
-
|
|
340
336
|
//#endregion
|
|
341
337
|
//#region src/api/watch/index.ts
|
|
342
338
|
/**
|
|
@@ -368,11 +364,10 @@ function getValidNotifyOption(bundlerOptions) {
|
|
|
368
364
|
* @experimental
|
|
369
365
|
* @category Programmatic APIs
|
|
370
366
|
*/
|
|
371
|
-
|
|
367
|
+
function watch(input) {
|
|
372
368
|
const emitter = new WatcherEmitter();
|
|
373
369
|
createWatcher(emitter, input);
|
|
374
370
|
return emitter;
|
|
375
|
-
}
|
|
376
|
-
|
|
371
|
+
}
|
|
377
372
|
//#endregion
|
|
378
|
-
export { onExit as n, watch as t };
|
|
373
|
+
export { onExit as n, watch as t };
|