bunup 0.8.7 → 0.8.9

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
@@ -517,9 +517,7 @@ async function newProject() {
517
517
  if (useMonorepo && monorepoFirstPackageName) {
518
518
  await replaceInFile({
519
519
  files: path5.join(projectPath, "**/*"),
520
- from: [
521
- new RegExp(MONOREPO_FIRST_PACKAGE_NAME_PLACEHOLDER, "g")
522
- ],
520
+ from: [new RegExp(MONOREPO_FIRST_PACKAGE_NAME_PLACEHOLDER, "g")],
523
521
  to: [monorepoFirstPackageName],
524
522
  ignore: ["node_modules", "dist", "bun.lock"]
525
523
  });
@@ -553,6 +551,11 @@ var init_new = __esm(() => {
553
551
  name: "Typescript Library",
554
552
  dir: "ts-lib",
555
553
  monorepoDir: "ts-lib-monorepo"
554
+ },
555
+ {
556
+ defaultName: "my-react-lib",
557
+ name: "React Library",
558
+ dir: "react-lib"
556
559
  }
557
560
  ];
558
561
  });
@@ -560,7 +563,7 @@ var init_new = __esm(() => {
560
563
  // src/cli/index.ts
561
564
  import { exec } from "tinyexec";
562
565
  // package.json
563
- var version = "0.8.7";
566
+ var version = "0.8.9";
564
567
 
565
568
  // src/cli/index.ts
566
569
  init_errors();
@@ -1136,7 +1139,8 @@ async function build(partialOptions, rootDir = process.cwd()) {
1136
1139
  await Promise.all(dtsPromises);
1137
1140
  }
1138
1141
  await runPluginBuildDoneHooks(bunupPlugins, options, buildOutput, {
1139
- packageJson
1142
+ packageJson,
1143
+ rootDir
1140
1144
  });
1141
1145
  if (options.onSuccess) {
1142
1146
  await options.onSuccess(options);
package/dist/index.cjs CHANGED
@@ -668,7 +668,8 @@ async function build(partialOptions, rootDir = process.cwd()) {
668
668
  await Promise.all(dtsPromises);
669
669
  }
670
670
  await runPluginBuildDoneHooks(bunupPlugins, options, buildOutput, {
671
- packageJson
671
+ packageJson,
672
+ rootDir
672
673
  });
673
674
  if (options.onSuccess) {
674
675
  await options.onSuccess(options);
package/dist/index.d.cts CHANGED
@@ -22,6 +22,8 @@ type BunupBunPlugin = {
22
22
  type BuildMeta = {
23
23
  /** The package.json file */
24
24
  packageJson: PackageJson
25
+ /** The root directory of the build */
26
+ rootDir: string
25
27
  };
26
28
  type BuildOutputFile = {
27
29
  /** Path to the generated file */
package/dist/index.d.ts CHANGED
@@ -22,6 +22,8 @@ type BunupBunPlugin = {
22
22
  type BuildMeta = {
23
23
  /** The package.json file */
24
24
  packageJson: PackageJson
25
+ /** The root directory of the build */
26
+ rootDir: string
25
27
  };
26
28
  type BuildOutputFile = {
27
29
  /** Path to the generated file */
package/dist/index.js CHANGED
@@ -635,7 +635,8 @@ async function build(partialOptions, rootDir = process.cwd()) {
635
635
  await Promise.all(dtsPromises);
636
636
  }
637
637
  await runPluginBuildDoneHooks(bunupPlugins, options, buildOutput, {
638
- packageJson
638
+ packageJson,
639
+ rootDir
639
640
  });
640
641
  if (options.onSuccess) {
641
642
  await options.onSuccess(options);
package/dist/plugins.cjs CHANGED
@@ -118,7 +118,8 @@ __export(exports_built_in, {
118
118
  report: () => report,
119
119
  injectStyles: () => injectStyles,
120
120
  filterJsDtsFiles: () => filterJsDtsFiles,
121
- exports: () => exports2
121
+ exports: () => exports2,
122
+ copy: () => copy
122
123
  });
123
124
  module.exports = __toCommonJS(exports_built_in);
124
125
 
@@ -635,4 +636,36 @@ function injectStyles(options) {
635
636
  }
636
637
  };
637
638
  }
639
+ // src/plugins/built-in/productivity/copy.ts
640
+ var import_promises = require("fs/promises");
641
+ var import_node_path3 = require("path");
642
+ function copy(patterns, outDir) {
643
+ return {
644
+ type: "bunup",
645
+ name: "copy",
646
+ hooks: {
647
+ onBuildDone: async ({ options, meta }) => {
648
+ const targetDir = outDir || options.outDir;
649
+ const baseDir = meta.rootDir;
650
+ for (const pattern of patterns) {
651
+ let globPattern = pattern;
652
+ if (!pattern.includes("*") && !pattern.includes("?")) {
653
+ try {
654
+ const stats = await import_promises.stat(`${baseDir}/${pattern}`);
655
+ if (stats.isDirectory()) {
656
+ globPattern = `${pattern}/**/*`;
657
+ }
658
+ } catch {}
659
+ }
660
+ const glob = new Bun.Glob(globPattern);
661
+ for await (const file of glob.scan(baseDir)) {
662
+ const targetPath = `${targetDir}/${file}`;
663
+ await import_promises.mkdir(import_node_path3.dirname(targetPath), { recursive: true });
664
+ await Bun.write(targetPath, Bun.file(`${baseDir}/${file}`));
665
+ }
666
+ }
667
+ }
668
+ }
669
+ };
670
+ }
638
671
  })
@@ -306,6 +306,8 @@ type BunupBunPlugin = {
306
306
  type BuildMeta = {
307
307
  /** The package.json file */
308
308
  packageJson: PackageJson
309
+ /** The root directory of the build */
310
+ rootDir: string
309
311
  };
310
312
  type BuildOutputFile = {
311
313
  /** Path to the generated file */
@@ -410,4 +412,10 @@ type InjectStylesPluginOptions = Pick<import("lightningcss").TransformOptions<im
410
412
  * @see https://bunup.dev/docs/plugins/css#injectstyles
411
413
  */
412
414
  declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
413
- export { shims, report, injectStyles, filterJsDtsFiles, exports };
415
+ /**
416
+ * A plugin that copies files and directories to the output directory.
417
+ *
418
+ * @see https://bunup.dev/docs/plugins/productivity#copy
419
+ */
420
+ declare function copy(patterns: string[], outDir?: string): BunupPlugin;
421
+ export { shims, report, injectStyles, filterJsDtsFiles, exports, copy };
package/dist/plugins.d.ts CHANGED
@@ -306,6 +306,8 @@ type BunupBunPlugin = {
306
306
  type BuildMeta = {
307
307
  /** The package.json file */
308
308
  packageJson: PackageJson
309
+ /** The root directory of the build */
310
+ rootDir: string
309
311
  };
310
312
  type BuildOutputFile = {
311
313
  /** Path to the generated file */
@@ -410,4 +412,10 @@ type InjectStylesPluginOptions = Pick<import("lightningcss").TransformOptions<im
410
412
  * @see https://bunup.dev/docs/plugins/css#injectstyles
411
413
  */
412
414
  declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
413
- export { shims, report, injectStyles, filterJsDtsFiles, exports };
415
+ /**
416
+ * A plugin that copies files and directories to the output directory.
417
+ *
418
+ * @see https://bunup.dev/docs/plugins/productivity#copy
419
+ */
420
+ declare function copy(patterns: string[], outDir?: string): BunupPlugin;
421
+ export { shims, report, injectStyles, filterJsDtsFiles, exports, copy };
package/dist/plugins.js CHANGED
@@ -600,10 +600,43 @@ function injectStyles(options) {
600
600
  }
601
601
  };
602
602
  }
603
+ // src/plugins/built-in/productivity/copy.ts
604
+ import { mkdir, stat } from "fs/promises";
605
+ import { dirname } from "path";
606
+ function copy(patterns, outDir) {
607
+ return {
608
+ type: "bunup",
609
+ name: "copy",
610
+ hooks: {
611
+ onBuildDone: async ({ options, meta }) => {
612
+ const targetDir = outDir || options.outDir;
613
+ const baseDir = meta.rootDir;
614
+ for (const pattern of patterns) {
615
+ let globPattern = pattern;
616
+ if (!pattern.includes("*") && !pattern.includes("?")) {
617
+ try {
618
+ const stats = await stat(`${baseDir}/${pattern}`);
619
+ if (stats.isDirectory()) {
620
+ globPattern = `${pattern}/**/*`;
621
+ }
622
+ } catch {}
623
+ }
624
+ const glob = new Bun.Glob(globPattern);
625
+ for await (const file of glob.scan(baseDir)) {
626
+ const targetPath = `${targetDir}/${file}`;
627
+ await mkdir(dirname(targetPath), { recursive: true });
628
+ await Bun.write(targetPath, Bun.file(`${baseDir}/${file}`));
629
+ }
630
+ }
631
+ }
632
+ }
633
+ };
634
+ }
603
635
  export {
604
636
  shims,
605
637
  report,
606
638
  injectStyles,
607
639
  filterJsDtsFiles,
608
- exports
640
+ exports,
641
+ copy
609
642
  };
package/package.json CHANGED
@@ -1,101 +1,101 @@
1
1
  {
2
- "name": "bunup",
3
- "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
- "version": "0.8.7",
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
- ]
2
+ "name": "bunup",
3
+ "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
+ "version": "0.8.9",
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
+ ]
101
101
  }