@visulima/packem 2.0.0-alpha.63 → 2.0.0-alpha.64
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.
- package/CHANGELOG.md +63 -0
- package/README.md +1 -20
- package/dist/builder/typedoc/index.d.ts +13 -3
- package/dist/builder/typedoc/index.js +1 -1
- package/dist/cli/index.js +23 -26
- package/dist/config/index.d.ts +56 -46
- package/dist/config/preset/preact.d.ts +29 -17
- package/dist/config/preset/react.d.ts +67 -55
- package/dist/config/preset/solid.d.ts +107 -95
- package/dist/config/preset/svelte.d.ts +79 -67
- package/dist/config/preset/vue.d.ts +61 -49
- package/dist/index.d.ts +56 -46
- package/dist/index.js +1 -1
- package/dist/packem_shared/create-or-update-key-storage-Ddq46eG8.js +1 -0
- package/dist/packem_shared/index-s7nugSmV.js +88 -0
- package/dist/packem_shared/types.d-fhksMqKN.d.ts +452 -0
- package/dist/rollup/plugins/css/loaders/less.d.ts +1 -1
- package/dist/rollup/plugins/css/loaders/lightningcss.d.ts +1 -1
- package/dist/rollup/plugins/css/loaders/postcss.d.ts +1 -1
- package/dist/rollup/plugins/css/loaders/sass.d.ts +1 -1
- package/dist/rollup/plugins/css/loaders/sourcemap.d.ts +1 -1
- package/dist/rollup/plugins/css/loaders/stylus.d.ts +1 -1
- package/dist/rollup/plugins/css/loaders/tailwindcss.d.ts +1 -1
- package/dist/rollup/plugins/css/minifiers/cssnano.d.ts +1 -1
- package/dist/rollup/plugins/css/minifiers/lightningcss.d.ts +1 -1
- package/dist/rollup/plugins/esbuild/index.d.ts +1 -2
- package/dist/rollup/plugins/oxc/oxc-transformer.d.ts +1 -2
- package/dist/rollup/plugins/sucrase/index.d.ts +1 -2
- package/dist/rollup/plugins/swc/swc-plugin.d.ts +1 -2
- package/package.json +16 -32
- package/dist/builder/typedoc/generate-reference-documentation.d.ts +0 -4
- package/dist/cli/commands/add.d.ts +0 -4
- package/dist/cli/commands/build.d.ts +0 -21
- package/dist/cli/commands/init.d.ts +0 -3
- package/dist/cli/commands/migrate.d.ts +0 -21
- package/dist/cli/commands/utils/css-loader-dependencies.d.ts +0 -2
- package/dist/cli/index.d.ts +0 -1
- package/dist/config/preset/auto.d.ts +0 -3
- package/dist/config/preset/utils/infer-entries.d.ts +0 -12
- package/dist/config/preset/utils/overwrite-with-publish-config.d.ts +0 -4
- package/dist/config/utils/find-packem-file.d.ts +0 -2
- package/dist/config/utils/load-env-file.d.ts +0 -15
- package/dist/config/utils/load-package-json.d.ts +0 -6
- package/dist/config/utils/load-packem-config.d.ts +0 -7
- package/dist/config/utils/load-preset.d.ts +0 -4
- package/dist/config/utils/load-tsconfig.d.ts +0 -5
- package/dist/config/utils/prepare-entries.d.ts +0 -4
- package/dist/jit/create-stub.d.ts +0 -4
- package/dist/lib/concurrency.d.ts +0 -6
- package/dist/packem/build.d.ts +0 -21
- package/dist/packem/index.d.ts +0 -24
- package/dist/packem/node10-compatibility.d.ts +0 -7
- package/dist/packem/utils/brotli-size.d.ts +0 -2
- package/dist/packem/utils/group-by-keys.d.ts +0 -12
- package/dist/packem/utils/gzip-size.d.ts +0 -2
- package/dist/packem_shared/create-or-update-key-storage-U4wgANkm.js +0 -1
- package/dist/packem_shared/index-D76f4ee8.js +0 -83
- package/dist/rollup/build-types.d.ts +0 -5
- package/dist/rollup/build.d.ts +0 -5
- package/dist/rollup/get-rollup-options.d.ts +0 -5
- package/dist/rollup/plugins/externalize-dependencies.d.ts +0 -28
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +0 -1
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.js +0 -1
- package/dist/rollup/plugins/resolve-externals-plugin.d.ts +0 -62
- package/dist/rollup/plugins/resolve-implicit-externals.d.ts +0 -21
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +0 -1
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.js +0 -1
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +0 -1
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +0 -1
- package/dist/rollup/utils/resolve-aliases.d.ts +0 -4
- package/dist/rollup/watch.d.ts +0 -5
- package/dist/types.d.ts +0 -335
- package/dist/utils/clean-distribution-directories.d.ts +0 -4
- package/dist/utils/create-defu-with-hooks-merger.d.ts +0 -14
- package/dist/utils/create-or-update-key-storage.d.ts +0 -3
- package/dist/utils/extract-export-filenames.d.ts +0 -16
- package/dist/utils/find-alternatives.d.ts +0 -2
- package/dist/utils/get-package-side-effect.d.ts +0 -3
- package/dist/utils/import-specifier.d.ts +0 -20
- package/dist/utils/infer-export-type.d.ts +0 -3
- package/dist/utils/kill-process.d.ts +0 -14
- package/dist/utils/log-build-errors.d.ts +0 -4
- package/dist/utils/remove-old-cache-folders.d.ts +0 -3
- package/dist/utils/warn-legacy-cjs.d.ts +0 -8
- package/dist/validator/attw.d.ts +0 -7
- package/dist/validator/package-json/index.d.ts +0 -4
- package/dist/validator/package-json/validate-dependencies.d.ts +0 -4
- package/dist/validator/package-json/validate-engines.d.ts +0 -4
- package/dist/validator/package-json/validate-package-entries.d.ts +0 -4
- package/dist/validator/package-json/validate-package-fields.d.ts +0 -4
- package/dist/validator/validate-alias-entries.d.ts +0 -3
- package/dist/validator/validate-bundle-size.d.ts +0 -4
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
import { CheckPackageOptions } from '@arethetypeswrong/core';
|
|
2
|
+
import { PackemRollupOptions, TransformerFn, TransformerName } from '@visulima/packem-rollup';
|
|
3
|
+
import { InternalOXCTransformPluginConfig } from '@visulima/packem-rollup/oxc';
|
|
4
|
+
import { NativeModulesOptions } from '@visulima/packem-rollup/plugin/native-modules';
|
|
5
|
+
import { Environment, Runtime, BuildContext, Format, BuildHooks, Mode } from '@visulima/packem-share/types';
|
|
6
|
+
import { FileCache } from '@visulima/packem-share/utils';
|
|
7
|
+
import { StyleOptions } from '@visulima/rollup-plugin-css';
|
|
8
|
+
import { JitiOptions } from 'jiti';
|
|
9
|
+
import 'rollup';
|
|
10
|
+
import { TypeDocOptions } from 'typedoc';
|
|
11
|
+
import '@visulima/pail';
|
|
12
|
+
type ExePlatform = "darwin" | "linux" | "win";
|
|
13
|
+
type ExeArch = "arm64" | "x64";
|
|
14
|
+
interface ExeTarget {
|
|
15
|
+
arch: ExeArch;
|
|
16
|
+
/**
|
|
17
|
+
* Node.js version to use for the executable.
|
|
18
|
+
*
|
|
19
|
+
* Accepts a valid semver string (e.g., `"25.7.0"`), or the special values
|
|
20
|
+
* `"latest"` / `"latest-lts"` which resolve the version automatically from
|
|
21
|
+
* {@link https://nodejs.org/dist/index.json}.
|
|
22
|
+
*
|
|
23
|
+
* The minimum required version is 25.7.0, which is when stable SEA support landed in Node.js.
|
|
24
|
+
*/
|
|
25
|
+
nodeVersion: "latest" | "latest-lts" | (string & {}) | `${string}.${string}.${string}`;
|
|
26
|
+
platform: ExePlatform;
|
|
27
|
+
}
|
|
28
|
+
interface ExeExtensionOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Cross-platform targets for building executables.
|
|
31
|
+
* When specified, builds an executable for each target platform/arch combination
|
|
32
|
+
* by downloading and caching the corresponding Node.js binary from nodejs.org.
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* targets: [
|
|
36
|
+
* { platform: "linux", arch: "x64", nodeVersion: "25.7.0" },
|
|
37
|
+
* { platform: "darwin", arch: "arm64", nodeVersion: "25.7.0" },
|
|
38
|
+
* { platform: "win", arch: "x64", nodeVersion: "25.7.0" },
|
|
39
|
+
* ]
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
targets?: ExeTarget[];
|
|
43
|
+
}
|
|
44
|
+
interface ExeChunk {
|
|
45
|
+
path: string;
|
|
46
|
+
type?: string;
|
|
47
|
+
}
|
|
48
|
+
interface SeaConfig {
|
|
49
|
+
/** Optional, embedded asset mappings. */
|
|
50
|
+
assets?: Record<string, string>;
|
|
51
|
+
/** @default true */
|
|
52
|
+
disableExperimentalSEAWarning?: boolean;
|
|
53
|
+
/** Extra Node.js CLI arguments embedded into the executable. */
|
|
54
|
+
execArgv?: string[];
|
|
55
|
+
/** @default "env" */
|
|
56
|
+
execArgvExtension?: "cli" | "env" | "none";
|
|
57
|
+
/** Optional; if not specified, uses the current Node.js binary. */
|
|
58
|
+
executable?: string;
|
|
59
|
+
main?: string;
|
|
60
|
+
mainFormat?: "commonjs" | "module";
|
|
61
|
+
output?: string;
|
|
62
|
+
/** @default false */
|
|
63
|
+
useCodeCache?: boolean;
|
|
64
|
+
/** @default false */
|
|
65
|
+
useSnapshot?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface ExeOptions extends ExeExtensionOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Output file name without any suffix or extension.
|
|
70
|
+
* For example, do not include `.exe`, platform suffixes, or architecture suffixes.
|
|
71
|
+
*/
|
|
72
|
+
fileName?: ((chunk: ExeChunk) => string) | string;
|
|
73
|
+
/**
|
|
74
|
+
* Output directory for executables.
|
|
75
|
+
* @default "build"
|
|
76
|
+
*/
|
|
77
|
+
outDir?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Node.js SEA configuration passthrough.
|
|
80
|
+
* @see https://nodejs.org/api/single-executable-applications.html#generating-single-executable-applications-with---build-sea
|
|
81
|
+
*/
|
|
82
|
+
seaConfig?: Omit<SeaConfig, "main" | "mainFormat" | "output">;
|
|
83
|
+
}
|
|
84
|
+
type Node10CompatibilityOptions = {
|
|
85
|
+
typeScriptVersion?: string;
|
|
86
|
+
writeToPackageJson?: boolean;
|
|
87
|
+
};
|
|
88
|
+
type MaybeFalsy<T> = T | false | null | undefined;
|
|
89
|
+
type ResolveExternalsPluginOptions = {
|
|
90
|
+
/**
|
|
91
|
+
* Mark node built-in modules like `path`, `fs`... as external.
|
|
92
|
+
*
|
|
93
|
+
* Set the builtins option to false if you'd like to use some shims/polyfills for those.
|
|
94
|
+
*
|
|
95
|
+
* How to handle the node: scheme used in recent versions of Node (i.e., import path from 'node:path').
|
|
96
|
+
* If add (the default, recommended), the node: scheme is always added. In effect, this dedupes your imports of Node builtins by homogenizing their names to their schemed version.
|
|
97
|
+
* If strip, the scheme is always removed. In effect, this dedupes your imports of Node builtins by homogenizing their names to their unschemed version. Schemed-only builtins like node:test are not stripped.
|
|
98
|
+
* ignore will simply leave all builtins imports as written in your code.
|
|
99
|
+
*
|
|
100
|
+
* Note that scheme handling is always applied, regardless of the builtins options being enabled or not.
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
builtins?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* node: prefix handing for importing Node builtins:
|
|
106
|
+
* - `'add'` turns `'path'` to `'node:path'`
|
|
107
|
+
* - `'strip'` turns `'node:path'` to `'path'`
|
|
108
|
+
* - `'ignore'` leaves Node builtin names as-is
|
|
109
|
+
* @default "add"
|
|
110
|
+
*/
|
|
111
|
+
builtinsPrefix?: "add" | "ignore" | "strip";
|
|
112
|
+
/**
|
|
113
|
+
* Mark dependencies as external.
|
|
114
|
+
*
|
|
115
|
+
* Defaults to `true`.
|
|
116
|
+
*/
|
|
117
|
+
deps?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Mark devDependencies as external.
|
|
120
|
+
*
|
|
121
|
+
* Defaults to `false`.
|
|
122
|
+
*/
|
|
123
|
+
devDeps?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Force exclude these deps from the list of externals, regardless of other settings.
|
|
126
|
+
*
|
|
127
|
+
* Defaults to `[]` (force exclude nothing).
|
|
128
|
+
*/
|
|
129
|
+
exclude?: MaybeFalsy<RegExp | string>[];
|
|
130
|
+
/**
|
|
131
|
+
* Mark optionalDependencies as external.
|
|
132
|
+
*
|
|
133
|
+
* Defaults to `true`.
|
|
134
|
+
*/
|
|
135
|
+
optDeps?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Mark peerDependencies as external.
|
|
138
|
+
*
|
|
139
|
+
* Defaults to `true`.
|
|
140
|
+
*/
|
|
141
|
+
peerDeps?: boolean;
|
|
142
|
+
};
|
|
143
|
+
type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
|
|
144
|
+
interface AttwOptions extends CheckPackageOptions {
|
|
145
|
+
/**
|
|
146
|
+
* Ignore the scripts on pack
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
149
|
+
ignoreScripts?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* The level of the check.
|
|
152
|
+
*
|
|
153
|
+
* The available levels are:
|
|
154
|
+
* - `error`: fails the build
|
|
155
|
+
* - `warn`: warns the build
|
|
156
|
+
* @default 'warn'
|
|
157
|
+
*/
|
|
158
|
+
level?: "error" | "warn";
|
|
159
|
+
/**
|
|
160
|
+
* Specify the package manager to use for --pack
|
|
161
|
+
* Bun does not support --json option on the pack command, if you choose bun you will get a error.
|
|
162
|
+
* @default 'auto'
|
|
163
|
+
*/
|
|
164
|
+
pm?: "pnpm" | "yarn" | "npm" | "bun" | "auto";
|
|
165
|
+
/**
|
|
166
|
+
* Profiles select a set of resolution modes to require/ignore. All are evaluated but failures outside
|
|
167
|
+
* of those required are ignored.
|
|
168
|
+
*
|
|
169
|
+
* The available profiles are:
|
|
170
|
+
* - `strict`: requires all resolutions
|
|
171
|
+
* - `node16`: ignores node10 resolution failures
|
|
172
|
+
* - `esmOnly`: ignores CJS resolution failures
|
|
173
|
+
* @default 'strict'
|
|
174
|
+
*/
|
|
175
|
+
profile?: "strict" | "node16" | "esmOnly";
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* In addition to basic `entries`, `presets`, and `hooks`,
|
|
179
|
+
* there are also all the properties of `BuildOptions` except for BuildOption's `entries`.
|
|
180
|
+
*/
|
|
181
|
+
interface BuildConfig extends DeepPartial<Omit<BuildOptions, "entries">> {
|
|
182
|
+
entries?: (BuildEntry | string)[];
|
|
183
|
+
envFile?: string;
|
|
184
|
+
envPrefix?: string;
|
|
185
|
+
hooks?: Partial<BuildHooks<InternalBuildOptions>>;
|
|
186
|
+
preset?: BuildPreset | "none" | (NonNullable<unknown> & string);
|
|
187
|
+
}
|
|
188
|
+
type BuildPreset = BuildConfig | (() => BuildConfig);
|
|
189
|
+
/**
|
|
190
|
+
* Function type for dynamic build configuration.
|
|
191
|
+
* Allows configuration to be generated based on environment and mode.
|
|
192
|
+
* @param environment The build environment (development/production)
|
|
193
|
+
* @param mode The build mode (build/watch)
|
|
194
|
+
* @returns Build configuration object or Promise resolving to one
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
|
+
type BuildConfigFunction = (environment: Environment, mode: Mode) => BuildConfig | Promise<BuildConfig>;
|
|
198
|
+
type BuildEntry = {
|
|
199
|
+
/** Whether to generate CommonJS output for this entry */
|
|
200
|
+
cjs?: boolean;
|
|
201
|
+
/** TypeScript declaration file generation mode */
|
|
202
|
+
declaration?: boolean | "compatible" | "node16";
|
|
203
|
+
/** Whether to generate .d.cts declaration file without triggering CJS JS build */
|
|
204
|
+
declarationCjs?: boolean;
|
|
205
|
+
/** Whether to generate .d.mts declaration file without triggering ESM JS build */
|
|
206
|
+
declarationEsm?: boolean;
|
|
207
|
+
/** Build environment for this entry */
|
|
208
|
+
environment?: Environment;
|
|
209
|
+
/** Whether to generate ESM output for this entry */
|
|
210
|
+
esm?: boolean;
|
|
211
|
+
/** Whether this entry should be marked as executable */
|
|
212
|
+
executable?: true;
|
|
213
|
+
/** Set of export keys to include for this entry */
|
|
214
|
+
exportKey?: Set<string>;
|
|
215
|
+
/** Alternative filename for the output file */
|
|
216
|
+
fileAlias?: string;
|
|
217
|
+
/** Input file path for this entry */
|
|
218
|
+
input: string;
|
|
219
|
+
/** Whether the input is a glob pattern */
|
|
220
|
+
isGlob?: boolean;
|
|
221
|
+
/** Name identifier for this entry */
|
|
222
|
+
name?: string;
|
|
223
|
+
/** Output directory for this entry */
|
|
224
|
+
outDir?: string;
|
|
225
|
+
/** Runtime environment for this entry */
|
|
226
|
+
runtime?: Runtime;
|
|
227
|
+
};
|
|
228
|
+
interface BuildOptions {
|
|
229
|
+
/** Path alias mappings for module resolution */
|
|
230
|
+
alias: Record<string, string>;
|
|
231
|
+
/** Whether to analyze bundle size and dependencies */
|
|
232
|
+
analyze?: boolean;
|
|
233
|
+
/** Browser targets for transpilation (e.g., ['chrome 58', 'firefox 57']) */
|
|
234
|
+
browserTargets?: string[];
|
|
235
|
+
/** Custom builder functions for different build types */
|
|
236
|
+
builder?: Record<string, (context: BuildContext<BuildOptions>, cachePath: string | undefined, fileCache: FileCache, logged: boolean) => Promise<void>>;
|
|
237
|
+
/** Whether to enable CommonJS interop for ESM modules */
|
|
238
|
+
cjsInterop?: boolean;
|
|
239
|
+
/** Whether to clean the output directory before building */
|
|
240
|
+
clean: boolean;
|
|
241
|
+
/** Whether to enable debug mode with verbose logging */
|
|
242
|
+
debug: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* `compatible` means "src/gather.ts" will generate "dist/index.d.mts", "dist/index.d.cts" and "dist/index.d.ts".
|
|
245
|
+
* `node16` means "src/gather.ts" will generate "dist/index.d.mts" and "dist/index.d.cts".
|
|
246
|
+
* `true` is equivalent to `compatible`.
|
|
247
|
+
* `false` will disable declaration generation.
|
|
248
|
+
* `undefined` will auto-detect based on "package.json". If "package.json" has "types" field, it will be `"compatible"`, otherwise `false`.
|
|
249
|
+
*/
|
|
250
|
+
declaration?: boolean | "compatible" | "node16" | undefined;
|
|
251
|
+
/**
|
|
252
|
+
* If `true`, only generate declaration files.
|
|
253
|
+
* If `false` or `undefined`, generate both declaration and source files.
|
|
254
|
+
*/
|
|
255
|
+
dtsOnly?: boolean;
|
|
256
|
+
/** Whether to emit CommonJS output */
|
|
257
|
+
emitCJS?: boolean;
|
|
258
|
+
/** Whether to emit ESM output */
|
|
259
|
+
emitESM?: boolean;
|
|
260
|
+
/** Build entry points */
|
|
261
|
+
entries: BuildEntry[];
|
|
262
|
+
/**
|
|
263
|
+
* Bundle the build output into a single standalone executable via Node.js SEA.
|
|
264
|
+
* Set to `true` to build for the current platform, or pass an options object
|
|
265
|
+
* for fine-grained control (cross-platform targets, SEA config, custom output name).
|
|
266
|
+
*
|
|
267
|
+
* Requires Node.js >= 25.7.0 at build time. Not supported in Bun or Deno.
|
|
268
|
+
* Automatically enforces a single entry point.
|
|
269
|
+
*/
|
|
270
|
+
exe?: boolean | ExeOptions;
|
|
271
|
+
/** Experimental features configuration */
|
|
272
|
+
experimental?: {
|
|
273
|
+
/**
|
|
274
|
+
* If `true`, the `oxc resolve` plugin will be used instead of the default `@rollup/plugin-node-resolve` and `@rollup/plugin-alias`.
|
|
275
|
+
*/
|
|
276
|
+
oxcResolve?: boolean;
|
|
277
|
+
};
|
|
278
|
+
/** External dependencies that should not be bundled */
|
|
279
|
+
externals: (RegExp | string)[];
|
|
280
|
+
/** Whether to fail the build on warnings */
|
|
281
|
+
failOnWarn?: boolean;
|
|
282
|
+
/** Whether to enable file caching for faster rebuilds */
|
|
283
|
+
fileCache?: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Array of export keys to ignore during entry inference.
|
|
286
|
+
* Useful for excluding exports that only contain images or other non-JavaScript assets.
|
|
287
|
+
* @example ["images", "assets", "icons"]
|
|
288
|
+
*/
|
|
289
|
+
ignoreExportKeys?: string[];
|
|
290
|
+
/**
|
|
291
|
+
* Jiti options, where [jiti](https://github.com/unjs/jiti) is used to load the entry files.
|
|
292
|
+
* @default { alias: {}, debug: false, interopDefault: true }
|
|
293
|
+
*/
|
|
294
|
+
jiti: Omit<JitiOptions & {
|
|
295
|
+
absoluteJitiPath?: boolean;
|
|
296
|
+
}, "onError" | "transform">;
|
|
297
|
+
/** Signal to use when killing child processes */
|
|
298
|
+
killSignal?: KillSignal;
|
|
299
|
+
/** Whether to minify the output */
|
|
300
|
+
minify?: boolean | undefined;
|
|
301
|
+
/** Name of the build */
|
|
302
|
+
name: string;
|
|
303
|
+
/** Node.js 10 compatibility options */
|
|
304
|
+
node10Compatibility?: Node10CompatibilityOptions | false;
|
|
305
|
+
/** Command to run or function to execute after successful build */
|
|
306
|
+
onSuccess?: string | (() => Promise<(() => Promise<void> | void) | undefined | void>);
|
|
307
|
+
/** Timeout for the onSuccess command in milliseconds */
|
|
308
|
+
onSuccessTimeout?: number;
|
|
309
|
+
/** Output directory for build artifacts */
|
|
310
|
+
outDir: string;
|
|
311
|
+
/** Custom file extensions for different output formats */
|
|
312
|
+
outputExtensionMap?: Record<Format, string>;
|
|
313
|
+
/** Rollup-specific build options */
|
|
314
|
+
rollup: RollupBuildOptions;
|
|
315
|
+
/** Root directory of the project */
|
|
316
|
+
rootDir: string;
|
|
317
|
+
/** Target runtime environment */
|
|
318
|
+
runtime?: "browser" | "node";
|
|
319
|
+
/** Source directory containing the source files */
|
|
320
|
+
sourceDir: string;
|
|
321
|
+
/** Whether to generate source maps */
|
|
322
|
+
sourcemap: boolean;
|
|
323
|
+
/** Transformer function for processing source files */
|
|
324
|
+
transformer: TransformerFn;
|
|
325
|
+
/** TypeDoc configuration for generating documentation */
|
|
326
|
+
typedoc: TypeDocumentOptions | false;
|
|
327
|
+
/**
|
|
328
|
+
* If `true`, enables unbundle mode which preserves the source file structure.
|
|
329
|
+
* Instead of bundling everything into a single file, each module is output as a separate file
|
|
330
|
+
* maintaining the original directory structure.
|
|
331
|
+
* @default false
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* // With unbundle: true
|
|
335
|
+
* // src/index.ts exports from './a/indexA', './b/indexB'
|
|
336
|
+
* // Output: dist/index.js, dist/a/indexA.js, dist/b/indexB.js
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
unbundle?: boolean;
|
|
340
|
+
/** Validation options for the build */
|
|
341
|
+
validation?: ValidationOptions | false;
|
|
342
|
+
}
|
|
343
|
+
interface InternalBuildOptions extends BuildOptions {
|
|
344
|
+
/** Rollup options with internal OXC configuration */
|
|
345
|
+
rollup: BuildOptions["rollup"] & {
|
|
346
|
+
nativeModules?: NativeModulesOptions | false;
|
|
347
|
+
oxc?: InternalOXCTransformPluginConfig;
|
|
348
|
+
};
|
|
349
|
+
/** Name of the transformer being used */
|
|
350
|
+
transformerName: TransformerName | undefined;
|
|
351
|
+
}
|
|
352
|
+
/** Valid kill signals for terminating child processes */
|
|
353
|
+
type KillSignal = "SIGKILL" | "SIGTERM";
|
|
354
|
+
interface RollupBuildOptions extends PackemRollupOptions {
|
|
355
|
+
/** CSS processing options or false to disable */
|
|
356
|
+
css?: StyleOptions | false;
|
|
357
|
+
/** External dependency resolution plugin options */
|
|
358
|
+
resolveExternals?: ResolveExternalsPluginOptions;
|
|
359
|
+
}
|
|
360
|
+
type TypeDocumentOptions = Partial<Omit<TypeDocOptions, "entryPoints" | "hideGenerator" | "out" | "preserveWatchOutput" | "watch">> & {
|
|
361
|
+
/**
|
|
362
|
+
* The format of the output.
|
|
363
|
+
* @default "html"
|
|
364
|
+
*/
|
|
365
|
+
format?: "html" | "inline" | "json" | "markdown";
|
|
366
|
+
/**
|
|
367
|
+
* The name of the JSON file.
|
|
368
|
+
*/
|
|
369
|
+
jsonFileName?: string;
|
|
370
|
+
/**
|
|
371
|
+
* A marker to replace the content within the file on the correct location.
|
|
372
|
+
* @default "TYPEDOC" This marker need to be placed in the readme <!-- TYPEDOC --><!-- TYPEDOC -->
|
|
373
|
+
*/
|
|
374
|
+
marker?: string;
|
|
375
|
+
/**
|
|
376
|
+
* The path of the output directory.
|
|
377
|
+
*/
|
|
378
|
+
output?: string;
|
|
379
|
+
/**
|
|
380
|
+
* The path of the README file.
|
|
381
|
+
*/
|
|
382
|
+
readmePath?: string;
|
|
383
|
+
};
|
|
384
|
+
type ValidationOptions = {
|
|
385
|
+
/**
|
|
386
|
+
* Run `arethetypeswrong` after bundling.
|
|
387
|
+
* Requires `@arethetypeswrong/core` to be installed.
|
|
388
|
+
* @default false
|
|
389
|
+
* @see https://github.com/arethetypeswrong/arethetypeswrong.github.io
|
|
390
|
+
*/
|
|
391
|
+
attw?: boolean | AttwOptions;
|
|
392
|
+
/** Bundle size validation options */
|
|
393
|
+
bundleLimit?: {
|
|
394
|
+
/** Allow the build to succeed even if limits are exceeded */
|
|
395
|
+
allowFail?: boolean;
|
|
396
|
+
/**
|
|
397
|
+
* Bundle size limit in bytes, or string with unit (e.g., "1MB", "500KB")
|
|
398
|
+
* @example
|
|
399
|
+
* - "1MB"
|
|
400
|
+
* - "500KB"
|
|
401
|
+
* - 1048576 // 1MB in bytes
|
|
402
|
+
*/
|
|
403
|
+
limit?: number | `${number}${"B" | "GB" | "KB" | "MB" | "TB"}`;
|
|
404
|
+
/** Size limits for specific files or globs */
|
|
405
|
+
limits?: Record<string, number | `${number}${"B" | "GB" | "KB" | "MB" | "TB"}`>;
|
|
406
|
+
};
|
|
407
|
+
/** Dependency validation options */
|
|
408
|
+
dependencies: {
|
|
409
|
+
/** Hoisted dependency validation with exclusions */
|
|
410
|
+
hoisted: {
|
|
411
|
+
exclude: string[];
|
|
412
|
+
} | false;
|
|
413
|
+
/** Unused dependency validation with exclusions */
|
|
414
|
+
unused: {
|
|
415
|
+
exclude: string[];
|
|
416
|
+
} | false;
|
|
417
|
+
} | false;
|
|
418
|
+
/** Package.json validation options */
|
|
419
|
+
packageJson?: {
|
|
420
|
+
/** Allowed file extensions in exports field */
|
|
421
|
+
allowedExportExtensions?: string[];
|
|
422
|
+
/** Whether to validate the bin field */
|
|
423
|
+
bin?: boolean;
|
|
424
|
+
/** Whether to validate dependencies */
|
|
425
|
+
dependencies?: boolean;
|
|
426
|
+
/** Whether to validate the engines field */
|
|
427
|
+
engines?: boolean;
|
|
428
|
+
/** Whether to validate the exports field */
|
|
429
|
+
exports?: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Additional custom conditions to consider valid in exports field validation.
|
|
432
|
+
* These will be added to the standard and community conditions.
|
|
433
|
+
* @example ["custom", "my-bundler"]
|
|
434
|
+
*/
|
|
435
|
+
extraConditions?: string[];
|
|
436
|
+
/** Whether to validate the files field */
|
|
437
|
+
files?: boolean;
|
|
438
|
+
/** Whether to validate the main field */
|
|
439
|
+
main?: boolean;
|
|
440
|
+
/** Whether to validate the module field */
|
|
441
|
+
module?: boolean;
|
|
442
|
+
/** Whether to validate the name field */
|
|
443
|
+
name?: boolean;
|
|
444
|
+
/** Whether to validate the sideEffects field */
|
|
445
|
+
sideEffects?: boolean;
|
|
446
|
+
/** Whether to validate the types field */
|
|
447
|
+
types?: boolean;
|
|
448
|
+
/** Whether to validate the typesVersions field */
|
|
449
|
+
typesVersions?: boolean;
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
export { BuildConfig as B, InternalBuildOptions as I, RollupBuildOptions as R, BuildEntry as a, BuildOptions as b, BuildConfigFunction as c, BuildPreset as d };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/loader/less';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/loader/lightningcss';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/loader/postcss';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/loader/sass';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/loader/sourcemap';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/loader/stylus';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/loader/tailwindcss';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/minifier/cssnano';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from '@visulima/rollup-plugin-css/minifier/lightningcss';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { esbuildPlugin as default } from "@visulima/packem-rollup/esbuild";
|
|
1
|
+
export { EsbuildPluginConfig, esbuildPlugin as default } from '@visulima/packem-rollup/esbuild';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { oxcTransformPlugin as default } from "@visulima/packem-rollup/oxc";
|
|
1
|
+
export { oxcTransformPlugin as default } from '@visulima/packem-rollup/oxc';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { sucrasePlugin as default } from "@visulima/packem-rollup/sucrase";
|
|
1
|
+
export { SucrasePluginConfig, sucrasePlugin as default } from '@visulima/packem-rollup/sucrase';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { swcPlugin as default } from "@visulima/packem-rollup/swc";
|
|
1
|
+
export { SwcPluginConfig, swcPlugin as default } from '@visulima/packem-rollup/swc';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/packem",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.64",
|
|
4
4
|
"description": "A fast and modern bundler for Node.js and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -134,18 +134,6 @@
|
|
|
134
134
|
"types": "./dist/rollup/plugins/css/minifiers/lightningcss.d.ts",
|
|
135
135
|
"default": "./dist/rollup/plugins/css/minifiers/lightningcss.js"
|
|
136
136
|
},
|
|
137
|
-
"./dts/isolated/transformer/swc": {
|
|
138
|
-
"types": "./dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts",
|
|
139
|
-
"default": "./dist/rollup/plugins/swc/isolated-declarations-swc-transformer.js"
|
|
140
|
-
},
|
|
141
|
-
"./dts/isolated/transformer/oxc": {
|
|
142
|
-
"types": "./dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts",
|
|
143
|
-
"default": "./dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.js"
|
|
144
|
-
},
|
|
145
|
-
"./dts/isolated/transformer/typescript": {
|
|
146
|
-
"types": "./dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts",
|
|
147
|
-
"default": "./dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js"
|
|
148
|
-
},
|
|
149
137
|
"./transformer/esbuild": {
|
|
150
138
|
"types": "./dist/rollup/plugins/esbuild/index.d.ts",
|
|
151
139
|
"default": "./dist/rollup/plugins/esbuild/index.js"
|
|
@@ -185,20 +173,20 @@
|
|
|
185
173
|
"@antfu/install-pkg": "1.1.0",
|
|
186
174
|
"@clack/prompts": "1.2.0",
|
|
187
175
|
"@rollup/pluginutils": "5.3.0",
|
|
188
|
-
"@visulima/cerebro": "
|
|
189
|
-
"@visulima/colorize": "
|
|
190
|
-
"@visulima/find-cache-dir": "
|
|
191
|
-
"@visulima/fs": "
|
|
192
|
-
"@visulima/humanizer": "
|
|
193
|
-
"@visulima/package": "
|
|
194
|
-
"@visulima/packem-rollup": "1.0.0-alpha.
|
|
195
|
-
"@visulima/packem-share": "1.0.0-alpha.
|
|
196
|
-
"@visulima/pail": "
|
|
197
|
-
"@visulima/path": "
|
|
198
|
-
"@visulima/rollup-plugin-css": "1.0.0-alpha.
|
|
199
|
-
"@visulima/rollup-plugin-dts": "1.0.0-alpha.
|
|
200
|
-
"@visulima/tabular": "
|
|
201
|
-
"@visulima/tsconfig": "
|
|
176
|
+
"@visulima/cerebro": "3.0.0-alpha.11",
|
|
177
|
+
"@visulima/colorize": "2.0.0-alpha.10",
|
|
178
|
+
"@visulima/find-cache-dir": "3.0.0-alpha.9",
|
|
179
|
+
"@visulima/fs": "5.0.0-alpha.12",
|
|
180
|
+
"@visulima/humanizer": "3.0.0-alpha.11",
|
|
181
|
+
"@visulima/package": "5.0.0-alpha.11",
|
|
182
|
+
"@visulima/packem-rollup": "1.0.0-alpha.51",
|
|
183
|
+
"@visulima/packem-share": "1.0.0-alpha.32",
|
|
184
|
+
"@visulima/pail": "4.0.0-alpha.11",
|
|
185
|
+
"@visulima/path": "3.0.0-alpha.10",
|
|
186
|
+
"@visulima/rollup-plugin-css": "1.0.0-alpha.31",
|
|
187
|
+
"@visulima/rollup-plugin-dts": "1.0.0-alpha.12",
|
|
188
|
+
"@visulima/tabular": "4.0.0-alpha.11",
|
|
189
|
+
"@visulima/tsconfig": "3.0.0-alpha.11",
|
|
202
190
|
"browserslist": "4.28.2",
|
|
203
191
|
"defu": "6.1.7",
|
|
204
192
|
"fastest-levenshtein": "1.0.16",
|
|
@@ -206,7 +194,7 @@
|
|
|
206
194
|
"jiti": "2.6.1",
|
|
207
195
|
"magic-string": "0.30.21",
|
|
208
196
|
"mlly": "1.8.2",
|
|
209
|
-
"oxc-transform": "
|
|
197
|
+
"oxc-transform": "0.127.0",
|
|
210
198
|
"picomatch": "4.0.4",
|
|
211
199
|
"rollup": "4.60.1",
|
|
212
200
|
"rollup-plugin-import-trace": "1.0.1",
|
|
@@ -224,7 +212,6 @@
|
|
|
224
212
|
"icss-utils": ">=5.1.0",
|
|
225
213
|
"less": ">=4.2.0",
|
|
226
214
|
"lightningcss": ">=1.27.0",
|
|
227
|
-
"oxc-transform": ">=0.20.0",
|
|
228
215
|
"package-manager-detector": "^1.6.0",
|
|
229
216
|
"postcss": ">=8.4.47",
|
|
230
217
|
"postcss-load-config": ">=6.0.1",
|
|
@@ -278,9 +265,6 @@
|
|
|
278
265
|
"lightningcss": {
|
|
279
266
|
"optional": true
|
|
280
267
|
},
|
|
281
|
-
"oxc-transform": {
|
|
282
|
-
"optional": true
|
|
283
|
-
},
|
|
284
268
|
"postcss": {
|
|
285
269
|
"optional": true
|
|
286
270
|
},
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Pail } from "@visulima/pail";
|
|
2
|
-
import type { BuildEntry, TypeDocumentOptions } from "../../types.d.ts";
|
|
3
|
-
declare const generateReferenceDocumentation: (options: TypeDocumentOptions, entries: BuildEntry[], outputDirectory: string, logger: Pail) => Promise<void>;
|
|
4
|
-
export default generateReferenceDocumentation;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Cli } from "@visulima/cerebro";
|
|
2
|
-
/**
|
|
3
|
-
* Creates and registers the build command with the CLI.
|
|
4
|
-
* Handles various build modes, environment variables, and build configurations.
|
|
5
|
-
* @param cli CLI instance to register the command with
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* // Usage from command line:
|
|
9
|
-
* // Build for production:
|
|
10
|
-
* // packem build --production
|
|
11
|
-
*
|
|
12
|
-
* // Watch mode with development environment:
|
|
13
|
-
* // packem build --watch --development
|
|
14
|
-
*
|
|
15
|
-
* // With custom environment variables:
|
|
16
|
-
* // packem build --env.API_URL=http://api.example.com
|
|
17
|
-
* ```
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
declare const createBuildCommand: (cli: Cli<Console>) => void;
|
|
21
|
-
export default createBuildCommand;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Cli } from "@visulima/cerebro";
|
|
2
|
-
/**
|
|
3
|
-
* Creates and registers the migrate command with the CLI.
|
|
4
|
-
* Handles migration from other bundlers (tsup, unbuild, bunchee, etc.) to packem.
|
|
5
|
-
* @param cli CLI instance to register the command with
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* // From command line:
|
|
9
|
-
* // Migrate from tsup to packem:
|
|
10
|
-
* // packem migrate
|
|
11
|
-
*
|
|
12
|
-
* // Dry run to preview changes:
|
|
13
|
-
* // packem migrate --dry-run
|
|
14
|
-
*
|
|
15
|
-
* // Specify custom directory:
|
|
16
|
-
* // packem migrate --cwd /path/to/project
|
|
17
|
-
* ```
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
declare const createMigrateCommand: (cli: Cli<Console>) => void;
|
|
21
|
-
export default createMigrateCommand;
|