rolldown 1.0.0-beta.7-commit.46fbc61 → 1.0.0-beta.7-commit.b80d472
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.cjs +78 -13
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +79 -14
- package/dist/experimental-index.cjs +1 -1
- package/dist/experimental-index.d.cts +65 -0
- package/dist/experimental-index.d.mts +65 -0
- package/dist/experimental-index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +1 -1
- package/dist/parallel-plugin-worker.cjs +1 -1
- package/dist/parallel-plugin-worker.d.cts +1 -0
- package/dist/parallel-plugin-worker.d.mts +1 -0
- package/dist/parallel-plugin-worker.mjs +1 -1
- package/dist/parallel-plugin.d.cts +15 -0
- package/dist/parallel-plugin.d.mts +15 -0
- package/dist/parse-ast-index.d.cts +9 -0
- package/dist/parse-ast-index.d.mts +9 -0
- package/dist/shared/binding.d-CJ9AePJ7.d.cts +789 -0
- package/dist/shared/binding.d-jRGZ_qiz.d.mts +789 -0
- package/dist/shared/input-options.d-0CaiVwOO.d.cts +1046 -0
- package/dist/shared/input-options.d-6gWWIKa5.d.mts +1046 -0
- package/dist/shared/{src-Ca98NyM6.mjs → src-Cgiazi-7.mjs} +70 -3
- package/dist/shared/{src-CbcfNaXm.cjs → src-DiHrbNiz.cjs} +66 -3
- package/package.json +16 -20
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/api/build.d.ts +0 -18
- package/dist/types/api/experimental.d.ts +0 -7
- package/dist/types/api/rolldown/index.d.ts +0 -3
- package/dist/types/api/rolldown/rolldown-build.d.ts +0 -15
- package/dist/types/api/watch/index.d.ts +0 -3
- package/dist/types/api/watch/watch-emitter.d.ts +0 -31
- package/dist/types/api/watch/watcher.d.ts +0 -13
- package/dist/types/binding.d.ts +0 -1507
- package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
- package/dist/types/builtin-plugin/constructors.d.ts +0 -23
- package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -27
- package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
- package/dist/types/builtin-plugin/utils.d.ts +0 -8
- package/dist/types/cli/arguments/alias.d.ts +0 -16
- package/dist/types/cli/arguments/index.d.ts +0 -15
- package/dist/types/cli/arguments/normalize.d.ts +0 -16
- package/dist/types/cli/arguments/utils.d.ts +0 -8
- package/dist/types/cli/commands/bundle.d.ts +0 -3
- package/dist/types/cli/commands/help.d.ts +0 -1
- package/dist/types/cli/index.d.ts +0 -1
- package/dist/types/cli/load-config.d.ts +0 -5
- package/dist/types/cli/logger.d.ts +0 -5
- package/dist/types/constants/plugin-context.d.ts +0 -7
- package/dist/types/constants/plugin.d.ts +0 -45
- package/dist/types/experimental-index.d.ts +0 -9
- package/dist/types/index.d.ts +0 -31
- package/dist/types/log/log-handler.d.ts +0 -4
- package/dist/types/log/logger.d.ts +0 -6
- package/dist/types/log/logging.d.ts +0 -12
- package/dist/types/log/logs.d.ts +0 -18
- package/dist/types/options/generated/checks-options.d.ts +0 -57
- package/dist/types/options/input-options.d.ts +0 -185
- package/dist/types/options/normalized-input-options.d.ts +0 -18
- package/dist/types/options/normalized-output-options.d.ts +0 -70
- package/dist/types/options/output-options.d.ts +0 -182
- package/dist/types/options/watch-options.d.ts +0 -5
- package/dist/types/parallel-plugin-worker.d.ts +0 -1
- package/dist/types/parallel-plugin.d.ts +0 -1
- package/dist/types/parse-ast-index.d.ts +0 -5
- package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
- package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
- package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
- package/dist/types/plugin/bindingify-plugin.d.ts +0 -17
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
- package/dist/types/plugin/generated/hook-usage.d.ts +0 -29
- package/dist/types/plugin/hook-filter.d.ts +0 -49
- package/dist/types/plugin/index.d.ts +0 -141
- package/dist/types/plugin/minimal-plugin-context.d.ts +0 -24
- package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
- package/dist/types/plugin/parallel-plugin.d.ts +0 -9
- package/dist/types/plugin/plugin-context-data.d.ts +0 -22
- package/dist/types/plugin/plugin-context.d.ts +0 -67
- package/dist/types/plugin/plugin-driver.d.ts +0 -10
- package/dist/types/plugin/transform-plugin-context.d.ts +0 -28
- package/dist/types/plugin/with-filter.d.ts +0 -10
- package/dist/types/types/assert.d.ts +0 -14
- package/dist/types/types/config-export.d.ts +0 -5
- package/dist/types/types/misc.d.ts +0 -40
- package/dist/types/types/module-info.d.ts +0 -15
- package/dist/types/types/module-side-effects.d.ts +0 -12
- package/dist/types/types/output-bundle.d.ts +0 -4
- package/dist/types/types/rolldown-options.d.ts +0 -5
- package/dist/types/types/rolldown-output.d.ts +0 -66
- package/dist/types/types/schema.d.ts +0 -33
- package/dist/types/types/sourcemap.d.ts +0 -14
- package/dist/types/types/utils.d.ts +0 -13
- package/dist/types/types.d.ts +0 -7
- package/dist/types/utils/asset-source.d.ts +0 -4
- package/dist/types/utils/async-flatten.d.ts +0 -1
- package/dist/types/utils/bindingify-input-options.d.ts +0 -7
- package/dist/types/utils/bindingify-output-options.d.ts +0 -5
- package/dist/types/utils/code-frame.d.ts +0 -1
- package/dist/types/utils/compose-js-plugins.d.ts +0 -2
- package/dist/types/utils/create-bundler-option.d.ts +0 -11
- package/dist/types/utils/create-bundler.d.ts +0 -9
- package/dist/types/utils/define-config.d.ts +0 -5
- package/dist/types/utils/error.d.ts +0 -2
- package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -17
- package/dist/types/utils/misc.d.ts +0 -7
- package/dist/types/utils/normalize-hook.d.ts +0 -7
- package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
- package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
- package/dist/types/utils/plugin/index.d.ts +0 -2
- package/dist/types/utils/resolved-external.d.ts +0 -4
- package/dist/types/utils/transform-module-info.d.ts +0 -4
- package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
- package/dist/types/utils/transform-rendered-module.d.ts +0 -3
- package/dist/types/utils/transform-side-effects.d.ts +0 -3
- package/dist/types/utils/transform-sourcemap.d.ts +0 -3
- package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
- package/dist/types/utils/validator.d.ts +0 -6
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
import { Program } from "@oxc-project/types";
|
|
2
|
+
|
|
3
|
+
//#region src/binding.d.ts
|
|
4
|
+
type VoidNullable<T = void> = T | null | undefined | void
|
|
5
|
+
type BindingStringOrRegex = string | RegExp
|
|
6
|
+
declare class BindingBundleEndEventData {
|
|
7
|
+
output: string
|
|
8
|
+
duration: number
|
|
9
|
+
}
|
|
10
|
+
declare class BindingError {
|
|
11
|
+
kind: string
|
|
12
|
+
message: string
|
|
13
|
+
}
|
|
14
|
+
declare class BindingRenderedChunk {
|
|
15
|
+
get name(): string
|
|
16
|
+
get isEntry(): boolean
|
|
17
|
+
get isDynamicEntry(): boolean
|
|
18
|
+
get facadeModuleId(): string | null
|
|
19
|
+
get moduleIds(): Array<string>
|
|
20
|
+
get exports(): Array<string>
|
|
21
|
+
get fileName(): string
|
|
22
|
+
get modules(): BindingModules
|
|
23
|
+
get imports(): Array<string>
|
|
24
|
+
get dynamicImports(): Array<string>
|
|
25
|
+
}
|
|
26
|
+
declare class BindingRenderedModule {
|
|
27
|
+
get code(): string | null
|
|
28
|
+
get renderedExports(): Array<string>
|
|
29
|
+
}
|
|
30
|
+
declare class BindingWatcherChangeData {
|
|
31
|
+
path: string
|
|
32
|
+
kind: string
|
|
33
|
+
}
|
|
34
|
+
declare class BindingWatcherEvent {
|
|
35
|
+
eventKind(): string
|
|
36
|
+
watchChangeData(): BindingWatcherChangeData
|
|
37
|
+
bundleEndData(): BindingBundleEndEventData
|
|
38
|
+
bundleEventKind(): string
|
|
39
|
+
errors(): Array<Error | BindingError>
|
|
40
|
+
}
|
|
41
|
+
declare class ParseResult {
|
|
42
|
+
get program(): Program
|
|
43
|
+
get module(): EcmaScriptModule
|
|
44
|
+
get comments(): Array<Comment>
|
|
45
|
+
get errors(): Array<OxcError>
|
|
46
|
+
}
|
|
47
|
+
interface BindingBuildImportAnalysisPluginConfig {
|
|
48
|
+
preloadCode: string
|
|
49
|
+
insertPreload: boolean
|
|
50
|
+
optimizeModulePreloadRelativePaths: boolean
|
|
51
|
+
renderBuiltUrl: boolean
|
|
52
|
+
isRelativeBase: boolean
|
|
53
|
+
}
|
|
54
|
+
type BindingBuiltinPluginName = 'builtin:wasm-helper'|
|
|
55
|
+
'builtin:import-glob'|
|
|
56
|
+
'builtin:dynamic-import-vars'|
|
|
57
|
+
'builtin:module-preload-polyfill'|
|
|
58
|
+
'builtin:manifest'|
|
|
59
|
+
'builtin:load-fallback'|
|
|
60
|
+
'builtin:transform'|
|
|
61
|
+
'builtin:wasm-fallback'|
|
|
62
|
+
'builtin:alias'|
|
|
63
|
+
'builtin:json'|
|
|
64
|
+
'builtin:build-import-analysis'|
|
|
65
|
+
'builtin:replace'|
|
|
66
|
+
'builtin:vite-resolve'|
|
|
67
|
+
'builtin:module-federation'|
|
|
68
|
+
'builtin:isolated-declaration'|
|
|
69
|
+
'builtin:report';
|
|
70
|
+
interface BindingGlobImportPluginConfig {
|
|
71
|
+
root?: string
|
|
72
|
+
restoreQueryExtension?: boolean
|
|
73
|
+
}
|
|
74
|
+
interface BindingHmrBoundaryOutput {
|
|
75
|
+
boundary: string
|
|
76
|
+
acceptedVia: string
|
|
77
|
+
}
|
|
78
|
+
interface BindingHmrOutput {
|
|
79
|
+
patch: string
|
|
80
|
+
hmrBoundaries: Array<BindingHmrBoundaryOutput>
|
|
81
|
+
}
|
|
82
|
+
interface BindingHookResolveIdExtraArgs {
|
|
83
|
+
custom?: number
|
|
84
|
+
isEntry: boolean
|
|
85
|
+
kind: 'import' | 'dynamic-import' | 'require-call'
|
|
86
|
+
}
|
|
87
|
+
interface BindingIsolatedDeclarationPluginConfig {
|
|
88
|
+
stripInternal?: boolean
|
|
89
|
+
}
|
|
90
|
+
interface BindingJsonPluginConfig {
|
|
91
|
+
minify?: boolean
|
|
92
|
+
namedExports?: boolean
|
|
93
|
+
stringify?: BindingJsonPluginStringify
|
|
94
|
+
}
|
|
95
|
+
type BindingJsonPluginStringify =
|
|
96
|
+
boolean | string
|
|
97
|
+
interface BindingManifestPluginConfig {
|
|
98
|
+
root: string
|
|
99
|
+
outPath: string
|
|
100
|
+
}
|
|
101
|
+
interface BindingMfManifest {
|
|
102
|
+
filePath?: string
|
|
103
|
+
disableAssetsAnalyze?: boolean
|
|
104
|
+
fileName?: string
|
|
105
|
+
}
|
|
106
|
+
interface BindingMinifyOptions {
|
|
107
|
+
mangle: boolean
|
|
108
|
+
compress: boolean
|
|
109
|
+
removeWhitespace: boolean
|
|
110
|
+
}
|
|
111
|
+
interface BindingModuleFederationPluginOption {
|
|
112
|
+
name: string
|
|
113
|
+
filename?: string
|
|
114
|
+
exposes?: Record<string, string>
|
|
115
|
+
remotes?: Array<BindingRemote>
|
|
116
|
+
shared?: Record<string, BindingShared>
|
|
117
|
+
runtimePlugins?: Array<string>
|
|
118
|
+
manifest?: BindingMfManifest
|
|
119
|
+
getPublicPath?: string
|
|
120
|
+
}
|
|
121
|
+
interface BindingModulePreloadPolyfillPluginConfig {
|
|
122
|
+
skip?: boolean
|
|
123
|
+
}
|
|
124
|
+
interface BindingModules {
|
|
125
|
+
values: Array<BindingRenderedModule>
|
|
126
|
+
keys: Array<string>
|
|
127
|
+
}
|
|
128
|
+
interface BindingRemote {
|
|
129
|
+
type?: string
|
|
130
|
+
entry: string
|
|
131
|
+
name: string
|
|
132
|
+
entryGlobalName?: string
|
|
133
|
+
shareScope?: string
|
|
134
|
+
}
|
|
135
|
+
interface BindingReplacePluginConfig {
|
|
136
|
+
values: Record<string, string>
|
|
137
|
+
delimiters?: [string, string]
|
|
138
|
+
preventAssignment?: boolean
|
|
139
|
+
objectGuards?: boolean
|
|
140
|
+
sourcemap?: boolean
|
|
141
|
+
}
|
|
142
|
+
interface BindingReportPluginConfig {
|
|
143
|
+
isTty: boolean
|
|
144
|
+
}
|
|
145
|
+
interface BindingShared {
|
|
146
|
+
version?: string
|
|
147
|
+
shareScope?: string
|
|
148
|
+
singleton?: boolean
|
|
149
|
+
requiredVersion?: string
|
|
150
|
+
strictVersion?: boolean
|
|
151
|
+
}
|
|
152
|
+
interface BindingTransformHookExtraArgs {
|
|
153
|
+
moduleType: string
|
|
154
|
+
}
|
|
155
|
+
interface BindingTransformPluginConfig {
|
|
156
|
+
include?: Array<BindingStringOrRegex>
|
|
157
|
+
exclude?: Array<BindingStringOrRegex>
|
|
158
|
+
jsxRefreshInclude?: Array<BindingStringOrRegex>
|
|
159
|
+
jsxRefreshExclude?: Array<BindingStringOrRegex>
|
|
160
|
+
isServerConsumer?: boolean
|
|
161
|
+
runtimeResolveBase?: string
|
|
162
|
+
jsxInject?: string
|
|
163
|
+
transformOptions?: TransformOptions
|
|
164
|
+
}
|
|
165
|
+
interface BindingViteResolvePluginConfig {
|
|
166
|
+
resolveOptions: BindingViteResolvePluginResolveOptions
|
|
167
|
+
environmentConsumer: string
|
|
168
|
+
environmentName: string
|
|
169
|
+
external: true | string[]
|
|
170
|
+
noExternal: true | Array<string | RegExp>
|
|
171
|
+
dedupe: Array<string>
|
|
172
|
+
finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
|
|
173
|
+
finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
|
|
174
|
+
runtime: string
|
|
175
|
+
}
|
|
176
|
+
interface BindingViteResolvePluginResolveOptions {
|
|
177
|
+
isBuild: boolean
|
|
178
|
+
isProduction: boolean
|
|
179
|
+
asSrc: boolean
|
|
180
|
+
preferRelative: boolean
|
|
181
|
+
isRequire?: boolean
|
|
182
|
+
root: string
|
|
183
|
+
scan: boolean
|
|
184
|
+
mainFields: Array<string>
|
|
185
|
+
conditions: Array<string>
|
|
186
|
+
externalConditions: Array<string>
|
|
187
|
+
extensions: Array<string>
|
|
188
|
+
tryIndex: boolean
|
|
189
|
+
tryPrefix?: string
|
|
190
|
+
preserveSymlinks: boolean
|
|
191
|
+
}
|
|
192
|
+
interface Comment {
|
|
193
|
+
type: 'Line' | 'Block'
|
|
194
|
+
value: string
|
|
195
|
+
start: number
|
|
196
|
+
end: number
|
|
197
|
+
}
|
|
198
|
+
interface CompilerAssumptions {
|
|
199
|
+
ignoreFunctionLength?: boolean
|
|
200
|
+
noDocumentAll?: boolean
|
|
201
|
+
objectRestNoSymbols?: boolean
|
|
202
|
+
pureGetters?: boolean
|
|
203
|
+
setPublicClassFields?: boolean
|
|
204
|
+
}
|
|
205
|
+
interface DecoratorOptions {
|
|
206
|
+
/**
|
|
207
|
+
* Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
|
|
208
|
+
*
|
|
209
|
+
* Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
|
|
210
|
+
* This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
|
|
211
|
+
*
|
|
212
|
+
* @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
|
|
213
|
+
* @default false
|
|
214
|
+
*/
|
|
215
|
+
legacy?: boolean
|
|
216
|
+
/**
|
|
217
|
+
* Enables emitting decorator metadata.
|
|
218
|
+
*
|
|
219
|
+
* This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
|
|
220
|
+
* in TypeScript, and it only works when `legacy` is true.
|
|
221
|
+
*
|
|
222
|
+
* @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
|
|
223
|
+
* @default false
|
|
224
|
+
*/
|
|
225
|
+
emitDecoratorMetadata?: boolean
|
|
226
|
+
}
|
|
227
|
+
interface DynamicImport {
|
|
228
|
+
start: number
|
|
229
|
+
end: number
|
|
230
|
+
moduleRequest: Span
|
|
231
|
+
}
|
|
232
|
+
interface EcmaScriptModule {
|
|
233
|
+
/**
|
|
234
|
+
* Has ESM syntax.
|
|
235
|
+
*
|
|
236
|
+
* i.e. `import` and `export` statements, and `import.meta`.
|
|
237
|
+
*
|
|
238
|
+
* Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
|
|
239
|
+
*/
|
|
240
|
+
hasModuleSyntax: boolean
|
|
241
|
+
/** Import statements. */
|
|
242
|
+
staticImports: Array<StaticImport>
|
|
243
|
+
/** Export statements. */
|
|
244
|
+
staticExports: Array<StaticExport>
|
|
245
|
+
/** Dynamic import expressions. */
|
|
246
|
+
dynamicImports: Array<DynamicImport>
|
|
247
|
+
/** Span positions` of `import.meta` */
|
|
248
|
+
importMetas: Array<Span>
|
|
249
|
+
}
|
|
250
|
+
interface ErrorLabel {
|
|
251
|
+
message?: string
|
|
252
|
+
start: number
|
|
253
|
+
end: number
|
|
254
|
+
}
|
|
255
|
+
interface ExportExportName {
|
|
256
|
+
kind: ExportExportNameKind
|
|
257
|
+
name?: string
|
|
258
|
+
start?: number
|
|
259
|
+
end?: number
|
|
260
|
+
}
|
|
261
|
+
type ExportExportNameKind = /** `export { name } */
|
|
262
|
+
'Name'|
|
|
263
|
+
/** `export default expression` */
|
|
264
|
+
'Default'|
|
|
265
|
+
/** `export * from "mod" */
|
|
266
|
+
'None';
|
|
267
|
+
interface ExportImportName {
|
|
268
|
+
kind: ExportImportNameKind
|
|
269
|
+
name?: string
|
|
270
|
+
start?: number
|
|
271
|
+
end?: number
|
|
272
|
+
}
|
|
273
|
+
type ExportImportNameKind = /** `export { name } */
|
|
274
|
+
'Name'|
|
|
275
|
+
/** `export * as ns from "mod"` */
|
|
276
|
+
'All'|
|
|
277
|
+
/** `export * from "mod"` */
|
|
278
|
+
'AllButDefault'|
|
|
279
|
+
/** Does not have a specifier. */
|
|
280
|
+
'None';
|
|
281
|
+
interface ExportLocalName {
|
|
282
|
+
kind: ExportLocalNameKind
|
|
283
|
+
name?: string
|
|
284
|
+
start?: number
|
|
285
|
+
end?: number
|
|
286
|
+
}
|
|
287
|
+
type ExportLocalNameKind = /** `export { name } */
|
|
288
|
+
'Name'|
|
|
289
|
+
/** `export default expression` */
|
|
290
|
+
'Default'|
|
|
291
|
+
/**
|
|
292
|
+
* If the exported value is not locally accessible from within the module.
|
|
293
|
+
* `export default function () {}`
|
|
294
|
+
*/
|
|
295
|
+
'None';
|
|
296
|
+
type HelperMode = /**
|
|
297
|
+
* Runtime mode (default): Helper functions are imported from a runtime package.
|
|
298
|
+
*
|
|
299
|
+
* Example:
|
|
300
|
+
*
|
|
301
|
+
* ```js
|
|
302
|
+
* import helperName from "@oxc-project/runtime/helpers/helperName";
|
|
303
|
+
* helperName(...arguments);
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
'Runtime'|
|
|
307
|
+
/**
|
|
308
|
+
* External mode: Helper functions are accessed from a global `babelHelpers` object.
|
|
309
|
+
*
|
|
310
|
+
* Example:
|
|
311
|
+
*
|
|
312
|
+
* ```js
|
|
313
|
+
* babelHelpers.helperName(...arguments);
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
'External';
|
|
317
|
+
interface Helpers {
|
|
318
|
+
mode?: HelperMode
|
|
319
|
+
}
|
|
320
|
+
interface ImportName {
|
|
321
|
+
kind: ImportNameKind
|
|
322
|
+
name?: string
|
|
323
|
+
start?: number
|
|
324
|
+
end?: number
|
|
325
|
+
}
|
|
326
|
+
type ImportNameKind = /** `import { x } from "mod"` */
|
|
327
|
+
'Name'|
|
|
328
|
+
/** `import * as ns from "mod"` */
|
|
329
|
+
'NamespaceObject'|
|
|
330
|
+
/** `import defaultExport from "mod"` */
|
|
331
|
+
'Default';
|
|
332
|
+
interface IsolatedDeclarationsOptions {
|
|
333
|
+
/**
|
|
334
|
+
* Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
|
|
335
|
+
* This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
|
|
336
|
+
*
|
|
337
|
+
* Default: `false`
|
|
338
|
+
*
|
|
339
|
+
* See <https://www.typescriptlang.org/tsconfig/#stripInternal>
|
|
340
|
+
*/
|
|
341
|
+
stripInternal?: boolean
|
|
342
|
+
sourcemap?: boolean
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Configure how TSX and JSX are transformed.
|
|
346
|
+
*
|
|
347
|
+
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
|
|
348
|
+
*/
|
|
349
|
+
interface JsxOptions {
|
|
350
|
+
/**
|
|
351
|
+
* Decides which runtime to use.
|
|
352
|
+
*
|
|
353
|
+
* - 'automatic' - auto-import the correct JSX factories
|
|
354
|
+
* - 'classic' - no auto-import
|
|
355
|
+
*
|
|
356
|
+
* @default 'automatic'
|
|
357
|
+
*/
|
|
358
|
+
runtime?: 'classic' | 'automatic'
|
|
359
|
+
/**
|
|
360
|
+
* Emit development-specific information, such as `__source` and `__self`.
|
|
361
|
+
*
|
|
362
|
+
* @default false
|
|
363
|
+
*
|
|
364
|
+
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
|
|
365
|
+
*/
|
|
366
|
+
development?: boolean
|
|
367
|
+
/**
|
|
368
|
+
* Toggles whether or not to throw an error if an XML namespaced tag name
|
|
369
|
+
* is used.
|
|
370
|
+
*
|
|
371
|
+
* Though the JSX spec allows this, it is disabled by default since React's
|
|
372
|
+
* JSX does not currently have support for it.
|
|
373
|
+
*
|
|
374
|
+
* @default true
|
|
375
|
+
*/
|
|
376
|
+
throwIfNamespace?: boolean
|
|
377
|
+
/**
|
|
378
|
+
* Enables `@babel/plugin-transform-react-pure-annotations`.
|
|
379
|
+
*
|
|
380
|
+
* It will mark top-level React method calls as pure for tree shaking.
|
|
381
|
+
*
|
|
382
|
+
* @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
|
|
383
|
+
*
|
|
384
|
+
* @default true
|
|
385
|
+
*/
|
|
386
|
+
pure?: boolean
|
|
387
|
+
/**
|
|
388
|
+
* Replaces the import source when importing functions.
|
|
389
|
+
*
|
|
390
|
+
* @default 'react'
|
|
391
|
+
*/
|
|
392
|
+
importSource?: string
|
|
393
|
+
/**
|
|
394
|
+
* Replace the function used when compiling JSX expressions. It should be a
|
|
395
|
+
* qualified name (e.g. `React.createElement`) or an identifier (e.g.
|
|
396
|
+
* `createElement`).
|
|
397
|
+
*
|
|
398
|
+
* Only used for `classic` {@link runtime}.
|
|
399
|
+
*
|
|
400
|
+
* @default 'React.createElement'
|
|
401
|
+
*/
|
|
402
|
+
pragma?: string
|
|
403
|
+
/**
|
|
404
|
+
* Replace the component used when compiling JSX fragments. It should be a
|
|
405
|
+
* valid JSX tag name.
|
|
406
|
+
*
|
|
407
|
+
* Only used for `classic` {@link runtime}.
|
|
408
|
+
*
|
|
409
|
+
* @default 'React.Fragment'
|
|
410
|
+
*/
|
|
411
|
+
pragmaFrag?: string
|
|
412
|
+
/**
|
|
413
|
+
* When spreading props, use `Object.assign` directly instead of an extend helper.
|
|
414
|
+
*
|
|
415
|
+
* Only used for `classic` {@link runtime}.
|
|
416
|
+
*
|
|
417
|
+
* @default false
|
|
418
|
+
*/
|
|
419
|
+
useBuiltIns?: boolean
|
|
420
|
+
/**
|
|
421
|
+
* When spreading props, use inline object with spread elements directly
|
|
422
|
+
* instead of an extend helper or Object.assign.
|
|
423
|
+
*
|
|
424
|
+
* Only used for `classic` {@link runtime}.
|
|
425
|
+
*
|
|
426
|
+
* @default false
|
|
427
|
+
*/
|
|
428
|
+
useSpread?: boolean
|
|
429
|
+
/**
|
|
430
|
+
* Enable React Fast Refresh .
|
|
431
|
+
*
|
|
432
|
+
* Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
|
|
433
|
+
*
|
|
434
|
+
* @default false
|
|
435
|
+
*/
|
|
436
|
+
refresh?: boolean | ReactRefreshOptions
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Transform JavaScript code to a Vite Node runnable module.
|
|
440
|
+
*
|
|
441
|
+
* @param filename The name of the file being transformed.
|
|
442
|
+
* @param sourceText the source code itself
|
|
443
|
+
* @param options The options for the transformation. See {@link
|
|
444
|
+
* ModuleRunnerTransformOptions} for more information.
|
|
445
|
+
*
|
|
446
|
+
* @returns an object containing the transformed code, source maps, and any
|
|
447
|
+
* errors that occurred during parsing or transformation.
|
|
448
|
+
*
|
|
449
|
+
* @deprecated Only works for Vite.
|
|
450
|
+
*/
|
|
451
|
+
declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): ModuleRunnerTransformResult
|
|
452
|
+
interface ModuleRunnerTransformOptions {
|
|
453
|
+
/**
|
|
454
|
+
* Enable source map generation.
|
|
455
|
+
*
|
|
456
|
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
|
457
|
+
*
|
|
458
|
+
* @default false
|
|
459
|
+
*
|
|
460
|
+
* @see {@link SourceMap}
|
|
461
|
+
*/
|
|
462
|
+
sourcemap?: boolean
|
|
463
|
+
}
|
|
464
|
+
interface ModuleRunnerTransformResult {
|
|
465
|
+
/**
|
|
466
|
+
* The transformed code.
|
|
467
|
+
*
|
|
468
|
+
* If parsing failed, this will be an empty string.
|
|
469
|
+
*/
|
|
470
|
+
code: string
|
|
471
|
+
/**
|
|
472
|
+
* The source map for the transformed code.
|
|
473
|
+
*
|
|
474
|
+
* This will be set if {@link TransformOptions#sourcemap} is `true`.
|
|
475
|
+
*/
|
|
476
|
+
map?: SourceMap
|
|
477
|
+
deps: Array<string>
|
|
478
|
+
dynamicDeps: Array<string>
|
|
479
|
+
/**
|
|
480
|
+
* Parse and transformation errors.
|
|
481
|
+
*
|
|
482
|
+
* Oxc's parser recovers from common syntax errors, meaning that
|
|
483
|
+
* transformed code may still be available even if there are errors in this
|
|
484
|
+
* list.
|
|
485
|
+
*/
|
|
486
|
+
errors: Array<OxcError>
|
|
487
|
+
}
|
|
488
|
+
interface OxcError {
|
|
489
|
+
severity: Severity
|
|
490
|
+
message: string
|
|
491
|
+
labels: Array<ErrorLabel>
|
|
492
|
+
helpMessage?: string
|
|
493
|
+
codeframe?: string
|
|
494
|
+
}
|
|
495
|
+
interface ParserOptions {
|
|
496
|
+
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
497
|
+
/** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
|
|
498
|
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx'
|
|
499
|
+
/**
|
|
500
|
+
* Return an AST which includes TypeScript-related properties, or excludes them.
|
|
501
|
+
*
|
|
502
|
+
* `'js'` is default for JS / JSX files.
|
|
503
|
+
* `'ts'` is default for TS / TSX files.
|
|
504
|
+
* The type of the file is determined from `lang` option, or extension of provided `filename`.
|
|
505
|
+
*/
|
|
506
|
+
astType?: 'js' | 'ts'
|
|
507
|
+
/**
|
|
508
|
+
* Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
|
|
509
|
+
*
|
|
510
|
+
* If this option is true, parenthesized expressions are represented by
|
|
511
|
+
* (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
|
|
512
|
+
* have a single `expression` property containing the expression inside parentheses.
|
|
513
|
+
*
|
|
514
|
+
* @default true
|
|
515
|
+
*/
|
|
516
|
+
preserveParens?: boolean
|
|
517
|
+
/**
|
|
518
|
+
* Produce semantic errors with an additional AST pass.
|
|
519
|
+
* Semantic errors depend on symbols and scopes, where the parser does not construct.
|
|
520
|
+
* This adds a small performance overhead.
|
|
521
|
+
*
|
|
522
|
+
* @default false
|
|
523
|
+
*/
|
|
524
|
+
showSemanticErrors?: boolean
|
|
525
|
+
}
|
|
526
|
+
interface PreRenderedChunk {
|
|
527
|
+
name: string
|
|
528
|
+
isEntry: boolean
|
|
529
|
+
isDynamicEntry: boolean
|
|
530
|
+
facadeModuleId?: string
|
|
531
|
+
moduleIds: Array<string>
|
|
532
|
+
exports: Array<string>
|
|
533
|
+
}
|
|
534
|
+
interface ReactRefreshOptions {
|
|
535
|
+
/**
|
|
536
|
+
* Specify the identifier of the refresh registration variable.
|
|
537
|
+
*
|
|
538
|
+
* @default `$RefreshReg$`.
|
|
539
|
+
*/
|
|
540
|
+
refreshReg?: string
|
|
541
|
+
/**
|
|
542
|
+
* Specify the identifier of the refresh signature variable.
|
|
543
|
+
*
|
|
544
|
+
* @default `$RefreshSig$`.
|
|
545
|
+
*/
|
|
546
|
+
refreshSig?: string
|
|
547
|
+
emitFullSignatures?: boolean
|
|
548
|
+
}
|
|
549
|
+
type Severity = 'Error'|
|
|
550
|
+
'Warning'|
|
|
551
|
+
'Advice';
|
|
552
|
+
interface SourceMap {
|
|
553
|
+
file?: string
|
|
554
|
+
mappings: string
|
|
555
|
+
names: Array<string>
|
|
556
|
+
sourceRoot?: string
|
|
557
|
+
sources: Array<string>
|
|
558
|
+
sourcesContent?: Array<string>
|
|
559
|
+
version: number
|
|
560
|
+
x_google_ignoreList?: Array<number>
|
|
561
|
+
}
|
|
562
|
+
interface Span {
|
|
563
|
+
start: number
|
|
564
|
+
end: number
|
|
565
|
+
}
|
|
566
|
+
interface StaticExport {
|
|
567
|
+
start: number
|
|
568
|
+
end: number
|
|
569
|
+
entries: Array<StaticExportEntry>
|
|
570
|
+
}
|
|
571
|
+
interface StaticExportEntry {
|
|
572
|
+
start: number
|
|
573
|
+
end: number
|
|
574
|
+
moduleRequest?: ValueSpan
|
|
575
|
+
/** The name under which the desired binding is exported by the module`. */
|
|
576
|
+
importName: ExportImportName
|
|
577
|
+
/** The name used to export this binding by this module. */
|
|
578
|
+
exportName: ExportExportName
|
|
579
|
+
/** The name that is used to locally access the exported value from within the importing module. */
|
|
580
|
+
localName: ExportLocalName
|
|
581
|
+
}
|
|
582
|
+
interface StaticImport {
|
|
583
|
+
/** Start of import statement. */
|
|
584
|
+
start: number
|
|
585
|
+
/** End of import statement. */
|
|
586
|
+
end: number
|
|
587
|
+
/**
|
|
588
|
+
* Import source.
|
|
589
|
+
*
|
|
590
|
+
* ```js
|
|
591
|
+
* import { foo } from "mod";
|
|
592
|
+
* // ^^^
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
moduleRequest: ValueSpan
|
|
596
|
+
/**
|
|
597
|
+
* Import specifiers.
|
|
598
|
+
*
|
|
599
|
+
* Empty for `import "mod"`.
|
|
600
|
+
*/
|
|
601
|
+
entries: Array<StaticImportEntry>
|
|
602
|
+
}
|
|
603
|
+
interface StaticImportEntry {
|
|
604
|
+
/**
|
|
605
|
+
* The name under which the desired binding is exported by the module.
|
|
606
|
+
*
|
|
607
|
+
* ```js
|
|
608
|
+
* import { foo } from "mod";
|
|
609
|
+
* // ^^^
|
|
610
|
+
* import { foo as bar } from "mod";
|
|
611
|
+
* // ^^^
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
614
|
+
importName: ImportName
|
|
615
|
+
/**
|
|
616
|
+
* The name that is used to locally access the imported value from within the importing module.
|
|
617
|
+
* ```js
|
|
618
|
+
* import { foo } from "mod";
|
|
619
|
+
* // ^^^
|
|
620
|
+
* import { foo as bar } from "mod";
|
|
621
|
+
* // ^^^
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
localName: ValueSpan
|
|
625
|
+
/**
|
|
626
|
+
* Whether this binding is for a TypeScript type-only import.
|
|
627
|
+
*
|
|
628
|
+
* `true` for the following imports:
|
|
629
|
+
* ```ts
|
|
630
|
+
* import type { foo } from "mod";
|
|
631
|
+
* import { type foo } from "mod";
|
|
632
|
+
* ```
|
|
633
|
+
*/
|
|
634
|
+
isType: boolean
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
|
|
638
|
+
*
|
|
639
|
+
* @param filename The name of the file being transformed. If this is a
|
|
640
|
+
* relative path, consider setting the {@link TransformOptions#cwd} option..
|
|
641
|
+
* @param sourceText the source code itself
|
|
642
|
+
* @param options The options for the transformation. See {@link
|
|
643
|
+
* TransformOptions} for more information.
|
|
644
|
+
*
|
|
645
|
+
* @returns an object containing the transformed code, source maps, and any
|
|
646
|
+
* errors that occurred during parsing or transformation.
|
|
647
|
+
*/
|
|
648
|
+
declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult
|
|
649
|
+
/**
|
|
650
|
+
* Options for transforming a JavaScript or TypeScript file.
|
|
651
|
+
*
|
|
652
|
+
* @see {@link transform}
|
|
653
|
+
*/
|
|
654
|
+
interface TransformOptions {
|
|
655
|
+
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
656
|
+
/** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
|
|
657
|
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx'
|
|
658
|
+
/**
|
|
659
|
+
* The current working directory. Used to resolve relative paths in other
|
|
660
|
+
* options.
|
|
661
|
+
*/
|
|
662
|
+
cwd?: string
|
|
663
|
+
/**
|
|
664
|
+
* Enable source map generation.
|
|
665
|
+
*
|
|
666
|
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
|
667
|
+
*
|
|
668
|
+
* @default false
|
|
669
|
+
*
|
|
670
|
+
* @see {@link SourceMap}
|
|
671
|
+
*/
|
|
672
|
+
sourcemap?: boolean
|
|
673
|
+
/** Set assumptions in order to produce smaller output. */
|
|
674
|
+
assumptions?: CompilerAssumptions
|
|
675
|
+
/** Configure how TypeScript is transformed. */
|
|
676
|
+
typescript?: TypeScriptOptions
|
|
677
|
+
/** Configure how TSX and JSX are transformed. */
|
|
678
|
+
jsx?: 'preserve' | JsxOptions
|
|
679
|
+
/**
|
|
680
|
+
* Sets the target environment for the generated JavaScript.
|
|
681
|
+
*
|
|
682
|
+
* The lowest target is `es2015`.
|
|
683
|
+
*
|
|
684
|
+
* Example:
|
|
685
|
+
*
|
|
686
|
+
* * 'es2015'
|
|
687
|
+
* * ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']
|
|
688
|
+
*
|
|
689
|
+
* @default `esnext` (No transformation)
|
|
690
|
+
*
|
|
691
|
+
* @see [esbuild#target](https://esbuild.github.io/api/#target)
|
|
692
|
+
*/
|
|
693
|
+
target?: string | Array<string>
|
|
694
|
+
/** Behaviour for runtime helpers. */
|
|
695
|
+
helpers?: Helpers
|
|
696
|
+
/** Define Plugin */
|
|
697
|
+
define?: Record<string, string>
|
|
698
|
+
/** Inject Plugin */
|
|
699
|
+
inject?: Record<string, string | [string, string]>
|
|
700
|
+
/** Decorator plugin */
|
|
701
|
+
decorator?: DecoratorOptions
|
|
702
|
+
}
|
|
703
|
+
interface TransformResult {
|
|
704
|
+
/**
|
|
705
|
+
* The transformed code.
|
|
706
|
+
*
|
|
707
|
+
* If parsing failed, this will be an empty string.
|
|
708
|
+
*/
|
|
709
|
+
code: string
|
|
710
|
+
/**
|
|
711
|
+
* The source map for the transformed code.
|
|
712
|
+
*
|
|
713
|
+
* This will be set if {@link TransformOptions#sourcemap} is `true`.
|
|
714
|
+
*/
|
|
715
|
+
map?: SourceMap
|
|
716
|
+
/**
|
|
717
|
+
* The `.d.ts` declaration file for the transformed code. Declarations are
|
|
718
|
+
* only generated if `declaration` is set to `true` and a TypeScript file
|
|
719
|
+
* is provided.
|
|
720
|
+
*
|
|
721
|
+
* If parsing failed and `declaration` is set, this will be an empty string.
|
|
722
|
+
*
|
|
723
|
+
* @see {@link TypeScriptOptions#declaration}
|
|
724
|
+
* @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
|
|
725
|
+
*/
|
|
726
|
+
declaration?: string
|
|
727
|
+
/**
|
|
728
|
+
* Declaration source map. Only generated if both
|
|
729
|
+
* {@link TypeScriptOptions#declaration declaration} and
|
|
730
|
+
* {@link TransformOptions#sourcemap sourcemap} are set to `true`.
|
|
731
|
+
*/
|
|
732
|
+
declarationMap?: SourceMap
|
|
733
|
+
/**
|
|
734
|
+
* Helpers used.
|
|
735
|
+
*
|
|
736
|
+
* @internal
|
|
737
|
+
*
|
|
738
|
+
* Example:
|
|
739
|
+
*
|
|
740
|
+
* ```text
|
|
741
|
+
* { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
|
|
742
|
+
* ```
|
|
743
|
+
*/
|
|
744
|
+
helpersUsed: Record<string, string>
|
|
745
|
+
/**
|
|
746
|
+
* Parse and transformation errors.
|
|
747
|
+
*
|
|
748
|
+
* Oxc's parser recovers from common syntax errors, meaning that
|
|
749
|
+
* transformed code may still be available even if there are errors in this
|
|
750
|
+
* list.
|
|
751
|
+
*/
|
|
752
|
+
errors: Array<OxcError>
|
|
753
|
+
}
|
|
754
|
+
interface TypeScriptOptions {
|
|
755
|
+
jsxPragma?: string
|
|
756
|
+
jsxPragmaFrag?: string
|
|
757
|
+
onlyRemoveTypeImports?: boolean
|
|
758
|
+
allowNamespaces?: boolean
|
|
759
|
+
allowDeclareFields?: boolean
|
|
760
|
+
/**
|
|
761
|
+
* Also generate a `.d.ts` declaration file for TypeScript files.
|
|
762
|
+
*
|
|
763
|
+
* The source file must be compliant with all
|
|
764
|
+
* [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
|
|
765
|
+
* requirements.
|
|
766
|
+
*
|
|
767
|
+
* @default false
|
|
768
|
+
*/
|
|
769
|
+
declaration?: IsolatedDeclarationsOptions
|
|
770
|
+
/**
|
|
771
|
+
* Rewrite or remove TypeScript import/export declaration extensions.
|
|
772
|
+
*
|
|
773
|
+
* - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
|
|
774
|
+
* - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
|
|
775
|
+
* - When set to `true`, it's equivalent to `rewrite`.
|
|
776
|
+
* - When set to `false` or omitted, no changes will be made to the extensions.
|
|
777
|
+
*
|
|
778
|
+
* @default false
|
|
779
|
+
*/
|
|
780
|
+
rewriteImportExtensions?: 'rewrite' | 'remove' | boolean
|
|
781
|
+
}
|
|
782
|
+
interface ValueSpan {
|
|
783
|
+
value: string
|
|
784
|
+
start: number
|
|
785
|
+
end: number
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
//#endregion
|
|
789
|
+
export { BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingHmrOutput, BindingHookResolveIdExtraArgs, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReplacePluginConfig, BindingReportPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWatcherEvent, ParseResult, ParserOptions, PreRenderedChunk, TransformOptions, TransformResult as TransformResult$1, moduleRunnerTransform, transform };
|