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

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