1 | export const VERSION: string;
|
2 |
|
3 | export interface RollupError extends RollupLogProps {
|
4 | parserError?: Error;
|
5 | stack?: string;
|
6 | watchFiles?: string[];
|
7 | }
|
8 |
|
9 | export interface RollupWarning extends RollupLogProps {
|
10 | chunkName?: string;
|
11 | cycle?: string[];
|
12 | exportName?: string;
|
13 | exporter?: string;
|
14 | guess?: string;
|
15 | importer?: string;
|
16 | missing?: string;
|
17 | modules?: string[];
|
18 | names?: string[];
|
19 | reexporter?: string;
|
20 | source?: string;
|
21 | sources?: string[];
|
22 | }
|
23 |
|
24 | export interface RollupLogProps {
|
25 | code?: string;
|
26 | frame?: string;
|
27 | hook?: string;
|
28 | id?: string;
|
29 | loc?: {
|
30 | column: number;
|
31 | file?: string;
|
32 | line: number;
|
33 | };
|
34 | message: string;
|
35 | name?: string;
|
36 | plugin?: string;
|
37 | pluginCode?: string;
|
38 | pos?: number;
|
39 | url?: string;
|
40 | }
|
41 |
|
42 | export type SourceMapSegment =
|
43 | | [number]
|
44 | | [number, number, number, number]
|
45 | | [number, number, number, number, number];
|
46 |
|
47 | export interface ExistingDecodedSourceMap {
|
48 | file?: string;
|
49 | mappings: SourceMapSegment[][];
|
50 | names: string[];
|
51 | sourceRoot?: string;
|
52 | sources: (string | null)[];
|
53 | sourcesContent?: string[];
|
54 | version: number;
|
55 | }
|
56 |
|
57 | export interface ExistingRawSourceMap {
|
58 | file?: string;
|
59 | mappings: string;
|
60 | names: string[];
|
61 | sourceRoot?: string;
|
62 | sources: string[];
|
63 | sourcesContent?: string[];
|
64 | version: number;
|
65 | }
|
66 |
|
67 | export type DecodedSourceMapOrMissing =
|
68 | | {
|
69 | mappings?: never;
|
70 | missing: true;
|
71 | plugin: string;
|
72 | }
|
73 | | ExistingDecodedSourceMap;
|
74 |
|
75 | export interface SourceMap {
|
76 | file: string;
|
77 | mappings: string;
|
78 | names: string[];
|
79 | sources: string[];
|
80 | sourcesContent: string[];
|
81 | version: number;
|
82 | toString(): string;
|
83 | toUrl(): string;
|
84 | }
|
85 |
|
86 | export type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
|
87 |
|
88 | type PartialNull<T> = {
|
89 | [P in keyof T]: T[P] | null;
|
90 | };
|
91 |
|
92 | interface ModuleOptions {
|
93 | meta: CustomPluginOptions;
|
94 | moduleSideEffects: boolean | 'no-treeshake';
|
95 | syntheticNamedExports: boolean | string;
|
96 | }
|
97 |
|
98 | export interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
|
99 | ast?: AcornNode;
|
100 | code: string;
|
101 | map?: SourceMapInput;
|
102 | }
|
103 |
|
104 | export interface TransformModuleJSON extends Partial<PartialNull<ModuleOptions>> {
|
105 | ast?: AcornNode;
|
106 | code: string;
|
107 |
|
108 | customTransformCache: boolean;
|
109 | originalCode: string;
|
110 | originalSourcemap: ExistingDecodedSourceMap | null;
|
111 | resolvedIds?: ResolvedIdMap;
|
112 | sourcemapChain: DecodedSourceMapOrMissing[];
|
113 | transformDependencies: string[];
|
114 | }
|
115 |
|
116 | export interface ModuleJSON extends TransformModuleJSON {
|
117 | ast: AcornNode;
|
118 | dependencies: string[];
|
119 | id: string;
|
120 | transformFiles: EmittedFile[] | undefined;
|
121 | }
|
122 |
|
123 | export interface PluginCache {
|
124 | delete(id: string): boolean;
|
125 | get<T = any>(id: string): T;
|
126 | has(id: string): boolean;
|
127 | set<T = any>(id: string, value: T): void;
|
128 | }
|
129 |
|
130 | export interface MinimalPluginContext {
|
131 | meta: PluginContextMeta;
|
132 | }
|
133 |
|
134 | export interface EmittedAsset {
|
135 | fileName?: string;
|
136 | name?: string;
|
137 | source?: string | Uint8Array;
|
138 | type: 'asset';
|
139 | }
|
140 |
|
141 | export interface EmittedChunk {
|
142 | fileName?: string;
|
143 | id: string;
|
144 | implicitlyLoadedAfterOneOf?: string[];
|
145 | importer?: string;
|
146 | name?: string;
|
147 | preserveSignature?: PreserveEntrySignaturesOption;
|
148 | type: 'chunk';
|
149 | }
|
150 |
|
151 | export type EmittedFile = EmittedAsset | EmittedChunk;
|
152 |
|
153 | export type EmitAsset = (name: string, source?: string | Uint8Array) => string;
|
154 |
|
155 | export type EmitChunk = (id: string, options?: { name?: string }) => string;
|
156 |
|
157 | export type EmitFile = (emittedFile: EmittedFile) => string;
|
158 |
|
159 | interface ModuleInfo {
|
160 | ast: AcornNode | null;
|
161 | code: string | null;
|
162 | dynamicImporters: readonly string[];
|
163 | dynamicallyImportedIds: readonly string[];
|
164 | hasModuleSideEffects: boolean | 'no-treeshake';
|
165 | id: string;
|
166 | implicitlyLoadedAfterOneOf: readonly string[];
|
167 | implicitlyLoadedBefore: readonly string[];
|
168 | importedIds: readonly string[];
|
169 | importers: readonly string[];
|
170 | isEntry: boolean;
|
171 | isExternal: boolean;
|
172 | isIncluded: boolean | null;
|
173 | meta: CustomPluginOptions;
|
174 | syntheticNamedExports: boolean | string;
|
175 | }
|
176 |
|
177 | export type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
|
178 |
|
179 | export interface CustomPluginOptions {
|
180 | [plugin: string]: any;
|
181 | }
|
182 |
|
183 | export interface PluginContext extends MinimalPluginContext {
|
184 | addWatchFile: (id: string) => void;
|
185 | cache: PluginCache;
|
186 |
|
187 | emitAsset: EmitAsset;
|
188 |
|
189 | emitChunk: EmitChunk;
|
190 | emitFile: EmitFile;
|
191 | error: (err: RollupError | string, pos?: number | { column: number; line: number }) => never;
|
192 |
|
193 | getAssetFileName: (assetReferenceId: string) => string;
|
194 |
|
195 | getChunkFileName: (chunkReferenceId: string) => string;
|
196 | getFileName: (fileReferenceId: string) => string;
|
197 | getModuleIds: () => IterableIterator<string>;
|
198 | getModuleInfo: GetModuleInfo;
|
199 | getWatchFiles: () => string[];
|
200 |
|
201 | isExternal: IsExternal;
|
202 | load: (options: { id: string } & Partial<PartialNull<ModuleOptions>>) => Promise<ModuleInfo>;
|
203 |
|
204 | moduleIds: IterableIterator<string>;
|
205 | parse: (input: string, options?: any) => AcornNode;
|
206 | resolve: (
|
207 | source: string,
|
208 | importer?: string,
|
209 | options?: { custom?: CustomPluginOptions; isEntry?: boolean; skipSelf?: boolean }
|
210 | ) => Promise<ResolvedId | null>;
|
211 |
|
212 | resolveId: (source: string, importer?: string) => Promise<string | null>;
|
213 | setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
|
214 | warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
|
215 | }
|
216 |
|
217 | export interface PluginContextMeta {
|
218 | rollupVersion: string;
|
219 | watchMode: boolean;
|
220 | }
|
221 |
|
222 | export interface ResolvedId extends ModuleOptions {
|
223 | external: boolean | 'absolute';
|
224 | id: string;
|
225 | }
|
226 |
|
227 | export interface ResolvedIdMap {
|
228 | [key: string]: ResolvedId;
|
229 | }
|
230 |
|
231 | interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
|
232 | external?: boolean | 'absolute' | 'relative';
|
233 | id: string;
|
234 | }
|
235 |
|
236 | export type ResolveIdResult = string | false | null | undefined | PartialResolvedId;
|
237 |
|
238 | export type ResolveIdHook = (
|
239 | this: PluginContext,
|
240 | source: string,
|
241 | importer: string | undefined,
|
242 | options: { custom?: CustomPluginOptions; isEntry: boolean }
|
243 | ) => Promise<ResolveIdResult> | ResolveIdResult;
|
244 |
|
245 | export type IsExternal = (
|
246 | source: string,
|
247 | importer: string | undefined,
|
248 | isResolved: boolean
|
249 | ) => boolean;
|
250 |
|
251 | export type IsPureModule = (id: string) => boolean | null | undefined;
|
252 |
|
253 | export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
|
254 |
|
255 | type LoadResult = SourceDescription | string | null | undefined;
|
256 |
|
257 | export type LoadHook = (this: PluginContext, id: string) => Promise<LoadResult> | LoadResult;
|
258 |
|
259 | export interface TransformPluginContext extends PluginContext {
|
260 | getCombinedSourcemap: () => SourceMap;
|
261 | }
|
262 |
|
263 | export type TransformResult = string | null | undefined | Partial<SourceDescription>;
|
264 |
|
265 | export type TransformHook = (
|
266 | this: TransformPluginContext,
|
267 | code: string,
|
268 | id: string
|
269 | ) => Promise<TransformResult> | TransformResult;
|
270 |
|
271 | export type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => Promise<void> | void;
|
272 |
|
273 | export type RenderChunkHook = (
|
274 | this: PluginContext,
|
275 | code: string,
|
276 | chunk: RenderedChunk,
|
277 | options: NormalizedOutputOptions
|
278 | ) =>
|
279 | | Promise<{ code: string; map?: SourceMapInput } | null>
|
280 | | { code: string; map?: SourceMapInput }
|
281 | | string
|
282 | | null
|
283 | | undefined;
|
284 |
|
285 | export type ResolveDynamicImportHook = (
|
286 | this: PluginContext,
|
287 | specifier: string | AcornNode,
|
288 | importer: string
|
289 | ) => Promise<ResolveIdResult> | ResolveIdResult;
|
290 |
|
291 | export type ResolveImportMetaHook = (
|
292 | this: PluginContext,
|
293 | prop: string | null,
|
294 | options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
|
295 | ) => string | null | undefined;
|
296 |
|
297 | export type ResolveAssetUrlHook = (
|
298 | this: PluginContext,
|
299 | options: {
|
300 | assetFileName: string;
|
301 | chunkId: string;
|
302 | format: InternalModuleFormat;
|
303 | moduleId: string;
|
304 | relativeAssetPath: string;
|
305 | }
|
306 | ) => string | null | undefined;
|
307 |
|
308 | export type ResolveFileUrlHook = (
|
309 | this: PluginContext,
|
310 | options: {
|
311 | assetReferenceId: string | null;
|
312 | chunkId: string;
|
313 | chunkReferenceId: string | null;
|
314 | fileName: string;
|
315 | format: InternalModuleFormat;
|
316 | moduleId: string;
|
317 | referenceId: string;
|
318 | relativePath: string;
|
319 | }
|
320 | ) => string | null | undefined;
|
321 |
|
322 | export type AddonHookFunction = (this: PluginContext) => string | Promise<string>;
|
323 | export type AddonHook = string | AddonHookFunction;
|
324 |
|
325 | export type ChangeEvent = 'create' | 'update' | 'delete';
|
326 | export type WatchChangeHook = (
|
327 | this: PluginContext,
|
328 | id: string,
|
329 | change: { event: ChangeEvent }
|
330 | ) => void;
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 | export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
|
344 |
|
345 | export interface OutputBundle {
|
346 | [fileName: string]: OutputAsset | OutputChunk;
|
347 | }
|
348 |
|
349 | export interface FilePlaceholder {
|
350 | type: 'placeholder';
|
351 | }
|
352 |
|
353 | export interface OutputBundleWithPlaceholders {
|
354 | [fileName: string]: OutputAsset | OutputChunk | FilePlaceholder;
|
355 | }
|
356 |
|
357 | export interface PluginHooks extends OutputPluginHooks {
|
358 | buildEnd: (this: PluginContext, err?: Error) => Promise<void> | void;
|
359 | buildStart: (this: PluginContext, options: NormalizedInputOptions) => Promise<void> | void;
|
360 | closeBundle: (this: PluginContext) => Promise<void> | void;
|
361 | closeWatcher: (this: PluginContext) => void;
|
362 | load: LoadHook;
|
363 | moduleParsed: ModuleParsedHook;
|
364 | options: (
|
365 | this: MinimalPluginContext,
|
366 | options: InputOptions
|
367 | ) => Promise<InputOptions | null | undefined> | InputOptions | null | undefined;
|
368 | resolveDynamicImport: ResolveDynamicImportHook;
|
369 | resolveId: ResolveIdHook;
|
370 | transform: TransformHook;
|
371 | watchChange: WatchChangeHook;
|
372 | }
|
373 |
|
374 | interface OutputPluginHooks {
|
375 | augmentChunkHash: (this: PluginContext, chunk: PreRenderedChunk) => string | void;
|
376 | generateBundle: (
|
377 | this: PluginContext,
|
378 | options: NormalizedOutputOptions,
|
379 | bundle: OutputBundle,
|
380 | isWrite: boolean
|
381 | ) => void | Promise<void>;
|
382 | outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | undefined;
|
383 | renderChunk: RenderChunkHook;
|
384 | renderDynamicImport: (
|
385 | this: PluginContext,
|
386 | options: {
|
387 | customResolution: string | null;
|
388 | format: InternalModuleFormat;
|
389 | moduleId: string;
|
390 | targetModuleId: string | null;
|
391 | }
|
392 | ) => { left: string; right: string } | null | undefined;
|
393 | renderError: (this: PluginContext, err?: Error) => Promise<void> | void;
|
394 | renderStart: (
|
395 | this: PluginContext,
|
396 | outputOptions: NormalizedOutputOptions,
|
397 | inputOptions: NormalizedInputOptions
|
398 | ) => Promise<void> | void;
|
399 |
|
400 | resolveAssetUrl: ResolveAssetUrlHook;
|
401 | resolveFileUrl: ResolveFileUrlHook;
|
402 | resolveImportMeta: ResolveImportMetaHook;
|
403 | writeBundle: (
|
404 | this: PluginContext,
|
405 | options: NormalizedOutputOptions,
|
406 | bundle: OutputBundle
|
407 | ) => void | Promise<void>;
|
408 | }
|
409 |
|
410 | export type AsyncPluginHooks =
|
411 | | 'options'
|
412 | | 'buildEnd'
|
413 | | 'buildStart'
|
414 | | 'generateBundle'
|
415 | | 'load'
|
416 | | 'moduleParsed'
|
417 | | 'renderChunk'
|
418 | | 'renderError'
|
419 | | 'renderStart'
|
420 | | 'resolveDynamicImport'
|
421 | | 'resolveId'
|
422 | | 'transform'
|
423 | | 'writeBundle'
|
424 | | 'closeBundle';
|
425 |
|
426 | export type PluginValueHooks = 'banner' | 'footer' | 'intro' | 'outro';
|
427 |
|
428 | export type SyncPluginHooks = Exclude<keyof PluginHooks, AsyncPluginHooks>;
|
429 |
|
430 | export type FirstPluginHooks =
|
431 | | 'load'
|
432 | | 'renderDynamicImport'
|
433 | | 'resolveAssetUrl'
|
434 | | 'resolveDynamicImport'
|
435 | | 'resolveFileUrl'
|
436 | | 'resolveId'
|
437 | | 'resolveImportMeta';
|
438 |
|
439 | export type SequentialPluginHooks =
|
440 | | 'augmentChunkHash'
|
441 | | 'closeWatcher'
|
442 | | 'generateBundle'
|
443 | | 'options'
|
444 | | 'outputOptions'
|
445 | | 'renderChunk'
|
446 | | 'transform'
|
447 | | 'watchChange';
|
448 |
|
449 | export type ParallelPluginHooks =
|
450 | | 'banner'
|
451 | | 'buildEnd'
|
452 | | 'buildStart'
|
453 | | 'footer'
|
454 | | 'intro'
|
455 | | 'moduleParsed'
|
456 | | 'outro'
|
457 | | 'renderError'
|
458 | | 'renderStart'
|
459 | | 'writeBundle'
|
460 | | 'closeBundle';
|
461 |
|
462 | interface OutputPluginValueHooks {
|
463 | banner: AddonHook;
|
464 | cacheKey: string;
|
465 | footer: AddonHook;
|
466 | intro: AddonHook;
|
467 | outro: AddonHook;
|
468 | }
|
469 |
|
470 | export interface Plugin extends Partial<PluginHooks>, Partial<OutputPluginValueHooks> {
|
471 |
|
472 | api?: any;
|
473 | name: string;
|
474 | }
|
475 |
|
476 | export interface OutputPlugin extends Partial<OutputPluginHooks>, Partial<OutputPluginValueHooks> {
|
477 | name: string;
|
478 | }
|
479 |
|
480 | type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
|
481 |
|
482 | export interface NormalizedTreeshakingOptions {
|
483 | annotations: boolean;
|
484 | correctVarValueBeforeDeclaration: boolean;
|
485 | moduleSideEffects: HasModuleSideEffects;
|
486 | propertyReadSideEffects: boolean | 'always';
|
487 | tryCatchDeoptimization: boolean;
|
488 | unknownGlobalSideEffects: boolean;
|
489 | }
|
490 |
|
491 | export interface TreeshakingOptions
|
492 | extends Partial<Omit<NormalizedTreeshakingOptions, 'moduleSideEffects'>> {
|
493 | moduleSideEffects?: ModuleSideEffectsOption;
|
494 | preset?: TreeshakingPreset;
|
495 |
|
496 | pureExternalModules?: PureModulesOption;
|
497 | }
|
498 |
|
499 | interface GetManualChunkApi {
|
500 | getModuleIds: () => IterableIterator<string>;
|
501 | getModuleInfo: GetModuleInfo;
|
502 | }
|
503 | export type GetManualChunk = (id: string, api: GetManualChunkApi) => string | null | undefined;
|
504 |
|
505 | export type ExternalOption =
|
506 | | (string | RegExp)[]
|
507 | | string
|
508 | | RegExp
|
509 | | ((
|
510 | source: string,
|
511 | importer: string | undefined,
|
512 | isResolved: boolean
|
513 | ) => boolean | null | undefined);
|
514 | export type PureModulesOption = boolean | string[] | IsPureModule;
|
515 | export type GlobalsOption = { [name: string]: string } | ((name: string) => string);
|
516 | export type InputOption = string | string[] | { [entryAlias: string]: string };
|
517 | export type ManualChunksOption = { [chunkAlias: string]: string[] } | GetManualChunk;
|
518 | export type ModuleSideEffectsOption = boolean | 'no-external' | string[] | HasModuleSideEffects;
|
519 | export type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only';
|
520 | export type SourcemapPathTransformOption = (
|
521 | relativeSourcePath: string,
|
522 | sourcemapPath: string
|
523 | ) => string;
|
524 |
|
525 | export interface InputOptions {
|
526 | acorn?: Record<string, unknown>;
|
527 | acornInjectPlugins?: (() => unknown)[] | (() => unknown);
|
528 | cache?: false | RollupCache;
|
529 | context?: string;
|
530 | experimentalCacheExpiry?: number;
|
531 | external?: ExternalOption;
|
532 | /** @deprecated Use the "inlineDynamicImports" output option instead. */
|
533 | inlineDynamicImports?: boolean;
|
534 | input?: InputOption;
|
535 | makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
|
536 | /** @deprecated Use the "manualChunks" output option instead. */
|
537 | manualChunks?: ManualChunksOption;
|
538 | maxParallelFileReads?: number;
|
539 | moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
|
540 | onwarn?: WarningHandlerWithDefault;
|
541 | perf?: boolean;
|
542 | plugins?: (Plugin | null | false | undefined)[];
|
543 | preserveEntrySignatures?: PreserveEntrySignaturesOption;
|
544 | /** @deprecated Use the "preserveModules" output option instead. */
|
545 | preserveModules?: boolean;
|
546 | preserveSymlinks?: boolean;
|
547 | shimMissingExports?: boolean;
|
548 | strictDeprecations?: boolean;
|
549 | treeshake?: boolean | TreeshakingPreset | TreeshakingOptions;
|
550 | watch?: WatcherOptions | false;
|
551 | }
|
552 |
|
553 | export interface NormalizedInputOptions {
|
554 | acorn: Record<string, unknown>;
|
555 | acornInjectPlugins: (() => unknown)[];
|
556 | cache: false | undefined | RollupCache;
|
557 | context: string;
|
558 | experimentalCacheExpiry: number;
|
559 | external: IsExternal;
|
560 | /** @deprecated Use the "inlineDynamicImports" output option instead. */
|
561 | inlineDynamicImports: boolean | undefined;
|
562 | input: string[] | { [entryAlias: string]: string };
|
563 | makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
|
564 | /** @deprecated Use the "manualChunks" output option instead. */
|
565 | manualChunks: ManualChunksOption | undefined;
|
566 | maxParallelFileReads: number;
|
567 | moduleContext: (id: string) => string;
|
568 | onwarn: WarningHandler;
|
569 | perf: boolean;
|
570 | plugins: Plugin[];
|
571 | preserveEntrySignatures: PreserveEntrySignaturesOption;
|
572 |
|
573 | preserveModules: boolean | undefined;
|
574 | preserveSymlinks: boolean;
|
575 | shimMissingExports: boolean;
|
576 | strictDeprecations: boolean;
|
577 | treeshake: false | NormalizedTreeshakingOptions;
|
578 | }
|
579 |
|
580 | export type InternalModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd';
|
581 |
|
582 | export type ModuleFormat = InternalModuleFormat | 'commonjs' | 'esm' | 'module' | 'systemjs';
|
583 |
|
584 | type GeneratedCodePreset = 'es5' | 'es2015';
|
585 |
|
586 | interface NormalizedGeneratedCodeOptions {
|
587 | arrowFunctions: boolean;
|
588 | constBindings: boolean;
|
589 | objectShorthand: boolean;
|
590 | reservedNamesAsProps: boolean;
|
591 | }
|
592 |
|
593 | interface GeneratedCodeOptions extends Partial<NormalizedGeneratedCodeOptions> {
|
594 | preset?: GeneratedCodePreset;
|
595 | }
|
596 |
|
597 | export type OptionsPaths = Record<string, string> | ((id: string) => string);
|
598 |
|
599 | export type InteropType = boolean | 'auto' | 'esModule' | 'default' | 'defaultOnly';
|
600 |
|
601 | export type GetInterop = (id: string | null) => InteropType;
|
602 |
|
603 | export type AmdOptions = (
|
604 | | {
|
605 | autoId?: false;
|
606 | id: string;
|
607 | }
|
608 | | {
|
609 | autoId: true;
|
610 | basePath?: string;
|
611 | id?: undefined;
|
612 | }
|
613 | | {
|
614 | autoId?: false;
|
615 | id?: undefined;
|
616 | }
|
617 | ) & {
|
618 | define?: string;
|
619 | };
|
620 |
|
621 | export type NormalizedAmdOptions = (
|
622 | | {
|
623 | autoId: false;
|
624 | id?: string;
|
625 | }
|
626 | | {
|
627 | autoId: true;
|
628 | basePath: string;
|
629 | }
|
630 | ) & {
|
631 | define: string;
|
632 | };
|
633 |
|
634 | export interface OutputOptions {
|
635 | amd?: AmdOptions;
|
636 | assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string);
|
637 | banner?: string | (() => string | Promise<string>);
|
638 | chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
|
639 | compact?: boolean;
|
640 | // only required for bundle.write
|
641 | dir?: string;
|
642 | /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
|
643 | dynamicImportFunction?: string;
|
644 | entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
|
645 | esModule?: boolean;
|
646 | exports?: 'default' | 'named' | 'none' | 'auto';
|
647 | extend?: boolean;
|
648 | externalLiveBindings?: boolean;
|
649 | // only required for bundle.write
|
650 | file?: string;
|
651 | footer?: string | (() => string | Promise<string>);
|
652 | format?: ModuleFormat;
|
653 | freeze?: boolean;
|
654 | generatedCode?: GeneratedCodePreset | GeneratedCodeOptions;
|
655 | globals?: GlobalsOption;
|
656 | hoistTransitiveImports?: boolean;
|
657 | indent?: string | boolean;
|
658 | inlineDynamicImports?: boolean;
|
659 | interop?: InteropType | GetInterop;
|
660 | intro?: string | (() => string | Promise<string>);
|
661 | manualChunks?: ManualChunksOption;
|
662 | minifyInternalExports?: boolean;
|
663 | name?: string;
|
664 | namespaceToStringTag?: boolean;
|
665 | noConflict?: boolean;
|
666 | outro?: string | (() => string | Promise<string>);
|
667 | paths?: OptionsPaths;
|
668 | plugins?: (OutputPlugin | null | false | undefined)[];
|
669 | /** @deprecated Use the "generatedCode.constBindings" instead. */
|
670 | preferConst?: boolean;
|
671 | preserveModules?: boolean;
|
672 | preserveModulesRoot?: string;
|
673 | sanitizeFileName?: boolean | ((fileName: string) => string);
|
674 | sourcemap?: boolean | 'inline' | 'hidden';
|
675 | sourcemapExcludeSources?: boolean;
|
676 | sourcemapFile?: string;
|
677 | sourcemapPathTransform?: SourcemapPathTransformOption;
|
678 | strict?: boolean;
|
679 | systemNullSetters?: boolean;
|
680 | validate?: boolean;
|
681 | }
|
682 |
|
683 | export interface NormalizedOutputOptions {
|
684 | amd: NormalizedAmdOptions;
|
685 | assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string);
|
686 | banner: () => string | Promise<string>;
|
687 | chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
|
688 | compact: boolean;
|
689 | dir: string | undefined;
|
690 | /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
|
691 | dynamicImportFunction: string | undefined;
|
692 | entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
|
693 | esModule: boolean;
|
694 | exports: 'default' | 'named' | 'none' | 'auto';
|
695 | extend: boolean;
|
696 | externalLiveBindings: boolean;
|
697 | file: string | undefined;
|
698 | footer: () => string | Promise<string>;
|
699 | format: InternalModuleFormat;
|
700 | freeze: boolean;
|
701 | generatedCode: NormalizedGeneratedCodeOptions;
|
702 | globals: GlobalsOption;
|
703 | hoistTransitiveImports: boolean;
|
704 | indent: true | string;
|
705 | inlineDynamicImports: boolean;
|
706 | interop: GetInterop;
|
707 | intro: () => string | Promise<string>;
|
708 | manualChunks: ManualChunksOption;
|
709 | minifyInternalExports: boolean;
|
710 | name: string | undefined;
|
711 | namespaceToStringTag: boolean;
|
712 | noConflict: boolean;
|
713 | outro: () => string | Promise<string>;
|
714 | paths: OptionsPaths;
|
715 | plugins: OutputPlugin[];
|
716 |
|
717 | preferConst: boolean;
|
718 | preserveModules: boolean;
|
719 | preserveModulesRoot: string | undefined;
|
720 | sanitizeFileName: (fileName: string) => string;
|
721 | sourcemap: boolean | 'inline' | 'hidden';
|
722 | sourcemapExcludeSources: boolean;
|
723 | sourcemapFile: string | undefined;
|
724 | sourcemapPathTransform: SourcemapPathTransformOption | undefined;
|
725 | strict: boolean;
|
726 | systemNullSetters: boolean;
|
727 | validate: boolean;
|
728 | }
|
729 |
|
730 | export type WarningHandlerWithDefault = (
|
731 | warning: RollupWarning,
|
732 | defaultHandler: WarningHandler
|
733 | ) => void;
|
734 | export type WarningHandler = (warning: RollupWarning) => void;
|
735 |
|
736 | export interface SerializedTimings {
|
737 | [label: string]: [number, number, number];
|
738 | }
|
739 |
|
740 | export interface PreRenderedAsset {
|
741 | name: string | undefined;
|
742 | source: string | Uint8Array;
|
743 | type: 'asset';
|
744 | }
|
745 |
|
746 | export interface OutputAsset extends PreRenderedAsset {
|
747 | fileName: string;
|
748 |
|
749 | isAsset: true;
|
750 | }
|
751 |
|
752 | export interface RenderedModule {
|
753 | code: string | null;
|
754 | originalLength: number;
|
755 | removedExports: string[];
|
756 | renderedExports: string[];
|
757 | renderedLength: number;
|
758 | }
|
759 |
|
760 | export interface PreRenderedChunk {
|
761 | exports: string[];
|
762 | facadeModuleId: string | null;
|
763 | isDynamicEntry: boolean;
|
764 | isEntry: boolean;
|
765 | isImplicitEntry: boolean;
|
766 | modules: {
|
767 | [id: string]: RenderedModule;
|
768 | };
|
769 | name: string;
|
770 | type: 'chunk';
|
771 | }
|
772 |
|
773 | export interface RenderedChunk extends PreRenderedChunk {
|
774 | code?: string;
|
775 | dynamicImports: string[];
|
776 | fileName: string;
|
777 | implicitlyLoadedBefore: string[];
|
778 | importedBindings: {
|
779 | [imported: string]: string[];
|
780 | };
|
781 | imports: string[];
|
782 | map?: SourceMap;
|
783 | referencedFiles: string[];
|
784 | }
|
785 |
|
786 | export interface OutputChunk extends RenderedChunk {
|
787 | code: string;
|
788 | }
|
789 |
|
790 | export interface SerializablePluginCache {
|
791 | [key: string]: [number, any];
|
792 | }
|
793 |
|
794 | export interface RollupCache {
|
795 | modules: ModuleJSON[];
|
796 | plugins?: Record<string, SerializablePluginCache>;
|
797 | }
|
798 |
|
799 | export interface RollupOutput {
|
800 | output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
|
801 | }
|
802 |
|
803 | export interface RollupBuild {
|
804 | cache: RollupCache | undefined;
|
805 | close: () => Promise<void>;
|
806 | closed: boolean;
|
807 | generate: (outputOptions: OutputOptions) => Promise<RollupOutput>;
|
808 | getTimings?: () => SerializedTimings;
|
809 | watchFiles: string[];
|
810 | write: (options: OutputOptions) => Promise<RollupOutput>;
|
811 | }
|
812 |
|
813 | export interface RollupOptions extends InputOptions {
|
814 |
|
815 | output?: OutputOptions | OutputOptions[];
|
816 | }
|
817 |
|
818 | export interface MergedRollupOptions extends InputOptions {
|
819 | output: OutputOptions[];
|
820 | }
|
821 |
|
822 | export function rollup(options: RollupOptions): Promise<RollupBuild>;
|
823 |
|
824 | export interface ChokidarOptions {
|
825 | alwaysStat?: boolean;
|
826 | atomic?: boolean | number;
|
827 | awaitWriteFinish?:
|
828 | | {
|
829 | pollInterval?: number;
|
830 | stabilityThreshold?: number;
|
831 | }
|
832 | | boolean;
|
833 | binaryInterval?: number;
|
834 | cwd?: string;
|
835 | depth?: number;
|
836 | disableGlobbing?: boolean;
|
837 | followSymlinks?: boolean;
|
838 | ignoreInitial?: boolean;
|
839 | ignorePermissionErrors?: boolean;
|
840 | ignored?: any;
|
841 | interval?: number;
|
842 | persistent?: boolean;
|
843 | useFsEvents?: boolean;
|
844 | usePolling?: boolean;
|
845 | }
|
846 |
|
847 | export interface WatcherOptions {
|
848 | buildDelay?: number;
|
849 | chokidar?: ChokidarOptions;
|
850 | clearScreen?: boolean;
|
851 | exclude?: string | RegExp | (string | RegExp)[];
|
852 | include?: string | RegExp | (string | RegExp)[];
|
853 | skipWrite?: boolean;
|
854 | }
|
855 |
|
856 | export interface RollupWatchOptions extends InputOptions {
|
857 | output?: OutputOptions | OutputOptions[];
|
858 | watch?: WatcherOptions | false;
|
859 | }
|
860 |
|
861 | interface TypedEventEmitter<T extends { [event: string]: (...args: any) => any }> {
|
862 | addListener<K extends keyof T>(event: K, listener: T[K]): this;
|
863 | emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): boolean;
|
864 | eventNames(): Array<keyof T>;
|
865 | getMaxListeners(): number;
|
866 | listenerCount(type: keyof T): number;
|
867 | listeners<K extends keyof T>(event: K): Array<T[K]>;
|
868 | off<K extends keyof T>(event: K, listener: T[K]): this;
|
869 | on<K extends keyof T>(event: K, listener: T[K]): this;
|
870 | once<K extends keyof T>(event: K, listener: T[K]): this;
|
871 | prependListener<K extends keyof T>(event: K, listener: T[K]): this;
|
872 | prependOnceListener<K extends keyof T>(event: K, listener: T[K]): this;
|
873 | rawListeners<K extends keyof T>(event: K): Array<T[K]>;
|
874 | removeAllListeners<K extends keyof T>(event?: K): this;
|
875 | removeListener<K extends keyof T>(event: K, listener: T[K]): this;
|
876 | setMaxListeners(n: number): this;
|
877 | }
|
878 |
|
879 | export type RollupWatcherEvent =
|
880 | | { code: 'START' }
|
881 | | { code: 'BUNDLE_START'; input?: InputOption; output: readonly string[] }
|
882 | | {
|
883 | code: 'BUNDLE_END';
|
884 | duration: number;
|
885 | input?: InputOption;
|
886 | output: readonly string[];
|
887 | result: RollupBuild;
|
888 | }
|
889 | | { code: 'END' }
|
890 | | { code: 'ERROR'; error: RollupError; result: RollupBuild | null };
|
891 |
|
892 | export interface RollupWatcher
|
893 | extends TypedEventEmitter<{
|
894 | change: (id: string, change: { event: ChangeEvent }) => void;
|
895 | close: () => void;
|
896 | event: (event: RollupWatcherEvent) => void;
|
897 | restart: () => void;
|
898 | }> {
|
899 | close(): void;
|
900 | }
|
901 |
|
902 | export function watch(config: RollupWatchOptions | RollupWatchOptions[]): RollupWatcher;
|
903 |
|
904 | interface AcornNode {
|
905 | end: number;
|
906 | start: number;
|
907 | type: string;
|
908 | }
|
909 |
|
910 | export function defineConfig(options: RollupOptions): RollupOptions;
|
911 | export function defineConfig(options: RollupOptions[]): RollupOptions[];
|