@b9g/libuild 0.1.13 → 0.1.15

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.15] - 2025-01-14
6
+
7
+ ### Fixed
8
+ - **Support bin-only packages** - Packages with only bin/ executables and no src/ library code no longer crash. Main/module/types fields and "." export are now correctly omitted for bin-only packages, while bin exports are properly generated.
9
+
10
+ ## [0.1.14] - 2025-01-14
11
+
12
+ ### Fixed
13
+ - **Eliminate stderr noise from dual-purpose shebang** - Changed from `//bin/true` to standard polyglot pattern `':' //;` to prevent shell from attempting to execute non-existent path, eliminating "No such file or directory" errors while maintaining dual runtime detection
14
+
5
15
  ## [0.1.13] - 2025-01-14
6
16
 
7
17
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b9g/libuild",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Zero-config library builds",
5
5
  "keywords": [
6
6
  "build",
package/src/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env sh
2
- //bin/true; exec "$({ [ "${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] || true; } && command -v bun || command -v node)" "$0" "$@"
2
+ ':' //; exec "$({ [ "${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] || true; } && command -v bun || command -v node)" "$0" "$@"
3
3
  /// <reference types="./cli.d.ts" />
4
4
 
5
5
  // src/cli.ts
package/src/libuild.cjs CHANGED
@@ -215233,9 +215233,9 @@ ${content}`;
215233
215233
  function generateRuntimeBanner(pkg) {
215234
215234
  const prefersBun = pkg.engines?.bun !== void 0;
215235
215235
  if (prefersBun) {
215236
- return '//bin/true; exec "$({ [ "${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] || true; } && command -v bun || command -v node)" "$0" "$@"';
215236
+ return `':' //; exec "$({ [ "\${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] || true; } && command -v bun || command -v node)" "$0" "$@"`;
215237
215237
  } else {
215238
- return '//bin/true; exec "$([ "${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] && command -v bun || command -v node)" "$0" "$@"';
215238
+ return `':' //; exec "$([ "\${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] && command -v bun || command -v node)" "$0" "$@"`;
215239
215239
  }
215240
215240
  }
215241
215241
  async function processJavaScriptExecutable(filePath, runtimeBanner) {
@@ -215505,10 +215505,12 @@ async function generateExports(entries, mainEntry, options, existingExports = {}
215505
215505
  exports2[key] = expandExistingExport(value);
215506
215506
  }
215507
215507
  }
215508
- if (!exports2["."]) {
215509
- exports2["."] = await createExportEntry(mainEntry);
215510
- } else {
215511
- exports2["."] = expandExistingExport(exports2["."], mainEntry);
215508
+ if (mainEntry) {
215509
+ if (!exports2["."]) {
215510
+ exports2["."] = await createExportEntry(mainEntry);
215511
+ } else {
215512
+ exports2["."] = expandExistingExport(exports2["."], mainEntry);
215513
+ }
215512
215514
  }
215513
215515
  for (const entry of entries) {
215514
215516
  if (entry === "umd")
@@ -215883,15 +215885,17 @@ async function cleanPackageJSON(pkg, mainEntry, options, cwd, distDir) {
215883
215885
  if (!cleaned.type) {
215884
215886
  cleaned.type = "module";
215885
215887
  }
215886
- if (options.formats.cjs) {
215887
- cleaned.main = `src/${mainEntry}.cjs`;
215888
- }
215889
- cleaned.module = `src/${mainEntry}.js`;
215890
- if (distDir) {
215891
- const dtsPath = Path3.join(distDir, "src", `${mainEntry}.d.ts`);
215892
- const exists = await fileExists(dtsPath);
215893
- if (exists) {
215894
- cleaned.types = `src/${mainEntry}.d.ts`;
215888
+ if (mainEntry) {
215889
+ if (options.formats.cjs) {
215890
+ cleaned.main = `src/${mainEntry}.cjs`;
215891
+ }
215892
+ cleaned.module = `src/${mainEntry}.js`;
215893
+ if (distDir) {
215894
+ const dtsPath = Path3.join(distDir, "src", `${mainEntry}.d.ts`);
215895
+ const exists = await fileExists(dtsPath);
215896
+ if (exists) {
215897
+ cleaned.types = `src/${mainEntry}.d.ts`;
215898
+ }
215895
215899
  }
215896
215900
  }
215897
215901
  return cleaned;
package/src/libuild.js CHANGED
@@ -220,9 +220,9 @@ ${content}`;
220
220
  function generateRuntimeBanner(pkg) {
221
221
  const prefersBun = pkg.engines?.bun !== void 0;
222
222
  if (prefersBun) {
223
- return '//bin/true; exec "$({ [ "${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] || true; } && command -v bun || command -v node)" "$0" "$@"';
223
+ return `':' //; exec "$({ [ "\${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] || true; } && command -v bun || command -v node)" "$0" "$@"`;
224
224
  } else {
225
- return '//bin/true; exec "$([ "${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] && command -v bun || command -v node)" "$0" "$@"';
225
+ return `':' //; exec "$([ "\${npm_config_user_agent#bun/}" != "$npm_config_user_agent" ] && command -v bun || command -v node)" "$0" "$@"`;
226
226
  }
227
227
  }
228
228
  async function processJavaScriptExecutable(filePath, runtimeBanner) {
@@ -492,10 +492,12 @@ async function generateExports(entries, mainEntry, options, existingExports = {}
492
492
  exports[key] = expandExistingExport(value);
493
493
  }
494
494
  }
495
- if (!exports["."]) {
496
- exports["."] = await createExportEntry(mainEntry);
497
- } else {
498
- exports["."] = expandExistingExport(exports["."], mainEntry);
495
+ if (mainEntry) {
496
+ if (!exports["."]) {
497
+ exports["."] = await createExportEntry(mainEntry);
498
+ } else {
499
+ exports["."] = expandExistingExport(exports["."], mainEntry);
500
+ }
499
501
  }
500
502
  for (const entry of entries) {
501
503
  if (entry === "umd")
@@ -870,15 +872,17 @@ async function cleanPackageJSON(pkg, mainEntry, options, cwd, distDir) {
870
872
  if (!cleaned.type) {
871
873
  cleaned.type = "module";
872
874
  }
873
- if (options.formats.cjs) {
874
- cleaned.main = `src/${mainEntry}.cjs`;
875
- }
876
- cleaned.module = `src/${mainEntry}.js`;
877
- if (distDir) {
878
- const dtsPath = Path3.join(distDir, "src", `${mainEntry}.d.ts`);
879
- const exists = await fileExists(dtsPath);
880
- if (exists) {
881
- cleaned.types = `src/${mainEntry}.d.ts`;
875
+ if (mainEntry) {
876
+ if (options.formats.cjs) {
877
+ cleaned.main = `src/${mainEntry}.cjs`;
878
+ }
879
+ cleaned.module = `src/${mainEntry}.js`;
880
+ if (distDir) {
881
+ const dtsPath = Path3.join(distDir, "src", `${mainEntry}.d.ts`);
882
+ const exists = await fileExists(dtsPath);
883
+ if (exists) {
884
+ cleaned.types = `src/${mainEntry}.d.ts`;
885
+ }
882
886
  }
883
887
  }
884
888
  return cleaned;