bunup 0.11.25 → 0.11.26

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/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  build,
5
5
  createBuildOptions,
6
6
  processLoadedConfigs
7
- } from "../shared/bunup-yaq8w9a4.js";
7
+ } from "../shared/bunup-sh4qzm7v.js";
8
8
  import {
9
9
  BunupCLIError,
10
10
  BunupWatchError,
@@ -18,13 +18,13 @@ import {
18
18
  logger,
19
19
  parseErrorMessage,
20
20
  setSilent
21
- } from "../shared/bunup-ed9pv5cz.js";
21
+ } from "../shared/bunup-7pt8z3ak.js";
22
22
 
23
23
  // packages/bunup/src/cli/index.ts
24
24
  import { loadConfig } from "coffi";
25
25
  import pc3 from "picocolors";
26
26
  // packages/bunup/package.json
27
- var version = "0.11.25";
27
+ var version = "0.11.26";
28
28
 
29
29
  // packages/bunup/src/watch.ts
30
30
  import path from "path";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arrayable, BuildContext, BuildMeta, BuildOptions, BuildOutput, BuildOutputFile, BunupPlugin, DefineConfigItem, DefineWorkspaceItem, WithOptional } from "./shared/bunup-r5ahaj5s";
1
+ import { Arrayable, BuildContext, BuildMeta, BuildOptions, BuildOutput, BuildOutputFile, BunupPlugin, DefineConfigItem, DefineWorkspaceItem, WithOptional } from "./shared/bunup-e4mbn453";
2
2
  declare function build(partialOptions: Partial<BuildOptions>, rootDir?: string): Promise<void>;
3
3
  declare function defineConfig(options: Arrayable<DefineConfigItem>): Arrayable<DefineConfigItem>;
4
4
  declare function defineWorkspace(options: WithOptional<DefineWorkspaceItem, "config">[], sharedOptions?: Partial<DefineConfigItem>): DefineWorkspaceItem[];
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  build
4
- } from "./shared/bunup-yaq8w9a4.js";
5
- import"./shared/bunup-ed9pv5cz.js";
4
+ } from "./shared/bunup-sh4qzm7v.js";
5
+ import"./shared/bunup-7pt8z3ak.js";
6
6
  // packages/bunup/src/define.ts
