@rollipop/rolldown 1.0.0-rc.2 → 1.0.0-rc.3
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-setup.mjs +1 -1
- package/dist/cli.mjs +27 -996
- package/dist/config.d.mts +10 -5
- package/dist/config.mjs +9 -12
- package/dist/experimental-index.d.mts +72 -14
- package/dist/experimental-index.mjs +64 -11
- package/dist/experimental-runtime-types.d.ts +0 -5
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +24 -1
- package/dist/get-log-filter.d.mts +3 -7
- package/dist/get-log-filter.mjs +23 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +10 -9
- package/dist/parallel-plugin-worker.mjs +5 -4
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +26 -2
- package/dist/parse-ast-index.mjs +61 -2
- package/dist/plugins-index.d.mts +8 -5
- package/dist/plugins-index.mjs +8 -5
- package/dist/shared/{binding-Bo6UcGYl.d.mts → binding-C4ZlFAt6.d.mts} +302 -117
- package/dist/shared/{binding-9QXxzPo6.mjs → binding-D25Pz9Tj.mjs} +32 -26
- package/dist/shared/{bindingify-input-options-C--dZCPv.mjs → bindingify-input-options-D6jfpJ6l.mjs} +52 -113
- package/dist/shared/{constructors-DsYXT8FB.mjs → constructors-BAGdj697.mjs} +8 -5
- package/dist/shared/{constructors-B64fS2o1.d.mts → constructors-C-tyKVjw.d.mts} +9 -4
- package/dist/shared/{define-config-DT_Hpxdr.d.mts → define-config-BKLqq_zt.d.mts} +148 -43
- package/dist/shared/error-BoaGIj5N.mjs +90 -0
- package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
- package/dist/shared/{load-config-TBowPn4n.mjs → load-config-CV5K8wKJ.mjs} +10 -2
- package/dist/shared/{logs-NH298mHo.mjs → logs-CCc_0vhs.mjs} +1 -1
- package/dist/shared/{normalize-string-or-regex-CaBvmZZK.mjs → normalize-string-or-regex-tBSnk6HY.mjs} +2 -2
- package/dist/shared/parse-DWZRPGsB.mjs +77 -0
- package/dist/shared/{rolldown-5hTSdYMy.mjs → rolldown-CZ1SIh-x.mjs} +1 -1
- package/dist/shared/{rolldown-build-B7oitB1K.mjs → rolldown-build-BYA-VVk0.mjs} +1019 -26
- package/dist/shared/transform-CIcvJTbn.mjs +93 -0
- package/dist/shared/transform-DoG7c5_r.d.mts +132 -0
- package/dist/shared/{watch-CkctCkiN.mjs → watch-DV7vV2OV.mjs} +6 -5
- package/dist/utils-index.d.mts +376 -0
- package/dist/utils-index.mjs +2426 -0
- package/package.json +17 -16
- package/dist/shared/parse-ast-index-BQ9Myuc2.mjs +0 -99
- /package/dist/shared/{define-config-BVG4QvnP.mjs → define-config-BMj_QknW.mjs} +0 -0
- /package/dist/shared/{logging-CE90D8JR.d.mts → logging-C6h4g8dA.d.mts} +0 -0
- /package/dist/shared/{misc-CCZIsXVO.mjs → misc-Xty885dB.mjs} +0 -0
- /package/dist/shared/{prompt-CI-U8Lh4.mjs → prompt-B56gTa4S.mjs} +0 -0
|
@@ -98,7 +98,7 @@ interface MangleOptions {
|
|
|
98
98
|
/**
|
|
99
99
|
* Pass `true` to mangle names declared in the top level scope.
|
|
100
100
|
*
|
|
101
|
-
* @default false
|
|
101
|
+
* @default true for modules and commonjs, otherwise false
|
|
102
102
|
*/
|
|
103
103
|
toplevel?: boolean;
|
|
104
104
|
/**
|
|
@@ -124,12 +124,6 @@ interface MangleOptionsKeepNames {
|
|
|
124
124
|
*/
|
|
125
125
|
class: boolean;
|
|
126
126
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Minify asynchronously.
|
|
129
|
-
*
|
|
130
|
-
* Note: This function can be slower than `minifySync` due to the overhead of spawning a thread.
|
|
131
|
-
*/
|
|
132
|
-
declare function minify(filename: string, sourceText: string, options?: MinifyOptions | undefined | null): Promise<MinifyResult>;
|
|
133
127
|
interface MinifyOptions {
|
|
134
128
|
/** Use when minifying an ES module. */
|
|
135
129
|
module?: boolean;
|
|
@@ -143,8 +137,6 @@ interface MinifyResult {
|
|
|
143
137
|
map?: SourceMap;
|
|
144
138
|
errors: Array<OxcError>;
|
|
145
139
|
}
|
|
146
|
-
/** Minify synchronously. */
|
|
147
|
-
declare function minifySync(filename: string, sourceText: string, options?: MinifyOptions | undefined | null): MinifyResult;
|
|
148
140
|
interface TreeShakeOptions {
|
|
149
141
|
/**
|
|
150
142
|
* Whether to respect the pure annotations.
|
|
@@ -428,6 +420,20 @@ declare class ResolverFactory {
|
|
|
428
420
|
* This method automatically discovers tsconfig.json by traversing parent directories.
|
|
429
421
|
*/
|
|
430
422
|
resolveFileAsync(file: string, request: string): Promise<ResolveResult>;
|
|
423
|
+
/**
|
|
424
|
+
* Synchronously resolve `specifier` for TypeScript declaration files.
|
|
425
|
+
*
|
|
426
|
+
* `file` is the absolute path to the containing file.
|
|
427
|
+
* Uses TypeScript's `moduleResolution: "bundler"` algorithm.
|
|
428
|
+
*/
|
|
429
|
+
resolveDtsSync(file: string, request: string): ResolveResult;
|
|
430
|
+
/**
|
|
431
|
+
* Asynchronously resolve `specifier` for TypeScript declaration files.
|
|
432
|
+
*
|
|
433
|
+
* `file` is the absolute path to the containing file.
|
|
434
|
+
* Uses TypeScript's `moduleResolution: "bundler"` algorithm.
|
|
435
|
+
*/
|
|
436
|
+
resolveDtsAsync(file: string, request: string): Promise<ResolveResult>;
|
|
431
437
|
}
|
|
432
438
|
/** Node.js builtin module when `Options::builtin_modules` is enabled. */
|
|
433
439
|
interface Builtin {
|
|
@@ -602,6 +608,15 @@ interface NapiResolveOptions {
|
|
|
602
608
|
* Default `true`
|
|
603
609
|
*/
|
|
604
610
|
symlinks?: boolean;
|
|
611
|
+
/**
|
|
612
|
+
* Whether to read the `NODE_PATH` environment variable and append its entries to `modules`.
|
|
613
|
+
*
|
|
614
|
+
* `NODE_PATH` is a deprecated Node.js feature that is not part of ESM resolution.
|
|
615
|
+
* Set this to `false` to disable the behavior.
|
|
616
|
+
*
|
|
617
|
+
* Default `true`
|
|
618
|
+
*/
|
|
619
|
+
nodePath?: boolean;
|
|
605
620
|
/**
|
|
606
621
|
* Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not.
|
|
607
622
|
* For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true.
|
|
@@ -805,7 +820,7 @@ declare function isolatedDeclarationSync(filename: string, sourceText: string, o
|
|
|
805
820
|
/**
|
|
806
821
|
* Configure how TSX and JSX are transformed.
|
|
807
822
|
*
|
|
808
|
-
* @see {@link https://
|
|
823
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
|
|
809
824
|
*/
|
|
810
825
|
interface JsxOptions {
|
|
811
826
|
/**
|
|
@@ -821,8 +836,6 @@ interface JsxOptions {
|
|
|
821
836
|
* Emit development-specific information, such as `__source` and `__self`.
|
|
822
837
|
*
|
|
823
838
|
* @default false
|
|
824
|
-
*
|
|
825
|
-
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
|
|
826
839
|
*/
|
|
827
840
|
development?: boolean;
|
|
828
841
|
/**
|
|
@@ -836,11 +849,7 @@ interface JsxOptions {
|
|
|
836
849
|
*/
|
|
837
850
|
throwIfNamespace?: boolean;
|
|
838
851
|
/**
|
|
839
|
-
*
|
|
840
|
-
*
|
|
841
|
-
* It will mark JSX elements and top-level React method calls as pure for tree shaking.
|
|
842
|
-
*
|
|
843
|
-
* @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
|
|
852
|
+
* Mark JSX elements and top-level React method calls as pure for tree shaking.
|
|
844
853
|
*
|
|
845
854
|
* @default true
|
|
846
855
|
*/
|
|
@@ -953,7 +962,7 @@ interface ReactRefreshOptions {
|
|
|
953
962
|
/**
|
|
954
963
|
* Configure how styled-components are transformed.
|
|
955
964
|
*
|
|
956
|
-
* @see {@link https://
|
|
965
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins#styled-components}
|
|
957
966
|
*/
|
|
958
967
|
interface StyledComponentsOptions {
|
|
959
968
|
/**
|
|
@@ -1028,21 +1037,6 @@ interface StyledComponentsOptions {
|
|
|
1028
1037
|
*/
|
|
1029
1038
|
topLevelImportPaths?: Array<string>;
|
|
1030
1039
|
}
|
|
1031
|
-
/**
|
|
1032
|
-
* Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
|
|
1033
|
-
*
|
|
1034
|
-
* Note: This function can be slower than `transform` due to the overhead of spawning a thread.
|
|
1035
|
-
*
|
|
1036
|
-
* @param filename The name of the file being transformed. If this is a
|
|
1037
|
-
* relative path, consider setting the {@link TransformOptions#cwd} option.
|
|
1038
|
-
* @param sourceText the source code itself
|
|
1039
|
-
* @param options The options for the transformation. See {@link
|
|
1040
|
-
* TransformOptions} for more information.
|
|
1041
|
-
*
|
|
1042
|
-
* @returns a promise that resolves to an object containing the transformed code,
|
|
1043
|
-
* source maps, and any errors that occurred during parsing or transformation.
|
|
1044
|
-
*/
|
|
1045
|
-
declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): Promise<TransformResult>;
|
|
1046
1040
|
/**
|
|
1047
1041
|
* Options for transforming a JavaScript or TypeScript file.
|
|
1048
1042
|
*
|
|
@@ -1070,9 +1064,15 @@ interface TransformOptions {
|
|
|
1070
1064
|
sourcemap?: boolean;
|
|
1071
1065
|
/** Set assumptions in order to produce smaller output. */
|
|
1072
1066
|
assumptions?: CompilerAssumptions;
|
|
1073
|
-
/**
|
|
1067
|
+
/**
|
|
1068
|
+
* Configure how TypeScript is transformed.
|
|
1069
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
|
|
1070
|
+
*/
|
|
1074
1071
|
typescript?: TypeScriptOptions;
|
|
1075
|
-
/**
|
|
1072
|
+
/**
|
|
1073
|
+
* Configure how TSX and JSX are transformed.
|
|
1074
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
|
|
1075
|
+
*/
|
|
1076
1076
|
jsx?: 'preserve' | JsxOptions;
|
|
1077
1077
|
/**
|
|
1078
1078
|
* Sets the target environment for the generated JavaScript.
|
|
@@ -1086,84 +1086,29 @@ interface TransformOptions {
|
|
|
1086
1086
|
*
|
|
1087
1087
|
* @default `esnext` (No transformation)
|
|
1088
1088
|
*
|
|
1089
|
-
* @see
|
|
1089
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target}
|
|
1090
1090
|
*/
|
|
1091
1091
|
target?: string | Array<string>;
|
|
1092
1092
|
/** Behaviour for runtime helpers. */
|
|
1093
1093
|
helpers?: Helpers;
|
|
1094
|
-
/** Define Plugin */
|
|
1095
|
-
define?: Record<string, string>;
|
|
1096
|
-
/** Inject Plugin */
|
|
1097
|
-
inject?: Record<string, string | [string, string]>;
|
|
1098
|
-
/** Decorator plugin */
|
|
1099
|
-
decorator?: DecoratorOptions;
|
|
1100
|
-
/** Third-party plugins to use. */
|
|
1101
|
-
plugins?: PluginsOptions;
|
|
1102
|
-
}
|
|
1103
|
-
interface TransformResult {
|
|
1104
|
-
/**
|
|
1105
|
-
* The transformed code.
|
|
1106
|
-
*
|
|
1107
|
-
* If parsing failed, this will be an empty string.
|
|
1108
|
-
*/
|
|
1109
|
-
code: string;
|
|
1110
|
-
/**
|
|
1111
|
-
* The source map for the transformed code.
|
|
1112
|
-
*
|
|
1113
|
-
* This will be set if {@link TransformOptions#sourcemap} is `true`.
|
|
1114
|
-
*/
|
|
1115
|
-
map?: SourceMap;
|
|
1116
|
-
/**
|
|
1117
|
-
* The `.d.ts` declaration file for the transformed code. Declarations are
|
|
1118
|
-
* only generated if `declaration` is set to `true` and a TypeScript file
|
|
1119
|
-
* is provided.
|
|
1120
|
-
*
|
|
1121
|
-
* If parsing failed and `declaration` is set, this will be an empty string.
|
|
1122
|
-
*
|
|
1123
|
-
* @see {@link TypeScriptOptions#declaration}
|
|
1124
|
-
* @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
|
|
1125
|
-
*/
|
|
1126
|
-
declaration?: string;
|
|
1127
1094
|
/**
|
|
1128
|
-
*
|
|
1129
|
-
* {@link
|
|
1130
|
-
* {@link TransformOptions#sourcemap sourcemap} are set to `true`.
|
|
1095
|
+
* Define Plugin
|
|
1096
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
|
|
1131
1097
|
*/
|
|
1132
|
-
|
|
1098
|
+
define?: Record<string, string>;
|
|
1133
1099
|
/**
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1136
|
-
* @internal
|
|
1137
|
-
*
|
|
1138
|
-
* Example:
|
|
1139
|
-
*
|
|
1140
|
-
* ```text
|
|
1141
|
-
* { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
|
|
1142
|
-
* ```
|
|
1100
|
+
* Inject Plugin
|
|
1101
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
|
|
1143
1102
|
*/
|
|
1144
|
-
|
|
1103
|
+
inject?: Record<string, string | [string, string]>;
|
|
1104
|
+
/** Decorator plugin */
|
|
1105
|
+
decorator?: DecoratorOptions;
|
|
1145
1106
|
/**
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1148
|
-
* Oxc's parser recovers from common syntax errors, meaning that
|
|
1149
|
-
* transformed code may still be available even if there are errors in this
|
|
1150
|
-
* list.
|
|
1107
|
+
* Third-party plugins to use.
|
|
1108
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
|
|
1151
1109
|
*/
|
|
1152
|
-
|
|
1110
|
+
plugins?: PluginsOptions;
|
|
1153
1111
|
}
|
|
1154
|
-
/**
|
|
1155
|
-
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
|
|
1156
|
-
*
|
|
1157
|
-
* @param filename The name of the file being transformed. If this is a
|
|
1158
|
-
* relative path, consider setting the {@link TransformOptions#cwd} option..
|
|
1159
|
-
* @param sourceText the source code itself
|
|
1160
|
-
* @param options The options for the transformation. See {@link
|
|
1161
|
-
* TransformOptions} for more information.
|
|
1162
|
-
*
|
|
1163
|
-
* @returns an object containing the transformed code, source maps, and any
|
|
1164
|
-
* errors that occurred during parsing or transformation.
|
|
1165
|
-
*/
|
|
1166
|
-
declare function transformSync(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult;
|
|
1167
1112
|
interface TypeScriptOptions {
|
|
1168
1113
|
jsxPragma?: string;
|
|
1169
1114
|
jsxPragmaFrag?: string;
|
|
@@ -1328,8 +1273,6 @@ declare class BindingNormalizedOptions {
|
|
|
1328
1273
|
get platform(): 'node' | 'browser' | 'neutral';
|
|
1329
1274
|
get shimMissingExports(): boolean;
|
|
1330
1275
|
get name(): string | null;
|
|
1331
|
-
get cssEntryFilenames(): string | undefined;
|
|
1332
|
-
get cssChunkFilenames(): string | undefined;
|
|
1333
1276
|
get entryFilenames(): string | undefined;
|
|
1334
1277
|
get chunkFilenames(): string | undefined;
|
|
1335
1278
|
get assetFilenames(): string | undefined;
|
|
@@ -1356,6 +1299,7 @@ declare class BindingNormalizedOptions {
|
|
|
1356
1299
|
get polyfillRequire(): boolean;
|
|
1357
1300
|
get minify(): false | 'dce-only' | MinifyOptions;
|
|
1358
1301
|
get legalComments(): 'none' | 'inline';
|
|
1302
|
+
get comments(): BindingCommentsOptions;
|
|
1359
1303
|
get preserveModules(): boolean;
|
|
1360
1304
|
get preserveModulesRoot(): string | undefined;
|
|
1361
1305
|
get virtualDirname(): string;
|
|
@@ -1405,7 +1349,33 @@ declare class BindingSourceMap {
|
|
|
1405
1349
|
declare class BindingWatcherBundler {
|
|
1406
1350
|
close(): Promise<void>;
|
|
1407
1351
|
}
|
|
1408
|
-
|
|
1352
|
+
/**
|
|
1353
|
+
* Cache for tsconfig resolution to avoid redundant file system operations.
|
|
1354
|
+
*
|
|
1355
|
+
* The cache stores resolved tsconfig configurations keyed by their file paths.
|
|
1356
|
+
* When transforming multiple files in the same project, tsconfig lookups are
|
|
1357
|
+
* deduplicated, improving performance.
|
|
1358
|
+
*
|
|
1359
|
+
* @category Utilities
|
|
1360
|
+
* @experimental
|
|
1361
|
+
*/
|
|
1362
|
+
declare class TsconfigCache {
|
|
1363
|
+
/** Create a new transform cache with auto tsconfig discovery enabled. */
|
|
1364
|
+
constructor();
|
|
1365
|
+
/**
|
|
1366
|
+
* Clear the cache.
|
|
1367
|
+
*
|
|
1368
|
+
* Call this when tsconfig files have changed to ensure fresh resolution.
|
|
1369
|
+
*/
|
|
1370
|
+
clear(): void;
|
|
1371
|
+
/** Get the number of cached entries. */
|
|
1372
|
+
size(): number;
|
|
1373
|
+
}
|
|
1374
|
+
type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | '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-web-worker-post';
|
|
1375
|
+
interface BindingBundleAnalyzerPluginConfig {
|
|
1376
|
+
/** Output filename for the analysis data (default: "analyze-data.json") */
|
|
1377
|
+
fileName?: string;
|
|
1378
|
+
}
|
|
1409
1379
|
interface BindingBundleState {
|
|
1410
1380
|
lastFullBuildFailed: boolean;
|
|
1411
1381
|
hasStaleOutput: boolean;
|
|
@@ -1414,6 +1384,161 @@ interface BindingClientHmrUpdate {
|
|
|
1414
1384
|
clientId: string;
|
|
1415
1385
|
update: BindingHmrUpdate;
|
|
1416
1386
|
}
|
|
1387
|
+
interface BindingCommentsOptions {
|
|
1388
|
+
legal?: boolean;
|
|
1389
|
+
annotation?: boolean;
|
|
1390
|
+
jsdoc?: boolean;
|
|
1391
|
+
}
|
|
1392
|
+
interface BindingCompilerOptions {
|
|
1393
|
+
baseUrl?: string;
|
|
1394
|
+
paths?: Record<string, Array<string>>;
|
|
1395
|
+
experimentalDecorators?: boolean;
|
|
1396
|
+
emitDecoratorMetadata?: boolean;
|
|
1397
|
+
useDefineForClassFields?: boolean;
|
|
1398
|
+
rewriteRelativeImportExtensions?: boolean;
|
|
1399
|
+
jsx?: string;
|
|
1400
|
+
jsxFactory?: string;
|
|
1401
|
+
jsxFragmentFactory?: string;
|
|
1402
|
+
jsxImportSource?: string;
|
|
1403
|
+
verbatimModuleSyntax?: boolean;
|
|
1404
|
+
preserveValueImports?: boolean;
|
|
1405
|
+
importsNotUsedAsValues?: string;
|
|
1406
|
+
target?: string;
|
|
1407
|
+
module?: string;
|
|
1408
|
+
allowJs?: boolean;
|
|
1409
|
+
rootDirs?: Array<string>;
|
|
1410
|
+
}
|
|
1411
|
+
/** Enhanced transform options with tsconfig and inputMap support. */
|
|
1412
|
+
interface BindingEnhancedTransformOptions {
|
|
1413
|
+
/** Treat the source text as 'js', 'jsx', 'ts', 'tsx', or 'dts'. */
|
|
1414
|
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
|
|
1415
|
+
/** Treat the source text as 'script', 'module', 'commonjs', or 'unambiguous'. */
|
|
1416
|
+
sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined;
|
|
1417
|
+
/**
|
|
1418
|
+
* The current working directory. Used to resolve relative paths in other
|
|
1419
|
+
* options.
|
|
1420
|
+
*/
|
|
1421
|
+
cwd?: string;
|
|
1422
|
+
/**
|
|
1423
|
+
* Enable source map generation.
|
|
1424
|
+
*
|
|
1425
|
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
|
1426
|
+
*
|
|
1427
|
+
* @default false
|
|
1428
|
+
*/
|
|
1429
|
+
sourcemap?: boolean;
|
|
1430
|
+
/** Set assumptions in order to produce smaller output. */
|
|
1431
|
+
assumptions?: CompilerAssumptions;
|
|
1432
|
+
/**
|
|
1433
|
+
* Configure how TypeScript is transformed.
|
|
1434
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
|
|
1435
|
+
*/
|
|
1436
|
+
typescript?: TypeScriptOptions;
|
|
1437
|
+
/**
|
|
1438
|
+
* Configure how TSX and JSX are transformed.
|
|
1439
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
|
|
1440
|
+
*/
|
|
1441
|
+
jsx?: 'preserve' | JsxOptions;
|
|
1442
|
+
/**
|
|
1443
|
+
* Sets the target environment for the generated JavaScript.
|
|
1444
|
+
*
|
|
1445
|
+
* The lowest target is `es2015`.
|
|
1446
|
+
*
|
|
1447
|
+
* Example:
|
|
1448
|
+
*
|
|
1449
|
+
* * `'es2015'`
|
|
1450
|
+
* * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
|
|
1451
|
+
*
|
|
1452
|
+
* @default `esnext` (No transformation)
|
|
1453
|
+
*
|
|
1454
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target}
|
|
1455
|
+
*/
|
|
1456
|
+
target?: string | Array<string>;
|
|
1457
|
+
/** Behaviour for runtime helpers. */
|
|
1458
|
+
helpers?: Helpers;
|
|
1459
|
+
/**
|
|
1460
|
+
* Define Plugin
|
|
1461
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
|
|
1462
|
+
*/
|
|
1463
|
+
define?: Record<string, string>;
|
|
1464
|
+
/**
|
|
1465
|
+
* Inject Plugin
|
|
1466
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
|
|
1467
|
+
*/
|
|
1468
|
+
inject?: Record<string, string | [string, string]>;
|
|
1469
|
+
/** Decorator plugin */
|
|
1470
|
+
decorator?: DecoratorOptions;
|
|
1471
|
+
/**
|
|
1472
|
+
* Third-party plugins to use.
|
|
1473
|
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
|
|
1474
|
+
*/
|
|
1475
|
+
plugins?: PluginsOptions;
|
|
1476
|
+
/**
|
|
1477
|
+
* Configure tsconfig handling.
|
|
1478
|
+
* - true: Auto-discover and load the nearest tsconfig.json
|
|
1479
|
+
* - TsconfigRawOptions: Use the provided inline tsconfig options
|
|
1480
|
+
*/
|
|
1481
|
+
tsconfig?: boolean | BindingTsconfigRawOptions;
|
|
1482
|
+
/** An input source map to collapse with the output source map. */
|
|
1483
|
+
inputMap?: SourceMap;
|
|
1484
|
+
}
|
|
1485
|
+
/** Result of the enhanced transform API. */
|
|
1486
|
+
interface BindingEnhancedTransformResult {
|
|
1487
|
+
/**
|
|
1488
|
+
* The transformed code.
|
|
1489
|
+
*
|
|
1490
|
+
* If parsing failed, this will be an empty string.
|
|
1491
|
+
*/
|
|
1492
|
+
code: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* The source map for the transformed code.
|
|
1495
|
+
*
|
|
1496
|
+
* This will be set if {@link BindingEnhancedTransformOptions#sourcemap} is `true`.
|
|
1497
|
+
*/
|
|
1498
|
+
map?: SourceMap;
|
|
1499
|
+
/**
|
|
1500
|
+
* The `.d.ts` declaration file for the transformed code. Declarations are
|
|
1501
|
+
* only generated if `declaration` is set to `true` and a TypeScript file
|
|
1502
|
+
* is provided.
|
|
1503
|
+
*
|
|
1504
|
+
* If parsing failed and `declaration` is set, this will be an empty string.
|
|
1505
|
+
*
|
|
1506
|
+
* @see {@link TypeScriptOptions#declaration}
|
|
1507
|
+
* @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
|
|
1508
|
+
*/
|
|
1509
|
+
declaration?: string;
|
|
1510
|
+
/**
|
|
1511
|
+
* Declaration source map. Only generated if both
|
|
1512
|
+
* {@link TypeScriptOptions#declaration declaration} and
|
|
1513
|
+
* {@link BindingEnhancedTransformOptions#sourcemap sourcemap} are set to `true`.
|
|
1514
|
+
*/
|
|
1515
|
+
declarationMap?: SourceMap;
|
|
1516
|
+
/**
|
|
1517
|
+
* Helpers used.
|
|
1518
|
+
*
|
|
1519
|
+
* @internal
|
|
1520
|
+
*
|
|
1521
|
+
* Example:
|
|
1522
|
+
*
|
|
1523
|
+
* ```text
|
|
1524
|
+
* { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
|
|
1525
|
+
* ```
|
|
1526
|
+
*/
|
|
1527
|
+
helpersUsed: Record<string, string>;
|
|
1528
|
+
/** Parse and transformation errors. */
|
|
1529
|
+
errors: Array<BindingError>;
|
|
1530
|
+
/** Parse and transformation warnings. */
|
|
1531
|
+
warnings: Array<BindingError>;
|
|
1532
|
+
/** Paths to tsconfig files that were loaded during transformation. */
|
|
1533
|
+
tsconfigFilePaths: Array<string>;
|
|
1534
|
+
}
|
|
1535
|
+
type BindingError = {
|
|
1536
|
+
type: 'JsError';
|
|
1537
|
+
field0: Error;
|
|
1538
|
+
} | {
|
|
1539
|
+
type: 'NativeError';
|
|
1540
|
+
field0: NativeError;
|
|
1541
|
+
};
|
|
1417
1542
|
interface BindingEsmExternalRequirePluginConfig {
|
|
1418
1543
|
external: Array<BindingStringOrRegex>;
|
|
1419
1544
|
skipDuplicateCheck?: boolean;
|
|
@@ -1452,6 +1577,13 @@ interface BindingHookResolveIdExtraArgs {
|
|
|
1452
1577
|
interface BindingIsolatedDeclarationPluginConfig {
|
|
1453
1578
|
stripInternal?: boolean;
|
|
1454
1579
|
}
|
|
1580
|
+
interface BindingLogLocation {
|
|
1581
|
+
/** 1-based */
|
|
1582
|
+
line: number;
|
|
1583
|
+
/** 0-based position in the line in UTF-16 code units */
|
|
1584
|
+
column: number;
|
|
1585
|
+
file?: string;
|
|
1586
|
+
}
|
|
1455
1587
|
interface BindingMagicStringOptions {
|
|
1456
1588
|
filename?: string;
|
|
1457
1589
|
}
|
|
@@ -1521,6 +1653,54 @@ interface BindingSourceMapOptions {
|
|
|
1521
1653
|
interface BindingTransformHookExtraArgs {
|
|
1522
1654
|
moduleType: string;
|
|
1523
1655
|
}
|
|
1656
|
+
interface BindingTsconfig {
|
|
1657
|
+
files?: Array<string>;
|
|
1658
|
+
include?: Array<string>;
|
|
1659
|
+
exclude?: Array<string>;
|
|
1660
|
+
compilerOptions: BindingCompilerOptions;
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* TypeScript compiler options for inline tsconfig configuration.
|
|
1664
|
+
*
|
|
1665
|
+
* @category Utilities
|
|
1666
|
+
*/
|
|
1667
|
+
interface BindingTsconfigCompilerOptions {
|
|
1668
|
+
/** Specifies the JSX factory function to use. */
|
|
1669
|
+
jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve' | 'react-native';
|
|
1670
|
+
/** Specifies the JSX factory function. */
|
|
1671
|
+
jsxFactory?: string;
|
|
1672
|
+
/** Specifies the JSX fragment factory function. */
|
|
1673
|
+
jsxFragmentFactory?: string;
|
|
1674
|
+
/** Specifies the module specifier for JSX imports. */
|
|
1675
|
+
jsxImportSource?: string;
|
|
1676
|
+
/** Enables experimental decorators. */
|
|
1677
|
+
experimentalDecorators?: boolean;
|
|
1678
|
+
/** Enables decorator metadata emission. */
|
|
1679
|
+
emitDecoratorMetadata?: boolean;
|
|
1680
|
+
/** Preserves module structure of imports/exports. */
|
|
1681
|
+
verbatimModuleSyntax?: boolean;
|
|
1682
|
+
/** Configures how class fields are emitted. */
|
|
1683
|
+
useDefineForClassFields?: boolean;
|
|
1684
|
+
/** The ECMAScript target version. */
|
|
1685
|
+
target?: string;
|
|
1686
|
+
/** @deprecated Use verbatimModuleSyntax instead. */
|
|
1687
|
+
preserveValueImports?: boolean;
|
|
1688
|
+
/** @deprecated Use verbatimModuleSyntax instead. */
|
|
1689
|
+
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error';
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Raw tsconfig options for inline configuration.
|
|
1693
|
+
*
|
|
1694
|
+
* @category Utilities
|
|
1695
|
+
*/
|
|
1696
|
+
interface BindingTsconfigRawOptions {
|
|
1697
|
+
/** TypeScript compiler options. */
|
|
1698
|
+
compilerOptions?: BindingTsconfigCompilerOptions;
|
|
1699
|
+
}
|
|
1700
|
+
interface BindingTsconfigResult {
|
|
1701
|
+
tsconfig: BindingTsconfig;
|
|
1702
|
+
tsconfigFilePaths: Array<string>;
|
|
1703
|
+
}
|
|
1524
1704
|
interface BindingViteBuildImportAnalysisPluginConfig {
|
|
1525
1705
|
preloadCode: string;
|
|
1526
1706
|
insertPreload: boolean;
|
|
@@ -1579,9 +1759,9 @@ interface BindingViteReporterPluginConfig {
|
|
|
1579
1759
|
isLib: boolean;
|
|
1580
1760
|
assetsDir: string;
|
|
1581
1761
|
chunkLimit: number;
|
|
1582
|
-
shouldLogInfo: boolean;
|
|
1583
1762
|
warnLargeChunks: boolean;
|
|
1584
1763
|
reportCompressedSize: boolean;
|
|
1764
|
+
logInfo?: (msg: string) => void;
|
|
1585
1765
|
}
|
|
1586
1766
|
interface BindingViteResolvePluginConfig {
|
|
1587
1767
|
resolveOptions: BindingViteResolvePluginResolveOptions;
|
|
@@ -1628,21 +1808,24 @@ interface BindingViteTransformPluginConfig {
|
|
|
1628
1808
|
transformOptions?: TransformOptions;
|
|
1629
1809
|
yarnPnp?: boolean;
|
|
1630
1810
|
}
|
|
1631
|
-
interface BindingViteWasmHelperPluginConfig {
|
|
1632
|
-
decodedBase: string;
|
|
1633
|
-
v2?: BindingViteWasmHelperPluginV2Config;
|
|
1634
|
-
}
|
|
1635
|
-
interface BindingViteWasmHelperPluginV2Config {
|
|
1636
|
-
root: string;
|
|
1637
|
-
isLib: boolean;
|
|
1638
|
-
publicDir: string;
|
|
1639
|
-
assetInlineLimit: number | ((file: string, content: Buffer) => boolean | undefined);
|
|
1640
|
-
}
|
|
1641
1811
|
declare function createTokioRuntime(blockingThreads?: number | undefined | null): void;
|
|
1642
1812
|
interface ExternalMemoryStatus {
|
|
1643
1813
|
freed: boolean;
|
|
1644
1814
|
reason?: string;
|
|
1645
1815
|
}
|
|
1816
|
+
/** Error emitted from native side, it only contains kind and message, no stack trace. */
|
|
1817
|
+
interface NativeError {
|
|
1818
|
+
kind: string;
|
|
1819
|
+
message: string;
|
|
1820
|
+
/** The id of the file associated with the error */
|
|
1821
|
+
id?: string;
|
|
1822
|
+
/** The exporter associated with the error (for import/export errors) */
|
|
1823
|
+
exporter?: string;
|
|
1824
|
+
/** Location information (line, column, file) */
|
|
1825
|
+
loc?: BindingLogLocation;
|
|
1826
|
+
/** Position in the source file in UTF-16 code units */
|
|
1827
|
+
pos?: number;
|
|
1828
|
+
}
|
|
1646
1829
|
interface PreRenderedChunk {
|
|
1647
1830
|
/** The name of this chunk, which is used in naming patterns. */
|
|
1648
1831
|
name: string;
|
|
@@ -1657,8 +1840,10 @@ interface PreRenderedChunk {
|
|
|
1657
1840
|
/** Exported variable names from this chunk. */
|
|
1658
1841
|
exports: Array<string>;
|
|
1659
1842
|
}
|
|
1843
|
+
/** @hidden This is only expected to be used by Vite */
|
|
1844
|
+
declare function resolveTsconfig(filename: string, cache?: TsconfigCache | undefined | null): BindingTsconfigResult | null;
|
|
1660
1845
|
interface ViteImportGlobMeta {
|
|
1661
1846
|
isSubImportsPattern?: boolean;
|
|
1662
1847
|
}
|
|
1663
1848
|
//#endregion
|
|
1664
|
-
export {
|
|
1849
|
+
export { IsolatedDeclarationsOptions as A, ResolverFactory as B, BindingViteModulePreloadPolyfillPluginConfig as C, BindingViteTransformPluginConfig as D, BindingViteResolvePluginConfig as E, NapiResolveOptions as F, isolatedDeclaration as G, TransformOptions as H, ParseResult as I, resolveTsconfig as J, isolatedDeclarationSync as K, ParserOptions as L, JsxOptions as M, MinifyOptions as N, BindingWatcherBundler as O, MinifyResult as P, PreRenderedChunk as R, BindingViteManifestPluginConfig as S, BindingViteReporterPluginConfig as T, TsconfigCache as U, SourceMap as V, createTokioRuntime as W, BindingTsconfigRawOptions as _, BindingEnhancedTransformOptions as a, BindingViteImportGlobPluginConfig as b, BindingHookResolveIdExtraArgs as c, BindingPluginContextResolveOptions as d, BindingRebuildStrategy as f, BindingTsconfigCompilerOptions as g, BindingTransformHookExtraArgs as h, BindingClientHmrUpdate as i, IsolatedDeclarationsResult as j, ExternalMemoryStatus as k, BindingIsolatedDeclarationPluginConfig as l, BindingReplacePluginConfig as m, BindingBundleAnalyzerPluginConfig as n, BindingEnhancedTransformResult as o, BindingRenderedChunk as p, moduleRunnerTransform as q, BindingBundleState as r, BindingEsmExternalRequirePluginConfig as s, BindingBuiltinPluginName as t, BindingMagicString as u, BindingViteBuildImportAnalysisPluginConfig as v, BindingViteReactRefreshWrapperPluginConfig as w, BindingViteJsonPluginConfig as x, BindingViteDynamicImportVarsPluginConfig as y, ResolveResult as z };
|