@visulima/packem 2.0.0-alpha.3 → 2.0.0-alpha.30

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 (58) hide show
  1. package/CHANGELOG.md +346 -1
  2. package/README.md +16 -12
  3. package/dist/builder/typedoc/index.d.ts +6 -3
  4. package/dist/builder/typedoc/index.js +3 -3
  5. package/dist/cli/index.js +37 -37
  6. package/dist/config/index.d.ts +6 -3
  7. package/dist/index.d.ts +8 -5
  8. package/dist/index.js +1 -1
  9. package/dist/packem_shared/default-BYM_JvQL.js +1 -0
  10. package/dist/packem_shared/default-Bi3Aj6a9.js +1 -0
  11. package/dist/packem_shared/{default-DqRcOUe1.js → default-CTae39UA.js} +1 -1
  12. package/dist/packem_shared/{default-B6X7-Lx3.js → default-C_x8DHoD.js} +1 -1
  13. package/dist/packem_shared/default-YwldmWl4.js +1 -0
  14. package/dist/packem_shared/esbuildPlugin-BrFhdKJk-C8Y7RuGP.js +3 -0
  15. package/dist/packem_shared/{index-DySckW0r.d.ts → index-BYO428ZM.d.ts} +641 -510
  16. package/dist/packem_shared/index-dFhGUj4X.js +180 -0
  17. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-BCM0B079.js +3 -0
  18. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG-RVsiMbfI.js +1 -0
  19. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-DYkwKhiN.js +6 -0
  20. package/dist/packem_shared/{types-CaBbG-vU.d.ts → types-BXtpQcRr.d.ts} +16 -4
  21. package/dist/rollup/plugins/css/loaders/less.d.ts +1 -1
  22. package/dist/rollup/plugins/css/loaders/less.js +1 -1
  23. package/dist/rollup/plugins/css/loaders/lightningcss.d.ts +1 -1
  24. package/dist/rollup/plugins/css/loaders/lightningcss.js +1 -1
  25. package/dist/rollup/plugins/css/loaders/postcss.d.ts +1 -1
  26. package/dist/rollup/plugins/css/loaders/postcss.js +1 -1
  27. package/dist/rollup/plugins/css/loaders/sass.d.ts +1 -1
  28. package/dist/rollup/plugins/css/loaders/sass.js +1 -1
  29. package/dist/rollup/plugins/css/loaders/sourcemap.d.ts +9 -8
  30. package/dist/rollup/plugins/css/loaders/sourcemap.js +1 -1
  31. package/dist/rollup/plugins/css/loaders/stylus.d.ts +1 -1
  32. package/dist/rollup/plugins/css/loaders/stylus.js +1 -1
  33. package/dist/rollup/plugins/css/loaders/tailwindcss.d.ts +1 -0
  34. package/dist/rollup/plugins/css/loaders/tailwindcss.js +1 -0
  35. package/dist/rollup/plugins/css/minifiers/cssnano.d.ts +1 -1
  36. package/dist/rollup/plugins/css/minifiers/cssnano.js +1 -1
  37. package/dist/rollup/plugins/css/minifiers/lightningcss.d.ts +1 -1
  38. package/dist/rollup/plugins/css/minifiers/lightningcss.js +1 -1
  39. package/dist/rollup/plugins/esbuild/index.d.ts +4 -2
  40. package/dist/rollup/plugins/esbuild/index.js +1 -1
  41. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +5 -3
  42. package/dist/rollup/plugins/oxc/oxc-transformer.d.ts +4 -2
  43. package/dist/rollup/plugins/sucrase/index.d.ts +3 -1
  44. package/dist/rollup/plugins/sucrase/index.js +1 -1
  45. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +9 -2
  46. package/dist/rollup/plugins/swc/swc-plugin.d.ts +4 -8
  47. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +3 -1
  48. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +1 -1
  49. package/files.d.ts +37 -0
  50. package/package.json +50 -26
  51. package/dist/packem_shared/default-B_dUKZ_J.js +0 -1
  52. package/dist/packem_shared/default-C3sdXf4G.js +0 -1
  53. package/dist/packem_shared/default-DR5Fia_R.js +0 -1
  54. package/dist/packem_shared/esbuildPlugin-BAwyhG6L-yty60jMl.js +0 -3
  55. package/dist/packem_shared/index-DWE3PZRE.js +0 -138
  56. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js +0 -3
  57. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG-BsYx9cDO.js +0 -1
  58. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-BEkYWTsH.js +0 -6
@@ -6,16 +6,20 @@ import { RollupReplaceOptions } from '@rollup/plugin-replace';
6
6
  import { RollupWasmOptions } from '@rollup/plugin-wasm';
7
7
  import { FilterPattern } from '@rollup/pluginutils';
8
8
  import { RollupBuild, RollupOptions, RollupWatcher, OutputOptions, Plugin as Plugin$1 } from 'rollup';
9
- import { Options as Options$2 } from 'rollup-plugin-dts';
9
+ import { Options as Options$4 } from 'rollup-plugin-dts';
10
10
  import { NodePolyfillsOptions } from 'rollup-plugin-polyfill-node';
11
11
  import { PureAnnotationsOptions } from 'rollup-plugin-pure';
12
12
  import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
13
+ import { SourceMapOptions } from 'magic-string';
14
+ import { MinifierOptions } from 'html-minifier-next';
13
15
  import { TransformOptions as TransformOptions$1, Loader, BuildOptions } from 'esbuild';
14
16
  import { PackageJson } from '@visulima/package';
15
17
  import { AnsiColors as AnsiColors$1 } from '@visulima/colorize';
16
18
  import { NapiResolveOptions } from 'oxc-resolver';
17
19
  import { TransformOptions as TransformOptions$2, JsxOptions } from 'oxc-transform';
18
- import { Options as Options$3 } from 'sucrase';
20
+ import { Options as Options$5 } from 'sucrase';
21
+
22
+ type AnsiColors = "bgBlack" | "bgBlackBright" | "bgBlue" | "bgBlueBright" | "bgCyan" | "bgCyanBright" | "bgGray" | "bgGreen" | "bgGreenBright" | "bgGrey" | "bgMagenta" | "bgMagentaBright" | "bgRed" | "bgRedBright" | "bgWhite" | "bgWhiteBright" | "bgYellow" | "bgYellowBright" | "black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright";
19
23
 
