rollup 0.57.0 → 0.58.2

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +3 -11
  3. package/bin/rollup +591 -413
  4. package/dist/rollup.browser.js +19731 -18315
  5. package/dist/rollup.d.ts +341 -0
  6. package/dist/rollup.es.js +6582 -4875
  7. package/dist/rollup.js +6581 -4874
  8. package/dist/typings/Chunk.d.ts +37 -25
  9. package/dist/typings/ExternalModule.d.ts +3 -0
  10. package/dist/typings/Graph.d.ts +7 -6
  11. package/dist/typings/Module.d.ts +5 -1
  12. package/dist/typings/ast/nodes/ConditionalExpression.d.ts +4 -6
  13. package/dist/typings/ast/nodes/ExportDefaultDeclaration.d.ts +0 -1
  14. package/dist/typings/ast/nodes/Identifier.d.ts +2 -2
  15. package/dist/typings/ast/nodes/Import.d.ts +5 -3
  16. package/dist/typings/ast/nodes/LogicalExpression.d.ts +8 -4
  17. package/dist/typings/ast/nodes/MemberExpression.d.ts +2 -2
  18. package/dist/typings/ast/nodes/ObjectExpression.d.ts +3 -0
  19. package/dist/typings/ast/nodes/SequenceExpression.d.ts +10 -2
  20. package/dist/typings/ast/variables/GlobalVariable.d.ts +0 -1
  21. package/dist/typings/chunk-optimization.d.ts +3 -0
  22. package/dist/typings/finalisers/amd.d.ts +2 -9
  23. package/dist/typings/finalisers/cjs.d.ts +2 -8
  24. package/dist/typings/finalisers/es.d.ts +2 -8
  25. package/dist/typings/finalisers/iife.d.ts +2 -8
  26. package/dist/typings/finalisers/index.d.ts +9 -4
  27. package/dist/typings/finalisers/shared/warnOnBuiltins.d.ts +3 -2
  28. package/dist/typings/finalisers/system.d.ts +2 -7
  29. package/dist/typings/finalisers/umd.d.ts +2 -8
  30. package/dist/typings/rollup/index.d.ts +36 -28
  31. package/dist/typings/utils/addons.d.ts +10 -0
  32. package/dist/typings/utils/blank.d.ts +1 -0
  33. package/dist/typings/utils/collapseSourcemaps.d.ts +2 -2
  34. package/dist/typings/utils/defaults.d.ts +1 -1
  35. package/dist/typings/utils/mergeOptions.d.ts +4 -1
  36. package/dist/typings/utils/relativeId.d.ts +2 -0
  37. package/dist/typings/utils/renderHelpers.d.ts +2 -0
  38. package/dist/typings/watch/index.d.ts +5 -2
  39. package/package.json +33 -32
  40. package/dist/typings/finalisers/shared/getGlobalNameMaker.d.ts +0 -4
  41. package/dist/typings/utils/flushTime.d.ts +0 -5
  42. package/dist/typings/utils/object.d.ts +0 -7
  43. package/typings/package.json.d.ts +0 -3
