nuxt-bun-compile 0.1.24 → 0.1.25
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 +27 -0
- package/README.ptBR.md +27 -0
- package/dist/module.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ The module hooks into Nuxt's build pipeline and handles **everything** automatic
|
|
|
68
68
|
| `enabled` | `boolean` | `true` | Enable/disable the module |
|
|
69
69
|
| `outfile` | `string` | `"nuxtbin"` | Output binary filename |
|
|
70
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. |
|
|
71
72
|
| `extraExternals` | `(string \| RegExp)[]` | `[]` | Additional packages to mark as external |
|
|
72
73
|
| `autoCompile` | `boolean` | `true` | Run `bun build --compile` automatically after build |
|
|
73
74
|
|
|
@@ -98,6 +99,32 @@ bunCompile: {
|
|
|
98
99
|
|
|
99
100
|
---
|
|
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
|
+
|
|
101
128
|
## 🏗️ Architecture
|
|
102
129
|
|
|
103
130
|
The module uses a **hook-based architecture**:
|
package/README.ptBR.md
CHANGED
|
@@ -68,6 +68,7 @@ O módulo se conecta ao pipeline de build do Nuxt e cuida de **tudo** automatica
|
|
|
68
68
|
| `enabled` | `boolean` | `true` | Habilitar/desabilitar o módulo |
|
|
69
69
|
| `outfile` | `string` | `"nuxtbin"` | Nome do arquivo binário de saída |
|
|
70
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. |
|
|
71
72
|
| `extraExternals` | `(string \| RegExp)[]` | `[]` | Pacotes adicionais para marcar como external |
|
|
72
73
|
| `autoCompile` | `boolean` | `true` | Executar `bun build --compile` automaticamente após o build |
|
|
73
74
|
|
|
@@ -98,6 +99,32 @@ bunCompile: {
|
|
|
98
99
|
|
|
99
100
|
---
|
|
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
|
+
|
|
101
128
|
## 🏗️ Arquitetura
|
|
102
129
|
|
|
103
130
|
O módulo usa uma **arquitetura baseada em hooks**:
|
package/dist/module.json
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.25",
|
|
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",
|