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

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 (59) hide show
  1. package/CHANGELOG.md +364 -1
  2. package/LICENSE.md +475 -1347
  3. package/README.md +16 -12
  4. package/dist/builder/typedoc/index.d.ts +6 -3
  5. package/dist/builder/typedoc/index.js +3 -3
  6. package/dist/cli/index.js +37 -37
  7. package/dist/config/index.d.ts +6 -3
  8. package/dist/index.d.ts +8 -5
  9. package/dist/index.js +1 -1
  10. package/dist/packem_shared/default-BYM_JvQL.js +1 -0
  11. package/dist/packem_shared/{default-B6X7-Lx3.js → default-BY_XZBkt.js} +1 -1
  12. package/dist/packem_shared/default-Bv0h8ASu.js +1 -0
  13. package/dist/packem_shared/default-CAKCVA5N.js +1 -0
  14. package/dist/packem_shared/{default-DqRcOUe1.js → default-CTOd1a5W.js} +1 -1
  15. package/dist/packem_shared/esbuildPlugin-DpLtQGuZ-DlbvGoD-.js +3 -0
  16. package/dist/packem_shared/index-CMiSObms.js +178 -0
  17. package/dist/packem_shared/{index-DySckW0r.d.ts → index-D09qw6EP.d.ts} +209 -328
  18. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-CfOpxpsh.js +3 -0
  19. package/dist/packem_shared/oxcResolvePlugin-Ccef6pyL-VBndJ7ld.js +1 -0
  20. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-D4oir4A1.js +6 -0
  21. package/dist/packem_shared/{types-CaBbG-vU.d.ts → types-B5hAMUkV.d.ts} +16 -4
  22. package/dist/rollup/plugins/css/loaders/less.d.ts +1 -1
  23. package/dist/rollup/plugins/css/loaders/less.js +1 -1
  24. package/dist/rollup/plugins/css/loaders/lightningcss.d.ts +1 -1
  25. package/dist/rollup/plugins/css/loaders/lightningcss.js +1 -1
  26. package/dist/rollup/plugins/css/loaders/postcss.d.ts +1 -1
  27. package/dist/rollup/plugins/css/loaders/postcss.js +1 -1
  28. package/dist/rollup/plugins/css/loaders/sass.d.ts +1 -1
  29. package/dist/rollup/plugins/css/loaders/sass.js +1 -1
  30. package/dist/rollup/plugins/css/loaders/sourcemap.d.ts +9 -8
  31. package/dist/rollup/plugins/css/loaders/sourcemap.js +1 -1
  32. package/dist/rollup/plugins/css/loaders/stylus.d.ts +1 -1
  33. package/dist/rollup/plugins/css/loaders/stylus.js +1 -1
  34. package/dist/rollup/plugins/css/loaders/tailwindcss.d.ts +1 -0
  35. package/dist/rollup/plugins/css/loaders/tailwindcss.js +1 -0
  36. package/dist/rollup/plugins/css/minifiers/cssnano.d.ts +1 -1
  37. package/dist/rollup/plugins/css/minifiers/cssnano.js +1 -1
  38. package/dist/rollup/plugins/css/minifiers/lightningcss.d.ts +1 -1
  39. package/dist/rollup/plugins/css/minifiers/lightningcss.js +1 -1
  40. package/dist/rollup/plugins/esbuild/index.d.ts +4 -2
  41. package/dist/rollup/plugins/esbuild/index.js +1 -1
  42. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +5 -3
  43. package/dist/rollup/plugins/oxc/oxc-transformer.d.ts +4 -2
  44. package/dist/rollup/plugins/sucrase/index.d.ts +3 -1
  45. package/dist/rollup/plugins/sucrase/index.js +1 -1
  46. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +9 -2
  47. package/dist/rollup/plugins/swc/swc-plugin.d.ts +4 -8
  48. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +3 -1
  49. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +1 -1
  50. package/files.d.ts +37 -0
  51. package/package.json +50 -26
  52. package/dist/packem_shared/default-B_dUKZ_J.js +0 -1
  53. package/dist/packem_shared/default-C3sdXf4G.js +0 -1
  54. package/dist/packem_shared/default-DR5Fia_R.js +0 -1
  55. package/dist/packem_shared/esbuildPlugin-BAwyhG6L-yty60jMl.js +0 -3
  56. package/dist/packem_shared/index-DWE3PZRE.js +0 -138
  57. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js +0 -3
  58. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG-BsYx9cDO.js +0 -1
  59. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-BEkYWTsH.js +0 -6
