nuxt-bun-compile 0.1.21 → 0.1.22

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.22",
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,14 @@
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
+ "bun-linux-x64-musl",
9
+ "bun-linux-arm64",
10
+ "bun-linux-arm64-musl"
11
+ ];
6
12
  const DEFAULT_EXTERNALS = [
7
13
  "sharp",
8
14
  /^@img\//,
@@ -82,11 +88,18 @@ const module$1 = defineNuxtModule({
82
88
  bunExecutable = options.bunPath;
83
89
  }
84
90
  }
85
- const cmd = `${bunExecutable} build ${outputPath} --compile --outfile ${options.outfile}`;
91
+ if (options.target && !VALID_TARGETS.includes(options.target)) {
92
+ logger.error(`Invalid target: "${options.target}". Must be one of: ${VALID_TARGETS.join(", ")}`);
93
+ return;
94
+ }
95
+ const args = ["build", outputPath, "--compile", "--outfile", options.outfile];
96
+ if (options.target) {
97
+ args.push("--target", options.target);
98
+ }
86
99
  logger.info(`Bun v${process.versions.bun} detected, running bun compile step`);
87
- logger.info(`Compiling binary: ${cmd}`);
100
+ logger.info(`Compiling binary: ${bunExecutable} ${args.join(" ")}`);
88
101
  try {
89
- execSync(cmd, { stdio: "inherit", cwd: nuxt.options.rootDir });
102
+ execFileSync(bunExecutable, args, { stdio: "inherit", cwd: nuxt.options.rootDir });
90
103
  logger.success(`Binary created: ${options.outfile}`);
91
104
  } catch (err) {
92
105
  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.22",
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
  },