rolldown 0.10.2 → 0.10.3

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 (64) hide show
  1. package/bin/cli.js +1 -1
  2. package/dist/cjs/cli.cjs +772 -0
  3. package/dist/cjs/index.cjs +26 -0
  4. package/dist/cjs/parallel-plugin-worker.cjs +32 -0
  5. package/dist/{parallel-plugin.cjs → cjs/parallel-plugin.cjs} +2 -3
  6. package/dist/esm/cli.mjs +773 -0
  7. package/dist/esm/index.mjs +24 -0
  8. package/dist/esm/parallel-plugin-worker.mjs +33 -0
  9. package/dist/esm/parallel-plugin.mjs +9 -0
  10. package/dist/shared/chunk-WMSF1LUG.cjs +37 -0
  11. package/dist/shared/consola_36c0034f-ED9jtJgC.mjs +942 -0
  12. package/dist/shared/consola_36c0034f-RVbq7gBJ.cjs +945 -0
  13. package/dist/shared/prompt-Q6AgPcFh.cjs +859 -0
  14. package/dist/shared/prompt-uoOfg_gh.mjs +860 -0
  15. package/dist/shared/rolldown-7z0huS4W.mjs +49 -0
  16. package/dist/shared/rolldown-binding.wasi.cjs +26 -13
  17. package/dist/shared/rolldown-pt4wPK1i.cjs +48 -0
  18. package/dist/shared/utils_index-0Q22WhZL.cjs +5331 -0
  19. package/dist/shared/utils_index-Wfcc8MjH.mjs +5361 -0
  20. package/dist/shared/wasi-worker-browser.mjs +6 -7
  21. package/dist/shared/wasi-worker.mjs +5 -2
  22. package/package.json +52 -37
  23. package/dist/chunks/prompt.cjs +0 -443
  24. package/dist/chunks/prompt.cjs.map +0 -1
  25. package/dist/chunks/prompt.mjs +0 -436
  26. package/dist/chunks/prompt.mjs.map +0 -1
  27. package/dist/cli.cjs +0 -1961
  28. package/dist/cli.cjs.map +0 -1
  29. package/dist/cli.d.cts +0 -2
  30. package/dist/cli.d.mts +0 -2
  31. package/dist/cli.d.ts +0 -2
  32. package/dist/cli.mjs +0 -1939
  33. package/dist/cli.mjs.map +0 -1
  34. package/dist/index.cjs +0 -26
  35. package/dist/index.cjs.map +0 -1
  36. package/dist/index.d.cts +0 -66
  37. package/dist/index.d.mts +0 -66
  38. package/dist/index.d.ts +0 -66
  39. package/dist/index.mjs +0 -21
  40. package/dist/index.mjs.map +0 -1
  41. package/dist/parallel-plugin-worker.cjs +0 -34
  42. package/dist/parallel-plugin-worker.cjs.map +0 -1
  43. package/dist/parallel-plugin-worker.d.cts +0 -2
  44. package/dist/parallel-plugin-worker.d.mts +0 -2
  45. package/dist/parallel-plugin-worker.d.ts +0 -2
  46. package/dist/parallel-plugin-worker.mjs +0 -32
  47. package/dist/parallel-plugin-worker.mjs.map +0 -1
  48. package/dist/parallel-plugin.cjs.map +0 -1
  49. package/dist/parallel-plugin.d.cts +0 -12
  50. package/dist/parallel-plugin.d.mts +0 -12
  51. package/dist/parallel-plugin.d.ts +0 -12
  52. package/dist/parallel-plugin.mjs +0 -6
  53. package/dist/parallel-plugin.mjs.map +0 -1
  54. package/dist/shared/rolldown.1ea1dc1e.d.cts +0 -1160
  55. package/dist/shared/rolldown.1ea1dc1e.d.mts +0 -1160
  56. package/dist/shared/rolldown.1ea1dc1e.d.ts +0 -1160
  57. package/dist/shared/rolldown.4d4592d7.cjs +0 -348
  58. package/dist/shared/rolldown.4d4592d7.cjs.map +0 -1
  59. package/dist/shared/rolldown.65028ebe.cjs +0 -547
  60. package/dist/shared/rolldown.65028ebe.cjs.map +0 -1
  61. package/dist/shared/rolldown.7d1ce9fc.mjs +0 -546
  62. package/dist/shared/rolldown.7d1ce9fc.mjs.map +0 -1
  63. package/dist/shared/rolldown.b914368a.mjs +0 -340
  64. package/dist/shared/rolldown.b914368a.mjs.map +0 -1
