@visulima/packem 2.0.0-alpha.9 → 2.0.0-alpha.91

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 (98) hide show
  1. package/CHANGELOG.md +1288 -3
  2. package/LICENSE.md +3812 -2243
  3. package/README.md +92 -34
  4. package/dist/babel-runtime/packem_shared/transform-code-KNtowoK1.js +1 -0
  5. package/dist/babel-runtime/plugins/babel/worker.js +1 -0
  6. package/dist/builder/typedoc/index.d.ts +11 -23
  7. package/dist/builder/typedoc/index.js +3 -3
  8. package/dist/cli/index.js +69 -41
  9. package/dist/config/index.d.ts +55 -24
  10. package/dist/config/index.js +1 -1
  11. package/dist/config/preset/preact.d.ts +31 -0
  12. package/dist/config/preset/preact.js +2 -0
  13. package/dist/config/preset/react.d.ts +72 -0
  14. package/dist/config/preset/react.js +1 -0
  15. package/dist/config/preset/solid.d.ts +114 -0
  16. package/dist/config/preset/solid.js +1 -0
  17. package/dist/config/preset/svelte.d.ts +84 -0
  18. package/dist/config/preset/svelte.js +1 -0
  19. package/dist/config/preset/vue.d.ts +66 -0
  20. package/dist/config/preset/vue.js +1 -0
  21. package/dist/css/loaders/less.d.ts +1 -0
  22. package/dist/css/loaders/less.js +1 -0
  23. package/dist/css/loaders/lightningcss.d.ts +1 -0
  24. package/dist/css/loaders/lightningcss.js +1 -0
  25. package/dist/css/loaders/postcss.d.ts +1 -0
  26. package/dist/css/loaders/postcss.js +1 -0
  27. package/dist/css/loaders/sass.d.ts +1 -0
  28. package/dist/css/loaders/sass.js +1 -0
  29. package/dist/css/loaders/sourcemap.d.ts +1 -0
  30. package/dist/css/loaders/sourcemap.js +1 -0
  31. package/dist/css/loaders/stylus.d.ts +1 -0
  32. package/dist/css/loaders/stylus.js +1 -0
  33. package/dist/{rollup/plugins/css/minifiers/lightningcss.js → css/loaders/tailwindcss.d.ts} +1 -1
  34. package/dist/css/loaders/tailwindcss.js +1 -0
  35. package/dist/css/minifiers/cssnano.d.ts +1 -0
  36. package/dist/css/minifiers/cssnano.js +1 -0
  37. package/dist/css/minifiers/lightningcss.d.ts +1 -0
  38. package/dist/css/minifiers/lightningcss.js +1 -0
  39. package/dist/index.d.ts +55 -30
  40. package/dist/index.js +45 -1
  41. package/dist/packem_shared/create-or-update-key-storage-DHOKZmnD.js +28 -0
  42. package/dist/packem_shared/default-mHB0zin0.js +1 -0
  43. package/dist/packem_shared/index-UxllEEEe.js +249 -0
  44. package/dist/packem_shared/oxcTransformPlugin-Dwvbw2jE-BsmmBg7q.js +177 -0
  45. package/dist/packem_shared/types.d-BkLP91NJ.d.ts +464 -0
  46. package/dist/packem_shared/utils-Bsoe7qJG.js +1 -0
  47. package/dist/rollup/plugins/esbuild/index.d.ts +1 -24
  48. package/dist/rollup/plugins/esbuild/index.js +1 -1
  49. package/dist/rollup/plugins/oxc/oxc-transformer.d.ts +1 -20
  50. package/dist/rollup/plugins/oxc/oxc-transformer.js +1 -1
  51. package/dist/rollup/plugins/sucrase/index.d.ts +1 -19
  52. package/dist/rollup/plugins/sucrase/index.js +1 -1
  53. package/dist/rollup/plugins/swc/swc-plugin.d.ts +1 -26
  54. package/dist/rollup/plugins/swc/swc-plugin.js +1 -1
  55. package/files.d.ts +37 -0
  56. package/package.json +113 -78
  57. package/dist/packem_shared/browserslistToEsbuild-C0IWmbNe-C6xPL1oW.js +0 -1
  58. package/dist/packem_shared/create-or-update-key-storage-GwAIWW7R.js +0 -3
  59. package/dist/packem_shared/default-B6X7-Lx3.js +0 -1
  60. package/dist/packem_shared/default-BYM_JvQL.js +0 -1
  61. package/dist/packem_shared/default-B_dUKZ_J.js +0 -1
  62. package/dist/packem_shared/default-DjNIGH2Y.js +0 -1
  63. package/dist/packem_shared/default-DqRcOUe1.js +0 -1
  64. package/dist/packem_shared/esbuildPlugin-BAwyhG6L-yty60jMl.js +0 -3
  65. package/dist/packem_shared/index-CSyJAz0_.js +0 -139
  66. package/dist/packem_shared/index-CUp9WuCG.js +0 -1
  67. package/dist/packem_shared/index-DvyuEcZZ.d.ts +0 -5235
  68. package/dist/packem_shared/isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.js +0 -1
  69. package/dist/packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC-B-0lOgFf.js +0 -1
  70. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js +0 -3
  71. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG-BsYx9cDO.js +0 -1
  72. package/dist/packem_shared/oxcTransformPlugin-DfVQouIB-Cpfv95eA.js +0 -4
  73. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-BEkYWTsH.js +0 -6
  74. package/dist/packem_shared/swcPlugin-Boip4lWG-CwJ-HVJc.js +0 -1
  75. package/dist/packem_shared/types-0XfKu6f9.d.ts +0 -163
  76. package/dist/rollup/plugins/css/loaders/less.d.ts +0 -1
  77. package/dist/rollup/plugins/css/loaders/less.js +0 -1
  78. package/dist/rollup/plugins/css/loaders/lightningcss.d.ts +0 -1
  79. package/dist/rollup/plugins/css/loaders/lightningcss.js +0 -1
  80. package/dist/rollup/plugins/css/loaders/postcss.d.ts +0 -1
  81. package/dist/rollup/plugins/css/loaders/postcss.js +0 -1
  82. package/dist/rollup/plugins/css/loaders/sass.d.ts +0 -1
  83. package/dist/rollup/plugins/css/loaders/sass.js +0 -1
  84. package/dist/rollup/plugins/css/loaders/sourcemap.d.ts +0 -9
  85. package/dist/rollup/plugins/css/loaders/sourcemap.js +0 -1
  86. package/dist/rollup/plugins/css/loaders/stylus.d.ts +0 -1
  87. package/dist/rollup/plugins/css/loaders/stylus.js +0 -1
  88. package/dist/rollup/plugins/css/loaders/tailwindcss.d.ts +0 -1
  89. package/dist/rollup/plugins/css/loaders/tailwindcss.js +0 -1
  90. package/dist/rollup/plugins/css/minifiers/cssnano.d.ts +0 -1
  91. package/dist/rollup/plugins/css/minifiers/cssnano.js +0 -1
  92. package/dist/rollup/plugins/css/minifiers/lightningcss.d.ts +0 -1
  93. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +0 -25
  94. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.js +0 -1
  95. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +0 -20
  96. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.js +0 -1
  97. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +0 -24
  98. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +0 -1
