rolldown 0.14.0 → 0.15.0-snapshot-b2570e7-20241204003545
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/cjs/cli.cjs +782 -854
- package/dist/cjs/experimental-index.cjs +68 -26
- package/dist/cjs/index.cjs +6 -8
- package/dist/cjs/parallel-plugin-worker.cjs +20 -14
- package/dist/cjs/parallel-plugin.cjs +1 -3
- package/dist/esm/cli.mjs +722 -796
- package/dist/esm/experimental-index.mjs +44 -7
- package/dist/esm/index.mjs +2 -4
- package/dist/esm/parallel-plugin-worker.mjs +15 -10
- package/dist/esm/parallel-plugin.mjs +1 -3
- package/dist/shared/{chunk-JoMxl5V2.cjs → chunk-BK2Ye-xa.cjs} +19 -6
- package/dist/shared/{consola.36c0034f-Xyw7SC_7.mjs → consola_36c0034f-DWsVjwtA.mjs} +218 -283
- package/dist/shared/{consola.36c0034f-HcmWcfPe.cjs → consola_36c0034f-_8_dG1Nr.cjs} +249 -295
- package/dist/shared/{prompt-hoPhcrA-.mjs → prompt-DGW8ZJmn.mjs} +125 -174
- package/dist/shared/{prompt-9Ij3R3TG.cjs → prompt-RFvZMmjc.cjs} +157 -204
- package/dist/shared/src-1jxF0vle.cjs +2917 -0
- package/dist/shared/src-Cm19F5A9.mjs +2789 -0
- package/dist/types/api/build.d.ts +16 -0
- package/dist/types/api/experimental.d.ts +7 -0
- package/dist/types/api/rolldown/index.d.ts +3 -0
- package/dist/types/api/rolldown/rolldown-build.d.ts +12 -0
- package/dist/types/api/watch/index.d.ts +3 -0
- package/dist/types/{watcher.d.ts → api/watch/watch-emitter.d.ts} +17 -17
- package/dist/types/api/watch/watcher.d.ts +13 -0
- package/dist/types/binding.d.ts +175 -40
- package/dist/types/builtin-plugin/alias-plugin.d.ts +10 -0
- package/dist/types/builtin-plugin/constructors.d.ts +20 -0
- package/dist/types/builtin-plugin/replace-plugin.d.ts +28 -0
- package/dist/types/{options/normalized-ecma-transform-plugin-config.d.ts → builtin-plugin/transform-plugin.d.ts} +2 -1
- package/dist/types/builtin-plugin/utils.d.ts +8 -0
- package/dist/types/cli/arguments/normalize.d.ts +2 -6
- package/dist/types/cli/arguments/schema.d.ts +169 -81
- package/dist/types/constants/plugin.d.ts +3 -1
- package/dist/types/experimental-index.d.ts +5 -2
- package/dist/types/index.d.ts +13 -10
- package/dist/types/log/locate-character/index.d.ts +13 -0
- package/dist/types/log/logger.d.ts +2 -16
- package/dist/types/log/logging.d.ts +6 -3
- package/dist/types/log/logs.d.ts +2 -0
- package/dist/types/options/input-options-schema.d.ts +596 -0
- package/dist/types/options/input-options.d.ts +74 -430
- package/dist/types/options/normalized-input-options.d.ts +17 -11
- package/dist/types/options/normalized-output-options.d.ts +57 -21
- package/dist/types/options/output-options-schema.d.ts +147 -0
- package/dist/types/options/output-options.d.ts +72 -265
- package/dist/types/options/watch-options.d.ts +5 -0
- package/dist/types/plugin/bindingify-build-hooks.d.ts +9 -11
- package/dist/types/plugin/bindingify-hook-filter.d.ts +5 -5
- package/dist/types/plugin/bindingify-output-hooks.d.ts +13 -16
- package/dist/types/plugin/bindingify-plugin.d.ts +12 -3
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +3 -5
- package/dist/types/plugin/hook-filter.d.ts +1 -1
- package/dist/types/plugin/index.d.ts +21 -18
- package/dist/types/plugin/minimal-plugin-context.d.ts +15 -0
- package/dist/types/plugin/plugin-context-data.d.ts +4 -5
- package/dist/types/plugin/plugin-context.d.ts +9 -4
- package/dist/types/plugin/plugin-driver.d.ts +4 -5
- package/dist/types/plugin/transform-plugin-context.d.ts +4 -3
- package/dist/types/rollup-types.d.ts +1 -1
- package/dist/types/treeshake/index.d.ts +0 -12
- package/dist/types/treeshake/module-side-effects.d.ts +111 -11
- package/dist/types/types/rolldown-output.d.ts +11 -2
- package/dist/types/types/utils.d.ts +1 -0
- package/dist/types/utils/bindingify-input-options.d.ts +7 -0
- package/dist/types/utils/bindingify-output-options.d.ts +3 -0
- package/dist/types/utils/define-config.d.ts +3 -0
- package/dist/types/utils/error.d.ts +1 -0
- package/dist/types/utils/normalize-hook.d.ts +1 -1
- package/dist/types/utils/normalize-plugin-option.d.ts +8 -3
- package/dist/types/{options/utils.d.ts → utils/normalize-string-or-regex.d.ts} +1 -1
- package/dist/types/utils/transform-rendered-chunk.d.ts +4 -0
- package/dist/types/utils/transform-rendered-module.d.ts +3 -0
- package/dist/types/utils/transform-sourcemap.d.ts +2 -0
- package/dist/types/utils/transform-to-rollup-output.d.ts +1 -0
- package/package.json +30 -22
- package/dist/shared/rolldown-binding.wasi.cjs +0 -187
- package/dist/shared/src_index-3pqhEViJ.cjs +0 -2785
- package/dist/shared/src_index-ywYMd4vB.mjs +0 -2786
- package/dist/shared/wasi-worker-browser.mjs +0 -39
- package/dist/shared/wasi-worker.mjs +0 -63
- package/dist/shared/watcher-worker.js +0 -1
- package/dist/types/constants/types.d.ts +0 -1
- package/dist/types/options/bindingify-input-options.d.ts +0 -4
- package/dist/types/options/bindingify-output-options.d.ts +0 -3
- package/dist/types/options/normalized-alias-plugin-config.d.ts +0 -8
- package/dist/types/options/watch-option.d.ts +0 -5
- package/dist/types/plugin/builtin-plugin.d.ts +0 -81
- package/dist/types/rolldown-build.d.ts +0 -10
- package/dist/types/rolldown.d.ts +0 -12
- package/dist/types/types/rendered-module.d.ts +0 -2
- package/dist/types/utils/normalize-input-options.d.ts +0 -3
- package/dist/types/utils/normalize-output-options.d.ts +0 -3
- package/dist/types/utils/normalize-tree-shake.d.ts +0 -3
- /package/dist/types/{utils/type-assert.d.ts → types/assert.d.ts} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RolldownOptions } from '../types/rolldown-options';
|
|
2
|
+
import type { RolldownOutput } from '../types/rolldown-output';
|
|
3
|
+
export interface BuildOptions extends RolldownOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Write the output to the file system
|
|
6
|
+
*
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
write?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function build(options: BuildOptions): Promise<RolldownOutput>;
|
|
12
|
+
/**
|
|
13
|
+
* Build multiple outputs __sequentially__.
|
|
14
|
+
*/
|
|
15
|
+
declare function build(options: BuildOptions[]): Promise<RolldownOutput[]>;
|
|
16
|
+
export { build };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InputOptions } from '../options/input-options';
|
|
2
|
+
/**
|
|
3
|
+
* This is an experimental API. It's behavior may change in the future.
|
|
4
|
+
*
|
|
5
|
+
* Calling this API will only execute the scan stage of rolldown.
|
|
6
|
+
*/
|
|
7
|
+
export declare const experimental_scan: (input: InputOptions) => Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InputOptions } from '../../options/input-options';
|
|
2
|
+
import type { OutputOptions } from '../../options/output-options';
|
|
3
|
+
import type { RolldownOutput } from '../../types/rolldown-output';
|
|
4
|
+
export declare class RolldownBuild {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(inputOptions: InputOptions);
|
|
7
|
+
get closed(): boolean;
|
|
8
|
+
generate(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
9
|
+
write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
12
|
+
}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MaybePromise } from '
|
|
3
|
-
export declare class Watcher {
|
|
4
|
-
closed: boolean;
|
|
5
|
-
controller: AbortController;
|
|
6
|
-
inner: BindingWatcher;
|
|
7
|
-
stopWorkers?: () => Promise<void>;
|
|
8
|
-
constructor(inner: BindingWatcher, stopWorkers?: () => Promise<void>);
|
|
9
|
-
close(): Promise<void>;
|
|
10
|
-
on(event: 'change', listener: (id: string, change: {
|
|
11
|
-
event: ChangeEvent;
|
|
12
|
-
}) => MaybePromise<void>): this;
|
|
13
|
-
on(event: 'event', listener: (data: RollupWatcherEvent) => MaybePromise<void>): this;
|
|
14
|
-
on(event: 'restart' | 'close', listener: () => MaybePromise<void>): this;
|
|
15
|
-
watch(): void;
|
|
16
|
-
}
|
|
1
|
+
import { BindingWatcherEvent } from '../../binding';
|
|
2
|
+
import { MaybePromise } from '../../types/utils';
|
|
17
3
|
export type WatcherEvent = 'close' | 'event' | 'restart' | 'change';
|
|
18
4
|
export type ChangeEvent = 'create' | 'update' | 'delete';
|
|
19
5
|
export type RollupWatcherEvent = {
|
|
@@ -27,5 +13,19 @@ export type RollupWatcherEvent = {
|
|
|
27
13
|
} | {
|
|
28
14
|
code: 'END';
|
|
29
15
|
} | {
|
|
30
|
-
code: 'ERROR';
|
|
16
|
+
code: 'ERROR';
|
|
17
|
+
error: Error;
|
|
31
18
|
};
|
|
19
|
+
export declare class WatcherEmitter {
|
|
20
|
+
listeners: Map<WatcherEvent, Array<(...parameters: any[]) => MaybePromise<void>>>;
|
|
21
|
+
timer: any;
|
|
22
|
+
constructor();
|
|
23
|
+
on(event: 'change', listener: (id: string, change: {
|
|
24
|
+
event: ChangeEvent;
|
|
25
|
+
}) => MaybePromise<void>): this;
|
|
26
|
+
on(event: 'event', listener: (data: RollupWatcherEvent) => MaybePromise<void>): this;
|
|
27
|
+
on(event: 'restart' | 'close', listener: () => MaybePromise<void>): this;
|
|
28
|
+
onEvent(event: BindingWatcherEvent): Promise<void>;
|
|
29
|
+
close(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export type RolldownWatcher = WatcherEmitter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BindingWatcher } from '../../binding';
|
|
2
|
+
import { WatchOptions } from '../../options/watch-options';
|
|
3
|
+
import { WatcherEmitter } from './watch-emitter';
|
|
4
|
+
export declare class Watcher {
|
|
5
|
+
closed: boolean;
|
|
6
|
+
inner: BindingWatcher;
|
|
7
|
+
emitter: WatcherEmitter;
|
|
8
|
+
stopWorkers?: () => Promise<void>;
|
|
9
|
+
constructor(emitter: WatcherEmitter, inner: BindingWatcher, stopWorkers?: () => Promise<void>);
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
start(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function createWatcher(emitter: WatcherEmitter, input: WatchOptions): Promise<void>;
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -3,6 +3,22 @@ type Nullable<T> = T | null | undefined
|
|
|
3
3
|
type VoidNullable<T = void> = T | null | undefined | void
|
|
4
4
|
export type BindingStringOrRegex = string | RegExp
|
|
5
5
|
|
|
6
|
+
export declare class BindingBundleEndEventData {
|
|
7
|
+
output: string
|
|
8
|
+
duration: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare class BindingCallableBuiltinPlugin {
|
|
12
|
+
constructor(plugin: BindingBuiltinPlugin)
|
|
13
|
+
resolveId(id: string, importer?: string | undefined | null, options?: BindingHookJsResolveIdOptions | undefined | null): Promise<BindingHookJsResolveIdOutput | null>
|
|
14
|
+
load(id: string): Promise<BindingHookJsLoadOutput | null>
|
|
15
|
+
watchChange(path: string, event: BindingJsWatchChangeEvent): Promise<void>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export declare class BindingHookError {
|
|
19
|
+
get errors(): Array<Error | object>
|
|
20
|
+
}
|
|
21
|
+
|
|
6
22
|
export declare class BindingLog {
|
|
7
23
|
code: string
|
|
8
24
|
message: string
|
|
@@ -18,6 +34,37 @@ export declare class BindingModuleInfo {
|
|
|
18
34
|
get code(): string | null
|
|
19
35
|
}
|
|
20
36
|
|
|
37
|
+
export declare class BindingNormalizedOptions {
|
|
38
|
+
get input(): Array<string> | Record<string, string>
|
|
39
|
+
get cwd(): string | null
|
|
40
|
+
get platform(): 'node' | 'browser' | 'neutral'
|
|
41
|
+
get shimMissingExports(): boolean
|
|
42
|
+
get name(): string | null
|
|
43
|
+
get cssEntryFilenames(): string | undefined
|
|
44
|
+
get cssChunkFilenames(): string | undefined
|
|
45
|
+
get entryFilenames(): string | undefined
|
|
46
|
+
get chunkFilenames(): string | undefined
|
|
47
|
+
get assetFilenames(): string
|
|
48
|
+
get dir(): string | null
|
|
49
|
+
get file(): string | null
|
|
50
|
+
get format(): 'es' | 'cjs' | 'app' | 'iife' | 'umd'
|
|
51
|
+
get exports(): 'default' | 'named' | 'none' | 'auto'
|
|
52
|
+
get esModule(): boolean | 'if-default-prop'
|
|
53
|
+
get inlineDynamicImports(): boolean
|
|
54
|
+
get sourcemap(): boolean | 'inline' | 'hidden'
|
|
55
|
+
get banner(): string | undefined | null | undefined
|
|
56
|
+
get footer(): string | undefined | null | undefined
|
|
57
|
+
get intro(): string | undefined | null | undefined
|
|
58
|
+
get outro(): string | undefined | null | undefined
|
|
59
|
+
get externalLiveBindings(): boolean
|
|
60
|
+
get extend(): boolean
|
|
61
|
+
get globals(): Record<string, string> | undefined
|
|
62
|
+
get hashCharacters(): 'base64' | 'base36' | 'hex'
|
|
63
|
+
get sourcemapDebugIds(): boolean
|
|
64
|
+
get minify(): boolean
|
|
65
|
+
get comments(): 'none' | 'preserve-legal'
|
|
66
|
+
}
|
|
67
|
+
|
|
21
68
|
export declare class BindingOutputAsset {
|
|
22
69
|
get fileName(): string
|
|
23
70
|
get originalFileName(): string | null
|
|
@@ -45,33 +92,54 @@ export declare class BindingOutputChunk {
|
|
|
45
92
|
export declare class BindingOutputs {
|
|
46
93
|
get chunks(): Array<BindingOutputChunk>
|
|
47
94
|
get assets(): Array<BindingOutputAsset>
|
|
95
|
+
get errors(): Array<Error | object>
|
|
48
96
|
}
|
|
49
97
|
|
|
50
98
|
export declare class BindingPluginContext {
|
|
99
|
+
load(specifier: string, sideEffects: BindingHookSideEffects | undefined, fn: () => void): Promise<void>
|
|
51
100
|
resolve(specifier: string, importer?: string | undefined | null, extraOptions?: BindingPluginContextResolveOptions | undefined | null): Promise<BindingPluginContextResolvedId | null>
|
|
52
101
|
emitFile(file: BindingEmittedAsset): string
|
|
53
102
|
getFileName(referenceId: string): string
|
|
54
103
|
getModuleInfo(moduleId: string): BindingModuleInfo | null
|
|
55
|
-
getModuleIds(): Array<string>
|
|
104
|
+
getModuleIds(): Array<string>
|
|
56
105
|
addWatchFile(file: string): void
|
|
57
106
|
}
|
|
58
107
|
|
|
108
|
+
export declare class BindingRenderedModule {
|
|
109
|
+
get code(): string | null
|
|
110
|
+
}
|
|
111
|
+
|
|
59
112
|
export declare class BindingTransformPluginContext {
|
|
113
|
+
getCombinedSourcemap(): string
|
|
60
114
|
inner(): BindingPluginContext
|
|
61
115
|
}
|
|
62
116
|
|
|
63
117
|
export declare class BindingWatcher {
|
|
64
118
|
close(): Promise<void>
|
|
65
|
-
|
|
119
|
+
start(listener: (data: BindingWatcherEvent) => void): Promise<void>
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare class BindingWatcherChangeData {
|
|
123
|
+
path: string
|
|
124
|
+
kind: string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export declare class BindingWatcherEvent {
|
|
128
|
+
eventKind(): string
|
|
129
|
+
watchChangeData(): BindingWatcherChangeData
|
|
130
|
+
bundleEndData(): BindingBundleEndEventData
|
|
131
|
+
bundleEventKind(): string
|
|
132
|
+
errors(): Array<Error | object>
|
|
66
133
|
}
|
|
67
134
|
|
|
68
135
|
export declare class Bundler {
|
|
69
136
|
constructor(inputOptions: BindingInputOptions, outputOptions: BindingOutputOptions, parallelPluginsRegistry?: ParallelJsPluginRegistry | undefined | null)
|
|
70
137
|
write(): Promise<BindingOutputs>
|
|
71
138
|
generate(): Promise<BindingOutputs>
|
|
72
|
-
scan(): Promise<
|
|
139
|
+
scan(): Promise<BindingOutputs>
|
|
73
140
|
close(): Promise<void>
|
|
74
141
|
watch(): Promise<BindingWatcher>
|
|
142
|
+
get closed(): boolean
|
|
75
143
|
}
|
|
76
144
|
|
|
77
145
|
export declare class ParallelJsPluginRegistry {
|
|
@@ -129,20 +197,19 @@ export interface BindingBuiltinPlugin {
|
|
|
129
197
|
options?: unknown
|
|
130
198
|
}
|
|
131
199
|
|
|
132
|
-
export
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
200
|
+
export type BindingBuiltinPluginName = 'builtin:wasm-helper'|
|
|
201
|
+
'builtin:import-glob'|
|
|
202
|
+
'builtin:dynamic-import-vars'|
|
|
203
|
+
'builtin:module-preload-polyfill'|
|
|
204
|
+
'builtin:manifest'|
|
|
205
|
+
'builtin:load-fallback'|
|
|
206
|
+
'builtin:transform'|
|
|
207
|
+
'builtin:wasm-fallback'|
|
|
208
|
+
'builtin:alias'|
|
|
209
|
+
'builtin:json'|
|
|
210
|
+
'builtin:build-import-analysis'|
|
|
211
|
+
'builtin:replace'|
|
|
212
|
+
'builtin:vite-resolve';
|
|
146
213
|
|
|
147
214
|
export interface BindingEmittedAsset {
|
|
148
215
|
name?: string
|
|
@@ -154,6 +221,8 @@ export interface BindingEmittedAsset {
|
|
|
154
221
|
export interface BindingExperimentalOptions {
|
|
155
222
|
strictExecutionOrder?: boolean
|
|
156
223
|
disableLiveBindings?: boolean
|
|
224
|
+
viteMode?: boolean
|
|
225
|
+
resolveNewUrlToAsset?: boolean
|
|
157
226
|
}
|
|
158
227
|
|
|
159
228
|
export interface BindingGeneralHookFilter {
|
|
@@ -166,6 +235,22 @@ export interface BindingGlobImportPluginConfig {
|
|
|
166
235
|
restoreQueryExtension?: boolean
|
|
167
236
|
}
|
|
168
237
|
|
|
238
|
+
export interface BindingHookJsLoadOutput {
|
|
239
|
+
code: string
|
|
240
|
+
map?: string
|
|
241
|
+
sideEffects: boolean | 'no-treeshake'
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface BindingHookJsResolveIdOptions {
|
|
245
|
+
scan?: boolean
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface BindingHookJsResolveIdOutput {
|
|
249
|
+
id: string
|
|
250
|
+
external?: boolean
|
|
251
|
+
sideEffects: boolean | 'no-treeshake'
|
|
252
|
+
}
|
|
253
|
+
|
|
169
254
|
export interface BindingHookLoadOutput {
|
|
170
255
|
code: string
|
|
171
256
|
sideEffects?: BindingHookSideEffects
|
|
@@ -228,12 +313,13 @@ export interface BindingInputOptions {
|
|
|
228
313
|
resolve?: BindingResolveOptions
|
|
229
314
|
shimMissingExports?: boolean
|
|
230
315
|
platform?: 'node' | 'browser' | 'neutral'
|
|
231
|
-
logLevel
|
|
316
|
+
logLevel: BindingLogLevel
|
|
232
317
|
onLog: (logLevel: 'debug' | 'warn' | 'info', log: BindingLog) => void
|
|
233
318
|
cwd: string
|
|
234
319
|
treeshake?: BindingTreeshake
|
|
235
320
|
moduleTypes?: Record<string, string>
|
|
236
321
|
define?: Array<[string, string]>
|
|
322
|
+
dropLabels?: Array<string>
|
|
237
323
|
inject?: Array<BindingInjectImportNamed | BindingInjectImportNamespace>
|
|
238
324
|
experimental?: BindingExperimentalOptions
|
|
239
325
|
profilerNames?: boolean
|
|
@@ -255,6 +341,10 @@ export interface BindingJsonSourcemap {
|
|
|
255
341
|
names?: Array<string>
|
|
256
342
|
}
|
|
257
343
|
|
|
344
|
+
export interface BindingJsWatchChangeEvent {
|
|
345
|
+
event: string
|
|
346
|
+
}
|
|
347
|
+
|
|
258
348
|
export declare enum BindingLogLevel {
|
|
259
349
|
Silent = 0,
|
|
260
350
|
Warn = 1,
|
|
@@ -279,6 +369,12 @@ export interface BindingModulePreloadPolyfillPluginConfig {
|
|
|
279
369
|
skip?: boolean
|
|
280
370
|
}
|
|
281
371
|
|
|
372
|
+
export interface BindingModuleSideEffectsRule {
|
|
373
|
+
test?: RegExp | undefined
|
|
374
|
+
sideEffects: boolean
|
|
375
|
+
external?: boolean | undefined
|
|
376
|
+
}
|
|
377
|
+
|
|
282
378
|
export interface BindingNotifyOption {
|
|
283
379
|
pollInterval?: number
|
|
284
380
|
compareContents?: boolean
|
|
@@ -286,9 +382,11 @@ export interface BindingNotifyOption {
|
|
|
286
382
|
|
|
287
383
|
export interface BindingOutputOptions {
|
|
288
384
|
name?: string
|
|
385
|
+
assetFileNames?: string
|
|
289
386
|
entryFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
290
387
|
chunkFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
291
|
-
|
|
388
|
+
cssEntryFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
389
|
+
cssChunkFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
292
390
|
banner?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
293
391
|
dir?: string
|
|
294
392
|
file?: string
|
|
@@ -297,8 +395,9 @@ export interface BindingOutputOptions {
|
|
|
297
395
|
extend?: boolean
|
|
298
396
|
externalLiveBindings?: boolean
|
|
299
397
|
footer?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
300
|
-
format?: 'es' | 'cjs' | 'iife' | 'umd'
|
|
301
|
-
globals?: Record<string, string>
|
|
398
|
+
format?: 'es' | 'cjs' | 'iife' | 'umd' | 'app'
|
|
399
|
+
globals?: Record<string, string> | ((name: string) => string)
|
|
400
|
+
hashCharacters?: 'base64' | 'base36' | 'hex'
|
|
302
401
|
inlineDynamicImports?: boolean
|
|
303
402
|
intro?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
304
403
|
outro?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
@@ -309,6 +408,7 @@ export interface BindingOutputOptions {
|
|
|
309
408
|
sourcemapPathTransform?: (source: string, sourcemapPath: string) => string
|
|
310
409
|
minify?: boolean
|
|
311
410
|
advancedChunks?: BindingAdvancedChunksOptions
|
|
411
|
+
comments?: 'none' | 'preserve-legal'
|
|
312
412
|
}
|
|
313
413
|
|
|
314
414
|
export interface BindingPluginContextResolvedId {
|
|
@@ -328,7 +428,7 @@ export interface BindingPluginHookMeta {
|
|
|
328
428
|
|
|
329
429
|
export interface BindingPluginOptions {
|
|
330
430
|
name: string
|
|
331
|
-
buildStart?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
431
|
+
buildStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable>
|
|
332
432
|
buildStartMeta?: BindingPluginHookMeta
|
|
333
433
|
resolveId?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>, options: BindingHookResolveIdExtraArgs) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
334
434
|
resolveIdMeta?: BindingPluginHookMeta
|
|
@@ -343,19 +443,19 @@ export interface BindingPluginOptions {
|
|
|
343
443
|
transformFilter?: BindingTransformHookFilter
|
|
344
444
|
moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
|
|
345
445
|
moduleParsedMeta?: BindingPluginHookMeta
|
|
346
|
-
buildEnd?: (ctx: BindingPluginContext, error
|
|
446
|
+
buildEnd?: (ctx: BindingPluginContext, error?: BindingHookError) => MaybePromise<VoidNullable>
|
|
347
447
|
buildEndMeta?: BindingPluginHookMeta
|
|
348
|
-
renderChunk?: (ctx: BindingPluginContext, code: string, chunk: RenderedChunk) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
|
|
448
|
+
renderChunk?: (ctx: BindingPluginContext, code: string, chunk: RenderedChunk, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
|
|
349
449
|
renderChunkMeta?: BindingPluginHookMeta
|
|
350
450
|
augmentChunkHash?: (ctx: BindingPluginContext, chunk: RenderedChunk) => MaybePromise<void | string>
|
|
351
451
|
augmentChunkHashMeta?: BindingPluginHookMeta
|
|
352
|
-
renderStart?: (ctx: BindingPluginContext) => void
|
|
452
|
+
renderStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => void
|
|
353
453
|
renderStartMeta?: BindingPluginHookMeta
|
|
354
454
|
renderError?: (ctx: BindingPluginContext, error: string) => void
|
|
355
455
|
renderErrorMeta?: BindingPluginHookMeta
|
|
356
|
-
generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean) => MaybePromise<VoidNullable<JsChangedOutputs>>
|
|
456
|
+
generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
|
|
357
457
|
generateBundleMeta?: BindingPluginHookMeta
|
|
358
|
-
writeBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs) => MaybePromise<VoidNullable<JsChangedOutputs>>
|
|
458
|
+
writeBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
|
|
359
459
|
writeBundleMeta?: BindingPluginHookMeta
|
|
360
460
|
closeBundle?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
361
461
|
closeBundleMeta?: BindingPluginHookMeta
|
|
@@ -383,15 +483,12 @@ export interface BindingPluginWithIndex {
|
|
|
383
483
|
plugin: BindingPluginOptions
|
|
384
484
|
}
|
|
385
485
|
|
|
386
|
-
export interface BindingRenderedModule {
|
|
387
|
-
code?: string
|
|
388
|
-
}
|
|
389
|
-
|
|
390
486
|
export interface BindingReplacePluginConfig {
|
|
391
487
|
values: Record<string, string>
|
|
392
488
|
delimiters?: [string, string]
|
|
393
489
|
preventAssignment?: boolean
|
|
394
490
|
objectGuards?: boolean
|
|
491
|
+
sourcemap?: boolean
|
|
395
492
|
}
|
|
396
493
|
|
|
397
494
|
export interface BindingResolveOptions {
|
|
@@ -426,18 +523,41 @@ export interface BindingTransformPluginConfig {
|
|
|
426
523
|
include?: Array<BindingStringOrRegex>
|
|
427
524
|
exclude?: Array<BindingStringOrRegex>
|
|
428
525
|
jsxInject?: string
|
|
526
|
+
reactRefresh?: boolean
|
|
429
527
|
targets?: string
|
|
430
528
|
}
|
|
431
529
|
|
|
432
530
|
export interface BindingTreeshake {
|
|
433
|
-
moduleSideEffects:
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
531
|
+
moduleSideEffects: boolean | BindingModuleSideEffectsRule[]
|
|
532
|
+
annotations?: boolean
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export interface BindingViteResolvePluginConfig {
|
|
536
|
+
resolveOptions: BindingViteResolvePluginResolveOptions
|
|
537
|
+
environmentConsumer: string
|
|
538
|
+
environmentName: string
|
|
539
|
+
external: true | string[]
|
|
540
|
+
noExternal: true | string[]
|
|
541
|
+
finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
|
|
542
|
+
finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
|
|
543
|
+
runtime: string
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export interface BindingViteResolvePluginResolveOptions {
|
|
547
|
+
isBuild: boolean
|
|
548
|
+
isProduction: boolean
|
|
549
|
+
asSrc: boolean
|
|
550
|
+
preferRelative: boolean
|
|
551
|
+
isRequire?: boolean
|
|
552
|
+
root: string
|
|
553
|
+
scan: boolean
|
|
554
|
+
mainFields: Array<string>
|
|
555
|
+
conditions: Array<string>
|
|
556
|
+
externalConditions: Array<string>
|
|
557
|
+
extensions: Array<string>
|
|
558
|
+
tryIndex: boolean
|
|
559
|
+
tryPrefix?: string
|
|
560
|
+
preserveSymlinks: boolean
|
|
441
561
|
}
|
|
442
562
|
|
|
443
563
|
export interface BindingWatchOption {
|
|
@@ -597,7 +717,7 @@ export interface JsxOptions {
|
|
|
597
717
|
/**
|
|
598
718
|
* Enable React Fast Refresh .
|
|
599
719
|
*
|
|
600
|
-
* Conforms to the implementation in {@link https://github.com/facebook/react/tree/
|
|
720
|
+
* Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
|
|
601
721
|
*
|
|
602
722
|
* @default false
|
|
603
723
|
*/
|
|
@@ -697,6 +817,21 @@ export interface TransformOptions {
|
|
|
697
817
|
typescript?: TypeScriptOptions
|
|
698
818
|
/** Configure how TSX and JSX are transformed. */
|
|
699
819
|
jsx?: JsxOptions
|
|
820
|
+
/**
|
|
821
|
+
* Sets the target environment for the generated JavaScript.
|
|
822
|
+
*
|
|
823
|
+
* The lowest target is `es2015`.
|
|
824
|
+
*
|
|
825
|
+
* Example:
|
|
826
|
+
*
|
|
827
|
+
* * 'es2015'
|
|
828
|
+
* * ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']
|
|
829
|
+
*
|
|
830
|
+
* @default `esnext` (No transformation)
|
|
831
|
+
*
|
|
832
|
+
* @see [esbuild#target](https://esbuild.github.io/api/#target)
|
|
833
|
+
*/
|
|
834
|
+
target?: string | Array<string>
|
|
700
835
|
/** Define Plugin */
|
|
701
836
|
define?: Record<string, string>
|
|
702
837
|
/** Inject Plugin */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BuiltinPlugin } from './constructors';
|
|
2
|
+
type AliasPluginAlias = {
|
|
3
|
+
find: string | RegExp;
|
|
4
|
+
replacement: string;
|
|
5
|
+
};
|
|
6
|
+
type AliasPluginConfig = {
|
|
7
|
+
entries: AliasPluginAlias[];
|
|
8
|
+
};
|
|
9
|
+
export declare function aliasPlugin(config: AliasPluginConfig): BuiltinPlugin;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingJsonPluginConfig, BindingBuildImportAnalysisPluginConfig, type BindingViteResolvePluginConfig } from '../binding';
|
|
2
|
+
export declare class BuiltinPlugin {
|
|
3
|
+
name: BindingBuiltinPluginName;
|
|
4
|
+
_options?: unknown;
|
|
5
|
+
constructor(name: BindingBuiltinPluginName, _options?: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare function modulePreloadPolyfillPlugin(config?: BindingModulePreloadPolyfillPluginConfig): BuiltinPlugin;
|
|
8
|
+
export declare function dynamicImportVarsPlugin(): BuiltinPlugin;
|
|
9
|
+
export declare function importGlobPlugin(config?: BindingGlobImportPluginConfig): BuiltinPlugin;
|
|
10
|
+
export declare function manifestPlugin(config?: BindingManifestPluginConfig): BuiltinPlugin;
|
|
11
|
+
export declare function wasmHelperPlugin(): BuiltinPlugin;
|
|
12
|
+
export declare function wasmFallbackPlugin(): BuiltinPlugin;
|
|
13
|
+
export declare function loadFallbackPlugin(): BuiltinPlugin;
|
|
14
|
+
export declare function jsonPlugin(config?: BindingJsonPluginConfig): BuiltinPlugin;
|
|
15
|
+
export declare function buildImportAnalysisPlugin(config: BindingBuildImportAnalysisPluginConfig): BuiltinPlugin;
|
|
16
|
+
export declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, 'runtime'>): BuiltinPlugin & {
|
|
17
|
+
resolveId: (id: string, importer?: string | undefined | null, options?: import("../binding").BindingHookJsResolveIdOptions | undefined | null) => Promise<import("../binding").BindingHookJsResolveIdOutput | null>;
|
|
18
|
+
load: (id: string) => Promise<import("../binding").BindingHookJsLoadOutput | null>;
|
|
19
|
+
watchChange: (path: string, event: import("../binding").BindingJsWatchChangeEvent) => Promise<void>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BindingReplacePluginConfig } from '../binding';
|
|
2
|
+
import { BuiltinPlugin } from './constructors';
|
|
3
|
+
/**
|
|
4
|
+
* Replaces targeted strings in files while bundling.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Basic usage
|
|
8
|
+
* ```js
|
|
9
|
+
* replacePlugin({
|
|
10
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
11
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
12
|
+
* __buildVersion: 15
|
|
13
|
+
* })
|
|
14
|
+
* ```
|
|
15
|
+
* @example
|
|
16
|
+
* // With options
|
|
17
|
+
* ```js
|
|
18
|
+
* replacePlugin({
|
|
19
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
20
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
21
|
+
* __buildVersion: 15
|
|
22
|
+
* }, {
|
|
23
|
+
* preventAssignment: false,
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export declare function replacePlugin(values?: BindingReplacePluginConfig['values'], options?: Omit<BindingReplacePluginConfig, 'values'>): BuiltinPlugin;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { BuiltinPlugin } from './constructors';
|
|
1
2
|
import { BindingTransformPluginConfig } from '../binding';
|
|
2
3
|
type TransformPattern = string | RegExp | (RegExp | string)[];
|
|
3
4
|
export type TransformPluginConfig = Omit<BindingTransformPluginConfig, 'include' | 'exclude'> & {
|
|
4
5
|
include?: TransformPattern;
|
|
5
6
|
exclude?: TransformPattern;
|
|
6
7
|
};
|
|
7
|
-
export declare function
|
|
8
|
+
export declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
|
|
8
9
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BindingBuiltinPlugin, BindingCallableBuiltinPlugin } from '../binding';
|
|
2
|
+
import { BuiltinPlugin } from './constructors';
|
|
3
|
+
type BindingCallableBuiltinPluginLike = {
|
|
4
|
+
[K in keyof BindingCallableBuiltinPlugin]: BindingCallableBuiltinPlugin[K];
|
|
5
|
+
};
|
|
6
|
+
export declare function makeBuiltinPluginCallable(plugin: BuiltinPlugin): BuiltinPlugin & BindingCallableBuiltinPluginLike;
|
|
7
|
+
export declare function bindingifyBuiltInPlugin(plugin: BuiltinPlugin): BindingBuiltinPlugin;
|
|
8
|
+
export {};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file is used for normalize the options.
|
|
3
|
-
* In CLI, the input options and output options are mixed together. We need to tell them apart.
|
|
4
|
-
*/
|
|
5
|
-
import { InputOptions } from '../../options/input-options';
|
|
6
|
-
import { OutputOptions } from '../../options/output-options';
|
|
7
1
|
import { CliOptions } from './schema';
|
|
2
|
+
import type { InputOptions } from '../../options/input-options';
|
|
3
|
+
import type { OutputOptions } from '../../options/output-options';
|
|
8
4
|
export interface NormalizedCliOptions {
|
|
9
5
|
input: InputOptions;
|
|
10
6
|
output: OutputOptions;
|