@hypernym/bundler 0.31.3 → 0.32.0

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/README.md CHANGED
@@ -297,10 +297,10 @@ export default defineConfig({
297
297
 
298
298
  Controls code minification for all `chunk` entries.
299
299
 
300
- - `true`: Enable full minification including code compression and dead code elimination.
301
- - `false`: Disable minification (default).
302
- - `'dce-only'`: Only perform dead code elimination without code compression.
303
- - `MinifyOptions`: Fine-grained control over minification settings.
300
+ - `true` - Enable full minification including code compression and dead code elimination.
301
+ - `false` - Disable minification (default).
302
+ - `'dce-only'` - Only perform dead code elimination without code compression.
303
+ - `MinifyOptions` - Fine-grained control over minification settings.
304
304
 
305
305
  ```ts
306
306
  // bundler.config.ts
@@ -325,6 +325,30 @@ export default defineConfig({
325
325
  })
326
326
  ```
327
327
 
328
+ ## comments
329
+
330
+ - Type: `boolean | CommentsOptions | undefined`
331
+ - Default: `{ legal: true, annotation: true, jsdoc: false }`
332
+
333
+ Specifies which comments are preserved in the output.
334
+
335
+ - `true` - Preserve legal, annotation, and JSDoc comments.
336
+ - `false` - Strip all comments.
337
+ - `object` - Granular control over comment categories:
338
+ - `legal` - `@license`, `@preserve`, `//!`, `/*!`.
339
+ - `annotation` - `@__PURE__`, `@__NO_SIDE_EFFECTS__`, `@vite-ignore`.
340
+ - `jsdoc` - JSDoc comments.
341
+
342
+ ```ts
343
+ // bundler.config.ts
344
+
345
+ import { defineConfig } from '@hypernym/bundler'
346
+
347
+ export default defineConfig({
348
+ comments: true,
349
+ })
350
+ ```
351
+
328
352
  ## Hooks
329
353
 
330
354
  List of lifecycle hooks that are called at various phases:
package/dist/bin/index.js CHANGED
@@ -9,7 +9,7 @@ import { build as build$1 } from "../build/index.js";
9
9
 
10
10
  //#region src/bin/meta.ts
11
11
  const name = `Hyperbundler`;
12
- const version = `0.31.3`;
12
+ const version = `0.32.0`;
13
13
 
14
14
  //#endregion
15
15
  //#region src/utils/logger.ts
@@ -73,24 +73,6 @@ function formatBytes(bytes) {
73
73
 
74
74
  //#endregion
75
75
  //#region src/config.ts
76
- /**
77
- * List of global default patterns for external module identifiers.
78
- *
79
- * @example
80
- *
81
- * ```ts
82
- * import { externals } from '@hypernym/bundler'
83
- *
84
- * export default defineConfig({
85
- * entries: [
86
- * {
87
- * input: './src/index.ts',
88
- * externals: [...externals, 'id', /regexp/]
89
- * },
90
- * ]
91
- * })
92
- * ```
93
- */
94
76
  const externals = [
95
77
  /^node:/,
96
78
  /^@types/,
@@ -113,7 +113,7 @@ function logEntryStats(stats) {
113
113
  if (stats.logs) for (const log of stats.logs) cl("!", log.level.padEnd(5), output.padEnd(outputLength), dim(log.log.message));
114
114
  }
115
115
  async function build(options) {
116
- const { cwd: cwdir = cwd(), outDir = "dist", entries, externals, tsconfig, hooks, minify } = options;
116
+ const { cwd: cwdir = cwd(), outDir = "dist", entries, externals, tsconfig, hooks, minify, comments } = options;
117
117
  let start = 0;
118
118
  const buildStats = {
119
119
  cwd: cwdir,
@@ -168,7 +168,12 @@ async function build(options) {
168
168
  name: entry.name,
169
169
  globals: entry.globals,
170
170
  extend: entry.extend,
171
- plugins: entry.paths ? [outputPaths(entry.paths)] : void 0
171
+ plugins: entry.paths ? [outputPaths(entry.paths)] : void 0,
172
+ comments: entry.comments || comments || {
173
+ legal: true,
174
+ annotation: true,
175
+ jsdoc: false
176
+ }
172
177
  };
173
178
  const entryOptions = {
174
179
  ...entryInput,
package/dist/index.d.ts CHANGED
@@ -170,6 +170,19 @@ interface EntryBase {
170
170
  * @default undefined
171
171
  */
172
172
  tsconfig?: InputOptions['tsconfig'];
173
+ /**
174
+ * Specifies which comments are preserved in the output.
175
+ *
176
+ * - `true` - Preserve legal, annotation, and JSDoc comments.
177
+ * - `false` - Strip all comments.
178
+ * - `object` - Granular control over comment categories:
179
+ * - `legal` - `@license`, `@preserve`, `//!`, `/*!`.
180
+ * - `annotation` - `@__PURE__`, `@__NO_SIDE_EFFECTS__`, `@vite-ignore`.
181
+ * - `jsdoc` - JSDoc comments.
182
+ *
183
+ * @default { legal: true, annotation: true, jsdoc: false }
184
+ */
185
+ comments?: OutputOptions['comments'];
173
186
  }
174
187
  interface EntryChunk extends EntryBase {
175
188
  /**
@@ -465,10 +478,10 @@ interface Options {
465
478
  /**
466
479
  * Controls code minification for all `chunk` entries.
467
480
  *
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.
481
+ * - `true` - Enable full minification including code compression and dead code elimination.
482
+ * - `false` - Disable minification (default).
483
+ * - `'dce-only'` - Only perform dead code elimination without code compression.
484
+ * - `MinifyOptions` - Fine-grained control over minification settings.
472
485
  *
473
486
  * @example
474
487
  *
@@ -524,6 +537,20 @@ interface Options {
524
537
  * @default undefined
525
538
  */
526
539
  tsconfig?: string;
540
+ /**
541
+ * Specifies which comments are preserved in the output.
542
+ *
543
+ * @example
544
+ *
545
+ * ```ts
546
+ * export default defineConfig({
547
+ * comments: true,
548
+ * })
549
+ * ```
550
+ *
551
+ * @default { legal: true, annotation: true, jsdoc: false }
552
+ */
553
+ comments?: OutputOptions['comments'];
527
554
  }
528
555
  //#endregion
529
556
  //#region src/types/hooks.d.ts
package/dist/index.js CHANGED
@@ -1,24 +1,6 @@
1
1
  export * from "./build/index.js"
2
2
 
3
3
  //#region src/config.ts
4
- /**
5
- * List of global default patterns for external module identifiers.
6
- *
7
- * @example
8
- *
9
- * ```ts
10
- * import { externals } from '@hypernym/bundler'
11
- *
12
- * export default defineConfig({
13
- * entries: [
14
- * {
15
- * input: './src/index.ts',
16
- * externals: [...externals, 'id', /regexp/]
17
- * },
18
- * ]
19
- * })
20
- * ```
21
- */
22
4
  const externals = [
23
5
  /^node:/,
24
6
  /^@types/,
@@ -28,25 +10,6 @@ const externals = [
28
10
  /^rollup/,
29
11
  /^rolldown/
30
12
  ];
31
- /**
32
- * ESM & TS module bundler.
33
- *
34
- * Automatically detects a custom configuration file at the project root, which can override or extend the build behavior.
35
- *
36
- * Configuration file also accepts `.js`, `.mjs`, `.ts`, `.mts` formats.
37
- *
38
- * @example
39
- *
40
- * ```ts
41
- * import { defineConfig } from '@hypernym/bundler'
42
- *
43
- * export default defineConfig({
44
- * // ...
45
- * })
46
- * ```
47
- *
48
- * @see [Repository](https://github.com/hypernym-studio/bundler)
49
- */
50
13
  function defineConfig(options) {
51
14
  return options;
52
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypernym/bundler",
3
- "version": "0.31.3",
3
+ "version": "0.32.0",
4
4
  "author": "Hypernym Studio",
5
5
  "description": "ESM & TS module bundler.",
6
6
  "license": "MIT",
@@ -58,14 +58,14 @@
58
58
  "@hypernym/args": "^0.3.4",
59
59
  "@hypernym/colors": "^1.0.6",
60
60
  "@hypernym/utils": "^3.4.7",
61
- "rolldown": "^1.0.0-rc.2",
62
- "rolldown-plugin-dts": "^0.21.9"
61
+ "rolldown": "^1.0.0-rc.4",
62
+ "rolldown-plugin-dts": "^0.22.1"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@hypernym/eslint-config": "^3.6.7",
66
66
  "@hypernym/prettier-config": "^3.2.11",
67
67
  "@hypernym/tsconfig": "^2.6.5",
68
- "@types/node": "^24.10.10",
68
+ "@types/node": "^24.10.13",
69
69
  "eslint": "^9.39.2",
70
70
  "prettier": "^3.8.1",
71
71
  "typescript": "^5.9.3"