@visulima/packem-rollup 1.0.0-alpha.22 → 1.0.0-alpha.24

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 (102) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE.md +0 -436
  3. package/dist/index.d.ts +25 -26
  4. package/dist/index.js +1 -0
  5. package/dist/packem_shared/cachingPlugin-CLawAGhx.js +1 -0
  6. package/dist/packem_shared/createSplitChunks-Ceq_Ca5Y.js +1 -0
  7. package/dist/packem_shared/{esbuildPlugin-BrFhdKJk.mjs → esbuildPlugin-DpLtQGuZ.js} +1 -1
  8. package/dist/packem_shared/oxcResolvePlugin-Ccef6pyL.js +1 -0
  9. package/dist/packem_shared/{patchTypescriptTypes-BEdkvKxL.mjs → patchTypescriptTypes-BX_sJsvd.js} +2 -2
  10. package/dist/packem_shared/{resolveTsconfigPathsPlugin-pUcTdE77.mjs → resolveTsconfigPathsPlugin-CEasmDpi.js} +1 -1
  11. package/dist/packem_shared/{resolveTsconfigRootDirectoriesPlugin-_93afm2q.mjs → resolveTsconfigRootDirectoriesPlugin-Cwj3tqCJ.js} +1 -1
  12. package/dist/packem_shared/{types-Bk7lLMcF.d.ts → types-BiZanzz1.d.ts} +25 -136
  13. package/dist/plugins/cjs-interop.d.ts +11 -0
  14. package/dist/{packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs → plugins/cjs-interop.js} +1 -1
  15. package/dist/plugins/copy.d.ts +18 -0
  16. package/dist/plugins/copy.js +1 -0
  17. package/dist/plugins/data-uri.d.ts +12 -0
  18. package/dist/plugins/data-uri.js +1 -0
  19. package/dist/plugins/debarrel.d.ts +11 -0
  20. package/dist/{packem_shared/debarrelPlugin-BTYc859G.mjs → plugins/debarrel.js} +1 -1
  21. package/dist/plugins/esbuild/index.d.ts +19 -5
  22. package/dist/plugins/esbuild/index.js +1 -0
  23. package/dist/plugins/esm-shim-cjs-syntax.d.ts +13 -0
  24. package/dist/plugins/fix-dts-default-cjs-exports.d.ts +9 -0
  25. package/dist/plugins/fix-dts-default-cjs-exports.js +1 -0
  26. package/dist/plugins/isolated-declarations/index.d.ts +13 -0
  27. package/dist/{packem_shared/isolatedDeclarationsPlugin-B34s_qkE.mjs → plugins/isolated-declarations/index.js} +1 -1
  28. package/dist/plugins/json.d.ts +7 -0
  29. package/dist/plugins/json.js +1 -0
  30. package/dist/plugins/jsx-remove-attributes.d.ts +11 -0
  31. package/dist/plugins/jsx-remove-attributes.js +1 -0
  32. package/dist/plugins/license.d.ts +21 -0
  33. package/dist/plugins/license.js +13 -0
  34. package/dist/plugins/minify-html-literals/index.d.ts +96 -6
  35. package/dist/plugins/native-modules-plugin.d.ts +9 -0
  36. package/dist/plugins/oxc/index.d.ts +20 -6
  37. package/dist/plugins/oxc/index.js +1 -0
  38. package/dist/plugins/preserve-directives.d.ts +13 -0
  39. package/dist/{packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs → plugins/preserve-directives.js} +3 -3
  40. package/dist/plugins/raw.d.ts +11 -0
  41. package/dist/plugins/require-cjs-transformer.d.ts +19 -0
  42. package/dist/plugins/require-cjs-transformer.js +25 -0
  43. package/dist/plugins/shebang.d.ts +13 -0
  44. package/dist/plugins/source-maps.d.ts +11 -0
  45. package/dist/plugins/sucrase/index.d.ts +18 -4
  46. package/dist/plugins/swc/index.d.ts +19 -5
  47. package/dist/plugins/swc/index.js +1 -0
  48. package/dist/plugins/typescript/index.d.ts +20 -6
  49. package/dist/plugins/typescript/index.js +1 -0
  50. package/dist/plugins/url.d.ts +17 -0
  51. package/dist/plugins/url.js +1 -0
  52. package/package.json +86 -18
  53. package/dist/index.d.mts +0 -59
  54. package/dist/index.mjs +0 -1
  55. package/dist/packem_shared/browserslist-to-esbuild-DY9HwYtp.d.mts +0 -3
  56. package/dist/packem_shared/cachingPlugin-TWoY5ZxV.mjs +0 -1
  57. package/dist/packem_shared/copyPlugin--6RITp1-.mjs +0 -1
  58. package/dist/packem_shared/createSplitChunks-CGDk55G3.mjs +0 -1
  59. package/dist/packem_shared/dataUriPlugin-BFb7bZZs.mjs +0 -1
  60. package/dist/packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs +0 -1
  61. package/dist/packem_shared/index-hWYvkB02.d.mts +0 -346
  62. package/dist/packem_shared/index-hWYvkB02.d.ts +0 -346
  63. package/dist/packem_shared/jsonPlugin-BAi3Da-h.mjs +0 -1
  64. package/dist/packem_shared/jsxRemoveAttributes-B1PLPffj.mjs +0 -1
  65. package/dist/packem_shared/licensePlugin-C5yzUqe-.mjs +0 -13
  66. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG.mjs +0 -1
  67. package/dist/packem_shared/requireCJSTransformerPlugin-qcY8AH5r.mjs +0 -26
  68. package/dist/packem_shared/types-CMThMMkh.d.mts +0 -4337
  69. package/dist/packem_shared/urlPlugin-DJJrDWjj.mjs +0 -1
  70. package/dist/plugins/esbuild/index.d.mts +0 -28
  71. package/dist/plugins/esbuild/index.mjs +0 -1
  72. package/dist/plugins/minify-html-literals/index.d.mts +0 -5
  73. package/dist/plugins/oxc/index.d.mts +0 -31
  74. package/dist/plugins/oxc/index.mjs +0 -1
  75. package/dist/plugins/sucrase/index.d.mts +0 -22
  76. package/dist/plugins/swc/index.d.mts +0 -29
  77. package/dist/plugins/swc/index.mjs +0 -1
  78. package/dist/plugins/typescript/index.d.mts +0 -32
  79. package/dist/plugins/typescript/index.mjs +0 -1
  80. /package/dist/packem_shared/{browserslistToEsbuild-C0IWmbNe.mjs → browserslistToEsbuild-C0IWmbNe.js} +0 -0
  81. /package/dist/packem_shared/{chunkSplitter-DWAy1JkE.mjs → chunkSplitter-DWAy1JkE.js} +0 -0
  82. /package/dist/packem_shared/{fix-dts-default-cjs-exports-BQc0nwIG.mjs → fix-dts-default-cjs-exports-BQc0nwIG.js} +0 -0
  83. /package/dist/packem_shared/{fixDynamicImportExtension-BBGNRniz.mjs → fixDynamicImportExtension-BBGNRniz.js} +0 -0
  84. /package/dist/packem_shared/{getCustomModuleLayer-d8i66lfh.mjs → getCustomModuleLayer-d8i66lfh.js} +0 -0
  85. /package/dist/packem_shared/{getModuleLayer-rF9RxnJ5.mjs → getModuleLayer-rF9RxnJ5.js} +0 -0
  86. /package/dist/packem_shared/{index-Dq8IUFTs.mjs → index-Dq8IUFTs.js} +0 -0
  87. /package/dist/packem_shared/{index-QEzU3Fey.mjs → index-QEzU3Fey.js} +0 -0
  88. /package/dist/packem_shared/{isolatedDeclarationsOxcTransformer-WbfE6cGu.mjs → isolatedDeclarationsOxcTransformer-WbfE6cGu.js} +0 -0
  89. /package/dist/packem_shared/{isolatedDeclarationsSwcTransformer-Ch2AgtWC.mjs → isolatedDeclarationsSwcTransformer-Ch2AgtWC.js} +0 -0
  90. /package/dist/packem_shared/{isolatedDeclarationsTypescriptTransformer-DkuEkofo.mjs → isolatedDeclarationsTypescriptTransformer-DkuEkofo.js} +0 -0
  91. /package/dist/packem_shared/{metafilePlugin-CVcqFpPJ.mjs → metafilePlugin-CVcqFpPJ.js} +0 -0
  92. /package/dist/packem_shared/{oxcTransformPlugin-DfVQouIB.mjs → oxcTransformPlugin-DfVQouIB.js} +0 -0
  93. /package/dist/packem_shared/{resolveFileUrlPlugin-BkpjVHeK.mjs → resolveFileUrlPlugin-BkpjVHeK.js} +0 -0
  94. /package/dist/packem_shared/{resolveTypescriptMjsCtsPlugin-DcZrZTmM.mjs → resolveTypescriptMjsCtsPlugin-DcZrZTmM.js} +0 -0
  95. /package/dist/packem_shared/{swcPlugin-Boip4lWG.mjs → swcPlugin-Boip4lWG.js} +0 -0
  96. /package/dist/{packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs → plugins/esm-shim-cjs-syntax.js} +0 -0
  97. /package/dist/plugins/minify-html-literals/{index.mjs → index.js} +0 -0
  98. /package/dist/{packem_shared/nativeModulesPlugin-D6lO-8g6.mjs → plugins/native-modules-plugin.js} +0 -0
  99. /package/dist/{packem_shared/rawPlugin-DgRj14Xy.mjs → plugins/raw.js} +0 -0
  100. /package/dist/{packem_shared/makeExecutable-6aOVHoJR.mjs → plugins/shebang.js} +0 -0
  101. /package/dist/{packem_shared/sourcemapsPlugin-B4W3J79w.mjs → plugins/source-maps.js} +0 -0
  102. /package/dist/plugins/sucrase/{index.mjs → index.js} +0 -0
