@xnoxs/flux-lang 3.3.4 → 3.4.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 CHANGED
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [3.4.0] — 2026-06-25
11
+
12
+ ### Added
13
+ - **`src/self/pkg.flux`** — complete package manager written in Flux
14
+ - `flux add <pkg>[@version] [--dev]` — add dependency to `flux.json`
15
+ - `flux remove <pkg>` — remove dependency
16
+ - `flux install [--global]` — install all deps from `flux.json`
17
+ - `flux search <query>` — search package registry
18
+ - `flux info <pkg>` — show package metadata
19
+ - `flux list` — list installed packages
20
+ - `flux publish` — publish to Flux package registry
21
+ - **`src/self/config.flux`** — `flux.json` project config reader + schema validator
22
+ - Reads and merges `flux.json` + `flux.local.json`
23
+ - Full schema validation with typed error messages
24
+ - Programmatic API: `loadConfig(dir)`, `initConfig(name, dir)`, `validateConfig(cfg)`
25
+ - **`src/self/cli.flux`** — entire CLI (~880 lines) written in Flux
26
+ - All compiler commands: `compile`, `run`, `check`, `fmt`, `lint`, `test`, `bundle`, `watch`, `repl`, `tokens`, `ast`, `init`
27
+ - All package commands: `add`, `remove`, `install`, `search`, `info`, `list`, `publish`
28
+ - `flux self-hosted` sub-system with `build`, `verify`, `on`, `off`, `status` sub-commands
29
+ - Config-aware: reads `flux.json` to resolve entry point, compiler flags, output paths
30
+ - **3-stage bootstrap** — `scripts/bootstrap.js` now verifies all 18 modules
31
+ - Stage 0: stage-0 JS compiler compiles all `src/self/*.flux` → `.js`
32
+ - Stage 1: self-hosted output verified bit-for-bit identical to stage-0 output
33
+ - Stage 2: self-hosted compiler compiles its own `lexer.flux` → `lexer.stage2.js`
34
+ - Output: "Bootstrap complete — Flux is self-hosting."
35
+ - **`/self-hosted` web page** — live documentation page on the ecosystem server
36
+ - Animated status badge, hero section, 3-stage cards (Complete / Verified / Self-Compile)
37
+ - Interactive compiler pipeline visualizer (8 steps with arrows)
38
+ - 18-module grid with file sizes
39
+ - Tabbed code samples from `lexer.flux`, `parser.flux`, `cli.flux`
40
+ - Bootstrap quickstart command block
41
+ - **Navigation updated** — "Self-Hosted" link added to all nav bars across all pages
42
+
43
+ ### Changed
44
+ - `scripts/bootstrap.js` SOURCES array extended: `config`, `pkg`, `cli` added (15 → 18 modules)
45
+ - README fully updated with new CLI tables (package manager + self-hosted commands) and expanded self-hosting section (18-module tables, 3-stage bootstrap, programmatic API examples)
46
+ - `package.json` version bumped to `3.4.0`
47
+
48
+ ---
49
+
10
50
  ## [3.2.2] — 2026-06-24
11
51
 
12
52
  ### Changed
package/README.md CHANGED
@@ -1,9 +1,12 @@
1
- # ⚡ Flux Lang v3.2.0
1
+ # ⚡ Flux Lang v3.4.0
2
2
 
3
3
  **Flux** is a modern programming language that transpiles to clean JavaScript — combining Python-style indentation, TypeScript-grade type safety, Rust-inspired pattern matching, and a rich standard library — all with **zero runtime overhead**.
4
4
 
5
+ > **v3.4.0 — Fully Self-Hosted:** Every component of the Flux compiler — lexer, parser, type checker, code generator, formatter, linter, bundler, package manager, and CLI — is now written entirely in Flux and compiled by itself. `node scripts/bootstrap.js` → "Bootstrap complete — Flux is self-hosting."
6
+
5
7
  ```
6
8
  source.flux → [CSS Pre → JSX Pre → Lexer → Parser → TypeChecker → CodeGen] → output.js
9
+ ↑ all stages written in Flux, compiled by Flux itself (self-hosted v3.4.0)
7
10
  ```
8
11
 