@@ -6,23 +6,25 @@ 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
13
  import { TransformOptions as TransformOptions$1, Loader, BuildOptions } from 'esbuild';
14
14
  import { PackageJson } from '@visulima/package';
15
- import { AnsiColors as AnsiColors$1 } from '@visulima/colorize';
15
+ import { AnsiColors } from '@visulima/colorize';
16
+ import { SourceMapOptions } from 'magic-string';
17
+ import { MinifierOptions } from 'html-minifier-next';
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';
19
21
 
20
22
  /**
21
23
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
22
24
 
23
25
  @category Type
24
26
  */
25
- type Primitive$1 =
27
+ type Primitive =
26
28
  | null
27
29
  | undefined
28
30
  | string
@@ -67,12 +69,12 @@ const pet: Pet2 = '';
67
69
 
68
70
  @category Type
69
71
  */
70
- type LiteralUnion$1<
72
+ type LiteralUnion<
71
73
  LiteralType,
72
- BaseType extends Primitive$1,
74
+ BaseType extends Primitive,
73
75
  > = LiteralType | (BaseType & Record<never, never>);
74
76
 
75
- declare class InteractiveStreamHook$1 {
77
+ declare class InteractiveStreamHook {
76
78
  #private;
77
79
  static readonly DRAIN = true;
78
80
  constructor(stream: NodeJS.WriteStream);
@@ -83,20 +85,20 @@ declare class InteractiveStreamHook$1 {
83
85
  write(message: string): void;
84
86
  }
85
87
 
86
- type StreamType$1 = "stderr" | "stdout";
87
- declare class InteractiveManager$1 {
88
+ type StreamType = "stderr" | "stdout";
89
+ declare class InteractiveManager {
88
90
  #private;
89
- constructor(stdout: InteractiveStreamHook$1, stderr: InteractiveStreamHook$1);
91
+ constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
90
92
  get lastLength(): number;
91
93
  get outside(): number;
92
94
  get isHooked(): boolean;
93
95
  get isSuspended(): boolean;
94
- erase(stream: StreamType$1, count?: number): void;
96
+ erase(stream: StreamType, count?: number): void;
95
97
  hook(): boolean;
96
- resume(stream: StreamType$1, eraseRowCount?: number): void;
97
- suspend(stream: StreamType$1, erase?: boolean): void;
98
+ resume(stream: StreamType, eraseRowCount?: number): void;
99
+ suspend(stream: StreamType, erase?: boolean): void;
98
100
  unhook(separateHistory?: boolean): boolean;
99
- update(stream: StreamType$1, rows: string[], from?: number): void;
101
+ update(stream: StreamType, rows: string[], from?: number): void;
100
102
  private _clear;
101
103
  }
102
104
 
@@ -106,75 +108,75 @@ declare global {
106
108
  }
107
109
  }
108
110
  }
109
- interface Meta$1<L> extends VisulimaPail.CustomMeta<L> {
111
+ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
110
112
  badge: string | undefined;
111
113
  context: any[] | undefined;
112
114
  date: Date | string;
113
115
  error: Error | undefined;
114
116
  groups: string[];
115
117
  label: string | undefined;
116
- message: Primitive$1 | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
118
+ message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
117
119
  prefix: string | undefined;
118
120
  repeated?: number | undefined;
119
121
  scope: string[] | undefined;
120
122
  suffix: string | undefined;
121
123
  traceError: Error | undefined;
122
124
  type: {
123
- level: ExtendedRfc5424LogLevels$1 | L;
125
+ level: ExtendedRfc5424LogLevels | L;
124
126
  name: string;
125
127
  };
126
128
  }
127
- type ExtendedRfc5424LogLevels$1 = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
128
- type DefaultLogTypes$1 = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
129
- interface LoggerFunction$1 {
130
- (message: Message$1): void;
129
+ type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
130
+ type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
131
+ interface LoggerFunction {
132
+ (message: Message): void;
131
133
  (...message: any[]): void;
132
134
  }
133
- interface LoggerConfiguration$1<L extends string> {
135
+ interface LoggerConfiguration<L extends string> {
134
136
  badge?: string;
135
- color?: AnsiColors$1 | undefined;
137
+ color?: AnsiColors | undefined;
136
138
  label: string;
137
- logLevel: LiteralUnion$1<ExtendedRfc5424LogLevels$1, L>;
139
+ logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
138
140
  }
139
- type LoggerTypesConfig$1<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration$1<L>>>;
140
- type ReadonlyMeta$1<L extends string> = Readonly<Meta$1<L>>;
141
- interface Reporter$1<L extends string> {
142
- log: (meta: ReadonlyMeta$1<L>) => void;
141
+ type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
142
+ type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
143
+ interface Reporter<L extends string> {
144
+ log: (meta: ReadonlyMeta<L>) => void;
143
145
  }
144
- interface Processor$1<L extends string> {
145
- process: (meta: Meta$1<L>) => Meta$1<L>;
146
+ interface Processor<L extends string> {
147
+ process: (meta: Meta<L>) => Meta<L>;
146
148
  }
147
- interface ConstructorOptions$1<T extends string, L extends string> {
149
+ interface ConstructorOptions<T extends string, L extends string> {
148
150
  disabled?: boolean;
149
- logLevel?: LiteralUnion$1<ExtendedRfc5424LogLevels$1, L>;
150
- logLevels?: Partial<Record<ExtendedRfc5424LogLevels$1, number>> & Record<L, number>;
151
+ logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
152
+ logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
151
153
  messages?: {
152
154
  timerEnd?: string;
153
155
  timerStart?: string;
154
156
  };
155
- processors?: Processor$1<L>[];
156
- rawReporter?: Reporter$1<L>;
157
- reporters?: Reporter$1<L>[];
157
+ processors?: Processor<L>[];
158
+ rawReporter?: Reporter<L>;
159
+ reporters?: Reporter<L>[];
158
160
  scope?: string[] | string;
159
161
  throttle?: number;
160
162
  throttleMin?: number;
161
- types?: LoggerTypesConfig$1<T, L> & Partial<LoggerTypesConfig$1<DefaultLogTypes$1, L>>;
163
+ types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
162
164
  }
163
- interface ServerConstructorOptions$1<T extends string, L extends string> extends ConstructorOptions$1<T, L> {
165
+ interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
164
166
  interactive?: boolean;
165
167
  stderr: NodeJS.WriteStream;
166
168
  stdout: NodeJS.WriteStream;
167
169
  }
168
- type Message$1 = {
170
+ type Message = {
169
171
  context?: any[] | undefined;
170
172
  message: any;
171
173
  prefix?: string;
172
174
  suffix?: string;
173
175
  };
174
176
 
175
- type Replacer$1 = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
177
+ type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
176
178
 
177
- interface StringifyOptions$1 {
179
+ interface StringifyOptions {
178
180
  bigint?: boolean,
179
181
  circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
180
182
  deterministic?: boolean | ((a: string, b: string) => number),
@@ -183,21 +185,21 @@ interface StringifyOptions$1 {
183
185
  strict?: boolean,
184
186
  }
185
187
 
186
- declare function stringify$1(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer$1, space?: string | number): undefined
187
- declare function stringify$1(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer$1, space?: string | number): string
188
- declare function stringify$1(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
188
+ declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
189
+ declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
190
+ declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
189
191
 
190
- declare namespace stringify$1 {
191
- export function configure(options: StringifyOptions$1): typeof stringify$1
192
+ declare namespace stringify {
193
+ export function configure(options: StringifyOptions): typeof stringify
192
194
  }
193
195
 
194
- declare class PailBrowserImpl$1<T extends string = string, L extends string = string> {
196
+ declare class PailBrowserImpl<T extends string = string, L extends string = string> {
195
197
  protected timersMap: Map<string, number>;
196
198
  protected countMap: Map<string, number>;
197
199
  protected seqTimers: Set<string>;
198
200
  protected readonly lastLog: {
199
201
  count?: number;
200
- object?: Meta$1<L>;
202
+ object?: Meta<L>;
201
203
  serialized?: string;
202
204
  time?: Date;
203
205
  timeout?: ReturnType<typeof setTimeout>;
@@ -205,26 +207,26 @@ declare class PailBrowserImpl$1<T extends string = string, L extends string = st
205
207
  protected readonly logLevels: Record<string, number>;
206
208
  protected disabled: boolean;
207
209
  protected scopeName: string[];
208
- protected readonly types: LoggerTypesConfig$1<LiteralUnion$1<DefaultLogTypes$1, T>, L>;
210
+ protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
209
211
  protected readonly longestLabel: string;
210
- protected readonly processors: Set<Processor$1<L>>;
211
- protected readonly generalLogLevel: LiteralUnion$1<ExtendedRfc5424LogLevels$1, L>;
212
- protected reporters: Set<Reporter$1<L>>;
212
+ protected readonly processors: Set<Processor<L>>;
213
+ protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
214
+ protected reporters: Set<Reporter<L>>;
213
215
  protected readonly throttle: number;
214
216
  protected readonly throttleMin: number;
215
- protected readonly stringify: typeof stringify$1;
217
+ protected readonly stringify: typeof stringify;
216
218
  protected groups: string[];
217
219
  protected readonly startTimerMessage: string;
218
220
  protected readonly endTimerMessage: string;
219
- protected rawReporter: Reporter$1<L>;
220
- constructor(options: ConstructorOptions$1<T, L>);
221
+ protected rawReporter: Reporter<L>;
222
+ constructor(options: ConstructorOptions<T, L>);
221
223
  wrapConsole(): void;
222
224
  restoreConsole(): void;
223
225
  wrapException(): void;
224
226
  disable(): void;
225
227
  enable(): void;
226
228
  isEnabled(): boolean;
227
- scope<N extends string = T>(...name: string[]): PailBrowserType$1<N, L>;
229
+ scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
228
230
  unscope(): void;
229
231
  time(label?: string): void;
230
232
  timeLog(label?: string, ...data: unknown[]): void;
@@ -235,35 +237,35 @@ declare class PailBrowserImpl$1<T extends string = string, L extends string = st
235
237
  countReset(label?: string): void;
236
238
  clear(): void;
237
239
  raw(message: string, ...arguments_: unknown[]): void;
238
- protected extendReporter(reporter: Reporter$1<L>): Reporter$1<L>;
239
- protected registerReporters(reporters: Reporter$1<L>[]): void;
240
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
241
+ protected registerReporters(reporters: Reporter<L>[]): void;
240
242
  private _report;
241
243
  private registerProcessors;
242
244
  private _normalizeLogLevel;
243
245
  private _buildMeta;
244
246
  private _logger;
245
247
  }
246
- type PailBrowserType$1<T extends string = string, L extends string = string> = PailBrowserImpl$1<T, L> & Record<DefaultLogTypes$1, LoggerFunction$1> & Record<T, LoggerFunction$1> & (new <TC extends string = string, LC extends string = string>(options?: ConstructorOptions$1<TC, LC>) => PailBrowserType$1<TC, LC>);
248
+ 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>);
247
249
 
248
- declare class PailServerImpl$1<T extends string = string, L extends string = string> extends PailBrowserImpl$1<T, L> {
249
- readonly options: ServerConstructorOptions$1<T, L>;
250
+ declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
251
+ readonly options: ServerConstructorOptions<T, L>;
250
252
  protected readonly stdout: NodeJS.WriteStream;
251
253
  protected readonly stderr: NodeJS.WriteStream;
252
- protected interactiveManager: InteractiveManager$1 | undefined;
254
+ protected interactiveManager: InteractiveManager | undefined;
253
255
  protected readonly interactive: boolean;
254
- constructor(options: ServerConstructorOptions$1<T, L>);
255
- scope<N extends string = T>(...name: string[]): PailServerType$1<N, L>;
256
- getInteractiveManager(): InteractiveManager$1 | undefined;
256
+ constructor(options: ServerConstructorOptions<T, L>);
257
+ scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
258
+ getInteractiveManager(): InteractiveManager | undefined;
257
259
  wrapStd(): void;
258
260
  restoreStd(): void;
259
261
  wrapAll(): void;
260
262
  restoreAll(): void;
261
263
  clear(): void;
262
- protected extendReporter(reporter: Reporter$1<L>): Reporter$1<L>;
264
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
263
265
  private _wrapStream;
264
266
  private _restoreStream;
265
267
  }
266
- 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>);
268
+ 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>);
267
269
 
268
270
  declare global {
269
271
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -2645,7 +2647,7 @@ type BuildContext<T> = {
2645
2647
  hooks: Hookable<BuildHooks<T>>;
2646
2648
  implicitDependencies: Set<string>;
2647
2649
  jiti: Jiti;
2648
- logger: PailServerType$1;
2650
+ logger: PailServerType;
2649
2651
  mode: Mode;
2650
2652
  options: T;
2651
2653
  pkg: PackageJson;
@@ -2688,256 +2690,6 @@ type BuildContextBuildEntry = {
2688
2690
  type?: "entry";
2689
2691
  };
2690
2692
 
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>>;
2835
- }
2836
- interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
2837
- interactive?: boolean;
2838
- stderr: NodeJS.WriteStream;
2839
- stdout: NodeJS.WriteStream;
2840
- }
2841
- type Message = {
2842
- context?: any[] | undefined;
2843
- message: any;
2844
- prefix?: string;
2845
- suffix?: string;
2846
- };
2847
-
2848
- type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
2849
-
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,
2857
- }
2858
-
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
2862
-
2863
- declare namespace stringify {
2864
- export function configure(options: StringifyOptions): typeof stringify
2865
- }
2866
-
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;
2918
- }
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
-
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;
2938
- }
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>);
2940
-
2941
2693
  interface CJSInteropOptions {
2942
2694
  addDefaultProperty?: boolean;
2943
2695
  }
@@ -2955,6 +2707,17 @@ type SingleTargetDesc = {
2955
2707
  src: string[] | string;
2956
2708
  };
2957
2709
 
2710
+ type DataUriPluginOptions = {
2711
+ exclude?: FilterPattern;
2712
+ include?: FilterPattern;
2713
+ srcset?: boolean;
2714
+ };
2715
+
2716
+ interface DebarrelPluginOptions {
2717
+ include?: FilterPattern;
2718
+ possibleBarrelFiles?: (RegExp | string)[];
2719
+ }
2720
+
2958
2721
  interface EsmShimCjsSyntaxOptions {
2959
2722
  exclude?: FilterPattern;
2960
2723
  include?: FilterPattern;
@@ -2978,11 +2741,114 @@ interface LicenseOptions {
2978
2741
  path?: string;
2979
2742
  }
2980
2743
 
2744
+ interface Template {
2745
+ parts: TemplatePart[];
2746
+ tag?: string;
2747
+ }
2748
+ interface TemplatePart {
2749
+ end: number;
2750
+ start: number;
2751
+ text: string;
2752
+ }
2753
+ interface Strategy$1<N = unknown> {
2754
+ getRootNode: (source: string, fileName?: string) => N;
2755
+ getTaggedTemplateTemplate: (node: N) => unknown;
2756
+ getTagText: (node: N) => string;
2757
+ getTemplateParts: (node: N) => TemplatePart[];
2758
+ isTaggedTemplate: (node: N) => boolean;
2759
+ isTemplate: (node: N) => boolean;
2760
+ walkNodes: (parent: N, visit: (child: N) => void) => void;
2761
+ }
2762
+
2763
+ interface ParseLiteralsOptions {
2764
+ fileName?: string;
2765
+ strategy?: Partial<Strategy$1<unknown>>;
2766
+ }
2767
+ declare const parseLiterals: (source: string, options?: ParseLiteralsOptions) => Template[];
2768
+
2769
+ interface Strategy<O = unknown, C = unknown> {
2770
+ combineHTMLStrings: (parts: TemplatePart[], placeholder: string) => string;
2771
+ getPlaceholder: (parts: TemplatePart[]) => string;
2772
+ minifyCSS?: (css: string, options?: C) => string;
2773
+ minifyHTML: (html: string, options?: O) => string | Promise<string>;
2774
+ splitHTMLByPlaceholder: (html: string, placeholder: string) => string[];
2775
+ }
2776
+ declare const defaultMinifyOptions: MinifierOptions;
2777
+
2778
+ type Options$3 = DefaultOptions | CustomOptions<unknown>;
2779
+ interface DefaultOptions extends BaseOptions {
2780
+ minifyOptions?: Partial<typeof defaultMinifyOptions>;
2781
+ }
2782
+ interface CustomOptions<S extends Strategy | unknown> extends BaseOptions {
2783
+ minifyOptions?: S extends Strategy<infer O> ? Partial<O> : never;
2784
+ strategy: S;
2785
+ }
2786
+ interface BaseOptions {
2787
+ fileName?: string;
2788
+ generateSourceMap?: ((ms: MagicStringLike, fileName: string) => SourceMap | undefined) | false;
2789
+ MagicString?: new (source: string) => MagicStringLike;
2790
+ parseLiterals?: typeof parseLiterals;
2791
+ parseLiteralsOptions?: Partial<ParseLiteralsOptions>;
2792
+ shouldMinify?: (template: Template) => boolean;
2793
+ shouldMinifyCSS?: (template: Template) => boolean;
2794
+ validate?: Validation | false;
2795
+ }
2796
+ interface MagicStringLike {
2797
+ generateMap: (options?: Partial<SourceMapOptions>) => SourceMap;
2798
+ overwrite: (start: number, end: number, content: string) => unknown;
2799
+ toString: () => string;
2800
+ }
2801
+ interface SourceMap {
2802
+ file?: string;
2803
+ mappings: string;
2804
+ names: string[];
2805
+ sources: string[];
2806
+ sourcesContent?: string[];
2807
+ toString: () => string;
2808
+ toUrl: () => string;
2809
+ version: number;
2810
+ }
2811
+ interface Validation {
2812
+ ensureHTMLPartsValid: (parts: TemplatePart[], htmlParts: string[]) => void;
2813
+ ensurePlaceholderValid: (placeholder: unknown) => void;
2814
+ }
2815
+ interface Result {
2816
+ code: string;
2817
+ map: SourceMap | undefined;
2818
+ }
2819
+ declare function minifyHTMLLiterals(source: string, options?: DefaultOptions): Promise<Result | null>;
2820
+ declare function minifyHTMLLiterals<S extends Strategy>(source: string, options?: CustomOptions<S>): Promise<Result | null>;
2821
+
2822
+ interface MinifyHTMLLiteralsOptions {
2823
+ exclude?: FilterPattern;
2824
+ failOnError?: boolean;
2825
+ include?: FilterPattern;
2826
+ minifyHTMLLiterals?: typeof minifyHTMLLiterals;
2827
+ options?: Partial<Options$3>;
2828
+ }
2829
+
2830
+ interface NativeModulesOptions {
2831
+ nativesDirectory?: string;
2832
+ }
2833
+
2981
2834
  interface RawLoaderOptions {
2982
2835
  exclude?: FilterPattern;
2983
2836
  include?: FilterPattern;
2984
2837
  }
2985
2838
 
2839
+ type Awaitable<T> = T | Promise<T>;
2840
+ type TransformFunction = (id: string, importer: string, rollupResolve: (id: string, importer?: string) => Promise<{
2841
+ id: string;
2842
+ }>) => Awaitable<boolean | undefined | void>;
2843
+ interface Options$2 {
2844
+ builtinNodeModules?: boolean;
2845
+ cwd?: string;
2846
+ exclude?: FilterPattern;
2847
+ include?: FilterPattern;
2848
+ order?: "pre" | "post" | undefined;
2849
+ shouldTransform?: string[] | TransformFunction;
2850
+ }
2851
+
2986
2852
  type ShebangOptions = {
2987
2853
  replace: boolean;
2988
2854
  shebang: string;
@@ -3006,7 +2872,7 @@ interface UrlOptions {
3006
2872
 
3007
2873
  type MarkOptional<Type, Keys extends keyof Type> = Type extends Type ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
3008
2874
  type EsbuildPluginConfig = Options$1 & {
3009
- logger: PailServerType;
2875
+ logger: Console;
3010
2876
  };
3011
2877
  type OptimizeDepsOptions = {
3012
2878
  cwd: string;
@@ -3036,7 +2902,7 @@ type OxcResolveOptions = Omit<NapiResolveOptions, "tsconfig"> & {
3036
2902
  ignoreSideEffectsForRoot?: boolean;
3037
2903
  };
3038
2904
 
3039
- interface SucrasePluginConfig extends Options$3 {
2905
+ interface SucrasePluginConfig extends Options$5 {
3040
2906
  exclude?: FilterPattern;
3041
2907
  include?: FilterPattern;
3042
2908
  }
@@ -3523,7 +3389,7 @@ interface Options extends Config {
3523
3389
  */
3524
3390
  sourceRoot?: string;
3525
3391
  plugin?: Plugin;
3526
- isModule?: boolean | "unknown";
3392
+ isModule?: boolean | "unknown" | "commonjs";
3527
3393
  /**
3528
3394
  * Destination path. Note that this value is used only to fix source path
3529
3395
  * of source map files and swc does not write output to this path.
@@ -3766,7 +3632,7 @@ interface EsParserConfig {
3766
3632
  */
3767
3633
  importAssertions?: boolean;
3768
3634
  /**
3769
- * Defaults to `false`
3635
+ * @deprecated Always true in swc
3770
3636
  */
3771
3637
  importAttributes?: boolean;
3772
3638
  /**
@@ -3820,6 +3686,7 @@ interface TransformConfig {
3820
3686
  * https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
3821
3687
  */
3822
3688
  verbatimModuleSyntax?: boolean;
3689
+ tsEnumIsMutable?: boolean;
3823
3690
  }
3824
3691
  interface ReactConfig {
3825
3692
  /**
@@ -3880,11 +3747,20 @@ interface ReactConfig {
3880
3747
  emitFullSignatures?: boolean;
3881
3748
  };
3882
3749
  /**
3883
- * jsx runtime
3750
+ * Decides which runtime to use when transforming JSX.
3751
+ * - `"automatic"` - Automatically imports the functions that JSX transpiles to.
3752
+ * This is the modern approach introduced in React 17+ that eliminates the need to
3753
+ * manually import React in every file that uses JSX.
3754
+ * - `"classic"` - Uses the traditional JSX transform that relies on `React.createElement`
3755
+ * calls. Requires React to be in scope, which was the standard behavior before React 17.
3756
+ * - `"preserve"` - Leaves JSX syntax unchanged without transforming it.
3757
+ * @default "classic"
3884
3758
  */
3885
- runtime?: "automatic" | "classic";
3759
+ runtime?: "automatic" | "classic" | "preserve";
3886
3760
  /**
3887
- * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic'
3761
+ * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory
3762
+ * functions when using `runtime` 'automatic'
3763
+ * @default "react"
3888
3764
  */
3889
3765
  importSource?: string;
3890
3766
  }
@@ -5175,7 +5051,9 @@ interface PackemRollupOptions {
5175
5051
  cjsInterop?: CJSInteropOptions;
5176
5052
  commonjs: RollupCommonJSOptions | false;
5177
5053
  copy?: CopyPluginOptions | false;
5178
- dts: Options$2;
5054
+ dataUri?: DataUriPluginOptions | false;
5055
+ debarrel?: DebarrelPluginOptions | false;
5056
+ dts: Options$4;
5179
5057
  dynamicVars?: RollupDynamicImportVariablesOptions | false;
5180
5058
  esbuild?: Options$1 | false;
5181
5059
  experimental?: {
@@ -5186,6 +5064,8 @@ interface PackemRollupOptions {
5186
5064
  jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
5187
5065
  license?: LicenseOptions | false;
5188
5066
  metafile?: boolean;
5067
+ minifyHTMLLiterals?: MinifyHTMLLiteralsOptions | false;
5068
+ nativeModules?: NativeModulesOptions | false;
5189
5069
  output?: OutputOptions;
5190
5070
  oxc?: Omit<OXCTransformPluginConfig, "cwd" | "sourcemap" | "target"> | false;
5191
5071
  patchTypes: PatchTypesOptions | false;
@@ -5199,7 +5079,8 @@ interface PackemRollupOptions {
5199
5079
  };
5200
5080
  preserveDynamicImports?: boolean;
5201
5081
  raw?: RawLoaderOptions | false;
5202
- replace: RollupReplaceOptions | false;
5082
+ replace: Omit<RollupReplaceOptions, "cwd"> | false;
5083
+ requireCJS?: Options$2 | false;
5203
5084
  resolve: RollupNodeResolveOptions | false;
5204
5085
  shebang?: Partial<ShebangOptions> | false;
5205
5086
  shim?: EsmShimCjsSyntaxOptions | false;
@@ -5224,4 +5105,4 @@ type TransformerFn = ((config: EsbuildPluginConfig | InternalOXCTransformPluginC
5224
5105
  type TransformerName = "esbuild" | "oxc" | "sucrase" | "swc";
5225
5106
 
5226
5107
  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 };
5108
+ 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 };