@visulima/packem-rollup 1.0.0-alpha.7 → 1.0.0-alpha.70

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 (85) hide show
  1. package/CHANGELOG.md +693 -0
  2. package/LICENSE.md +8 -791
  3. package/README.md +89 -2
  4. package/dist/index.d.ts +731 -51
  5. package/dist/index.js +1 -0
  6. package/dist/packem_shared/browserslistToEsbuild-HD6SaWPt.js +1 -0
  7. package/dist/packem_shared/esbuildPlugin-BStpbA6S.js +1 -0
  8. package/dist/packem_shared/swcPlugin-DBBN5mct.js +1 -0
  9. package/dist/packem_shared/types.d-Dmpk2asd.d.ts +7 -0
  10. package/dist/packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.d.ts +6 -0
  11. package/dist/packem_shared/types.d-KBgVO47q.d.ts +658 -0
  12. package/dist/plugins/chunk-splitter/index.d.ts +3 -0
  13. package/dist/plugins/chunk-splitter/index.js +1 -0
  14. package/dist/plugins/cjs-interop.d.ts +11 -0
  15. package/dist/plugins/cjs-interop.js +2 -0
  16. package/dist/plugins/esbuild/index.d.ts +9 -23
  17. package/dist/plugins/esbuild/index.js +1 -0
  18. package/dist/plugins/json.d.ts +5 -0
  19. package/dist/plugins/json.js +1 -0
  20. package/dist/plugins/jsx-remove-attributes.d.ts +11 -0
  21. package/dist/plugins/jsx-remove-attributes.js +1 -0
  22. package/dist/plugins/preserve-directives.d.ts +15 -0
  23. package/dist/plugins/preserve-directives.js +4 -0
  24. package/dist/plugins/pure-new-expression-plugin.d.ts +12 -0
  25. package/dist/plugins/pure-new-expression-plugin.js +1 -0
  26. package/dist/plugins/sucrase/index.d.ts +100 -17
  27. package/dist/plugins/sucrase/index.js +1 -0
  28. package/dist/plugins/swc/index.d.ts +9 -24
  29. package/dist/plugins/swc/index.js +1 -0
  30. package/package.json +53 -53
  31. package/dist/index.d.mts +0 -56
  32. package/dist/index.mjs +0 -1
  33. package/dist/packem_shared/browserslist-to-esbuild-DY9HwYtp.d.mts +0 -3
  34. package/dist/packem_shared/browserslist-to-esbuild-DY9HwYtp.d.ts +0 -3
  35. package/dist/packem_shared/browserslistToEsbuild-C0IWmbNe.mjs +0 -1
  36. package/dist/packem_shared/cachingPlugin-D0BBFJPD.mjs +0 -1
  37. package/dist/packem_shared/chunkSplitter-DWAy1JkE.mjs +0 -1
  38. package/dist/packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs +0 -2
  39. package/dist/packem_shared/copyPlugin--6RITp1-.mjs +0 -1
  40. package/dist/packem_shared/createSplitChunks-CGDk55G3.mjs +0 -1
  41. package/dist/packem_shared/dataUriPlugin-BOjv6O2O.mjs +0 -1
  42. package/dist/packem_shared/esbuildPlugin-BAwyhG6L.mjs +0 -1
  43. package/dist/packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs +0 -11
  44. package/dist/packem_shared/fix-dts-default-cjs-exports-BQc0nwIG.mjs +0 -26
  45. package/dist/packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs +0 -1
  46. package/dist/packem_shared/fixDynamicImportExtension-BBGNRniz.mjs +0 -1
  47. package/dist/packem_shared/getCustomModuleLayer-d8i66lfh.mjs +0 -1
  48. package/dist/packem_shared/getModuleLayer-rF9RxnJ5.mjs +0 -1
  49. package/dist/packem_shared/index-Cj1Okk1t.mjs +0 -1
  50. package/dist/packem_shared/isolatedDeclarationsOxcTransformer-WbfE6cGu.mjs +0 -1
  51. package/dist/packem_shared/isolatedDeclarationsPlugin-A0wmmw3Y.mjs +0 -3
  52. package/dist/packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC.mjs +0 -1
  53. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo.mjs +0 -3
  54. package/dist/packem_shared/jsonPlugin-BAi3Da-h.mjs +0 -1
  55. package/dist/packem_shared/jsxRemoveAttributes-B1PLPffj.mjs +0 -1
  56. package/dist/packem_shared/licensePlugin-C5yzUqe-.mjs +0 -13
  57. package/dist/packem_shared/makeExecutable-6aOVHoJR.mjs +0 -4
  58. package/dist/packem_shared/metafilePlugin-ObS4J7mO.mjs +0 -1
  59. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG.mjs +0 -1
  60. package/dist/packem_shared/oxcTransformPlugin-DfVQouIB.mjs +0 -4
  61. package/dist/packem_shared/patchTypescriptTypes-BEdkvKxL.mjs +0 -6
  62. package/dist/packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs +0 -4
  63. package/dist/packem_shared/rawPlugin-BqlR6ZOI.mjs +0 -1
  64. package/dist/packem_shared/resolveFileUrlPlugin-BkpjVHeK.mjs +0 -1
  65. package/dist/packem_shared/resolveTsconfigPathsPlugin-Crf4lzxq.mjs +0 -1
  66. package/dist/packem_shared/resolveTsconfigRootDirectoriesPlugin-_93afm2q.mjs +0 -1
  67. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM.mjs +0 -1
  68. package/dist/packem_shared/sourcemapsPlugin-B4W3J79w.mjs +0 -1
  69. package/dist/packem_shared/swcPlugin-Boip4lWG.mjs +0 -1
  70. package/dist/packem_shared/types-BKqesFEF.d.mts +0 -4548
  71. package/dist/packem_shared/types-BKqesFEF.d.ts +0 -4548
  72. package/dist/packem_shared/urlPlugin-Bm2IE00y.mjs +0 -1
  73. package/dist/plugins/esbuild/index.d.mts +0 -25
  74. package/dist/plugins/esbuild/index.mjs +0 -1
  75. package/dist/plugins/oxc/index.d.mts +0 -28
  76. package/dist/plugins/oxc/index.d.ts +0 -28
  77. package/dist/plugins/oxc/index.mjs +0 -1
  78. package/dist/plugins/sucrase/index.d.mts +0 -19
  79. package/dist/plugins/sucrase/index.mjs +0 -1
  80. package/dist/plugins/swc/index.d.mts +0 -26
  81. package/dist/plugins/swc/index.mjs +0 -1
  82. package/dist/plugins/typescript/index.d.mts +0 -29
  83. package/dist/plugins/typescript/index.d.ts +0 -29
  84. package/dist/plugins/typescript/index.mjs +0 -1
  85. /package/dist/packem_shared/{index-Dq8IUFTs.mjs → index-Dq8IUFTs.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,56 +1,736 @@
1
- import { Plugin, RenderedChunk, GetManualChunk, CustomPluginOptions } from 'rollup';
2
- import { P as PailServerType } from './packem_shared/types-BKqesFEF.js';
3
- export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, n as IsolatedDeclarationsResult, o as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, p as PackemRollupOptions, R as RawLoaderOptions, q as RollupPlugins, S as ShebangOptions, h as SourcemapsPluginOptions, T as TransformerFn, t as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, d as dataUriPlugin, e as esmShimCjsSyntaxPlugin, g as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, r as rawPlugin, f as removeShebangPlugin, s as shebangPlugin, k as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-BKqesFEF.js';
4
- export { b as browserslistToEsbuild } from './packem_shared/browserslist-to-esbuild-DY9HwYtp.js';
1
+ export { default as chunkSplitter } from "./plugins/chunk-splitter/index.js";
2
+ import { c as Options$3 } from "./packem_shared/types.d-KBgVO47q.js";
3
+ export { d as browserslistToEsbuild } from "./packem_shared/types.d-KBgVO47q.js";
4
+ import { JSXRemoveAttributesPlugin } from "./plugins/jsx-remove-attributes.js";
5
+ export { jsxRemoveAttributes } from "./plugins/jsx-remove-attributes.js";
6
+ export { type PreserveDirectivesPluginOptions, preserveDirectivesPlugin } from "./plugins/preserve-directives.js";
7
+ export { pureNewExpressionPlugin } from "./plugins/pure-new-expression-plugin.js";
8
+ import { RollupAliasOptions } from '@rollup/plugin-alias';
9
+ export { type Alias, type ResolverObject as AliasResolverObject, type ResolvedAlias, type RollupAliasOptions, default as alias } from '@rollup/plugin-alias';
10
+ import { RollupCommonJSOptions } from '@rollup/plugin-commonjs';
11
+ export { type RollupCommonJSOptions, default as commonjs } from '@rollup/plugin-commonjs';
5
12
  import { RollupJsonOptions } from '@rollup/plugin-json';
6
- import { FileCache } from '@visulima/packem-share/utils';
13
+ import { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve';
14
+ export { type RollupNodeResolveOptions, default as nodeResolve } from '@rollup/plugin-node-resolve';
15
+ import { RollupReplaceOptions } from '@rollup/plugin-replace';
16
+ export { type RollupReplaceOptions, default as replace } from '@rollup/plugin-replace';
17
+ import { RollupWasmOptions } from '@rollup/plugin-wasm';
18
+ export { type RollupWasmOptions, default as wasm } from '@rollup/plugin-wasm';
7
19
  import { FilterPattern } from '@rollup/pluginutils';
8
- import { BuildContextBuildAssetAndChunk, BuildContextBuildEntry } from '@visulima/packem-share/types';
9
- export { Alias, ResolverObject as AliasResolverObject, ResolvedAlias, RollupAliasOptions, default as alias } from '@rollup/plugin-alias';
10
- export { RollupCommonJSOptions, default as commonjs } from '@rollup/plugin-commonjs';
11
- export { RollupDynamicImportVariablesOptions, default as dynamicImportVars } from '@rollup/plugin-dynamic-import-vars';
12
- export { RollupInjectOptions, default as inject } from '@rollup/plugin-inject';
13
- export { RollupNodeResolveOptions, default as nodeResolve } from '@rollup/plugin-node-resolve';
14
- export { RollupReplaceOptions, default as replace } from '@rollup/plugin-replace';
15
- export { RollupWasmOptions, default as wasm } from '@rollup/plugin-wasm';
16
- export { NodePolyfillsOptions as RollupNodePolyfillsOptions, default as polyfillNode } from 'rollup-plugin-polyfill-node';
17
- export { PureAnnotationsOptions as RollupPureAnnotationsOptions, PluginPure as pure } from 'rollup-plugin-pure';
18
- export { PluginVisualizerOptions as RollupPluginVisualizerOptions, default as visualizer } from 'rollup-plugin-visualizer';
19
- import 'rollup-plugin-dts';
20
- import 'esbuild';
20
+ import { TransformOptions } from '@babel/core';
21
+ import { ResolvedId, OutputOptions, Plugin, RollupOptions } from 'rollup';
22
+ import { NapiResolveOptions } from 'oxc-resolver';
23
+ import { TransformOptions as TransformOptions$1, JsxOptions } from 'oxc-transform';
21
24
  import '@visulima/package';
22
- import 'oxc-resolver';
23
- import 'oxc-transform';
24
- import 'sucrase';
25
-
26
- declare const chunkSplitter: () => Plugin;
27
-
28
- type FixDtsDefaultCjsExportsPluginOptions = {
29
- matcher?: (info: RenderedChunk) => boolean;
30
- };
31
- declare const fixDtsDefaultCjsExportsPlugin: (options?: FixDtsDefaultCjsExportsPluginOptions) => Plugin;
32
-
33
- declare const fixDynamicImportExtension: () => Plugin;
34
-
35
- declare const JSONPlugin: (options: RollupJsonOptions) => Plugin;
36
-
37
- declare const metafilePlugin: () => Plugin;
38
-
39
- declare const cachingPlugin: (plugin: Plugin, cache: FileCache, subDirectory?: string) => Plugin;
40
-
41
- declare const preserveDirectives: ({ directiveRegex, exclude, include, logger, }: {
42
- directiveRegex: RegExp;
25
+ import '@visulima/packem-share/types';
26
+ import { SourceMapOptions } from 'magic-string';
27
+ import 'clean-css';
28
+ import { MinifierOptions } from 'html-minifier-next';
29
+ import { Options as Options$2 } from '@visulima/rollup-plugin-dts';
30
+ import { NodePolyfillsOptions } from 'rollup-plugin-polyfill-node';
31
+ export { type NodePolyfillsOptions as RollupNodePolyfillsOptions, default as polyfillNode } from 'rollup-plugin-polyfill-node';
32
+ import { PureAnnotationsOptions } from 'rollup-plugin-pure';
33
+ export { type PureAnnotationsOptions as RollupPureAnnotationsOptions, PluginPure as purePlugin } from 'rollup-plugin-pure';
34
+ import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
35
+ export { type PluginVisualizerOptions as RollupPluginVisualizerOptions, default as visualizer } from 'rollup-plugin-visualizer';
36
+ import { CJSInteropOptions } from "./plugins/cjs-interop.js";
37
+ import { SucrasePluginConfig } from "./plugins/sucrase/index.js";
38
+ import { S as SwcPluginConfig } from "./packem_shared/types.d-Dmpk2asd.js";
39
+ export { type RollupDynamicImportVariablesOptions, default as dynamicImportVars } from '@rollup/plugin-dynamic-import-vars';
40
+ export { type RollupInjectOptions, default as inject } from '@rollup/plugin-inject';
41
+ export { importTrace, patchErrorWithTrace } from 'rollup-plugin-import-trace';
42
+ import '@visulima/packem-share/utils';
43
+ import "./packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
44
+ import '@swc/types';
45
+ interface BabelPluginConfig extends Omit<TransformOptions, "exclude" | "filename" | "include" | "sourceFileName"> {
46
+ exclude?: FilterPattern;
47
+ filename?: string;
48
+ include?: FilterPattern;
49
+ /**
50
+ * Run Babel transforms in parallel across a worker pool.
51
+ * `false` always transforms in-process; `true`/`undefined` auto-enables workers
52
+ * once the build crosses `parallelThreshold` matched files (so small builds never
53
+ * pay the worker startup cost); a number caps the worker count (default min(cpus, 4)).
54
+ * Parallel mode requires fully serializable Babel options — when a non-serializable
55
+ * option is present (e.g. a function plugin, or a `babel` config supplied as a
56
+ * function) the plugin silently falls back to in-process transforms.
57
+ * @default true
58
+ */
59
+ parallel?: boolean | number;
60
+ /**
61
+ * Minimum number of matched files before the worker pool is created.
62
+ * @default 20
63
+ */
64
+ parallelThreshold?: number;
65
+ sourceFileName?: string;
66
+ }
67
+ type OXCTransformPluginConfig = Omit<TransformOptions$1, "cwd" | "sourcemap" | "target" | "typescript"> & {
68
+ exclude?: FilterPattern;
69
+ include?: FilterPattern; /** Configure how TSX and JSX are transformed. */
70
+ jsx?: Omit<JsxOptions, "refresh"> | "preserve";
71
+ };
72
+ type OXCResolveOptions = Omit<NapiResolveOptions, "tsconfig"> & {
73
+ ignoreSideEffectsForRoot?: boolean;
74
+ };
75
+ type SingleTargetDesc = {
76
+ dest?: string;
77
+ exclude?: string[] | string;
78
+ src: string[] | string;
79
+ };
80
+ type MultipleTargetsDesc = SingleTargetDesc | SingleTargetDesc[] | string[] | string;
81
+ type CopyPluginOptions = {
82
+ /**
83
+ * Copy items once. Useful in watch mode.
84
+ * @default false
85
+ */
86
+ copyOnce?: boolean;
87
+ exactFileNames?: boolean;
88
+ /**
89
+ * Remove the directory structure of copied files.
90
+ * @default true
91
+ */
92
+ flatten?: boolean;
93
+ targets: MultipleTargetsDesc;
94
+ };
95
+ type DataUriPluginOptions = {
96
+ exclude?: FilterPattern;
97
+ include?: FilterPattern; /** Encode spaces for use in srcset attribute */
98
+ srcset?: boolean;
99
+ };
100
+ /**
101
+ * Data URI plugin that converts files to data URIs for inline embedding.
102
+ *
103
+ * Supported query parameters:
104
+ *
105
+ * - `?data-uri` - Basic data URI conversion.
106
+ * - `?data-uri and encoding=css` - Use CSS-optimized SVG encoding.
107
+ * - `?data-uri and encoding=tiny` - Use tiny SVG encoding (default).
108
+ * - `?data-uri and srcset` - Encode spaces as %20 for srcset compatibility.
109
+ *
110
+ * Examples:
111
+ *
112
+ * - `./icon.svg?data-uri` - Tiny SVG encoding.
113
+ * - `./icon.svg?data-uri and encoding=css` - CSS-optimized SVG encoding.
114
+ * - `./icon.svg?data-uri and srcset` - Tiny SVG with srcset compatibility.
115
+ * - `./icon.svg?data-uri and encoding=css and srcset` - CSS encoding with srcset compatibility.
116
+ */
117
+ interface DebarrelPluginOptions {
118
+ include?: FilterPattern;
119
+ possibleBarrelFiles?: (RegExp | string)[];
120
+ }
121
+ /**
122
+ * Collected duplicated-package information, keyed by package name, then version,
123
+ * then the resolved package directory, with the set of importers as the leaf value.
124
+ *
125
+ * ```plaintext
126
+ * Map {
127
+ * "axios" => Map {
128
+ * "1.4.0" => Map { "[dir]" => Set { "packages/pkg2/index.js" } },
129
+ * "0.27.2" => Map { "[dir]" => Set { "packages/pkg1/index.js" } }
130
+ * }
131
+ * }
132
+ * ```
133
+ */
134
+ type PackagesInfo = Map<string, Map<string, Map<string, Set<string>>>>;
135
+ interface DetectDuplicatedPluginOptions {
136
+ /** Build a custom message from the collected duplicates instead of the default report. */
137
+ customErrorMessage?: (packageToVersionsMap: PackagesInfo) => string;
138
+ /**
139
+ * Whether to report duplicated deps that are pulled in transitively by another dep under node_modules.
140
+ * When `false`, only duplicates imported directly by your own source are reported.
141
+ * @default true
142
+ */
143
+ deep?: boolean;
144
+ /**
145
+ * Duplicated dependencies to ignore. Pass `*` as a version to ignore all versions, e.g. `{ axios: ["0.17.4", "1.4.0"] }`.
146
+ * @default {} (ignore nothing)
147
+ */
148
+ ignore?: Record<string, string[]>;
149
+ /**
150
+ * Make the build fail when duplicated deps exist.
151
+ * @default false
152
+ */
153
+ throwErrorWhenDuplicated?: boolean;
154
+ }
155
+ interface EsmShimCjsSyntaxOptions {
156
+ exclude?: FilterPattern;
157
+ include?: FilterPattern;
158
+ }
159
+ type MaybeFalsy<T> = T | false | null | undefined;
160
+ /**
161
+ * User-facing configuration for externals classification, mirrored at
162
+ * `packem.config.ts` → `rollup.resolveExternals`.
163
+ */
164
+ type ResolveExternalsPluginOptions = {
165
+ /**
166
+ * Mark node built-in modules like `path`, `fs`... as external.
167
+ *
168
+ * Set to `false` to use shims/polyfills instead.
169
+ * @default true
170
+ */
171
+ builtins?: boolean;
172
+ /**
173
+ * `node:` prefix handling for imports of Node builtins:
174
+ * - `'add'` turns `'path'` into `'node:path'`
175
+ * - `'strip'` turns `'node:path'` into `'path'`
176
+ * - `'ignore'` leaves names as written
177
+ * @default "add"
178
+ */
179
+ builtinsPrefix?: "add" | "ignore" | "strip";
180
+ /**
181
+ * Mark `dependencies` as external.
182
+ * @default true
183
+ */
184
+ deps?: boolean;
185
+ /**
186
+ * Mark `devDependencies` as external.
187
+ * @default false
188
+ */
189
+ devDeps?: boolean;
190
+ /**
191
+ * Patterns whose matching specifiers are forced to be bundled,
192
+ * overriding all other rules (deps/peer/built-ins/etc.).
193
+ *
194
+ * Strings are matched as exact specifiers; RegExp values are tested
195
+ * against the import id. Falsy entries are ignored for convenient
196
+ * conditional configuration.
197
+ * @default [] (no specifier is forcibly bundled)
198
+ */
199
+ exclude?: MaybeFalsy<RegExp | string>[];
200
+ /**
201
+ * Mark `optionalDependencies` as external.
202
+ * @default true
203
+ */
204
+ optDeps?: boolean;
205
+ /**
206
+ * Mark `peerDependencies` as external.
207
+ * @default true
208
+ */
209
+ peerDeps?: boolean;
210
+ };
211
+ /**
212
+ * Minimal slice of build options consumed by `externalsPlugin`.
213
+ *
214
+ * The plugin lives in `@visulima/packem-rollup` so it can be reused outside
215
+ * of packem core, so it's parameterized over this shape rather than
216
+ * packem's `InternalBuildOptions`. Any options object that satisfies this
217
+ * structural type is accepted.
218
+ */
219
+ interface LicenseOptions {
220
+ dependenciesMarker?: string;
221
+ dependenciesTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
222
+ dtsMarker?: string;
223
+ dtsTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
224
+ path?: string;
225
+ }
226
+ /**
227
+ * Ported from https://github.com/lit/lit/tree/main/packages/labs/rollup-plugin-minify-html-literals
228
+ *
229
+ * BSD-3-Clause License
230
+ *
231
+ * Copyright (c) 2024 Google LLC
232
+ */
233
+ interface Template {
234
+ parts: TemplatePart[];
235
+ tag?: string;
236
+ }
237
+ interface TemplatePart {
238
+ end: number;
239
+ start: number;
240
+ text: string;
241
+ }
242
+ interface Strategy$1<N = unknown> {
243
+ getRootNode: (source: string, fileName?: string) => N;
244
+ getTaggedTemplateTemplate: (node: N) => unknown;
245
+ getTagText: (node: N) => string;
246
+ getTemplateParts: (node: N) => TemplatePart[];
247
+ isTaggedTemplate: (node: N) => boolean;
248
+ isTemplate: (node: N) => boolean;
249
+ walkNodes: (parent: N, visit: (child: N) => void) => void;
250
+ }
251
+ interface ParseLiteralsOptions {
252
+ fileName?: string;
253
+ strategy?: Partial<Strategy$1>;
254
+ }
255
+ declare const parseLiterals: (source: string, options?: ParseLiteralsOptions) => Template[];
256
+ /**
257
+ * A strategy on how to minify HTML and optionally CSS.
258
+ * @template O minify HTML options
259
+ * @template C minify CSS options
260
+ */
261
+ interface Strategy<O = unknown, C = unknown> {
262
+ /**
263
+ * Combines the parts' HTML text strings together into a single string using
264
+ * the provided placeholder. The placeholder indicates where a template
265
+ * expression occurs.
266
+ * @param parts the parts to combine
267
+ * @param placeholder the placeholder to use between parts
268
+ * @returns the combined parts' text strings
269
+ */
270
+ combineHTMLStrings: (parts: TemplatePart[], placeholder: string) => string;
271
+ /**
272
+ * Retrieve a placeholder for the given array of template parts. The
273
+ * placeholder returned should be the same if the function is invoked with the
274
+ * same array of parts.
275
+ *
276
+ * The placeholder should be an HTML-compliant string that is not present in
277
+ * any of the parts' text.
278
+ * @param parts the parts to get a placeholder for
279
+ * @returns the placeholder
280
+ */
281
+ getPlaceholder: (parts: TemplatePart[]) => string;
282
+ /**
283
+ * Minifies the provided CSS string.
284
+ * @param css the css to minfiy
285
+ * @param options css minify options
286
+ * @returns minified CSS string
287
+ */
288
+ minifyCSS?: (css: string, options?: C) => string;
289
+ /**
290
+ * Minfies the provided HTML string.
291
+ * @param html the html to minify
292
+ * @param options html minify options
293
+ * @returns minified HTML string
294
+ */
295
+ minifyHTML: (html: string, options?: O) => string | Promise<string>;
296
+ /**
297
+ * Splits a minfied HTML string back into an array of strings from the
298
+ * provided placeholder. The returned array of strings should be the same
299
+ * length as the template parts that were combined to make the HTML string.
300
+ * @param html the html string to split
301
+ * @param placeholder the placeholder to split by
302
+ * @returns an array of html strings
303
+ */
304
+ splitHTMLByPlaceholder: (html: string, placeholder: string) => string[];
305
+ }
306
+ /**
307
+ * The default &lt;code>html-minifier&lt;/code> options, optimized for production
308
+ * minification.
309
+ */
310
+ declare const defaultMinifyOptions: MinifierOptions;
311
+ /**
312
+ * Options for &lt;code>minifyHTMLLiterals()&lt;/code>.
313
+ */
314
+ type Options$1 = DefaultOptions | CustomOptions;
315
+ /**
316
+ * Options for &lt;code>minifyHTMLLiterals()&lt;/code>, using default html-minifier
317
+ * strategy.
318
+ */
319
+ interface DefaultOptions extends BaseOptions {
320
+ /**
321
+ * &lt;code>html-minifier&lt;/code> options to use. Defaults to
322
+ * &lt;code>defaultMinifyOptions&lt;/code>, for production-ready minification.
323
+ */
324
+ minifyOptions?: Partial<typeof defaultMinifyOptions>;
325
+ }
326
+ /**
327
+ * Options for &lt;code>minifyHTMLLiterals()&lt;/code>, using a custom strategy.
328
+ */
329
+ interface CustomOptions<S extends Strategy<any, any> = Strategy<any, any>> extends BaseOptions {
330
+ /**
331
+ * HTML minification options.
332
+ */
333
+ minifyOptions?: S extends Strategy<infer O> ? Partial<O> : never;
334
+ /**
335
+ * Override the default strategy for how to minify HTML. The default is to
336
+ * use &lt;code>html-minifier&lt;/code>.
337
+ */
338
+ strategy: S;
339
+ }
340
+ /**
341
+ * Options for &lt;code>minifyHTMLLiterals()&lt;/code>.
342
+ */
343
+ interface BaseOptions {
344
+ /**
345
+ * The name of the file. This is used to determine how to parse the source
346
+ * code and for source map filenames. It may be a base name, relative, or
347
+ * absolute path.
348
+ */
349
+ fileName?: string;
350
+ /**
351
+ * Override how source maps are generated. Set to false to disable source map
352
+ * generation.
353
+ * @param ms the MagicString instance with code modifications
354
+ * @param fileName the name or path of the file
355
+ * @returns a v3 SourceMap or undefined
356
+ */
357
+ generateSourceMap?: ((ms: MagicStringLike, fileName: string) => SourceMap | undefined) | false;
358
+ /**
359
+ * The MagicString-like constructor to use. MagicString is used to replace
360
+ * strings and generate source maps.
361
+ *
362
+ * Override if you want to set your own version of MagicString or change how
363
+ * strings are overridden. Use &lt;code>generateSourceMap&lt;/code> if you want to
364
+ * change how source maps are created.
365
+ */
366
+ MagicString?: new (source: string) => MagicStringLike;
367
+ /**
368
+ * Override how template literals are parsed from a source string.
369
+ */
370
+ parseLiterals?: typeof parseLiterals;
371
+ /**
372
+ * Options for &lt;code>parseLiterals()&lt;/code>.
373
+ */
374
+ parseLiteralsOptions?: Partial<ParseLiteralsOptions>;
375
+ /**
376
+ * Determines whether or not a template should be minified. The default is to
377
+ * minify all tagged template whose tag name contains "html" (case
378
+ * insensitive).
379
+ * @param template the template to check
380
+ * @returns true if the template should be minified
381
+ */
382
+ shouldMinify?: (template: Template) => boolean;
383
+ /**
384
+ * Determines whether or not a CSS template should be minified. The default is
385
+ * to minify all tagged template whose tag name contains "css" (case
386
+ * insensitive).
387
+ * @param template the template to check
388
+ * @returns true if the template should be minified
389
+ */
390
+ shouldMinifyCSS?: (template: Template) => boolean;
391
+ /**
392
+ * Override custom validation or set to false to disable validation. This is
393
+ * only useful when implementing your own strategy that may return
394
+ * unexpected results.
395
+ */
396
+ validate?: Validation | false;
397
+ }
398
+ /**
399
+ * A MagicString-like instance. &lt;code>minify-html-literals&lt;/code> only uses a
400
+ * subset of the MagicString API to overwrite the source code and generate
401
+ * source maps.
402
+ */
403
+ interface MagicStringLike {
404
+ generateMap: (options?: Partial<SourceMapOptions>) => SourceMap;
405
+ overwrite: (start: number, end: number, content: string) => unknown;
406
+ toString: () => string;
407
+ }
408
+ /**
409
+ * A v3 SourceMap.
410
+ *
411
+ * &lt;code>magic-string> incorrectly declares the SourceMap type with a version
412
+ * string instead of a number, so &lt;code>minify-html-literals&lt;/code> declares
413
+ * its own type.
414
+ */
415
+ interface SourceMap {
416
+ file?: string;
417
+ mappings: string;
418
+ names: string[];
419
+ sources: string[];
420
+ sourcesContent?: string[];
421
+ toString: () => string;
422
+ toUrl: () => string;
423
+ version: number;
424
+ }
425
+ /**
426
+ * Validation that is executed when minifying HTML to ensure there are no
427
+ * unexpected errors. This is to alleviate hard-to-troubleshoot errors such as
428
+ * undefined errors.
429
+ */
430
+ interface Validation {
431
+ /**
432
+ * Throws an error if &lt;code>strategy.splitHTMLByPlaceholder()&lt;/code> does not
433
+ * return an HTML part string for each template part.
434
+ * @param parts the template parts that generated the strings
435
+ * @param htmlParts the split HTML strings
436
+ */
437
+ ensureHTMLPartsValid: (parts: TemplatePart[], htmlParts: string[]) => void;
438
+ /**
439
+ * Throws an error if &lt;code>strategy.getPlaceholder()&lt;/code> does not return
440
+ * a valid placeholder string.
441
+ * @param placeholder the placeholder to check
442
+ */
443
+ ensurePlaceholderValid: (placeholder: unknown) => void;
444
+ }
445
+ /**
446
+ * The result of a call to &lt;code>minifyHTMLLiterals()&lt;/code>.
447
+ */
448
+ interface Result {
449
+ /**
450
+ * The minified code.
451
+ */
452
+ code: string;
453
+ /**
454
+ * Optional v3 SourceMap for the code.
455
+ */
456
+ map: SourceMap | undefined;
457
+ }
458
+ /**
459
+ * Minifies all HTML template literals in the provided source string.
460
+ * @param source the source code
461
+ * @param options minification options
462
+ * @returns the minified code, or null if no minification occurred.
463
+ */
464
+ declare function minifyHTMLLiterals$1(source: string, options?: DefaultOptions): Promise<Result | null | undefined>;
465
+ /**
466
+ * Minifies all HTML template literals in the provided source string.
467
+ * @param source the source code
468
+ * @param options minification options
469
+ * @returns the minified code, or null if no minification occurred.
470
+ */
471
+ declare function minifyHTMLLiterals$1<S extends Strategy>(source: string, options?: CustomOptions<S>): Promise<Result | undefined>;
472
+ /**
473
+ * Plugin options.
474
+ */
475
+ interface MinifyHTMLLiteralsOptions {
476
+ /**
477
+ * Pattern or array of patterns of files not to minify.
478
+ */
479
+ exclude?: FilterPattern;
480
+ /**
481
+ * If true, any errors while parsing or minifying will abort the bundle
482
+ * process. Defaults to false, which will only show a warning.
483
+ */
484
+ failOnError?: boolean;
485
+ /**
486
+ * Pattern or array of patterns of files to minify.
487
+ */
488
+ include?: FilterPattern;
489
+ /**
490
+ * Override minify-html-literals function.
491
+ */
492
+ minifyHTMLLiterals?: typeof minifyHTMLLiterals$1;
493
+ /**
494
+ * Minify options, see
495
+ * https://www.npmjs.com/package/minify-html-literals#options.
496
+ */
497
+ options?: Partial<Options$1>;
498
+ }
499
+ interface NativeModulesOptions {
500
+ /**
501
+ * Custom subdirectory name for native modules within the output directory
502
+ * @default 'natives'
503
+ */
504
+ nativesDirectory?: string;
505
+ }
506
+ /**
507
+ * Handles native Node.js addons (.node files)
508
+ * - Stage 1 (resolve/load): Identifies .node files and generates runtime code.
509
+ * - Stage 2 (generateBundle): Copies the identified .node files to the output dir.
510
+ */
511
+ interface RawLoaderOptions {
512
+ exclude?: FilterPattern;
513
+ include?: FilterPattern;
514
+ }
515
+ type Awaitable<T> = T | Promise<T>;
516
+ /**
517
+ * @returns A boolean or a promise that resolves to a boolean,
518
+ * or `undefined` to let the plugin decide automatically.
519
+ */
520
+ type TransformFunction = (id: string, importer: string, rollupResolve: (id: string, importer?: string) => Promise<ResolvedId | null>) => Awaitable<boolean | undefined | void>;
521
+ interface Options {
522
+ /**
523
+ * Whether to transform Node.js built-in modules (e.g., `fs`, `path`)
524
+ * to `process.getBuiltinModule()` calls when supported, which has the best performance.
525
+ * Falls back to `createRequire()` for older Node.js versions, Bun, and Deno.
526
+ *
527
+ * Note: `process.getBuiltinModule` is available since Node.js 20.16.0 and 22.3.0.
528
+ * For older versions, the plugin uses `createRequire()` as fallback.
529
+ */
530
+ builtinNodeModules?: boolean;
531
+ cwd?: string;
532
+ exclude?: FilterPattern;
533
+ include?: FilterPattern;
534
+ order?: "pre" | "post";
535
+ /**
536
+ * A function to determine whether a module should be transformed.
537
+ * Return `true` to force transformation, `false` to skip transformation,
538
+ * or `undefined` to let the plugin decide automatically.
539
+ */
540
+ shouldTransform?: string[] | TransformFunction;
541
+ }
542
+ type ShebangOptions = {
543
+ replace: boolean;
544
+ shebang: string;
545
+ };
546
+ interface SourcemapsPluginOptions {
547
+ exclude?: FilterPattern;
548
+ include?: FilterPattern;
549
+ }
550
+ interface UrlOptions {
551
+ /**
552
+ * The destination dir to copy assets, usually used to rebase the assets according to HTML files.
553
+ * @type {string}
554
+ */
555
+ destDir?: string;
556
+ /**
557
+ * If false, will prevent files being emitted by this plugin. This is useful for when you are using Rollup to emit both a client-side and server-side bundle.
558
+ * @type {boolean}
559
+ * @default true
560
+ */
561
+ emitFiles: boolean;
562
+ /**
563
+ * A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
564
+ * should _ignore_.
565
+ *
566
+ * By default, no files are ignored.
567
+ * @type {FilterPattern}
568
+ */
569
+ exclude?: FilterPattern;
570
+ /**
571
+ * If emitFiles is true, this option can be used to rename the emitted files. It accepts the following string replacements:
572
+ * [hash] - The hash value of the file's contents
573
+ * [name] - The name of the imported file (without its file extension)
574
+ * [extname] - The extension of the imported file (including the leading .)
575
+ * [dirname] - The parent directory name of the imported file (including trailing /)
576
+ * @type {string}
577
+ * @default [hash][extname]
578
+ */
579
+ fileName: string;
580
+ /**
581
+ * A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
582
+ * should operate on.
583
+ * By default, the png,jpg,jpeg,gif,svg,webp files are targeted.
584
+ * @type {FilterPattern}
585
+ */
586
+ include?: FilterPattern;
587
+ /**
588
+ * The file size limit for inline files.
589
+ * If a file exceeds this limit, it will be copied to the destination folder and the hashed filename will be provided instead.
590
+ * If limit is set to 0 all files will be copied.
591
+ * @type {number}
592
+ * @default 14336 (14kb)
593
+ */
594
+ limit: number;
595
+ /**
596
+ * A string which will be added in front of filenames when they are not inlined but are copied.
597
+ * @type {string}
598
+ */
599
+ publicPath?: string;
600
+ /**
601
+ * When using the [dirname] replacement in fileName, use this directory as the source directory from which to create the file path rather than the parent directory of the imported file. For example:
602
+ * @example
603
+ * ```js
604
+ * src/path/to/file.js
605
+ *
606
+ * import png from './image.png';
607
+ * rollup.config.js
608
+ *
609
+ * url({
610
+ * fileName: '[dirname][hash][extname]',
611
+ * sourceDir: path.join(__dirname, 'src')
612
+ * });
613
+ *
614
+ * Emitted File: path/to/image.png
615
+ * ```
616
+ */
617
+ sourceDir?: string;
618
+ }
619
+ type PatchTypesOptions = {
620
+ identifierReplacements?: Record<string, Record<string, string>>;
621
+ };
622
+ /**
623
+ * Patches the bundled types output before passing to the dts plugin.
624
+ *
625
+ * 1. Validate unallowed dependency imports.
626
+ * 2. Replace confusing type names.
627
+ * 3. Strip leftover internal types.
628
+ * 4. Clean unnecessary comments.
629
+ */
630
+ type TsconfigPathsPluginOptions = {
631
+ resolveAbsolutePath?: boolean;
632
+ };
633
+ /**
634
+ * Rollup plugin that resolves module ids using `tsconfig.json`/`jsconfig.json` "paths".
635
+ *
636
+ * Handles tsconfig.json or jsconfig.json "paths" option for rollup, largely based
637
+ * on how the TypeScript compiler handles it.
638
+ * @see https://github.com/microsoft/TypeScript/blob/1a9c8197fffe3dace5f8dca6633d450a88cba66d/src/compiler/moduleNameResolver.ts#L1362
639
+ */
640
+ interface RollupDynamicImportVariablesOptions {
641
+ /**
642
+ * By default, the plugin will not throw errors when target files are not found.
643
+ * Setting this option to true will result in errors thrown when encountering files which don't exist.
644
+ * @default false
645
+ */
646
+ errorWhenNoFilesFound?: boolean;
647
+ /**
648
+ * A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
649
+ * should _ignore_.
650
+ *
651
+ * By default, no files are ignored.
652
+ */
653
+ exclude?: FilterPattern;
654
+ /**
655
+ * A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
656
+ * should operate on.
657
+ * By default, all files are targeted.
658
+ */
659
+ include?: FilterPattern;
660
+ /**
661
+ * By default, the plugin quits the build process when it encounters an error.
662
+ * If you set this option to true, it will throw a warning instead and leave the code untouched.
663
+ * @default false
664
+ */
665
+ warnOnError?: boolean;
666
+ }
667
+ interface ExtendedRollupNodeResolveOptions extends RollupNodeResolveOptions {
668
+ /**
669
+ * Controls how unresolved import warnings from the node-resolve plugin are handled.
670
+ * - `"error"` (default): Treat unresolved imports as errors, causing the build to fail
671
+ * - `"warn"`: Treat unresolved imports as warnings, allowing the build to continue
672
+ * @default "error"
673
+ */
674
+ unresolvedImportBehavior?: "error" | "warn";
675
+ }
676
+ interface PackemRollupOptions {
677
+ alias?: RollupAliasOptions | false;
678
+ babel?: BabelPluginConfig | false;
679
+ cjsInterop?: CJSInteropOptions;
680
+ commonjs?: RollupCommonJSOptions | false;
681
+ copy?: CopyPluginOptions | false;
682
+ dataUri?: DataUriPluginOptions | false;
683
+ debarrel?: DebarrelPluginOptions | false;
684
+ /**
685
+ * Detect dependencies that get bundled more than once (multiple versions, or
686
+ * the same version from multiple directories) and report them. Enabled by
687
+ * default; set to `false` to disable, or pass options to configure.
688
+ */
689
+ detectDuplicated?: DetectDuplicatedPluginOptions | false;
690
+ dts?: Options$2;
691
+ dynamicVars?: RollupDynamicImportVariablesOptions | false;
692
+ esbuild?: Options$3 | false;
693
+ experimental?: {
694
+ resolve?: OXCResolveOptions | false;
695
+ };
696
+ json?: RollupJsonOptions | false;
697
+ jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
698
+ license?: LicenseOptions | false;
699
+ metafile?: boolean;
700
+ minifyHTMLLiterals?: MinifyHTMLLiteralsOptions | false;
701
+ nativeModules?: NativeModulesOptions | false;
702
+ output?: OutputOptions;
703
+ oxc?: Omit<OXCTransformPluginConfig, "cwd" | "sourcemap" | "target"> | false;
704
+ patchTypes?: PatchTypesOptions | false;
705
+ plugins?: RollupPlugins;
706
+ polyfillNode?: NodePolyfillsOptions | false;
707
+ preserveDirectives?: {
708
+ directiveRegex?: RegExp;
43
709
  exclude?: FilterPattern;
44
710
  include?: FilterPattern;
45
- logger: PailServerType;
46
- }) => Plugin;
47
-
48
- declare const resolveFileUrl: () => Plugin;
49
-
50
- declare const createSplitChunks: (dependencyGraphMap: Map<string, Set<[string, string]>>, entryFiles: (BuildContextBuildAssetAndChunk | BuildContextBuildEntry)[]) => GetManualChunk;
51
-
52
- declare const getCustomModuleLayer: (moduleId: string) => string | undefined;
53
-
54
- declare const getModuleLayer: (moduleMeta: CustomPluginOptions) => any;
55
-
56
- export { cachingPlugin, chunkSplitter, createSplitChunks, fixDtsDefaultCjsExportsPlugin, fixDynamicImportExtension, getCustomModuleLayer, getModuleLayer, JSONPlugin as jsonPlugin, metafilePlugin, preserveDirectives as preserveDirectivesPlugin, resolveFileUrl as resolveFileUrlPlugin };
711
+ };
712
+ preserveDynamicImports?: boolean;
713
+ pure?: Omit<PureAnnotationsOptions, "sourcemap"> | false;
714
+ raw?: RawLoaderOptions | false;
715
+ replace?: Omit<RollupReplaceOptions, "cwd"> | false;
716
+ requireCJS?: Options | false;
717
+ resolve?: ExtendedRollupNodeResolveOptions | false;
718
+ resolveExternals?: ResolveExternalsPluginOptions;
719
+ shebang?: Partial<ShebangOptions> | false;
720
+ shim?: EsmShimCjsSyntaxOptions | false;
721
+ sourcemap?: SourcemapsPluginOptions;
722
+ sucrase?: SucrasePluginConfig | false;
723
+ swc?: SwcPluginConfig | false;
724
+ treeshake?: RollupOptions["treeshake"];
725
+ tsconfigPaths?: TsconfigPathsPluginOptions | false;
726
+ url?: UrlOptions | false;
727
+ visualizer?: PluginVisualizerOptions | false;
728
+ wasm?: RollupWasmOptions | false;
729
+ watch?: RollupOptions["watch"];
730
+ }
731
+ type RollupPlugins = {
732
+ enforce?: "post" | "pre";
733
+ plugin: Plugin;
734
+ type?: "build" | "dts";
735
+ }[];
736
+ export { type ExtendedRollupNodeResolveOptions, type JSXRemoveAttributesPlugin, type PackemRollupOptions, type RollupPlugins };