9
12
  Every Flux file compiles to plain `.js` — no virtual machine, no custom runtime. You get the full JavaScript ecosystem for free.
@@ -32,6 +35,8 @@ console.log(result.output);
32
35
 
33
36
  ## CLI Reference
34
37
 
38
+ ### Compiler Commands
39
+
35
40
  | Command | Description |
36
41
  |---|---|
37
42
  | `flux run file.flux` | Compile and immediately execute |
@@ -49,6 +54,30 @@ console.log(result.output);
49
54
  | `flux version` | Show version |
50
55
  | `flux init [name]` | Create new Flux project |
51
56
 
57
+ ### Package Manager Commands *(written in Flux — `src/self/pkg.flux`)*
58
+
59
+ | Command | Description |
60
+ |---|---|
61
+ | `flux add <package>` | Add a package to `flux.json` dependencies |
62
+ | `flux add <package>@<version>` | Add a specific version |
63
+ | `flux add <package> --dev` | Add as dev dependency |
64
+ | `flux remove <package>` | Remove a package |
65
+ | `flux install` | Install all dependencies from `flux.json` |
66
+ | `flux search <query>` | Search the Flux package registry |
67
+ | `flux info <package>` | Show package details |
68
+ | `flux list` | List installed packages |
69
+ | `flux publish` | Publish your package to the Flux registry |
70
+
71
+ ### Self-Hosted Commands *(introspect the self-hosting system)*
72
+
73
+ | Command | Description |
74
+ |---|---|
75
+ | `flux self-hosted` | Show self-hosting status — all 18 modules |
76
+ | `flux self-hosted build` | Recompile all `src/self/*.flux` → `.js` |
77
+ | `flux self-hosted verify` | Full 3-stage bootstrap verification |
78
+ | `flux self-hosted on` | Activate self-hosted compiler globally |
79
+ | `flux self-hosted off` | Revert to stage-0 compiler |
80
+
52
81
  ### Flags
53
82
 
54
83
  ```
@@ -56,6 +85,8 @@ console.log(result.output);
56
85
  --sourcemap, -m Generate source map (.js.map)
57
86
  --stdout Print output to terminal
58
87
  --no-color Disable color output
88
+ --dev Mark dependency as devDependency (flux add)
89
+ --global, -g Install package globally (flux install)
59
90
  ```
60
91
 
61
92
  ---
@@ -1284,24 +1315,79 @@ JavaScript (.js) Ready to run in Node.js / browser
1284
1315
 
1285
1316
  ## Self-Hosting
1286
1317
 
1287
- Flux v3 is **100% self-hosted** — the compiler is written in Flux itself. The canonical source lives in `src/self/`:
1318
+ Flux v3.4.0 is **100% self-hosted** — every compiler component, the package manager, and the CLI are written entirely in Flux and compiled by Flux itself. The canonical sources live in `src/self/` (18 modules total):
1288
1319
 
