bunup 0.16.17 → 0.16.18

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
  processLoadedConfigs,
6
6
  resolveBuildOptions
7
- } from "../shared/bunup-ze2fw5ca.js";
7
+ } from "../shared/bunup-4m73cpyq.js";
8
8
  import {
9
9
  BunupBuildError,
10
10
  BunupCLIError,
@@ -21,13 +21,13 @@ import {
21
21
  logTime,
22
22
  logger,
23
23
  parseErrorMessage
24
- } from "../shared/bunup-qb65sm3k.js";
24
+ } from "../shared/bunup-rmbrx2hr.js";
25
25
 
26
26
  // packages/bunup/src/cli/index.ts
27
27
  import { loadConfig } from "coffi";
28
28
  import pc4 from "picocolors";
29
29
  // packages/bunup/package.json
30
- var version = "0.16.17";
30
+ var version = "0.16.18";
31
31
 
32
32
  // packages/bunup/src/printer/print-build-report.ts
33
33
  import { promisify } from "util";
@@ -343,7 +343,7 @@ async function main(args = Bun.argv.slice(2)) {
343
343
  });
344
344
  }
345
345
  logger.info("Build started");
346
- const startTime = performance.now();
346
+ let buildTimeMs = 0;
347
347
  for (const { options, rootDir } of configsToProcess) {
348
348
  const optionsArray = ensureArray(options);
349
349
  for await (const o of optionsArray) {
@@ -354,14 +354,15 @@ async function main(args = Bun.argv.slice(2)) {
354
354
  if (userOptions.watch) {
355
355
  await watch(userOptions, rootDir, filepath);
356
356
  } else {
357
+ const startTime = performance.now();
357
358
  const result = await build(userOptions, rootDir);
359
+ buildTimeMs += performance.now() - startTime;
358
360
  if (!cliOptions.watch && !shouldSilent) {
359
361
  await printBuildReport(result);
360
362
  }
361
363
  }
362
364
  }
363
365
  }
364
- const buildTimeMs = performance.now() - startTime;
365
366
  if (cliOptions.watch) {
366
367
  console.log(`
367
368
  ${pc4.bgMagentaBright(" WATCH ")} Watching for file changes...
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  build
4
- } from "./shared/bunup-ze2fw5ca.js";
5
- import"./shared/bunup-qb65sm3k.js";
4
+ } from "./shared/bunup-4m73cpyq.js";
5
+ import"./shared/bunup-rmbrx2hr.js";
6
6
  // packages/bunup/src/define.ts
7
7
  function defineConfig(options) {
8
8
  return options;
package/dist/plugins.js CHANGED
@@ -7,10 +7,11 @@ import {
7
7
  logger,
8
8
  shims,
9
9
  unused
10
- } from "./shared/bunup-qb65sm3k.js";
10
+ } from "./shared/bunup-rmbrx2hr.js";
11
11
 
12
12
  // packages/bunup/src/plugins/copy.ts
13
- import { basename, extname, join } from "path";
13
+ import fs from "fs";
14
+ import { basename, isAbsolute, join } from "path";
14
15
  function copy(pattern) {
15
16
  return new CopyBuilder(pattern);
16
17
  }
@@ -80,7 +81,7 @@ class CopyBuilder {
80
81
  }
81
82
  this._fileCache.set(sourcePath, lastModified);
82
83
  }
83
- const finalDestinationPath = resolveDestinationPath(destinationPath, scannedPath, meta.rootDir);
84
+ const finalDestinationPath = resolveDestinationPath(destinationPath, sourcePath, meta.rootDir);
84
85
  const shouldOverride = this._options?.override ?? true;
85
86
  if (!shouldOverride) {
86
87
  const destinationExists = await Bun.file(finalDestinationPath).exists();
@@ -127,7 +128,7 @@ class CopyBuilder {
127
128
  }
128
129
  }
129
130
  function resolveDestinationPath(destinationPath, scannedPath, rootDir) {
130
- const fullDestinationPath = join(rootDir, destinationPath);
131
+ const fullDestinationPath = isAbsolute(destinationPath) ? destinationPath : join(rootDir, destinationPath);
131
132
  const isScannedPathDir = isDirectoryPath(scannedPath);
132
133
  const isDestinationDir = isDirectoryPath(fullDestinationPath);
133
134
  if (isDestinationDir && !isScannedPathDir) {
@@ -136,7 +137,12 @@ function resolveDestinationPath(destinationPath, scannedPath, rootDir) {
136
137
  return fullDestinationPath;
137
138
  }
138
139
  function isDirectoryPath(filePath) {
139
- return extname(filePath) === "";
140
+ try {
141
+ const stats = fs.statSync(filePath);
142
+ return stats.isDirectory();
143
+ } catch {
144
+ return false;
145
+ }
140
146
  }
141
147
  async function copyDirectory(sourcePath, finalDestinationPath) {
142
148
  await Bun.$`cp -r ${sourcePath} ${finalDestinationPath}`;
@@ -19,7 +19,7 @@ import {
19
19
  parseErrorMessage,
20
20
  shims,
21
21
  unused
22
- } from "./bunup-qb65sm3k.js";
22
+ } from "./bunup-rmbrx2hr.js";
23
23
 
24
24
  // packages/bunup/src/loaders.ts
25
25
  import path from "path";
@@ -62,13 +62,13 @@ async function loadPackageJson(cwd = process.cwd()) {
62
62
  }
63
63
 
64
64
  // packages/bunup/src/build.ts
65
- import path3 from "path";
65
+ import path4 from "path";
66
66
  import { generateDts, logIsolatedDeclarationErrors } from "@bunup/dts";
67
67
  import pc2 from "picocolors";
68
68
 
69
69
  // packages/bunup/src/ensure-bun-version.ts
70
70
  import pc from "picocolors";
71
- var MINIMUM_BUN_VERSION = "1.0.11";
71
+ var MINIMUM_BUN_VERSION = "1.3.6";
72
72
  function ensureBunVersion(requiredVersion, feature) {
73
73
  const currentVersion = Bun.version;
74
74
  const satisfiesRequirement = Bun.semver.satisfies(currentVersion, `>=${requiredVersion}`);
@@ -390,6 +390,13 @@ async function runPluginBuildDoneHooks(bunupPlugins, ctx) {
390
390
  }
391
391
  }
392
392
 
393
+ // packages/bunup/src/utils/bun.ts
394
+ import path3 from "path";
395
+ function getOriginalEntrypointFromOutputPath(metafile, outputPath, rootDir) {
396
+ const entryPoint = metafile?.outputs[outputPath]?.entryPoint;
397
+ return path3.relative(rootDir, entryPoint);
398
+ }
399
+
393
400
  // packages/bunup/src/utils/extension.ts
394
401
  function getDefaultJsOutputExtension(format, packageType) {
395
402
  switch (format) {
@@ -488,17 +495,18 @@ async function build(userOptions, rootDir = process.cwd()) {
488
495
  banner: options.banner,
489
496
  footer: options.footer,
490
497
  publicPath: options.publicPath,
491
- root: options.sourceBase ? path3.resolve(rootDir, options.sourceBase) : undefined,
498
+ root: options.sourceBase ? path4.resolve(rootDir, options.sourceBase) : undefined,
492
499
  env: resolvedEnv,
493
500
  ignoreDCEAnnotations: options.ignoreDCEAnnotations,
494
501
  emitDCEAnnotations: options.emitDCEAnnotations,
495
502
  packages: options.packages,
496
503
  jsx: options.jsx,
497
504
  compile: options.compile,
498
- outdir: options.compile ? path3.resolve(rootDir, options.outDir) : undefined,
505
+ outdir: options.compile ? path4.resolve(rootDir, options.outDir) : undefined,
499
506
  throw: false,
500
507
  plugins: bunPlugins,
501
- tsconfig: options.preferredTsconfig ? path3.resolve(rootDir, options.preferredTsconfig) : undefined
508
+ tsconfig: options.preferredTsconfig ? path4.resolve(rootDir, options.preferredTsconfig) : undefined,
509
+ metafile: true
502
510
  });
503
511
  for (const log of result.logs) {
504
512
  if (log.level === "error") {
@@ -511,13 +519,12 @@ async function build(userOptions, rootDir = process.cwd()) {
511
519
  else if (log.level === "info")
512
520
  logger.info(log.message);
513
521
  }
514
- let entrypointIndex = 0;
515
522
  for (const file of result.outputs) {
516
523
  if (options.compile) {
517
524
  const fullPath2 = file.path;
518
- const pathRelativeToRootDir2 = path3.relative(rootDir, fullPath2);
519
- const absoluteOutDir = path3.resolve(rootDir, options.outDir);
520
- const pathRelativeToOutdir2 = path3.relative(absoluteOutDir, fullPath2);
525
+ const pathRelativeToRootDir2 = path4.relative(rootDir, fullPath2);
526
+ const absoluteOutDir = path4.resolve(rootDir, options.outDir);
527
+ const pathRelativeToOutdir2 = path4.relative(absoluteOutDir, fullPath2);
521
528
  buildOutputFiles.push({
522
529
  fullPath: fullPath2,
523
530
  pathRelativeToRootDir: pathRelativeToRootDir2,
@@ -532,8 +539,8 @@ async function build(userOptions, rootDir = process.cwd()) {
532
539
  }
533
540
  const content = await file.text();
534
541
  const pathRelativeToOutdir = cleanPath(isJavascriptFile(file.path) && file.kind === "entry-point" ? replaceExtension(file.path, getDefaultJsOutputExtension(fmt, packageType)) : file.path);
535
- const pathRelativeToRootDir = path3.join(options.outDir, pathRelativeToOutdir);
536
- const fullPath = path3.resolve(rootDir, pathRelativeToRootDir);
542
+ const pathRelativeToRootDir = path4.join(options.outDir, pathRelativeToOutdir);
543
+ const fullPath = path4.resolve(rootDir, pathRelativeToRootDir);
537
544
  await Bun.write(fullPath, content);
538
545
  if (!buildOutputFiles.some((f) => f.fullPath === fullPath)) {
539
546
  buildOutputFiles.push({
@@ -543,12 +550,9 @@ async function build(userOptions, rootDir = process.cwd()) {
543
550
  dts: false,
544
551
  format: fmt,
545
552
  kind: file.kind,
546
- entrypoint: file.kind === "entry-point" ? cleanPath(entrypoints[entrypointIndex] ?? "") : undefined,
553
+ entrypoint: file.kind === "entry-point" ? getOriginalEntrypointFromOutputPath(result.metafile, file.path, rootDir) : undefined,
547
554
  size: file.size
548
555
  });
549
- if (file.kind === "entry-point") {
550
- entrypointIndex++;
551
- }
552
556
  }
553
557
  }
554
558
  });
@@ -563,7 +567,7 @@ async function build(userOptions, rootDir = process.cwd()) {
563
567
  naming: {
564
568
  chunk: getDefaultChunkNaming(options.name)
565
569
  },
566
- root: options.sourceBase ? path3.resolve(rootDir, options.sourceBase) : undefined,
570
+ root: options.sourceBase ? path4.resolve(rootDir, options.sourceBase) : undefined,
567
571
  ...dtsOptions
568
572
  });
569
573
  if (dtsResult.errors.length && !logger.isSilent()) {
@@ -574,7 +578,7 @@ async function build(userOptions, rootDir = process.cwd()) {
574
578
  const dtsExtension = getDefaultDtsOutputExtention(fmt, packageType, file.kind);
575
579
  const pathRelativeToOutdir = cleanPath(`${file.pathInfo.outputPathWithoutExtension}${dtsExtension}`);
576
580
  const pathRelativeToRootDir = cleanPath(`${options.outDir}/${pathRelativeToOutdir}`);
577
- const fullPath = path3.join(rootDir, pathRelativeToRootDir);
581
+ const fullPath = path4.join(rootDir, pathRelativeToRootDir);
578
582
  await Bun.write(fullPath, file.dts);
579
583
  buildOutputFiles.push({
580
584
  fullPath,
@@ -583,7 +587,7 @@ async function build(userOptions, rootDir = process.cwd()) {
583
587
  dts: true,
584
588
  format: fmt,
585
589
  kind: file.kind,
586
- entrypoint: file.entrypoint ? cleanPath(file.entrypoint) : undefined,
590
+ entrypoint: file.entrypoint,
587
591
  size: file.dts.length
588
592
  });
589
593
  }
@@ -613,8 +617,8 @@ async function build(userOptions, rootDir = process.cwd()) {
613
617
  if (options.onSuccess) {
614
618
  await executeOnSuccess(options.onSuccess, options, ac.signal);
615
619
  }
616
- console.log("");
617
- console.log(`${options.name ? ` ${pc2.bgBlueBright(` ${options.name} `)} ` : " "}${logger.formatMessage({
620
+ logger.log("");
621
+ logger.log(`${options.name ? ` ${pc2.bgBlueBright(` ${options.name} `)} ` : " "}${logger.formatMessage({
618
622
  message: formatListWithAnd(entrypoints),
619
623
  muted: true,
620
624
  noIcon: true
@@ -644,7 +644,7 @@ function mergeCustomExportsWithGenerated(baseExports, customExportsProvider, ctx
644
644
  return mergedExports;
645
645
  }
646
646
  function createUpdatedPackageJson(originalData, entryPoints, exports2, files) {
647
- const { main, module, types, ...restPackageJson } = originalData;
647
+ const { main: _, module: __, types: ___, ...restPackageJson } = originalData;
648
648
  const newPackageJson = {
649
649
  ...Object.fromEntries(Object.entries({
650
650
  name: originalData.name,
@@ -652,7 +652,7 @@ function createUpdatedPackageJson(originalData, entryPoints, exports2, files) {
652
652
  version: originalData.version,
653
653
  type: originalData.type,
654
654
  private: originalData.private
655
- }).filter(([_, value]) => value !== undefined)),
655
+ }).filter(([_2, value]) => value !== undefined)),
656
656
  files,
657
657
  ...entryPoints,
658
658
  exports: exports2
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.16.17",
4
+ "version": "0.16.18",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -24,12 +24,12 @@
24
24
  "./package.json": "./package.json"
25
25
  },
26
26
  "license": "MIT",
27
- "author": "Arshad Yaseen <m@arshadyaseen.com> (https://arshadyaseen.com)",
27
+ "author": "Arshad Yaseen <arshadpyaseen@gmail.com> (https://arshad.fyi)",
28
28
  "maintainers": [
29
29
  {
30
30
  "name": "Arshad Yaseen",
31
- "email": "m@arshadyaseen.com",
32
- "url": "https://arshadyaseen.com"
31
+ "email": "arshadpyaseen@gmail.com",
32
+ "url": "https://arshad.fyi"
33
33
  }
34
34
  ],
35
35
  "repository": {
@@ -50,8 +50,8 @@
50
50
  "type-check": "tsc --noEmit"
51
51
  },
52
52
  "dependencies": {
53
- "@bunup/dts": "^0.14.46",
54
- "@bunup/shared": "0.16.12",
53
+ "@bunup/dts": "^0.14.47",
54
+ "@bunup/shared": "0.16.17",
55
55
  "chokidar": "^5.0.0",
56
56
  "coffi": "^0.1.37",
57
57
  "lightningcss": "^1.30.2",
@@ -69,6 +69,6 @@
69
69
  }
70
70
  },
71
71
  "devDependencies": {
72
- "@types/bun": "^1.3.5"
72
+ "@types/bun": "^1.3.6"
73
73
  }
74
74
  }