nuxt-bun-compile 0.1.21 → 0.1.23

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.d.mts CHANGED
@@ -1,13 +1,15 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
+ type BunCompileTarget = 'bun-linux-x64' | 'bun-linux-x64-musl' | 'bun-linux-arm64' | 'bun-linux-arm64-musl';
3
4
  interface ModuleOptions {
4
5
  enabled: boolean;
5
6
  outfile: string;
6
7
  extraExternals: (string | RegExp)[];
7
8
  autoCompile: boolean;
8
9
  bunPath?: string;
10
+ target?: BunCompileTarget;
9
11
  }
10
12
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
11
13
 
12
14
  export { _default as default };
13
- export type { ModuleOptions };
15
+ export type { BunCompileTarget, ModuleOptions };
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.21",
4
+ "version": "0.1.23",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,8 +1,18 @@
1
1
  import { defineNuxtModule, useLogger } from '@nuxt/kit';
2
- import { execSync } from 'node:child_process';
2
+ import { execFileSync } from 'node:child_process';
3
3
  import { statSync } from 'node:fs';
4
4
  import { join } from 'node:path';
5
5
 
6
+ const VALID_TARGETS = [
7
+ "bun-linux-x64",
8
+ // glibc (padrão)
9
+ "bun-linux-x64-musl",
10
+ // musl (Alpine)
11
+ "bun-linux-arm64",
12
+ // glibc ARM
13
+ "bun-linux-arm64-musl"
14
+ // musl ARM (Alpine)
15
+ ];
6
16
  const DEFAULT_EXTERNALS = [
7
17
  "sharp",
8
18
  /^@img\//,
@@ -82,11 +92,18 @@ const module$1 = defineNuxtModule({
82
92
  bunExecutable = options.bunPath;
83
93
  }
84
94
  }
85
- const cmd = `${bunExecutable} build ${outputPath} --compile --outfile ${options.outfile}`;
95
+ if (options.target && !VALID_TARGETS.includes(options.target)) {
96
+ logger.error(`Invalid target: "${options.target}". Must be one of: ${VALID_TARGETS.join(", ")}`);
97
+ return;
98
+ }
99
+ const args = ["build", outputPath, "--compile", "--outfile", options.outfile];
100
+ if (options.target) {
101
+ args.push("--target", options.target);
102
+ }
86
103
  logger.info(`Bun v${process.versions.bun} detected, running bun compile step`);
87
- logger.info(`Compiling binary: ${cmd}`);
104
+ logger.info(`Compiling binary: ${bunExecutable} ${args.join(" ")}`);
88
105
  try {
89
- execSync(cmd, { stdio: "inherit", cwd: nuxt.options.rootDir });
106
+ execFileSync(bunExecutable, args, { stdio: "inherit", cwd: nuxt.options.rootDir });
90
107
  logger.success(`Binary created: ${options.outfile}`);
91
108
  } catch (err) {
92
109
  logger.error("bun build --compile failed:", err);
package/dist/types.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { default } from './module.mjs'
2
2
 
3
- export { type ModuleOptions } from './module.mjs'
3
+ export { type BunCompileTarget, type ModuleOptions } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-bun-compile",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
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",
@@ -38,7 +38,7 @@
38
38
  "prepack": "bunx --bun nuxt-module-build build",
39
39
  "predev": "bun dev:prepare",
40
40
  "predev:build": "bun dev:prepare",
41
- "prerelease": "bun format && bun lint && bun dev:prepare && bun run test",
41
+ "prerelease": "bun clear;bun install --frozen-lockfile; bun format && bun lint && bun dev:prepare && bun run test",
42
42
  "prepare": "bunx --bun husky",
43
43
  "clear": "rm -rf node_modules .nuxt dist package-lock.json pnpm-lock.yaml nuxt-bun-compile-*.tgz playground/node_modules playground/.nuxt playground/.output playground/nuxtbin test/fixtures/basic/node_modules test/fixtures/basic/.nuxt"
44
44
  },