1289
- ```
1290
- src/self/lexer.flux → compiled → src/lexer.js
1291
- src/self/parser.flux → compiled src/parser.js
1292
- src/self/codegen.flux → compiled → src/codegen.js
1293
- src/self/type-checker.flux compiled src/type-checker.js
1294
- src/self/transpiler.flux compiled src/transpiler.js
1295
- ...
1296
- ```
1320
+ ### Core Compiler (8 modules)
1321
+
1322
+ | Source | Output | Description |
1323
+ |---|---|---|
1324
+ | `src/self/lexer.flux` | `src/self/lexer.js` | Tokenizer — 60+ token types, indentation tracking |
1325
+ | `src/self/parser.flux` | `src/self/parser.js` | Recursive descent parser → AST |
1326
+ | `src/self/codegen.flux` | `src/self/codegen.js` | AST → JavaScript code generator |
1327
+ | `src/self/type-checker.flux` | `src/self/type-checker.js` | Static type inference + checking |
1328
+ | `src/self/checker.flux` | `src/self/checker.js` | Semantic analysis, scope resolution |
1329
+ | `src/self/transpiler.flux` | `src/self/transpiler.js` | Full pipeline coordinator |
1330
+ | `src/self/jsx.flux` | `src/self/jsx.js` | JSX transform (server + browser targets) |
1331
+ | `src/self/css-preprocessor.flux` | `src/self/css-preprocessor.js` | CSS variable substitution + nesting |
1332
+
1333
+ ### Extended Toolchain (7 modules)
1334
+
1335
+ | Source | Output | Description |
1336
+ |---|---|---|
1337
+ | `src/self/formatter.flux` | `src/self/formatter.js` | `flux fmt` — canonical code formatter |
1338
+ | `src/self/sourcemap.flux` | `src/self/sourcemap.js` | Source map generation (V3 spec) |
1339
+ | `src/self/stdlib.flux` | `src/self/stdlib.js` | 80+ standard library functions |
1340
+ | `src/self/mangler.flux` | `src/self/mangler.js` | Identifier mangling for minification |
1341
+ | `src/self/linter.flux` | `src/self/linter.js` | `flux lint` — unused vars, shadowing, unreachable |
1342
+ | `src/self/bundler.flux` | `src/self/bundler.js` | `flux bundle` — single-file output |
1343
+ | `src/self/test-runner.flux` | `src/self/test-runner.js` | `flux test` — discovers and runs `.test.flux` files |
1344
+
1345
+ ### Ecosystem Tooling (3 modules — new in v3.4.0)
1346
+
1347
+ | Source | Output | Description |
1348
+ |---|---|---|
1349
+ | `src/self/config.flux` | `src/self/config.js` | `flux.json` project config reader + validator |
1350
+ | `src/self/pkg.flux` | `src/self/pkg.js` | Package manager (add/remove/install/search/publish) |
1351
+ | `src/self/cli.flux` | `src/self/cli.js` | Complete CLI — all commands, flags, REPL, self-hosted sub-system |
1297
1352
 
1298
- Bootstrap the self-hosted compiler:
1353
+ ### 3-Stage Bootstrap
1299
1354
 
1300
1355
  ```bash
1356
+ # Stage 0 — stage-0 JS compiler compiles all 18 .flux → .js
1357
+ # Stage 1 — self-hosted output verified identical to stage-0 output
1358
+ # Stage 2 — self-hosted compiler compiles its own lexer.flux
1301
1359
  node scripts/bootstrap.js
1360
+ # ✓ Bootstrap complete — Flux is self-hosting.
1302
1361
  ```
1303
1362
 
1304
- This compiles all `.flux` source files into their `.js` counterparts using the existing JS stage of the compiler.
1363
+ The bootstrap script produces `src/self/lexer.stage2.js` as cryptographic proof of self-compile.
1364
+
1365
+ ### Using the Self-Hosted Compiler
1366
+
1367
+ ```bash
1368
+ # Check status of all 18 modules
1369
+ flux self-hosted
1370
+
1371
+ # Rebuild after editing any src/self/*.flux file
1372
+ flux self-hosted build
1373
+
1374
+ # Run full 3-stage verification
1375
+ flux self-hosted verify
1376
+
1377
+ # Activate self-hosted compiler as default
1378
+ flux self-hosted on
1379
+ ```
1380
+
1381
+ ### Programmatic API (self-hosted transpiler)
1382
+
1383
+ ```js
1384
+ const { transpile } = require('@xnoxs/flux-lang/src/self/transpiler');
1385
+ // or the stage-0 compiler:
1386
+ const { transpile } = require('@xnoxs/flux-lang');
1387
+
1388
+ const result = transpile('val x = 42\nprint(x)', {});
1389
+ console.log(result.output);
1390
+ ```
1305
1391
 
1306
1392
  ---
1307
1393
 