20
24
  /**
21
25
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
@@ -132,7 +136,7 @@ interface LoggerFunction$1 {
132
136
  }
133
137
  interface LoggerConfiguration$1<L extends string> {
134
138
  badge?: string;
135
- color?: AnsiColors$1 | undefined;
139
+ color?: AnsiColors | undefined;
136
140
  label: string;
137
141
  logLevel: LiteralUnion$1<ExtendedRfc5424LogLevels$1, L>;
138
142
  }
@@ -265,6 +269,106 @@ declare class PailServerImpl$1<T extends string = string, L extends string = str
265
269
  }
266
270
  type PailServerType$1<T extends string = string, L extends string = string> = PailServerImpl$1<T, L> & Record<DefaultLogTypes$1, LoggerFunction$1> & Record<T, LoggerFunction$1> & (new <TC extends string = string, LC extends string = string>(options?: ServerConstructorOptions$1<TC, LC>) => PailServerType$1<TC, LC>);
267
271
 
272
+ interface Template {
273
+ parts: TemplatePart[];
274
+ tag?: string;
275
+ }
276
+ interface TemplatePart {
277
+ end: number;
278
+ start: number;
279
+ text: string;
280
+ }
281
+ interface Strategy$1<N = unknown> {
282
+ getRootNode: (source: string, fileName?: string) => N;
283
+ getTaggedTemplateTemplate: (node: N) => unknown;
284
+ getTagText: (node: N) => string;
285
+ getTemplateParts: (node: N) => TemplatePart[];
286
+ isTaggedTemplate: (node: N) => boolean;
287
+ isTemplate: (node: N) => boolean;
288
+ walkNodes: (parent: N, visit: (child: N) => void) => void;
289
+ }
290
+
291
+ interface ParseLiteralsOptions {
292
+ fileName?: string;
293
+ strategy?: Partial<Strategy$1<unknown>>;
294
+ }
295
+ declare const parseLiterals: (source: string, options?: ParseLiteralsOptions) => Template[];
296
+
297
+ interface Strategy<O = unknown, C = unknown> {
298
+ combineHTMLStrings: (parts: TemplatePart[], placeholder: string) => string;
299
+ getPlaceholder: (parts: TemplatePart[]) => string;
300
+ minifyCSS?: (css: string, options?: C) => string;
301
+ minifyHTML: (html: string, options?: O) => string | Promise<string>;
302
+ splitHTMLByPlaceholder: (html: string, placeholder: string) => string[];
303
+ }
304
+ declare const defaultMinifyOptions: MinifierOptions;
305
+
306
+ type Options$3 = DefaultOptions | CustomOptions<unknown>;
307
+ interface DefaultOptions extends BaseOptions {
308
+ minifyOptions?: Partial<typeof defaultMinifyOptions>;
309
+ }
310
+ interface CustomOptions<S extends Strategy | unknown> extends BaseOptions {
311
+ minifyOptions?: S extends Strategy<infer O> ? Partial<O> : never;
312
+ strategy: S;
313
+ }
314
+ interface BaseOptions {
315
+ fileName?: string;
316
+ generateSourceMap?: ((ms: MagicStringLike, fileName: string) => SourceMap | undefined) | false;
317
+ MagicString?: new (source: string) => MagicStringLike;
318
+ parseLiterals?: typeof parseLiterals;
319
+ parseLiteralsOptions?: Partial<ParseLiteralsOptions>;
320
+ shouldMinify?: (template: Template) => boolean;
321
+ shouldMinifyCSS?: (template: Template) => boolean;
322
+ validate?: Validation | false;
323
+ }
324
+ interface MagicStringLike {
325
+ generateMap: (options?: Partial<SourceMapOptions>) => SourceMap;
326
+ overwrite: (start: number, end: number, content: string) => unknown;
327
+ toString: () => string;
328
+ }
329
+ interface SourceMap {
330
+ file?: string;
331
+ mappings: string;
332
+ names: string[];
333
+ sources: string[];
334
+ sourcesContent?: string[];
335
+ toString: () => string;
336
+ toUrl: () => string;
337
+ version: number;
338
+ }
339
+ interface Validation {
340
+ ensureHTMLPartsValid: (parts: TemplatePart[], htmlParts: string[]) => void;
341
+ ensurePlaceholderValid: (placeholder: unknown) => void;
342
+ }
343
+ interface Result {
344
+ code: string;
345
+ map: SourceMap | undefined;
346
+ }
347
+ declare function minifyHTMLLiterals(source: string, options?: DefaultOptions): Promise<Result | null>;
348
+ declare function minifyHTMLLiterals<S extends Strategy>(source: string, options?: CustomOptions<S>): Promise<Result | null>;
349
+
350
+ interface MinifyHTMLLiteralsOptions {
351
+ exclude?: FilterPattern;
352
+ failOnError?: boolean;
353
+ include?: FilterPattern;
354
+ minifyHTMLLiterals?: typeof minifyHTMLLiterals;
355
+ options?: Partial<Options$3>;
356
+ }
357
+
358
+ /**
359
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
360
+
361
+ @category Type
362
+ */
363
+ type Primitive =
364
+ | null
365
+ | undefined
366
+ | string
367
+ | number
368
+ | boolean
369
+ | symbol
370
+ | bigint;
371
+
268
372
  declare global {
269
373
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
270
374
  interface SymbolConstructor {
@@ -273,128 +377,362 @@ declare global {
273
377
  }
274
378
 
275
379
  /**
276
- Extract all optional keys from the given type.
277
-
278
- This is useful when you want to create a new type that contains different type values for the optional keys only.
279
-
280
- @example
281
- ```
282
- import type {OptionalKeysOf, Except} from 'type-fest';
283
-
284
- interface User {
285
- name: string;
286
- surname: string;
287
-
288
- luckyNumber?: number;
289
- }
290
-
291
- const REMOVE_FIELD = Symbol('remove field symbol');
292
- type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
293
- [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
294
- };
295
-
296
- const update1: UpdateOperation<User> = {
297
- name: 'Alice'
298
- };
299
-
300
- const update2: UpdateOperation<User> = {
301
- name: 'Bob',
302
- luckyNumber: REMOVE_FIELD
303
- };
304
- ```
305
-
306
- @category Utilities
307
- */
308
- type OptionalKeysOf<BaseType extends object> =
309
- BaseType extends unknown // For distributing `BaseType`
310
- ? (keyof {
311
- [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never
312
- }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
313
- : never; // Should never happen
380
+ Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
314
381
 
315
- /**
316
- Extract all required keys from the given type.
382
+ Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
317
383
 
318
- This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
384
+ This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
319
385
 
320
386
  @example
321
387
  ```
322
- import type {RequiredKeysOf} from 'type-fest';
323
-
324
- declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
325
-
326
- interface User {
327
- name: string;
328
- surname: string;
329
-
330
- luckyNumber?: number;
331
- }
388
+ import type {LiteralUnion} from 'type-fest';
332
389
 
333
- const validator1 = createValidation<User>('name', value => value.length < 25);
334
- const validator2 = createValidation<User>('surname', value => value.length < 25);
335
- ```
390
+ // Before
336
391
 
337
- @category Utilities
338
- */
339
- type RequiredKeysOf<BaseType extends object> =
340
- BaseType extends unknown // For distributing `BaseType`
341
- ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>>
342
- : never; // Should never happen
392
+ type Pet = 'dog' | 'cat' | string;
343
393
 
344
- /**
345
- Returns a boolean for whether the given type is `never`.
394
+ const pet: Pet = '';
395
+ // Start typing in your TypeScript-enabled IDE.
396
+ // You **will not** get auto-completion for `dog` and `cat` literals.
346
397
 
347
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
348
- @link https://stackoverflow.com/a/53984913/10292952
349
- @link https://www.zhenghao.io/posts/ts-never
398
+ // After
350
399
 
351
- Useful in type utilities, such as checking if something does not occur.
400
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
352
401
 
353
- @example
402
+ const pet: Pet2 = '';
403
+ // You **will** get auto-completion for `dog` and `cat` literals.
354
404
  ```
355
- import type {IsNever, And} from 'type-fest';
356
-
357
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
358
- type AreStringsEqual<A extends string, B extends string> =
359
- And<
360
- IsNever<Exclude<A, B>> extends true ? true : false,
361
- IsNever<Exclude<B, A>> extends true ? true : false
362
- >;
363
405
 
364
- type EndIfEqual<I extends string, O extends string> =
365
- AreStringsEqual<I, O> extends true
366
- ? never
367
- : void;
406
+ @category Type
407
+ */
408
+ type LiteralUnion<
409
+ LiteralType,
410
+ BaseType extends Primitive,
411
+ > = LiteralType | (BaseType & Record<never, never>);
368
412
 
369
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
370
- if (input === output) {
371
- process.exit(0);
372
- }
413
+ declare class InteractiveStreamHook {
414
+ #private;
415
+ static readonly DRAIN = true;
416
+ constructor(stream: NodeJS.WriteStream);
417
+ active(): void;
418
+ erase(count: number): void;
419
+ inactive(separateHistory?: boolean): void;
420
+ renew(): void;
421
+ write(message: string): void;
373
422
  }
374
423
 
375
- endIfEqual('abc', 'abc');
376
- //=> never
377
-
378
- endIfEqual('abc', '123');
379
- //=> void
380
- ```
424
+ type StreamType = "stderr" | "stdout";
425
+ declare class InteractiveManager {
426
+ #private;
427
+ constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
428
+ get lastLength(): number;
429
+ get outside(): number;
430
+ get isHooked(): boolean;
431
+ get isSuspended(): boolean;
432
+ erase(stream: StreamType, count?: number): void;
433
+ hook(): boolean;
434
+ resume(stream: StreamType, eraseRowCount?: number): void;
435
+ suspend(stream: StreamType, erase?: boolean): void;
436
+ unhook(separateHistory?: boolean): boolean;
437
+ update(stream: StreamType, rows: string[], from?: number): void;
438
+ private _clear;
439
+ }
381
440
 
382
- @category Type Guard
383
- @category Utilities
384
- */
385
- type IsNever<T> = [T] extends [never] ? true : false;
441
+ declare global {
442
+ namespace VisulimaPail {
443
+ interface CustomMeta<L> {
444
+ }
445
+ }
446
+ }
447
+ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
448
+ badge: string | undefined;
449
+ context: any[] | undefined;
450
+ date: Date | string;
451
+ error: Error | undefined;
452
+ groups: string[];
453
+ label: string | undefined;
454
+ message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
455
+ prefix: string | undefined;
456
+ repeated?: number | undefined;
457
+ scope: string[] | undefined;
458
+ suffix: string | undefined;
459
+ traceError: Error | undefined;
460
+ type: {
461
+ level: ExtendedRfc5424LogLevels | L;
462
+ name: string;
463
+ };
464
+ }
465
+ type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
466
+ type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
467
+ interface LoggerFunction {
468
+ (message: Message): void;
469
+ (...message: any[]): void;
470
+ }
471
+ interface LoggerConfiguration<L extends string> {
472
+ badge?: string;
473
+ color?: AnsiColors$1 | undefined;
474
+ label: string;
475
+ logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
476
+ }
477
+ type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
478
+ type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
479
+ interface Reporter<L extends string> {
480
+ log: (meta: ReadonlyMeta<L>) => void;
481
+ }
482
+ interface Processor<L extends string> {
483
+ process: (meta: Meta<L>) => Meta<L>;
484
+ }
485
+ interface ConstructorOptions<T extends string, L extends string> {
486
+ disabled?: boolean;
487
+ logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
488
+ logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
489
+ messages?: {
490
+ timerEnd?: string;
491
+ timerStart?: string;
492
+ };
493
+ processors?: Processor<L>[];
494
+ rawReporter?: Reporter<L>;
495
+ reporters?: Reporter<L>[];
496
+ scope?: string[] | string;
497
+ throttle?: number;
498
+ throttleMin?: number;
499
+ types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
500
+ }
501
+ interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
502
+ interactive?: boolean;
503
+ stderr: NodeJS.WriteStream;
504
+ stdout: NodeJS.WriteStream;
505
+ }
506
+ type Message = {
507
+ context?: any[] | undefined;
508
+ message: any;
509
+ prefix?: string;
510
+ suffix?: string;
511
+ };
386
512
 
387
- /**
388
- An if-else-like type that resolves depending on whether the given type is `never`.
513
+ type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
389
514
 
390
- @see {@link IsNever}
515
+ interface StringifyOptions {
516
+ bigint?: boolean,
517
+ circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
518
+ deterministic?: boolean | ((a: string, b: string) => number),
519
+ maximumBreadth?: number,
520
+ maximumDepth?: number,
521
+ strict?: boolean,
522
+ }
391
523
 
392
- @example
393
- ```
394
- import type {IfNever} from 'type-fest';
524
+ declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
525
+ declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
526
+ declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
395
527
 
396
- type ShouldBeTrue = IfNever<never>;
397
- //=> true
528
+ declare namespace stringify {
529
+ export function configure(options: StringifyOptions): typeof stringify
530
+ }
531
+
532
+ declare class PailBrowserImpl<T extends string = string, L extends string = string> {
533
+ protected timersMap: Map<string, number>;
534
+ protected countMap: Map<string, number>;
535
+ protected seqTimers: Set<string>;
536
+ protected readonly lastLog: {
537
+ count?: number;
538
+ object?: Meta<L>;
539
+ serialized?: string;
540
+ time?: Date;
541
+ timeout?: ReturnType<typeof setTimeout>;
542
+ };
543
+ protected readonly logLevels: Record<string, number>;
544
+ protected disabled: boolean;
545
+ protected scopeName: string[];
546
+ protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
547
+ protected readonly longestLabel: string;
548
+ protected readonly processors: Set<Processor<L>>;
549
+ protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
550
+ protected reporters: Set<Reporter<L>>;
551
+ protected readonly throttle: number;
552
+ protected readonly throttleMin: number;
553
+ protected readonly stringify: typeof stringify;
554
+ protected groups: string[];
555
+ protected readonly startTimerMessage: string;
556
+ protected readonly endTimerMessage: string;
557
+ protected rawReporter: Reporter<L>;
558
+ constructor(options: ConstructorOptions<T, L>);
559
+ wrapConsole(): void;
560
+ restoreConsole(): void;
561
+ wrapException(): void;
562
+ disable(): void;
563
+ enable(): void;
564
+ isEnabled(): boolean;
565
+ scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
566
+ unscope(): void;
567
+ time(label?: string): void;
568
+ timeLog(label?: string, ...data: unknown[]): void;
569
+ timeEnd(label?: string): void;
570
+ group(label?: string): void;
571
+ groupEnd(): void;
572
+ count(label?: string): void;
573
+ countReset(label?: string): void;
574
+ clear(): void;
575
+ raw(message: string, ...arguments_: unknown[]): void;
576
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
577
+ protected registerReporters(reporters: Reporter<L>[]): void;
578
+ private _report;
579
+ private registerProcessors;
580
+ private _normalizeLogLevel;
581
+ private _buildMeta;
582
+ private _logger;
583
+ }
584
+ type PailBrowserType<T extends string = string, L extends string = string> = PailBrowserImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ConstructorOptions<TC, LC>) => PailBrowserType<TC, LC>);
585
+
586
+ declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
587
+ readonly options: ServerConstructorOptions<T, L>;
588
+ protected readonly stdout: NodeJS.WriteStream;
589
+ protected readonly stderr: NodeJS.WriteStream;
590
+ protected interactiveManager: InteractiveManager | undefined;
591
+ protected readonly interactive: boolean;
592
+ constructor(options: ServerConstructorOptions<T, L>);
593
+ scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
594
+ getInteractiveManager(): InteractiveManager | undefined;
595
+ wrapStd(): void;
596
+ restoreStd(): void;
597
+ wrapAll(): void;
598
+ restoreAll(): void;
599
+ clear(): void;
600
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
601
+ private _wrapStream;
602
+ private _restoreStream;
603
+ }
604
+ type PailServerType<T extends string = string, L extends string = string> = PailServerImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ServerConstructorOptions<TC, LC>) => PailServerType<TC, LC>);
605
+
606
+ declare global {
607
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
608
+ interface SymbolConstructor {
609
+ readonly observable: symbol;
610
+ }
611
+ }
612
+
613
+ /**
614
+ Extract all optional keys from the given type.
615
+
616
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
617
+
618
+ @example
619
+ ```
620
+ import type {OptionalKeysOf, Except} from 'type-fest';
621
+
622
+ interface User {
623
+ name: string;
624
+ surname: string;
625
+
626
+ luckyNumber?: number;
627
+ }
628
+
629
+ const REMOVE_FIELD = Symbol('remove field symbol');
630
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
631
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
632
+ };
633
+
634
+ const update1: UpdateOperation<User> = {
635
+ name: 'Alice'
636
+ };
637
+
638
+ const update2: UpdateOperation<User> = {
639
+ name: 'Bob',
640
+ luckyNumber: REMOVE_FIELD
641
+ };
642
+ ```
643
+
644
+ @category Utilities
645
+ */
646
+ type OptionalKeysOf<BaseType extends object> =
647
+ BaseType extends unknown // For distributing `BaseType`
648
+ ? (keyof {
649
+ [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never
650
+ }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
651
+ : never; // Should never happen
652
+
653
+ /**
654
+ Extract all required keys from the given type.
655
+
656
+ This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
657
+
658
+ @example
659
+ ```
660
+ import type {RequiredKeysOf} from 'type-fest';
661
+
662
+ declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
663
+
664
+ interface User {
665
+ name: string;
666
+ surname: string;
667
+
668
+ luckyNumber?: number;
669
+ }
670
+
671
+ const validator1 = createValidation<User>('name', value => value.length < 25);
672
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
673
+ ```
674
+
675
+ @category Utilities
676
+ */
677
+ type RequiredKeysOf<BaseType extends object> =
678
+ BaseType extends unknown // For distributing `BaseType`
679
+ ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>>
680
+ : never; // Should never happen
681
+
682
+ /**
683
+ Returns a boolean for whether the given type is `never`.
684
+
685
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
686
+ @link https://stackoverflow.com/a/53984913/10292952
687
+ @link https://www.zhenghao.io/posts/ts-never
688
+
689
+ Useful in type utilities, such as checking if something does not occur.
690
+
691
+ @example
692
+ ```
693
+ import type {IsNever, And} from 'type-fest';
694
+
695
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
696
+ type AreStringsEqual<A extends string, B extends string> =
697
+ And<
698
+ IsNever<Exclude<A, B>> extends true ? true : false,
699
+ IsNever<Exclude<B, A>> extends true ? true : false
700
+ >;
701
+
702
+ type EndIfEqual<I extends string, O extends string> =
703
+ AreStringsEqual<I, O> extends true
704
+ ? never
705
+ : void;
706
+
707
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
708
+ if (input === output) {
709
+ process.exit(0);
710
+ }
711
+ }
712
+
713
+ endIfEqual('abc', 'abc');
714
+ //=> never
715
+
716
+ endIfEqual('abc', '123');
717
+ //=> void
718
+ ```
719
+
720
+ @category Type Guard
721
+ @category Utilities
722
+ */
723
+ type IsNever<T> = [T] extends [never] ? true : false;
724
+
725
+ /**
726
+ An if-else-like type that resolves depending on whether the given type is `never`.
727
+
728
+ @see {@link IsNever}
729
+
730
+ @example
731
+ ```
732
+ import type {IfNever} from 'type-fest';
733
+
734
+ type ShouldBeTrue = IfNever<never>;
735
+ //=> true
398
736
 
399
737
  type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
400
738
  //=> 'bar'
@@ -2529,414 +2867,164 @@ interface NodeRequire {
2529
2867
  >;
2530
2868
 
2531
2869
  /** @deprecated CommonJS API */
2532
- main: NodeModule | undefined;
2533
- }
2534
-
2535
- interface NodeModule {
2536
- /**
2537
- * `true` if the module is running during the Node.js preload.
2538
- */
2539
- isPreloading: boolean;
2540
- exports: any;
2541
- require: NodeRequire;
2542
- id: string;
2543
- filename: string;
2544
- loaded: boolean;
2545
- /**
2546
- * @deprecated since Node.js **v14.6.0** Please use
2547
- * {@linkcode NodeRequire.main | require.main} and
2548
- * {@linkcode NodeModule.children | module.children} instead.
2549
- */
2550
- parent: NodeModule | null | undefined;
2551
- children: NodeModule[];
2552
- /**
2553
- * The directory name of the module.
2554
- * This is usually the same as the `path.dirname()` of the `module.id`.
2555
- *
2556
- * @since Node.js **v11.14.0**
2557
- */
2558
- path: string;
2559
- paths: string[];
2560
- }
2561
-
2562
- type ModuleCache = Record<string, NodeModule>;
2563
-
2564
- type EvalModuleOptions = Partial<{
2565
- id: string;
2566
- filename: string;
2567
- ext: string;
2568
- cache: ModuleCache;
2569
- /**
2570
- * @default true
2571
- */
2572
- async: boolean;
2573
- forceTranspile: boolean;
2574
- }>;
2575
-
2576
- interface TransformOptions {
2577
- source: string;
2578
- filename?: string;
2579
- ts?: boolean;
2580
- retainLines?: boolean;
2581
- interopDefault?: boolean;
2582
- /**
2583
- * @default false
2584
- */
2585
- async?: boolean;
2586
- /**
2587
- * @default false
2588
- */
2589
- jsx?: boolean | JSXOptions;
2590
- babel?: Record<string, any>;
2591
- }
2592
-
2593
- interface TransformResult {
2594
- code: string;
2595
- error?: any;
2596
- }
2597
-
2598
- interface JitiResolveOptions {
2599
- conditions?: string[];
2600
- parentURL?: string | URL;
2601
- try?: boolean;
2602
- }
2603
-
2604
- /**
2605
- * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options | Reference}
2606
- */
2607
- interface JSXOptions {
2608
- throwIfNamespace?: boolean;
2609
- runtime?: "classic" | "automatic";
2610
- importSource?: string;
2611
- pragma?: string;
2612
- pragmaFrag?: string;
2613
- useBuiltIns?: boolean;
2614
- useSpread?: boolean;
2615
- }
2616
-
2617
- type Environment = "production" | "development" | undefined;
2618
- type Mode = "build" | "jit" | "watch";
2619
- type Format = "cjs" | "esm";
2620
- type Runtime = "browser" | "bun" | "deno" | "edge-light" | "electron" | "node" | "react-native" | "react-server" | "workerd" | undefined;
2621
-
2622
- interface BuildHooks<T> {
2623
- "build:before": (context: BuildContext<T>) => Promise<void> | void;
2624
- "build:done": (context: BuildContext<T>) => Promise<void> | void;
2625
- "build:prepare": (context: BuildContext<T>) => Promise<void> | void;
2626
- "builder:before": (name: string, context: BuildContext<T>) => Promise<void> | void;
2627
- "builder:done": (name: string, context: BuildContext<T>) => Promise<void> | void;
2628
- "rollup:build": (context: BuildContext<T>, build: RollupBuild) => Promise<void> | void;
2629
- "rollup:done": (context: BuildContext<T>) => Promise<void> | void;
2630
- "rollup:dts:build": (context: BuildContext<T>, build: RollupBuild) => Promise<void> | void;
2631
- "rollup:dts:done": (context: BuildContext<T>) => Promise<void> | void;
2632
- "rollup:dts:options": (context: BuildContext<T>, options: RollupOptions) => Promise<void> | void;
2633
- "rollup:options": (context: BuildContext<T>, options: RollupOptions) => Promise<void> | void;
2634
- "rollup:watch": (context: BuildContext<T>, watcher: RollupWatcher) => Promise<void> | void;
2635
- "typedoc:before": (context: BuildContext<T>) => Promise<void> | void;
2636
- "typedoc:done": (context: BuildContext<T>) => Promise<void> | void;
2637
- "validate:before": (context: BuildContext<T>) => Promise<void> | void;
2638
- "validate:done": (context: BuildContext<T>) => Promise<void> | void;
2639
- }
2640
- type BuildContext<T> = {
2641
- buildEntries: (BuildContextBuildAssetAndChunk | BuildContextBuildEntry)[];
2642
- dependencyGraphMap: Map<string, Set<[string, string]>>;
2643
- environment: Environment;
2644
- hoistedDependencies: Set<string>;
2645
- hooks: Hookable<BuildHooks<T>>;
2646
- implicitDependencies: Set<string>;
2647
- jiti: Jiti;
2648
- logger: PailServerType$1;
2649
- mode: Mode;
2650
- options: T;
2651
- pkg: PackageJson;
2652
- tsconfig?: TsConfigResult;
2653
- usedDependencies: Set<string>;
2654
- warnings: Set<string>;
2655
- };
2656
- type BuildContextBuildAssetAndChunk = {
2657
- chunk?: boolean;
2658
- chunks?: string[];
2659
- dynamicImports?: string[];
2660
- exports?: string[];
2661
- modules?: {
2662
- bytes: number;
2663
- id: string;
2664
- }[];
2665
- path: string;
2666
- size?: {
2667
- brotli?: number;
2668
- bytes?: number;
2669
- gzip?: number;
2670
- };
2671
- type?: "asset" | "chunk";
2672
- };
2673
- type BuildContextBuildEntry = {
2674
- chunk?: boolean;
2675
- chunks?: string[];
2676
- dynamicImports?: string[];
2677
- exports?: string[];
2678
- modules?: {
2679
- bytes: number;
2680
- id: string;
2681
- }[];
2682
- path: string;
2683
- size?: {
2684
- brotli?: number;
2685
- bytes?: number;
2686
- gzip?: number;
2687
- };
2688
- type?: "entry";
2689
- };
2690
-
2691
- type AnsiColors = "bgBlack" | "bgBlackBright" | "bgBlue" | "bgBlueBright" | "bgCyan" | "bgCyanBright" | "bgGray" | "bgGreen" | "bgGreenBright" | "bgGrey" | "bgMagenta" | "bgMagentaBright" | "bgRed" | "bgRedBright" | "bgWhite" | "bgWhiteBright" | "bgYellow" | "bgYellowBright" | "black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright";
2692
-
2693
- /**
2694
- Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
2695
-
2696
- @category Type
2697
- */
2698
- type Primitive =
2699
- | null
2700
- | undefined
2701
- | string
2702
- | number
2703
- | boolean
2704
- | symbol
2705
- | bigint;
2706
-
2707
- declare global {
2708
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
2709
- interface SymbolConstructor {
2710
- readonly observable: symbol;
2711
- }
2712
- }
2713
-
2714
- /**
2715
- Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
2716
-
2717
- Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
2718
-
2719
- This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
2720
-
2721
- @example
2722
- ```
2723
- import type {LiteralUnion} from 'type-fest';
2724
-
2725
- // Before
2726
-
2727
- type Pet = 'dog' | 'cat' | string;
2728
-
2729
- const pet: Pet = '';
2730
- // Start typing in your TypeScript-enabled IDE.
2731
- // You **will not** get auto-completion for `dog` and `cat` literals.
2732
-
2733
- // After
2734
-
2735
- type Pet2 = LiteralUnion<'dog' | 'cat', string>;
2736
-
2737
- const pet: Pet2 = '';
2738
- // You **will** get auto-completion for `dog` and `cat` literals.
2739
- ```
2740
-
2741
- @category Type
2742
- */
2743
- type LiteralUnion<
2744
- LiteralType,
2745
- BaseType extends Primitive,
2746
- > = LiteralType | (BaseType & Record<never, never>);
2747
-
2748
- declare class InteractiveStreamHook {
2749
- #private;
2750
- static readonly DRAIN = true;
2751
- constructor(stream: NodeJS.WriteStream);
2752
- active(): void;
2753
- erase(count: number): void;
2754
- inactive(separateHistory?: boolean): void;
2755
- renew(): void;
2756
- write(message: string): void;
2757
- }
2758
-
2759
- type StreamType = "stderr" | "stdout";
2760
- declare class InteractiveManager {
2761
- #private;
2762
- constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
2763
- get lastLength(): number;
2764
- get outside(): number;
2765
- get isHooked(): boolean;
2766
- get isSuspended(): boolean;
2767
- erase(stream: StreamType, count?: number): void;
2768
- hook(): boolean;
2769
- resume(stream: StreamType, eraseRowCount?: number): void;
2770
- suspend(stream: StreamType, erase?: boolean): void;
2771
- unhook(separateHistory?: boolean): boolean;
2772
- update(stream: StreamType, rows: string[], from?: number): void;
2773
- private _clear;
2774
- }
2775
-
2776
- declare global {
2777
- namespace VisulimaPail {
2778
- interface CustomMeta<L> {
2779
- }
2780
- }
2781
- }
2782
- interface Meta<L> extends VisulimaPail.CustomMeta<L> {
2783
- badge: string | undefined;
2784
- context: any[] | undefined;
2785
- date: Date | string;
2786
- error: Error | undefined;
2787
- groups: string[];
2788
- label: string | undefined;
2789
- message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
2790
- prefix: string | undefined;
2791
- repeated?: number | undefined;
2792
- scope: string[] | undefined;
2793
- suffix: string | undefined;
2794
- traceError: Error | undefined;
2795
- type: {
2796
- level: ExtendedRfc5424LogLevels | L;
2797
- name: string;
2798
- };
2799
- }
2800
- type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
2801
- type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
2802
- interface LoggerFunction {
2803
- (message: Message): void;
2804
- (...message: any[]): void;
2805
- }
2806
- interface LoggerConfiguration<L extends string> {
2807
- badge?: string;
2808
- color?: AnsiColors | undefined;
2809
- label: string;
2810
- logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
2811
- }
2812
- type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
2813
- type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
2814
- interface Reporter<L extends string> {
2815
- log: (meta: ReadonlyMeta<L>) => void;
2816
- }
2817
- interface Processor<L extends string> {
2818
- process: (meta: Meta<L>) => Meta<L>;
2819
- }
2820
- interface ConstructorOptions<T extends string, L extends string> {
2821
- disabled?: boolean;
2822
- logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
2823
- logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
2824
- messages?: {
2825
- timerEnd?: string;
2826
- timerStart?: string;
2827
- };
2828
- processors?: Processor<L>[];
2829
- rawReporter?: Reporter<L>;
2830
- reporters?: Reporter<L>[];
2831
- scope?: string[] | string;
2832
- throttle?: number;
2833
- throttleMin?: number;
2834
- types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
2870
+ main: NodeModule | undefined;
2835
2871
  }
2836
- interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
2837
- interactive?: boolean;
2838
- stderr: NodeJS.WriteStream;
2839
- stdout: NodeJS.WriteStream;
2872
+
2873
+ interface NodeModule {
2874
+ /**
2875
+ * `true` if the module is running during the Node.js preload.
2876
+ */
2877
+ isPreloading: boolean;
2878
+ exports: any;
2879
+ require: NodeRequire;
2880
+ id: string;
2881
+ filename: string;
2882
+ loaded: boolean;
2883
+ /**
2884
+ * @deprecated since Node.js **v14.6.0** Please use
2885
+ * {@linkcode NodeRequire.main | require.main} and
2886
+ * {@linkcode NodeModule.children | module.children} instead.
2887
+ */
2888
+ parent: NodeModule | null | undefined;
2889
+ children: NodeModule[];
2890
+ /**
2891
+ * The directory name of the module.
2892
+ * This is usually the same as the `path.dirname()` of the `module.id`.
2893
+ *
2894
+ * @since Node.js **v11.14.0**
2895
+ */
2896
+ path: string;
2897
+ paths: string[];
2840
2898
  }
2841
- type Message = {
2842
- context?: any[] | undefined;
2843
- message: any;
2844
- prefix?: string;
2845
- suffix?: string;
2846
- };
2847
2899
 
2848
- type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
2900
+ type ModuleCache = Record<string, NodeModule>;
2849
2901
 
2850
- interface StringifyOptions {
2851
- bigint?: boolean,
2852
- circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
2853
- deterministic?: boolean | ((a: string, b: string) => number),
2854
- maximumBreadth?: number,
2855
- maximumDepth?: number,
2856
- strict?: boolean,
2902
+ type EvalModuleOptions = Partial<{
2903
+ id: string;
2904
+ filename: string;
2905
+ ext: string;
2906
+ cache: ModuleCache;
2907
+ /**
2908
+ * @default true
2909
+ */
2910
+ async: boolean;
2911
+ forceTranspile: boolean;
2912
+ }>;
2913
+
2914
+ interface TransformOptions {
2915
+ source: string;
2916
+ filename?: string;
2917
+ ts?: boolean;
2918
+ retainLines?: boolean;
2919
+ interopDefault?: boolean;
2920
+ /**
2921
+ * @default false
2922
+ */
2923
+ async?: boolean;
2924
+ /**
2925
+ * @default false
2926
+ */
2927
+ jsx?: boolean | JSXOptions;
2928
+ babel?: Record<string, any>;
2857
2929
  }
2858
2930
 
2859
- declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
2860
- declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
2861
- declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
2931
+ interface TransformResult {
2932
+ code: string;
2933
+ error?: any;
2934
+ }
2862
2935
 
2863
- declare namespace stringify {
2864
- export function configure(options: StringifyOptions): typeof stringify
2936
+ interface JitiResolveOptions {
2937
+ conditions?: string[];
2938
+ parentURL?: string | URL;
2939
+ try?: boolean;
2865
2940
  }
2866
2941
 
2867
- declare class PailBrowserImpl<T extends string = string, L extends string = string> {
2868
- protected timersMap: Map<string, number>;
2869
- protected countMap: Map<string, number>;
2870
- protected seqTimers: Set<string>;
2871
- protected readonly lastLog: {
2872
- count?: number;
2873
- object?: Meta<L>;
2874
- serialized?: string;
2875
- time?: Date;
2876
- timeout?: ReturnType<typeof setTimeout>;
2877
- };
2878
- protected readonly logLevels: Record<string, number>;
2879
- protected disabled: boolean;
2880
- protected scopeName: string[];
2881
- protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
2882
- protected readonly longestLabel: string;
2883
- protected readonly processors: Set<Processor<L>>;
2884
- protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
2885
- protected reporters: Set<Reporter<L>>;
2886
- protected readonly throttle: number;
2887
- protected readonly throttleMin: number;
2888
- protected readonly stringify: typeof stringify;
2889
- protected groups: string[];
2890
- protected readonly startTimerMessage: string;
2891
- protected readonly endTimerMessage: string;
2892
- protected rawReporter: Reporter<L>;
2893
- constructor(options: ConstructorOptions<T, L>);
2894
- wrapConsole(): void;
2895
- restoreConsole(): void;
2896
- wrapException(): void;
2897
- disable(): void;
2898
- enable(): void;
2899
- isEnabled(): boolean;
2900
- scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
2901
- unscope(): void;
2902
- time(label?: string): void;
2903
- timeLog(label?: string, ...data: unknown[]): void;
2904
- timeEnd(label?: string): void;
2905
- group(label?: string): void;
2906
- groupEnd(): void;
2907
- count(label?: string): void;
2908
- countReset(label?: string): void;
2909
- clear(): void;
2910
- raw(message: string, ...arguments_: unknown[]): void;
2911
- protected extendReporter(reporter: Reporter<L>): Reporter<L>;
2912
- protected registerReporters(reporters: Reporter<L>[]): void;
2913
- private _report;
2914
- private registerProcessors;
2915
- private _normalizeLogLevel;
2916
- private _buildMeta;
2917
- private _logger;
2942
+ /**
2943
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options | Reference}
2944
+ */
2945
+ interface JSXOptions {
2946
+ throwIfNamespace?: boolean;
2947
+ runtime?: "classic" | "automatic";
2948
+ importSource?: string;
2949
+ pragma?: string;
2950
+ pragmaFrag?: string;
2951
+ useBuiltIns?: boolean;
2952
+ useSpread?: boolean;
2918
2953
  }
2919
- type PailBrowserType<T extends string = string, L extends string = string> = PailBrowserImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ConstructorOptions<TC, LC>) => PailBrowserType<TC, LC>);
2920
2954
 
2921
- declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
2922
- readonly options: ServerConstructorOptions<T, L>;
2923
- protected readonly stdout: NodeJS.WriteStream;
2924
- protected readonly stderr: NodeJS.WriteStream;
2925
- protected interactiveManager: InteractiveManager | undefined;
2926
- protected readonly interactive: boolean;
2927
- constructor(options: ServerConstructorOptions<T, L>);
2928
- scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
2929
- getInteractiveManager(): InteractiveManager | undefined;
2930
- wrapStd(): void;
2931
- restoreStd(): void;
2932
- wrapAll(): void;
2933
- restoreAll(): void;
2934
- clear(): void;
2935
- protected extendReporter(reporter: Reporter<L>): Reporter<L>;
2936
- private _wrapStream;
2937
- private _restoreStream;
2955
+ type Environment = "production" | "development" | undefined;
2956
+ type Mode = "build" | "jit" | "watch";
2957
+ type Format = "cjs" | "esm";
2958
+ type Runtime = "browser" | "bun" | "deno" | "edge-light" | "electron" | "node" | "react-native" | "react-server" | "workerd" | undefined;
2959
+
2960
+ interface BuildHooks<T> {
2961
+ "build:before": (context: BuildContext<T>) => Promise<void> | void;
2962
+ "build:done": (context: BuildContext<T>) => Promise<void> | void;
2963
+ "build:prepare": (context: BuildContext<T>) => Promise<void> | void;
2964
+ "builder:before": (name: string, context: BuildContext<T>) => Promise<void> | void;
2965
+ "builder:done": (name: string, context: BuildContext<T>) => Promise<void> | void;
2966
+ "rollup:build": (context: BuildContext<T>, build: RollupBuild) => Promise<void> | void;
2967
+ "rollup:done": (context: BuildContext<T>) => Promise<void> | void;
2968
+ "rollup:dts:build": (context: BuildContext<T>, build: RollupBuild) => Promise<void> | void;
2969
+ "rollup:dts:done": (context: BuildContext<T>) => Promise<void> | void;
2970
+ "rollup:dts:options": (context: BuildContext<T>, options: RollupOptions) => Promise<void> | void;
2971
+ "rollup:options": (context: BuildContext<T>, options: RollupOptions) => Promise<void> | void;
2972
+ "rollup:watch": (context: BuildContext<T>, watcher: RollupWatcher) => Promise<void> | void;
2973
+ "typedoc:before": (context: BuildContext<T>) => Promise<void> | void;
2974
+ "typedoc:done": (context: BuildContext<T>) => Promise<void> | void;
2975
+ "validate:before": (context: BuildContext<T>) => Promise<void> | void;
2976
+ "validate:done": (context: BuildContext<T>) => Promise<void> | void;
2938
2977
  }
2939
- type PailServerType<T extends string = string, L extends string = string> = PailServerImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ServerConstructorOptions<TC, LC>) => PailServerType<TC, LC>);
2978
+ type BuildContext<T> = {
2979
+ buildEntries: (BuildContextBuildAssetAndChunk | BuildContextBuildEntry)[];
2980
+ dependencyGraphMap: Map<string, Set<[string, string]>>;
2981
+ environment: Environment;
2982
+ hoistedDependencies: Set<string>;
2983
+ hooks: Hookable<BuildHooks<T>>;
2984
+ implicitDependencies: Set<string>;
2985
+ jiti: Jiti;
2986
+ logger: PailServerType;
2987
+ mode: Mode;
2988
+ options: T;
2989
+ pkg: PackageJson;
2990
+ tsconfig?: TsConfigResult;
2991
+ usedDependencies: Set<string>;
2992
+ warnings: Set<string>;
2993
+ };
2994
+ type BuildContextBuildAssetAndChunk = {
2995
+ chunk?: boolean;
2996
+ chunks?: string[];
2997
+ dynamicImports?: string[];
2998
+ exports?: string[];
2999
+ modules?: {
3000
+ bytes: number;
3001
+ id: string;
3002
+ }[];
3003
+ path: string;
3004
+ size?: {
3005
+ brotli?: number;
3006
+ bytes?: number;
3007
+ gzip?: number;
3008
+ };
3009
+ type?: "asset" | "chunk";
3010
+ };
3011
+ type BuildContextBuildEntry = {
3012
+ chunk?: boolean;
3013
+ chunks?: string[];
3014
+ dynamicImports?: string[];
3015
+ exports?: string[];
3016
+ modules?: {
3017
+ bytes: number;
3018
+ id: string;
3019
+ }[];
3020
+ path: string;
3021
+ size?: {
3022
+ brotli?: number;
3023
+ bytes?: number;
3024
+ gzip?: number;
3025
+ };
3026
+ type?: "entry";
3027
+ };
2940
3028
 
