@visulima/packem-rollup 1.0.0-alpha.64 → 1.0.0-alpha.66

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