@wu-framework/cli 0.4.0 → 0.5.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/CHANGELOG.md +19 -1
- package/README.md +17 -6
- package/bin/wu-darwin-arm64 +0 -0
- package/bin/wu-darwin-x64 +0 -0
- package/bin/wu-linux-arm64 +0 -0
- package/bin/wu-linux-x64 +0 -0
- package/bin/wu-win32-x64.exe +0 -0
- package/bin/wu.js +71 -54
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Todos los cambios notables de wu-cli. Formato basado en [Keep a Changelog](https://keepachangelog.com/) y [SemVer](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [0.5.0] — 2026-08-29 — alineación con wu-framework 3
|
|
6
|
+
|
|
7
|
+
### Cambiado
|
|
8
|
+
|
|
9
|
+
- Los proyectos nuevos usan `wu-framework@^3.0.0-beta.2`, declaran Node 20+ y
|
|
10
|
+
`wu doctor` detecta rangos de registro que todavía resuelven a V2.
|
|
11
|
+
- `apps[].grants` y `apps[].compatibility` forman parte del schema del CLI y se
|
|
12
|
+
propagan sin pérdida por desarrollo, build, `apps.json`, `wu-manifest.json` y
|
|
13
|
+
shells generados.
|
|
14
|
+
- `wu build` fusiona el `wu.json` de la app con la entry final: conserva sus
|
|
15
|
+
solicitudes V3 y rechaza JSON malformado en lugar de borrarlo en silencio.
|
|
16
|
+
- El launcher npm ya no ejecuta el binario al importarlo desde tests y vuelve a
|
|
17
|
+
despachar Linux ARM64, que se distribuía pero faltaba en su mapa de plataforma.
|
|
18
|
+
|
|
19
|
+
### Pruebas
|
|
20
|
+
|
|
21
|
+
- Cobertura para rangos V3/locales, rechazo de V2, persistencia de grants y
|
|
22
|
+
compatibilidad, y conservación de permisos en manifiestos de producción.
|
|
23
|
+
|
|
5
24
|
## [0.4.0] — 2026-08-27 — cabeceras, CSP generada y ficheros que no debían salir
|
|
6
25
|
|
|
7
26
|
Todo lo de aquí sale de un informe de escaneo contra un sitio wu: `.env` servido, sin CSP, sin `X-Frame-Options`, `package.json` público, `Access-Control-Allow-Origin: *`. Nueve de los once hallazgos los producía wu, no el hosting.
|
|
@@ -252,4 +271,3 @@ Primera versión con el pipeline completo. (La 0.1.0, del 2026-02-27, fue el pri
|
|
|
252
271
|
- Soporte inicial para 13 frameworks
|
|
253
272
|
|
|
254
273
|
---
|
|
255
|
-
|
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
**Wu CLI** es un CLI + dev-server nativo en **Zig 0.16** para arquitecturas microfrontend ([wu-framework](https://www.wu-framework.com)). Reemplaza **N procesos Vite** (uno por micro-app) con **un único proceso en un solo puerto** que descubre, compila, sirve y hace HMR. Sin dependencias Zig, binario de ~250-460 KB por plataforma, distribuido vía npm.
|
|
34
34
|
|
|
35
|
-
## Estado actual (código v0.
|
|
35
|
+
## Estado actual (código v0.5.0)
|
|
36
36
|
|
|
37
37
|
Las versiones de `package.json`, `src/main.zig` y `build.zig.zon` están
|
|
38
38
|
sincronizadas y una invariante de CI evita que vuelvan a divergir. Consulta el
|
|
@@ -70,7 +70,8 @@ sincronizadas y una invariante de CI evita que vuelvan a divergir. Consulta el
|
|
|
70
70
|
npm install -g @wu-framework/cli
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
Requiere **Node.js
|
|
73
|
+
Requiere **Node.js 20+**. El requisito coincide con wu-framework 3 y con las
|
|
74
|
+
plantillas actuales de Astro, Next y Angular.
|
|
74
75
|
|
|
75
76
|
### Desde fuente
|
|
76
77
|
|
|
@@ -168,7 +169,14 @@ Referencia completa con todas las flags: **[docs/cli.md](docs/cli.md)**.
|
|
|
168
169
|
"framework": "react"
|
|
169
170
|
},
|
|
170
171
|
"apps": [
|
|
171
|
-
{
|
|
172
|
+
{
|
|
173
|
+
"name": "catalog",
|
|
174
|
+
"dir": "mf-catalog",
|
|
175
|
+
"framework": "react",
|
|
176
|
+
"port": 5001,
|
|
177
|
+
"grants": ["events.emit:catalog:*", "events.subscribe:catalog:*"],
|
|
178
|
+
"compatibility": "strict"
|
|
179
|
+
},
|
|
172
180
|
{ "name": "cart", "dir": "mf-cart", "framework": "vue", "port": 5002 }
|
|
173
181
|
],
|
|
174
182
|
"shared": ["react", "react-dom", "react-dom/client"],
|
|
@@ -180,6 +188,10 @@ Referencia completa con todas las flags: **[docs/cli.md](docs/cli.md)**.
|
|
|
180
188
|
}
|
|
181
189
|
```
|
|
182
190
|
|
|
191
|
+
En wu-framework 3, `grants` es autoridad del shell y se cruza con lo que cada
|
|
192
|
+
app solicita en `wu.json`; declarar un grant que la app no pidió no le concede
|
|
193
|
+
nada. `compatibility: "v2"` es un puente temporal por app, no el nuevo default.
|
|
194
|
+
|
|
183
195
|
Si no existe, `wu` auto-descubre micro-apps escaneando subdirectorios con `vite.config.*` + `package.json`. El directorio llamado **`shell`** se promueve a shell del proyecto.
|
|
184
196
|
|
|
185
197
|
Schema completo, defaults, ejemplos de proxy: **[docs/configuration.md](docs/configuration.md)**.
|
|
@@ -266,13 +278,12 @@ Configuración para producción y modelo de amenazas: **[docs/security.md](docs/
|
|
|
266
278
|
- **47** archivos Zig fuente, **~18.4k LOC** totales en `src/` (runtime + cli + config + commands)
|
|
267
279
|
- **~250-460 KB** binario release por plataforma (con `-Doptimize=ReleaseFast`)
|
|
268
280
|
- **0** dependencias Zig externas
|
|
269
|
-
-
|
|
281
|
+
- Suite Zig, launcher npm, invariantes, fuzzing y smokes de proyectos generados
|
|
270
282
|
- **0** procesos Vite simultáneos en `wu dev` (modo nativo). `wu dev --vite` legacy sí spawnea N procesos.
|
|
271
283
|
|
|
272
284
|
## Requisitos
|
|
273
285
|
|
|
274
|
-
- **Node.js
|
|
275
|
-
- **Node.js 18+** a runtime sólo para Vue, Svelte, Solid o Angular (React/Preact corren en Zig puro)
|
|
286
|
+
- **Node.js 20+** para instalar el CLI y ejecutar los toolchains generados
|
|
276
287
|
- **Zig 0.16.0** sólo si construyes desde fuente
|
|
277
288
|
|
|
278
289
|
## Licencia
|
package/bin/wu-darwin-arm64
CHANGED
|
Binary file
|
package/bin/wu-darwin-x64
CHANGED
|
Binary file
|
package/bin/wu-linux-arm64
CHANGED
|
Binary file
|
package/bin/wu-linux-x64
CHANGED
|
Binary file
|
package/bin/wu-win32-x64.exe
CHANGED
|
Binary file
|
package/bin/wu.js
CHANGED
|
@@ -5,57 +5,74 @@ const path = require('path');
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const os = require('os');
|
|
7
7
|
|
|
8
|
-
const PLATFORM_MAP = {
|
|
9
|
-
'win32-x64': 'wu-win32-x64.exe',
|
|
10
|
-
'linux-x64': 'wu-linux-x64',
|
|
11
|
-
'
|
|
12
|
-
'darwin-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (result.error
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
8
|
+
const PLATFORM_MAP = {
|
|
9
|
+
'win32-x64': 'wu-win32-x64.exe',
|
|
10
|
+
'linux-x64': 'wu-linux-x64',
|
|
11
|
+
'linux-arm64': 'wu-linux-arm64',
|
|
12
|
+
'darwin-x64': 'wu-darwin-x64',
|
|
13
|
+
'darwin-arm64': 'wu-darwin-arm64',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function binaryNameFor(platform, arch) {
|
|
17
|
+
return PLATFORM_MAP[`${platform}-${arch}`];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function executeBinary(binaryPath, args, runtime = {}) {
|
|
21
|
+
const spawn = runtime.spawn ?? spawnSync;
|
|
22
|
+
const chmod = runtime.chmod ?? fs.chmodSync;
|
|
23
|
+
const reportError = runtime.reportError ?? console.error;
|
|
24
|
+
const options = {
|
|
25
|
+
stdio: 'inherit',
|
|
26
|
+
env: runtime.env ?? process.env,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let result = spawn(binaryPath, args, options);
|
|
30
|
+
|
|
31
|
+
// npm pack on Windows cannot preserve POSIX executable bits. Repair the
|
|
32
|
+
// packaged Linux/macOS binary only when the operating system rejects it.
|
|
33
|
+
if (result.error && result.error.code === 'EACCES') {
|
|
34
|
+
try {
|
|
35
|
+
chmod(binaryPath, 0o755);
|
|
36
|
+
result = spawn(binaryPath, args, options);
|
|
37
|
+
} catch (chmodErr) {
|
|
38
|
+
reportError(`wu-cli: permission denied and could not chmod: ${chmodErr.message}`);
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (result.error) {
|
|
44
|
+
reportError(`wu-cli: failed to execute binary: ${result.error.message}`);
|
|
45
|
+
return 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return result.status ?? 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function runCli(args = process.argv.slice(2)) {
|
|
52
|
+
const platform = os.platform();
|
|
53
|
+
const arch = os.arch();
|
|
54
|
+
const binaryName = binaryNameFor(platform, arch);
|
|
55
|
+
|
|
56
|
+
if (!binaryName) {
|
|
57
|
+
console.error(`wu-cli: unsupported platform ${platform}-${arch}`);
|
|
58
|
+
console.error(`Supported: ${Object.keys(PLATFORM_MAP).join(', ')}`);
|
|
59
|
+
return 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
63
|
+
|
|
64
|
+
if (!fs.existsSync(binaryPath)) {
|
|
65
|
+
console.error(`wu-cli: binary not found at ${binaryPath}`);
|
|
66
|
+
console.error('This may mean the package was not built for your platform.');
|
|
67
|
+
console.error('Try reinstalling: npm install -g @wu-framework/cli');
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return executeBinary(binaryPath, args);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
module.exports = { PLATFORM_MAP, binaryNameFor, executeBinary, runCli };
|
|
75
|
+
|
|
76
|
+
if (require.main === module) {
|
|
77
|
+
process.exit(runCli());
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wu-framework/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Native Zig dev server + CLI for wu-framework microfrontends. One binary, one port, all your micro-apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Wu Framework Team",
|
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
"LICENSE"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"
|
|
19
|
-
"test
|
|
18
|
+
"build:binaries": "node scripts/build-all.mjs",
|
|
19
|
+
"test": "npm run test:invariants && npm run test:wrapper",
|
|
20
|
+
"test:invariants": "node scripts/check-invariants.mjs",
|
|
21
|
+
"test:wrapper": "node --test \"tests/*.test.cjs\"",
|
|
22
|
+
"prepublishOnly": "npm test && npm run build:binaries"
|
|
20
23
|
},
|
|
21
24
|
"keywords": [
|
|
22
25
|
"micro-frontend",
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
"stimulus"
|
|
42
45
|
],
|
|
43
46
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
47
|
+
"node": ">=20"
|
|
45
48
|
},
|
|
46
49
|
"publishConfig": {
|
|
47
50
|
"access": "public"
|