bunup 0.8.6 → 0.8.8

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/dist/cli.js CHANGED
@@ -251,7 +251,7 @@ var init_logger = __esm(() => {
251
251
  });
252
252
 
253
253
  // src/errors.ts
254
- var import_picocolors2, BunupError, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, parseErrorMessage = (error) => {
254
+ var import_picocolors2, BunupError, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, BunupPluginError, parseErrorMessage = (error) => {
255
255
  if (error instanceof Error) {
256
256
  return error.message;
257
257
  }
@@ -268,6 +268,8 @@ var import_picocolors2, BunupError, BunupBuildError, BunupDTSBuildError, BunupCL
268
268
  errorType = "CLI ERROR";
269
269
  } else if (error instanceof BunupWatchError) {
270
270
  errorType = "WATCH ERROR";
271
+ } else if (error instanceof BunupPluginError) {
272
+ errorType = "PLUGIN ERROR";
271
273
  } else if (error instanceof BunupError) {
272
274
  errorType = "BUNUP ERROR";
273
275
  }
@@ -321,6 +323,12 @@ var init_errors = __esm(() => {
321
323
  this.name = "BunupWatchError";
322
324
  }
323
325
  };
326
+ BunupPluginError = class BunupPluginError extends BunupError {
327
+ constructor(message) {
328
+ super(message);
329
+ this.name = "BunupPluginError";
330
+ }
331
+ };
324
332
  KNOWN_ERRORS = [
325
333
  {
326
334
  pattern: /Could not resolve: "bun"/i,
@@ -509,9 +517,7 @@ async function newProject() {
509
517
  if (useMonorepo && monorepoFirstPackageName) {
510
518
  await replaceInFile({
511
519
  files: path5.join(projectPath, "**/*"),
512
- from: [
513
- new RegExp(MONOREPO_FIRST_PACKAGE_NAME_PLACEHOLDER, "g")
514
- ],
520
+ from: [new RegExp(MONOREPO_FIRST_PACKAGE_NAME_PLACEHOLDER, "g")],
515
521
  to: [monorepoFirstPackageName],
516
522
  ignore: ["node_modules", "dist", "bun.lock"]
517
523
  });
@@ -545,6 +551,11 @@ var init_new = __esm(() => {
545
551
  name: "Typescript Library",
546
552
  dir: "ts-lib",
547
553
  monorepoDir: "ts-lib-monorepo"
554
+ },
555
+ {
556
+ defaultName: "my-react-lib",
557
+ name: "React Library",
558
+ dir: "react-lib"
548
559
  }
549
560
  ];
550
561
  });
@@ -552,7 +563,7 @@ var init_new = __esm(() => {
552
563
  // src/cli/index.ts
553
564
  import { exec } from "tinyexec";
554
565
  // package.json
555
- var version = "0.8.6";
566
+ var version = "0.8.8";
556
567
 
557
568
  // src/cli/index.ts
558
569
  init_errors();
@@ -970,6 +981,7 @@ function externalOptionPlugin(options, packageJson) {
970
981
 
971
982
  // src/plugins/utils.ts
972
983
  var import_picocolors4 = __toESM(require_picocolors(), 1);
984
+ init_errors();
973
985
  function filterBunupBunPlugins(plugins) {
974
986
  if (!plugins)
975
987
  return [];
@@ -1059,12 +1071,7 @@ async function build(partialOptions, rootDir = process.cwd()) {
1059
1071
  });
1060
1072
  for (const log of result.logs) {
1061
1073
  if (log.level === "error") {
1062
- console.log(`
1063
- `);
1064
- console.log(log);
1065
- console.log(`
1066
- `);
1067
- throw new Error;
1074
+ throw new BunupBuildError(log.message);
1068
1075
  }
1069
1076
  if (log.level === "warning")
1070
1077
  logger.warn(log.message);
@@ -1183,6 +1190,7 @@ async function watch(partialOptions, rootDir) {
1183
1190
  }
1184
1191
  isRebuilding = true;
1185
1192
  try {
1193
+ await new Promise((resolve) => setTimeout(resolve, 20));
1186
1194
  const start = performance.now();
1187
1195
  await build(options, rootDir);
1188
1196
  if (!initial) {
package/dist/index.cjs CHANGED
@@ -600,12 +600,7 @@ async function build(partialOptions, rootDir = process.cwd()) {
600
600
  });
601
601
  for (const log of result.logs) {
602
602
  if (log.level === "error") {
603
- console.log(`
604
- `);
605
- console.log(log);
606
- console.log(`
607
- `);
608
- throw new Error;
603
+ throw new BunupBuildError(log.message);
609
604
  }
610
605
  if (log.level === "warning")
611
606
  logger.warn(log.message);
package/dist/index.js CHANGED
@@ -567,12 +567,7 @@ async function build(partialOptions, rootDir = process.cwd()) {
567
567
  });
568
568
  for (const log of result.logs) {
569
569
  if (log.level === "error") {
570
- console.log(`
571
- `);
572
- console.log(log);
573
- console.log(`
574
- `);
575
- throw new Error;
570
+ throw new BunupBuildError(log.message);
576
571
  }
577
572
  if (log.level === "warning")
578
573
  logger.warn(log.message);
package/dist/plugins.cjs CHANGED
@@ -367,6 +367,18 @@ var import_node_path = __toESM(require("path"));
367
367
 
368
368
  // src/errors.ts
369
369
  var import_picocolors2 = __toESM(require_picocolors());
370
+ class BunupError extends Error {
371
+ constructor(message) {
372
+ super(message);
373
+ this.name = "BunupError";
374
+ }
375
+ }
376
+ class BunupPluginError extends BunupError {
377
+ constructor(message) {
378
+ super(message);
379
+ this.name = "BunupPluginError";
380
+ }
381
+ }
370
382
 
371
383
  // src/utils.ts
372
384
  function getJsonSpaceCount(fileContent) {
@@ -560,7 +572,7 @@ async function getPackageForPlugin(name, pluginName) {
560
572
  try {
561
573
  pkg = await import(name);
562
574
  } catch {
563
- throw new Error(`[${import_picocolors4.default.cyan(name)}] is required for the ${pluginName} plugin. Please install it with: ${import_picocolors4.default.blue(`bun add ${name} --dev`)}`);
575
+ throw new BunupPluginError(`[${import_picocolors4.default.cyan(name)}] is required for the ${pluginName} plugin. Please install it with: ${import_picocolors4.default.blue(`bun add ${name} --dev`)}`);
564
576
  }
565
577
  return pkg;
566
578
  }
@@ -407,7 +407,7 @@ type InjectStylesPluginOptions = Pick<import("lightningcss").TransformOptions<im
407
407
  /**
408
408
  * A plugin that injects styles into the document head.
409
409
  *
410
- * @see https://bunup.dev/docs/plugins/css#inject-styles
410
+ * @see https://bunup.dev/docs/plugins/css#injectstyles
411
411
  */
412
412
  declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
413
413
  export { shims, report, injectStyles, filterJsDtsFiles, exports };
package/dist/plugins.d.ts CHANGED
@@ -407,7 +407,7 @@ type InjectStylesPluginOptions = Pick<import("lightningcss").TransformOptions<im
407
407
  /**
408
408
  * A plugin that injects styles into the document head.
409
409
  *
410
- * @see https://bunup.dev/docs/plugins/css#inject-styles
410
+ * @see https://bunup.dev/docs/plugins/css#injectstyles
411
411
  */
412
412
  declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
413
413
  export { shims, report, injectStyles, filterJsDtsFiles, exports };
package/dist/plugins.js CHANGED
@@ -332,6 +332,18 @@ import path, { normalize } from "path";
332
332
 
333
333
  // src/errors.ts
334
334
  var import_picocolors2 = __toESM(require_picocolors(), 1);
335
+ class BunupError extends Error {
336
+ constructor(message) {
337
+ super(message);
338
+ this.name = "BunupError";
339
+ }
340
+ }
341
+ class BunupPluginError extends BunupError {
342
+ constructor(message) {
343
+ super(message);
344
+ this.name = "BunupPluginError";
345
+ }
346
+ }
335
347
 
336
348
  // src/utils.ts
337
349
  function getJsonSpaceCount(fileContent) {
@@ -525,7 +537,7 @@ async function getPackageForPlugin(name, pluginName) {
525
537
  try {
526
538
  pkg = await import(name);
527
539
  } catch {
528
- throw new Error(`[${import_picocolors4.default.cyan(name)}] is required for the ${pluginName} plugin. Please install it with: ${import_picocolors4.default.blue(`bun add ${name} --dev`)}`);
540
+ throw new BunupPluginError(`[${import_picocolors4.default.cyan(name)}] is required for the ${pluginName} plugin. Please install it with: ${import_picocolors4.default.blue(`bun add ${name} --dev`)}`);
529
541
  }
530
542
  return pkg;
531
543
  }
package/package.json CHANGED
@@ -1,102 +1,101 @@
1
1
  {
2
- "name": "bunup",
3
- "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
- "version": "0.8.6",
5
- "type": "module",
6
- "files": [
7
- "dist",
8
- "bin"
9
- ],
10
- "module": "./dist/index.js",
11
- "main": "./dist/index.cjs",
12
- "types": "./dist/index.d.cts",
13
- "exports": {
14
- ".": {
15
- "import": "./dist/index.js",
16
- "require": "./dist/index.cjs",
17
- "types": "./dist/index.d.cts"
18
- },
19
- "./plugins": {
20
- "import": "./dist/plugins.js",
21
- "require": "./dist/plugins.cjs",
22
- "types": "./dist/plugins.d.cts"
23
- }
24
- },
25
- "license": "MIT",
26
- "author": "Arshad Yaseen <m@arshadyaseen.com> (https://arshadyaseen.com)",
27
- "maintainers": [
28
- {
29
- "name": "Arshad Yaseen",
30
- "email": "m@arshadyaseen.com",
31
- "url": "https://arshadyaseen.com"
32
- }
33
- ],
34
- "repository": {
35
- "type": "git",
36
- "url": "git+https://github.com/arshad-yaseen/bunup.git"
37
- },
38
- "funding": "https://github.com/sponsors/arshad-yaseen",
39
- "homepage": "https://bunup.dev",
40
- "keywords": [
41
- "bun",
42
- "bunup",
43
- "bun-bundler"
44
- ],
45
- "bin": {
46
- "bunup": "bin/bunup.mjs"
47
- },
48
- "dependencies": {
49
- "@clack/prompts": "^0.10.1",
50
- "bun-dts": "^0.1.27",
51
- "chokidar": "^4.0.3",
52
- "coffi": "^0.1.29",
53
- "giget": "^2.0.0",
54
- "package-manager-detector": "^1.2.0",
55
- "replace-in-file": "^8.3.0",
56
- "tinyexec": "^1.0.1"
57
- },
58
- "devDependencies": {
59
- "@biomejs/biome": "^1.9.4",
60
- "@types/bun": "^1.2.5",
61
- "bumpp": "^10.1.0",
62
- "husky": "^9.1.7",
63
- "lint-staged": "^15.5.1",
64
- "typescript": "^5.8.3"
65
- },
66
- "peerDependencies": {
67
- "typescript": ">=4.5.0",
68
- "lightningcss": ">=1.17.0"
69
- },
70
- "peerDependenciesMeta": {
71
- "typescript": {
72
- "optional": true
73
- },
74
- "lightningcss": {
75
- "optional": true
76
- }
77
- },
78
- "scripts": {
79
- "build": "bunx bunup@latest",
80
- "build:docs": "bun run --cwd docs build",
81
- "dev": "bunx bunup@latest --watch",
82
- "dev:docs": "bun run --cwd docs dev",
83
- "format": "biome format .",
84
- "format:fix": "biome format --write .",
85
- "lint": "biome check .",
86
- "lint:fix": "biome check --write .",
87
- "prepare": "husky",
88
- "test": "bun test",
89
- "test-build": "bun run --cwd tests build",
90
- "tsc": "tsc --noEmit",
91
- "publish:ci": "bun publish --access public --no-git-checks",
92
- "release": "bumpp"
93
- },
94
- "lint-staged": {
95
- "*": "bun run format:fix && git add .",
96
- "src/**/*.(m|c)?(j|t)s": "bun run tsc"
97
- },
98
- "workspaces": [
99
- "docs",
100
- "tests"
101
- ]
2
+ "name": "bunup",
3
+ "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
+ "version": "0.8.8",
5
+ "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "bin"
9
+ ],
10
+ "module": "./dist/index.js",
11
+ "main": "./dist/index.cjs",
12
+ "types": "./dist/index.d.cts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs",
17
+ "types": "./dist/index.d.cts"
18
+ },
19
+ "./plugins": {
20
+ "import": "./dist/plugins.js",
21
+ "require": "./dist/plugins.cjs",
22
+ "types": "./dist/plugins.d.cts"
23
+ }
24
+ },
25
+ "license": "MIT",
26
+ "author": "Arshad Yaseen <m@arshadyaseen.com> (https://arshadyaseen.com)",
27
+ "maintainers": [
28
+ {
29
+ "name": "Arshad Yaseen",
30
+ "email": "m@arshadyaseen.com",
31
+ "url": "https://arshadyaseen.com"
32
+ }
33
+ ],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/arshad-yaseen/bunup.git"
37
+ },
38
+ "funding": "https://github.com/sponsors/arshad-yaseen",
39
+ "homepage": "https://bunup.dev",
40
+ "keywords": [
41
+ "bun",
42
+ "bunup",
43
+ "bun-bundler"
44
+ ],
45
+ "bin": {
46
+ "bunup": "bin/bunup.mjs"
47
+ },
48
+ "dependencies": {
49
+ "@clack/prompts": "^0.10.1",
50
+ "bun-dts": "^0.1.28",
51
+ "chokidar": "^4.0.3",
52
+ "coffi": "^0.1.29",
53
+ "giget": "^2.0.0",
54
+ "replace-in-file": "^8.3.0",
55
+ "tinyexec": "^1.0.1"
56
+ },
57
+ "devDependencies": {
58
+ "@biomejs/biome": "^1.9.4",
59
+ "@types/bun": "^1.2.5",
60
+ "bumpp": "^10.1.0",
61
+ "husky": "^9.1.7",
62
+ "lint-staged": "^15.5.1",
63
+ "typescript": "^5.8.3"
64
+ },
65
+ "peerDependencies": {
66
+ "typescript": ">=4.5.0",
67
+ "lightningcss": ">=1.17.0"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "typescript": {
71
+ "optional": true
72
+ },
73
+ "lightningcss": {
74
+ "optional": true
75
+ }
76
+ },
77
+ "scripts": {
78
+ "build": "bunx bunup@latest",
79
+ "build:docs": "bun run --cwd docs build",
80
+ "dev": "bunx bunup@latest --watch",
81
+ "dev:docs": "bun run --cwd docs dev",
82
+ "format": "biome format .",
83
+ "format:fix": "biome format --write .",
84
+ "lint": "biome check .",
85
+ "lint:fix": "biome check --write .",
86
+ "prepare": "husky",
87
+ "test": "bun test",
88
+ "test-build": "bun run --cwd tests build",
89
+ "tsc": "tsc --noEmit",
90
+ "publish:ci": "bun publish --access public --no-git-checks",
91
+ "release": "bumpp"
92
+ },
93
+ "lint-staged": {
94
+ "*": "bun run format:fix && git add .",
95
+ "src/**/*.(m|c)?(j|t)s": "bun run tsc"
96
+ },
97
+ "workspaces": [
98
+ "docs",
99
+ "tests"
100
+ ]
102
101
  }