quickbundle 3.0.0-next-ad3f6ff → 3.0.0-next-9f62eb1

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 (2) hide show
  1. package/dist/index.js +18 -20
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import os from "node:os";
15
15
 
16
16
  //#region package.json
17
17
  var name = "quickbundle";
18
- var version = "3.0.0-next-ad3f6ff";
18
+ var version = "3.0.0-next-9f62eb1";
19
19
 
20
20
  //#endregion
21
21
  //#region src/bundler/build.ts
@@ -28,17 +28,13 @@ const build = async (input) => {
28
28
  const bundle = await rolldown(config);
29
29
  if (config.output) {
30
30
  const outputEntries = Array.isArray(config.output) ? config.output : [config.output];
31
- const promises = [];
32
- for (const outputEntry of outputEntries) promises.push(new Promise((resolve, reject) => {
33
- bundle.write(outputEntry).then(({ output: rolldownOutput }) => {
34
- resolve({
35
- elapsedTime: Date.now() - initialTime,
36
- filePath: join(outputEntry.dir ?? "", rolldownOutput.find((item) => item.type === "chunk" && item.isEntry)?.fileName ?? "")
37
- });
38
- }).catch((error) => {
39
- if (error instanceof Error) reject(error);
40
- });
41
- }));
31
+ const promises = Array.from(outputEntries, async (outputEntry) => {
32
+ const { output: rolldownOutput } = await bundle.write(outputEntry);
33
+ return {
34
+ elapsedTime: Date.now() - initialTime,
35
+ filePath: join(outputEntry.dir ?? "", rolldownOutput.find((item) => item.type === "chunk" && item.isEntry)?.fileName ?? "")
36
+ };
37
+ });
42
38
  output.push(...await Promise.all(promises));
43
39
  }
44
40
  }
@@ -135,7 +131,7 @@ const DEFAULT_OPTIONS = {
135
131
  sourceMaps: false,
136
132
  standalone: false
137
133
  };
138
- const createConfiguration = (options = DEFAULT_OPTIONS) => {
134
+ const createConfig = (options = DEFAULT_OPTIONS) => {
139
135
  const buildableExports = getBuildableExports(options);
140
136
  return {
141
137
  data: buildableExports.flatMap((buildableExport) => {
@@ -229,10 +225,10 @@ const getPlugins = (options) => {
229
225
  return output;
230
226
  };
231
227
  const createMainConfig = (entryPoints, options) => {
228
+ if (entryPoints.import && entryPoints.default && entryPoints.import !== entryPoints.default) throw new Error("Both `import` and `default` export fields have been defined but with different values. To preserve proper `default` field resolution on the consumer side (i.e. to target ESM format), make sure to provide the same file path for both fields.");
232
229
  const { minification, sourceMaps } = options;
233
230
  const cjsInput = entryPoints.require;
234
231
  const esmInput = entryPoints.import ?? entryPoints.default;
235
- if (entryPoints.import && entryPoints.default && entryPoints.import !== entryPoints.default) throw new Error("Both `import` and `default` export fields have been defined but with different values. To preserve proper `default` field resolution on the consumer side (i.e. to target ESM format), make sure to provide the same file path for both fields.");
236
232
  const commonOutputConfig = {
237
233
  minify: minification,
238
234
  sourcemap: sourceMaps
@@ -240,7 +236,7 @@ const createMainConfig = (entryPoints, options) => {
240
236
  const output = [cjsInput && {
241
237
  ...commonOutputConfig,
242
238
  ...getFileOutput(cjsInput),
243
- codeSplitting: Boolean(options.standalone),
239
+ codeSplitting: options.standalone,
244
240
  format: "cjs"
245
241
  }, esmInput && {
246
242
  ...commonOutputConfig,
@@ -275,7 +271,7 @@ const createBuildCommand = (program) => {
275
271
  name: "build"
276
272
  }).task({
277
273
  async handler(context) {
278
- return build(createConfiguration({
274
+ return build(createConfig({
279
275
  minification: context.minification,
280
276
  sourceMaps: context.sourceMaps,
281
277
  standalone: false
@@ -348,7 +344,7 @@ const createCompileCommand = (program) => {
348
344
  }
349
345
  }).task({
350
346
  handler() {
351
- return createConfiguration({
347
+ return createConfig({
352
348
  minification: true,
353
349
  sourceMaps: false,
354
350
  standalone: true
@@ -455,9 +451,11 @@ const watch$1 = (input) => {
455
451
  case "BUNDLE_END":
456
452
  await event.result.close();
457
453
  break;
458
- case "END":
459
- clearLog(`Build done in ${Date.now() - startDuration}ms (at ${(/* @__PURE__ */ new Date()).toLocaleTimeString()})`, { type: "success" });
454
+ case "END": {
455
+ const duration = Date.now() - startDuration;
456
+ clearLog(`Build done in ${duration}ms (at ${(/* @__PURE__ */ new Date()).toLocaleTimeString()})`, { type: "success" });
460
457
  return;
458
+ }
461
459
  case "ERROR": {
462
460
  const { error } = event;
463
461
  clearLog(error.message, { type: "error" });
@@ -484,7 +482,7 @@ const createWatchCommand = (program) => {
484
482
  description: "Watch and rebuild on any code change (development mode)",
485
483
  name: "watch"
486
484
  }).task({ handler(context) {
487
- watch$1(createConfiguration({
485
+ watch$1(createConfig({
488
486
  minification: context.minification,
489
487
  sourceMaps: context.sourceMaps,
490
488
  standalone: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickbundle",
3
- "version": "3.0.0-next-ad3f6ff",
3
+ "version": "3.0.0-next-9f62eb1",
4
4
  "description": "The zero-configuration transpiler and bundler for the web",
5
5
  "keywords": [
6
6
  "library",
@@ -43,14 +43,14 @@
43
43
  "@rollup/plugin-url": "^8.0.2",
44
44
  "decompress": "^4.2.1",
45
45
  "gzip-size": "^7.0.0",
46
- "rolldown": "^1.0.2",
47
- "rolldown-plugin-dts": "^0.25.1",
46
+ "rolldown": "^1.2.0",
47
+ "rolldown-plugin-dts": "^0.27.14",
48
48
  "rollup-plugin-node-externals": "^9.0.1",
49
- "termost": "^1.9.0"
49
+ "termost": "^1.9.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/decompress": "4.2.7",
53
- "@types/node": "24.12.4"
53
+ "@types/node": "24.13.3"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "typescript": "^4.7.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"