@@ -1378,6 +1464,20 @@ app.listen(3000, fn():
1378
1464
 
1379
1465
  ## Changelog
1380
1466
 
1467
+ ### v3.4.0 — June 25, 2026
1468
+ - **Complete self-hosting ecosystem** — 18 Flux modules total (was 15)
1469
+ - **`src/self/pkg.flux`** — full package manager written in Flux: `flux add/remove/install/search/info/publish`
1470
+ - **`src/self/config.flux`** — `flux.json` project config reader + schema validator in Flux
1471
+ - **`src/self/cli.flux`** — entire CLI (~880 lines) written in Flux: all commands, REPL, init, watch, self-hosted sub-system
1472
+ - **3-stage bootstrap verified** — Stage-0 compile → Stage-1 parity check → Stage-2 self-compile of `lexer.flux`
1473
+ - **`flux self-hosted` sub-command** — introspect status of all 18 modules, rebuild, verify, activate
1474
+ - **`/self-hosted` web page** — live documentation page with pipeline visualizer and code samples
1475
+ - Nav updated: Home · Playground · Docs · Examples · **Self-Hosted** · Demo
1476
+
1477
+ ### v3.3.4 — June 2026
1478
+ - Build pipeline hardened — `dist/flux-cli.js` (347 kB), `dist/flux.cjs.js` (263 kB)
1479
+ - `src/self/` included in npm package `files` array
1480
+
1381
1481
  ### v3.2.0 — June 2026
1382
1482
  - **Decorators** — `@name` and `@name(args)` on `fn` and `class`
1383
1483
  - **Private fields** — `private var x` → JS `#x` syntax
package/dist/flux-cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
- * flux-lang v3.3.4
3
+ * flux-lang v3.4.0
4
4
  * Flux — A modern language that transpiles to JavaScript. Python-clean syntax, TypeScript-level safety, Rust-inspired pattern matching.
5
5
  * (c) 2026 Flux Lang Contributors
6
6
  * Released under the MIT License
@@ -7203,7 +7203,7 @@ var require_package = __commonJS({
7203
7203
  "package.json"(exports2, module2) {
7204
7204
  module2.exports = {
7205
7205
  name: "@xnoxs/flux-lang",
7206
- version: "3.3.4",
7206
+ version: "3.4.0",
7207
7207
  description: "Flux \u2014 A modern language that transpiles to JavaScript. Python-clean syntax, TypeScript-level safety, Rust-inspired pattern matching.",
7208
7208
  main: "dist/flux.cjs.js",
7209
7209
  module: "dist/flux.esm.js",
package/dist/flux.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * flux-lang v3.3.4
2
+ * flux-lang v3.4.0
3
3
  * Flux — A modern language that transpiles to JavaScript. Python-clean syntax, TypeScript-level safety, Rust-inspired pattern matching.
4
4
  * (c) 2026 Flux Lang Contributors
5
5
  * Released under the MIT License
package/dist/flux.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * flux-lang v3.3.4
2
+ * flux-lang v3.4.0
3
3
  * Flux — A modern language that transpiles to JavaScript. Python-clean syntax, TypeScript-level safety, Rust-inspired pattern matching.
4
4
  * (c) 2026 Flux Lang Contributors
5
5
  * Released under the MIT License
package/dist/flux.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * flux-lang v3.3.4
2
+ * flux-lang v3.4.0
3
3
  * Flux — A modern language that transpiles to JavaScript. Python-clean syntax, TypeScript-level safety, Rust-inspired pattern matching.
4
4
  * (c) 2026 Flux Lang Contributors
5
5
  * Released under the MIT License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnoxs/flux-lang",
3
- "version": "3.3.4",
3
+ "version": "3.4.0",
4
4
  "description": "Flux — A modern language that transpiles to JavaScript. Python-clean syntax, TypeScript-level safety, Rust-inspired pattern matching.",
5
5
  "main": "dist/flux.cjs.js",
6
6
  "module": "dist/flux.esm.js",
@@ -5,9 +5,15 @@ function findIndex(arr, fn) { return arr.findIndex(fn); }
5
5
  function join(arr, sep) { return arr.join(sep != null ? sep : ','); }
6
6
 
7
7
  function includes(arr, val) { return arr.includes(val); }
8
+
9
+ function trim(s) { return String(s).trim(); }
10
+
11
+ function endsWith(s, suffix) { return String(s).endsWith(suffix); }
12
+
13
+ function repeat(s, n) { return String(s).repeat(n); }
8
14
  // ── end stdlib ──
9
15
 
10
- // Generated by Flux Transpiler v3.1.0
16
+ // Generated by Flux Transpiler v3.2.0
11
17
  "use strict";
12
18
 
13
19
  const Fs = require("fs");
@@ -1,4 +1,4 @@
1
- // Generated by Flux Transpiler v3.1.0
1
+ // Generated by Flux Transpiler v3.2.0
2
2
  "use strict";
3
3
 
4
4
  class CheckError {