nuxt-bun-compile 0.1.26 → 0.1.28

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Socket Badge](https://badge.socket.dev/npm/package/nuxt-bun-compile/0.1.0)](https://badge.socket.dev/npm/package/nuxt-bun-compile/0.1.0)
4
4
 
5
- ![Logo Nuxt Bun Compile](/images/logo-transparent--nuxt-bun-compile.png "Logo Nuxt Bun Compile")
5
+ <img src="/images/logo-transparent--nuxt-bun-compile.png" alt="Logo Nuxt Bun Compile" width="50%">
6
6
 
7
7
  > 🚀 Nuxt module that automatically configures Nitro for `bun build --compile`, generating a **standalone executable binary** from your Nuxt app — zero runtime dependencies needed.
8
8
 
@@ -24,9 +24,9 @@ bun nuxt add nuxt-bun-compile
24
24
  bun run -b build
25
25
  ```
26
26
 
27
- [Why is `-b` required?](https://github.com/jprando/nuxt-bun-compile?tab=readme-ov-file#why-is--b-required)
27
+ [Why is `-b` required?](/docs/ARCHITECTURE.md#why-is--b-required)
28
28
 
29
- [If you encounter memory issues during build](https://github.com/jprando/nuxt-bun-compile?tab=readme-ov-file#why-node_options--max-old-space-size8192)
29
+ [If you encounter memory issues during build](/docs/NOTES.md#why-node_options--max-old-space-size8192)
30
30
 
31
31
  **Step 3: Run your binary**
32
32
 
@@ -41,240 +41,15 @@ That's it. One binary. No `node_modules`. No runtime. Just your app.
41
41
 
42
42
  ---
43
43
 
44
- ## 🎯 What It Does
45
-
46
- The module hooks into Nuxt's build pipeline and handles **everything** automatically:
47
-
48
- 1. **Configures Nitro** with the optimal settings for binary compilation
49
- 2. **Externalizes problematic packages** that break with full bundling
50
- 3. **Runs `bun build --compile`** after the build to produce a standalone executable
51
-
52
- ### Nitro Configuration (auto-applied)
53
-
54
- | Setting | Value | Why |
55
- |---|---|---|
56
- | `preset` | `"bun"` | Target the Bun runtime |
57
- | `noExternals` | `true` | Bundle everything into the output |
58
- | `inlineDynamicImports` | `true` | Flatten dynamic imports for single-file output |
59
- | `serveStatic` | `"inline"` | Embed static assets in the binary |
60
- | `esbuild.options.target` | `"esnext"` | Use latest JS features for maximum performance |
61
-
62
- ---
63
-
64
- ## ⚙️ Options
65
-
66
- | Option | Type | Default | Description |
67
- |---|---|---|---|
68
- | `enabled` | `boolean` | `true` | Enable/disable the module |
69
- | `outfile` | `string` | `"nuxtbin"` | Output binary filename |
70
- | `bunPath` | `string` | `undefined` | Path to the bun executable. Can be a directory (e.g., `/opt/bun/`) or a direct path to the binary (e.g., `/opt/bun/bun`). If it's a directory, '/bun' will be appended. Defaults to 'bun' from the system's PATH. |
71
- | `target` | `'bun-linux-x64' \| 'bun-linux-x64-musl' \| 'bun-linux-arm64' \| 'bun-linux-arm64-musl'` | `auto-detected` | Target platform for binary compilation. Auto-detects your system architecture (x64/arm64) and libc type (glibc/musl). Override only if auto-detection fails or you need a specific target. |
72
- | `extraExternals` | `(string \| RegExp)[]` | `[]` | Additional packages to mark as external |
73
- | `autoCompile` | `boolean` | `true` | Run `bun build --compile` automatically after build |
74
-
75
- ---
76
-
77
- ## 📦 Default External Packages
78
-
79
- These packages are known to break with `noExternals: true` and are excluded by default:
80
-
81
- | Package | Pattern |
82
- |---|---|
83
- | sharp | `sharp` |
84
- | @img | `@img/*` |
85
- | css-tree | `css-tree`, `css-tree/*` |
86
- | csso | `csso`, `csso/*` |
87
- | svgo | `svgo` |
88
- | mdn-data | `mdn-data`, `mdn-data/*` |
89
-
90
- Need to add more? Use `extraExternals`:
91
-
92
- ```ts
93
- bunCompile: {
94
- extraExternals: ["problematic-package", /^@scope\//],
95
- }
96
- ```
97
-
98
- > **⚠️ Important:** Libraries listed in `extraExternals` (as well as the default externals) are **not embedded in the binary**. For the `nuxtbin` binary to run correctly, these dependencies must be available in a `node_modules` folder alongside the generated binary.
99
-
100
- ---
101
-
102
- ## ⚠️ Native Dependencies in Alpine Linux
103
-
104
- When compiling with `--target=bun-linux-x64-musl` or `--target=bun-linux-arm64-musl` (Alpine), the resulting binary still dynamically links to `libstdc++` and `libgcc` at runtime. This is documented Bun behavior:
105
-
106
- - [oven-sh/bun#23910](https://github.com/oven-sh/bun/issues/23910)
107
- - [oven-sh/bun#918](https://github.com/oven-sh/bun/issues/918)
108
-
109
- ### Solution: Install Required Libraries in Docker
110
-
111
- If running the binary in an Alpine Linux container, install the required libraries:
112
-
113
- ```dockerfile
114
- FROM alpine:latest
115
-
116
- RUN apk add --no-cache libstdc++ libgcc
117
-
118
- COPY nuxtbin /app/
119
- WORKDIR /app
120
-
121
- CMD ["./nuxtbin"]
122
- ```
123
-
124
- This ensures all runtime dependencies are available in the container.
125
-
126
- ---
127
-
128
- ## 🏗️ Architecture
129
-
130
- The module uses a **hook-based architecture**:
131
-
132
- - **`nitro:config`** — Adjusts Nitro settings (preset, externals, bundling)
133
- - **`nitro:compiled`** — Triggers `bun build --compile` after Nitro finishes building the server
134
-
135
- ### How It Works
136
-
137
- ```
138
- bun run -b build
139
-
140
- ├─ nitro:config hook ──▶ Configure preset, bundling, externals
141
-
142
- ├─ Nuxt/Nitro build pipeline runs normally
143
-
144
- └─ nitro compiled hook ──▶ bun build .output/server/index.mjs --compile --outfile <name>
145
-
146
- └──▶ 🎉 Standalone binary ready!
147
- ```
148
-
149
- ### Why is `-b` required?
150
-
151
- When you run `bun run build` (without `-b`), Bun acts as a **task runner** and may delegate script execution to Node.js. In that scenario, `globalThis.Bun` and `process.versions.bun` **do not exist**, and the module cannot detect the Bun runtime:
152
-
153
- ```ts
154
- const isBun = typeof globalThis.Bun !== "undefined"
155
- || process.versions.bun !== undefined;
156
- ```
157
- [src/module.ts:L70-L76](https://github.com/jprando/nuxt-bun-compile/blob/main/src/module.ts#L70-L76)
158
-
159
- The **`-b`** (or `--bun`) flag forces Bun to be the runtime that executes the script. With it, the variables above become available and the `bun build --compile` step runs correctly.
160
-
161
- ---
162
-
163
- ## 🛠️ Tech Stack
164
-
165
- | | Technology | Details |
166
- |---|---|---|
167
- | 🔤 | **TypeScript** | ESNext target, strict mode, bundler resolution |
168
- | 🐰 | **Bun** | Runtime 1.3.9+, package manager |
169
- | 💚 | **Nuxt** | 4.x |
170
- | 📐 | **dprint** | Code formatter (TS, JSON, MD, TOML, YAML, and more) |
171
- | 📦 | **ESM** | Pure ES modules (`"type": "module"`) |
172
-
173
- ---
174
-
175
- ## 📚 Usage Examples
176
-
177
- ### Custom Build Script
178
-
179
- Create a dedicated npm script in your `package.json`:
180
-
181
- ```json
182
- {
183
- "scripts": {
184
- "build": "nuxt build",
185
- "compile": "NODE_OPTIONS=\"--max-old-space-size=8192\" bun run -b build"
186
- }
187
- }
188
- ```
189
-
190
- Then run: `bun run compile`
191
-
192
- ### Docker Deployment
193
-
194
- Before building, create a `.dockerignore` file to exclude unnecessary files from the build context:
195
-
196
- ```
197
- .claude
198
- .devcontainer
199
- .gemini
200
- .git
201
- .github
202
- .husky
203
- .nuxt
204
- .output
205
- .serena
206
- .vscode
207
- .yarn
208
- dist
209
- node_modules
210
- nuxtbin
211
- test
212
- tests
213
- ```
214
-
215
- Deploy the compiled binary in a Docker container using multi-stage build:
216
-
217
- ```dockerfile
218
- # Stage 1: Base image with Bun runtime
219
- FROM oven/bun:alpine AS bun-base
220
- WORKDIR /app
221
-
222
- # Stage 2: Install dependencies
223
- FROM bun-base AS bun-install
224
- COPY package.json bun.lockb ./
225
- RUN bun install --frozen-lockfile
226
-
227
- # Stage 3: Build the binary
228
- FROM bun-base AS bun-build
229
- COPY --from=bun-install /app/node_modules /app/node_modules
230
- COPY . .
231
- RUN NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
232
-
233
- # Stage 4: Release (lightweight production image)
234
- FROM alpine:latest AS release
235
- EXPOSE 3000/tcp
236
- WORKDIR /app
237
- # Required libraries for Bun binaries on Alpine
238
- # See: https://github.com/oven-sh/bun/issues/23910
239
- # https://github.com/oven-sh/bun/issues/918
240
- RUN apk add --no-cache libstdc++ libgcc
241
- COPY --from=bun-build /app/nuxtbin /app/nuxtbin
242
- CMD ["./nuxtbin"]
243
- ```
244
-
245
- Build and run:
246
- ```bash
247
- docker build -t my-nuxt-app .
248
- docker run -p 3000:3000 my-nuxt-app
249
- ```
250
-
251
- > **Reference:** See the complete multi-stage example in [nuxt-duckdb-wasm/Dockerfile](https://github.com/jprando/nuxt-duckdb-wasm/blob/main/Dockerfile) for a production-ready setup.
252
-
253
- ---
254
-
255
- ## 🧑‍💻 Development
256
-
257
- ### Testing Locally in a Nuxt App
258
-
259
- ```bash
260
- # 1. Clone this repo for local development
261
- git clone https://github.com/jprando/nuxt-bun-compile.git
262
-
263
- # 2. Link the module
264
- cd nuxt-bun-compile && bun install && bun prepack && bun link
265
-
266
- # 3. Use it in your Nuxt app
267
- cd your-nuxt-app && bun link nuxt-bun-compile
268
-
269
- # 4. Add to nuxt.config.ts modules array
270
- bun nuxt add nuxt-bun-compile
271
-
272
- # 5. Build
273
- NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
274
-
275
- # 6. Run the binary
276
- ./nuxtbin
277
- ```
44
+ - [🎯 What It Does](/docs/WHAT-IT-DOES.md)
45
+ - [⚙️ Options](/docs/OPTIONS.md)
46
+ - [📦 Default External Packages](/docs/DEFAULT-EXTERNAL-PACKAGES.md)
47
+ - [⚠️ Native Dependencies in Alpine Linux](/docs/NATIVE-DEPENDENCIES-IN-ALPINE-LINUX.md)
48
+ - [🏗️ Architecture](/docs/ARCHITECTURE.md)
49
+ - [📚 Usage Examples](/docs/USAGE-EXAMPLES.md)
50
+ - [🧑‍💻 Development](/docs/DEVELOPMENT.md)
51
+ - [🛠️ Tech Stack](/docs/TECH-STACK.md)
52
+ - [📝 Notes](/docs/NOTES.md)
278
53
 
279
54
  ---
280
55
 
@@ -286,22 +61,6 @@ NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
286
61
 
287
62
  ---
288
63
 
289
- ## 📝 Notes
290
-
291
- ### Why `NODE_OPTIONS="--max-old-space-size=8192"`?
292
-
293
- The Nuxt build process with `noExternals: true` and `inlineDynamicImports: true` causes Rollup/esbuild to bundle **all** dependencies into a single output. In projects with many dependencies, this can consume more memory than the default V8 heap limit (approximately 1.5–2 GB), resulting in the error:
294
-
295
- ```
296
- FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
297
- ```
298
-
299
- The `NODE_OPTIONS="--max-old-space-size=8192"` variable increases the V8 heap memory limit to 8 GB, providing enough headroom for the bundling process to complete. The value of `8192` (MB) is a safe reference for most projects — adjust as needed for larger projects or machines with less RAM.
300
-
301
- > **Note:** This variable affects the Node.js/V8 process that runs the Nuxt build, not the final binary generated by `bun build --compile`.
302
-
303
- ---
304
-
305
64
  ## 📄 License
306
65
 
307
66
  MIT
package/README.ptBR.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Socket Badge](https://badge.socket.dev/npm/package/nuxt-bun-compile/0.1.0)](https://badge.socket.dev/npm/package/nuxt-bun-compile/0.1.0)
4
4
 
5
- ![Logo Nuxt Bun Compile](/images/logo-transparent--nuxt-bun-compile.png "Logo Nuxt Bun Compile")
5
+ <img src="/images/logo-transparent--nuxt-bun-compile.png" alt="Logo Nuxt Bun Compile" width="50%">
6
6
 
7
7
  > 🚀 Módulo Nuxt que configura automaticamente o Nitro para `bun build --compile`, gerando um **binário executável standalone** a partir da sua aplicação Nuxt — sem dependências de runtime.
8
8
 
@@ -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/blob/main/README.ptBR.md#por-que--b-%C3%A9-obrigat%C3%B3rio)
27
+ [Por que é necessário o parâmetro `-b`?](/docs/ARCHITECTURE.ptBR.md#por-que--b-é-obrigatório)
28
28
 
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)
29
+ [Se você enfrentar problemas de memória durante a compilação](/docs/NOTES.ptBR.md#por-que-node_options--max-old-space-size8192)
30
30
 
31
31
  **Passo 3: Executar seu binário**
32
32
 
@@ -41,240 +41,15 @@ Só um binário. Sem `node_modules`. Sem runtime. Apenas sua aplicação.
41
41
 
42
42
  ---
43
43
 
44
- ## 🎯 O que Faz
45
-
46
- O módulo se conecta ao pipeline de build do Nuxt e cuida de **tudo** automaticamente:
47
-
48
- 1. **Configura o Nitro** com as configurações ótimas para compilação em binário
49
- 2. **Externaliza pacotes problemáticos** que quebram com bundling completo
50
- 3. **Executa `bun build --compile`** após o build para produzir um executável standalone
51
-
52
- ### Configuração do Nitro (aplicada automaticamente)
53
-
54
- | Configuração | Valor | Motivo |
55
- |---|---|---|
56
- | `preset` | `"bun"` | Usar o runtime Bun como alvo |
57
- | `noExternals` | `true` | Empacotar tudo no output |
58
- | `inlineDynamicImports` | `true` | Achatar imports dinâmicos para output em arquivo único |
59
- | `serveStatic` | `"inline"` | Embutir assets estáticos no binário |
60
- | `esbuild.options.target` | `"esnext"` | Usar as features JS mais recentes para máximo desempenho |
61
-
62
- ---
63
-
64
- ## ⚙️ Opções
65
-
66
- | Opção | Tipo | Padrão | Descrição |
67
- |---|---|---|---|
68
- | `enabled` | `boolean` | `true` | Habilitar/desabilitar o módulo |
69
- | `outfile` | `string` | `"nuxtbin"` | Nome do arquivo binário de saída |
70
- | `bunPath` | `string` | `undefined` | Caminho para o executável do bun. Pode ser um diretório (ex: `/opt/bun/`) ou o caminho direto para o binário (ex: `/opt/bun/bun`). Se for um diretório, '/bun' será anexado. O padrão é 'bun' do PATH do sistema. |
71
- | `target` | `'bun-linux-x64' \| 'bun-linux-x64-musl' \| 'bun-linux-arm64' \| 'bun-linux-arm64-musl'` | `auto-detectado` | Plataforma alvo para compilação do binário. Auto-detecta sua arquitetura (x64/arm64) e tipo de libc (glibc/musl). Sobrescreva apenas se a auto-detecção falhar ou você precisar de um target específico. |
72
- | `extraExternals` | `(string \| RegExp)[]` | `[]` | Pacotes adicionais para marcar como external |
73
- | `autoCompile` | `boolean` | `true` | Executar `bun build --compile` automaticamente após o build |
74
-
75
- ---
76
-
77
- ## 📦 Pacotes External Padrão
78
-
79
- Estes pacotes são conhecidos por quebrar com `noExternals: true` e são excluídos por padrão:
80
-
81
- | Pacote | Pattern |
82
- |---|---|
83
- | sharp | `sharp` |
84
- | @img | `@img/*` |
85
- | css-tree | `css-tree`, `css-tree/*` |
86
- | csso | `csso`, `csso/*` |
87
- | svgo | `svgo` |
88
- | mdn-data | `mdn-data`, `mdn-data/*` |
89
-
90
- Precisa adicionar mais? Use `extraExternals`:
91
-
92
- ```ts
93
- bunCompile: {
94
- extraExternals: ["problematic-package", /^@scope\//],
95
- }
96
- ```
97
-
98
- > **⚠️ Importante:** As bibliotecas listadas em `extraExternals` (assim como as externals padrão) **não são embutidas no binário**. Para que o binário `nuxtbin` execute corretamente, essas dependências precisam estar disponíveis em uma pasta `node_modules` ao lado do binário gerado.
99
-
100
- ---
101
-
102
- ## ⚠️ Dependências Nativas no Alpine Linux
103
-
104
- Ao compilar com `--target=bun-linux-x64-musl` ou `--target=bun-linux-arm64-musl` (Alpine), o binário resultante ainda faz link dinâmico com `libstdc++` e `libgcc` em tempo de execução. Este é um comportamento documentado do Bun:
105
-
106
- - [oven-sh/bun#23910](https://github.com/oven-sh/bun/issues/23910)
107
- - [oven-sh/bun#918](https://github.com/oven-sh/bun/issues/918)
108
-
109
- ### Solução: Instalar Bibliotecas Necessárias no Docker
110
-
111
- Se rodar o binário em um container Alpine Linux, instale as bibliotecas necessárias:
112
-
113
- ```dockerfile
114
- FROM alpine:latest
115
-
116
- RUN apk add --no-cache libstdc++ libgcc
117
-
118
- COPY nuxtbin /app/
119
- WORKDIR /app
120
-
121
- CMD ["./nuxtbin"]
122
- ```
123
-
124
- Isso garante que todas as dependências de runtime estejam disponíveis no container.
125
-
126
- ---
127
-
128
- ## 🏗️ Arquitetura
129
-
130
- O módulo usa uma **arquitetura baseada em hooks**:
131
-
132
- - **`nitro:config`** — Ajusta configurações do Nitro (preset, externals, bundling)
133
- - **`nitro:compiled`** — Aciona `bun build --compile` após o Nitro terminar o build do servidor
134
-
135
- ### Como Funciona
136
-
137
- ```
138
- bun run -b build
139
-
140
- ├─ hook nitro:config ──▶ Configura preset, bundling, externals
141
-
142
- ├─ Pipeline de build Nuxt/Nitro executa normalmente
143
-
144
- └─ hook nitro compiled ──▶ bun build .output/server/index.mjs --compile --outfile <nome>
145
-
146
- └──▶ 🎉 Binário standalone pronto!
147
- ```
148
-
149
- ### Por que `-b` é obrigatório?
150
-
151
- Quando você executa `bun run build` (sem `-b`), o Bun age como um **gerenciador de tarefas** e pode delegar a execução do script ao Node.js. Nesse cenário, as variáveis `globalThis.Bun` e `process.versions.bun` **não existem**, e o módulo não consegue detectar o runtime Bun:
152
-
153
- ```ts
154
- const isBun = typeof globalThis.Bun !== "undefined"
155
- || process.versions.bun !== undefined;
156
- ```
157
- [src/module.ts:L70-L76](https://github.com/jprando/nuxt-bun-compile/blob/main/src/module.ts#L70-L76)
158
-
159
- O parâmetro **`-b`** (ou `--bun`) força o Bun a ser o runtime que executa o script. Com ele, as variáveis acima ficam disponíveis e a etapa de `bun build --compile` é executada corretamente.
160
-
161
- ---
162
-
163
- ## 🛠️ Tech Stack
164
-
165
- | | Tecnologia | Detalhes |
166
- |---|---|---|
167
- | 🔤 | **TypeScript** | Target ESNext, strict mode, bundler resolution |
168
- | 🐰 | **Bun** | Runtime 1.3.9+, gerenciador de pacotes |
169
- | 💚 | **Nuxt** | 4.x |
170
- | 📐 | **dprint** | Formatador de código (TS, JSON, MD, TOML, YAML e mais) |
171
- | 📦 | **ESM** | ES modules puro (`"type": "module"`) |
172
-
173
- ---
174
-
175
- ## 📚 Exemplos de Uso
176
-
177
- ### Script Customizado de Build
178
-
179
- Crie um script npm/bun dedicado no seu `package.json`:
180
-
181
- ```json
182
- {
183
- "scripts": {
184
- "build": "nuxt build",
185
- "compile": "NODE_OPTIONS=\"--max-old-space-size=8192\" bun run -b build"
186
- }
187
- }
188
- ```
189
-
190
- Execute com: `bun run compile`
191
-
192
- ### Deploy com Docker
193
-
194
- Antes de compilar, crie um arquivo `.dockerignore` para excluir arquivos desnecessários do contexto de build:
195
-
196
- ```
197
- .claude
198
- .devcontainer
199
- .gemini
200
- .git
201
- .github
202
- .husky
203
- .nuxt
204
- .output
205
- .serena
206
- .vscode
207
- .yarn
208
- dist
209
- node_modules
210
- nuxtbin
211
- test
212
- tests
213
- ```
214
-
215
- Faça deploy do binário compilado em um container Docker usando multi-stage build:
216
-
217
- ```dockerfile
218
- # Estágio 1: Imagem base com runtime Bun
219
- FROM oven/bun:alpine AS bun-base
220
- WORKDIR /app
221
-
222
- # Estágio 2: Instalar dependências
223
- FROM bun-base AS bun-install
224
- COPY package.json bun.lockb ./
225
- RUN bun install --frozen-lockfile
226
-
227
- # Estágio 3: Compilar o binário
228
- FROM bun-base AS bun-build
229
- COPY --from=bun-install /app/node_modules /app/node_modules
230
- COPY . .
231
- RUN NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
232
-
233
- # Estágio 4: Release (imagem de produção otimizada)
234
- FROM alpine:latest AS release
235
- EXPOSE 3000/tcp
236
- WORKDIR /app
237
- # Bibliotecas necessárias para binários Bun no Alpine
238
- # Ver: https://github.com/oven-sh/bun/issues/23910
239
- # https://github.com/oven-sh/bun/issues/918
240
- RUN apk add --no-cache libstdc++ libgcc
241
- COPY --from=bun-build /app/nuxtbin /app/nuxtbin
242
- CMD ["./nuxtbin"]
243
- ```
244
-
245
- Build e execute:
246
- ```bash
247
- docker build -t minha-app-nuxt .
248
- docker run -p 3000:3000 minha-app-nuxt
249
- ```
250
-
251
- > **Referência:** Veja um exemplo completo com multi-stage em [nuxt-duckdb-wasm/Dockerfile](https://github.com/jprando/nuxt-duckdb-wasm/blob/main/Dockerfile) para um setup pronto para produção.
252
-
253
- ---
254
-
255
- ## 🧑‍💻 Desenvolvimento
256
-
257
- ### Testando Localmente em uma Aplicação Nuxt
258
-
259
- ```bash
260
- # 1. Clone este repositório para desenvolvimento local
261
- git clone https://github.com/jprando/nuxt-bun-compile.git
262
-
263
- # 2. Linke o módulo
264
- cd nuxt-bun-compile && bun install && bun prepack && bun link
265
-
266
- # 3. Use em sua aplicação Nuxt
267
- cd sua-app-nuxt && bun link nuxt-bun-compile
268
-
269
- # 4. Adicione ao array modules no nuxt.config.ts
270
- bun nuxt add nuxt-bun-compile
271
-
272
- # 5. Compile
273
- NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
274
-
275
- # 6. Execute o binário
276
- ./nuxtbin
277
- ```
44
+ - [🎯 O que Faz](/docs/WHAT-IT-DOES.ptBR.md)
45
+ - [⚙️ Opções](/docs/OPTIONS.ptBR.md)
46
+ - [📦 Pacotes External Padrão](/docs/DEFAULT-EXTERNAL-PACKAGES.ptBR.md)
47
+ - [⚠️ Dependências Nativas no Alpine Linux](/docs/NATIVE-DEPENDENCIES-IN-ALPINE-LINUX.ptBR.md)
48
+ - [🏗️ Arquitetura](/docs/ARCHITECTURE.ptBR.md)
49
+ - [📚 Exemplos de Uso](/docs/USAGE-EXAMPLES.ptBR.md)
50
+ - [🧑‍💻 Desenvolvimento](/docs/DEVELOPMENT.ptBR.md)
51
+ - [🛠️ Tech Stack](/docs/TECH-STACK.ptBR.md)
52
+ - [📝 Notas](/docs/NOTES.ptBR.md)
278
53
 
279
54
  ---
280
55
 
@@ -286,22 +61,6 @@ NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
286
61
 
287
62
  ---
288
63
 
289
- ## 📝 Notas
290
-
291
- ### Por que `NODE_OPTIONS="--max-old-space-size=8192"`?
292
-
293
- O processo de build do Nuxt com `noExternals: true` e `inlineDynamicImports: true` faz com que o Rollup/esbuild tente empacotar **todas** as dependências em um único bundle. Em projetos com muitas dependências, isso pode consumir mais memória do que o limite padrão do V8 (aproximadamente 1.5–2 GB), causando o erro:
294
-
295
- ```
296
- FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
297
- ```
298
-
299
- A variável `NODE_OPTIONS="--max-old-space-size=8192"` aumenta o limite de memória heap do V8 para 8 GB, dando margem suficiente para que o bundling termine sem estourar a memória. O valor de `8192` (MB) é uma referência segura para a maioria dos projetos — ajuste conforme necessário para projetos maiores ou máquinas com menos RAM.
300
-
301
- > **Nota:** Essa variável afeta o processo do Node.js/V8 que roda o build do Nuxt, e não o binário final gerado pelo `bun build --compile`.
302
-
303
- ---
304
-
305
64
  ## 📄 Licença
306
65
 
307
66
  MIT
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.26",
4
+ "version": "0.1.28",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-bun-compile",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
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",