@xnoxs/flux-lang 3.1.1

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.md +1089 -0
  3. package/bin/flux.js +1397 -0
  4. package/dist/flux.cjs.js +6664 -0
  5. package/dist/flux.esm.js +6674 -0
  6. package/dist/flux.min.js +263 -0
  7. package/index.d.ts +202 -0
  8. package/index.js +26 -0
  9. package/package.json +77 -0
  10. package/scripts/build.js +76 -0
  11. package/src/bundler.js +216 -0
  12. package/src/checker.js +322 -0
  13. package/src/codegen.js +785 -0
  14. package/src/css-preprocessor.js +399 -0
  15. package/src/formatter.js +140 -0
  16. package/src/jsx.js +480 -0
  17. package/src/lexer.js +518 -0
  18. package/src/linter.js +758 -0
  19. package/src/mangler.js +280 -0
  20. package/src/parser.js +1671 -0
  21. package/src/self/bundler.flux +167 -0
  22. package/src/self/bundler.js +187 -0
  23. package/src/self/checker.flux +249 -0
  24. package/src/self/checker.js +338 -0
  25. package/src/self/codegen.flux +555 -0
  26. package/src/self/codegen.js +784 -0
  27. package/src/self/css-preprocessor.flux +373 -0
  28. package/src/self/css-preprocessor.js +387 -0
  29. package/src/self/formatter.flux +93 -0
  30. package/src/self/formatter.js +114 -0
  31. package/src/self/jsx.flux +430 -0
  32. package/src/self/jsx.js +396 -0
  33. package/src/self/lexer.flux +529 -0
  34. package/src/self/lexer.js +709 -0
  35. package/src/self/lexer.stage2.js +700 -0
  36. package/src/self/linter.flux +515 -0
  37. package/src/self/linter.js +804 -0
  38. package/src/self/mangler.flux +253 -0
  39. package/src/self/mangler.js +348 -0
  40. package/src/self/parser.flux +1146 -0
  41. package/src/self/parser.js +1571 -0
  42. package/src/self/sourcemap.flux +66 -0
  43. package/src/self/sourcemap.js +72 -0
  44. package/src/self/stdlib.flux +356 -0
  45. package/src/self/stdlib.js +396 -0
  46. package/src/self/test-runner.flux +201 -0
  47. package/src/self/test-runner.js +132 -0
  48. package/src/self/transpiler.flux +123 -0
  49. package/src/self/transpiler.js +83 -0
  50. package/src/self/type-checker.flux +821 -0
  51. package/src/self/type-checker.js +1106 -0
  52. package/src/sourcemap.js +82 -0
  53. package/src/stdlib.js +436 -0
  54. package/src/test-runner.js +239 -0
  55. package/src/transpiler.js +172 -0
  56. package/src/type-checker.js +1206 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,103 @@