2941
3029
  interface CJSInteropOptions {
2942
3030
  addDefaultProperty?: boolean;
@@ -2955,6 +3043,17 @@ type SingleTargetDesc = {
2955
3043
  src: string[] | string;
2956
3044
  };
2957
3045
 
3046
+ type DataUriPluginOptions = {
3047
+ exclude?: FilterPattern;
3048
+ include?: FilterPattern;
3049
+ srcset?: boolean;
3050
+ };
3051
+
3052
+ interface DebarrelPluginOptions {
3053
+ include?: FilterPattern;
3054
+ possibleBarrelFiles?: (RegExp | string)[];
3055
+ }
3056
+
2958
3057
  interface EsmShimCjsSyntaxOptions {
2959
3058
  exclude?: FilterPattern;
2960
3059
  include?: FilterPattern;
@@ -2978,11 +3077,28 @@ interface LicenseOptions {
2978
3077
  path?: string;
2979
3078
  }
2980
3079
 
3080
+ interface NativeModulesOptions {
3081
+ nativesDirectory?: string;
3082
+ }
3083
+
2981
3084
  interface RawLoaderOptions {
2982
3085
  exclude?: FilterPattern;
2983
3086
  include?: FilterPattern;
2984
3087
  }
2985
3088
 
3089
+ type Awaitable<T> = T | Promise<T>;
3090
+ type TransformFunction = (id: string, importer: string, rollupResolve: (id: string, importer?: string) => Promise<{
3091
+ id: string;
3092
+ }>) => Awaitable<boolean | undefined | void>;
3093
+ interface Options$2 {
3094
+ builtinNodeModules?: boolean;
3095
+ cwd?: string;
3096
+ exclude?: FilterPattern;
3097
+ include?: FilterPattern;
3098
+ order?: "pre" | "post" | undefined;
3099
+ shouldTransform?: string[] | TransformFunction;
3100
+ }
3101
+
2986
3102
  type ShebangOptions = {
2987
3103
  replace: boolean;
2988
3104
  shebang: string;
@@ -3006,7 +3122,7 @@ interface UrlOptions {
3006
3122
 
3007
3123
  type MarkOptional<Type, Keys extends keyof Type> = Type extends Type ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
3008
3124
  type EsbuildPluginConfig = Options$1 & {
3009
- logger: PailServerType;
3125
+ logger: PailServerType$1;
3010
3126
  };
3011
3127
  type OptimizeDepsOptions = {
3012
3128
  cwd: string;
@@ -3036,7 +3152,7 @@ type OxcResolveOptions = Omit<NapiResolveOptions, "tsconfig"> & {
3036
3152
  ignoreSideEffectsForRoot?: boolean;
3037
3153
  };
3038
3154
 
3039
- interface SucrasePluginConfig extends Options$3 {
3155
+ interface SucrasePluginConfig extends Options$5 {
3040
3156
  exclude?: FilterPattern;
3041
3157
  include?: FilterPattern;
3042
3158
  }
@@ -3523,7 +3639,7 @@ interface Options extends Config {
3523
3639
  */
3524
3640
  sourceRoot?: string;
3525
3641
  plugin?: Plugin;
3526
- isModule?: boolean | "unknown";
3642
+ isModule?: boolean | "unknown" | "commonjs";
3527
3643
  /**
3528
3644
  * Destination path. Note that this value is used only to fix source path
3529
3645
  * of source map files and swc does not write output to this path.
@@ -3766,7 +3882,7 @@ interface EsParserConfig {
3766
3882
  */
3767
3883
  importAssertions?: boolean;
3768
3884
  /**
3769
- * Defaults to `false`
3885
+ * @deprecated Always true in swc
3770
3886
  */
3771
3887
  importAttributes?: boolean;
3772
3888
  /**
@@ -3820,6 +3936,7 @@ interface TransformConfig {
3820
3936
  * https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
3821
3937
  */
3822
3938
  verbatimModuleSyntax?: boolean;
3939
+ tsEnumIsMutable?: boolean;
3823
3940
  }
3824
3941
  interface ReactConfig {
3825
3942
  /**
@@ -3880,11 +3997,20 @@ interface ReactConfig {
3880
3997
  emitFullSignatures?: boolean;
3881
3998
  };
3882
3999
  /**
3883
- * jsx runtime
4000
+ * Decides which runtime to use when transforming JSX.
4001
+ * - `"automatic"` - Automatically imports the functions that JSX transpiles to.
4002
+ * This is the modern approach introduced in React 17+ that eliminates the need to
4003
+ * manually import React in every file that uses JSX.
4004
+ * - `"classic"` - Uses the traditional JSX transform that relies on `React.createElement`
4005
+ * calls. Requires React to be in scope, which was the standard behavior before React 17.
4006
+ * - `"preserve"` - Leaves JSX syntax unchanged without transforming it.
4007
+ * @default "classic"
3884
4008
  */
3885
- runtime?: "automatic" | "classic";
4009
+ runtime?: "automatic" | "classic" | "preserve";
3886
4010
  /**
3887
- * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic'
4011
+ * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory
4012
+ * functions when using `runtime` 'automatic'
4013
+ * @default "react"
3888
4014
  */
3889
4015
  importSource?: string;
3890
4016
  }
@@ -5175,7 +5301,9 @@ interface PackemRollupOptions {
5175
5301
  cjsInterop?: CJSInteropOptions;
5176
5302
  commonjs: RollupCommonJSOptions | false;
5177
5303
  copy?: CopyPluginOptions | false;
5178
- dts: Options$2;
5304
+ dataUri?: DataUriPluginOptions | false;
5305
+ debarrel?: DebarrelPluginOptions | false;
5306
+ dts: Options$4;
5179
5307
  dynamicVars?: RollupDynamicImportVariablesOptions | false;
5180
5308
  esbuild?: Options$1 | false;
5181
5309
  experimental?: {
@@ -5186,6 +5314,8 @@ interface PackemRollupOptions {
5186
5314
  jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
5187
5315
  license?: LicenseOptions | false;
5188
5316
  metafile?: boolean;
5317
+ minifyHTMLLiterals?: MinifyHTMLLiteralsOptions | false;
5318
+ nativeModules?: NativeModulesOptions | false;
5189
5319
  output?: OutputOptions;
5190
5320
  oxc?: Omit<OXCTransformPluginConfig, "cwd" | "sourcemap" | "target"> | false;
5191
5321
  patchTypes: PatchTypesOptions | false;
@@ -5199,7 +5329,8 @@ interface PackemRollupOptions {
5199
5329
  };
5200
5330
  preserveDynamicImports?: boolean;
5201
5331
  raw?: RawLoaderOptions | false;
5202
- replace: RollupReplaceOptions | false;
5332
+ replace: Omit<RollupReplaceOptions, "cwd"> | false;
5333
+ requireCJS?: Options$2 | false;
5203
5334
  resolve: RollupNodeResolveOptions | false;
5204
5335
  shebang?: Partial<ShebangOptions> | false;
5205
5336
  shim?: EsmShimCjsSyntaxOptions | false;
@@ -5224,4 +5355,4 @@ type TransformerFn = ((config: EsbuildPluginConfig | InternalOXCTransformPluginC
5224
5355
  type TransformerName = "esbuild" | "oxc" | "sucrase" | "swc";
5225
5356
 
5226
5357
  export { sucrasePlugin as s };
5227
- export type { BuildContext as B, Environment as E, Format as F, IsolatedDeclarationsTransformer as I, Mode as M, PackemRollupOptions as P, Runtime as R, SwcPluginConfig as S, TransformerFn as T, TransformerName as a, BuildContextBuildAssetAndChunk as b, BuildContextBuildEntry as c, BuildHooks as d, EsbuildPluginConfig as e, IsolatedDeclarationsResult as f, InternalOXCTransformPluginConfig as g, SucrasePluginConfig as h };
5358
+ export type { BuildContext as B, Environment as E, Format as F, IsolatedDeclarationsTransformer as I, Mode as M, PackemRollupOptions as P, Runtime as R, SwcPluginConfig as S, TransformerFn as T, TransformerName as a, BuildContextBuildAssetAndChunk as b, BuildContextBuildEntry as c, BuildHooks as d, IsolatedDeclarationsResult as e, EsbuildPluginConfig as f, InternalOXCTransformPluginConfig as g, SucrasePluginConfig as h };