@xnoxs/flux-lang 3.3.0 → 3.3.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.
- package/dist/flux-cli.js +51 -11
- package/dist/flux.cjs.js +1 -1
- package/dist/flux.esm.js +1 -1
- package/dist/flux.min.js +1 -1
- package/package.json +1 -1
package/dist/flux-cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*!
|
|
3
|
-
* flux-lang v3.3.
|
|
3
|
+
* flux-lang v3.3.1
|
|
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.
|
|
7166
|
+
version: "3.3.1",
|
|
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();
|
|
@@ -8832,8 +8833,8 @@ function cmdRun(filePath, opts) {
|
|
|
8832
8833
|
}
|
|
8833
8834
|
}
|
|
8834
8835
|
}
|
|
8835
|
-
function
|
|
8836
|
-
const
|
|
8836
|
+
function runCheck(abs) {
|
|
8837
|
+
const source = fs.readFileSync(abs, "utf8");
|
|
8837
8838
|
const baseName = path.basename(abs);
|
|
8838
8839
|
const result = transpile(source, { check: true, typecheck: true });
|
|
8839
8840
|
if (!result.success) {
|
|
@@ -8842,15 +8843,15 @@ function cmdCheck(filePath) {
|
|
|
8842
8843
|
console.error(clr(C.red, `
|
|
8843
8844
|
\u2717 ${baseName}: ${n} ${kind} error${n > 1 ? "s" : ""}`));
|
|
8844
8845
|
printErrors(result.errors, source, abs);
|
|
8845
|
-
|
|
8846
|
+
return { ok: false, typeErrors: 0, warnings: 0 };
|
|
8846
8847
|
}
|
|
8847
|
-
let
|
|
8848
|
+
let ok = true;
|
|
8848
8849
|
const typeErrors = result.typeErrors || [];
|
|
8849
8850
|
if (typeErrors.length > 0) {
|
|
8850
8851
|
console.error(clr(C.red, `
|
|
8851
8852
|
\u2717 ${baseName}: ${typeErrors.length} type error(s)`));
|
|
8852
8853
|
printErrors(typeErrors, source, abs);
|
|
8853
|
-
|
|
8854
|
+
ok = false;
|
|
8854
8855
|
}
|
|
8855
8856
|
const warnings = [...result.typeWarnings || []];
|
|
8856
8857
|
for (const w of warnings) {
|
|
@@ -8866,7 +8867,7 @@ function cmdCheck(filePath) {
|
|
|
8866
8867
|
const tw = typeErrors.length;
|
|
8867
8868
|
const ww = warnings.length;
|
|
8868
8869
|
console.log();
|
|
8869
|
-
if (
|
|
8870
|
+
if (ok) {
|
|
8870
8871
|
console.log(
|
|
8871
8872
|
clr(C.green, `\u2713 ${baseName} \u2014 no errors`) + (ww > 0 ? clr(C.yellow, ` (${ww} warning${ww > 1 ? "s" : ""})`) : "")
|
|
8872
8873
|
);
|
|
@@ -8875,7 +8876,45 @@ function cmdCheck(filePath) {
|
|
|
8875
8876
|
}
|
|
8876
8877
|
console.log(clr(C.gray, ` Functions: ${fns} | Classes: ${cls} | JS output: ${lines} lines`));
|
|
8877
8878
|
console.log();
|
|
8878
|
-
|
|
8879
|
+
return { ok, typeErrors: tw, warnings: ww };
|
|
8880
|
+
}
|
|
8881
|
+
function cmdCheck(filePath, opts) {
|
|
8882
|
+
const abs = path.resolve(filePath);
|
|
8883
|
+
const baseName = path.basename(abs);
|
|
8884
|
+
if (!fs.existsSync(abs)) {
|
|
8885
|
+
console.error(clr(C.red, `[Error] File not found: ${abs}`));
|
|
8886
|
+
process.exit(1);
|
|
8887
|
+
}
|
|
8888
|
+
if (!opts || !opts.watch) {
|
|
8889
|
+
const { ok } = runCheck(abs);
|
|
8890
|
+
if (!ok) process.exit(1);
|
|
8891
|
+
return;
|
|
8892
|
+
}
|
|
8893
|
+
const CLEAR = "\x1B[2J\x1B[H";
|
|
8894
|
+
const HEADER = clr(C.cyan, `
|
|
8895
|
+
\u{1F441} flux check --watch: ${baseName}
|
|
8896
|
+
`);
|
|
8897
|
+
function doCheck() {
|
|
8898
|
+
if (!noColor) process.stdout.write(CLEAR);
|
|
8899
|
+
console.log(HEADER);
|
|
8900
|
+
const ts = (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
8901
|
+
console.log(clr(C.gray, ` Last check: ${ts}`));
|
|
8902
|
+
console.log();
|
|
8903
|
+
try {
|
|
8904
|
+
runCheck(abs);
|
|
8905
|
+
} catch (e) {
|
|
8906
|
+
console.error(clr(C.red, `[Error] ${e.message}`));
|
|
8907
|
+
}
|
|
8908
|
+
console.log(clr(C.gray, ` Watching for changes\u2026 (Ctrl+C to exit)`));
|
|
8909
|
+
}
|
|
8910
|
+
doCheck();
|
|
8911
|
+
let debounce = null;
|
|
8912
|
+
fs.watch(abs, { persistent: true }, (event) => {
|
|
8913
|
+
if (event === "change") {
|
|
8914
|
+
clearTimeout(debounce);
|
|
8915
|
+
debounce = setTimeout(doCheck, 80);
|
|
8916
|
+
}
|
|
8917
|
+
});
|
|
8879
8918
|
}
|
|
8880
8919
|
function cmdLint(filePath) {
|
|
8881
8920
|
const { source, abs } = readFluxFile(filePath);
|
|
@@ -9556,7 +9595,7 @@ function parseArgs(argv) {
|
|
|
9556
9595
|
const args = argv.slice(2);
|
|
9557
9596
|
const cmd = args[0];
|
|
9558
9597
|
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 };
|
|
9598
|
+
const opts = { stdout: false, out: null, sourcemap: void 0, mangle: void 0, jsxTarget: void 0, watch: false };
|
|
9560
9599
|
const publishOpts = {
|
|
9561
9600
|
bump: "patch",
|
|
9562
9601
|
ver: null,
|
|
@@ -9575,6 +9614,7 @@ function parseArgs(argv) {
|
|
|
9575
9614
|
if (args[i] === "--no-color") process.env.NO_COLOR = "1";
|
|
9576
9615
|
if ((args[i] === "--jsx-target" || args[i] === "--jsxTarget") && args[i + 1])
|
|
9577
9616
|
opts.jsxTarget = args[++i];
|
|
9617
|
+
if (args[i] === "--watch" || args[i] === "-w") opts.watch = true;
|
|
9578
9618
|
if (args[i] === "--patch") publishOpts.bump = "patch";
|
|
9579
9619
|
if (args[i] === "--minor") publishOpts.bump = "minor";
|
|
9580
9620
|
if (args[i] === "--major") publishOpts.bump = "major";
|
|
@@ -9629,7 +9669,7 @@ function main() {
|
|
|
9629
9669
|
console.error(clr(C.red, "Specify a file: flux check <file.flux>"));
|
|
9630
9670
|
process.exit(1);
|
|
9631
9671
|
}
|
|
9632
|
-
cmdCheck(file);
|
|
9672
|
+
cmdCheck(file, finalOpts);
|
|
9633
9673
|
break;
|
|
9634
9674
|
}
|
|
9635
9675
|
case "lint": {
|
package/dist/flux.cjs.js
CHANGED
package/dist/flux.esm.js
CHANGED
package/dist/flux.min.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xnoxs/flux-lang",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
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",
|