@hypernym/bundler 0.21.0 → 0.30.1

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
@@ -57,7 +57,7 @@ export default defineConfig({
57
57
  { dts: './src/types/index.ts' },
58
58
  {
59
59
  input: './src/utils/index.ts',
60
- output: './dist/utils/utils.min.mjs',
60
+ output: './dist/utils/utils.min.js',
61
61
  minify: true,
62
62
  },
63
63
  // ...
@@ -107,7 +107,7 @@ npx hyperbundler --config hyper.config.ts
107
107
 
108
108
  During transformation, file formats are automatically resolved, and in most cases, no additional configuration is required.
109
109
 
110
- The default module environment for generated files is `esm`, which means output files will have a `.mjs` extension unless otherwise specified. For TypeScript declarations, the corresponding extension will be `.d.mts`.
110
+ The default module environment for generated files is `esm`, which means output files will have a `.js` extension unless otherwise specified. For TypeScript declarations, the corresponding extension will be `.d.ts`.
111
111
 
112
112
  Formats can also be explicitly specified for each entry, if needed.
113
113
 
@@ -115,18 +115,18 @@ Formats can also be explicitly specified for each entry, if needed.
115
115
 
116
116
  Default transformation behavior for all `chunk` entries:
117
117
 
118
- - `./srcDir/file.js` → `./outDir/file.mjs`
119
- - `./srcDir/file.mjs` → `./outDir/file.mjs`
118
+ - `./srcDir/file.js` → `./outDir/file.js`
119
+ - `./srcDir/file.mjs` → `./outDir/file.js`
120
120
  - `./srcDir/file.cjs` → `./outDir/file.cjs`
121
- - `./srcDir/file.ts` → `./outDir/file.mjs`
122
- - `./srcDir/file.mts` → `./outDir/file.mjs`
121
+ - `./srcDir/file.ts` → `./outDir/file.js`
122
+ - `./srcDir/file.mts` → `./outDir/file.js`
123
123
  - `./srcDir/file.cts` → `./outDir/file.cjs`
124
124
 
125
125
  ### Declarations
126
126
 
127
127
  Default transformation behavior for all `dts` entries:
128
128
 
129
- - `./srcDir/file.ts` → `./outDir/file.d.mts`
129
+ - `./srcDir/file.ts` → `./outDir/file.d.ts`
130
130
 
131
131
  ## Options
132
132
 
@@ -147,8 +147,8 @@ import { defineConfig } from '@hypernym/bundler'
147
147
 
148
148
  export default defineConfig({
149
149
  entries: [
150
- { input: './src/index.ts' }, // outputs './dist/index.mjs'
151
- { dts: './src/types.ts' }, // outputs './dist/types.d.mts'
150
+ { input: './src/index.ts' }, // outputs './dist/index.js'
151
+ { dts: './src/types.ts' }, // outputs './dist/types.d.ts'
152
152
  // ...
153
153
  ],
154
154
  })
@@ -165,7 +165,7 @@ import { defineConfig } from '@hypernym/bundler'
165
165
 
166
166
  export default defineConfig({
167
167
  entries: [
168
- { input: './src/index.ts' }, // outputs './dist/index.mjs'
168
+ { input: './src/index.ts' }, // outputs './dist/index.js'
169
169
  {
170
170
  input: './src/index.ts',
171
171
  output: './out/index.js', // outputs './out/index.js'
@@ -176,14 +176,14 @@ export default defineConfig({
176
176
 
177
177
  ### Entry Dts
178
178
 
179
- Builds TypeScript `declaration` files (`.d.mts`) for production.
179
+ Builds TypeScript `declaration` files (`.d.ts`) for production.
180
180
 
181
181
  ```ts
182
182
  import { defineConfig } from '@hypernym/bundler'
183
183
 
184
184
  export default defineConfig({
185
185
  entries: [
186
- { dts: './src/types.ts' }, // outputs './dist/types.d.mts'
186
+ { dts: './src/types.ts' }, // outputs './dist/types.d.ts'
187
187
  {
188
188
  dts: './src/types.ts',
189
189
  output: './out/types.d.ts', // outputs './out/types.d.ts'
@@ -528,10 +528,10 @@ Specifies the path to the `bundler` custom config file.
528
528
 
529
529
  ```sh
530
530
  # pnpm
531
- pnpm hyperbundler --config hyper.config.mjs
531
+ pnpm hyperbundler --config hyper.config.js
532
532
 
533
533
  # npm
534
- npx hyperbundler --config hyper.config.mjs
534
+ npx hyperbundler --config hyper.config.js
535
535
  ```
536
536
 
537
537
  ### cwd
@@ -5,11 +5,11 @@ import { cyan, dim } from "@hypernym/colors";
5
5
  import { isAbsolute, resolve } from "node:path";
6
6
  import { exists, read, write } from "@hypernym/utils/fs";
7
7
  import { build } from "rolldown";
8
- import { build as build$1 } from "../build/index.mjs";
8
+ 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.21.0`;
12
+ const version = `0.30.1`;
13
13
 
14
14
  //#endregion
15
15
  //#region src/utils/logger.ts
@@ -105,8 +105,7 @@ const externals = [
105
105
  //#region src/bin/loader.ts
106
106
  async function getTSConfigPath(cwd$1, filePath = "tsconfig.json") {
107
107
  const tsconfigPath = resolve(cwd$1, filePath);
108
- const tsconfigFile = await exists(tsconfigPath);
109
- if (tsconfigFile) return tsconfigPath;
108
+ if (await exists(tsconfigPath)) return tsconfigPath;
110
109
  }
111
110
  async function loadConfig(filePath, defaults) {
112
111
  const cwd$1 = defaults.cwd;
@@ -117,15 +116,14 @@ async function loadConfig(filePath, defaults) {
117
116
  tsconfig: defaults.tsconfig,
118
117
  output: { format: "esm" }
119
118
  });
120
- const tempConfig = resolve(cwd$1, "node_modules/.hypernym/bundler/config.mjs");
119
+ const tempConfig = resolve(cwd$1, "node_modules/.hypernym/bundler/config.js");
121
120
  await write(tempConfig, result.output[0].code);
122
121
  const config = (await import(tempConfig)).default;
123
- const options = {
124
- ...defaults,
125
- ...config
126
- };
127
122
  return {
128
- options,
123
+ options: {
124
+ ...defaults,
125
+ ...config
126
+ },
129
127
  path: filePath
130
128
  };
131
129
  }
@@ -144,21 +142,18 @@ async function createConfigLoader(args) {
144
142
  const warnMessage = `Missing required configuration. To start bundling, add the ${cyan(`'bundler.config.{js,mjs,ts,mts}'`)} file to the project's root.`;
145
143
  if (args.config) {
146
144
  const path = resolve(args.config);
147
- const isConfig = await exists(path);
148
- if (isConfig) return await loadConfig(path, defaults);
145
+ if (await exists(path)) return await loadConfig(path, defaults);
149
146
  else return logger.exit(warnMessage);
150
147
  }
151
148
  const configName = "bundler.config";
152
- const configExts = [
149
+ for (const ext of [
153
150
  ".ts",
154
151
  ".mts",
155
152
  ".mjs",
156
153
  ".js"
157
- ];
158
- for (const ext of configExts) {
154
+ ]) {
159
155
  const path = resolve(cwdir, `${configName}${ext}`);
160
- const isConfig = await exists(path);
161
- if (isConfig) return await loadConfig(path, defaults);
156
+ if (await exists(path)) return await loadConfig(path, defaults);
162
157
  }
163
158
  return logger.exit(warnMessage);
164
159
  }
@@ -6,7 +6,7 @@ import { isUndefined } from "@hypernym/utils";
6
6
  import { copy, readdir, write } from "@hypernym/utils/fs";
7
7
  import { rolldown } from "rolldown";
8
8
  import { dts } from "rolldown-plugin-dts";
9
- import { outputPaths } from "../plugins/index.mjs";
9
+ import { outputPaths } from "../plugins/index.js";
10
10
 
11
11
  //#region src/bin/meta.ts
12
12
  const name = `Hyperbundler`;
@@ -86,7 +86,7 @@ function getOutputPath(outDir, input, { extension = "auto" } = {}) {
86
86
  ];
87
87
  const legacy = [".cjs", ".cts"];
88
88
  let newExt = "";
89
- if (esm.includes(ext)) newExt = extension === "dts" ? ".d.mts" : ".mjs";
89
+ if (esm.includes(ext)) newExt = extension === "dts" ? ".d.ts" : ".js";
90
90
  else if (legacy.includes(ext)) newExt = extension === "dts" ? ".d.cts" : ".cjs";
91
91
  if (newExt) output = `${output.slice(0, -ext.length)}${newExt}`;
92
92
  }
@@ -107,10 +107,9 @@ function logEntryStats(stats) {
107
107
  let format = stats.format;
108
108
  if (format === "commonjs") format = "cjs";
109
109
  if (format === "es" || format === "module") format = "esm";
110
- const pathDim = dim(path);
111
- const output = pathDim + base;
110
+ const output = dim(path) + base;
112
111
  const outputLength = output.length + 2;
113
- cl$1("", format.padEnd(5), output.padEnd(outputLength), dim(`[${formatBytes(stats.size)}, ${formatMs(stats.buildTime)}]`));
112
+ cl$1(dim("+"), format.padEnd(5), output.padEnd(outputLength), dim(`[${formatBytes(stats.size)}, ${formatMs(stats.buildTime)}]`));
114
113
  if (stats.logs) for (const log of stats.logs) cl$1("!", log.level.padEnd(5), output.padEnd(outputLength), dim(log.log.message));
115
114
  }
116
115
  async function build(options) {
@@ -168,7 +168,7 @@ interface EntryChunk extends EntryBase {
168
168
  * ```ts
169
169
  * export default defineConfig({
170
170
  * entries: [
171
- * { input: './src/index.ts' }, // outputs './dist/index.mjs'
171
+ * { input: './src/index.ts' }, // outputs './dist/index.js'
172
172
  * ]
173
173
  * })
174
174
  * ```
@@ -242,7 +242,7 @@ interface EntryDts extends EntryBase {
242
242
  * ```ts
243
243
  * export default defineConfig({
244
244
  * entries: [
245
- * { dts: './src/types.ts' }, // outputs './dist/types.d.mts'
245
+ * { dts: './src/types.ts' }, // outputs './dist/types.d.ts'
246
246
  * ]
247
247
  * })
248
248
  * ```
@@ -391,8 +391,8 @@ interface Options {
391
391
  * ```ts
392
392
  * export default defineConfig({
393
393
  * entries: [
394
- * { input: './src/index.ts' }, // outputs './dist/index.mjs'
395
- * { dts: './src/types.ts' }, // outputs './dist/types.d.mts'
394
+ * { input: './src/index.ts' }, // outputs './dist/index.js'
395
+ * { dts: './src/types.ts' }, // outputs './dist/types.d.ts'
396
396
  * // ...
397
397
  * ]
398
398
  * })
@@ -1,4 +1,4 @@
1
- export * from "./build/index.mjs"
1
+ export * from "./build/index.js"
2
2
 
3
3
  //#region src/config.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypernym/bundler",
3
- "version": "0.21.0",
3
+ "version": "0.30.1",
4
4
  "author": "Hypernym Studio",
5
5
  "description": "ESM & TS module bundler.",
6
6
  "license": "MIT",
@@ -13,12 +13,12 @@
13
13
  "type": "module",
14
14
  "exports": {
15
15
  ".": {
16
- "types": "./dist/index.d.mts",
17
- "import": "./dist/index.mjs"
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
18
  },
19
19
  "./plugins": {
20
- "types": "./dist/plugins/index.d.mts",
21
- "import": "./dist/plugins/index.mjs"
20
+ "types": "./dist/plugins/index.d.ts",
21
+ "import": "./dist/plugins/index.js"
22
22
  }
23
23
  },
24
24
  "files": [
@@ -40,7 +40,7 @@
40
40
  "dts"
41
41
  ],
42
42
  "bin": {
43
- "hyperbundler": "./dist/bin/index.mjs"
43
+ "hyperbundler": "./dist/bin/index.js"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@types/node": ">=20.0.0",
@@ -58,15 +58,15 @@
58
58
  "@hypernym/args": "^0.3.3",
59
59
  "@hypernym/colors": "^1.0.5",
60
60
  "@hypernym/utils": "^3.4.5",
61
- "rolldown": "^1.0.0-beta.34",
62
- "rolldown-plugin-dts": "^0.15.9"
61
+ "rolldown": "^1.0.0-beta.40",
62
+ "rolldown-plugin-dts": "^0.16.9"
63
63
  },
64
64
  "devDependencies": {
65
- "@hypernym/eslint-config": "^3.6.3",
66
- "@hypernym/prettier-config": "^3.2.6",
65
+ "@hypernym/eslint-config": "^3.6.4",
66
+ "@hypernym/prettier-config": "^3.2.7",
67
67
  "@hypernym/tsconfig": "^2.6.2",
68
- "@types/node": "^24.3.0",
69
- "eslint": "^9.34.0",
68
+ "@types/node": "^24.5.2",
69
+ "eslint": "^9.36.0",
70
70
  "prettier": "^3.6.2",
71
71
  "typescript": "^5.9.2"
72
72
  },
File without changes
File without changes