bunup 0.8.9 → 0.8.10
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 +1 -1
- package/dist/plugins.cjs +13 -18
- package/dist/plugins.d.cts +3 -1
- package/dist/plugins.d.ts +3 -1
- package/dist/plugins.js +14 -19
- package/package.json +1 -1
package/dist/cli.js
CHANGED
package/dist/plugins.cjs
CHANGED
|
@@ -410,6 +410,9 @@ function getUpdatedPackageJson(oldPackageJson, newPackageJson) {
|
|
|
410
410
|
return JSON.stringify(newPackageJson, null, getJsonSpaceCount(oldPackageJson)) + (hasTrailingNewline ? `
|
|
411
411
|
` : "");
|
|
412
412
|
}
|
|
413
|
+
function isDirectoryPath(filePath) {
|
|
414
|
+
return import_node_path.default.extname(filePath) === "";
|
|
415
|
+
}
|
|
413
416
|
|
|
414
417
|
// src/plugins/built-in/productivity/exports.ts
|
|
415
418
|
function exports2() {
|
|
@@ -637,31 +640,23 @@ function injectStyles(options) {
|
|
|
637
640
|
};
|
|
638
641
|
}
|
|
639
642
|
// src/plugins/built-in/productivity/copy.ts
|
|
640
|
-
var import_promises = require("fs/promises");
|
|
641
643
|
var import_node_path3 = require("path");
|
|
642
|
-
|
|
644
|
+
var import_node_path4 = require("path");
|
|
645
|
+
function copy(patterns, outPath) {
|
|
643
646
|
return {
|
|
644
647
|
type: "bunup",
|
|
645
648
|
name: "copy",
|
|
646
649
|
hooks: {
|
|
647
650
|
onBuildDone: async ({ options, meta }) => {
|
|
648
|
-
const
|
|
649
|
-
const baseDir = meta.rootDir;
|
|
651
|
+
const destinationPath = outPath || options.outDir;
|
|
650
652
|
for (const pattern of patterns) {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
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}`));
|
|
653
|
+
const glob = new Bun.Glob(pattern);
|
|
654
|
+
for await (const filePath of glob.scan({
|
|
655
|
+
cwd: meta.rootDir,
|
|
656
|
+
dot: true
|
|
657
|
+
})) {
|
|
658
|
+
const sourceFile = Bun.file(import_node_path3.join(meta.rootDir, filePath));
|
|
659
|
+
await Bun.write(outPath && isDirectoryPath(outPath) ? import_node_path3.join(destinationPath, import_node_path4.basename(filePath)) : destinationPath, sourceFile);
|
|
665
660
|
}
|
|
666
661
|
}
|
|
667
662
|
}
|
package/dist/plugins.d.cts
CHANGED
|
@@ -415,7 +415,9 @@ declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
|
|
|
415
415
|
/**
|
|
416
416
|
* A plugin that copies files and directories to the output directory.
|
|
417
417
|
*
|
|
418
|
+
* @param patterns - Array of glob patterns to match files for copying
|
|
419
|
+
* @param outPath - Optional output path. If not provided, uses the build output directory
|
|
418
420
|
* @see https://bunup.dev/docs/plugins/productivity#copy
|
|
419
421
|
*/
|
|
420
|
-
declare function copy(patterns: string[],
|
|
422
|
+
declare function copy(patterns: string[], outPath?: string): BunupPlugin;
|
|
421
423
|
export { shims, report, injectStyles, filterJsDtsFiles, exports, copy };
|
package/dist/plugins.d.ts
CHANGED
|
@@ -415,7 +415,9 @@ declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
|
|
|
415
415
|
/**
|
|
416
416
|
* A plugin that copies files and directories to the output directory.
|
|
417
417
|
*
|
|
418
|
+
* @param patterns - Array of glob patterns to match files for copying
|
|
419
|
+
* @param outPath - Optional output path. If not provided, uses the build output directory
|
|
418
420
|
* @see https://bunup.dev/docs/plugins/productivity#copy
|
|
419
421
|
*/
|
|
420
|
-
declare function copy(patterns: string[],
|
|
422
|
+
declare function copy(patterns: string[], outPath?: string): BunupPlugin;
|
|
421
423
|
export { shims, report, injectStyles, filterJsDtsFiles, exports, copy };
|
package/dist/plugins.js
CHANGED
|
@@ -374,6 +374,9 @@ function getUpdatedPackageJson(oldPackageJson, newPackageJson) {
|
|
|
374
374
|
return JSON.stringify(newPackageJson, null, getJsonSpaceCount(oldPackageJson)) + (hasTrailingNewline ? `
|
|
375
375
|
` : "");
|
|
376
376
|
}
|
|
377
|
+
function isDirectoryPath(filePath) {
|
|
378
|
+
return path.extname(filePath) === "";
|
|
379
|
+
}
|
|
377
380
|
|
|
378
381
|
// src/plugins/built-in/productivity/exports.ts
|
|
379
382
|
function exports() {
|
|
@@ -601,31 +604,23 @@ function injectStyles(options) {
|
|
|
601
604
|
};
|
|
602
605
|
}
|
|
603
606
|
// src/plugins/built-in/productivity/copy.ts
|
|
604
|
-
import {
|
|
605
|
-
import {
|
|
606
|
-
function copy(patterns,
|
|
607
|
+
import { join } from "path";
|
|
608
|
+
import { basename } from "path";
|
|
609
|
+
function copy(patterns, outPath) {
|
|
607
610
|
return {
|
|
608
611
|
type: "bunup",
|
|
609
612
|
name: "copy",
|
|
610
613
|
hooks: {
|
|
611
614
|
onBuildDone: async ({ options, meta }) => {
|
|
612
|
-
const
|
|
613
|
-
const baseDir = meta.rootDir;
|
|
615
|
+
const destinationPath = outPath || options.outDir;
|
|
614
616
|
for (const pattern of patterns) {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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}`));
|
|
617
|
+
const glob = new Bun.Glob(pattern);
|
|
618
|
+
for await (const filePath of glob.scan({
|
|
619
|
+
cwd: meta.rootDir,
|
|
620
|
+
dot: true
|
|
621
|
+
})) {
|
|
622
|
+
const sourceFile = Bun.file(join(meta.rootDir, filePath));
|
|
623
|
+
await Bun.write(outPath && isDirectoryPath(outPath) ? join(destinationPath, basename(filePath)) : destinationPath, sourceFile);
|
|
629
624
|
}
|
|
630
625
|
}
|
|
631
626
|
}
|