@visulima/packem-rollup 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (46) hide show
  1. package/CHANGELOG.md +200 -0
  2. package/README.md +89 -2
  3. package/dist/index.d.mts +7 -4
  4. package/dist/index.d.ts +7 -4
  5. package/dist/index.mjs +1 -1
  6. package/dist/packem_shared/cachingPlugin-TWoY5ZxV.mjs +1 -0
  7. package/dist/packem_shared/dataUriPlugin-BFb7bZZs.mjs +1 -0
  8. package/dist/packem_shared/debarrelPlugin-BTYc859G.mjs +2 -0
  9. package/dist/packem_shared/esbuildPlugin-BrFhdKJk.mjs +1 -0
  10. package/dist/packem_shared/index-QEzU3Fey.mjs +1 -0
  11. package/dist/packem_shared/index.server.d-DhMawQMd.d.mts +251 -0
  12. package/dist/packem_shared/index.server.d-DhMawQMd.d.ts +251 -0
  13. package/dist/packem_shared/isolatedDeclarationsPlugin-B34s_qkE.mjs +3 -0
  14. package/dist/packem_shared/{metafilePlugin-ObS4J7mO.mjs → metafilePlugin-CVcqFpPJ.mjs} +1 -1
  15. package/dist/packem_shared/nativeModulesPlugin-D6lO-8g6.mjs +1 -0
  16. package/dist/packem_shared/rawPlugin-DgRj14Xy.mjs +6 -0
  17. package/dist/packem_shared/requireCJSTransformerPlugin-BZ49I4kw.mjs +11 -0
  18. package/dist/packem_shared/resolveTsconfigPathsPlugin-pUcTdE77.mjs +1 -0
  19. package/dist/packem_shared/{index-IiwweiIe.d.mts → types-BK7k04DQ.d.mts} +2697 -2898
  20. package/dist/packem_shared/{index-IiwweiIe.d.ts → types-DvaEike_.d.ts} +2697 -2898
  21. package/dist/packem_shared/urlPlugin-DJJrDWjj.mjs +1 -0
  22. package/dist/plugins/esbuild/index.d.mts +6 -4
  23. package/dist/plugins/esbuild/index.d.ts +6 -4
  24. package/dist/plugins/esbuild/index.mjs +1 -1
  25. package/dist/plugins/minify-html-literals/index.d.mts +98 -0
  26. package/dist/plugins/minify-html-literals/index.d.ts +79 -0
  27. package/dist/plugins/minify-html-literals/index.mjs +3 -0
  28. package/dist/plugins/oxc/index.d.mts +8 -6
  29. package/dist/plugins/oxc/index.d.ts +8 -6
  30. package/dist/plugins/oxc/index.mjs +1 -1
  31. package/dist/plugins/sucrase/index.d.mts +4 -2
  32. package/dist/plugins/sucrase/index.d.ts +4 -2
  33. package/dist/plugins/swc/index.d.mts +8 -6
  34. package/dist/plugins/swc/index.d.ts +8 -6
  35. package/dist/plugins/swc/index.mjs +1 -1
  36. package/dist/plugins/typescript/index.d.mts +5 -3
  37. package/dist/plugins/typescript/index.d.ts +5 -3
  38. package/dist/plugins/typescript/index.mjs +1 -1
  39. package/package.json +128 -175
  40. package/dist/packem_shared/cachingPlugin-D0BBFJPD.mjs +0 -1
  41. package/dist/packem_shared/esbuildPlugin-BAwyhG6L.mjs +0 -1
  42. package/dist/packem_shared/isolatedDeclarationsPlugin-BqP17nSP.mjs +0 -3
  43. package/dist/packem_shared/rawPlugin-BqlR6ZOI.mjs +0 -1
  44. package/dist/packem_shared/resolveTsconfigPathsPlugin-Crf4lzxq.mjs +0 -1
  45. package/dist/packem_shared/urlPlugin-DBgFIkTc.mjs +0 -1
  46. /package/dist/packem_shared/{resolveFileUrl-BkpjVHeK.mjs → resolveFileUrlPlugin-BkpjVHeK.mjs} +0 -0
