nuxt-bun-compile 0.1.23 → 0.1.24

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-bun-compile",
3
3
  "configKey": "bunCompile",
4
- "version": "0.1.23",
4
+ "version": "0.1.24",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineNuxtModule, useLogger } from '@nuxt/kit';
2
2
  import { execFileSync } from 'node:child_process';
3
- import { statSync } from 'node:fs';
3
+ import { statSync, readFileSync } from 'node:fs';
4
4
  import { join } from 'node:path';
5
5
 
6
6
  const VALID_TARGETS = [
@@ -24,6 +24,25 @@ const DEFAULT_EXTERNALS = [
24
24
  "mdn-data",
25
25
  /^mdn-data\//
26
26
  ];
27
+ function detectMusl() {
28
+ try {
29
+ const ldd = execFileSync("ldd", ["--version"], { encoding: "utf8", stdio: "pipe" });
30
+ return ldd.includes("musl");
31
+ } catch {
32
+ try {
33
+ const osRelease = readFileSync("/etc/os-release", "utf8");
34
+ return osRelease.includes("alpine") || osRelease.includes("musl");
35
+ } catch {
36
+ return false;
37
+ }
38
+ }
39
+ }
40
+ function detectTarget() {
41
+ const arch = process.arch === "arm64" ? "arm64" : "x64";
42
+ const isMusl = detectMusl();
43
+ const target = `bun-linux-${arch}${isMusl ? "-musl" : ""}`;
44
+ return target;
45
+ }
27
46
  const module$1 = defineNuxtModule({
28
47
  meta: {
29
48
  name: "nuxt-bun-compile",
@@ -92,13 +111,15 @@ const module$1 = defineNuxtModule({
92
111
  bunExecutable = options.bunPath;
93
112
  }
94
113
  }
95
- if (options.target && !VALID_TARGETS.includes(options.target)) {
96
- logger.error(`Invalid target: "${options.target}". Must be one of: ${VALID_TARGETS.join(", ")}`);
114
+ const selectedTarget = options.target || detectTarget();
115
+ if (!VALID_TARGETS.includes(selectedTarget)) {
116
+ logger.error(`Invalid target: "${selectedTarget}". Must be one of: ${VALID_TARGETS.join(", ")}`);
97
117
  return;
98
118
  }
99
119
  const args = ["build", outputPath, "--compile", "--outfile", options.outfile];
100
- if (options.target) {
101
- args.push("--target", options.target);
120
+ args.push("--target", selectedTarget);
121
+ if (!options.target) {
122
+ logger.info(`Target auto-detected: ${selectedTarget}`);
102
123
  }
103
124
  logger.info(`Bun v${process.versions.bun} detected, running bun compile step`);
104
125
  logger.info(`Compiling binary: ${bunExecutable} ${args.join(" ")}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-bun-compile",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "Nuxt module that automatically configures Nitro for `bun build --compile`, generating a standalone executable binary from your Nuxt app.",
5
5
  "repository": "jprando/nuxt-bun-compile",
6
6
  "license": "MIT",