bunup 0.8.8 → 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 +3 -2
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/plugins.cjs +29 -1
- package/dist/plugins.d.cts +11 -1
- package/dist/plugins.d.ts +11 -1
- package/dist/plugins.js +29 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -563,7 +563,7 @@ var init_new = __esm(() => {
|
|
|
563
563
|
// src/cli/index.ts
|
|
564
564
|
import { exec } from "tinyexec";
|
|
565
565
|
// package.json
|
|
566
|
-
var version = "0.8.
|
|
566
|
+
var version = "0.8.10";
|
|
567
567
|
|
|
568
568
|
// src/cli/index.ts
|
|
569
569
|
init_errors();
|
|
@@ -1139,7 +1139,8 @@ async function build(partialOptions, rootDir = process.cwd()) {
|
|
|
1139
1139
|
await Promise.all(dtsPromises);
|
|
1140
1140
|
}
|
|
1141
1141
|
await runPluginBuildDoneHooks(bunupPlugins, options, buildOutput, {
|
|
1142
|
-
packageJson
|
|
1142
|
+
packageJson,
|
|
1143
|
+
rootDir
|
|
1143
1144
|
});
|
|
1144
1145
|
if (options.onSuccess) {
|
|
1145
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
package/dist/index.d.ts
CHANGED
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
|
|
|
@@ -409,6 +410,9 @@ function getUpdatedPackageJson(oldPackageJson, newPackageJson) {
|
|
|
409
410
|
return JSON.stringify(newPackageJson, null, getJsonSpaceCount(oldPackageJson)) + (hasTrailingNewline ? `
|
|
410
411
|
` : "");
|
|
411
412
|
}
|
|
413
|
+
function isDirectoryPath(filePath) {
|
|
414
|
+
return import_node_path.default.extname(filePath) === "";
|
|
415
|
+
}
|
|
412
416
|
|
|
413
417
|
// src/plugins/built-in/productivity/exports.ts
|
|
414
418
|
function exports2() {
|
|
@@ -635,4 +639,28 @@ function injectStyles(options) {
|
|
|
635
639
|
}
|
|
636
640
|
};
|
|
637
641
|
}
|
|
642
|
+
// src/plugins/built-in/productivity/copy.ts
|
|
643
|
+
var import_node_path3 = require("path");
|
|
644
|
+
var import_node_path4 = require("path");
|
|
645
|
+
function copy(patterns, outPath) {
|
|
646
|
+
return {
|
|
647
|
+
type: "bunup",
|
|
648
|
+
name: "copy",
|
|
649
|
+
hooks: {
|
|
650
|
+
onBuildDone: async ({ options, meta }) => {
|
|
651
|
+
const destinationPath = outPath || options.outDir;
|
|
652
|
+
for (const pattern of patterns) {
|
|
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);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
}
|
|
638
666
|
})
|
package/dist/plugins.d.cts
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,12 @@ 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
|
-
|
|
415
|
+
/**
|
|
416
|
+
* A plugin that copies files and directories to the output directory.
|
|
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
|
|
420
|
+
* @see https://bunup.dev/docs/plugins/productivity#copy
|
|
421
|
+
*/
|
|
422
|
+
declare function copy(patterns: string[], outPath?: string): BunupPlugin;
|
|
423
|
+
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,12 @@ 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
|
-
|
|
415
|
+
/**
|
|
416
|
+
* A plugin that copies files and directories to the output directory.
|
|
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
|
|
420
|
+
* @see https://bunup.dev/docs/plugins/productivity#copy
|
|
421
|
+
*/
|
|
422
|
+
declare function copy(patterns: string[], outPath?: string): BunupPlugin;
|
|
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() {
|
|
@@ -600,10 +603,35 @@ function injectStyles(options) {
|
|
|
600
603
|
}
|
|
601
604
|
};
|
|
602
605
|
}
|
|
606
|
+
// src/plugins/built-in/productivity/copy.ts
|
|
607
|
+
import { join } from "path";
|
|
608
|
+
import { basename } from "path";
|
|
609
|
+
function copy(patterns, outPath) {
|
|
610
|
+
return {
|
|
611
|
+
type: "bunup",
|
|
612
|
+
name: "copy",
|
|
613
|
+
hooks: {
|
|
614
|
+
onBuildDone: async ({ options, meta }) => {
|
|
615
|
+
const destinationPath = outPath || options.outDir;
|
|
616
|
+
for (const pattern of patterns) {
|
|
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);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
}
|
|
603
630
|
export {
|
|
604
631
|
shims,
|
|
605
632
|
report,
|
|
606
633
|
injectStyles,
|
|
607
634
|
filterJsDtsFiles,
|
|
608
|
-
exports
|
|
635
|
+
exports,
|
|
636
|
+
copy
|
|
609
637
|
};
|