@@ -0,0 +1,251 @@
1
+ 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";
2
+
3
+ /**
4
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
5
+
6
+ @category Type
7
+ */
8
+ type Primitive =
9
+ | null
10
+ | undefined
11
+ | string
12
+ | number
13
+ | boolean
14
+ | symbol
15
+ | bigint;
16
+
17
+ declare global {
18
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
19
+ interface SymbolConstructor {
20
+ readonly observable: symbol;
21
+ }
22
+ }
23
+
24
+ /**
25
+ 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.
26
+
27
+ 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.
28
+
29
+ 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.
30
+
31
+ @example
32
+ ```
33
+ import type {LiteralUnion} from 'type-fest';
34
+
35
+ // Before
36
+
37
+ type Pet = 'dog' | 'cat' | string;
38
+
39
+ const pet: Pet = '';
40
+ // Start typing in your TypeScript-enabled IDE.
41
+ // You **will not** get auto-completion for `dog` and `cat` literals.
42
+
43
+ // After
44
+
45
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
46
+
47
+ const pet: Pet2 = '';
48
+ // You **will** get auto-completion for `dog` and `cat` literals.
49
+ ```
50
+
51
+ @category Type
52
+ */
53
+ type LiteralUnion<
54
+ LiteralType,
55
+ BaseType extends Primitive,
56
+ > = LiteralType | (BaseType & Record<never, never>);
57
+
58
+ declare class InteractiveStreamHook {
59
+ #private;
60
+ static readonly DRAIN = true;
61
+ constructor(stream: NodeJS.WriteStream);
62
+ active(): void;
63
+ erase(count: number): void;
64
+ inactive(separateHistory?: boolean): void;
65
+ renew(): void;
66
+ write(message: string): void;
67
+ }
68
+
69
+ type StreamType = "stderr" | "stdout";
70
+ declare class InteractiveManager {
71
+ #private;
72
+ constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
73
+ get lastLength(): number;
74
+ get outside(): number;
75
+ get isHooked(): boolean;
76
+ get isSuspended(): boolean;
77
+ erase(stream: StreamType, count?: number): void;
78
+ hook(): boolean;
79
+ resume(stream: StreamType, eraseRowCount?: number): void;
80
+ suspend(stream: StreamType, erase?: boolean): void;
81
+ unhook(separateHistory?: boolean): boolean;
82
+ update(stream: StreamType, rows: string[], from?: number): void;
83
+ private _clear;
84
+ }
85
+
86
+ declare global {
87
+ namespace VisulimaPail {
88
+ interface CustomMeta<L> {
89
+ }
90
+ }
91
+ }
92
+ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
93
+ badge: string | undefined;
94
+ context: any[] | undefined;
95
+ date: Date | string;
96
+ error: Error | undefined;
97
+ groups: string[];
98
+ label: string | undefined;
99
+ message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
100
+ prefix: string | undefined;
101
+ repeated?: number | undefined;
102
+ scope: string[] | undefined;
103
+ suffix: string | undefined;
104
+ traceError: Error | undefined;
105
+ type: {
106
+ level: ExtendedRfc5424LogLevels | L;
107
+ name: string;
108
+ };
109
+ }
110
+ type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
111
+ type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
112
+ interface LoggerFunction {
113
+ (message: Message): void;
114
+ (...message: any[]): void;
115
+ }
116
+ interface LoggerConfiguration<L extends string> {
117
+ badge?: string;
118
+ color?: AnsiColors | undefined;
119
+ label: string;
120
+ logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
121
+ }
122
+ type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
123
+ type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
124
+ interface Reporter<L extends string> {
125
+ log: (meta: ReadonlyMeta<L>) => void;
126
+ }
127
+ interface Processor<L extends string> {
128
+ process: (meta: Meta<L>) => Meta<L>;
129
+ }
130
+ interface ConstructorOptions<T extends string, L extends string> {
131
+ disabled?: boolean;
132
+ logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
133
+ logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
134
+ messages?: {
135
+ timerEnd?: string;
136
+ timerStart?: string;
137
+ };
138
+ processors?: Processor<L>[];
139
+ rawReporter?: Reporter<L>;
140
+ reporters?: Reporter<L>[];
141
+ scope?: string[] | string;
142
+ throttle?: number;
143
+ throttleMin?: number;
144
+ types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
145
+ }
146
+ interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
147
+ interactive?: boolean;
148
+ stderr: NodeJS.WriteStream;
149
+ stdout: NodeJS.WriteStream;
150
+ }
151
+ type Message = {
152
+ context?: any[] | undefined;
153
+ message: any;
154
+ prefix?: string;
155
+ suffix?: string;
156
+ };
157
+
158
+ type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
159
+
160
+ interface StringifyOptions {
161
+ bigint?: boolean,
162
+ circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
163
+ deterministic?: boolean | ((a: string, b: string) => number),
164
+ maximumBreadth?: number,
165
+ maximumDepth?: number,
166
+ strict?: boolean,
167
+ }
168
+
169
+ declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
170
+ declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
171
+ declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
172
+
173
+ declare namespace stringify {
174
+ export function configure(options: StringifyOptions): typeof stringify
175
+ }
176
+
177
+ declare class PailBrowserImpl<T extends string = string, L extends string = string> {
178
+ protected timersMap: Map<string, number>;
179
+ protected countMap: Map<string, number>;
180
+ protected seqTimers: Set<string>;
181
+ protected readonly lastLog: {
182
+ count?: number;
183
+ object?: Meta<L>;
184
+ serialized?: string;
185
+ time?: Date;
186
+ timeout?: ReturnType<typeof setTimeout>;
187
+ };
188
+ protected readonly logLevels: Record<string, number>;
189
+ protected disabled: boolean;
190
+ protected scopeName: string[];
191
+ protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
192
+ protected readonly longestLabel: string;
193
+ protected readonly processors: Set<Processor<L>>;
194
+ protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
195
+ protected reporters: Set<Reporter<L>>;
196
+ protected readonly throttle: number;
197
+ protected readonly throttleMin: number;
198
+ protected readonly stringify: typeof stringify;
199
+ protected groups: string[];
200
+ protected readonly startTimerMessage: string;
201
+ protected readonly endTimerMessage: string;
202
+ protected rawReporter: Reporter<L>;
203
+ constructor(options: ConstructorOptions<T, L>);
204
+ wrapConsole(): void;
205
+ restoreConsole(): void;
206
+ wrapException(): void;
207
+ disable(): void;
208
+ enable(): void;
209
+ isEnabled(): boolean;
210
+ scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
211
+ unscope(): void;
212
+ time(label?: string): void;
213
+ timeLog(label?: string, ...data: unknown[]): void;
214
+ timeEnd(label?: string): void;
215
+ group(label?: string): void;
216
+ groupEnd(): void;
217
+ count(label?: string): void;
218
+ countReset(label?: string): void;
219
+ clear(): void;
220
+ raw(message: string, ...arguments_: unknown[]): void;
221
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
222
+ protected registerReporters(reporters: Reporter<L>[]): void;
223
+ private _report;
224
+ private registerProcessors;
225
+ private _normalizeLogLevel;
226
+ private _buildMeta;
227
+ private _logger;
228
+ }
229
+ 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>);
230
+
231
+ declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
232
+ readonly options: ServerConstructorOptions<T, L>;
233
+ protected readonly stdout: NodeJS.WriteStream;
234
+ protected readonly stderr: NodeJS.WriteStream;
235
+ protected interactiveManager: InteractiveManager | undefined;
236
+ protected readonly interactive: boolean;
237
+ constructor(options: ServerConstructorOptions<T, L>);
238
+ scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
239
+ getInteractiveManager(): InteractiveManager | undefined;
240
+ wrapStd(): void;
241
+ restoreStd(): void;
242
+ wrapAll(): void;
243
+ restoreAll(): void;
244
+ clear(): void;
245
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
246
+ private _wrapStream;
247
+ private _restoreStream;
248
+ }
249
+ 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>);
250
+
251
+ export type { PailServerType as P };
@@ -0,0 +1,251 @@
1
+ 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";
2
+
3
+ /**
4
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
5
+
6
+ @category Type
7
+ */
8
+ type Primitive =
9
+ | null
10
+ | undefined
11
+ | string
12
+ | number
13
+ | boolean
14
+ | symbol
15
+ | bigint;
16
+
17
+ declare global {
18
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
19
+ interface SymbolConstructor {
20
+ readonly observable: symbol;
21
+ }
22
+ }
23
+
24
+ /**
25
+ 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.
26
+
27
+ 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.
28
+
29
+ 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.
30
+
31
+ @example
32
+ ```
33
+ import type {LiteralUnion} from 'type-fest';
34
+
35
+ // Before
36
+
37
+ type Pet = 'dog' | 'cat' | string;
38
+
39
+ const pet: Pet = '';
40
+ // Start typing in your TypeScript-enabled IDE.
41
+ // You **will not** get auto-completion for `dog` and `cat` literals.
42
+
43
+ // After
44
+
45
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
46
+
47
+ const pet: Pet2 = '';
48
+ // You **will** get auto-completion for `dog` and `cat` literals.
49
+ ```
50
+
51
+ @category Type
52
+ */
53
+ type LiteralUnion<
54
+ LiteralType,
55
+ BaseType extends Primitive,
56
+ > = LiteralType | (BaseType & Record<never, never>);
57
+
58
+ declare class InteractiveStreamHook {
59
+ #private;
60
+ static readonly DRAIN = true;
61
+ constructor(stream: NodeJS.WriteStream);
62
+ active(): void;
63
+ erase(count: number): void;
64
+ inactive(separateHistory?: boolean): void;
65
+ renew(): void;
66
+ write(message: string): void;
67
+ }
68
+
69
+ type StreamType = "stderr" | "stdout";
70
+ declare class InteractiveManager {
71
+ #private;
72
+ constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
73
+ get lastLength(): number;
74
+ get outside(): number;
75
+ get isHooked(): boolean;
76
+ get isSuspended(): boolean;
77
+ erase(stream: StreamType, count?: number): void;
78
+ hook(): boolean;
79
+ resume(stream: StreamType, eraseRowCount?: number): void;
80
+ suspend(stream: StreamType, erase?: boolean): void;
81
+ unhook(separateHistory?: boolean): boolean;
82
+ update(stream: StreamType, rows: string[], from?: number): void;
83
+ private _clear;
84
+ }
85
+
86
+ declare global {
87
+ namespace VisulimaPail {
88
+ interface CustomMeta<L> {
89
+ }
90
+ }
91
+ }
92
+ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
93
+ badge: string | undefined;
94
+ context: any[] | undefined;
95
+ date: Date | string;
96
+ error: Error | undefined;
97
+ groups: string[];
98
+ label: string | undefined;
99
+ message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
100
+ prefix: string | undefined;
101
+ repeated?: number | undefined;
102
+ scope: string[] | undefined;
103
+ suffix: string | undefined;
104
+ traceError: Error | undefined;
105
+ type: {
106
+ level: ExtendedRfc5424LogLevels | L;
107
+ name: string;
108
+ };
109
+ }
110
+ type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
111
+ type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
112
+ interface LoggerFunction {
113
+ (message: Message): void;
114
+ (...message: any[]): void;
115
+ }
116
+ interface LoggerConfiguration<L extends string> {
117
+ badge?: string;
118
+ color?: AnsiColors | undefined;
119
+ label: string;
120
+ logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
121
+ }
122
+ type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
123
+ type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
124
+ interface Reporter<L extends string> {
125
+ log: (meta: ReadonlyMeta<L>) => void;
126
+ }
127
+ interface Processor<L extends string> {
128
+ process: (meta: Meta<L>) => Meta<L>;
129
+ }
130
+ interface ConstructorOptions<T extends string, L extends string> {
131
+ disabled?: boolean;
132
+ logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
133
+ logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
134
+ messages?: {
135
+ timerEnd?: string;
136
+ timerStart?: string;
137
+ };
138
+ processors?: Processor<L>[];
139
+ rawReporter?: Reporter<L>;
140
+ reporters?: Reporter<L>[];
141
+ scope?: string[] | string;
142
+ throttle?: number;
143
+ throttleMin?: number;
144
+ types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
145
+ }
146
+ interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
147
+ interactive?: boolean;
148
+ stderr: NodeJS.WriteStream;
149
+ stdout: NodeJS.WriteStream;
150
+ }
151
+ type Message = {
152
+ context?: any[] | undefined;
153
+ message: any;
154
+ prefix?: string;
155
+ suffix?: string;
156
+ };
157
+
158
+ type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
159
+
160
+ interface StringifyOptions {
161
+ bigint?: boolean,
162
+ circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
163
+ deterministic?: boolean | ((a: string, b: string) => number),
164
+ maximumBreadth?: number,
165
+ maximumDepth?: number,
166
+ strict?: boolean,
167
+ }
168
+
169
+ declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
170
+ declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
171
+ declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
172
+
173
+ declare namespace stringify {
174
+ export function configure(options: StringifyOptions): typeof stringify
175
+ }
176
+
177
+ declare class PailBrowserImpl<T extends string = string, L extends string = string> {
178
+ protected timersMap: Map<string, number>;
179
+ protected countMap: Map<string, number>;
180
+ protected seqTimers: Set<string>;
181
+ protected readonly lastLog: {
182
+ count?: number;
183
+ object?: Meta<L>;
184
+ serialized?: string;
185
+ time?: Date;
186
+ timeout?: ReturnType<typeof setTimeout>;
187
+ };
188
+ protected readonly logLevels: Record<string, number>;
189
+ protected disabled: boolean;
190
+ protected scopeName: string[];
191
+ protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
192
+ protected readonly longestLabel: string;
193
+ protected readonly processors: Set<Processor<L>>;
194
+ protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
195
+ protected reporters: Set<Reporter<L>>;
196
+ protected readonly throttle: number;
197
+ protected readonly throttleMin: number;
198
+ protected readonly stringify: typeof stringify;
199
+ protected groups: string[];
200
+ protected readonly startTimerMessage: string;
201
+ protected readonly endTimerMessage: string;
202
+ protected rawReporter: Reporter<L>;
203
+ constructor(options: ConstructorOptions<T, L>);
204
+ wrapConsole(): void;
205
+ restoreConsole(): void;
206
+ wrapException(): void;
207
+ disable(): void;
208
+ enable(): void;
209
+ isEnabled(): boolean;
210
+ scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
211
+ unscope(): void;
212
+ time(label?: string): void;
213
+ timeLog(label?: string, ...data: unknown[]): void;
214
+ timeEnd(label?: string): void;
215
+ group(label?: string): void;
216
+ groupEnd(): void;
217
+ count(label?: string): void;
218
+ countReset(label?: string): void;
219
+ clear(): void;
220
+ raw(message: string, ...arguments_: unknown[]): void;
221
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
222
+ protected registerReporters(reporters: Reporter<L>[]): void;
223
+ private _report;
224
+ private registerProcessors;
225
+ private _normalizeLogLevel;
226
+ private _buildMeta;
227
+ private _logger;
228
+ }
229
+ 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>);
230
+
231
+ declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
232
+ readonly options: ServerConstructorOptions<T, L>;
233
+ protected readonly stdout: NodeJS.WriteStream;
234
+ protected readonly stderr: NodeJS.WriteStream;
235
+ protected interactiveManager: InteractiveManager | undefined;
236
+ protected readonly interactive: boolean;
237
+ constructor(options: ServerConstructorOptions<T, L>);
238
+ scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
239
+ getInteractiveManager(): InteractiveManager | undefined;
240
+ wrapStd(): void;
241
+ restoreStd(): void;
242
+ wrapAll(): void;
243
+ restoreAll(): void;
244
+ clear(): void;
245
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
246
+ private _wrapStream;
247
+ private _restoreStream;
248
+ }
249
+ 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>);
250
+
251
+ export type { PailServerType as P };
@@ -0,0 +1,3 @@
1
+ var M=Object.defineProperty;var $=(t,e)=>M(t,"name",{value:e,configurable:!0});import{createFilter as T}from"@rollup/pluginutils";import{readFile as G}from"@visulima/fs";import{ENDING_REGEX as O}from"@visulima/packem-share/constants";import{getDtsExtension as U}from"@visulima/packem-share/utils";import{dirname as I,toNamespacedPath as w,sep as D,extname as _,join as W,basename as F,relative as C}from"@visulima/path";import{parseAsync as J}from"oxc-parser";import{_ as L}from"./fix-dts-default-cjs-exports-BQc0nwIG.mjs";var X=Object.defineProperty,q=$((t,e)=>X(t,"name",{value:e,configurable:!0}),"e");const A=/^([\w-]+):/,P=q(t=>{if(!t||typeof t!="string")throw new Error("Invalid key: Key must be a non-empty string.");const e=[],c=A.exec(t);c&&(e.push(c[1]),t=t.replace(A,""));const a=t.split("/");for(const l of a)(l.includes("*")||l)&&e.push(l);return e},"splitTsconfigPathKey");var z=Object.defineProperty,B=$((t,e)=>z(t,"name",{value:e,configurable:!0}),"h");const H=B((t,e)=>{const c=t.replace(/^\.\//,""),a=e.replace(/^\.\//,"");if(a.startsWith(c))return t+a.slice(c.length);if(t.endsWith(e))return t;const l=P(t),d=P(e);let p=l.length-1,r=d.length-1;for(;p>=0&&r>=0&&l[p]===d[r];)p--,r--;let n=l.slice(0,p).join("/");const m=d.slice(r).join("/");return(!n.startsWith(".")||n==="")&&(n=`./${n}`),n+(m?`/${m}`:"")},"extendString");var Q=Object.defineProperty,V=$((t,e)=>Q(t,"name",{value:e,configurable:!0}),"s");const Y=V((...t)=>{if(t.length===0)return"";if(t.length===1)return I(t[0]);t=t.map(l=>w(l).split(D).join("/"));const[e,...c]=t;let a=e.split("/");for(const l of c){const d=l.split("/",a.length);let p=0;for(const r of d)if(r===a[p])p+=1;else{a=a.slice(0,p);break}a=a.slice(0,p)}return(a.length<=1&&a[0]===""?`/${a[0]}`:a.join("/")).split("/").join(D)},"lowestCommonAncestor");var Z=Object.defineProperty,x=$((t,e)=>Z(t,"name",{value:e,configurable:!0}),"u");const K=x((t,e)=>`${t}
2
+ //# sourceMappingURL=${F(e)}.map
3
+ `,"appendMapUrl"),k=x((t,e,c)=>JSON.stringify({file:F(c),mappings:t,names:[],sourceRoot:"",sources:[C(I(c),e)],version:3}),"generateDtsMap"),ce=x((t,e)=>{const c=T(e.options.include,e.options.exclude);let a=Object.create(null);const l=x((r,n)=>{a[r.replace(O,"")]={...n,ext:_(r)}},"addOutput");let d=[];e.tsconfig?.config.compilerOptions&&(d=Object.entries(e.tsconfig.config.compilerOptions.paths??{}).map(([r])=>r.endsWith("*")?new RegExp(`^${r.replace("*","(.*)")}$`):new RegExp(`^${r}$`)));async function p(r,n){if(!c(n))return;let m;try{m=(await J(n,r)).program}catch(o){e.logger.debug({message:o.message,prefix:"packem:isolated-declarations"})}if(m){const o=m.body.filter(s=>(s.type==="ImportDeclaration"||s.type==="ExportAllDeclaration"||s.type==="ExportNamedDeclaration")&&s.source);for await(const s of o){if(F(s.source.value).includes("."))continue;const i=await this.resolve(s.source.value,n);if(!(!i||i.external)&&(i.id.endsWith(".ts")||i.id.endsWith(".cts")||i.id.endsWith(".mts")||i.id.endsWith(".tsx")||i.id.endsWith(".ctsx")||i.id.endsWith(".mtsx"))){const g=i.id.replace(`${t}/`,"");let j=s.source.value;d.some(f=>f.test(s.source.value))&&!s.source.value.startsWith(".")&&(j=`./${s.source.value}`),r=r.replaceAll(`from "${s.source.value}"`,`from "${H(j,g)}"`)}}}const{errors:y,map:u,sourceText:v}=await e.options.isolatedDeclarationTransformer(n,r,e.options.sourcemap,e.tsconfig?.config?.compilerOptions);if(y.length>0){if(e.options.rollup.isolatedDeclarations.ignoreErrors){this.warn(y[0]);return}return this.error(y[0])}if(l(n,{map:u,source:v}),!m)return;const h=m.body.filter(o=>!("source"in o)||!o.source?!1:"importKind"in o&&o.importKind==="type"||"exportKind"in o&&o.exportKind==="type"?!0:o.type==="ImportDeclaration"?o.specifiers&&o.specifiers.every(s=>s.type==="ImportSpecifier"&&s.importKind==="type"):o.type==="ExportNamedDeclaration"&&o.specifiers&&o.specifiers.every(s=>s.exportKind==="type"));for await(const o of h){if(!o.source)continue;const s=await this.resolve(o.source.value,n);if(!s)return;const i=s.id;if(c(i)&&!a[i.replace(O,"")])try{const g=await G(i);await p.call(this,g,i)}catch{}}}return $(p,"E"),x(p,"transform"),{buildStart(){a=Object.create(null)},name:"packem:isolated-declarations",async renderStart(r,{input:n}){const m=Y(...Array.isArray(n)?n:Object.values(n));e.logger.debug({message:`Input base:${m}`,prefix:"packem:isolated-declarations"}),typeof r.entryFileNames=="function"&&(r.entryFileNames=r.entryFileNames({name:r.name}));const y=r.entryFileNames.replace(/\.(.)?[jt]sx?$/,(u,v)=>`.d.${v||""}ts`);for await(let[u,{ext:v,map:h,source:o}]of Object.entries(a)){if(e.options.rollup.cjsInterop&&r.format==="cjs"){const f=L(o,{fileName:u,imports:[]},{warn:this.warn});f&&(o=f.code)}const s=o.includes("from '")?"'":'"',i=u+v;if((e.options.declaration===!0||e.options.declaration==="compatible")&&r.format==="cjs"){e.logger.debug({message:`Emit compatible dts file: ${u}`,prefix:"packem:isolated-declarations"});const f=y.replace("[name]",w(u).replace(`${t}/`,"")).replace(".cts",".ts");let b=o;e.options.sourcemap&&h&&(b=K(b.trim(),f),this.emitFile({fileName:`${f}.map`,originalFileName:i,source:k(h,i,W(r.dir,f)),type:"asset"})),this.emitFile({fileName:f,originalFileName:i,source:b.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(E,N,R,S)=>`${N+s+(S||R)}.d.ts${s};`),type:"asset"})}e.logger.debug({message:`Emit dts file: ${u}`,prefix:"packem:isolated-declarations"});const g=y.replace("[name]",w(u).replace(`${t}/`,""));e.options.sourcemap&&h&&(o=K(o.trim(),g),this.emitFile({fileName:`${g}.map`,originalFileName:i,source:k(h,i,W(r.dir,g)),type:"asset"}));const j=U(e,r.format==="cjs"?"cjs":"esm");this.emitFile({fileName:g,originalFileName:i,source:o.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(f,b,E,N)=>`${b+s+(N||E)}.${j}${s};`),type:"asset"})}},transform:p}},"isolatedDeclarationsPlugin");export{ce as isolatedDeclarationsPlugin};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var a=(e,t)=>l(e,"name",{value:t,configurable:!0});import{ENDING_REGEX as f}from"@visulima/packem-share";var c=Object.defineProperty,u=a((e,t)=>c(e,"name",{value:t,configurable:!0}),"i");const g=u(()=>({async generateBundle(e,t){const r=[];for(const s of this.getModuleIds()){const o=this.getModuleInfo(s);if(o!=null&&!o.isExternal)for(const n of o.importedIds)r.push({source:s,target:n})}if(Array.isArray(r)&&r.length===0)return;const i=Object.keys(t);this.emitFile({fileName:`metafile-${i[0].replace(f,"")}-${e.format}.json`,source:JSON.stringify(r,void 0,2),type:"asset"})},name:"packem:metafile"}),"metafilePlugin");export{g as default};
1
+ var f=Object.defineProperty;var a=(e,t)=>f(e,"name",{value:t,configurable:!0});import{ENDING_REGEX as l}from"@visulima/packem-share";var c=Object.defineProperty,u=a((e,t)=>c(e,"name",{value:t,configurable:!0}),"o");const g=u(()=>({async generateBundle(e,t){const r=[];for(const s of this.getModuleIds()){const o=this.getModuleInfo(s);if(o!=null&&!o.isExternal)for(const n of o.importedIds)r.push({source:s,target:n})}if(Array.isArray(r)&&r.length===0)return;const i=Object.keys(t);this.emitFile({fileName:`metafile-${i[0].replace(l,"")}-${e.format}.json`,source:JSON.stringify(r,void 0,2),type:"asset"})},name:"packem:metafile"}),"metafilePlugin");export{g as default};
@@ -0,0 +1 @@
1
+ var $=Object.defineProperty;var m=(u,i)=>$(u,"name",{value:i,configurable:!0});import{copyFile as w}from"node:fs/promises";import{isAccessible as A,ensureDir as P}from"@visulima/fs";import{resolve as v,dirname as c,basename as f,extname as b,join as g}from"@visulima/path";var x=Object.defineProperty,y=m((u,i)=>x(u,"name",{value:i,configurable:!0}),"c");const d="\0natives:",q=y((u={})=>{const{nativesDirectory:i="natives"}=u,s=new Map;let o;return{buildStart(){s.clear()},generateBundle:y(async t=>{if(!o){const e=Array.isArray(t)?t[0]:t;e&&e.dir?o=e.dir:e&&e.file&&(o=c(e.file))}if(s.size===0)return;if(!o){(void 0).error("Output directory not detected. Please ensure Rollup output options are configured.");return}const r=g(o,i);await P(r),await Promise.all([...s.entries()].map(([e,n])=>{const a=g(r,n);return w(e,a)}))},"generateBundle"),load(t){if(!t.startsWith(d))return;const r=t.slice(d.length),e=s.get(r);if(e||this.error(`Could not find staged native module for: ${r}`),!o){const n=this;if(n&&n.meta&&n.meta.rollupVersion)return`export default require("./${i}/${e}");`;this.error("Output directory not detected. Please ensure Rollup output options are configured.")}return`export default require("${`./${i}/${e}`.replaceAll("\\","/")}");`},name:"native-modules",options(t){const r=t;if(r.output){const e=Array.isArray(r.output)?r.output[0]:r.output;e.dir?o=e.dir:e.file&&(o=c(e.file))}return t},async resolveId(t,r){if(t.startsWith(d)||!t.endsWith(".node"))return;const e=r?v(c(r),t):v(t);if(!await A(e)){this.warn(`Native module not found: ${e}`);return}const n=f(e);let a=n,p=1;const h=new Set([...s.values()].map(l=>f(l)));for(;h.has(a);){const l=b(n);a=`${f(n,l)}_${p}${l}`,p+=1}return s.set(e,a),d+e}}},"nativeModulesPlugin");export{q as nativeModulesPlugin};
@@ -0,0 +1,6 @@
1
+ var i=Object.defineProperty;var n=(r,a)=>i(r,"name",{value:a,configurable:!0});import{createFilter as s}from"@rollup/pluginutils";import{readFile as u}from"@visulima/fs";var p=Object.defineProperty,d=n((r,a)=>p(r,"name",{value:a,configurable:!0}),"a");const g=d(r=>{const a=s(r.include,r.exclude);return{async load(t){if(t.includes("?raw")){const e=t.split("?")[0];try{const l=await u(e);return process.platform==="win32"?l.replaceAll(`\r
2
+ `,`
3
+ `):l}catch{this.error(`Failed to read file: ${e}`)}}return null},name:"packem:raw",transform(t,e){const l=e.includes("?raw"),o=l?e.split("?")[0]:e;if(a(o)||l){const c=process.platform==="win32"?t.replaceAll(`\r
4
+ `,`
5
+ `):t;return{code:`const data = ${JSON.stringify(c)};
6
+ export default data;`,map:null}}return null}}},"rawPlugin");export{g as rawPlugin};
@@ -0,0 +1,11 @@
1
+ var F=Object.defineProperty;var y=(r,e)=>F(r,"name",{value:e,configurable:!0});import{createRequire as I,builtinModules as M}from"node:module";import R from"node:process";import{createFilter as W}from"@rollup/pluginutils";import{init as w,parse as G}from"cjs-module-lexer";import B from"magic-string";import{parseSync as D}from"oxc-parser";import{readFile as K}from"@visulima/fs";import{findPackageJson as E}from"@visulima/package/package-json";var L=Object.defineProperty,U=y((r,e)=>L(r,"name",{value:e,configurable:!0}),"s");const z=U(async(r,e,m)=>{if(await w(),r.startsWith("node:"))return!1;if(r.endsWith(".cjs"))return!0;if(r.endsWith(".js")||!r.includes("/")&&!r.startsWith(".")){let o;if(m)try{o=(await m(r,e)).id}catch{}if(!o&&e&&!e.includes("!~{"))try{o=I(e).resolve(r)}catch{}if(o){try{const{packageJson:f}=await E(o);if(f.type==="module")return!1;if(f.type==="commonjs")return!0}catch{}try{const f=await K(o,{encoding:"utf8"});try{return G(f,o),!0}catch{}}catch{}}}return!1},"isPureCJS");var H=Object.defineProperty,N=y((r,e)=>H(r,"name",{value:e,configurable:!0}),"j");let _=!1;const q="__cjs_require",Q=N(r=>{if(Array.isArray(r.shouldTransform)){const{shouldTransform:e}=r;r.shouldTransform=m=>e.includes(m)}return{builtinNodeModules:!!r.builtinNodeModules,cwd:r.cwd||R.cwd(),exclude:r.exclude||[/node_modules/,/\.d\.[cm]?ts$/],include:r.include||[/\.[cm]?[jt]sx?$/],order:"order"in r?r.order:"pre",shouldTransform:r.shouldTransform}},"resolveOptions"),ne=N((r,e)=>{const{builtinNodeModules:m,cwd:o,exclude:f,include:J,order:P,shouldTransform:A}=Q(r),k=W(J,f);return{async buildStart(){_||(await w(),_=!0)},name:"packem:plugin-require-cjs",renderChunk:{async handler(a,g,{format:O}){if(O!=="es"){e.debug({message:"skip",prefix:"plugin:require-cjs-transformer"});return}if(!k(g.fileName)){e.debug({message:`Skipping file (excluded by filter): ${g.fileName}`,prefix:"plugin:require-cjs-transformer"});return}e.debug({message:`Processing chunk: ${g.fileName}`,prefix:"plugin:require-cjs-transformer"}),e.debug({message:`Code length: ${a.length} characters`,prefix:"plugin:require-cjs-transformer"});const C=D(g.fileName,a,{astType:"js",lang:"js",sourceType:"module"}),{body:S}=C.program,l=new B(a);let h=!1;e.debug({message:`Found ${S.length} AST statements to process`,prefix:"plugin:require-cjs-transformer"});for await(const i of S)if(i.type==="ImportDeclaration"){if(i.importKind==="type"){e.debug({message:`Skipping type-only import: ${i.source.value}`,prefix:"plugin:require-cjs-transformer"});continue}const s=i.source.value;e.debug({message:`Processing import: ${s}`,prefix:"plugin:require-cjs-transformer"});const b=m&&(M.includes(s)||s.startsWith("node:"));e.debug({message:`Is builtin module: ${b}`,prefix:"plugin:require-cjs-transformer"});let $;if(b)$=!0,e.debug({message:"Processing as builtin module",prefix:"plugin:require-cjs-transformer"});else{const t=A?.(s,o,this?.resolveId);if(e.debug({message:`shouldTransform result: ${t}`,prefix:"plugin:require-cjs-transformer"}),t===void 0){const u=await z(s,o,this.resolveId?.bind(this));$=u,e.debug({message:`isPureCJS result: ${u}`,prefix:"plugin:require-cjs-transformer"})}else $=t,e.debug({message:`Using shouldTransform result: ${$}`,prefix:"plugin:require-cjs-transformer"})}if(!$){e.debug({message:`Skipping import (not a CJS module): ${s}`,prefix:"plugin:require-cjs-transformer"});continue}if(i.specifiers.length===0){b?(e.debug({message:`Transforming side-effect builtin import to removal: ${s}`,prefix:"plugin:require-cjs-transformer"}),l.remove(i.start,i.end)):(e.debug({message:`Transforming side-effect import to require call: ${s} -> ${q}(${JSON.stringify(s)})`,prefix:"plugin:require-cjs-transformer"}),l.overwrite(i.start,i.end,`${q}(${JSON.stringify(s)});`),h=!0);continue}e.debug({message:`Processing ${i.specifiers.length} import specifiers`,prefix:"plugin:require-cjs-transformer"});const x=[];let p,n;for(const t of i.specifiers)if(t.type==="ImportNamespaceSpecifier")p=t.local.name,e.debug({message:`Found namespace import: ${p} from ${s}`,prefix:"plugin:require-cjs-transformer"});else if(t.type==="ImportSpecifier"){if(t.importKind==="type"){e.debug({message:`Skipping type-only named import: ${a.slice(t.imported.start,t.imported.end)}`,prefix:"plugin:require-cjs-transformer"});continue}const u=a.slice(t.imported.start,t.imported.end),d=t.local.name;x.push([u,d]),e.debug({message:`Found named import: ${u} as ${d}`,prefix:"plugin:require-cjs-transformer"})}else n=t.local.name,e.debug({message:`Found default import: ${n}`,prefix:"plugin:require-cjs-transformer"});let c;b?(c=s==="process"||s==="node:process"?"globalThis.process":`globalThis.process.getBuiltinModule(${JSON.stringify(s)})`,e.debug({message:`Generated builtin require code: ${c}`,prefix:"plugin:require-cjs-transformer"})):(c=`__cjs_require(${JSON.stringify(s)})`,h=!0,e.debug({message:`Generated CJS require code: ${c}`,prefix:"plugin:require-cjs-transformer"}));const j=[];if(p&&(n||=`_cjs_${p}_default`,e.debug({message:`Generated default ID for namespace: ${n}`,prefix:"plugin:require-cjs-transformer"})),n&&(j.push(`const ${n} = ${c};`),e.debug({message:`Added default import transformation: const ${n} = ${c}`,prefix:"plugin:require-cjs-transformer"})),p&&(j.push(`const ${p} = { ...${n}, default: ${n} };`),e.debug({message:`Added namespace import transformation: const ${p} = { ...${n}, default: ${n} }`,prefix:"plugin:require-cjs-transformer"})),x.length>0){const t=`const {
2
+ ${x.map(([u,d])=>` ${u===d?d:`${u}: ${d}`}`).join(`,
3
+ `)}
4
+ } = ${n||c};`;j.push(t),e.debug({message:`Added named imports transformation: ${t.replaceAll(`
5
+ `," ").trim()}`,prefix:"plugin:require-cjs-transformer"})}const v=j.join(`
6
+ `);e.debug({message:`Final transformation for ${s}: ${v}`,prefix:"plugin:require-cjs-transformer"}),l.overwrite(i.start,i.end,v)}if(h){const i=m?`const ${q} = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
7
+ `:`import { createRequire as __cjs_createRequire } from "node:module";
8
+ const ${q} = __cjs_createRequire(import.meta.url);
9
+ `;if(e.debug({message:`Adding require preamble: ${i.replaceAll(`
10
+ `," ").trim()}`,prefix:"plugin:require-cjs-transformer"}),a[0]==="#"){const s=a.indexOf(`
11
+ `)+1;e.debug({message:`Adding preamble after shebang at position ${s}`,prefix:"plugin:require-cjs-transformer"}),l.appendLeft(s,i)}else e.debug({message:"Adding preamble at the beginning",prefix:"plugin:require-cjs-transformer"}),l.prepend(i)}else e.debug({message:"No require preamble needed",prefix:"plugin:require-cjs-transformer"});const T=l.toString();return e.debug({message:`Transformation complete for ${g.fileName}`,prefix:"plugin:require-cjs-transformer"}),e.debug({message:`Original code length: ${a.length}, Transformed code length: ${T.length}`,prefix:"plugin:require-cjs-transformer"}),{code:T,map:l.generateMap()}},order:P}}},"requireCJSTransformerPlugin");export{ne as requireCJSTransformerPlugin};
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var d=(t,e)=>b(t,"name",{value:e,configurable:!0});import{isAbsolute as P,join as $,dirname as O,resolve as k}from"@visulima/path";import{isRelative as y}from"@visulima/path/utils";var j=Object.defineProperty,o=d((t,e)=>j(t,"name",{value:e,configurable:!0}),"o");const S=42,U=o(t=>{let e=!1;for(let s=0;s<t.length;s++)if(t.codePointAt(s)===S){if(e)return!1;e=!0}return!0},"hasZeroOrOneAsteriskCharacter"),W=o(t=>{const e=t.indexOf("*");return e===-1?void 0:{prefix:t.slice(0,e),suffix:t.slice(e+1)}},"tryParsePattern"),A=o(({prefix:t,suffix:e},s)=>s.length>=t.length+e.length&&s.startsWith(t)&&s.endsWith(e),"isPatternMatch"),T=o((t,e,s)=>{let i,r=-1;for(const f of t){const a=e(f);A(a,s)&&a.prefix.length>r&&(r=a.prefix.length,i=f)}return i},"findBestPatternMatch"),B=o((t,e)=>{const s=[];for(const i of t){if(!U(i))continue;const r=W(i);if(r)s.push(r);else if(i===e)return i}return T(s,i=>i,e)},"matchPatternOrExact"),q=o((t,e)=>e.substring(t.prefix.length,e.length-t.suffix.length),"matchedText"),R=o(({prefix:t,suffix:e})=>`${t}*${e}`,"patternText"),w=o((t,e,s)=>{let i=O(e.path);e.config.compilerOptions?.baseUrl&&(i=k(t,e.config.compilerOptions.baseUrl)),s?.debug({message:`Resolved baseUrl to ${i}`,prefix:"plugin:resolve-tsconfig-paths"});const r=e.config.compilerOptions?.paths??{};return Object.keys(r).length===0&&s?.debug({message:"No paths found in tsconfig.json",prefix:"plugin:resolve-tsconfig-paths"}),{paths:r,resolvedBaseUrl:i}},"getTsconfigPaths"),C=o((t,e,s,i)=>{const{paths:r,resolvedBaseUrl:f}=w(t,e,s),a=Object.keys(r);return{name:"plugin:resolve-tsconfig-paths",async resolveId(n,m,v){if(a.length===0)return;if(n.includes("\0")){s.debug({message:`Skipping resolution of ${n} as it is a virtual module`,prefix:"plugin:resolve-tsconfig-paths"});return}if(n.includes("node_modules")){s.debug({message:`Skipping request as it is inside node_modules ${n}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(!i.resolveAbsolutePath&&P(n)){s.debug({message:`Skipping request as it is an absolute path ${n}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(y(n)){s.debug({message:`Skipping request as it is a relative path ${n}`,prefix:"plugin:resolve-tsconfig-paths"});return}const l=B(a,n);if(!l){s.debug({message:`moduleName did not match any paths pattern ${n}`,prefix:"plugin:resolve-tsconfig-paths"});return}const u=typeof l=="string"?void 0:q(l,n),x=typeof l=="string"?l:R(l);for await(const c of r[x]){const p=u?c.replace("*",u):c;if(p.endsWith(".d.ts")||p.endsWith(".d.cts")||p.endsWith(".d.mts"))continue;const h=$(f,p);try{const g=await this.resolve(h,m,{skipSelf:!0,...v});if(g)return g}catch(g){s.debug({context:[g],message:`Failed to resolve ${h} from ${n}`,prefix:"plugin:resolve-tsconfig-paths"})}}}}},"resolveTsconfigPathsPlugin");export{C as resolveTsconfigPathsPlugin};