@@ -0,0 +1,464 @@
1
+ import { CheckPackageOptions } from '@arethetypeswrong/core';
2
+ import { TransformerFn, TransformerName } from '@visulima/packem-plugins';
3
+ import { InternalOXCTransformPluginConfig } from '@visulima/packem-plugins/oxc';
4
+ import { ResolveExternalsPluginOptions } from '@visulima/packem-plugins/plugin/externals';
5
+ import { NativeModulesOptions } from '@visulima/packem-plugins/plugin/native-modules';
6
+ import { PackemRollupOptions } from '@visulima/packem-rollup';
7
+ import { BuildContext, Environment, Runtime, Format, BuildHooks, Mode } from '@visulima/packem-share/types';
8
+ import { FileCache } from '@visulima/packem-share/utils';
9
+ import { StyleOptions } from '@visulima/rollup-plugin-css';
10
+ import { JitiOptions } from 'jiti';
11
+ import { RenderedChunk } from 'rollup';
12
+ import { TypeDocOptions } from 'typedoc';
13
+ type ExePlatform = "darwin" | "linux" | "win";
14
+ type ExeArch = "arm64" | "x64";
15
+ interface ExeTarget {
16
+ arch: ExeArch;
17
+ /**
18
+ * Node.js version to use for the executable.
19
+ *
20
+ * Accepts a valid semver string (e.g., `"25.7.0"`), or the special values
21
+ * `"latest"` / `"latest-lts"` which resolve the version automatically from
22
+ * {@link https://nodejs.org/dist/index.json}.
23
+ *
24
+ * The minimum required version is 25.7.0, which is when stable SEA support landed in Node.js.
25
+ */
26
+ nodeVersion: "latest" | "latest-lts" | (string & {}) | `${string}.${string}.${string}`;
27
+ platform: ExePlatform;
28
+ }
29
+ interface ExeExtensionOptions {
30
+ /**
31
+ * Cross-platform targets for building executables.
32
+ * When specified, builds an executable for each target platform/arch combination
33
+ * by downloading and caching the corresponding Node.js binary from nodejs.org.
34
+ * @example
35
+ * ```ts
36
+ * targets: [
37
+ * { platform: "linux", arch: "x64", nodeVersion: "25.7.0" },
38
+ * { platform: "darwin", arch: "arm64", nodeVersion: "25.7.0" },
39
+ * { platform: "win", arch: "x64", nodeVersion: "25.7.0" },
40
+ * ]
41
+ * ```
42
+ */
43
+ targets?: ExeTarget[];
44
+ }
45
+ interface ExeChunk {
46
+ path: string;
47
+ type?: string;
48
+ }
49
+ interface SeaConfig {
50
+ /** Optional, embedded asset mappings. */
51
+ assets?: Record<string, string>;
52
+ /** @default true */
53
+ disableExperimentalSEAWarning?: boolean;
54
+ /** Extra Node.js CLI arguments embedded into the executable. */
55
+ execArgv?: string[];
56
+ /** @default "env" */
57
+ execArgvExtension?: "cli" | "env" | "none";
58
+ /** Optional; if not specified, uses the current Node.js binary. */
59
+ executable?: string;
60
+ main?: string;
61
+ mainFormat?: "commonjs" | "module";
62
+ output?: string;
63
+ /** @default false */
64
+ useCodeCache?: boolean;
65
+ /** @default false */
66
+ useSnapshot?: boolean;
67
+ }
68
+ interface ExeOptions extends ExeExtensionOptions {
69
+ /**
70
+ * Output file name without any suffix or extension.
71
+ * For example, do not include `.exe`, platform suffixes, or architecture suffixes.
72
+ */
73
+ fileName?: ((chunk: ExeChunk) => string) | string;
74
+ /**
75
+ * Output directory for executables.
76
+ * @default "build"
77
+ */
78
+ outDir?: string;
79
+ /**
80
+ * Node.js SEA configuration passthrough.
81
+ * @see https://nodejs.org/api/single-executable-applications.html#generating-single-executable-applications-with---build-sea
82
+ */
83
+ seaConfig?: Omit<SeaConfig, "main" | "mainFormat" | "output">;
84
+ }
85
+ type Node10CompatibilityOptions = {
86
+ typeScriptVersion?: string;
87
+ writeToPackageJson?: boolean;
88
+ };
89
+ type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
90
+ interface AttwOptions extends CheckPackageOptions {
91
+ /**
92
+ * Ignore the scripts on pack
93
+ * @default false
94
+ */
95
+ ignoreScripts?: boolean;
96
+ /**
97
+ * The level of the check.
98
+ *
99
+ * The available levels are:
100
+ * - `error`: fails the build
101
+ * - `warn`: warns the build
102
+ * @default 'warn'
103
+ */
104
+ level?: "error" | "warn";
105
+ /**
106
+ * Specify the package manager to use for --pack
107
+ * Bun does not support --json option on the pack command, if you choose bun you will get a error.
108
+ * @default 'auto'
109
+ */
110
+ pm?: "pnpm" | "yarn" | "npm" | "bun" | "auto";
111
+ /**
112
+ * Profiles select a set of resolution modes to require/ignore. All are evaluated but failures outside
113
+ * of those required are ignored.
114
+ *
115
+ * The available profiles are:
116
+ * - `strict`: requires all resolutions
117
+ * - `node16`: ignores node10 resolution failures
118
+ * - `esmOnly`: ignores CJS resolution failures
119
+ * @default 'strict'
120
+ */
121
+ profile?: "strict" | "node16" | "esmOnly";
122
+ }
123
+ /**
124
+ * In addition to basic `entries`, `presets`, and `hooks`,
125
+ * there are also all the properties of `BuildOptions` except for BuildOption's `entries`.
126
+ */
127
+ interface BuildConfig extends DeepPartial<Omit<BuildOptions, "entries">> {
128
+ entries?: (BuildEntry | string)[];
129
+ envFile?: string;
130
+ envPrefix?: string;
131
+ hooks?: Partial<BuildHooks<InternalBuildOptions>>;
132
+ preset?: BuildPreset | "none" | (NonNullable<unknown> & string);
133
+ }
134
+ type BuildPreset = BuildConfig | (() => BuildConfig);
135
+ /**
136
+ * Function type for dynamic build configuration.
137
+ * Allows configuration to be generated based on environment and mode.
138
+ * @param environment The build environment (development/production)
139
+ * @param mode The build mode (build/watch)
140
+ * @returns Build configuration object or Promise resolving to one
141
+ * @public
142
+ */
143
+ type BuildConfigFunction = (environment: Environment, mode: Mode) => BuildConfig | Promise<BuildConfig>;
144
+ type BuildEntry = {
145
+ /** Whether to generate CommonJS output for this entry */
146
+ cjs?: boolean;
147
+ /** TypeScript declaration file generation mode */
148
+ declaration?: boolean | "compatible" | "node16";
149
+ /** Whether to generate .d.cts declaration file without triggering CJS JS build */
150
+ declarationCjs?: boolean;
151
+ /** Whether to generate .d.mts declaration file without triggering ESM JS build */
152
+ declarationEsm?: boolean;
153
+ /**
154
+ * Set of declaration file extensions package.json's exports map references for
155
+ * this entry (e.g. `{ "d.mts", "d.cts" }`). Derived by infer-entries from the
156
+ * actual type file paths in exports; used by the DTS build to emit exactly the
157
+ * files package.json consumers will resolve. Takes precedence over the global
158
+ * `emitCJS`/`emitESM` + `declaration` flags when present.
159
+ */
160
+ declarationExtensions?: Set<"d.cts" | "d.mts" | "d.ts">;
161
+ /** Build environment for this entry */
162
+ environment?: Environment;
163
+ /** Whether to generate ESM output for this entry */
164
+ esm?: boolean;
165
+ /** Whether this entry should be marked as executable */
166
+ executable?: true;
167
+ /** Set of export keys to include for this entry */
168
+ exportKey?: Set<string>;
169
+ /** Alternative filename for the output file */
170
+ fileAlias?: string;
171
+ /** Input file path for this entry */
172
+ input: string;
173
+ /** Whether the input is a glob pattern */
174
+ isGlob?: boolean;
175
+ /** Name identifier for this entry */
176
+ name?: string;
177
+ /** Output directory for this entry */
178
+ outDir?: string;
179
+ /** Runtime environment for this entry */
180
+ runtime?: Runtime;
181
+ };
182
+ /**
183
+ * A banner/footer value. Either a static string or a function receiving the
184
+ * rendered chunk and returning the text to prepend/append. Passed straight
185
+ * through to Rollup/Rolldown `output.banner` / `output.footer`, so both
186
+ * bundler backends honour it.
187
+ */
188
+ type BannerFooterValue = string | ((chunk: RenderedChunk) => Promise<string> | string);
189
+ /**
190
+ * Banner/footer configuration. A bare string or function targets the JavaScript
191
+ * output only. Use the object form to target the JavaScript bundle (`js`) and/or
192
+ * the generated declaration files (`dts`) independently.
193
+ * @example
194
+ * ```ts
195
+ * banner: "/* @license MIT *\/", // js only
196
+ * banner: { js: "'use client';", dts: "// types" } // per output
197
+ * ```
198
+ */
199
+ type BannerFooterOption = BannerFooterValue | {
200
+ dts?: BannerFooterValue;
201
+ js?: BannerFooterValue;
202
+ };
203
+ interface BuildOptions {
204
+ /** Path alias mappings for module resolution */
205
+ alias: Record<string, string>;
206
+ /** Whether to analyze bundle size and dependencies */
207
+ analyze?: boolean;
208
+ /**
209
+ * Text to prepend to the build output. Maps to Rollup/Rolldown
210
+ * `output.banner` and is applied to both the CommonJS and ESM bundles.
211
+ * A bare string/function targets the JS output; use `{ js, dts }` to also
212
+ * prepend a header to the generated declaration files.
213
+ */
214
+ banner?: BannerFooterOption;
215
+ /** Browser targets for transpilation (e.g., ['chrome 58', 'firefox 57']) */
216
+ browserTargets?: string[];
217
+ /** Custom builder functions for different build types */
218
+ builder?: Record<string, (context: BuildContext<BuildOptions>, cachePath: string | undefined, fileCache: FileCache, logged: boolean) => Promise<void>>;
219
+ /**
220
+ * Bundler to use for building source files.
221
+ *
222
+ * When set to `"rolldown"` the `transformer` option must be omitted —
223
+ * rolldown ships its own oxc-based transform and always uses it. The
224
+ * esbuild/swc/sucrase/oxc transformer adapters only apply under the default
225
+ * `"rollup"` bundler.
226
+ */
227
+ bundler?: "rollup" | "rolldown";
228
+ /** Whether to enable CommonJS interop for ESM modules */
229
+ cjsInterop?: boolean;
230
+ /** Whether to clean the output directory before building */
231
+ clean: boolean;
232
+ /** Whether to enable debug mode with verbose logging */
233
+ debug: boolean;
234
+ /**
235
+ * `compatible` means "src/gather.ts" will generate "dist/index.d.mts", "dist/index.d.cts" and "dist/index.d.ts".
236
+ * `node16` means "src/gather.ts" will generate "dist/index.d.mts" and "dist/index.d.cts".
237
+ * `true` is equivalent to `compatible`.
238
+ * `false` will disable declaration generation.
239
+ * `undefined` will auto-detect based on "package.json". If "package.json" has "types" field, it will be `"compatible"`, otherwise `false`.
240
+ */
241
+ declaration?: boolean | "compatible" | "node16";
242
+ /**
243
+ * Maximum number of DTS bundles to build in parallel. Each
244
+ * `@visulima/rollup-plugin-dts` instance keeps a TypeScript program in
245
+ * memory, so this is capped low by default to avoid OOM on large monorepos.
246
+ * @default 2
247
+ */
248
+ dtsConcurrency?: number;
249
+ /**
250
+ * If `true`, only generate declaration files.
251
+ * If `false` or `undefined`, generate both declaration and source files.
252
+ */
253
+ dtsOnly?: boolean;
254
+ /** Whether to emit CommonJS output */
255
+ emitCJS?: boolean;
256
+ /** Whether to emit ESM output */
257
+ emitESM?: boolean;
258
+ /** Build entry points */
259
+ entries: BuildEntry[];
260
+ /**
261
+ * Bundle the build output into a single standalone executable via Node.js SEA.
262
+ * Set to `true` to build for the current platform, or pass an options object
263
+ * for fine-grained control (cross-platform targets, SEA config, custom output name).
264
+ *
265
+ * Requires Node.js >= 25.7.0 at build time. Not supported in Bun or Deno.
266
+ * Automatically enforces a single entry point.
267
+ */
268
+ exe?: boolean | ExeOptions;
269
+ /** External dependencies that should not be bundled */
270
+ externals: (RegExp | string)[];
271
+ /** Whether to fail the build on warnings */
272
+ failOnWarn?: boolean;
273
+ /** Whether to enable file caching for faster rebuilds */
274
+ fileCache?: boolean;
275
+ /**
276
+ * Text to append to the build output. Maps to Rollup/Rolldown
277
+ * `output.footer` and is applied to both the CommonJS and ESM bundles.
278
+ * A bare string/function targets the JS output; use `{ js, dts }` to also
279
+ * append text to the generated declaration files.
280
+ */
281
+ footer?: BannerFooterOption;
282
+ /**
283
+ * Array of export keys to ignore during entry inference.
284
+ * Useful for excluding exports that only contain images or other non-JavaScript assets.
285
+ * @example ["images", "assets", "icons"]
286
+ */
287
+ ignoreExportKeys?: string[];
288
+ /**
289
+ * Jiti options, where [jiti](https://github.com/unjs/jiti) is used to load the entry files.
290
+ * @default { alias: {}, debug: false, interopDefault: true }
291
+ */
292
+ jiti: Omit<JitiOptions & {
293
+ absoluteJitiPath?: boolean;
294
+ }, "onError" | "transform">;
295
+ /** Signal to use when killing child processes */
296
+ killSignal?: KillSignal;
297
+ /** Whether to minify the output */
298
+ minify?: boolean;
299
+ /** Name of the build */
300
+ name: string;
301
+ /** Node.js 10 compatibility options */
302
+ node10Compatibility?: Node10CompatibilityOptions | false;
303
+ onSuccess?: string | (() => Promise<(() => Promise<void> | void) | undefined>);
304
+ /** Command to run or function to execute after successful build */
305
+ /** Timeout for the onSuccess command in milliseconds */
306
+ onSuccessTimeout?: number;
307
+ /** Output directory for build artifacts */
308
+ outDir: string;
309
+ /** Custom file extensions for different output formats */
310
+ outputExtensionMap?: Record<Format, string>;
311
+ /**
312
+ * The resolved browserslist result, preserved even when the global runtime
313
+ * is "node" (where `browserTargets` is cleared). Per-group browser builds use
314
+ * this so that browser-runtime entries in an otherwise node package keep their
315
+ * intended browserslist targets.
316
+ */
317
+ resolvedBrowserTargets?: string[];
318
+ /** Rollup-specific build options */
319
+ rollup: RollupBuildOptions;
320
+ /** Root directory of the project */
321
+ rootDir: string;
322
+ /** Target runtime environment */
323
+ runtime?: Runtime;
324
+ /** Source directory containing the source files */
325
+ sourceDir: string;
326
+ /** Whether to generate source maps */
327
+ sourcemap: boolean;
328
+ /**
329
+ * Transformer function for processing source files.
330
+ *
331
+ * Required when `bundler` is `"rollup"` (the default). Must be omitted
332
+ * when `bundler` is `"rolldown"` — rolldown bundles its own oxc-based
333
+ * transform natively and never invokes packem's transformer adapter, so
334
+ * passing one is a configuration mistake and packem will refuse to build.
335
+ */
336
+ transformer?: TransformerFn;
337
+ /** TypeDoc configuration for generating documentation */
338
+ typedoc: TypeDocumentOptions | false;
339
+ /**
340
+ * If `true`, enables unbundle mode which preserves the source file structure.
341
+ * Instead of bundling everything into a single file, each module is output as a separate file
342
+ * maintaining the original directory structure.
343
+ * @default false
344
+ * @example
345
+ * ```typescript
346
+ * // With unbundle: true
347
+ * // src/index.ts exports from './a/indexA', './b/indexB'
348
+ * // Output: dist/index.js, dist/a/indexA.js, dist/b/indexB.js
349
+ * ```
350
+ */
351
+ unbundle?: boolean;
352
+ /** Validation options for the build */
353
+ validation?: ValidationOptions | false;
354
+ }
355
+ interface InternalBuildOptions extends BuildOptions {
356
+ /** Rollup options with internal OXC configuration */
357
+ rollup: BuildOptions["rollup"] & {
358
+ nativeModules?: NativeModulesOptions | false;
359
+ oxc?: InternalOXCTransformPluginConfig;
360
+ };
361
+ /** Name of the transformer being used */
362
+ transformerName: TransformerName | undefined;
363
+ }
364
+ /** Valid kill signals for terminating child processes */
365
+ type KillSignal = "SIGKILL" | "SIGTERM";
366
+ interface RollupBuildOptions extends PackemRollupOptions {
367
+ /** CSS processing options or false to disable */
368
+ css?: StyleOptions | false;
369
+ /** External dependency resolution plugin options */
370
+ resolveExternals?: ResolveExternalsPluginOptions;
371
+ }
372
+ type TypeDocumentOptions = Partial<Omit<TypeDocOptions, "entryPoints" | "hideGenerator" | "out" | "preserveWatchOutput" | "watch">> & {
373
+ /**
374
+ * The format of the output.
375
+ * @default "html"
376
+ */
377
+ format?: "html" | "inline" | "json" | "markdown";
378
+ /**
379
+ * The name of the JSON file.
380
+ */
381
+ jsonFileName?: string;
382
+ /**
383
+ * A marker to replace the content within the file on the correct location.
384
+ * @default "TYPEDOC" This marker need to be placed in the readme &lt;!-- TYPEDOC -->&lt;!-- TYPEDOC -->
385
+ */
386
+ marker?: string;
387
+ /**
388
+ * The path of the output directory.
389
+ */
390
+ output?: string;
391
+ /**
392
+ * The path of the README file.
393
+ */
394
+ readmePath?: string;
395
+ };
396
+ type ValidationOptions = {
397
+ /**
398
+ * Run `arethetypeswrong` after bundling.
399
+ * Requires `@arethetypeswrong/core` to be installed.
400
+ * @default false
401
+ * @see https://github.com/arethetypeswrong/arethetypeswrong.github.io
402
+ */
403
+ attw?: boolean | AttwOptions;
404
+ /** Bundle size validation options */
405
+ bundleLimit?: {
406
+ /** Allow the build to succeed even if limits are exceeded */
407
+ allowFail?: boolean;
408
+ /**
409
+ * Bundle size limit in bytes, or string with unit (e.g., "1MB", "500KB")
410
+ * @example
411
+ * - "1MB"
412
+ * - "500KB"
413
+ * - 1048576 // 1MB in bytes
414
+ */
415
+ limit?: number | `${number}${"B" | "GB" | "KB" | "MB" | "TB"}`;
416
+ /** Size limits for specific files or globs */
417
+ limits?: Record<string, number | `${number}${"B" | "GB" | "KB" | "MB" | "TB"}`>;
418
+ };
419
+ /** Dependency validation options */
420
+ dependencies: {
421
+ /** Hoisted dependency validation with exclusions */
422
+ hoisted: {
423
+ exclude: string[];
424
+ } | false;
425
+ /** Unused dependency validation with exclusions */
426
+ unused: {
427
+ exclude: string[];
428
+ } | false;
429
+ } | false;
430
+ /** Package.json validation options */
431
+ packageJson?: {
432
+ /** Allowed file extensions in exports field */
433
+ allowedExportExtensions?: string[];
434
+ /** Whether to validate the bin field */
435
+ bin?: boolean;
436
+ /** Whether to validate dependencies */
437
+ dependencies?: boolean;
438
+ /** Whether to validate the engines field */
439
+ engines?: boolean;
440
+ /** Whether to validate the exports field */
441
+ exports?: boolean;
442
+ /**
443
+ * Additional custom conditions to consider valid in exports field validation.
444
+ * These will be added to the standard and community conditions.
445
+ * @example ["custom", "my-bundler"]
446
+ */
447
+ extraConditions?: string[];
448
+ /** Whether to validate the files field */
449
+ files?: boolean;
450
+ /** Whether to validate the main field */
451
+ main?: boolean;
452
+ /** Whether to validate the module field */
453
+ module?: boolean;
454
+ /** Whether to validate the name field */
455
+ name?: boolean;
456
+ /** Whether to validate the sideEffects field */
457
+ sideEffects?: boolean;
458
+ /** Whether to validate the types field */
459
+ types?: boolean;
460
+ /** Whether to validate the typesVersions field */
461
+ typesVersions?: boolean;
462
+ };
463
+ };
464
+ export { BuildConfig as B, InternalBuildOptions as I, RollupBuildOptions as R, BuildConfigFunction as a, BuildPreset as b, BuildEntry as c, BuildOptions as d };
@@ -0,0 +1 @@
1
+ import{createRequire as w}from"node:module";const z=/^[A-Z]:\//i,p=(t="")=>t&&t.replaceAll("\\","/").replace(z,n=>n.toUpperCase()),j=/^[/\\]{2}/,k=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,b=/^[A-Z]:$/i,m=/^\/([A-Z]:)?$/i,$=/.(\.[^./]+)$/,y=/^[/\\]|^[a-z]:[/\\]/i,A=/\/$/,O=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",v=(t,n)=>{let e="",l=0,r=-1,i=0,s;for(let o=0;o<=t.length;++o){if(o<t.length)s=t[o];else{if(s==="/")break;s="/"}if(s==="/"){if(!(r===o-1||i===1))if(i===2){if(e.length<2||l!==2||!e.endsWith(".")||e.at(-2)!=="."){if(e.length>2){const c=e.lastIndexOf("/");c===-1?(e="",l=0):(e=e.slice(0,c),l=e.length-1-e.lastIndexOf("/")),r=o,i=0;continue}else if(e.length>0){e="",l=0,r=o,i=0;continue}}n&&(e+=e.length>0?"/..":"..",l=2)}else e.length>0?e+=`/${t.slice(r+1,o)}`:e=t.slice(r+1,o),l=o-r-1;r=o,i=0}else s==="."&&i!==-1?++i:i=-1}return e},f=t=>k.test(t),R=function(t){if(t.length===0)return".";t=p(t);const n=j.exec(t),e=f(t),l=t.at(-1)==="/";return t=v(t,!e),t.length===0?e?"/":l?"./":".":(l&&(t+="/"),b.test(t)&&(t+="/"),n?e?`//${t}`:`//./${t}`:e&&!f(t)?`/${t}`:t)},S=(...t)=>{let n="";for(const e of t)if(e)if(n.length>0){const l=n.at(-1)==="/",r=e[0]==="/";l&&r?n+=e.slice(1):n+=l||r?e:`/${e}`}else n+=e;return R(n)},g=function(...t){t=t.map(l=>p(l));let n="",e=!1;for(let l=t.length-1;l>=-1&&!e;l--){const r=l>=0?t[l]:O();!r||r.length===0||(n=`${r}/${n}`,e=f(r))}return n=v(n,!e),e&&!f(n)?`/${n}`:n.length>0?n:"."},H=function(t){return p(t)},W=function(t){return $.exec(p(t))?.[1]??""},N=function(t,n){const e=g(t).replace(m,"$1").split("/"),l=g(n).replace(m,"$1").split("/");if(l[0][1]===":"&&e[0][1]===":"&&e[0]!==l[0])return l.join("/");const r=[...e];for(const i of r){if(l[0]!==i)break;e.shift(),l.shift()}return[...e.map(()=>".."),...l].join("/")},T=t=>{const n=p(t).replace(A,"").split("/").slice(0,-1);return n.length===1&&b.test(n[0])&&(n[0]=`${n[0]}/`),n.join("/")||(f(t)?"/":".")},Z=(t,n)=>{const e=p(t).split("/").pop();return n&&e.endsWith(n)?e.slice(0,-n.length):e},V=function(t){const n=y.exec(t)?.[0]?.replaceAll("\\","/")??"",e=Z(t),l=W(e);return{base:e,dir:T(t),ext:l,name:e.slice(0,e.length-l.length),root:n}},_=w(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=t=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[n,e]=a.versions.node.split(".").map(Number);if(n>22||n===22&&e>=3||n===20&&e>=16)return a.getBuiltinModule(t)}return _(t)},{fileURLToPath:P}=E("node:url");function B(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,d;function U(){return d||(d=1,u=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),u}var q=U();const C=B(q);new Set(C);const I=new Set(["/","\\",void 0]),h=Symbol.for("pathe:normalizedAlias"),L=(t,n)=>n.split("/").length-t.split("/").length,x=(t="/")=>{const n=t.at(-1);return n==="/"||n==="\\"},M=t=>{if(t[h])return t;const n=Object.fromEntries(Object.entries(t).toSorted(([e],[l])=>L(e,l)));for(const e in n)for(const l in n)l===e||e.startsWith(l)||n[e].startsWith(l)&&I.has(n[e][l.length])&&(n[e]=n[l]+n[e].slice(l.length));return Object.defineProperty(n,h,{enumerable:!1,value:!0}),n},Y=(t,n)=>{t=p(t),n=M(n);for(const[e,l]of Object.entries(n)){if(!t.startsWith(e))continue;const r=x(e)?e.slice(0,-1):e;if(x(t[r.length]))return S(l,t.slice(e.length))}return t},D=/^(?:\.?\.[/\\]|\.\.\B)/,F=t=>D.test(t)||t==="..",J=t=>p(t instanceof URL?P(t):t);export{J as B,H as E,W as G,T as H,g as P,V as R,Z as V,F as W,R as Z,N as _,Y as k,f as v,S as w};
@@ -1,24 +1 @@
1
- import { T as TransformerFn } from '../../../packem_shared/index-DvyuEcZZ.js';
2
- export { e as EsbuildPluginConfig } from '../../../packem_shared/index-DvyuEcZZ.js';
3
- import '@rollup/plugin-alias';
4
- import '@rollup/plugin-commonjs';
5
- import '@rollup/plugin-json';
6
- import '@rollup/plugin-node-resolve';
7
- import '@rollup/plugin-replace';
8
- import '@rollup/plugin-wasm';
9
- import '@rollup/pluginutils';
10
- import 'rollup';
11
- import 'rollup-plugin-dts';
12
- import 'rollup-plugin-polyfill-node';
13
- import 'rollup-plugin-pure';
14
- import 'rollup-plugin-visualizer';
15
- import 'esbuild';
16
- import '@visulima/package';
17
- import '@visulima/colorize';
18
- import 'oxc-resolver';
19
- import 'oxc-transform';
20
- import 'sucrase';
21
-
22
- declare const _default: TransformerFn;
23
-
24
- export { _default as default };
1
+ export { type EsbuildPluginConfig, esbuildPlugin as default } from '@visulima/packem-rollup/esbuild';
@@ -1 +1 @@
1
- import{_ as f}from"../../../packem_shared/esbuildPlugin-BAwyhG6L-yty60jMl.js";export{f as default};
1
+ import{esbuildPlugin as u}from"@visulima/packem-rollup/esbuild";export{u as default};
@@ -1,20 +1 @@
1
- export { o as default, default as isolatedDeclarationsOxcTransformer } from './isolated-declarations-oxc-transformer.js';
2
- import 'oxc-transform';
3
- import '../../../packem_shared/index-DvyuEcZZ.js';
4
- import '@rollup/plugin-alias';
5
- import '@rollup/plugin-commonjs';
6
- import '@rollup/plugin-json';
7
- import '@rollup/plugin-node-resolve';
8
- import '@rollup/plugin-replace';
9
- import '@rollup/plugin-wasm';
10
- import '@rollup/pluginutils';
11
- import 'rollup';
12
- import 'rollup-plugin-dts';
13
- import 'rollup-plugin-polyfill-node';
14
- import 'rollup-plugin-pure';
15
- import 'rollup-plugin-visualizer';
16
- import 'esbuild';
17
- import '@visulima/package';
18
- import '@visulima/colorize';
19
- import 'oxc-resolver';
20
- import 'sucrase';
1
+ export { oxcTransformPlugin as default } from '@visulima/packem-plugins/oxc';
@@ -1 +1 @@
1
- import{n as f}from"../../../packem_shared/oxcTransformPlugin-DfVQouIB-Cpfv95eA.js";export{f as default};
1
+ import{t as e}from"../../../packem_shared/oxcTransformPlugin-Dwvbw2jE-BsmmBg7q.js";export{e as default};
@@ -1,19 +1 @@
1
- export { h as SucrasePluginConfig, s as default } from '../../../packem_shared/index-DvyuEcZZ.js';
2
- import '@rollup/plugin-alias';
3
- import '@rollup/plugin-commonjs';
4
- import '@rollup/plugin-json';
5
- import '@rollup/plugin-node-resolve';
6
- import '@rollup/plugin-replace';
7
- import '@rollup/plugin-wasm';
8
- import '@rollup/pluginutils';
9
- import 'rollup';
10
- import 'rollup-plugin-dts';
11
- import 'rollup-plugin-polyfill-node';
12
- import 'rollup-plugin-pure';
13
- import 'rollup-plugin-visualizer';
14
- import 'esbuild';
15
- import '@visulima/package';
16
- import '@visulima/colorize';
17
- import 'oxc-resolver';
18
- import 'oxc-transform';
19
- import 'sucrase';
1
+ export { type SucrasePluginConfig, sucrasePlugin as default } from '@visulima/packem-rollup/sucrase';
@@ -1 +1 @@
1
- import{sucrasePlugin as r}from"../../../packem_shared/default-B_dUKZ_J.js";export{r as default};
1
+ import{sucrasePlugin as r}from"@visulima/packem-rollup/sucrase";export{r as default};
@@ -1,26 +1 @@
1
- import { T as TransformerFn, f as IsolatedDeclarationsResult } from '../../../packem_shared/index-DvyuEcZZ.js';
2
- export { S as SwcPluginConfig } from '../../../packem_shared/index-DvyuEcZZ.js';
3
- import '@rollup/plugin-alias';
4
- import '@rollup/plugin-commonjs';
5
- import '@rollup/plugin-json';
6
- import '@rollup/plugin-node-resolve';
7
- import '@rollup/plugin-replace';
8
- import '@rollup/plugin-wasm';
9
- import '@rollup/pluginutils';
10
- import 'rollup';
11
- import 'rollup-plugin-dts';
12
- import 'rollup-plugin-polyfill-node';
13
- import 'rollup-plugin-pure';
14
- import 'rollup-plugin-visualizer';
15
- import 'esbuild';
16
- import '@visulima/package';
17
- import '@visulima/colorize';
18
- import 'oxc-resolver';
19
- import 'oxc-transform';
20
- import 'sucrase';
21
-
22
- declare const isolatedDeclarationsSwcTransformer: (id: string, code: string, sourceMap?: boolean) => Promise<IsolatedDeclarationsResult>;
23
-
24
- declare const _default: TransformerFn;
25
-
26
- export { _default as default, isolatedDeclarationsSwcTransformer as i };
1
+ export { type SwcPluginConfig, swcPlugin as default } from '@visulima/packem-rollup/swc';
@@ -1 +1 @@
1
- import{t as e}from"../../../packem_shared/swcPlugin-Boip4lWG-CwJ-HVJc.js";export{e as default};
1
+ import{swcPlugin as f}from"@visulima/packem-rollup/swc";export{f as default};
package/files.d.ts CHANGED
@@ -223,3 +223,40 @@ declare module "*?raw" {
223
223
 
224
224
  export default source;
225
225
  }
226
+
227
+ // Data URI plugin support
228
+ declare module "*?data-uri" {
229
+ const dataUri: string;
230
+
231
+ export default dataUri;
232
+ }
233
+
234
+ declare module "*?data-uri&encoding=css" {
235
+ const dataUri: string;
236
+
237
+ export default dataUri;
238
+ }
239
+
240
+ declare module "*?data-uri&encoding=tiny" {
241
+ const dataUri: string;
242
+
243
+ export default dataUri;
244
+ }
245
+
246
+ declare module "*?data-uri&srcset" {
247
+ const dataUri: string;
248
+
249
+ export default dataUri;
250
+ }
251
+
252
+ declare module "*?data-uri&encoding=css&srcset" {
253
+ const dataUri: string;
254
+
255
+ export default dataUri;
256
+ }
257
+
258
+ declare module "*?data-uri&encoding=tiny&srcset" {
259
+ const dataUri: string;
260
+
261
+ export default dataUri;
262
+ }