1
+ # Changelog
2
+
3
+ All notable changes to Flux Lang are documented here.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [3.1.0] — 2026-06-24
11
+
12
+ ### Added
13
+ - **Multiline arrow block bodies** — `val f = x ->\n stmt1\n stmt2` (multi-statement lambdas)
14
+ - **`for..of` loops** — `for item of iterable:` for iterating any JS iterable
15
+ - **Computed property keys** — `{ [expr]: value }` in object literals
16
+ - **Class getter / setter** — `get propName():` and `set propName(v):` (no `fn` keyword required)
17
+ - **Labeled break / continue** — `outer: for i in 0..n:` with `break outer` / `continue outer`
18
+ - **For-loop array destructuring** — `for [a, b] in pairs:` in `for..in` loops
19
+ - **esbuild bundle** — `npm run build` produces `dist/flux.cjs.js`, `dist/flux.esm.js`, `dist/flux.min.js`
20
+ - **Test suite expanded** — 81 tests across 11 test files (was 71)
21
+
22
+ ### Fixed
23
+ - Expression statements starting with short identifiers (e.g. `Fs.writeFileSync()`) no longer trigger false "misspelled keyword" parse errors
24
+ - `match` expressions used as values now emit a proper IIFE rather than a bare `switch`
25
+ - Static class methods no longer emit a stray `method` keyword
26
+ - `break` / `continue` now accept an optional label on the same line
27
+
28
+ ---
29
+
30
+ ## [Unreleased]
31
+
32
+ ### Added
33
+ - Standard library (`src/stdlib.js`) with 28 built-in helpers: `range`, `zip`, `enumerate`, `clamp`, `sum`, `flatten`, `chunk`, `unique`, `groupBy`, `sortBy`, `pick`, `omit`, `sleep`, `retry`, `memoize`, `pipe`, `compose`, `curry`, and more
34
+ - TypeScript definitions (`index.d.ts`) — full API types for the transpiler, formatter, lexer, parser, and bundler
35
+ - GitHub Actions CI — tests on Node 16, 18, 20, 22 on every push
36
+ - GitHub Actions CD — automated npm publish on version tag
37
+ - Benchmark suite (`benchmarks/bench.js`) — measures transpiler throughput
38
+ - VS Code extension (`vscode-flux/`) — syntax highlighting, snippets, LSP diagnostics
39
+ - Ecosystem website — landing page, interactive playground, documentation, examples gallery
40
+ - `flux.config.json` — project-level configuration file support
41
+
42
+ ---
43
+
44
+ ## [3.0.0] — 2025-01-01
45
+
46
+ ### Added
47
+ - **Return type annotations** — `fn greet(name: String) -> String:`
48
+ - **Union types** — `val x: Int | String | Null`
49
+ - **Nullable shorthand** — `String?` compiles to `String | Null`
50
+ - **Full type checker** — `flux check` catches type mismatches at compile time
51
+ - **Interface enforcement** — `implements` keyword checks all required members
52
+ - **Generic interfaces** — `interface Container<T>: fn get() -> T`
53
+ - **Algebraic Data Types** — `type Result = Ok(value) | Err(msg)`
54
+ - **ADT pattern matching** — `when Pattern(x):` binds fields
55
+ - **Match guards** — `when Pattern if condition:`
56
+ - **String format specs** — `"Pi: {pi:.2f}"`, `"{n:,}"`, `"{rate:.1%}"`
57
+ - `async` / `await` — async functions and promise handling
58
+ - `try` / `catch` / `finally` — structured error handling
59
+ - Spread / rest (`...`) — spread arrays/objects, rest parameters
60
+ - Optional chaining (`?.`) — safe property access
61
+ - Nullish coalescing (`??`) — default value for null/undefined
62
+ - Destructuring — `val { a, b } = obj` / `val [x, y] = arr`
63
+
64
+ ### Changed
65
+ - CLI rewritten from scratch — colored output, better error display
66
+ - Source maps redesigned — accurate line/column mappings
67
+ - Parser rewritten — 2× faster on large files
68
+
69
+ ---
70
+
71
+ ## [2.0.0] — 2024-06-01
72
+
73
+ ### Added
74
+ - JSX support — compile `.flux` files with JSX syntax
75
+ - CSS-in-Flux — `css { ... }` shorthand blocks
76
+ - Name mangling — `--mangle` flag for obfuscated output
77
+ - Source maps — `--sourcemap` flag
78
+ - `flux bundle` — bundle multiple files into one JS
79
+ - `flux watch` — watch mode with auto-recompile
80
+ - `flux fmt` — source formatter
81
+ - `flux repl` — interactive REPL
82
+ - `flux test` — test runner for `*.test.flux` files
83
+ - `flux init` — scaffold new Flux projects
84
+ - Val-immutability checker — errors on `val` reassignment
85
+
86
+ ### Changed
87
+ - Arrow functions: `->` instead of `=>`
88
+ - Template strings: `"{variable}"` instead of backtick syntax
89
+ - `fn` keyword for all function declarations
90
+
91
+ ---
92
+
93
+ ## [1.0.0] — 2024-01-01
94
+
95
+ ### Added
96
+ - Initial release
97
+ - Lexer, Parser, Code Generator
98
+ - Basic types: String, Int, Float, Bool, Null
99
+ - Control flow: `if`, `else`, `for`, `while`
100
+ - Functions: `fn`, basic arrow functions
101
+ - Classes with `extends`
102
+ - Module system: `import`, `export`
103
+ - `flux compile`, `flux run` CLI commands