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