@xnoxs/flux-lang 3.3.0 → 3.3.2

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/dist/flux-cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
- * flux-lang v3.3.0
3
+ * flux-lang v3.3.2
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
@@ -7163,7 +7163,7 @@ var require_package = __commonJS({
7163
7163
  "package.json"(exports2, module2) {
7164
7164
  module2.exports = {
7165
7165
  name: "@xnoxs/flux-lang",
7166
- version: "3.3.0",
7166
+ version: "3.3.2",
7167
7167
  description: "Flux \u2014 A modern language that transpiles to JavaScript. Python-clean syntax, TypeScript-level safety, Rust-inspired pattern matching.",
7168
7168
  main: "dist/flux.cjs.js",
7169
7169
  module: "dist/flux.esm.js",
@@ -8502,6 +8502,7 @@ function showHelp() {
8502
8502
  console.log(clr(C.bold, "OPTIONS:"));
8503
8503
  console.log(` ${clr(C.yellow, "--out, -o <file>")} Output file name`);
8504
8504
  console.log(` ${clr(C.yellow, "--sourcemap, -m")} Generate source map (.js.map)`);
8505
+ console.log(` ${clr(C.yellow, "--watch, -w")} Watch mode (re-run on save)`);
8505
8506
  console.log(` ${clr(C.yellow, "--stdout")} Print output to terminal`);
8506
8507
  console.log(` ${clr(C.yellow, "--no-color")} Disable colors`);
8507
8508
  console.log();
@@ -8807,7 +8808,8 @@ function cmdRun(filePath, opts) {
8807
8808
  const { source, abs } = readFluxFile(filePath);
8808
8809
  const result = transpile(source, {
8809
8810
  jsxTarget: opts && opts.jsxTarget,
8810
- mangle: opts && opts.mangle
8811
+ mangle: false
8812
+ // never mangle in run mode — code is executed directly
8811
8813
  });
8812
8814
  if (!result.success) {
8813
8815
  console.error(clr(C.red, `
@@ -8832,8 +8834,8 @@ function cmdRun(filePath, opts) {
8832
8834
  }
8833
8835
  }
8834
8836
  }
8835
- function cmdCheck(filePath) {
8836
- const { source, abs } = readFluxFile(filePath);
8837
+ function runCheck(abs) {
8838
+ const source = fs.readFileSync(abs, "utf8");
8837
8839
  const baseName = path.basename(abs);
8838
8840
  const result = transpile(source, { check: true, typecheck: true });
8839
8841
  if (!result.success) {
@@ -8842,15 +8844,15 @@ function cmdCheck(filePath) {
8842
8844
  console.error(clr(C.red, `
8843
8845
  \u2717 ${baseName}: ${n} ${kind} error${n > 1 ? "s" : ""}`));
8844
8846
  printErrors(result.errors, source, abs);
8845
- process.exit(1);
8847
+ return { ok: false, typeErrors: 0, warnings: 0 };
8846
8848
  }
8847
- let exitCode = 0;
8849
+ let ok = true;
8848
8850
  const typeErrors = result.typeErrors || [];
8849
8851
  if (typeErrors.length > 0) {
8850
8852
  console.error(clr(C.red, `
8851
8853
  \u2717 ${baseName}: ${typeErrors.length} type error(s)`));
8852
8854
  printErrors(typeErrors, source, abs);
8853
- exitCode = 1;
8855
+ ok = false;
8854
8856
  }
8855
8857
  const warnings = [...result.typeWarnings || []];
8856
8858
  for (const w of warnings) {
@@ -8866,7 +8868,7 @@ function cmdCheck(filePath) {
8866
8868
  const tw = typeErrors.length;
8867
8869
  const ww = warnings.length;
8868
8870
  console.log();
8869
- if (exitCode === 0) {
8871
+ if (ok) {
8870
8872
  console.log(
8871
8873
  clr(C.green, `\u2713 ${baseName} \u2014 no errors`) + (ww > 0 ? clr(C.yellow, ` (${ww} warning${ww > 1 ? "s" : ""})`) : "")
8872
8874
  );
@@ -8875,7 +8877,45 @@ function cmdCheck(filePath) {
8875
8877
  }
8876
8878
  console.log(clr(C.gray, ` Functions: ${fns} | Classes: ${cls} | JS output: ${lines} lines`));
8877
8879
  console.log();
8878
- if (exitCode !== 0) process.exit(exitCode);
8880
+ return { ok, typeErrors: tw, warnings: ww };
8881
+ }
8882
+ function cmdCheck(filePath, opts) {
8883
+ const abs = path.resolve(filePath);
8884
+ const baseName = path.basename(abs);
8885
+ if (!fs.existsSync(abs)) {
8886
+ console.error(clr(C.red, `[Error] File not found: ${abs}`));
8887
+ process.exit(1);
8888
+ }
8889
+ if (!opts || !opts.watch) {
8890
+ const { ok } = runCheck(abs);
8891
+ if (!ok) process.exit(1);
8892
+ return;
8893
+ }
8894
+ const CLEAR = "\x1B[2J\x1B[H";
8895
+ const HEADER = clr(C.cyan, `
8896
+ \u{1F441} flux check --watch: ${baseName}
8897
+ `);
8898
+ function doCheck() {
8899
+ if (!noColor) process.stdout.write(CLEAR);
8900
+ console.log(HEADER);
8901
+ const ts = (/* @__PURE__ */ new Date()).toLocaleTimeString();
8902
+ console.log(clr(C.gray, ` Last check: ${ts}`));
8903
+ console.log();
8904
+ try {
8905
+ runCheck(abs);
8906
+ } catch (e) {
8907
+ console.error(clr(C.red, `[Error] ${e.message}`));
8908
+ }
8909
+ console.log(clr(C.gray, ` Watching for changes\u2026 (Ctrl+C to exit)`));
8910
+ }
8911
+ doCheck();
8912
+ let debounce = null;
8913
+ fs.watch(abs, { persistent: true }, (event) => {
8914
+ if (event === "change") {
8915
+ clearTimeout(debounce);
8916
+ debounce = setTimeout(doCheck, 80);
8917
+ }
8918
+ });
8879
8919
  }
8880
8920
  function cmdLint(filePath) {
8881
8921
  const { source, abs } = readFluxFile(filePath);
@@ -9556,7 +9596,7 @@ function parseArgs(argv) {
9556
9596
  const args = argv.slice(2);
9557
9597
  const cmd = args[0];
9558
9598
  const file = args[1] && !args[1].startsWith("-") ? args[1] : null;
9559
- const opts = { stdout: false, out: null, sourcemap: void 0, mangle: void 0, jsxTarget: void 0 };
9599
+ const opts = { stdout: false, out: null, sourcemap: void 0, mangle: void 0, jsxTarget: void 0, watch: false };
9560
9600
  const publishOpts = {
9561
9601
  bump: "patch",
9562
9602
  ver: null,
@@ -9575,6 +9615,7 @@ function parseArgs(argv) {
9575
9615
  if (args[i] === "--no-color") process.env.NO_COLOR = "1";
9576
9616
  if ((args[i] === "--jsx-target" || args[i] === "--jsxTarget") && args[i + 1])
9577
9617
  opts.jsxTarget = args[++i];
9618
+ if (args[i] === "--watch" || args[i] === "-w") opts.watch = true;
9578
9619
  if (args[i] === "--patch") publishOpts.bump = "patch";
9579
9620
  if (args[i] === "--minor") publishOpts.bump = "minor";
9580
9621
  if (args[i] === "--major") publishOpts.bump = "major";
@@ -9629,7 +9670,7 @@ function main() {
9629
9670
  console.error(clr(C.red, "Specify a file: flux check <file.flux>"));
9630
9671
  process.exit(1);
9631
9672
  }
9632
- cmdCheck(file);
9673
+ cmdCheck(file, finalOpts);
9633
9674
  break;
9634
9675
  }
9635
9676
  case "lint": {
package/dist/flux.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * flux-lang v3.3.0
2
+ * flux-lang v3.3.2
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.0
2
+ * flux-lang v3.3.2
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.0
2
+ * flux-lang v3.3.2
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.0",
3
+ "version": "3.3.2",
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",