7
7
  function defineConfig(options) {
8
8
  return options;
package/dist/plugins.d.ts CHANGED
@@ -1,10 +1,15 @@
1
- import { BuildContext, BunupPlugin, MaybePromise } from "./shared/bunup-r5ahaj5s";
1
+ import { BuildContext, BunupPlugin, BunupPluginHooks, MaybePromise } from "./shared/bunup-e4mbn453";
2
2
  type CopyOptions = {
3
3
  /** Whether to follow symbolic links when copying files. */
4
4
  followSymlinks?: boolean
5
5
  /** Whether to exclude dotfiles (files starting with a dot) from being copied. */
6
6
  excludeDotfiles?: boolean
7
7
  };
8
+ /**
9
+ * A plugin that copies files and directories to the output directory.
10
+ *
11
+ * @see https://bunup.dev/docs/plugins/copy
12
+ */
8
13
  declare function copy(pattern: string | string[]): BunupPlugin & CopyBuilder;
9
14
  declare class CopyBuilder {
10
15
  private _patterns;
@@ -12,7 +17,8 @@ declare class CopyBuilder {
12
17
  private _options?;
13
18
  constructor(pattern: string | string[]);
14
19
  /**
15
- * Sets the destination directory where files will be copied.
20
+ * Sets the destination directory or file path where files will be copied.
21
+ * Relative to the output directory.
16
22
  */
17
23
  to(destination: string): this;
18
24
  /**
@@ -20,7 +26,7 @@ declare class CopyBuilder {
20
26
  */
21
27
  with(options: CopyOptions): this;
22
28
  get name(): string;
23
- get hooks(): BunupPlugin["hooks"];
29
+ get hooks(): BunupPluginHooks;
24
30
  }
25
31
  type CustomExports = Record<string, string | Record<string, string | Record<string, string>>>;
26
32
  type Exclude = ((ctx: BuildContext) => string[] | undefined) | string[];
package/dist/plugins.js CHANGED
@@ -7,8 +7,9 @@ import {
7
7
  detectFileFormatting,
8
8
  ensureArray,
9
9
  formatListWithAnd,
10
+ isGlobPattern,
10
11
  logger
11
- } from "./shared/bunup-ed9pv5cz.js";
12
+ } from "./shared/bunup-7pt8z3ak.js";
12
13
 
13
14
  // packages/bunup/src/plugins/built-in/copy.ts
14
15
  import { basename, extname, join } from "path";
@@ -55,15 +56,15 @@ class CopyBuilder {
55
56
  for await (const scannedPath of glob.scan({
56
57
  cwd: meta.rootDir,
57
58
  dot: !this._options?.excludeDotfiles,
58
- onlyFiles: !isPatternFolder(pattern),
59
+ onlyFiles: isGlobPattern(pattern),
59
60
  followSymlinks: this._options?.followSymlinks
60
61
  })) {
61
62
  const sourcePath = join(meta.rootDir, scannedPath);
62
- const destinationDir = resolveDestinationPath(destinationPath, scannedPath, meta.rootDir);
63
- if (isPathDir(sourcePath)) {
64
- await copyDirectory(sourcePath, destinationDir);
63
+ const finalDestinationPath = resolveDestinationPath(destinationPath, scannedPath, meta.rootDir);
64
+ if (isDirectoryPath(sourcePath)) {
65
+ await copyDirectory(sourcePath, finalDestinationPath);
65
66
  } else {
66
- await copyFile(sourcePath, destinationDir);
67
+ await copyFile(sourcePath, finalDestinationPath);
67
68
  }
68
69
  }
69
70
  }
@@ -73,25 +74,22 @@ class CopyBuilder {
73
74
  }
74
75
  function resolveDestinationPath(destinationPath, scannedPath, rootDir) {
75
76
  const fullDestinationPath = join(rootDir, destinationPath);
76
- const isScannedPathDir = isPathDir(scannedPath);
77
- const isDestinationDir = isPathDir(fullDestinationPath);
77
+ const isScannedPathDir = isDirectoryPath(scannedPath);
78
+ const isDestinationDir = isDirectoryPath(fullDestinationPath);
78
79
  if (isDestinationDir && !isScannedPathDir) {
79
80
  return join(fullDestinationPath, basename(scannedPath));
80
81
  }
81
82
  return fullDestinationPath;
82
83
  }
83
- function isPatternFolder(pattern) {
84
- return !pattern.includes("/");
85
- }
86
- function isPathDir(filePath) {
84
+ function isDirectoryPath(filePath) {
87
85
  return extname(filePath) === "";
88
86
  }
89
- async function copyDirectory(sourcePath, destinationPath) {
90
- await Bun.$`cp -r ${sourcePath} ${destinationPath}`;
87
+ async function copyDirectory(sourcePath, finalDestinationPath) {
88
+ await Bun.$`cp -r ${sourcePath} ${finalDestinationPath}`;
91
89
  }
92
- async function copyFile(sourcePath, destinationPath) {
90
+ async function copyFile(sourcePath, finalDestinationPath) {
93
91
  const sourceFile = Bun.file(sourcePath);
94
- await Bun.write(destinationPath, sourceFile);
92
+ await Bun.write(finalDestinationPath, sourceFile);
95
93
  }
96
94
  // packages/bunup/src/plugins/built-in/exports.ts
97
95
  import path from "path";
@@ -455,5 +455,8 @@ async function detectFileFormatting(filePath) {
455
455
  return { indentation: " ", hasTrailingNewline: true };
456
456
  }
457
457
  }
458
+ function isGlobPattern(pattern) {
459
+ return /[*?[\]{}]/.test(pattern);
460
+ }
458
461
 
459
- export { __toESM, __require, silent, setSilent, logTable, logTime, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, parseErrorMessage, handleError, handleErrorAndExit, JS_TS_RE, JS_DTS_RE, CSS_RE, ensureArray, getDefaultJsOutputExtension, getDefaultDtsOutputExtention, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, formatListWithAnd, getFilesFromGlobs, isTypeScriptFile, isJavascriptFile, replaceExtension, detectFileFormatting };
462
+ export { __toESM, __require, silent, setSilent, logTable, logTime, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, parseErrorMessage, handleError, handleErrorAndExit, JS_TS_RE, JS_DTS_RE, CSS_RE, ensureArray, getDefaultJsOutputExtension, getDefaultDtsOutputExtention, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, formatListWithAnd, getFilesFromGlobs, isTypeScriptFile, isJavascriptFile, replaceExtension, detectFileFormatting, isGlobPattern };
@@ -429,4 +429,4 @@ type DefineWorkspaceItem = {
429
429
  root: string
430
430
  config: DefineConfigItem | DefineConfigItem[]
431
431
  };
432
- export { MaybePromise, WithOptional, Arrayable, DefineConfigItem, DefineWorkspaceItem, BuildMeta, BuildOutputFile, BuildOutput, BuildContext, BunupPlugin, BuildOptions };
432
+ export { MaybePromise, WithOptional, Arrayable, DefineConfigItem, DefineWorkspaceItem, BuildMeta, BuildOutputFile, BuildOutput, BuildContext, BunupPluginHooks, BunupPlugin, BuildOptions };
@@ -19,7 +19,7 @@ import {
19
19
  replaceExtension,
20
20
  setSilent,
21
21
  silent
22
- } from "./bunup-ed9pv5cz.js";
22
+ } from "./bunup-7pt8z3ak.js";
23
23
 
24
24
  // packages/bunup/src/loaders.ts
25
25
  import path from "path";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bunup",
3
3
  "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
- "version": "0.11.25",
4
+ "version": "0.11.26",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -47,7 +47,7 @@
47
47
  "bunup": "dist/cli/index.js"
48
48
  },
49
49
  "dependencies": {
50
- "@bunup/dts": "0.11.25",
50
+ "@bunup/dts": "0.11.26",
51
51
  "chokidar": "^4.0.3",
52
52
  "coffi": "^0.1.35",
53
53
  "lightningcss": "^1.30.1",