@@ -1,1160 +0,0 @@
1
- // utils
2
- type NullValue$1 = null | undefined | void
3
- type MaybePromise$2<T> = T | Promise<T>
4
-
5
- type PartialNull<T> = {
6
- [P in keyof T]: T[P] | null
7
- }
8
-
9
- interface RollupError extends RollupLog {
10
- name?: string
11
- stack?: string
12
- watchFiles?: string[]
13
- }
14
-
15
- interface RollupLog {
16
- binding?: string
17
- cause?: unknown
18
- code?: string
19
- exporter?: string
20
- frame?: string
21
- hook?: string
22
- id?: string
23
- ids?: string[]
24
- loc?: {
25
- column: number
26
- file?: string
27
- line: number
28
- }
29
- message: string
30
- meta?: any
31
- names?: string[]
32
- plugin?: string
33
- pluginCode?: unknown
34
- pos?: number
35
- reexporter?: string
36
- stack?: string
37
- url?: string
38
- }
39
-
40
- type LogLevel = 'warn' | 'info' | 'debug'
41
- type LogLevelOption = LogLevel | 'silent'
42
-
43
- type SourceMapSegment =
44
- | [number]
45
- | [number, number, number, number]
46
- | [number, number, number, number, number]
47
-
48
- interface ExistingDecodedSourceMap {
49
- file?: string
50
- readonly mappings: SourceMapSegment[][]
51
- names: string[]
52
- sourceRoot?: string
53
- sources: string[]
54
- sourcesContent?: (string | null)[]
55
- version: number
56
- x_google_ignoreList?: number[]
57
- }
58
-
59
- interface ExistingRawSourceMap {
60
- file?: string
61
- mappings: string
62
- names: string[]
63
- sourceRoot?: string
64
- sources: string[]
65
- sourcesContent?: (string | null)[]
66
- version: number
67
- x_google_ignoreList?: number[]
68
- }
69
-
70
- type DecodedSourceMapOrMissing =
71
- | {
72
- missing: true
73
- plugin: string
74
- }
75
- | (ExistingDecodedSourceMap & { missing?: false })
76
-
77
- interface SourceMap {
78
- file: string
79
- mappings: string
80
- names: string[]
81
- sources: string[]
82
- sourcesContent: (string | null)[]
83
- version: number
84
- toString(): string
85
- toUrl(): string
86
- }
87
-
88
- type SourceMapInput$1 =
89
- | ExistingRawSourceMap
90
- | string
91
- | null
92
- | { mappings: '' }
93
-
94
- interface ModuleOptions {
95
- assertions: Record<string, string>
96
- meta: CustomPluginOptions
97
- moduleSideEffects: boolean | 'no-treeshake'
98
- syntheticNamedExports: boolean | string
99
- }
100
-
101
- interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
102
- ast?: AcornNode
103
- code: string
104
- map?: SourceMapInput$1
105
- }
106
-
107
- interface TransformModuleJSON {
108
- ast?: AcornNode
109
- code: string
110
- // note if plugins use new this.cache to opt-out auto transform cache
111
- customTransformCache: boolean
112
- originalCode: string
113
- originalSourcemap: ExistingDecodedSourceMap | null
114
- sourcemapChain: DecodedSourceMapOrMissing[]
115
- transformDependencies: string[]
116
- }
117
-
118
- interface ModuleJSON extends TransformModuleJSON, ModuleOptions {
119
- ast: AcornNode
120
- dependencies: string[]
121
- id: string
122
- resolvedIds: ResolvedIdMap
123
- transformFiles: EmittedFile[] | undefined
124
- }
125
-
126
- interface PluginCache {
127
- delete(id: string): boolean
128
- get<T = any>(id: string): T
129
- has(id: string): boolean
130
- set<T = any>(id: string, value: T): void
131
- }
132
-
133
- type LoggingFunction = (
134
- log: RollupLog | string | (() => RollupLog | string),
135
- ) => void
136
-
137
- interface MinimalPluginContext {
138
- debug: LoggingFunction
139
- error: (error: RollupError | string) => never
140
- info: LoggingFunction
141
- meta: PluginContextMeta
142
- warn: LoggingFunction
143
- }
144
-
145
- interface EmittedAsset {
146
- fileName?: string
147
- name?: string
148
- needsCodeReference?: boolean
149
- source?: string | Uint8Array
150
- type: 'asset'
151
- }
152
-
153
- interface EmittedChunk {
154
- fileName?: string
155
- id: string
156
- implicitlyLoadedAfterOneOf?: string[]
157
- importer?: string
158
- name?: string
159
- preserveSignature?: PreserveEntrySignaturesOption
160
- type: 'chunk'
161
- }
162
-
163
- interface EmittedPrebuiltChunk {
164
- code: string
165
- exports?: string[]
166
- fileName: string
167
- map?: SourceMap
168
- sourcemapFileName?: string
169
- type: 'prebuilt-chunk'
170
- }
171
-
172
- type EmittedFile = EmittedAsset | EmittedChunk | EmittedPrebuiltChunk
173
-
174
- type EmitFile = (emittedFile: EmittedFile) => string
175
-
176
- interface ModuleInfo extends ModuleOptions {
177
- ast: AcornNode | null
178
- code: string | null
179
- dynamicImporters: readonly string[]
180
- dynamicallyImportedIdResolutions: readonly ResolvedId[]
181
- dynamicallyImportedIds: readonly string[]
182
- exportedBindings: Record<string, string[]> | null
183
- exports: string[] | null
184
- hasDefaultExport: boolean | null
185
- /** @deprecated Use `moduleSideEffects` instead */
186
- hasModuleSideEffects: boolean | 'no-treeshake'
187
- id: string
188
- implicitlyLoadedAfterOneOf: readonly string[]
189
- implicitlyLoadedBefore: readonly string[]
190
- importedIdResolutions: readonly ResolvedId[]
191
- importedIds: readonly string[]
192
- importers: readonly string[]
193
- isEntry: boolean
194
- isExternal: boolean
195
- isIncluded: boolean | null
196
- }
197
-
198
- type GetModuleInfo = (moduleId: string) => ModuleInfo | null
199
-
200
- interface CustomPluginOptions {
201
- [plugin: string]: any
202
- }
203
-
204
- type LoggingFunctionWithPosition = (
205
- log: RollupLog | string | (() => RollupLog | string),
206
- pos?: number | { column: number; line: number },
207
- ) => void
208
-
209
- interface PluginContext$1 extends MinimalPluginContext {
210
- addWatchFile: (id: string) => void
211
- cache: PluginCache
212
- debug: LoggingFunction
213
- emitFile: EmitFile
214
- error: (error: RollupError | string) => never
215
- getFileName: (fileReferenceId: string) => string
216
- getModuleIds: () => IterableIterator<string>
217
- getModuleInfo: GetModuleInfo
218
- getWatchFiles: () => string[]
219
- info: LoggingFunction
220
- load: (
221
- options: { id: string; resolveDependencies?: boolean } & Partial<
222
- PartialNull<ModuleOptions>
223
- >,
224
- ) => Promise<ModuleInfo>
225
- /** @deprecated Use `this.getModuleIds` instead */
226
- moduleIds: IterableIterator<string>
227
- parse: (input: string, options?: any) => AcornNode
228
- resolve: (
229
- source: string,
230
- importer?: string,
231
- options?: {
232
- assertions?: Record<string, string>
233
- custom?: CustomPluginOptions
234
- isEntry?: boolean
235
- skipSelf?: boolean
236
- },
237
- ) => Promise<ResolvedId | null>
238
- setAssetSource: (
239
- assetReferenceId: string,
240
- source: string | Uint8Array,
241
- ) => void
242
- warn: LoggingFunction
243
- }
244
-
245
- interface PluginContextMeta {
246
- rollupVersion: string
247
- watchMode: boolean
248
- }
249
-
250
- interface ResolvedId extends ModuleOptions {
251
- external: boolean | 'absolute'
252
- id: string
253
- resolvedBy: string
254
- }
255
-
256
- interface ResolvedIdMap {
257
- [key: string]: ResolvedId
258
- }
259
-
260
- interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
261
- external?: boolean | 'absolute' | 'relative'
262
- id: string
263
- resolvedBy?: string
264
- }
265
-
266
- type ResolveIdResult = string | NullValue$1 | false | PartialResolvedId
267
-
268
- type ResolveIdHook = (
269
- this: PluginContext$1,
270
- source: string,
271
- importer: string | undefined,
272
- options: {
273
- assertions: Record<string, string>
274
- custom?: CustomPluginOptions
275
- isEntry: boolean
276
- },
277
- ) => ResolveIdResult
278
-
279
- type ShouldTransformCachedModuleHook = (
280
- this: PluginContext$1,
281
- options: {
282
- ast: AcornNode
283
- code: string
284
- id: string
285
- meta: CustomPluginOptions
286
- moduleSideEffects: boolean | 'no-treeshake'
287
- resolvedSources: ResolvedIdMap
288
- syntheticNamedExports: boolean | string
289
- },
290
- ) => boolean | NullValue$1
291
-
292
- type IsExternal = (
293
- source: string,
294
- importer: string | undefined,
295
- isResolved: boolean,
296
- ) => boolean
297
-
298
- type HasModuleSideEffects = (id: string, external: boolean) => boolean
299
-
300
- type LoadResult = SourceDescription | string | NullValue$1
301
-
302
- type LoadHook = (this: PluginContext$1, id: string) => LoadResult
303
-
304
- interface TransformPluginContext extends PluginContext$1 {
305
- debug: LoggingFunctionWithPosition
306
- error: (
307
- error: RollupError | string,
308
- pos?: number | { column: number; line: number },
309
- ) => never
310
- getCombinedSourcemap: () => SourceMap
311
- info: LoggingFunctionWithPosition
312
- warn: LoggingFunctionWithPosition
313
- }
314
-
315
- type TransformResult = string | NullValue$1 | Partial<SourceDescription>
316
-
317
- type TransformHook = (
318
- this: TransformPluginContext,
319
- code: string,
320
- id: string,
321
- ) => TransformResult
322
-
323
- type ModuleParsedHook = (this: PluginContext$1, info: ModuleInfo) => void
324
-
325
- type RenderChunkHook = (
326
- this: PluginContext$1,
327
- code: string,
328
- chunk: RenderedChunk$1,
329
- options: NormalizedOutputOptions$1,
330
- meta: { chunks: Record<string, RenderedChunk$1> },
331
- ) => { code: string; map?: SourceMapInput$1 } | string | NullValue$1
332
-
333
- type ResolveDynamicImportHook = (
334
- this: PluginContext$1,
335
- specifier: string | AcornNode,
336
- importer: string,
337
- options: { assertions: Record<string, string> },
338
- ) => ResolveIdResult
339
-
340
- type ResolveImportMetaHook = (
341
- this: PluginContext$1,
342
- property: string | null,
343
- options: { chunkId: string; format: InternalModuleFormat; moduleId: string },
344
- ) => string | NullValue$1
345
-
346
- type ResolveFileUrlHook = (
347
- this: PluginContext$1,
348
- options: {
349
- chunkId: string
350
- fileName: string
351
- format: InternalModuleFormat
352
- moduleId: string
353
- referenceId: string
354
- relativePath: string
355
- },
356
- ) => string | NullValue$1
357
-
358
- type AddonHookFunction = (
359
- this: PluginContext$1,
360
- chunk: RenderedChunk$1,
361
- ) => string | Promise<string>
362
- type AddonHook = string | AddonHookFunction
363
-
364
- type ChangeEvent = 'create' | 'update' | 'delete'
365
- type WatchChangeHook = (
366
- this: PluginContext$1,
367
- id: string,
368
- change: { event: ChangeEvent },
369
- ) => void
370
-
371
- interface OutputBundle {
372
- [fileName: string]: OutputAsset | OutputChunk
373
- }
374
-
375
- interface FunctionPluginHooks {
376
- augmentChunkHash: (this: PluginContext$1, chunk: RenderedChunk$1) => string | void
377
- buildEnd: (this: PluginContext$1, error?: Error) => void
378
- buildStart: (this: PluginContext$1, options: NormalizedInputOptions) => void
379
- closeBundle: (this: PluginContext$1) => void
380
- closeWatcher: (this: PluginContext$1) => void
381
- generateBundle: (
382
- this: PluginContext$1,
383
- options: NormalizedOutputOptions$1,
384
- bundle: OutputBundle,
385
- isWrite: boolean,
386
- ) => void
387
- load: LoadHook
388
- moduleParsed: ModuleParsedHook
389
- onLog: (
390
- this: MinimalPluginContext,
391
- level: LogLevel,
392
- log: RollupLog,
393
- ) => boolean | NullValue$1
394
- options: (
395
- this: MinimalPluginContext,
396
- options: InputOptions$1,
397
- ) => InputOptions$1 | NullValue$1
398
- outputOptions: (
399
- this: PluginContext$1,
400
- options: OutputOptions$1,
401
- ) => OutputOptions$1 | NullValue$1
402
- renderChunk: RenderChunkHook
403
- renderDynamicImport: (
404
- this: PluginContext$1,
405
- options: {
406
- customResolution: string | null
407
- format: InternalModuleFormat
408
- moduleId: string
409
- targetModuleId: string | null
410
- },
411
- ) => { left: string; right: string } | NullValue$1
412
- renderError: (this: PluginContext$1, error?: Error) => void
413
- renderStart: (
414
- this: PluginContext$1,
415
- outputOptions: NormalizedOutputOptions$1,
416
- inputOptions: NormalizedInputOptions,
417
- ) => void
418
- resolveDynamicImport: ResolveDynamicImportHook
419
- resolveFileUrl: ResolveFileUrlHook
420
- resolveId: ResolveIdHook
421
- resolveImportMeta: ResolveImportMetaHook
422
- shouldTransformCachedModule: ShouldTransformCachedModuleHook
423
- transform: TransformHook
424
- watchChange: WatchChangeHook
425
- writeBundle: (
426
- this: PluginContext$1,
427
- options: NormalizedOutputOptions$1,
428
- bundle: OutputBundle,
429
- ) => void
430
- }
431
-
432
- type OutputPluginHooks =
433
- | 'augmentChunkHash'
434
- | 'generateBundle'
435
- | 'outputOptions'
436
- | 'renderChunk'
437
- | 'renderDynamicImport'
438
- | 'renderError'
439
- | 'renderStart'
440
- | 'resolveFileUrl'
441
- | 'resolveImportMeta'
442
- | 'writeBundle'
443
-
444
- type SyncPluginHooks =
445
- | 'augmentChunkHash'
446
- | 'onLog'
447
- | 'outputOptions'
448
- | 'renderDynamicImport'
449
- | 'resolveFileUrl'
450
- | 'resolveImportMeta'
451
-
452
- type AsyncPluginHooks = Exclude<
453
- keyof FunctionPluginHooks,
454
- SyncPluginHooks
455
- >
456
-
457
- type FirstPluginHooks =
458
- | 'load'
459
- | 'renderDynamicImport'
460
- | 'resolveDynamicImport'
461
- | 'resolveFileUrl'
462
- | 'resolveId'
463
- | 'resolveImportMeta'
464
- | 'shouldTransformCachedModule'
465
-
466
- type SequentialPluginHooks =
467
- | 'augmentChunkHash'
468
- | 'generateBundle'
469
- | 'onLog'
470
- | 'options'
471
- | 'outputOptions'
472
- | 'renderChunk'
473
- | 'transform'
474
-
475
- type ParallelPluginHooks = Exclude<
476
- keyof FunctionPluginHooks | AddonHooks,
477
- FirstPluginHooks | SequentialPluginHooks
478
- >
479
-
480
- type AddonHooks = 'banner' | 'footer' | 'intro' | 'outro'
481
-
482
- type MakeAsync<Function_> = Function_ extends (
483
- this: infer This,
484
- ...parameters: infer Arguments
485
- ) => infer Return
486
- ? (this: This, ...parameters: Arguments) => Return | Promise<Return>
487
- : never
488
-
489
- // eslint-disable-next-line @typescript-eslint/ban-types
490
- type ObjectHook<T, O = {}> =
491
- | T
492
- | ({ handler: T; order?: 'pre' | 'post' | null } & O)
493
-
494
- type PluginHooks = {
495
- [K in keyof FunctionPluginHooks]: ObjectHook<
496
- K extends AsyncPluginHooks
497
- ? MakeAsync<FunctionPluginHooks[K]>
498
- : FunctionPluginHooks[K],
499
- // eslint-disable-next-line @typescript-eslint/ban-types
500
- K extends ParallelPluginHooks ? { sequential?: boolean } : {}
501
- >
502
- }
503
-
504
- interface OutputPlugin
505
- extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>,
506
- Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
507
- cacheKey?: string
508
- name: string
509
- version?: string
510
- }
511
-
512
- interface Plugin$1<A = any> extends OutputPlugin, Partial<PluginHooks> {
513
- // for inter-plugin communication
514
- api?: A
515
- }
516
-
517
- type TreeshakingPreset = 'smallest' | 'safest' | 'recommended'
518
-
519
- interface NormalizedTreeshakingOptions {
520
- annotations: boolean
521
- correctVarValueBeforeDeclaration: boolean
522
- manualPureFunctions: readonly string[]
523
- moduleSideEffects: HasModuleSideEffects
524
- propertyReadSideEffects: boolean | 'always'
525
- tryCatchDeoptimization: boolean
526
- unknownGlobalSideEffects: boolean
527
- }
528
-
529
- interface TreeshakingOptions
530
- extends Partial<Omit<NormalizedTreeshakingOptions, 'moduleSideEffects'>> {
531
- moduleSideEffects?: ModuleSideEffectsOption
532
- preset?: TreeshakingPreset
533
- }
534
-
535
- interface ManualChunkMeta {
536
- getModuleIds: () => IterableIterator<string>
537
- getModuleInfo: GetModuleInfo
538
- }
539
- type GetManualChunk = (
540
- id: string,
541
- meta: ManualChunkMeta,
542
- ) => string | NullValue$1
543
-
544
- type ExternalOption =
545
- | (string | RegExp)[]
546
- | string
547
- | RegExp
548
- | ((
549
- source: string,
550
- importer: string | undefined,
551
- isResolved: boolean,
552
- ) => boolean | NullValue$1)
553
-
554
- type GlobalsOption =
555
- | { [name: string]: string }
556
- | ((name: string) => string)
557
-
558
- type InputOption = string | string[] | { [entryAlias: string]: string }
559
-
560
- type ManualChunksOption =
561
- | { [chunkAlias: string]: string[] }
562
- | GetManualChunk
563
-
564
- type LogHandlerWithDefault = (
565
- level: LogLevel,
566
- log: RollupLog,
567
- defaultHandler: LogOrStringHandler,
568
- ) => void
569
-
570
- type LogOrStringHandler = (
571
- level: LogLevel | 'error',
572
- log: RollupLog | string,
573
- ) => void
574
-
575
- type LogHandler = (level: LogLevel, log: RollupLog) => void
576
-
577
- type ModuleSideEffectsOption =
578
- | boolean
579
- | 'no-external'
580
- | string[]
581
- | HasModuleSideEffects
582
-
583
- type PreserveEntrySignaturesOption =
584
- | false
585
- | 'strict'
586
- | 'allow-extension'
587
- | 'exports-only'
588
-
589
- type SourcemapPathTransformOption = (
590
- relativeSourcePath: string,
591
- sourcemapPath: string,
592
- ) => string
593
-
594
- type SourcemapIgnoreListOption = (
595
- relativeSourcePath: string,
596
- sourcemapPath: string,
597
- ) => boolean
598
-
599
- type InputPluginOption = MaybePromise$2<
600
- Plugin$1 | NullValue$1 | false | InputPluginOption[]
601
- >
602
-
603
- interface InputOptions$1 {
604
- acorn?: Record<string, unknown>
605
- acornInjectPlugins?:
606
- | ((...arguments_: any[]) => unknown)[]
607
- | ((...arguments_: any[]) => unknown)
608
- cache?: boolean | RollupCache
609
- context?: string
610
- experimentalCacheExpiry?: number
611
- experimentalLogSideEffects?: boolean
612
- external?: ExternalOption
613
- /** @deprecated Use the "inlineDynamicImports" output option instead. */
614
- inlineDynamicImports?: boolean
615
- input?: InputOption
616
- logLevel?: LogLevelOption
617
- makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource'
618
- /** @deprecated Use the "manualChunks" output option instead. */
619
- manualChunks?: ManualChunksOption
620
- maxParallelFileOps?: number
621
- /** @deprecated Use the "maxParallelFileOps" option instead. */
622
- maxParallelFileReads?: number
623
- moduleContext?:
624
- | ((id: string) => string | NullValue$1)
625
- | { [id: string]: string }
626
- onLog?: LogHandlerWithDefault
627
- onwarn?: WarningHandlerWithDefault
628
- perf?: boolean
629
- plugins?: InputPluginOption
630
- preserveEntrySignatures?: PreserveEntrySignaturesOption
631
- /** @deprecated Use the "preserveModules" output option instead. */
632
- preserveModules?: boolean
633
- preserveSymlinks?: boolean
634
- shimMissingExports?: boolean
635
- strictDeprecations?: boolean
636
- treeshake?: boolean | TreeshakingPreset | TreeshakingOptions
637
- watch?: WatcherOptions | false
638
- }
639
-
640
- interface NormalizedInputOptions {
641
- acorn: Record<string, unknown>
642
- acornInjectPlugins: (() => unknown)[]
643
- cache: false | undefined | RollupCache
644
- context: string
645
- experimentalCacheExpiry: number
646
- experimentalLogSideEffects: boolean
647
- external: IsExternal
648
- /** @deprecated Use the "inlineDynamicImports" output option instead. */
649
- inlineDynamicImports: boolean | undefined
650
- input: string[] | { [entryAlias: string]: string }
651
- logLevel: LogLevelOption
652
- makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource'
653
- /** @deprecated Use the "manualChunks" output option instead. */
654
- manualChunks: ManualChunksOption | undefined
655
- maxParallelFileOps: number
656
- /** @deprecated Use the "maxParallelFileOps" option instead. */
657
- maxParallelFileReads: number
658
- moduleContext: (id: string) => string
659
- onLog: LogHandler
660
- onwarn: (warning: RollupLog) => void
661
- perf: boolean
662
- plugins: Plugin$1[]
663
- preserveEntrySignatures: PreserveEntrySignaturesOption
664
- /** @deprecated Use the "preserveModules" output option instead. */
665
- preserveModules: boolean | undefined
666
- preserveSymlinks: boolean
667
- shimMissingExports: boolean
668
- strictDeprecations: boolean
669
- treeshake: false | NormalizedTreeshakingOptions
670
- }
671
-
672
- type InternalModuleFormat =
673
- | 'amd'
674
- | 'cjs'
675
- | 'es'
676
- | 'iife'
677
- | 'system'
678
- | 'umd'
679
-
680
- type ModuleFormat =
681
- | InternalModuleFormat
682
- | 'commonjs'
683
- | 'esm'
684
- | 'module'
685
- | 'systemjs'
686
-
687
- type GeneratedCodePreset = 'es5' | 'es2015'
688
-
689
- interface NormalizedGeneratedCodeOptions {
690
- arrowFunctions: boolean
691
- constBindings: boolean
692
- objectShorthand: boolean
693
- reservedNamesAsProps: boolean
694
- symbols: boolean
695
- }
696
-
697
- interface GeneratedCodeOptions extends Partial<NormalizedGeneratedCodeOptions> {
698
- preset?: GeneratedCodePreset
699
- }
700
-
701
- type OptionsPaths = Record<string, string> | ((id: string) => string)
702
-
703
- type InteropType =
704
- | 'compat'
705
- | 'auto'
706
- | 'esModule'
707
- | 'default'
708
- | 'defaultOnly'
709
-
710
- type GetInterop = (id: string | null) => InteropType
711
-
712
- type AmdOptions = (
713
- | {
714
- autoId?: false
715
- id: string
716
- }
717
- | {
718
- autoId: true
719
- basePath?: string
720
- id?: undefined
721
- }
722
- | {
723
- autoId?: false
724
- id?: undefined
725
- }
726
- ) & {
727
- define?: string
728
- forceJsExtensionForImports?: boolean
729
- }
730
-
731
- type NormalizedAmdOptions = (
732
- | {
733
- autoId: false
734
- id?: string
735
- }
736
- | {
737
- autoId: true
738
- basePath: string
739
- }
740
- ) & {
741
- define: string
742
- forceJsExtensionForImports: boolean
743
- }
744
-
745
- type AddonFunction = (chunk: RenderedChunk$1) => string | Promise<string>
746
-
747
- type OutputPluginOption = MaybePromise$2<
748
- OutputPlugin | NullValue$1 | false | OutputPluginOption[]
749
- >
750
-
751
- interface OutputOptions$1 {
752
- amd?: AmdOptions
753
- assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string)
754
- banner?: string | AddonFunction
755
- chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string)
756
- compact?: boolean
757
- // only required for bundle.write
758
- dir?: string
759
- /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
760
- dynamicImportFunction?: string
761
- dynamicImportInCjs?: boolean
762
- entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string)
763
- esModule?: boolean | 'if-default-prop'
764
- /** @deprecated This option is no longer needed and ignored. */
765
- experimentalDeepDynamicChunkOptimization?: boolean
766
- experimentalMinChunkSize?: number
767
- exports?: 'default' | 'named' | 'none' | 'auto'
768
- extend?: boolean
769
- externalImportAssertions?: boolean
770
- externalLiveBindings?: boolean
771
- // only required for bundle.write
772
- file?: string
773
- footer?: string | AddonFunction
774
- format?: ModuleFormat
775
- freeze?: boolean
776
- generatedCode?: GeneratedCodePreset | GeneratedCodeOptions
777
- globals?: GlobalsOption
778
- hoistTransitiveImports?: boolean
779
- indent?: string | boolean
780
- inlineDynamicImports?: boolean
781
- interop?: InteropType | GetInterop
782
- intro?: string | AddonFunction
783
- manualChunks?: ManualChunksOption
784
- minifyInternalExports?: boolean
785
- name?: string
786
- /** @deprecated Use "generatedCode.symbols" instead. */
787
- namespaceToStringTag?: boolean
788
- noConflict?: boolean
789
- outro?: string | AddonFunction
790
- paths?: OptionsPaths
791
- plugins?: OutputPluginOption
792
- /** @deprecated Use "generatedCode.constBindings" instead. */
793
- preferConst?: boolean
794
- preserveModules?: boolean
795
- preserveModulesRoot?: string
796
- sanitizeFileName?: boolean | ((fileName: string) => string)
797
- sourcemap?: boolean | 'inline' | 'hidden'
798
- sourcemapBaseUrl?: string
799
- sourcemapExcludeSources?: boolean
800
- sourcemapFile?: string
801
- sourcemapFileNames?: string | ((chunkInfo: PreRenderedChunk) => string)
802
- sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption
803
- sourcemapPathTransform?: SourcemapPathTransformOption
804
- strict?: boolean
805
- systemNullSetters?: boolean
806
- validate?: boolean
807
- }
808
-
809
- interface NormalizedOutputOptions$1 {
810
- amd: NormalizedAmdOptions
811
- assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string)
812
- banner: AddonFunction
813
- chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string)
814
- compact: boolean
815
- dir: string | undefined
816
- /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
817
- dynamicImportFunction: string | undefined
818
- dynamicImportInCjs: boolean
819
- entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string)
820
- esModule: boolean | 'if-default-prop'
821
- /** @deprecated This option is no longer needed and ignored. */
822
- experimentalDeepDynamicChunkOptimization: boolean
823
- experimentalMinChunkSize: number
824
- exports: 'default' | 'named' | 'none' | 'auto'
825
- extend: boolean
826
- externalImportAssertions: boolean
827
- externalLiveBindings: boolean
828
- file: string | undefined
829
- footer: AddonFunction
830
- format: InternalModuleFormat
831
- freeze: boolean
832
- generatedCode: NormalizedGeneratedCodeOptions
833
- globals: GlobalsOption
834
- hoistTransitiveImports: boolean
835
- indent: true | string
836
- inlineDynamicImports: boolean
837
- interop: GetInterop
838
- intro: AddonFunction
839
- manualChunks: ManualChunksOption
840
- minifyInternalExports: boolean
841
- name: string | undefined
842
- /** @deprecated Use "generatedCode.symbols" instead. */
843
- namespaceToStringTag: boolean
844
- noConflict: boolean
845
- outro: AddonFunction
846
- paths: OptionsPaths
847
- plugins: OutputPlugin[]
848
- /** @deprecated Use "generatedCode.constBindings" instead. */
849
- preferConst: boolean
850
- preserveModules: boolean
851
- preserveModulesRoot: string | undefined
852
- sanitizeFileName: (fileName: string) => string
853
- sourcemap: boolean | 'inline' | 'hidden'
854
- sourcemapBaseUrl: string | undefined
855
- sourcemapExcludeSources: boolean
856
- sourcemapFile: string | undefined
857
- sourcemapFileNames:
858
- | string
859
- | ((chunkInfo: PreRenderedChunk) => string)
860
- | undefined
861
- sourcemapIgnoreList: SourcemapIgnoreListOption
862
- sourcemapPathTransform: SourcemapPathTransformOption | undefined
863
- strict: boolean
864
- systemNullSetters: boolean
865
- validate: boolean
866
- }
867
-
868
- type WarningHandlerWithDefault = (
869
- warning: RollupLog,
870
- defaultHandler: LoggingFunction,
871
- ) => void
872
-
873
- interface PreRenderedAsset {
874
- name: string | undefined
875
- source: string | Uint8Array
876
- type: 'asset'
877
- }
878
-
879
- interface OutputAsset extends PreRenderedAsset {
880
- fileName: string
881
- needsCodeReference: boolean
882
- }
883
-
884
- interface RenderedModule {
885
- readonly code: string | null
886
- originalLength: number
887
- removedExports: string[]
888
- renderedExports: string[]
889
- renderedLength: number
890
- }
891
-
892
- interface PreRenderedChunk {
893
- exports: string[]
894
- facadeModuleId: string | null
895
- isDynamicEntry: boolean
896
- isEntry: boolean
897
- isImplicitEntry: boolean
898
- moduleIds: string[]
899
- name: string
900
- type: 'chunk'
901
- }
902
-
903
- interface RenderedChunk$1 extends PreRenderedChunk {
904
- dynamicImports: string[]
905
- fileName: string
906
- implicitlyLoadedBefore: string[]
907
- importedBindings: {
908
- [imported: string]: string[]
909
- }
910
- imports: string[]
911
- modules: {
912
- [id: string]: RenderedModule
913
- }
914
- referencedFiles: string[]
915
- }
916
-
917
- interface OutputChunk extends RenderedChunk$1 {
918
- code: string
919
- map: SourceMap | null
920
- sourcemapFileName: string | null
921
- preliminaryFileName: string
922
- }
923
-
924
- interface SerializablePluginCache {
925
- [key: string]: [number, any]
926
- }
927
-
928
- interface RollupCache {
929
- modules: ModuleJSON[]
930
- plugins?: Record<string, SerializablePluginCache>
931
- }
932
-
933
- interface ChokidarOptions {
934
- alwaysStat?: boolean
935
- atomic?: boolean | number
936
- awaitWriteFinish?:
937
- | {
938
- pollInterval?: number
939
- stabilityThreshold?: number
940
- }
941
- | boolean
942
- binaryInterval?: number
943
- cwd?: string
944
- depth?: number
945
- disableGlobbing?: boolean
946
- followSymlinks?: boolean
947
- ignoreInitial?: boolean
948
- ignorePermissionErrors?: boolean
949
- ignored?: any
950
- interval?: number
951
- persistent?: boolean
952
- useFsEvents?: boolean
953
- usePolling?: boolean
954
- }
955
-
956
- interface WatcherOptions {
957
- buildDelay?: number
958
- chokidar?: ChokidarOptions
959
- clearScreen?: boolean
960
- exclude?: string | RegExp | (string | RegExp)[]
961
- include?: string | RegExp | (string | RegExp)[]
962
- skipWrite?: boolean
963
- }
964
-
965
- interface AcornNode {
966
- end: number
967
- start: number
968
- type: string
969
- }
970
-
971
- type MaybePromise$1<T> = T | Promise<T>
972
- type Nullable<T> = T | null | undefined
973
- type VoidNullable<T = void> = T | null | undefined | void
974
- declare class BindingOutputAsset {
975
- get fileName(): string
976
- get source(): string
977
- }
978
-
979
- declare class BindingOutputChunk {
980
- get isEntry(): boolean
981
- get isDynamicEntry(): boolean
982
- get facadeModuleId(): string | null
983
- get moduleIds(): Array<string>
984
- get exports(): Array<string>
985
- get fileName(): string
986
- get modules(): Record<string, BindingRenderedModule>
987
- get code(): string
988
- get map(): string | null
989
- get sourcemapFileName(): string | null
990
- }
991
-
992
- declare class BindingOutputs {
993
- get chunks(): Array<BindingOutputChunk>
994
- get assets(): Array<BindingOutputAsset>
995
- }
996
-
997
- declare class BindingPluginContext {
998
- resolve(specifier: string, importer: string | undefined | null, extraOptions: BindingPluginContextResolveOptions): void
999
- }
1000
-
1001
- interface AliasItem {
1002
- find: string
1003
- replacements: Array<string>
1004
- }
1005
-
1006
- interface BindingHookResolveIdExtraOptions {
1007
- isEntry: boolean
1008
- kind: string
1009
- }
1010
-
1011
- interface BindingInputItem {
1012
- name?: string
1013
- import: string
1014
- }
1015
-
1016
- interface BindingInputOptions {
1017
- external?: undefined | ((source: string, importer: string | undefined, isResolved: boolean) => boolean)
1018
- input: Array<BindingInputItem>
1019
- plugins: Array<BindingPluginOrParallelJsPluginPlaceholder>
1020
- resolve?: BindingResolveOptions
1021
- shimMissingExports?: boolean
1022
- platform?: 'node' | 'browser' | 'neutral'
1023
- logLevel?: 'silent' | 'error' | 'warn' | 'info'
1024
- cwd: string
1025
- }
1026
-
1027
- interface BindingOutputOptions {
1028
- entryFileNames?: string
1029
- chunkFileNames?: string
1030
- banner?: Nullable<string> | ((chunk: RenderedChunk) => MaybePromise$1<VoidNullable<string>>)
1031
- dir?: string
1032
- exports?: 'default' | 'named' | 'none' | 'auto'
1033
- footer?: Nullable<string> | ((chunk: RenderedChunk) => MaybePromise$1<VoidNullable<string>>)
1034
- format?: 'es' | 'cjs'
1035
- plugins: Array<BindingPluginOrParallelJsPluginPlaceholder>
1036
- sourcemap?: 'file' | 'inline' | 'hidden'
1037
- }
1038
-
1039
- interface BindingPluginContextResolveOptions {
1040
- importKind: string
1041
- }
1042
-
1043
- interface BindingRenderedModule {
1044
- code?: string
1045
- }
1046
-
1047
- interface BindingResolveOptions {
1048
- alias?: Array<AliasItem>
1049
- aliasFields?: Array<Array<string>>
1050
- conditionNames?: Array<string>
1051
- exportsFields?: Array<Array<string>>
1052
- extensions?: Array<string>
1053
- mainFields?: Array<string>
1054
- mainFiles?: Array<string>
1055
- modules?: Array<string>
1056
- symlinks?: boolean
1057
- tsconfigFilename?: string
1058
- }
1059
-
1060
- interface RenderedChunk {
1061
- isEntry: boolean
1062
- isDynamicEntry: boolean
1063
- facadeModuleId?: string
1064
- moduleIds: Array<string>
1065
- exports: Array<string>
1066
- fileName: string
1067
- modules: Record<string, BindingRenderedModule>
1068
- }
1069
-
1070
- type MaybePromise<T> = T | Promise<T>;
1071
- interface AnyFn {
1072
- (...args: any[]): any;
1073
- }
1074
- interface AnyObj {
1075
- }
1076
- type NullValue<T = void> = T | undefined | null | void;
1077
-
1078
- interface SourceMapInputObject {
1079
- file?: string;
1080
- mappings: string;
1081
- names?: string[];
1082
- sources?: (string | null)[];
1083
- sourcesContent?: (string | null)[];
1084
- sourceRoot?: string;
1085
- version: number;
1086
- }
1087
- type SourceMapInput = SourceMapInputObject | string | null;
1088
-
1089
- interface OutputOptions {
1090
- dir?: OutputOptions$1['dir'];
1091
- format?: 'es';
1092
- exports?: OutputOptions$1['exports'];
1093
- sourcemap?: OutputOptions$1['sourcemap'];
1094
- banner?: OutputOptions$1['banner'];
1095
- footer?: OutputOptions$1['footer'];
1096
- entryFileNames?: string;
1097
- chunkFileNames?: string;
1098
- }
1099
- type NormalizedOutputOptions = BindingOutputOptions;
1100
-
1101
- type PluginContext = BindingPluginContext;
1102
- type FormalHook<Handler extends AnyFn, HookOptions extends AnyObj = AnyObj> = {
1103
- handler: Handler;
1104
- } & HookOptions;
1105
- type Hook<Handler extends AnyFn, HookOptions extends AnyObj = AnyObj> = FormalHook<Handler, HookOptions> | Handler;
1106
- interface Plugin {
1107
- name?: string;
1108
- buildStart?: Hook<(this: PluginContext, options: RolldownNormalizedInputOptions) => MaybePromise<NullValue>>;
1109
- resolveId?: Hook<(this: null, source: string, importer: string | undefined, extraOptions: BindingHookResolveIdExtraOptions) => MaybePromise<string | NullValue | false | {
1110
- id: string;
1111
- external?: boolean;
1112
- }>>;
1113
- load?: Hook<(this: null, id: string) => MaybePromise<NullValue | string | {
1114
- code: string;
1115
- map?: SourceMapInput;
1116
- }>>;
1117
- transform?: Hook<(this: null, code: string, id: string) => MaybePromise<NullValue | string | {
1118
- code: string;
1119
- map?: string | null | SourceMapInput;
1120
- }>>;
1121
- buildEnd?: Hook<(this: null, err?: Error) => MaybePromise<NullValue>>;
1122
- renderStart?: Hook<(outputOptions: BindingOutputOptions, inputOptions: RolldownNormalizedInputOptions) => MaybePromise<NullValue>>;
1123
- renderChunk?: Hook<(this: null, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => MaybePromise<NullValue | string | {
1124
- code: string;
1125
- map?: string | null | SourceMapInput;
1126
- }>>;
1127
- renderError?: Hook<(this: null, error: Error) => MaybePromise<NullValue>>;
1128
- generateBundle?: Hook<(bundle: BindingOutputs, isWrite: boolean) => MaybePromise<NullValue>>;
1129
- writeBundle?: Hook<(bundle: BindingOutputs) => MaybePromise<NullValue>>;
1130
- }
1131
- type ParallelPlugin = {
1132
- /** @internal */
1133
- _parallel: {
1134
- fileUrl: string;
1135
- options: unknown;
1136
- };
1137
- };
1138
- type DefineParallelPluginResult<Options> = (options: Options) => ParallelPlugin;
1139
- declare function defineParallelPlugin<Options>(pluginPath: string): DefineParallelPluginResult<Options>;
1140
-
1141
- interface InputOptions {
1142
- input?: InputOptions$1['input'];
1143
- plugins?: (Plugin | ParallelPlugin)[];
1144
- external?: InputOptions$1['external'];
1145
- resolve?: RolldownResolveOptions;
1146
- cwd?: string;
1147
- platform?: BindingInputOptions['platform'];
1148
- shimMissingExports?: BindingInputOptions['shimMissingExports'];
1149
- logLevel?: BindingInputOptions['logLevel'];
1150
- }
1151
- type RolldownResolveOptions = Omit<BindingResolveOptions, 'alias'> & {
1152
- alias?: Record<string, string>;
1153
- };
1154
- type RolldownNormalizedInputOptions = Omit<NormalizedInputOptions, 'plugins'> & {
1155
- plugins: (Plugin | ParallelPlugin)[];
1156
- resolve?: BindingResolveOptions;
1157
- platform?: BindingInputOptions['platform'];
1158
- };
1159
-
1160
- export { type DefineParallelPluginResult as D, type InputOptions as I, type MaybePromise as M, type OutputOptions as O, type Plugin as P, defineParallelPlugin as d };