nuxt-bun-compile 0.1.19 → 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/README.ptBR.md +2 -2
- package/dist/module.d.mts +3 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +17 -4
- package/dist/types.d.mts +1 -1
- package/package.json +4 -4
package/README.ptBR.md
CHANGED
|
@@ -24,9 +24,9 @@ bun nuxt add nuxt-bun-compile
|
|
|
24
24
|
bun run -b build
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
[Por que é necessário o parâmetro `-b`?](https://github.com/jprando/nuxt-bun-compile
|
|
27
|
+
[Por que é necessário o parâmetro `-b`?](https://github.com/jprando/nuxt-bun-compile/blob/main/README.ptBR.md#por-que--b-%C3%A9-obrigat%C3%B3rio)
|
|
28
28
|
|
|
29
|
-
[Se você enfrentar problemas de memória durante a compilação](https://github.com/jprando/nuxt-bun-compile
|
|
29
|
+
[Se você enfrentar problemas de memória durante a compilação](https://github.com/jprando/nuxt-bun-compile/blob/main/README.ptBR.md#por-que-node_options--max-old-space-size8192)
|
|
30
30
|
|
|
31
31
|
**Passo 3: Executar seu binário**
|
|
32
32
|
|
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
package/dist/module.mjs
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { defineNuxtModule, useLogger } from '@nuxt/kit';
|
|
2
|
-
import {
|
|
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
|
-
|
|
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: ${
|
|
100
|
+
logger.info(`Compiling binary: ${bunExecutable} ${args.join(" ")}`);
|
|
88
101
|
try {
|
|
89
|
-
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-bun-compile",
|
|
3
|
-
"version": "0.1.
|
|
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
|
},
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@nuxt/kit": "^4.3.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@nuxt/devtools": "^3.
|
|
50
|
-
"@nuxt/eslint-config": "^1.
|
|
49
|
+
"@nuxt/devtools": "^3.2.1",
|
|
50
|
+
"@nuxt/eslint-config": "^1.15.1",
|
|
51
51
|
"@nuxt/module-builder": "^1.0.2",
|
|
52
52
|
"@nuxt/schema": "^4.3.1",
|
|
53
53
|
"@nuxt/test-utils": "^4.0.0",
|