@@ -0,0 +1,341 @@
1
+ import { EventEmitter } from 'events';
2
+ import * as ESTree from 'estree';
3
+
4
+ export const VERSION: string;
5
+
6
+ export interface IdMap {
7
+ [key: string]: string;
8
+ }
9
+
10
+ export interface RollupError {
11
+ message: string;
12
+ code?: string;
13
+ name?: string;
14
+ url?: string;
15
+ id?: string;
16
+ loc?: {
17
+ file?: string;
18
+ line: number;
19
+ column: number;
20
+ };
21
+ stack?: string;
22
+ frame?: string;
23
+ pos?: number;
24
+ plugin?: string;
25
+ pluginCode?: string;
26
+ }
27
+
28
+ export interface RawSourceMap {
29
+ version: string;
30
+ sources: string[];
31
+ names: string[];
32
+ sourceRoot?: string;
33
+ sourcesContent?: string[];
34
+ mappings: string;
35
+ file: string;
36
+ }
37
+
38
+ export interface SourceMap {
39
+ version: string;
40
+ file: string;
41
+ sources: string[];
42
+ sourcesContent: string[];
43
+ names: string[];
44
+ mappings: string;
45
+
46
+ toString(): string;
47
+ toUrl(): string;
48
+ }
49
+
50
+ export interface SourceDescription {
51
+ code: string;
52
+ map?: RawSourceMap;
53
+ ast?: ESTree.Program;
54
+ }
55
+
56
+ export interface ModuleJSON {
57
+ id: string;
58
+ dependencies: string[];
59
+ code: string;
60
+ originalCode: string;
61
+ originalSourcemap: RawSourceMap | void;
62
+ ast: ESTree.Program;
63
+ sourcemapChain: RawSourceMap[];
64
+ resolvedIds: IdMap;
65
+ }
66
+
67
+ export type ResolveIdHook = (
68
+ id: string,
69
+ parent: string
70
+ ) => Promise<string | boolean | void> | string | boolean | void;
71
+
72
+ export interface TransformContext {
73
+ parse: (input: string, options: any) => ESTree.Program;
74
+ warn(warning: RollupWarning, pos?: { line: number; column: number }): void;
75
+ error(err: RollupError, pos?: { line: number; column: number }): void;
76
+ }
77
+
78
+ export type MissingExportHook = (
79
+ exportName: string,
80
+ importingModule: string,
81
+ importedModule: string,
82
+ importerStart?: number
83
+ ) => void;
84
+ export type IsExternalHook = (
85
+ id: string,
86
+ parentId: string,
87
+ isResolved: boolean
88
+ ) => Promise<boolean | void> | boolean | void;
89
+ export type LoadHook = (
90
+ id: string
91
+ ) => Promise<SourceDescription | string | void> | SourceDescription | string | void;
92
+ export type TransformHook = (
93
+ this: TransformContext,
94
+ code: string,
95
+ id: String
96
+ ) => Promise<SourceDescription | string | void>;
97
+ export type TransformBundleHook = (
98
+ code: string,
99
+ options: OutputOptions
100
+ ) => Promise<SourceDescription | string>;
101
+ export type ResolveDynamicImportHook = (
102
+ specifier: string | ESTree.Node,
103
+ parentId: string
104
+ ) => Promise<string | void> | string | void;
105
+
106
+ export interface Plugin {
107
+ name: string;
108
+ options?: (options: InputOptions) => void;
109
+ load?: LoadHook;
110
+ resolveId?: ResolveIdHook;
111
+ missingExport?: MissingExportHook;
112
+ transform?: TransformHook;
113
+ transformBundle?: TransformBundleHook;
114
+ ongenerate?: (options: OutputOptions, source: SourceDescription) => void;
115
+ onwrite?: (options: OutputOptions, source: SourceDescription) => void;
116
+ resolveDynamicImport?: ResolveDynamicImportHook;
117
+
118
+ banner?: () => string;
119
+ footer?: () => string;
120
+ intro?: () => string;
121
+ outro?: () => string;
122
+ }
123
+
124
+ export interface TreeshakingOptions {
125
+ propertyReadSideEffects: boolean;
126
+ pureExternalModules: boolean;
127
+ }
128
+
129
+ export type ExternalOption = string[] | IsExternalHook;
130
+ export type GlobalsOption = { [name: string]: string } | ((name: string) => string);
131
+
132
+ export interface InputOptions {
133
+ input: string | string[] | { [entryAlias: string]: string };
134
+ manualChunks?: { [chunkAlias: string]: string[] };
135
+ external?: ExternalOption;
136
+ plugins?: Plugin[];
137
+
138
+ onwarn?: WarningHandler;
139
+ cache?: {
140
+ modules: ModuleJSON[];
141
+ };
142
+
143
+ acorn?: {};
144
+ acornInjectPlugins?: Function[];
145
+ treeshake?: boolean | TreeshakingOptions;
146
+ context?: string;
147
+ moduleContext?: string | ((id: string) => string) | { [id: string]: string };
148
+ watch?: WatcherOptions;
149
+ experimentalDynamicImport?: boolean;
150
+ experimentalCodeSplitting?: boolean;
151
+ preserveSymlinks?: boolean;
152
+ experimentalPreserveModules?: boolean;
153
+ optimizeChunks?: boolean;
154
+ chunkGroupingSize?: number;
155
+
156
+ // undocumented?
157
+ pureExternalModules?: boolean;
158
+ preferConst?: boolean;
159
+ perf?: boolean;
160
+
161
+ /** @deprecated */
162
+ entry?: string;
163
+ transform?: TransformHook;
164
+ load?: LoadHook;
165
+ resolveId?: ResolveIdHook;
166
+ resolveExternal?: any;
167
+ }
168
+
169
+ export type ModuleFormat = 'amd' | 'cjs' | 'system' | 'es' | 'es6' | 'iife' | 'umd';
170
+
171
+ export type OptionsPaths = Record<string, string> | ((id: string) => string);
172
+
173
+ export interface OutputOptions {
174
+ // only required for bundle.write
175
+ file?: string;
176
+ // only required for bundles.write
177
+ dir?: string;
178
+ // this is optional at the base-level of RollupWatchOptions,
179
+ // which extends from this interface through config merge
180
+ format?: ModuleFormat;
181
+ name?: string;
182
+ globals?: GlobalsOption;
183
+ chunkNames?: string;
184
+ entryNames?: string;
185
+
186
+ paths?: OptionsPaths;
187
+ banner?: string;
188
+ footer?: string;
189
+ intro?: string;
190
+ outro?: string;
191
+ sourcemap?: boolean | 'inline';
192
+ sourcemapFile?: string;
193
+ interop?: boolean;
194
+ extend?: boolean;
195
+
196
+ exports?: 'default' | 'named' | 'none' | 'auto';
197
+ amd?: {
198
+ id?: string;
199
+ define?: string;
200
+ };
201
+ indent?: boolean;
202
+ strict?: boolean;
203
+ freeze?: boolean;
204
+ namespaceToStringTag?: boolean;
205
+ legacy?: boolean;
206
+
207
+ // undocumented?
208
+ noConflict?: boolean;
209
+
210
+ // deprecated
211
+ dest?: string;
212
+ moduleId?: string;
213
+ }
214
+
215
+ export interface OutputOptionsFile extends OutputOptions {
216
+ file?: string;
217
+ }
218
+
219
+ export interface OutputOptionsDir extends OutputOptions {
220
+ // only required for bundles.write
221
+ dir?: string;
222
+ }
223
+
224
+ export interface RollupWarning {
225
+ message?: string;
226
+ code?: string;
227
+ loc?: {
228
+ file: string;
229
+ line: number;
230
+ column: number;
231
+ };
232
+ deprecations?: { old: string; new: string }[];
233
+ modules?: string[];
234
+ names?: string[];
235
+ source?: string;
236
+ importer?: string;
237
+ frame?: any;
238
+ missing?: string;
239
+ exporter?: string;
240
+ name?: string;
241
+ sources?: string[];
242
+ reexporter?: string;
243
+ guess?: string;
244
+ url?: string;
245
+ id?: string;
246
+ plugin?: string;
247
+ pos?: number;
248
+ pluginCode?: string;
249
+ }
250
+
251
+ export type WarningHandler = (warning: string | RollupWarning) => void;
252
+
253
+ export type SerializedTimings = { [label: string]: number };
254
+
255
+ export interface OutputChunk {
256
+ imports: string[];
257
+ exports: string[];
258
+ modules: string[];
259
+ code: string;
260
+ map?: SourceMap;
261
+ }
262
+
263
+ export interface RollupCache {
264
+ modules: ModuleJSON[];
265
+ }
266
+
267
+ export interface Bundle {
268
+ // TODO: consider deprecating to match code splitting
269
+ imports: string[];
270
+ exports: string[];
271
+ modules: ModuleJSON[];
272
+ cache: RollupCache;
273
+
274
+ generate: (outputOptions: OutputOptions) => Promise<OutputChunk>;
275
+ write: (options: OutputOptions) => Promise<OutputChunk>;
276
+ getTimings?: () => SerializedTimings;
277
+ }
278
+
279
+ export interface BundleSet {
280
+ cache: {
281
+ modules: ModuleJSON[];
282
+ };
283
+ generate: (outputOptions: OutputOptions) => Promise<{ [chunkName: string]: OutputChunk }>;
284
+ write: (options: OutputOptions) => Promise<{ [chunkName: string]: OutputChunk }>;
285
+ getTimings?: () => SerializedTimings;
286
+ }
287
+
288
+ export interface RollupFileOptions extends InputOptions {
289
+ cache?: RollupCache;
290
+ input: string;
291
+ output?: OutputOptionsFile;
292
+ }
293
+
294
+ export interface RollupDirOptions extends InputOptions {
295
+ cache?: RollupCache;
296
+ input: string[] | { [entryName: string]: string };
297
+ output?: OutputOptionsDir;
298
+ }
299
+
300
+ export function rollup(options: RollupFileOptions): Promise<Bundle>;
301
+ export function rollup(options: RollupDirOptions): Promise<BundleSet>;
302
+
303
+ export interface Watcher extends EventEmitter {}
304
+
305
+ // chokidar watch options
306
+ export interface WatchOptions {
307
+ persistent?: boolean;
308
+ ignored?: any;
309
+ ignoreInitial?: boolean;
310
+ followSymlinks?: boolean;
311
+ cwd?: string;
312
+ disableGlobbing?: boolean;
313
+ usePolling?: boolean;
314
+ useFsEvents?: boolean;
315
+ alwaysStat?: boolean;
316
+ depth?: number;
317
+ interval?: number;
318
+ binaryInterval?: number;
319
+ ignorePermissionErrors?: boolean;
320
+ atomic?: boolean | number;
321
+ awaitWriteFinish?:
322
+ | {
323
+ stabilityThreshold?: number;
324
+ pollInterval?: number;
325
+ }
326
+ | boolean;
327
+ }
328
+
329
+ export interface WatcherOptions {
330
+ chokidar?: boolean | WatchOptions;
331
+ include?: string[];
332
+ exclude?: string[];
333
+ clearScreen?: boolean;
334
+ }
335
+
336
+ export interface RollupWatchOptions extends InputOptions {
337
+ output?: OutputOptions;
338
+ watch?: WatcherOptions;
339
+ }
340
+
341
+ export function watch(configs: RollupWatchOptions[]): Watcher;