next-bun-compile 0.2.2 → 0.3.0

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/README.md CHANGED
@@ -54,6 +54,18 @@ bun run build # Builds Next.js + compiles to ./server
54
54
 
55
55
  The binary is fully self-contained — static assets, public files, and the Next.js server are all embedded. Just copy it anywhere and run.
56
56
 
57
+ ### Cross-Compilation
58
+
59
+ Any flags passed to `next-bun-compile` are forwarded to `bun build --compile`. Use `--target` to cross-compile for a different platform:
60
+
61
+ ```bash
62
+ next-bun-compile --target=bun-linux-x64
63
+ next-bun-compile --target=bun-linux-arm64
64
+ next-bun-compile --target=bun-windows-x64
65
+ ```
66
+
67
+ See the [Bun cross-compilation docs](https://bun.sh/docs/bundler/executables#cross-compile) for all available targets.
68
+
57
69
  ### Environment Variables
58
70
 
59
71
  | Variable | Default | Description |
package/dist/cli.js CHANGED
@@ -158,7 +158,7 @@ extractAssets().then(() => {
158
158
  import { execFileSync } from "node:child_process";
159
159
  import { join as join2 } from "node:path";
160
160
  function compile(options) {
161
- const { standaloneDir, outfile } = options;
161
+ const { standaloneDir, outfile, extraArgs = [] } = options;
162
162
  const entryPoint = join2(standaloneDir, "server-entry.js");
163
163
  const args = [
164
164
  "build",
@@ -175,7 +175,8 @@ function compile(options) {
175
175
  "--define",
176
176
  'process.env.NEXT_RUNTIME="nodejs"',
177
177
  "--outfile",
178
- outfile
178
+ outfile,
179
+ ...extraArgs
179
180
  ];
180
181
  console.log(`next-bun-compile: Compiling to ${outfile}...`);
181
182
  execFileSync("bun", args, { stdio: "inherit" });
@@ -185,6 +186,7 @@ function compile(options) {
185
186
  // src/cli.ts
186
187
  import { existsSync as existsSync2 } from "node:fs";
187
188
  import { join as join3, resolve } from "node:path";
189
+ var extraArgs = process.argv.slice(2);
188
190
  var projectDir = resolve(".");
189
191
  var distDir = join3(projectDir, ".next");
190
192
  var standaloneDir = join3(distDir, "standalone");
@@ -197,4 +199,4 @@ if (existsSync2(ctxPath)) {
197
199
  console.log("next-bun-compile: Using build context from adapter");
198
200
  }
199
201
  generateEntryPoint({ standaloneDir, distDir, projectDir });
200
- compile({ standaloneDir, outfile: join3(projectDir, "server") });
202
+ compile({ standaloneDir, outfile: join3(projectDir, "server"), extraArgs });
package/dist/compile.js CHANGED
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
5
  import { execFileSync } from "node:child_process";
6
6
  import { join } from "node:path";
7
7
  function compile(options) {
8
- const { standaloneDir, outfile } = options;
8
+ const { standaloneDir, outfile, extraArgs = [] } = options;
9
9
  const entryPoint = join(standaloneDir, "server-entry.js");
10
10
  const args = [
11
11
  "build",
@@ -22,7 +22,8 @@ function compile(options) {
22
22
  "--define",
23
23
  'process.env.NEXT_RUNTIME="nodejs"',
24
24
  "--outfile",
25
- outfile
25
+ outfile,
26
+ ...extraArgs
26
27
  ];
27
28
  console.log(`next-bun-compile: Compiling to ${outfile}...`);
28
29
  execFileSync("bun", args, { stdio: "inherit" });
package/dist/index.js CHANGED
@@ -157,7 +157,7 @@ extractAssets().then(() => {
157
157
  import { execFileSync } from "node:child_process";
158
158
  import { join as join2 } from "node:path";
159
159
  function compile(options) {
160
- const { standaloneDir, outfile } = options;
160
+ const { standaloneDir, outfile, extraArgs = [] } = options;
161
161
  const entryPoint = join2(standaloneDir, "server-entry.js");
162
162
  const args = [
163
163
  "build",
@@ -174,7 +174,8 @@ function compile(options) {
174
174
  "--define",
175
175
  'process.env.NEXT_RUNTIME="nodejs"',
176
176
  "--outfile",
177
- outfile
177
+ outfile,
178
+ ...extraArgs
178
179
  ];
179
180
  console.log(`next-bun-compile: Compiling to ${outfile}...`);
180
181
  execFileSync("bun", args, { stdio: "inherit" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-bun-compile",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Next.js Build Adapter that compiles your app into a Bun single-file executable",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",