@hypernym/bundler 0.31.0 → 0.31.2
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/LICENSE.txt +2 -2
- package/dist/bin/index.js +1 -1
- package/dist/build/index.js +2 -1
- package/dist/index.d.ts +457 -457
- package/package.json +9 -9
package/LICENSE.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
4
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026, Ivo Dolenc <https://github.com/ivodolenc>
|
|
4
|
+
Copyright (c) 2026, Hypernym Studio <https://github.com/hypernym-studio>
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/bin/index.js
CHANGED
package/dist/build/index.js
CHANGED
|
@@ -140,9 +140,10 @@ async function build(options) {
|
|
|
140
140
|
...entry.dtsPlugin,
|
|
141
141
|
emitDtsOnly: true
|
|
142
142
|
})],
|
|
143
|
+
checks: { pluginTimings: false },
|
|
143
144
|
onLog: (level, log, handler) => {
|
|
144
145
|
if (entry.onLog) entry.onLog(level, log, handler, buildLogs);
|
|
145
|
-
else
|
|
146
|
+
else buildLogs.push({
|
|
146
147
|
level,
|
|
147
148
|
log
|
|
148
149
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -11,232 +11,232 @@ interface BuildLogs {
|
|
|
11
11
|
}
|
|
12
12
|
interface BuildEntryStats {
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* The root path of the project.
|
|
15
|
+
*/
|
|
16
16
|
cwd: string;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* Module output path.
|
|
19
|
+
*/
|
|
20
20
|
path: string;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* Module size.
|
|
23
|
+
*/
|
|
24
24
|
size: number;
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
* Build time of individual module.
|
|
27
|
+
*/
|
|
28
28
|
buildTime: number;
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
* Module format.
|
|
31
|
+
*/
|
|
32
32
|
format: string;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
* List of warnings from build plugins.
|
|
35
|
+
*/
|
|
36
36
|
logs: BuildLogs[];
|
|
37
37
|
}
|
|
38
38
|
interface BuildStats {
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
* The root path of the project.
|
|
41
|
+
*/
|
|
42
42
|
cwd: string;
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
* Final bundle size.
|
|
45
|
+
*/
|
|
46
46
|
size: number;
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
* Total bundle build time.
|
|
49
|
+
*/
|
|
50
50
|
buildTime: number;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
* List of generated bundle modules.
|
|
53
|
+
*/
|
|
54
54
|
files: BuildEntryStats[];
|
|
55
55
|
}
|
|
56
56
|
type PickEntryChunkOptions = 'input' | 'name' | 'globals' | 'extend' | 'minify';
|
|
57
57
|
type PickEntryDtsOptions = 'dts' | 'dtsPlugin';
|
|
58
58
|
interface BuildEntryOptions extends EntryBase, Partial<Pick<EntryChunk, PickEntryChunkOptions>>, Partial<Pick<EntryDts, PickEntryDtsOptions>> {
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
* Specifies the path to the processed file.
|
|
61
|
+
*
|
|
62
|
+
* @default undefined
|
|
63
|
+
*/
|
|
64
64
|
output?: string;
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/types/entries.d.ts
|
|
68
68
|
interface EntryBase {
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
* Specifies the format of the generated module.
|
|
71
|
+
*
|
|
72
|
+
* - `'es'`, `'esm'` and `'module'` are the same format, all stand for ES module.
|
|
73
|
+
* - `'cjs'` and `'commonjs'` are the same format, all stand for CommonJS module.
|
|
74
|
+
* - `'iife'` stands for [Immediately Invoked Function Expression](https://developer.mozilla.org/en-US/docs/Glossary/IIFE).
|
|
75
|
+
* - `'umd'` stands for [Universal Module Definition](https://github.com/umdjs/umd).
|
|
76
|
+
*
|
|
77
|
+
* @default 'esm'
|
|
78
|
+
*/
|
|
79
79
|
format?: OutputOptions['format'];
|
|
80
80
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
* Specifies the module IDs or regular expressions that match module IDs to be treated as external and excluded from the bundle.
|
|
82
|
+
*
|
|
83
|
+
* The IDs and regular expressions provided in this option are applied globally across all entries.
|
|
84
|
+
*
|
|
85
|
+
* Alternatively, externals can be defined individually for each entry using the `entry.externals` property.
|
|
86
|
+
*
|
|
87
|
+
* @default undefined
|
|
88
|
+
*/
|
|
89
89
|
externals?: (string | RegExp)[];
|
|
90
90
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
* Maps external module IDs to paths.
|
|
92
|
+
*
|
|
93
|
+
* @default undefined
|
|
94
|
+
*/
|
|
95
95
|
paths?: {
|
|
96
96
|
find: string | RegExp;
|
|
97
97
|
replacement: string | ((path: string, match: RegExpExecArray | null) => string);
|
|
98
98
|
}[];
|
|
99
99
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
* Specifies the string to be inserted at the beginning of the module.
|
|
101
|
+
*
|
|
102
|
+
* @default undefined
|
|
103
|
+
*/
|
|
104
104
|
banner?: OutputOptions['banner'];
|
|
105
105
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
* Specifies the string to be inserted at the beginning of the module after minification
|
|
107
|
+
*
|
|
108
|
+
* @default undefined
|
|
109
|
+
*/
|
|
110
110
|
postBanner?: OutputOptions['postBanner'];
|
|
111
111
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
* Specifies the string to be inserted at the end of the module.
|
|
113
|
+
*
|
|
114
|
+
* @default undefined
|
|
115
|
+
*/
|
|
116
116
|
footer?: OutputOptions['footer'];
|
|
117
117
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
* Specifies the string to be inserted at the end of the module after minification.
|
|
119
|
+
*
|
|
120
|
+
* @default undefined
|
|
121
|
+
*/
|
|
122
122
|
postFooter?: OutputOptions['postFooter'];
|
|
123
123
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
* Specifies the code at the beginning that goes inside any _format-specific_ wrapper.
|
|
125
|
+
*
|
|
126
|
+
* @default undefined
|
|
127
|
+
*/
|
|
128
128
|
intro?: OutputOptions['intro'];
|
|
129
129
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
* Specifies the code at the end that goes inside any _format-specific_ wrapper.
|
|
131
|
+
*
|
|
132
|
+
* @default undefined
|
|
133
|
+
*/
|
|
134
134
|
outro?: OutputOptions['outro'];
|
|
135
135
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
* Intercepts log messages. If not supplied, logs are printed to the console.
|
|
137
|
+
*
|
|
138
|
+
* @default undefined
|
|
139
|
+
*/
|
|
140
140
|
onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler, buildLogs: BuildLogs[]) => void;
|
|
141
141
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
* Specifies Rolldown `resolve` options.
|
|
143
|
+
*
|
|
144
|
+
* @default undefined
|
|
145
|
+
*/
|
|
146
146
|
resolve?: InputOptions['resolve'];
|
|
147
147
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
* Specifies Rolldown `define` options.
|
|
149
|
+
*
|
|
150
|
+
* @default undefined
|
|
151
|
+
*/
|
|
152
152
|
define?: NonNullable<InputOptions['transform']>['define'];
|
|
153
153
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
* Specifies Rolldown `inject` options.
|
|
155
|
+
*
|
|
156
|
+
* @default undefined
|
|
157
|
+
*/
|
|
158
158
|
inject?: NonNullable<InputOptions['transform']>['inject'];
|
|
159
159
|
/**
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
* Specifies Rolldown plugins.
|
|
161
|
+
*
|
|
162
|
+
* @default undefined
|
|
163
|
+
*/
|
|
164
164
|
plugins?: RolldownPluginOption;
|
|
165
165
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
* Specifies the path to the `tsconfig` file.
|
|
167
|
+
*
|
|
168
|
+
* By default, if the file `tsconfig.json` exists in the project root, it will be used as the default config file.
|
|
169
|
+
*
|
|
170
|
+
* @default undefined
|
|
171
|
+
*/
|
|
172
172
|
tsconfig?: InputOptions['tsconfig'];
|
|
173
173
|
}
|
|
174
174
|
interface EntryChunk extends EntryBase {
|
|
175
175
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
176
|
+
* Specifies the path to the build source.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
*
|
|
180
|
+
* ```ts
|
|
181
|
+
* export default defineConfig({
|
|
182
|
+
* entries: [
|
|
183
|
+
* { input: './src/index.ts' }, // outputs './dist/index.js'
|
|
184
|
+
* ]
|
|
185
|
+
* })
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
188
|
input: string;
|
|
189
189
|
/**
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
190
|
+
* Specifies the path to the processed file.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
*
|
|
194
|
+
* ```ts
|
|
195
|
+
* export default defineConfig({
|
|
196
|
+
* entries: [
|
|
197
|
+
* {
|
|
198
|
+
* input: './src/index.ts',
|
|
199
|
+
* output: './out/index.js', // outputs './out/index.js'
|
|
200
|
+
* },
|
|
201
|
+
* ]
|
|
202
|
+
* })
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* @default undefined
|
|
206
|
+
*/
|
|
207
207
|
output?: string;
|
|
208
208
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
* Specifies the global variable name that representing exported bundle.
|
|
210
|
+
*
|
|
211
|
+
* Intended for `umd/iife` formats.
|
|
212
|
+
*
|
|
213
|
+
* @default undefined
|
|
214
|
+
*/
|
|
215
215
|
name?: OutputOptions['name'];
|
|
216
216
|
/**
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
217
|
+
* Specifies global _module ID_ and _variable name_ pairs necessary for external imports.
|
|
218
|
+
*
|
|
219
|
+
* Intended for `umd/iife` formats.
|
|
220
|
+
*
|
|
221
|
+
* @default undefined
|
|
222
|
+
*/
|
|
223
223
|
globals?: OutputOptions['globals'];
|
|
224
224
|
/**
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
* Specifies whether to extend the global variable defined by the `name` option.
|
|
226
|
+
*
|
|
227
|
+
* Intended for `umd/iife` formats.
|
|
228
|
+
*/
|
|
229
229
|
extend?: OutputOptions['extend'];
|
|
230
230
|
/**
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
231
|
+
* Controls code minification.
|
|
232
|
+
*
|
|
233
|
+
* - `true`: Enable full minification including code compression and dead code elimination.
|
|
234
|
+
* - `false`: Disable minification (default).
|
|
235
|
+
* - `'dce-only'`: Only perform dead code elimination without code compression.
|
|
236
|
+
* - `MinifyOptions`: Fine-grained control over minification settings.
|
|
237
|
+
*
|
|
238
|
+
* @default undefined
|
|
239
|
+
*/
|
|
240
240
|
minify?: OutputOptions['minify'];
|
|
241
241
|
dts?: never;
|
|
242
242
|
dtsPlugin?: never;
|
|
@@ -247,41 +247,41 @@ interface EntryChunk extends EntryBase {
|
|
|
247
247
|
}
|
|
248
248
|
interface EntryDts extends EntryBase {
|
|
249
249
|
/**
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
250
|
+
* Specifies the path to the TypeScript `declaration` build source.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
*
|
|
254
|
+
* ```ts
|
|
255
|
+
* export default defineConfig({
|
|
256
|
+
* entries: [
|
|
257
|
+
* { dts: './src/types.ts' }, // outputs './dist/types.d.ts'
|
|
258
|
+
* ]
|
|
259
|
+
* })
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
262
|
dts: string;
|
|
263
263
|
/**
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
264
|
+
* Specifies the path to the processed file.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
*
|
|
268
|
+
* ```ts
|
|
269
|
+
* export default defineConfig({
|
|
270
|
+
* entries: [
|
|
271
|
+
* {
|
|
272
|
+
* dts: './src/types.ts',
|
|
273
|
+
* output: './out/types.d.ts', // outputs './out/types.d.ts'
|
|
274
|
+
* },
|
|
275
|
+
* ]
|
|
276
|
+
* })
|
|
277
|
+
* ```
|
|
278
|
+
*
|
|
279
|
+
* @default undefined
|
|
280
|
+
*/
|
|
281
281
|
output?: string;
|
|
282
282
|
/**
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
* Specifies options for the `rolldown-plugin-dts` plugin.
|
|
284
|
+
*/
|
|
285
285
|
dtsPlugin?: Options$1;
|
|
286
286
|
input?: never;
|
|
287
287
|
name?: never;
|
|
@@ -295,53 +295,53 @@ interface EntryDts extends EntryBase {
|
|
|
295
295
|
}
|
|
296
296
|
interface EntryCopy {
|
|
297
297
|
/**
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
298
|
+
* Copies either a single `file` or an entire `directory` structure from the source to the destination, including all subdirectories and files.
|
|
299
|
+
*
|
|
300
|
+
* This is especially useful for transferring assets that don't require any transformation, just a straightforward copy-paste operation.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
*
|
|
304
|
+
* ```ts
|
|
305
|
+
* export default defineConfig({
|
|
306
|
+
* entries: [
|
|
307
|
+
* {
|
|
308
|
+
* // copies a single file
|
|
309
|
+
* copy: './src/path/file.ts', // outputs './dist/path/file.ts'
|
|
310
|
+
* },
|
|
311
|
+
* {
|
|
312
|
+
* // copies a single file
|
|
313
|
+
* copy: './src/path/file.ts',
|
|
314
|
+
* output: './dist/subdir/custom-file-name.ts',
|
|
315
|
+
* },
|
|
316
|
+
* {
|
|
317
|
+
* // copies the entire directory
|
|
318
|
+
* input: './src/path/srcdir',
|
|
319
|
+
* output: './dist/outdir',
|
|
320
|
+
* },
|
|
321
|
+
* ]
|
|
322
|
+
* })
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* @default undefined
|
|
326
|
+
*/
|
|
327
327
|
copy: string;
|
|
328
328
|
/**
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
* Specifies the path to the destination file or directory.
|
|
330
|
+
*/
|
|
331
331
|
output?: string;
|
|
332
332
|
/**
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
333
|
+
* Copy directories recursively.
|
|
334
|
+
*
|
|
335
|
+
* @default true
|
|
336
|
+
*/
|
|
337
337
|
recursive?: boolean;
|
|
338
338
|
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
339
|
+
* Filters copied `files/directories`.
|
|
340
|
+
*
|
|
341
|
+
* Returns `true` to copy the item, `false` to ignore it.
|
|
342
|
+
*
|
|
343
|
+
* @default undefined
|
|
344
|
+
*/
|
|
345
345
|
filter?(source: string, destination: string): boolean;
|
|
346
346
|
input?: never;
|
|
347
347
|
name?: never;
|
|
@@ -354,29 +354,29 @@ interface EntryCopy {
|
|
|
354
354
|
}
|
|
355
355
|
interface EntryTemplate {
|
|
356
356
|
/**
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
357
|
+
* Specifies the content of the `template` file.
|
|
358
|
+
*
|
|
359
|
+
* Provides the ability to dynamically inject template content during the build phase.
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
*
|
|
363
|
+
* ```ts
|
|
364
|
+
* import { name, version } from './package.json'
|
|
365
|
+
*
|
|
366
|
+
* export default defineConfig({
|
|
367
|
+
* entries: [
|
|
368
|
+
* {
|
|
369
|
+
* template: `// Package ${name} v${version} ...`,
|
|
370
|
+
* output: './dist/template.ts',
|
|
371
|
+
* },
|
|
372
|
+
* ]
|
|
373
|
+
* })
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
376
|
template: string;
|
|
377
377
|
/**
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
* Specifies the path to the destination file.
|
|
379
|
+
*/
|
|
380
380
|
output: string;
|
|
381
381
|
input?: never;
|
|
382
382
|
name?: never;
|
|
@@ -394,249 +394,249 @@ type EntryOptions = EntryChunk | EntryDts | EntryCopy | EntryTemplate;
|
|
|
394
394
|
//#region src/types/options.d.ts
|
|
395
395
|
interface Options {
|
|
396
396
|
/**
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
397
|
+
* Specifies the bundle's entry points.
|
|
398
|
+
*
|
|
399
|
+
* It allows you to manually set all build entries and adjust options for each one individually.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
*
|
|
403
|
+
* ```ts
|
|
404
|
+
* export default defineConfig({
|
|
405
|
+
* entries: [
|
|
406
|
+
* { input: './src/index.ts' }, // outputs './dist/index.js'
|
|
407
|
+
* { dts: './src/types.ts' }, // outputs './dist/types.d.ts'
|
|
408
|
+
* // ...
|
|
409
|
+
* ]
|
|
410
|
+
* })
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
413
|
entries: EntryOptions[];
|
|
414
414
|
/**
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
415
|
+
* Specifies the output directory for production bundle.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
*
|
|
419
|
+
* ```ts
|
|
420
|
+
* export default defineConfig({
|
|
421
|
+
* outDir: './output',
|
|
422
|
+
* })
|
|
423
|
+
* ```
|
|
424
|
+
*
|
|
425
|
+
* @default 'dist'
|
|
426
|
+
*/
|
|
427
427
|
outDir?: string;
|
|
428
428
|
/**
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
429
|
+
* Specifies the module IDs, or regular expressions to match module IDs,
|
|
430
|
+
* that should remain external to the bundle.
|
|
431
|
+
*
|
|
432
|
+
* IDs and regexps from this option are applied globally to all entries.
|
|
433
|
+
*
|
|
434
|
+
* Also, it is possible to define externals individually per entry (`entry.externals`).
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
*
|
|
438
|
+
* ```ts
|
|
439
|
+
* export default defineConfig({
|
|
440
|
+
* externals: ['id-1', 'id-2', /regexp/],
|
|
441
|
+
* })
|
|
442
|
+
* ```
|
|
443
|
+
*
|
|
444
|
+
* @default [/^node:/,/^@types/,/^@rollup/,/^@rolldown/,/^@hypernym/,/^rollup/,/^rolldown/,...pkg.dependencies]
|
|
445
|
+
*/
|
|
446
446
|
externals?: (string | RegExp)[];
|
|
447
447
|
/**
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
448
|
+
* Provides a powerful hooking system to further expand bundling mode.
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
*
|
|
452
|
+
* ```ts
|
|
453
|
+
* export default defineConfig({
|
|
454
|
+
* hooks: {
|
|
455
|
+
* 'build:end': async (options, buildStats) => {
|
|
456
|
+
* // ...
|
|
457
|
+
* }
|
|
458
|
+
* }
|
|
459
|
+
* })
|
|
460
|
+
* ```
|
|
461
|
+
*
|
|
462
|
+
* @default undefined
|
|
463
|
+
*/
|
|
464
464
|
hooks?: HooksOptions;
|
|
465
465
|
/**
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
466
|
+
* Controls code minification for all `chunk` entries.
|
|
467
|
+
*
|
|
468
|
+
* - `true`: Enable full minification including code compression and dead code elimination.
|
|
469
|
+
* - `false`: Disable minification (default).
|
|
470
|
+
* - `'dce-only'`: Only perform dead code elimination without code compression.
|
|
471
|
+
* - `MinifyOptions`: Fine-grained control over minification settings.
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
*
|
|
475
|
+
* ```ts
|
|
476
|
+
* export default defineConfig({
|
|
477
|
+
* minify: true,
|
|
478
|
+
* })
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* It can also be set per entry.
|
|
482
|
+
*
|
|
483
|
+
* ```ts
|
|
484
|
+
* export default defineConfig({
|
|
485
|
+
* entries: [
|
|
486
|
+
* {
|
|
487
|
+
* input: './src/index.ts',
|
|
488
|
+
* minify: true,
|
|
489
|
+
* },
|
|
490
|
+
* ],
|
|
491
|
+
* })
|
|
492
|
+
* ```
|
|
493
|
+
*
|
|
494
|
+
* @default undefined
|
|
495
|
+
*/
|
|
496
496
|
minify?: OutputOptions['minify'];
|
|
497
497
|
/**
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
498
|
+
* Specifies the path to the project root (current working directory).
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
*
|
|
502
|
+
* ```ts
|
|
503
|
+
* export default defineConfig({
|
|
504
|
+
* cwd: './dir',
|
|
505
|
+
* })
|
|
506
|
+
* ```
|
|
507
|
+
*
|
|
508
|
+
* @default undefined
|
|
509
|
+
*/
|
|
510
510
|
cwd?: string;
|
|
511
511
|
/**
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
512
|
+
* Specifies the path to the `tsconfig` file.
|
|
513
|
+
*
|
|
514
|
+
* By default, if the file `tsconfig.json` exists in the project root, it will be used as the default config file.
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
*
|
|
518
|
+
* ```ts
|
|
519
|
+
* export default defineConfig({
|
|
520
|
+
* tsconfig: './path/to/tsconfig.json',
|
|
521
|
+
* })
|
|
522
|
+
* ```
|
|
523
|
+
*
|
|
524
|
+
* @default undefined
|
|
525
|
+
*/
|
|
526
526
|
tsconfig?: string;
|
|
527
527
|
}
|
|
528
528
|
//#endregion
|
|
529
529
|
//#region src/types/hooks.d.ts
|
|
530
530
|
interface HooksOptions {
|
|
531
531
|
/**
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
532
|
+
* Called at the beginning of bundling.
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
*
|
|
536
|
+
* ```ts
|
|
537
|
+
* export default defineConfig({
|
|
538
|
+
* hooks: {
|
|
539
|
+
* 'bundle:start': async (options) => {
|
|
540
|
+
* // ...
|
|
541
|
+
* }
|
|
542
|
+
* }
|
|
543
|
+
* })
|
|
544
|
+
* ```
|
|
545
|
+
*
|
|
546
|
+
* @default undefined
|
|
547
|
+
*/
|
|
548
548
|
'bundle:start'?: (options: Options) => void | Promise<void>;
|
|
549
549
|
/**
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
550
|
+
* Called at the beginning of building.
|
|
551
|
+
*
|
|
552
|
+
* @example
|
|
553
|
+
*
|
|
554
|
+
* ```ts
|
|
555
|
+
* export default defineConfig({
|
|
556
|
+
* hooks: {
|
|
557
|
+
* 'build:start': async (options, stats) => {
|
|
558
|
+
* // ...
|
|
559
|
+
* }
|
|
560
|
+
* }
|
|
561
|
+
* })
|
|
562
|
+
* ```
|
|
563
|
+
*
|
|
564
|
+
* @default undefined
|
|
565
|
+
*/
|
|
566
566
|
'build:start'?: (options: Options, stats: BuildStats) => void | Promise<void>;
|
|
567
567
|
/**
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
568
|
+
* Called on each entry just before the build process.
|
|
569
|
+
*
|
|
570
|
+
* Provides the ability to customize entry options before they are passed to the next phase.
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
*
|
|
574
|
+
* ```ts
|
|
575
|
+
* export default defineConfig({
|
|
576
|
+
* hooks: {
|
|
577
|
+
* 'build:entry:start': async (entry, stats) => {
|
|
578
|
+
* // ...
|
|
579
|
+
* }
|
|
580
|
+
* }
|
|
581
|
+
* })
|
|
582
|
+
* ```
|
|
583
|
+
*
|
|
584
|
+
* @default undefined
|
|
585
|
+
*/
|
|
586
586
|
'build:entry:start'?: (entry: BuildEntryOptions, stats: BuildEntryStats) => void | Promise<void>;
|
|
587
587
|
/**
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
588
|
+
* Called on each entry right after the build process is completed.
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
*
|
|
592
|
+
* ```ts
|
|
593
|
+
* export default defineConfig({
|
|
594
|
+
* hooks: {
|
|
595
|
+
* 'build:entry:end': async (entry, stats) => {
|
|
596
|
+
* // ...
|
|
597
|
+
* }
|
|
598
|
+
* }
|
|
599
|
+
* })
|
|
600
|
+
* ```
|
|
601
|
+
*
|
|
602
|
+
* @default undefined
|
|
603
|
+
*/
|
|
604
604
|
'build:entry:end'?: (entry: BuildEntryOptions, stats: BuildEntryStats) => void | Promise<void>;
|
|
605
605
|
/**
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
606
|
+
* Called right after building is complete.
|
|
607
|
+
*
|
|
608
|
+
* @example
|
|
609
|
+
*
|
|
610
|
+
* ```ts
|
|
611
|
+
* export default defineConfig({
|
|
612
|
+
* hooks: {
|
|
613
|
+
* 'build:end': async (options, stats) => {
|
|
614
|
+
* // ...
|
|
615
|
+
* }
|
|
616
|
+
* }
|
|
617
|
+
* })
|
|
618
|
+
* ```
|
|
619
|
+
*
|
|
620
|
+
* @default undefined
|
|
621
|
+
*/
|
|
622
622
|
'build:end'?: (options: Options, stats: BuildStats) => void | Promise<void>;
|
|
623
623
|
/**
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
624
|
+
* Called right after bundling is complete.
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
*
|
|
628
|
+
* ```ts
|
|
629
|
+
* export default defineConfig({
|
|
630
|
+
* hooks: {
|
|
631
|
+
* 'bundle:end': async (options) => {
|
|
632
|
+
* // ...
|
|
633
|
+
* }
|
|
634
|
+
* }
|
|
635
|
+
* })
|
|
636
|
+
* ```
|
|
637
|
+
*
|
|
638
|
+
* @default undefined
|
|
639
|
+
*/
|
|
640
640
|
'bundle:end'?: (options: Options) => void | Promise<void>;
|
|
641
641
|
}
|
|
642
642
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypernym/bundler",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.2",
|
|
4
4
|
"author": "Hypernym Studio",
|
|
5
5
|
"description": "ESM & TS module bundler.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@hypernym/args": "^0.3.4",
|
|
59
59
|
"@hypernym/colors": "^1.0.6",
|
|
60
|
-
"@hypernym/utils": "^3.4.
|
|
61
|
-
"rolldown": "^1.0.0-beta.
|
|
62
|
-
"rolldown-plugin-dts": "^0.
|
|
60
|
+
"@hypernym/utils": "^3.4.7",
|
|
61
|
+
"rolldown": "^1.0.0-beta.60",
|
|
62
|
+
"rolldown-plugin-dts": "^0.21.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@hypernym/eslint-config": "^3.6.
|
|
66
|
-
"@hypernym/prettier-config": "^3.2.
|
|
67
|
-
"@hypernym/tsconfig": "^2.6.
|
|
68
|
-
"@types/node": "^24.10.
|
|
65
|
+
"@hypernym/eslint-config": "^3.6.7",
|
|
66
|
+
"@hypernym/prettier-config": "^3.2.11",
|
|
67
|
+
"@hypernym/tsconfig": "^2.6.5",
|
|
68
|
+
"@types/node": "^24.10.9",
|
|
69
69
|
"eslint": "^9.39.2",
|
|
70
|
-
"prettier": "^3.
|
|
70
|
+
"prettier": "^3.8.0",
|
|
71
71
|
"typescript": "^5.9.3"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|