rolldown 0.10.4 → 0.10.5
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 +8 -8
- package/dist/cjs/index.cjs +3 -2
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +8 -8
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{utils_index-ywWHgCJG.mjs → bindingify_plugin-gPrr_HPR.mjs} +474 -827
- package/dist/shared/{utils_index-D-jBnBMP.cjs → bindingify_plugin-sRZqfDBJ.cjs} +484 -827
- package/dist/shared/rolldown-1SJPa4fg.cjs +547 -0
- package/dist/shared/rolldown-bgokD9pg.mjs +544 -0
- package/dist/shared/rolldown-binding.wasi.cjs +46 -25
- package/dist/types/binding.d.ts +256 -0
- package/dist/types/index.d.ts +21 -7
- package/dist/types/options/bindingify-input-options.d.ts +1 -1
- package/dist/types/options/bindingify-output-options.d.ts +1 -0
- package/dist/types/options/input-options.d.ts +31 -6
- package/dist/types/options/normalized-input-options.d.ts +4 -2
- package/dist/types/options/normalized-output-options.d.ts +2 -1
- package/dist/types/options/output-options.d.ts +10 -5
- package/dist/types/plugin/bindingify-builtin-plugin.d.ts +10 -0
- package/dist/types/plugin/bindingify-output-hooks.d.ts +1 -1
- package/dist/types/plugin/bindingify-plugin.d.ts +1 -1
- package/dist/types/plugin/index.d.ts +49 -29
- package/dist/types/plugin/plugin-context.d.ts +14 -0
- package/dist/types/plugin/plugin-driver.d.ts +5 -1
- package/dist/types/plugin/transfrom-plugin-context.d.ts +9 -5
- package/dist/types/rollup.d.ts +1113 -0
- package/dist/types/treeshake/index.d.ts +14 -0
- package/dist/types/treeshake/module-side-effects.d.ts +15 -0
- package/dist/types/types/rolldown-output.d.ts +3 -1
- package/dist/types/types/sourcemap.d.ts +7 -4
- package/dist/types/types/utils.d.ts +3 -0
- package/dist/types/utils/asset-source.d.ts +4 -0
- package/dist/types/utils/index.d.ts +1 -5
- package/dist/types/utils/initialize-parallel-plugins.d.ts +2 -1
- package/dist/types/utils/misc.d.ts +5 -0
- package/dist/types/utils/normalize-hook.d.ts +2 -2
- package/dist/types/utils/normalize-output-options.d.ts +2 -2
- package/dist/types/utils/normalize-plugin-option.d.ts +2 -2
- package/dist/types/utils/normalize-tree-shake.d.ts +3 -0
- package/dist/types/utils/transform-side-effects.d.ts +1 -1
- package/package.json +20 -21
- package/dist/shared/rolldown-ftFKbC6A.mjs +0 -51
- package/dist/shared/rolldown-l_Cw2GW3.cjs +0 -52
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
type MaybePromise<T> = T | Promise<T>
|
|
2
|
+
type Nullable<T> = T | null | undefined
|
|
3
|
+
type VoidNullable<T = void> = T | null | undefined | void
|
|
4
|
+
export class BindingLog {
|
|
5
|
+
code: string
|
|
6
|
+
message: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class BindingModuleInfo {
|
|
10
|
+
id: string
|
|
11
|
+
importers: Array<string>
|
|
12
|
+
dynamicImporters: Array<string>
|
|
13
|
+
importedIds: Array<string>
|
|
14
|
+
dynamicallyImportedIds: Array<string>
|
|
15
|
+
isEntry: boolean
|
|
16
|
+
get code(): string | null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class BindingOutputAsset {
|
|
20
|
+
get fileName(): string
|
|
21
|
+
get source(): BindingAssetSource
|
|
22
|
+
set source(source: BindingAssetSource)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class BindingOutputChunk {
|
|
26
|
+
get isEntry(): boolean
|
|
27
|
+
get isDynamicEntry(): boolean
|
|
28
|
+
get facadeModuleId(): string | null
|
|
29
|
+
get moduleIds(): Array<string>
|
|
30
|
+
get exports(): Array<string>
|
|
31
|
+
get fileName(): string
|
|
32
|
+
get modules(): Record<string, BindingRenderedModule>
|
|
33
|
+
get imports(): Array<string>
|
|
34
|
+
set imports(imports: Array<string>)
|
|
35
|
+
get dynamicImports(): Array<string>
|
|
36
|
+
get code(): string
|
|
37
|
+
set code(code: string)
|
|
38
|
+
get map(): string | null
|
|
39
|
+
set map(map: string)
|
|
40
|
+
get sourcemapFileName(): string | null
|
|
41
|
+
get preliminaryFileName(): string
|
|
42
|
+
get name(): string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The `BindingOutputs` owner `Vec<Output>` the mutable reference, it avoid `Clone` at call `writeBundle/generateBundle` hook, and make it mutable. */
|
|
46
|
+
export class BindingOutputs {
|
|
47
|
+
get chunks(): Array<BindingOutputChunk>
|
|
48
|
+
get assets(): Array<BindingOutputAsset>
|
|
49
|
+
delete(fileName: string): void
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class BindingPluginContext {
|
|
53
|
+
resolve(specifier: string, importer?: string | undefined | null, extraOptions?: BindingPluginContextResolveOptions | undefined | null): Promise<BindingPluginContextResolvedId | null>
|
|
54
|
+
emitFile(file: BindingEmittedAsset): string
|
|
55
|
+
getFileName(referenceId: string): string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export class BindingTransformPluginContext {
|
|
59
|
+
inner(): BindingPluginContext
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class Bundler {
|
|
63
|
+
constructor(inputOptions: BindingInputOptions, outputOptions: BindingOutputOptions, parallelPluginsRegistry?: ParallelJsPluginRegistry | undefined | null)
|
|
64
|
+
write(): Promise<FinalBindingOutputs>
|
|
65
|
+
generate(): Promise<FinalBindingOutputs>
|
|
66
|
+
scan(): Promise<void>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The `FinalBindingOutputs` is used at `write()` or `generate()`, it is similar to `BindingOutputs`, if using `BindingOutputs` has unexpected behavior.
|
|
71
|
+
* TODO find a way to export it gracefully.
|
|
72
|
+
*/
|
|
73
|
+
export class FinalBindingOutputs {
|
|
74
|
+
get chunks(): Array<BindingOutputChunk>
|
|
75
|
+
get assets(): Array<BindingOutputAsset>
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export class ParallelJsPluginRegistry {
|
|
79
|
+
id: number
|
|
80
|
+
workerCount: number
|
|
81
|
+
constructor(workerCount: number)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface AliasItem {
|
|
85
|
+
find: string
|
|
86
|
+
replacements: Array<string>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface BindingAssetSource {
|
|
90
|
+
inner: string | Uint8Array
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface BindingBuiltinPlugin {
|
|
94
|
+
name: BindingBuiltinPluginName
|
|
95
|
+
options?: unknown
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export enum BindingBuiltinPluginName {
|
|
99
|
+
WasmPlugin = 0
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface BindingEmittedAsset {
|
|
103
|
+
name?: string
|
|
104
|
+
fileName?: string
|
|
105
|
+
source: BindingAssetSource
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface BindingHookLoadOutput {
|
|
109
|
+
code: string
|
|
110
|
+
sideEffects?: BindingHookSideEffects
|
|
111
|
+
map?: BindingSourcemap
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface BindingHookRenderChunkOutput {
|
|
115
|
+
code: string
|
|
116
|
+
map?: BindingSourcemap
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface BindingHookResolveIdExtraOptions {
|
|
120
|
+
isEntry: boolean
|
|
121
|
+
kind: 'import' | 'dynamic-import' | 'require-call'
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface BindingHookResolveIdOutput {
|
|
125
|
+
id: string
|
|
126
|
+
external?: boolean
|
|
127
|
+
sideEffects?: BindingHookSideEffects
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export enum BindingHookSideEffects {
|
|
131
|
+
True = 0,
|
|
132
|
+
False = 1,
|
|
133
|
+
NoTreeshake = 2
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface BindingInputItem {
|
|
137
|
+
name?: string
|
|
138
|
+
import: string
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface BindingInputOptions {
|
|
142
|
+
external?: undefined | ((source: string, importer: string | undefined, isResolved: boolean) => boolean)
|
|
143
|
+
input: Array<BindingInputItem>
|
|
144
|
+
plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
|
|
145
|
+
resolve?: BindingResolveOptions
|
|
146
|
+
shimMissingExports?: boolean
|
|
147
|
+
platform?: 'node' | 'browser' | 'neutral'
|
|
148
|
+
logLevel?: BindingLogLevel
|
|
149
|
+
onLog: (logLevel: 'debug' | 'warn' | 'info', log: BindingLog) => void
|
|
150
|
+
cwd: string
|
|
151
|
+
treeshake?: BindingTreeshake
|
|
152
|
+
moduleTypes?: Record<string, string>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface BindingJsonSourcemap {
|
|
156
|
+
file?: string
|
|
157
|
+
mappings?: string
|
|
158
|
+
sourceRoot?: string
|
|
159
|
+
sources?: Array<string | undefined | null>
|
|
160
|
+
sourcesContent?: Array<string | undefined | null>
|
|
161
|
+
names?: Array<string>
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export enum BindingLogLevel {
|
|
165
|
+
Silent = 0,
|
|
166
|
+
Warn = 1,
|
|
167
|
+
Info = 2,
|
|
168
|
+
Debug = 3
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface BindingOutputOptions {
|
|
172
|
+
entryFileNames?: string
|
|
173
|
+
chunkFileNames?: string
|
|
174
|
+
assetFileNames?: string
|
|
175
|
+
banner?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
176
|
+
dir?: string
|
|
177
|
+
exports?: 'default' | 'named' | 'none' | 'auto'
|
|
178
|
+
footer?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
179
|
+
format?: 'es' | 'cjs'
|
|
180
|
+
plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
|
|
181
|
+
sourcemap?: 'file' | 'inline' | 'hidden'
|
|
182
|
+
sourcemapIgnoreList?: (source: string, sourcemapPath: string) => boolean
|
|
183
|
+
sourcemapPathTransform?: (source: string, sourcemapPath: string) => string
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface BindingPluginContextResolvedId {
|
|
187
|
+
id: string
|
|
188
|
+
external: boolean
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface BindingPluginContextResolveOptions {
|
|
192
|
+
importKind?: 'import' | 'dynamic-import' | 'require-call'
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface BindingPluginOptions {
|
|
196
|
+
name: string
|
|
197
|
+
buildStart?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
198
|
+
resolveId?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>, options: BindingHookResolveIdExtraOptions) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
199
|
+
resolveDynamicImport?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
200
|
+
load?: (ctx: BindingPluginContext, id: string) => MaybePromise<VoidNullable<BindingHookLoadOutput>>
|
|
201
|
+
transform?: (ctx: BindingTransformPluginContext, id: string, code: string) => MaybePromise<VoidNullable<BindingHookLoadOutput>>
|
|
202
|
+
moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
|
|
203
|
+
buildEnd?: (ctx: BindingPluginContext, error: Nullable<string>) => MaybePromise<VoidNullable>
|
|
204
|
+
renderChunk?: (ctx: BindingPluginContext, code: string, chunk: RenderedChunk) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
|
|
205
|
+
augmentChunkHash?: (ctx: BindingPluginContext, chunk: RenderedChunk) => MaybePromise<void | string>
|
|
206
|
+
renderStart?: (ctx: BindingPluginContext) => void
|
|
207
|
+
renderError?: (ctx: BindingPluginContext, error: string) => void
|
|
208
|
+
generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean) => MaybePromise<VoidNullable>
|
|
209
|
+
writeBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs) => MaybePromise<VoidNullable>
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface BindingPluginWithIndex {
|
|
213
|
+
index: number
|
|
214
|
+
plugin: BindingPluginOptions
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface BindingRenderedModule {
|
|
218
|
+
code?: string
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface BindingResolveOptions {
|
|
222
|
+
alias?: Array<AliasItem>
|
|
223
|
+
aliasFields?: Array<Array<string>>
|
|
224
|
+
conditionNames?: Array<string>
|
|
225
|
+
exportsFields?: Array<Array<string>>
|
|
226
|
+
extensions?: Array<string>
|
|
227
|
+
mainFields?: Array<string>
|
|
228
|
+
mainFiles?: Array<string>
|
|
229
|
+
modules?: Array<string>
|
|
230
|
+
symlinks?: boolean
|
|
231
|
+
tsconfigFilename?: string
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface BindingSourcemap {
|
|
235
|
+
inner: string | BindingJSONSourcemap
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface BindingTreeshake {
|
|
239
|
+
moduleSideEffects: string
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void
|
|
243
|
+
|
|
244
|
+
export interface RenderedChunk {
|
|
245
|
+
name: string
|
|
246
|
+
isEntry: boolean
|
|
247
|
+
isDynamicEntry: boolean
|
|
248
|
+
facadeModuleId?: string
|
|
249
|
+
moduleIds: Array<string>
|
|
250
|
+
exports: Array<string>
|
|
251
|
+
fileName: string
|
|
252
|
+
modules: Record<string, BindingRenderedModule>
|
|
253
|
+
imports: Array<string>
|
|
254
|
+
dynamicImports: Array<string>
|
|
255
|
+
}
|
|
256
|
+
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import { RolldownOutput, RolldownOutputChunk } from './types/rolldown-output';
|
|
2
|
-
import type { InputOptions } from './options/input-options';
|
|
3
|
-
import type { OutputOptions } from './options/output-options';
|
|
1
|
+
import { RolldownOutput, RolldownOutputAsset, RolldownOutputChunk, SourceMap } from './types/rolldown-output';
|
|
2
|
+
import type { ExternalOption, InputOption, InputOptions } from './options/input-options';
|
|
3
|
+
import type { ModuleFormat, OutputOptions } from './options/output-options';
|
|
4
4
|
import type { RolldownOptions } from './types/rolldown-options';
|
|
5
|
-
import type { Plugin } from './plugin';
|
|
5
|
+
import type { AsyncPluginHooks, CustomPluginOptions, FunctionPluginHooks, ImportKind, LoadResult, ModuleOptions, ObjectHook, ParallelPluginHooks, PartialResolvedId, Plugin, ResolveIdResult, ResolvedId, SourceDescription, TransformResult } from './plugin';
|
|
6
6
|
import { defineParallelPlugin, DefineParallelPluginResult } from './plugin';
|
|
7
7
|
import { defineConfig } from './utils/define-config';
|
|
8
8
|
import { rolldown, experimental_scan } from './rolldown';
|
|
9
9
|
import { ConfigExport } from './types/config-export';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import { BuiltinWasmPlugin } from './plugin/bindingify-builtin-plugin';
|
|
11
|
+
import { RolldownBuild } from './rolldown-build';
|
|
12
|
+
import { InternalModuleFormat } from './options/bindingify-output-options';
|
|
13
|
+
import { EmittedAsset, EmittedFile, PluginContext } from './plugin/plugin-context';
|
|
14
|
+
import { TransformPluginContext } from './plugin/transfrom-plugin-context';
|
|
15
|
+
import { NormalizedOutputOptions } from './options/normalized-output-options';
|
|
16
|
+
import { RenderedChunk } from './binding';
|
|
17
|
+
import { PartialNull } from './types/utils';
|
|
18
|
+
import { NormalizedInputOptions } from './options/normalized-input-options';
|
|
19
|
+
import { ModuleInfo } from './types/module-info';
|
|
20
|
+
import { MinimalPluginContext } from './log/logger';
|
|
21
|
+
import { ExistingRawSourceMap, SourceMapInput } from './types/sourcemap';
|
|
22
|
+
import { OutputBundle } from './types/output-bundle';
|
|
23
|
+
export { defineConfig, defineParallelPlugin, rolldown, experimental_scan, BuiltinWasmPlugin, };
|
|
24
|
+
export type { RolldownOutputChunk, RolldownOptions, RolldownOutput, RolldownBuild, InputOptions, NormalizedInputOptions, OutputOptions, NormalizedOutputOptions, Plugin, DefineParallelPluginResult, ConfigExport, ImportKind, InputOption, ExternalOption, ModuleFormat, InternalModuleFormat, LoadResult, TransformResult, ResolveIdResult, PluginContext, TransformPluginContext, ObjectHook, RenderedChunk, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, };
|
|
25
|
+
export type { RolldownOutput as RollupOutput, RolldownOptions as RollupOptions, RolldownBuild as RollupBuild, RolldownOutputChunk as OutputChunk, RolldownOutputAsset as OutputAsset, };
|
|
26
|
+
export type { RollupError, RollupLog, LoggingFunction } from './rollup';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BindingInputOptions } from '../binding';
|
|
2
2
|
import type { NormalizedInputOptions } from './normalized-input-options';
|
|
3
3
|
import type { NormalizedOutputOptions } from './normalized-output-options';
|
|
4
4
|
export declare function bindingifyInputOptions(options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingInputOptions;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { BindingOutputOptions } from '../binding';
|
|
2
2
|
import type { NormalizedOutputOptions } from './normalized-output-options';
|
|
3
|
+
export type InternalModuleFormat = 'es' | 'cjs';
|
|
3
4
|
export declare function bindingifyOutputOptions(outputOptions: NormalizedOutputOptions): BindingOutputOptions;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RolldownPlugin } from '../plugin';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { TreeshakingOptions } from '../treeshake';
|
|
4
|
+
declare const inputOptionSchema: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
5
|
+
declare const externalSchema: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>, z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodOptional<z.ZodString>, z.ZodBoolean], z.ZodUnknown>, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodVoid, z.ZodNull]>, z.ZodUndefined]>, z.ZodBoolean]>>]>;
|
|
3
6
|
declare const inputOptionsSchema: z.ZodObject<{
|
|
4
7
|
input: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
5
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodType<
|
|
6
|
-
external: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>, z.
|
|
8
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodType<RolldownPlugin, z.ZodTypeDef, RolldownPlugin>, "many">>;
|
|
9
|
+
external: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>, z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodOptional<z.ZodString>, z.ZodBoolean], z.ZodUnknown>, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodVoid, z.ZodNull]>, z.ZodUndefined]>, z.ZodBoolean]>>]>>;
|
|
7
10
|
resolve: z.ZodOptional<z.ZodObject<{
|
|
8
11
|
alias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
9
12
|
aliasFields: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
|
|
@@ -41,12 +44,22 @@ declare const inputOptionsSchema: z.ZodObject<{
|
|
|
41
44
|
cwd: z.ZodOptional<z.ZodString>;
|
|
42
45
|
platform: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"node">, z.ZodLiteral<"browser">]>, z.ZodLiteral<"neutral">]>>;
|
|
43
46
|
shimMissingExports: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
treeshake: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<z.objectUtil.extendShape<{
|
|
48
|
+
moduleSideEffects: z.ZodUnion<[z.ZodBoolean, z.ZodString]>;
|
|
49
|
+
}, {
|
|
50
|
+
moduleSideEffects: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
|
|
51
|
+
}>, "strict", z.ZodTypeAny, {
|
|
52
|
+
moduleSideEffects?: string | boolean | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
moduleSideEffects?: string | boolean | undefined;
|
|
55
|
+
}>]>>;
|
|
44
56
|
logLevel: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>, z.ZodLiteral<"silent">]>>;
|
|
45
57
|
onLog: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>, z.ZodAny, z.ZodFunction<z.ZodTuple<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>, z.ZodLiteral<"error">]>, z.ZodUnion<[z.ZodAny, z.ZodString]>], z.ZodUnknown>, z.ZodUnknown>], z.ZodUnknown>, z.ZodUnknown>>;
|
|
46
58
|
onwarn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny, z.ZodFunction<z.ZodTuple<[z.ZodUnion<[z.ZodUnion<[z.ZodAny, z.ZodString]>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnion<[z.ZodAny, z.ZodString]>>]>], z.ZodUnknown>, z.ZodUnknown>], z.ZodUnknown>, z.ZodUnknown>>;
|
|
59
|
+
moduleTypes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"js">, z.ZodLiteral<"jsx">]>, z.ZodLiteral<"ts">]>, z.ZodLiteral<"tsx">]>, z.ZodLiteral<"empty">]>, z.ZodLiteral<"json">]>, z.ZodLiteral<"text">]>, z.ZodLiteral<"base64">]>, z.ZodLiteral<"binary">]>, z.ZodLiteral<"empty">]>>>;
|
|
47
60
|
}, "strict", z.ZodTypeAny, {
|
|
48
61
|
input?: string | string[] | Record<string, string> | undefined;
|
|
49
|
-
plugins?:
|
|
62
|
+
plugins?: RolldownPlugin[] | undefined;
|
|
50
63
|
external?: string | RegExp | (string | RegExp)[] | ((args_0: string, args_1: string | undefined, args_2: boolean, ...args_3: unknown[]) => boolean | void | null | undefined) | undefined;
|
|
51
64
|
resolve?: {
|
|
52
65
|
modules?: string[] | undefined;
|
|
@@ -63,12 +76,16 @@ declare const inputOptionsSchema: z.ZodObject<{
|
|
|
63
76
|
cwd?: string | undefined;
|
|
64
77
|
platform?: "node" | "browser" | "neutral" | undefined;
|
|
65
78
|
shimMissingExports?: boolean | undefined;
|
|
79
|
+
treeshake?: boolean | {
|
|
80
|
+
moduleSideEffects?: string | boolean | undefined;
|
|
81
|
+
} | undefined;
|
|
66
82
|
logLevel?: "info" | "debug" | "warn" | "silent" | undefined;
|
|
67
83
|
onLog?: ((args_0: "info" | "debug" | "warn", args_1: any, args_2: (args_0: "info" | "debug" | "warn" | "error", args_1: any, ...args_2: unknown[]) => unknown, ...args_3: unknown[]) => unknown) | undefined;
|
|
68
84
|
onwarn?: ((args_0: any, args_1: (args_0: any, ...args_1: unknown[]) => unknown, ...args_2: unknown[]) => unknown) | undefined;
|
|
85
|
+
moduleTypes?: Record<string, "js" | "jsx" | "ts" | "tsx" | "empty" | "json" | "text" | "base64" | "binary"> | undefined;
|
|
69
86
|
}, {
|
|
70
87
|
input?: string | string[] | Record<string, string> | undefined;
|
|
71
|
-
plugins?:
|
|
88
|
+
plugins?: RolldownPlugin[] | undefined;
|
|
72
89
|
external?: string | RegExp | (string | RegExp)[] | ((args_0: string, args_1: string | undefined, args_2: boolean, ...args_3: unknown[]) => boolean | void | null | undefined) | undefined;
|
|
73
90
|
resolve?: {
|
|
74
91
|
modules?: string[] | undefined;
|
|
@@ -85,9 +102,17 @@ declare const inputOptionsSchema: z.ZodObject<{
|
|
|
85
102
|
cwd?: string | undefined;
|
|
86
103
|
platform?: "node" | "browser" | "neutral" | undefined;
|
|
87
104
|
shimMissingExports?: boolean | undefined;
|
|
105
|
+
treeshake?: boolean | {
|
|
106
|
+
moduleSideEffects?: string | boolean | undefined;
|
|
107
|
+
} | undefined;
|
|
88
108
|
logLevel?: "info" | "debug" | "warn" | "silent" | undefined;
|
|
89
109
|
onLog?: ((args_0: "info" | "debug" | "warn", args_1: any, args_2: (args_0: "info" | "debug" | "warn" | "error", args_1: any, ...args_2: unknown[]) => unknown, ...args_3: unknown[]) => unknown) | undefined;
|
|
90
110
|
onwarn?: ((args_0: any, args_1: (args_0: any, ...args_1: unknown[]) => unknown, ...args_2: unknown[]) => unknown) | undefined;
|
|
111
|
+
moduleTypes?: Record<string, "js" | "jsx" | "ts" | "tsx" | "empty" | "json" | "text" | "base64" | "binary"> | undefined;
|
|
91
112
|
}>;
|
|
92
|
-
export type
|
|
113
|
+
export type InputOption = z.infer<typeof inputOptionSchema>;
|
|
114
|
+
export type ExternalOption = z.infer<typeof externalSchema>;
|
|
115
|
+
export type InputOptions = Omit<z.infer<typeof inputOptionsSchema>, 'treeshake'> & {
|
|
116
|
+
treeshake?: boolean | TreeshakingOptions;
|
|
117
|
+
};
|
|
93
118
|
export {};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { LogLevelOption, RollupLog, NormalizedInputOptions as RollupNormalizedInputOptions } from '../rollup';
|
|
2
2
|
import type { InputOptions } from './input-options';
|
|
3
|
-
import type {
|
|
3
|
+
import type { RolldownPlugin } from '../plugin';
|
|
4
4
|
import type { LogLevel } from '../log/logging';
|
|
5
|
+
import { NormalizedTreeshakingOptions } from '../../src/treeshake';
|
|
5
6
|
export interface NormalizedInputOptions extends InputOptions {
|
|
6
7
|
input: RollupNormalizedInputOptions['input'];
|
|
7
|
-
plugins:
|
|
8
|
+
plugins: RolldownPlugin[];
|
|
8
9
|
onLog: (level: LogLevel, log: RollupLog) => void;
|
|
9
10
|
logLevel: LogLevelOption;
|
|
11
|
+
treeshake?: NormalizedTreeshakingOptions;
|
|
10
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../rollup';
|
|
2
2
|
import type { OutputOptions } from './output-options';
|
|
3
3
|
import type { Plugin, ParallelPlugin } from '../plugin';
|
|
4
|
-
import type { RenderedChunk } from '
|
|
4
|
+
import type { RenderedChunk } from '../binding';
|
|
5
5
|
type InternalModuleFormat = 'es' | 'cjs';
|
|
6
6
|
type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
7
7
|
export interface NormalizedOutputOptions extends OutputOptions {
|
|
@@ -16,5 +16,6 @@ export interface NormalizedOutputOptions extends OutputOptions {
|
|
|
16
16
|
footer: AddonFunction;
|
|
17
17
|
entryFileNames: string;
|
|
18
18
|
chunkFileNames: string;
|
|
19
|
+
assetFileNames: string;
|
|
19
20
|
}
|
|
20
21
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { RenderedChunk } from '../binding';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
declare const ModuleFormatSchema: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>>;
|
|
3
4
|
declare const outputOptionsSchema: z.ZodObject<{
|
|
4
5
|
dir: z.ZodOptional<z.ZodString>;
|
|
5
6
|
exports: z.ZodOptional<z.ZodLiteral<"named">>;
|
|
6
|
-
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.
|
|
7
|
+
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>>;
|
|
7
8
|
sourcemap: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"inline">]>, z.ZodLiteral<"hidden">]>>;
|
|
8
9
|
sourcemapIgnoreList: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodType<SourcemapIgnoreListOption, z.ZodTypeDef, SourcemapIgnoreListOption>]>>;
|
|
9
10
|
sourcemapPathTransform: z.ZodOptional<z.ZodType<SourcemapPathTransformOption, z.ZodTypeDef, SourcemapPathTransformOption>>;
|
|
@@ -11,30 +12,34 @@ declare const outputOptionsSchema: z.ZodObject<{
|
|
|
11
12
|
footer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
12
13
|
entryFileNames: z.ZodOptional<z.ZodString>;
|
|
13
14
|
chunkFileNames: z.ZodOptional<z.ZodString>;
|
|
15
|
+
assetFileNames: z.ZodOptional<z.ZodString>;
|
|
14
16
|
}, "strict", z.ZodTypeAny, {
|
|
15
17
|
exports?: "named" | undefined;
|
|
16
|
-
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
17
|
-
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
18
18
|
dir?: string | undefined;
|
|
19
19
|
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | undefined;
|
|
20
20
|
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
21
21
|
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
|
|
22
22
|
sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
|
|
23
|
+
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
24
|
+
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
23
25
|
entryFileNames?: string | undefined;
|
|
24
26
|
chunkFileNames?: string | undefined;
|
|
27
|
+
assetFileNames?: string | undefined;
|
|
25
28
|
}, {
|
|
26
29
|
exports?: "named" | undefined;
|
|
27
|
-
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
28
|
-
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
29
30
|
dir?: string | undefined;
|
|
30
31
|
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | undefined;
|
|
31
32
|
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
32
33
|
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
|
|
33
34
|
sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
|
|
35
|
+
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
36
|
+
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
34
37
|
entryFileNames?: string | undefined;
|
|
35
38
|
chunkFileNames?: string | undefined;
|
|
39
|
+
assetFileNames?: string | undefined;
|
|
36
40
|
}>;
|
|
37
41
|
export type OutputOptions = z.infer<typeof outputOptionsSchema>;
|
|
38
42
|
export type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
|
|
39
43
|
export type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
|
|
44
|
+
export type ModuleFormat = z.infer<typeof ModuleFormatSchema>;
|
|
40
45
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BindingBuiltinPlugin, BindingBuiltinPluginName } from '../binding';
|
|
2
|
+
export declare class BuiltinPlugin {
|
|
3
|
+
name: BindingBuiltinPluginName;
|
|
4
|
+
options?: unknown;
|
|
5
|
+
constructor(name: BindingBuiltinPluginName, options?: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare class BuiltinWasmPlugin extends BuiltinPlugin {
|
|
8
|
+
constructor(options?: unknown);
|
|
9
|
+
}
|
|
10
|
+
export declare function bindingifyBuiltInPlugin(plugin: BuiltinPlugin): BindingBuiltinPlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BindingPluginOptions } from '../binding';
|
|
2
2
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
3
3
|
import type { Plugin } from './index';
|
|
4
|
-
import { NormalizedOutputOptions } from '
|
|
4
|
+
import { NormalizedOutputOptions } from '../options/normalized-output-options';
|
|
5
5
|
export declare function bindingifyRenderStart(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingPluginOptions['renderStart'];
|
|
6
6
|
export declare function bindingifyRenderChunk(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingPluginOptions['renderChunk'];
|
|
7
7
|
export declare function bindingifyAugmentChunkHash(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['augmentChunkHash'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BindingPluginOptions } from '../binding';
|
|
2
2
|
import type { Plugin } from './index';
|
|
3
3
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
|
-
import type { NormalizedOutputOptions } from '
|
|
4
|
+
import type { NormalizedOutputOptions } from '../options/normalized-output-options';
|
|
5
5
|
export declare function bindingifyPlugin(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingPluginOptions;
|
|
@@ -1,57 +1,69 @@
|
|
|
1
1
|
import type { BindingHookResolveIdExtraOptions, RenderedChunk } from '../binding';
|
|
2
2
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
3
|
-
import type { AnyFn, AnyObj, NullValue, MaybePromise } from '../types/utils';
|
|
3
|
+
import type { AnyFn, AnyObj, NullValue, MaybePromise, PartialNull } from '../types/utils';
|
|
4
4
|
import type { SourceMapInput } from '../types/sourcemap';
|
|
5
5
|
import type { ModuleInfo } from '../types/module-info';
|
|
6
6
|
import type { OutputBundle } from '../types/output-bundle';
|
|
7
7
|
import type { PluginContext } from './plugin-context';
|
|
8
8
|
import type { TransformPluginContext } from './transfrom-plugin-context';
|
|
9
|
-
import type { NormalizedOutputOptions } from '
|
|
9
|
+
import type { NormalizedOutputOptions } from '../options/normalized-output-options';
|
|
10
10
|
import type { LogLevel } from '../log/logging';
|
|
11
11
|
import type { RollupLog } from '../rollup';
|
|
12
12
|
import type { MinimalPluginContext } from '../log/logger';
|
|
13
|
+
import { InputOptions, OutputOptions } from '..';
|
|
14
|
+
import { BuiltinPlugin } from './bindingify-builtin-plugin';
|
|
13
15
|
type FormalHook<Handler extends AnyFn, HookOptions extends AnyObj = AnyObj> = {
|
|
14
16
|
handler: Handler;
|
|
15
17
|
} & HookOptions;
|
|
16
|
-
export type
|
|
18
|
+
export type ObjectHook<Handler extends AnyFn, HookOptions extends AnyObj = AnyObj> = FormalHook<Handler, HookOptions> | Handler;
|
|
17
19
|
export type ModuleSideEffects = boolean | 'no-treeshake' | null;
|
|
18
|
-
export type
|
|
20
|
+
export type ImportKind = BindingHookResolveIdExtraOptions['kind'];
|
|
21
|
+
export interface CustomPluginOptions {
|
|
22
|
+
[plugin: string]: any;
|
|
23
|
+
}
|
|
24
|
+
export interface ModuleOptions {
|
|
25
|
+
moduleSideEffects: ModuleSideEffects;
|
|
26
|
+
}
|
|
27
|
+
export interface ResolvedId extends ModuleOptions {
|
|
28
|
+
external: boolean;
|
|
19
29
|
id: string;
|
|
30
|
+
}
|
|
31
|
+
export interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
|
|
20
32
|
external?: boolean;
|
|
21
|
-
|
|
22
|
-
}
|
|
33
|
+
id: string;
|
|
34
|
+
}
|
|
35
|
+
export interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
|
|
36
|
+
code: string;
|
|
37
|
+
map?: SourceMapInput;
|
|
38
|
+
}
|
|
39
|
+
export type ResolveIdResult = string | NullValue | false | PartialResolvedId;
|
|
40
|
+
export type LoadResult = NullValue | string | SourceDescription;
|
|
41
|
+
export type TransformResult = NullValue | string | SourceDescription;
|
|
23
42
|
export interface Plugin {
|
|
24
43
|
name?: string;
|
|
25
|
-
onLog?:
|
|
26
|
-
options?:
|
|
27
|
-
|
|
28
|
-
|
|
44
|
+
onLog?: ObjectHook<(this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean>;
|
|
45
|
+
options?: ObjectHook<(this: MinimalPluginContext, options: InputOptions) => MaybePromise<NullValue | InputOptions>>;
|
|
46
|
+
outputOptions?: ObjectHook<(this: null, options: OutputOptions) => MaybePromise<NullValue | OutputOptions>>;
|
|
47
|
+
buildStart?: ObjectHook<(this: PluginContext, options: NormalizedInputOptions) => MaybePromise<NullValue>>;
|
|
48
|
+
resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, extraOptions: BindingHookResolveIdExtraOptions) => MaybePromise<ResolveIdResult>>;
|
|
29
49
|
/**
|
|
30
50
|
* @deprecated
|
|
31
51
|
* This hook is only for rollup plugin compatibility. Please use `resolveId` instead.
|
|
32
52
|
*/
|
|
33
|
-
resolveDynamicImport?:
|
|
34
|
-
load?:
|
|
53
|
+
resolveDynamicImport?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined) => MaybePromise<ResolveIdResult>>;
|
|
54
|
+
load?: ObjectHook<(this: PluginContext, id: string) => MaybePromise<LoadResult>>;
|
|
55
|
+
transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string) => MaybePromise<TransformResult>>;
|
|
56
|
+
moduleParsed?: ObjectHook<(this: PluginContext, moduleInfo: ModuleInfo) => MaybePromise<NullValue>>;
|
|
57
|
+
buildEnd?: ObjectHook<(this: PluginContext, err?: Error) => MaybePromise<NullValue>>;
|
|
58
|
+
renderStart?: ObjectHook<(this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => MaybePromise<NullValue>>;
|
|
59
|
+
renderChunk?: ObjectHook<(this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => MaybePromise<NullValue | string | {
|
|
35
60
|
code: string;
|
|
36
61
|
map?: SourceMapInput;
|
|
37
|
-
moduleSideEffects?: ModuleSideEffects;
|
|
38
|
-
}>>;
|
|
39
|
-
transform?: Hook<(this: TransformPluginContext, code: string, id: string) => MaybePromise<NullValue | string | {
|
|
40
|
-
code: string;
|
|
41
|
-
map?: string | null | SourceMapInput;
|
|
42
|
-
moduleSideEffects?: ModuleSideEffects;
|
|
43
|
-
}>>;
|
|
44
|
-
moduleParsed?: Hook<(this: PluginContext, moduleInfo: ModuleInfo) => MaybePromise<NullValue>>;
|
|
45
|
-
buildEnd?: Hook<(this: PluginContext, err?: Error) => MaybePromise<NullValue>>;
|
|
46
|
-
renderStart?: Hook<(this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => MaybePromise<NullValue>>;
|
|
47
|
-
renderChunk?: Hook<(this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => MaybePromise<NullValue | string | {
|
|
48
|
-
code: string;
|
|
49
|
-
map?: string | null | SourceMapInput;
|
|
50
62
|
}>>;
|
|
51
|
-
augmentChunkHash?:
|
|
52
|
-
renderError?:
|
|
53
|
-
generateBundle?:
|
|
54
|
-
writeBundle?:
|
|
63
|
+
augmentChunkHash?: ObjectHook<(this: PluginContext, chunk: RenderedChunk) => MaybePromise<string | void>>;
|
|
64
|
+
renderError?: ObjectHook<(this: PluginContext, error: Error) => MaybePromise<NullValue>>;
|
|
65
|
+
generateBundle?: ObjectHook<(this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => MaybePromise<NullValue>>;
|
|
66
|
+
writeBundle?: ObjectHook<(this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => MaybePromise<NullValue>>;
|
|
55
67
|
}
|
|
56
68
|
export type ParallelPlugin = {
|
|
57
69
|
/** @internal */
|
|
@@ -60,6 +72,14 @@ export type ParallelPlugin = {
|
|
|
60
72
|
options: unknown;
|
|
61
73
|
};
|
|
62
74
|
};
|
|
75
|
+
export type RolldownPlugin = Plugin | ParallelPlugin | BuiltinPlugin;
|
|
63
76
|
export type DefineParallelPluginResult<Options> = (options: Options) => ParallelPlugin;
|
|
64
77
|
export declare function defineParallelPlugin<Options>(pluginPath: string): DefineParallelPluginResult<Options>;
|
|
78
|
+
export type FunctionPluginHooks = Plugin;
|
|
79
|
+
export type SyncPluginHooks = 'augmentChunkHash' | 'onLog' | 'outputOptions' | 'renderDynamicImport' | 'resolveFileUrl' | 'resolveImportMeta';
|
|
80
|
+
export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
|
|
81
|
+
export type FirstPluginHooks = 'load' | 'renderDynamicImport' | 'resolveDynamicImport' | 'resolveFileUrl' | 'resolveId' | 'resolveImportMeta' | 'shouldTransformCachedModule';
|
|
82
|
+
export type SequentialPluginHooks = 'augmentChunkHash' | 'generateBundle' | 'onLog' | 'options' | 'outputOptions' | 'renderChunk' | 'transform';
|
|
83
|
+
export type AddonHooks = 'banner' | 'footer' | 'intro' | 'outro';
|
|
84
|
+
export type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
65
85
|
export {};
|
|
@@ -2,11 +2,25 @@ import type { RollupError, LoggingFunction } from '../rollup';
|
|
|
2
2
|
import type { BindingPluginContext } from '../binding';
|
|
3
3
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
4
|
import type { Plugin } from './index';
|
|
5
|
+
import { AssetSource } from '../utils/asset-source';
|
|
6
|
+
export interface EmittedAsset {
|
|
7
|
+
type: 'asset';
|
|
8
|
+
name?: string;
|
|
9
|
+
fileName?: string;
|
|
10
|
+
source: AssetSource;
|
|
11
|
+
}
|
|
12
|
+
export type EmittedFile = EmittedAsset;
|
|
5
13
|
export declare class PluginContext {
|
|
6
14
|
debug: LoggingFunction;
|
|
7
15
|
info: LoggingFunction;
|
|
8
16
|
warn: LoggingFunction;
|
|
9
17
|
error: (error: RollupError | string) => never;
|
|
10
18
|
resolve: BindingPluginContext['resolve'];
|
|
19
|
+
emitFile: (file: EmittedAsset) => string;
|
|
20
|
+
getFileName: (referenceId: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
|
|
23
|
+
*/
|
|
24
|
+
parse: (input: string, options?: any) => any;
|
|
11
25
|
constructor(options: NormalizedInputOptions, context: BindingPluginContext, plugin: Plugin);
|
|
12
26
|
}
|