@@ -1,346 +0,0 @@
1
- import { FilterPattern } from '@rollup/pluginutils';
2
- import { Plugin } from 'rollup';
3
- import { SourceMapOptions } from 'magic-string';
4
- import { MinifierOptions } from 'html-minifier-next';
5
-
6
- 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";
7
-
8
- /**
9
- Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
10
-
11
- @category Type
12
- */
13
- type Primitive =
14
- | null
15
- | undefined
16
- | string
17
- | number
18
- | boolean
19
- | symbol
20
- | bigint;
21
-
22
- declare global {
23
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
24
- interface SymbolConstructor {
25
- readonly observable: symbol;
26
- }
27
- }
28
-
29
- /**
30
- 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.
31
-
32
- 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.
33
-
34
- 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.
35
-
36
- @example
37
- ```
38
- import type {LiteralUnion} from 'type-fest';
39
-
40
- // Before
41
-
42
- type Pet = 'dog' | 'cat' | string;
43
-
44
- const pet: Pet = '';
45
- // Start typing in your TypeScript-enabled IDE.
46
- // You **will not** get auto-completion for `dog` and `cat` literals.
47
-
48
- // After
49
-
50
- type Pet2 = LiteralUnion<'dog' | 'cat', string>;
51
-
52
- const pet: Pet2 = '';
53
- // You **will** get auto-completion for `dog` and `cat` literals.
54
- ```
55
-
56
- @category Type
57
- */
58
- type LiteralUnion<
59
- LiteralType,
60
- BaseType extends Primitive,
61
- > = LiteralType | (BaseType & Record<never, never>);
62
-
63
- declare class InteractiveStreamHook {
64
- #private;
65
- static readonly DRAIN = true;
66
- constructor(stream: NodeJS.WriteStream);
67
- active(): void;
68
- erase(count: number): void;
69
- inactive(separateHistory?: boolean): void;
70
- renew(): void;
71
- write(message: string): void;
72
- }
73
-
74
- type StreamType = "stderr" | "stdout";
75
- declare class InteractiveManager {
76
- #private;
77
- constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
78
- get lastLength(): number;
79
- get outside(): number;
80
- get isHooked(): boolean;
81
- get isSuspended(): boolean;
82
- erase(stream: StreamType, count?: number): void;
83
- hook(): boolean;
84
- resume(stream: StreamType, eraseRowCount?: number): void;
85
- suspend(stream: StreamType, erase?: boolean): void;
86
- unhook(separateHistory?: boolean): boolean;
87
- update(stream: StreamType, rows: string[], from?: number): void;
88
- private _clear;
89
- }
90
-
91
- declare global {
92
- namespace VisulimaPail {
93
- interface CustomMeta<L> {
94
- }
95
- }
96
- }
97
- interface Meta<L> extends VisulimaPail.CustomMeta<L> {
98
- badge: string | undefined;
99
- context: any[] | undefined;
100
- date: Date | string;
101
- error: Error | undefined;
102
- groups: string[];
103
- label: string | undefined;
104
- message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
105
- prefix: string | undefined;
106
- repeated?: number | undefined;
107
- scope: string[] | undefined;
108
- suffix: string | undefined;
109
- traceError: Error | undefined;
110
- type: {
111
- level: ExtendedRfc5424LogLevels | L;
112
- name: string;
113
- };
114
- }
115
- type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
116
- type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
117
- interface LoggerFunction {
118
- (message: Message): void;
119
- (...message: any[]): void;
120
- }
121
- interface LoggerConfiguration<L extends string> {
122
- badge?: string;
123
- color?: AnsiColors | undefined;
124
- label: string;
125
- logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
126
- }
127
- type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
128
- type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
129
- interface Reporter<L extends string> {
130
- log: (meta: ReadonlyMeta<L>) => void;
131
- }
132
- interface Processor<L extends string> {
133
- process: (meta: Meta<L>) => Meta<L>;
134
- }
135
- interface ConstructorOptions<T extends string, L extends string> {
136
- disabled?: boolean;
137
- logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
138
- logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
139
- messages?: {
140
- timerEnd?: string;
141
- timerStart?: string;
142
- };
143
- processors?: Processor<L>[];
144
- rawReporter?: Reporter<L>;
145
- reporters?: Reporter<L>[];
146
- scope?: string[] | string;
147
- throttle?: number;
148
- throttleMin?: number;
149
- types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
150
- }
151
- interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
152
- interactive?: boolean;
153
- stderr: NodeJS.WriteStream;
154
- stdout: NodeJS.WriteStream;
155
- }
156
- type Message = {
157
- context?: any[] | undefined;
158
- message: any;
159
- prefix?: string;
160
- suffix?: string;
161
- };
162
-
163
- type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
164
-
165
- interface StringifyOptions {
166
- bigint?: boolean,
167
- circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
168
- deterministic?: boolean | ((a: string, b: string) => number),
169
- maximumBreadth?: number,
170
- maximumDepth?: number,
171
- strict?: boolean,
172
- }
173
-
174
- declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
175
- declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
176
- declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
177
-
178
- declare namespace stringify {
179
- export function configure(options: StringifyOptions): typeof stringify
180
- }
181
-
182
- declare class PailBrowserImpl<T extends string = string, L extends string = string> {
183
- protected timersMap: Map<string, number>;
184
- protected countMap: Map<string, number>;
185
- protected seqTimers: Set<string>;
186
- protected readonly lastLog: {
187
- count?: number;
188
- object?: Meta<L>;
189
- serialized?: string;
190
- time?: Date;
191
- timeout?: ReturnType<typeof setTimeout>;
192
- };
193
- protected readonly logLevels: Record<string, number>;
194
- protected disabled: boolean;
195
- protected scopeName: string[];
196
- protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
197
- protected readonly longestLabel: string;
198
- protected readonly processors: Set<Processor<L>>;
199
- protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
200
- protected reporters: Set<Reporter<L>>;
201
- protected readonly throttle: number;
202
- protected readonly throttleMin: number;
203
- protected readonly stringify: typeof stringify;
204
- protected groups: string[];
205
- protected readonly startTimerMessage: string;
206
- protected readonly endTimerMessage: string;
207
- protected rawReporter: Reporter<L>;
208
- constructor(options: ConstructorOptions<T, L>);
209
- wrapConsole(): void;
210
- restoreConsole(): void;
211
- wrapException(): void;
212
- disable(): void;
213
- enable(): void;
214
- isEnabled(): boolean;
215
- scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
216
- unscope(): void;
217
- time(label?: string): void;
218
- timeLog(label?: string, ...data: unknown[]): void;
219
- timeEnd(label?: string): void;
220
- group(label?: string): void;
221
- groupEnd(): void;
222
- count(label?: string): void;
223
- countReset(label?: string): void;
224
- clear(): void;
225
- raw(message: string, ...arguments_: unknown[]): void;
226
- protected extendReporter(reporter: Reporter<L>): Reporter<L>;
227
- protected registerReporters(reporters: Reporter<L>[]): void;
228
- private _report;
229
- private registerProcessors;
230
- private _normalizeLogLevel;
231
- private _buildMeta;
232
- private _logger;
233
- }
234
- 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>);
235
-
236
- declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
237
- readonly options: ServerConstructorOptions<T, L>;
238
- protected readonly stdout: NodeJS.WriteStream;
239
- protected readonly stderr: NodeJS.WriteStream;
240
- protected interactiveManager: InteractiveManager | undefined;
241
- protected readonly interactive: boolean;
242
- constructor(options: ServerConstructorOptions<T, L>);
243
- scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
244
- getInteractiveManager(): InteractiveManager | undefined;
245
- wrapStd(): void;
246
- restoreStd(): void;
247
- wrapAll(): void;
248
- restoreAll(): void;
249
- clear(): void;
250
- protected extendReporter(reporter: Reporter<L>): Reporter<L>;
251
- private _wrapStream;
252
- private _restoreStream;
253
- }
254
- 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>);
255
-
256
- interface Template {
257
- parts: TemplatePart[];
258
- tag?: string;
259
- }
260
- interface TemplatePart {
261
- end: number;
262
- start: number;
263
- text: string;
264
- }
265
- interface Strategy$1<N = unknown> {
266
- getRootNode: (source: string, fileName?: string) => N;
267
- getTaggedTemplateTemplate: (node: N) => unknown;
268
- getTagText: (node: N) => string;
269
- getTemplateParts: (node: N) => TemplatePart[];
270
- isTaggedTemplate: (node: N) => boolean;
271
- isTemplate: (node: N) => boolean;
272
- walkNodes: (parent: N, visit: (child: N) => void) => void;
273
- }
274
-
275
- interface ParseLiteralsOptions {
276
- fileName?: string;
277
- strategy?: Partial<Strategy$1<unknown>>;
278
- }
279
- declare const parseLiterals: (source: string, options?: ParseLiteralsOptions) => Template[];
280
-
281
- interface Strategy<O = unknown, C = unknown> {
282
- combineHTMLStrings: (parts: TemplatePart[], placeholder: string) => string;
283
- getPlaceholder: (parts: TemplatePart[]) => string;
284
- minifyCSS?: (css: string, options?: C) => string;
285
- minifyHTML: (html: string, options?: O) => string | Promise<string>;
286
- splitHTMLByPlaceholder: (html: string, placeholder: string) => string[];
287
- }
288
- declare const defaultMinifyOptions: MinifierOptions;
289
-
290
- type Options = DefaultOptions | CustomOptions<unknown>;
291
- interface DefaultOptions extends BaseOptions {
292
- minifyOptions?: Partial<typeof defaultMinifyOptions>;
293
- }
294
- interface CustomOptions<S extends Strategy | unknown> extends BaseOptions {
295
- minifyOptions?: S extends Strategy<infer O> ? Partial<O> : never;
296
- strategy: S;
297
- }
298
- interface BaseOptions {
299
- fileName?: string;
300
- generateSourceMap?: ((ms: MagicStringLike, fileName: string) => SourceMap | undefined) | false;
301
- MagicString?: new (source: string) => MagicStringLike;
302
- parseLiterals?: typeof parseLiterals;
303
- parseLiteralsOptions?: Partial<ParseLiteralsOptions>;
304
- shouldMinify?: (template: Template) => boolean;
305
- shouldMinifyCSS?: (template: Template) => boolean;
306
- validate?: Validation | false;
307
- }
308
- interface MagicStringLike {
309
- generateMap: (options?: Partial<SourceMapOptions>) => SourceMap;
310
- overwrite: (start: number, end: number, content: string) => unknown;
311
- toString: () => string;
312
- }
313
- interface SourceMap {
314
- file?: string;
315
- mappings: string;
316
- names: string[];
317
- sources: string[];
318
- sourcesContent?: string[];
319
- toString: () => string;
320
- toUrl: () => string;
321
- version: number;
322
- }
323
- interface Validation {
324
- ensureHTMLPartsValid: (parts: TemplatePart[], htmlParts: string[]) => void;
325
- ensurePlaceholderValid: (placeholder: unknown) => void;
326
- }
327
- interface Result {
328
- code: string;
329
- map: SourceMap | undefined;
330
- }
331
- declare function minifyHTMLLiterals(source: string, options?: DefaultOptions): Promise<Result | null>;
332
- declare function minifyHTMLLiterals<S extends Strategy>(source: string, options?: CustomOptions<S>): Promise<Result | null>;
333
-
334
- interface MinifyHTMLLiteralsOptions {
335
- exclude?: FilterPattern;
336
- failOnError?: boolean;
337
- include?: FilterPattern;
338
- minifyHTMLLiterals?: typeof minifyHTMLLiterals;
339
- options?: Partial<Options>;
340
- }
341
- declare const minifyHTMLLiteralsPlugin: ({ exclude, failOnError, include, logger, minifyHTMLLiterals, options, }: MinifyHTMLLiteralsOptions & {
342
- logger: PailServerType;
343
- }) => Plugin;
344
-
345
- export { minifyHTMLLiteralsPlugin as m };
346
- export type { MinifyHTMLLiteralsOptions as M, PailServerType as P };
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var o=(t,r)=>c(t,"name",{value:r,configurable:!0});import u from"@rollup/plugin-json";var i=Object.defineProperty,l=o((t,r)=>i(t,"name",{value:r,configurable:!0}),"n");const n="export default ",m=l(t=>{const r=u(t);return{...r,name:"packem:json",transform(a,s){const e=r.transform?.call(this,a,s);return e&&typeof e!="string"&&"code"in e&&e.code?.startsWith(n)&&(e.code=e.code.replace(n,"module.exports = ")),e}}},"JSONPlugin");export{m as default};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var l=(e,a)=>f(e,"name",{value:a,configurable:!0});import{createFilter as y}from"@rollup/pluginutils";import{w as b}from"./index-Dq8IUFTs.mjs";import v from"magic-string";var d=Object.defineProperty,x=l((e,a)=>d(e,"name",{value:a,configurable:!0}),"u");const A=x(({attributes:e,logger:a})=>{const m=y([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(i,n){if(!m(n))return;let u;try{u=this.parse(i,{allowReturnOutsideFunction:!0})}catch(r){this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${n}" and remove the jsx attribute.`}),a.warn(r);return}let p=!1;const o=new v(i);if(b(u,{enter(r){if(r.type==="CallExpression"&&r.callee.type==="Identifier"&&r.callee.name==="jsx"){const c=r.arguments.filter(s=>s.type==="ObjectExpression"&&Array.isArray(s.properties));for(const s of c)for(const t of s.properties)t.type==="Property"&&t.key.type==="Literal"&&t.value.type==="Literal"&&e.includes(t.key.value)&&(o.overwrite(t.start-2,t.end,""),p=!0)}}}),!!p)return{code:o.toString(),map:o.generateMap({hires:!0})}}}},"jsxRemoveAttributes");export{A as jsxRemoveAttributes};
@@ -1,13 +0,0 @@
1
- var S=Object.defineProperty;var h=(r,e)=>S(r,"name",{value:e,configurable:!0});import{readFileSync as b,writeFileSync as v}from"@visulima/fs";import{replaceContentWithinMarker as F}from"@visulima/packem-share/utils";import P from"rollup-plugin-license";var T=Object.defineProperty,y=h((r,e)=>T(r,"name",{value:e,configurable:!0}),"d");const C=y(r=>{const e=[],l=[];return r.forEach(t=>{t.startsWith("(")?e.push(t):l.push(t)}),[...l.sort(),...e.sort()]},"sortLicenses"),z=y(({dtsMarker:r,licenseFilePath:e,licenseTemplate:l,logger:t,marker:s,mode:m,packageName:x})=>P({thirdParty(A){const u=new Set,d=A.sort(({name:n},{name:i})=>(n||0)>(i||0)?1:(i||0)>(n||0)?-1:0).map(({author:n,contributors:i,license:c,licenseText:$,maintainers:k,name:w,repository:p})=>{let a=`## ${w}
2
- `;c&&(a+=`License: ${c}
3
- `);const f=new Set;for(const o of[n,...k,...i]){const g=typeof o=="string"?o:o?.name;g&&f.add(g)}return f.size>0&&(a+=`By: ${[...f].join(", ")}
4
- `),p&&(a+=`Repository: ${typeof p=="string"?p:p.url}
5
- `),$&&(a+=`
6
- ${$.trim().replaceAll(/\r\n|\r/g,`
7
- `).replaceAll(`<!-- ${s} -->`,"").replaceAll(r?`<!-- ${r} -->`:"","").replaceAll(`<!-- /${s} -->`,"").replaceAll(r?`<!-- /${r} -->`:"","").trim().split(`
8
- `).map(o=>o?`> ${o}`:">").join(`
9
- `)}
10
- `),c&&u.add(c),a}).join(`
11
- ---------------------------------------
12
-
13
- `);if(d===""){t.info({message:"No dependencies license information found.",prefix:`plugin:license:${m}`});return}const j=l(C(u),d,x);try{const n=b(e),i=F(n,s,j);if(!i){t.error({message:`Could not find the license marker: <!-- ${s} --><!-- /${s} --> in ${e}`,prefix:`plugin:license:${m}`});return}n!==i&&(v(e,i),t.info({message:`${e} updated.`,prefix:`plugin:license:${m}`}))}catch(n){t.error(n)}}}),"license");export{z as license};
@@ -1 +0,0 @@
1
- var S=Object.defineProperty;var g=(o,e)=>S(o,"name",{value:e,configurable:!0});import{createFilter as P}from"@rollup/pluginutils";import{findPackageJson as k}from"@visulima/package/package-json";import{dirname as n}from"@visulima/path";import{ResolverFactory as J}from"oxc-resolver";var M=Object.defineProperty,m=g((o,e)=>M(o,"name",{value:e,configurable:!0}),"a");let b;const A=new Map,z=m((o,e,h,u)=>{const{ignoreSideEffectsForRoot:E,...a}=o;let c=b;return c||(c=b=new J({...a,roots:[...a.roots??[],e],tsconfig:u?{configFile:u,references:"auto"}:void 0})),{name:"oxc-resolve",resolveId:{async handler(v,l,{isEntry:w}){const p=w||!l?n(v):n(l),{error:x,path:r}=await c.async(p,v);if(x){h.debug(x,{context:[{basedir:e,extensions:a.extensions,id:r}]});return}let f=m(s=>!1,"hasModuleSideEffects");try{const{packageJson:s,path:F}=await k(n(r),{cache:A}),y=n(F);if(!E||e!==y){const i=s.sideEffects;if(typeof i=="boolean")f=m(()=>i,"hasModuleSideEffects");else if(Array.isArray(i)){const R=i.map(d=>d.includes("/")?d:`**/${d}`);f=P(R,void 0,{resolve:y})}}}catch(s){console.debug(s.message,{context:[{basedir:p,caller:"Resolver",error:s,extensions:a.extensions,id:r}]})}const t=await this.resolve(r,l,{skipSelf:!0});if(t)return t.external?!1:t.id!==r?t:{id:r,meta:t.meta,moduleSideEffects:f(r)}},order:"post"}}},"oxcResolvePlugin");export{z as default};
@@ -1,26 +0,0 @@
1
- var O=Object.defineProperty;var x=(r,e)=>O(r,"name",{value:e,configurable:!0});import{createRequire as F,builtinModules as I}from"node:module";import R from"node:process";import{createFilter as W}from"@rollup/pluginutils";import{init as N,parse as B}from"cjs-module-lexer";import G 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=x((r,e)=>L(r,"name",{value:e,configurable:!0}),"s");const z=U(async(r,e,p)=>{if(await N(),r.startsWith("node:"))return!1;if(r.endsWith(".cjs"))return!0;if(r.endsWith(".js")||!r.includes("/")&&!r.startsWith(".")){let o;if(p)try{o=(await p(r,e)).id}catch{}if(!o&&e&&!e.includes("!~{"))try{o=F(e).resolve(r)}catch{}if(o){try{const{packageJson:d}=await E(o);if(d.type==="module")return!1;if(d.type==="commonjs")return!0}catch{}try{const d=await K(o,{encoding:"utf8"});try{return B(d,o),!0}catch{}}catch{}}}return!1},"isPureCJS");var H=Object.defineProperty,w=x((r,e)=>H(r,"name",{value:e,configurable:!0}),"q");let T=!1;const y="__cjs_require",Q=w(r=>{if(Array.isArray(r.shouldTransform)){const{shouldTransform:e}=r;r.shouldTransform=p=>e.includes(p)}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=w((r,e)=>{const{builtinNodeModules:p,cwd:o,exclude:d,include:P,order:J,shouldTransform:k}=Q(r),A=W(P,d);return{async buildStart(){T||(await N(),T=!0)},name:"packem:plugin-require-cjs",renderChunk:{async handler(a,g,{format:C}){if(C!=="es"){e.debug({message:"skip",prefix:"plugin:require-cjs-transformer"});return}if(!A(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 M=D(g.fileName,a,{astType:"js",lang:"js",sourceType:"module"}),{body:_}=M.program,l=new G(a);let j=!1;e.debug({message:`Found ${_.length} AST statements to process`,prefix:"plugin:require-cjs-transformer"});for await(const i of _)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 $=p&&(I.includes(s)||s.startsWith("node:"));e.debug({message:`Is builtin module: ${$}`,prefix:"plugin:require-cjs-transformer"});let b;if($)b=!0,e.debug({message:"Processing as builtin module",prefix:"plugin:require-cjs-transformer"});else{const t=k?.(s,o,this?.resolveId);if(e.debug({message:`shouldTransform result: ${t}`,prefix:"plugin:require-cjs-transformer"}),t===void 0){const m=await z(s,o,this.resolveId?.bind(this));b=m,e.debug({message:`isPureCJS result: ${m}`,prefix:"plugin:require-cjs-transformer"})}else b=t,e.debug({message:`Using shouldTransform result: ${b}`,prefix:"plugin:require-cjs-transformer"})}if(!b){e.debug({message:`Skipping import (not a CJS module): ${s}`,prefix:"plugin:require-cjs-transformer"});continue}if(i.specifiers.length===0){$?(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} -> ${y}(${JSON.stringify(s)})`,prefix:"plugin:require-cjs-transformer"}),l.overwrite(i.start,i.end,`${y}(${JSON.stringify(s)});`),j=!0);continue}e.debug({message:`Processing ${i.specifiers.length} import specifiers`,prefix:"plugin:require-cjs-transformer"});const h=[];let c,n;for(const t of i.specifiers)if(t.type==="ImportNamespaceSpecifier")c=t.local.name,e.debug({message:`Found namespace import: ${c} 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 m=a.slice(t.imported.start,t.imported.end),f=t.local.name;h.push([m,f]),e.debug({message:`Found named import: ${m} as ${f}`,prefix:"plugin:require-cjs-transformer"})}else n=t.local.name,e.debug({message:`Found default import: ${n}`,prefix:"plugin:require-cjs-transformer"});let u;$?(s==="process"||s==="node:process"?u="__cjs_getProcess":(u=`__cjs_getBuiltinModule(${JSON.stringify(s)})`,j=!0),e.debug({message:`Generated builtin require code: ${u}`,prefix:"plugin:require-cjs-transformer"})):(u=`__cjs_require(${JSON.stringify(s)})`,j=!0,e.debug({message:`Generated CJS require code: ${u}`,prefix:"plugin:require-cjs-transformer"}));const q=[];if(c&&(n||=`_cjs_${c}_default`,e.debug({message:`Generated default ID for namespace: ${n}`,prefix:"plugin:require-cjs-transformer"})),n&&(q.push(`const ${n} = ${u};`),e.debug({message:`Added default import transformation: const ${n} = ${u}`,prefix:"plugin:require-cjs-transformer"})),c&&(q.push(`const ${c} = { ...${n}, default: ${n} };`),e.debug({message:`Added namespace import transformation: const ${c} = { ...${n}, default: ${n} }`,prefix:"plugin:require-cjs-transformer"})),h.length>0){const t=`const {
2
- ${h.map(([m,f])=>` ${m===f?f:`${m}: ${f}`}`).join(`,
3
- `)}
4
- } = ${n||u};`;q.push(t),e.debug({message:`Added named imports transformation: ${t.replaceAll(`
5
- `," ").trim()}`,prefix:"plugin:require-cjs-transformer"})}const v=q.join(`
6
- `);e.debug({message:`Final transformation for ${s}: ${v}`,prefix:"plugin:require-cjs-transformer"}),l.overwrite(i.start,i.end,v)}if(j){const i=`import { createRequire as __cjs_createRequire } from "node:module";
7
- const ${y} = __cjs_createRequire(import.meta.url);
8
-
9
- // Runtime capability helpers
10
- const __cjs_getBuiltinModule = (module) => {
11
- // Check if we're in Node.js and version supports getBuiltinModule
12
- if ("object" !== "undefined" && process.versions?.node) {
13
- const [major, minor] = process.versions.node.split(".").map(Number);
14
- // Node.js 20.16.0+ and 22.3.0+
15
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
16
- return process.getBuiltinModule(module);
17
- }
18
- }
19
- // Fallback to createRequire
20
- return __cjs_require(module);
21
- };
22
-
23
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
24
- `;if(e.debug({message:`Adding require preamble: ${i.replaceAll(`
25
- `," ").trim()}`,prefix:"plugin:require-cjs-transformer"}),a[0]==="#"){const s=a.indexOf(`
26
- `)+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 S=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: ${S.length}`,prefix:"plugin:require-cjs-transformer"}),{code:S,map:l.generateMap()}},order:J}}},"requireCJSTransformerPlugin");export{ne as requireCJSTransformerPlugin};