@xnoxs/flux-lang 4.0.4 → 4.0.5

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,4 +1,5 @@
1
- /*! flux-lang v4.0.4 - MIT License */
1
+ /*! flux-lang v4.0.5 - MIT License */
2
+ #!/usr/bin/env node
2
3
  "use strict";
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __commonJS = (cb, mod) => function __require() {
@@ -9,9 +10,9 @@ var __commonJS = (cb, mod) => function __require() {
9
10
  }
10
11
  };
11
12
 
12
- // src/self/lexer.js
13
+ // ../../../tmp/flux-publish-v5/src/self/lexer.js
13
14
  var require_lexer = __commonJS({
14
- "src/self/lexer.js"(exports2, module2) {
15
+ "../../../tmp/flux-publish-v5/src/self/lexer.js"(exports2, module2) {
15
16
  var T = { NUMBER: "NUMBER", STRING: "STRING", BOOL: "BOOL", NULL: "NULL", IDENT: "IDENT", VAR: "VAR", VAL: "VAL", FN: "FN", RETURN: "RETURN", IF: "IF", ELSE: "ELSE", FOR: "FOR", IN: "IN", WHILE: "WHILE", BREAK: "BREAK", CONTINUE: "CONTINUE", DO: "DO", CLASS: "CLASS", EXTENDS: "EXTENDS", SELF: "SELF", NEW: "NEW", INTERFACE: "INTERFACE", IMPLEMENTS: "IMPLEMENTS", PRIVATE: "PRIVATE", PUBLIC: "PUBLIC", PROTECTED: "PROTECTED", READONLY: "READONLY", STATIC: "STATIC", ABSTRACT: "ABSTRACT", OVERRIDE: "OVERRIDE", MATCH: "MATCH", WHEN: "WHEN", IMPORT: "IMPORT", EXPORT: "EXPORT", FROM: "FROM", AS: "AS", DEFAULT: "DEFAULT", AND: "AND", OR: "OR", NOT: "NOT", ASYNC: "ASYNC", AWAIT: "AWAIT", TRY: "TRY", CATCH: "CATCH", FINALLY: "FINALLY", THROW: "THROW", TYPEOF: "TYPEOF", INSTANCEOF: "INSTANCEOF", TYPE: "TYPE", ENUM: "ENUM", SATISFIES: "SATISFIES", IS: "IS", CONST: "CONST", PLUS: "PLUS", MINUS: "MINUS", STAR: "STAR", SLASH: "SLASH", PERCENT: "PERCENT", REGEX: "REGEX", STARSTAR: "STARSTAR", EQ: "EQ", EQEQ: "EQEQ", NEQ: "NEQ", EQEQEQ: "EQEQEQ", NEQEQ: "NEQEQ", LT: "LT", LTE: "LTE", GT: "GT", GTE: "GTE", PLUSEQ: "PLUSEQ", MINUSEQ: "MINUSEQ", STAREQ: "STAREQ", SLASHEQ: "SLASHEQ", PERCENTEQ: "PERCENTEQ", PLUSPLUS: "PLUSPLUS", MINUSMINUS: "MINUSMINUS", AMPERSAND: "AMPERSAND", ANDAND: "ANDAND", PIPEB: "PIPEB", OROR: "OROR", CARET: "CARET", TILDE: "TILDE", LSHIFT: "LSHIFT", RSHIFT: "RSHIFT", ARROW: "ARROW", FATARROW: "FATARROW", PIPE: "PIPE", DOTDOT: "DOTDOT", DOTDOTDOT: "DOTDOTDOT", WILDCARD: "WILDCARD", NULLISH: "NULLISH", QUESTIONDOT: "QUESTIONDOT", BANG: "BANG", AT: "AT", LPAREN: "LPAREN", RPAREN: "RPAREN", LBRACKET: "LBRACKET", RBRACKET: "RBRACKET", LBRACE: "LBRACE", RBRACE: "RBRACE", COMMA: "COMMA", DOT: "DOT", COLON: "COLON", QUESTION: "QUESTION", NEWLINE: "NEWLINE", INDENT: "INDENT", DEDENT: "DEDENT", EOF: "EOF" };
16
17
  module2.exports.T = T;
17
18
  var TokenType = T;
@@ -617,9 +618,9 @@ var require_lexer = __commonJS({
617
618
  }
618
619
  });
619
620
 
620
- // src/self/parser.js
621
+ // ../../../tmp/flux-publish-v5/src/self/parser.js
621
622
  var require_parser = __commonJS({
622
- "src/self/parser.js"(exports2, module2) {
623
+ "../../../tmp/flux-publish-v5/src/self/parser.js"(exports2, module2) {
623
624
  var { T } = require_lexer();
624
625
  function makeParseError(msg, tok) {
625
626
  const line = (tok == null ? void 0 : tok.line) ?? "?";
@@ -2129,9 +2130,9 @@ var require_parser = __commonJS({
2129
2130
  }
2130
2131
  });
2131
2132
 
2132
- // src/self/codegen.js
2133
+ // ../../../tmp/flux-publish-v5/src/self/codegen.js
2133
2134
  var require_codegen = __commonJS({
2134
- "src/self/codegen.js"(exports2, module2) {
2135
+ "../../../tmp/flux-publish-v5/src/self/codegen.js"(exports2, module2) {
2135
2136
  var { Lexer, lexerize, T } = require_lexer();
2136
2137
  var { Parser, makeParser } = require_parser();
2137
2138
  function _a(_e) {
@@ -2840,9 +2841,9 @@ var require_codegen = __commonJS({
2840
2841
  }
2841
2842
  });
2842
2843
 
2843
- // src/self/css-preprocessor.js
2844
+ // ../../../tmp/flux-publish-v5/src/self/css-preprocessor.js
2844
2845
  var require_css_preprocessor = __commonJS({
2845
- "src/self/css-preprocessor.js"(exports2, module2) {
2846
+ "../../../tmp/flux-publish-v5/src/self/css-preprocessor.js"(exports2, module2) {
2846
2847
  var CSS_PROP_MAP = { bg: "background", fg: "color", p: "padding", px: "padding-inline", py: "padding-block", pt: "padding-top", pb: "padding-bottom", pl: "padding-left", pr: "padding-right", m: "margin", mx: "margin-inline", my: "margin-block", mt: "margin-top", mb: "margin-bottom", ml: "margin-left", mr: "margin-right", radius: "border-radius", w: "width", h: "height", "min-w": "min-width", "max-w": "max-width", "min-h": "min-height", "max-h": "max-height", gap: "gap", "col-gap": "column-gap", "row-gap": "row-gap", text: "font-size", font: "font-family", weight: "font-weight", tracking: "letter-spacing", leading: "line-height", shadow: "box-shadow", opacity: "opacity", border: "border", outline: "outline", transition: "transition", cursor: "cursor", overflow: "overflow", "overflow-x": "overflow-x", "overflow-y": "overflow-y", z: "z-index", transform: "transform", content: "content", resize: "resize", appearance: "appearance", "object-fit": "object-fit", "accent-color": "accent-color", direction: "flex-direction", wrap: "flex-wrap", align: "align-items", justify: "justify-content", "align-self": "align-self", "justify-self": "justify-self", grow: "flex-grow", shrink: "flex-shrink", basis: "flex-basis", order: "order", cols: "grid-template-columns", rows: "grid-template-rows", "col-span": "grid-column", "row-span": "grid-row", "place-items": "place-items", "place-content": "place-content", "list-style": "list-style", "text-align": "text-align", decoration: "text-decoration", "text-transform": "text-transform", "white-space": "white-space", "word-break": "word-break", "user-select": "user-select", "pointer-events": "pointer-events", "vertical-align": "vertical-align", backdrop: "backdrop-filter", filter: "filter", clip: "clip-path", animation: "animation", position: "position", top: "top", right: "right", bottom: "bottom", left: "left", inset: "inset", color: "color", background: "background" };
2847
2848
  module2.exports.CSS_PROP_MAP = CSS_PROP_MAP;
2848
2849
  var CSS_BOOL_MAP = { flex: "display: flex", grid: "display: grid", block: "display: block", inline: "display: inline", "inline-flex": "display: inline-flex", "inline-block": "display: inline-block", "inline-grid": "display: inline-grid", bold: "font-weight: 700", italic: "font-style: italic", relative: "position: relative", absolute: "position: absolute", fixed: "position: fixed", sticky: "position: sticky", hidden: "display: none", pointer: "cursor: pointer", underline: "text-decoration: underline", "line-through": "text-decoration: line-through", capitalize: "text-transform: capitalize", uppercase: "text-transform: uppercase", lowercase: "text-transform: lowercase", truncate: "overflow: hidden; text-overflow: ellipsis; white-space: nowrap", "select-none": "user-select: none", "no-wrap": "white-space: nowrap", "no-list": "list-style: none", "no-outline": "outline: none", "no-border": "border: none", "no-bg": "background: transparent", "no-padding": "padding: 0", "no-margin": "margin: 0", "no-resize": "resize: none", center: "text-align: center", "items-center": "align-items: center", "justify-center": "justify-content: center", "place-center": "place-items: center", "flex-col": "flex-direction: column", "flex-row": "flex-direction: row", "flex-wrap": "flex-wrap: wrap", "flex-1": "flex: 1", "w-full": "width: 100%", "h-full": "height: 100%", "w-screen": "width: 100vw", "h-screen": "height: 100vh", "box-border": "box-sizing: border-box" };
@@ -3201,9 +3202,9 @@ var require_css_preprocessor = __commonJS({
3201
3202
  }
3202
3203
  });
3203
3204
 
3204
- // src/self/jsx.js
3205
+ // ../../../tmp/flux-publish-v5/src/self/jsx.js
3205
3206
  var require_jsx = __commonJS({
3206
- "src/self/jsx.js"(exports2, module2) {
3207
+ "../../../tmp/flux-publish-v5/src/self/jsx.js"(exports2, module2) {
3207
3208
  "use strict";
3208
3209
  var JSX_STYLE_VALUE_PROPS = { bg: (v) => "background:" + v, fg: (v) => "color:" + v, color: (v) => "color:" + v, p: (v) => "padding:" + v, px: (v) => "paddingLeft:" + v + ",paddingRight:" + v, py: (v) => "paddingTop:" + v + ",paddingBottom:" + v, pt: (v) => "paddingTop:" + v, pb: (v) => "paddingBottom:" + v, pl: (v) => "paddingLeft:" + v, pr: (v) => "paddingRight:" + v, m: (v) => "margin:" + v, mx: (v) => "marginLeft:" + v + ",marginRight:" + v, my: (v) => "marginTop:" + v + ",marginBottom:" + v, mt: (v) => "marginTop:" + v, mb: (v) => "marginBottom:" + v, ml: (v) => "marginLeft:" + v, mr: (v) => "marginRight:" + v, radius: (v) => "borderRadius:" + v, w: (v) => "width:" + v, h: (v) => "height:" + v, "min-w": (v) => "minWidth:" + v, "max-w": (v) => "maxWidth:" + v, "min-h": (v) => "minHeight:" + v, "max-h": (v) => "maxHeight:" + v, gap: (v) => "gap:" + v, "col-gap": (v) => "columnGap:" + v, "row-gap": (v) => "rowGap:" + v, text: (v) => "fontSize:" + v, font: (v) => "fontFamily:" + v, weight: (v) => "fontWeight:" + v, tracking: (v) => "letterSpacing:" + v, leading: (v) => "lineHeight:" + v, shadow: (v) => "boxShadow:" + v, opacity: (v) => "opacity:" + v, border: (v) => "border:" + v, outline: (v) => "outline:" + v, transition: (v) => "transition:" + v, cursor: (v) => "cursor:" + v, overflow: (v) => "overflow:" + v, z: (v) => "zIndex:" + v, transform: (v) => "transform:" + v, direction: (v) => "flexDirection:" + v, align: (v) => "alignItems:" + v, justify: (v) => "justifyContent:" + v, "align-self": (v) => "alignSelf:" + v, "place-items": (v) => "placeItems:" + v, grow: (v) => "flexGrow:" + v, shrink: (v) => "flexShrink:" + v, basis: (v) => "flexBasis:" + v, cols: (v) => "gridTemplateColumns:" + v, rows: (v) => "gridTemplateRows:" + v, inset: (v) => "inset:" + v, top: (v) => "top:" + v, right: (v) => "right:" + v, bottom: (v) => "bottom:" + v, left: (v) => "left:" + v, "object-fit": (v) => "objectFit:" + v, "line-height": (v) => "lineHeight:" + v, "text-align": (v) => "textAlign:" + v, decoration: (v) => "textDecoration:" + v, clip: (v) => "clipPath:" + v, filter: (v) => "filter:" + v, backdrop: (v) => "backdropFilter:" + v, animation: (v) => "animation:" + v };
3209
3210
  var JSX_STYLE_BOOL_PROPS = { flex: 'display:"flex"', grid: 'display:"grid"', block: 'display:"block"', "inline-flex": 'display:"inline-flex"', "inline-block": 'display:"inline-block"', bold: "fontWeight:700", italic: 'fontStyle:"italic"', underline: 'textDecoration:"underline"', pointer: 'cursor:"pointer"', hidden: 'display:"none"', relative: 'position:"relative"', absolute: 'position:"absolute"', fixed: 'position:"fixed"', sticky: 'position:"sticky"', "flex-col": 'flexDirection:"column"', "flex-row": 'flexDirection:"row"', "flex-wrap": 'flexWrap:"wrap"', "flex-1": "flex:1", "w-full": 'width:"100%"', "h-full": 'height:"100%"', center: 'textAlign:"center"', truncate: 'overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"', "select-none": 'userSelect:"none"', "no-wrap": 'whiteSpace:"nowrap"', "no-list": 'listStyle:"none"', "no-outline": 'outline:"none"', "no-border": 'border:"none"', "box-border": 'boxSizing:"border-box"' };
@@ -3552,9 +3553,9 @@ var require_jsx = __commonJS({
3552
3553
  }
3553
3554
  });
3554
3555
 
3555
- // src/self/checker.js
3556
+ // ../../../tmp/flux-publish-v5/src/self/checker.js
3556
3557
  var require_checker = __commonJS({
3557
- "src/self/checker.js"(exports2, module2) {
3558
+ "../../../tmp/flux-publish-v5/src/self/checker.js"(exports2, module2) {
3558
3559
  "use strict";
3559
3560
  var CheckError = class {
3560
3561
  constructor(message, loc, hint, name, line, col) {
@@ -3843,9 +3844,9 @@ var require_checker = __commonJS({
3843
3844
  }
3844
3845
  });
3845
3846
 
3846
- // src/self/type-checker.js
3847
+ // ../../../tmp/flux-publish-v5/src/self/type-checker.js
3847
3848
  var require_type_checker = __commonJS({
3848
- "src/self/type-checker.js"(exports2, module2) {
3849
+ "../../../tmp/flux-publish-v5/src/self/type-checker.js"(exports2, module2) {
3849
3850
  var T_ANY = Object.freeze({ kind: "any" });
3850
3851
  module2.exports.T_ANY = T_ANY;
3851
3852
  var T_UNKNOWN = Object.freeze({ kind: "unknown" });
@@ -4891,9 +4892,9 @@ var require_type_checker = __commonJS({
4891
4892
  }
4892
4893
  });
4893
4894
 
4894
- // src/self/transpiler.js
4895
+ // ../../../tmp/flux-publish-v5/src/self/transpiler.js
4895
4896
  var require_transpiler = __commonJS({
4896
- "src/self/transpiler.js"(exports2, module2) {
4897
+ "../../../tmp/flux-publish-v5/src/self/transpiler.js"(exports2, module2) {
4897
4898
  "use strict";
4898
4899
  var { Lexer, lexerize, T } = require_lexer();
4899
4900
  var { Parser, makeParser } = require_parser();
@@ -4987,9 +4988,9 @@ var require_transpiler = __commonJS({
4987
4988
  }
4988
4989
  });
4989
4990
 
4990
- // src/self/bundler.js
4991
+ // ../../../tmp/flux-publish-v5/src/self/bundler.js
4991
4992
  var require_bundler = __commonJS({
4992
- "src/self/bundler.js"(exports2, module2) {
4993
+ "../../../tmp/flux-publish-v5/src/self/bundler.js"(exports2, module2) {
4993
4994
  "use strict";
4994
4995
  var Fs2 = require("fs");
4995
4996
  var Path2 = require("path");
@@ -5164,9 +5165,9 @@ var require_bundler = __commonJS({
5164
5165
  }
5165
5166
  });
5166
5167
 
5167
- // src/self/formatter.js
5168
+ // ../../../tmp/flux-publish-v5/src/self/formatter.js
5168
5169
  var require_formatter = __commonJS({
5169
- "src/self/formatter.js"(exports2, module2) {
5170
+ "../../../tmp/flux-publish-v5/src/self/formatter.js"(exports2, module2) {
5170
5171
  function normalizeOperators(line) {
5171
5172
  if ((line.match(/:/g) ?? []).length > 2) {
5172
5173
  return line;
@@ -5273,9 +5274,9 @@ var require_formatter = __commonJS({
5273
5274
  }
5274
5275
  });
5275
5276
 
5276
- // src/self/linter.js
5277
+ // ../../../tmp/flux-publish-v5/src/self/linter.js
5277
5278
  var require_linter = __commonJS({
5278
- "src/self/linter.js"(exports2, module2) {
5279
+ "../../../tmp/flux-publish-v5/src/self/linter.js"(exports2, module2) {
5279
5280
  var { lexerize } = require_lexer();
5280
5281
  var { makeParser } = require_parser();
5281
5282
  var BUILTIN_NAMES = /* @__PURE__ */ new Set(["self", "this", "arguments", "exports", "module", "require", "__dirname", "__filename", "process", "console", "Math", "JSON", "Object", "Array", "String", "Number", "Boolean", "Promise", "Error", "Symbol", "Map", "Set", "WeakMap", "WeakSet", "Proxy", "Reflect", "undefined", "null", "true", "false", "NaN", "Infinity", "parseInt", "parseFloat", "isNaN", "isFinite", "setTimeout", "clearTimeout", "setInterval", "clearInterval", "fetch", "globalThis", "print", "truncate", "range", "sum", "first", "last", "zip", "flatten", "groupBy", "unique", "sortBy", "chunk"]);
@@ -6037,9 +6038,9 @@ var require_linter = __commonJS({
6037
6038
  }
6038
6039
  });
6039
6040
 
6040
- // src/self/test-runner.js
6041
+ // ../../../tmp/flux-publish-v5/src/self/test-runner.js
6041
6042
  var require_test_runner = __commonJS({
6042
- "src/self/test-runner.js"(exports2, module2) {
6043
+ "../../../tmp/flux-publish-v5/src/self/test-runner.js"(exports2, module2) {
6043
6044
  var Fs2 = require("fs");
6044
6045
  var Path2 = require("path");
6045
6046
  var Os2 = require("os");
@@ -6204,9 +6205,9 @@ function __runTest(name, fn) {
6204
6205
  }
6205
6206
  });
6206
6207
 
6207
- // src/self/config.js
6208
+ // ../../../tmp/flux-publish-v5/src/self/config.js
6208
6209
  var require_config = __commonJS({
6209
- "src/self/config.js"(exports2, module2) {
6210
+ "../../../tmp/flux-publish-v5/src/self/config.js"(exports2, module2) {
6210
6211
  "use strict";
6211
6212
  var Fs2 = require("fs");
6212
6213
  var Path2 = require("path");
@@ -6303,9 +6304,9 @@ var require_config = __commonJS({
6303
6304
  }
6304
6305
  });
6305
6306
 
6306
- // src/self/pkg.js
6307
+ // ../../../tmp/flux-publish-v5/src/self/pkg.js
6307
6308
  var require_pkg = __commonJS({
6308
- "src/self/pkg.js"(exports2, module2) {
6309
+ "../../../tmp/flux-publish-v5/src/self/pkg.js"(exports2, module2) {
6309
6310
  "use strict";
6310
6311
  var Fs2 = require("fs");
6311
6312
  var Path2 = require("path");
@@ -6314,7 +6315,7 @@ var require_pkg = __commonJS({
6314
6315
  var Os2 = require("os");
6315
6316
  var { readPackage } = require_config();
6316
6317
  var REGISTRY_URL = "https://registry.npmjs.org";
6317
- var ESC = "\x1B";
6318
+ var ESC = "\\u001b";
6318
6319
  var C2 = { reset: ESC + "[0m", bold: ESC + "[1m", dim: ESC + "[2m", red: ESC + "[31m", green: ESC + "[32m", yellow: ESC + "[33m", blue: ESC + "[34m", cyan: ESC + "[36m", gray: ESC + "[90m" };
6319
6320
  function clr2(c, s) {
6320
6321
  return c + s + C2.reset;
@@ -6336,7 +6337,7 @@ var require_pkg = __commonJS({
6336
6337
  }
6337
6338
  let frame = 0;
6338
6339
  function tick() {
6339
- stdout.write("\r" + clr2(C2.cyan, SPIN_FRAMES[frame % SPIN_FRAMES.length]) + " " + label + " ");
6340
+ stdout.write("\\r" + clr2(C2.cyan, SPIN_FRAMES[frame % SPIN_FRAMES.length]) + " " + label + " ");
6340
6341
  frame = frame + 1;
6341
6342
  }
6342
6343
  const timer = setInterval(tick, 80);
@@ -6347,7 +6348,7 @@ var require_pkg = __commonJS({
6347
6348
  return;
6348
6349
  }
6349
6350
  clearInterval(timer);
6350
- stdout.write("\r" + ESC + "[2K");
6351
+ stdout.write("\\r" + ESC + "[2K");
6351
6352
  }
6352
6353
  async function fetchJson(url) {
6353
6354
  const mod = url.startsWith("https") ? Https : Http;
@@ -6629,7 +6630,7 @@ var require_pkg = __commonJS({
6629
6630
  }
6630
6631
  });
6631
6632
 
6632
- // src/self/cli.js
6633
+ // ../../../tmp/flux-publish-v5/src/self/cli.js
6633
6634
  var Fs = require("fs");
6634
6635
  var Path = require("path");
6635
6636
  var Os = require("os");
@@ -6642,7 +6643,7 @@ var { loadConfig } = require_config();
6642
6643
  var { cmdAdd, cmdRemove, cmdInstall, cmdList, cmdSearch, cmdInfo, cmdPublish } = require_pkg();
6643
6644
  var VERSION = FLUX_VERSION ?? "3.0.0";
6644
6645
  var STAGE = FLUX_STAGE ?? "self-hosted";
6645
- var C = { reset: "\x1B[0m", bold: "\x1B[1m", dim: "\x1B[2m", red: "\x1B[31m", green: "\x1B[32m", yellow: "\x1B[33m", blue: "\x1B[34m", cyan: "\x1B[36m", white: "\x1B[37m", gray: "\x1B[90m", magenta: "\x1B[35m" };
6646
+ var C = { reset: "\\u001b[0m", bold: "\\u001b[1m", dim: "\\u001b[2m", red: "\\u001b[31m", green: "\\u001b[32m", yellow: "\\u001b[33m", blue: "\\u001b[34m", cyan: "\\u001b[36m", white: "\\u001b[37m", gray: "\\u001b[90m", magenta: "\\u001b[35m" };
6646
6647
  var noColor = process.env.NO_COLOR || !process.stdout.isTTY;
6647
6648
  function clr(c, s) {
6648
6649
  return noColor ? s : c + s + C.reset;
@@ -6682,31 +6683,19 @@ function showHelp() {
6682
6683
  console.log(" flux <command> [options]\n");
6683
6684
  console.log(bold("COMPILER:"));
6684
6685
  const compilerCmds = [["compile <file.flux>", "Compile .flux \u2192 .js"], ["bundle <entry.flux>", "Bundle multi-file project into one .js"], ["run <file.flux>", "Compile and run a single-file script"], ["watch <file.flux>", "Watch for changes, auto-compile"], ["check <file.flux>", "Type-check and static analysis"]];
6685
- for (const __item__ of compilerCmds) {
6686
- const [cmd, desc] = __item__;
6687
- console.log(" " + green(("flux " + cmd).padEnd(36)) + " " + gray(desc));
6688
- }
6686
+ compilerCmds.forEach((pair) => console.log(" " + green(("flux " + pair[0]).padEnd(36)) + " " + gray(pair[1])));
6689
6687
  console.log();
6690
6688
  console.log(bold("TOOLING:"));
6691
6689
  const toolCmds = [["lint <file.flux>", "Full lint: types + style + immutability"], ["fmt <file.flux>", "Format source code in-place"], ["test [dir]", "Run *.test.flux files"], ["repl", "Interactive REPL mode"], ["tokens <file.flux>", "Show lexer token list"], ["ast <file.flux>", "Show Abstract Syntax Tree (JSON)"]];
6692
- for (const __item__ of toolCmds) {
6693
- const [cmd, desc] = __item__;
6694
- console.log(" " + green(("flux " + cmd).padEnd(36)) + " " + gray(desc));
6695
- }
6690
+ toolCmds.forEach((pair) => console.log(" " + green(("flux " + pair[0]).padEnd(36)) + " " + gray(pair[1])));
6696
6691
  console.log();
6697
6692
  console.log(bold("PACKAGE MANAGER:"));
6698
6693
  const pkgCmds = [["init [name] [--template]", "Scaffold a new Flux project"], ["add <pkg[@version]>", "Add a dependency (npm install --save)"], ["remove <pkg>", "Remove a dependency (npm uninstall)"], ["install", "Install all dependencies (npm install)"], ["list", "List installed packages"], ["search <query>", "Search the npm registry"], ["info <pkg>", "Show package details"], ["publish", "Publish package to npm registry"]];
6699
- for (const __item__ of pkgCmds) {
6700
- const [cmd, desc] = __item__;
6701
- console.log(" " + cyan(("flux " + cmd).padEnd(36)) + " " + gray(desc));
6702
- }
6694
+ pkgCmds.forEach((pair) => console.log(" " + cyan(("flux " + pair[0]).padEnd(36)) + " " + gray(pair[1])));
6703
6695
  console.log();
6704
6696
  console.log(bold("SELF-HOSTED:"));
6705
6697
  const selfCmds = [["self-hosted", "Show self-hosted compiler status"], ["self-hosted build", "Bootstrap: compile compiler with itself"], ["self-hosted verify", "Verify self-hosted output matches stage-0"]];
6706
- for (const __item__ of selfCmds) {
6707
- const [cmd, desc] = __item__;
6708
- console.log(" " + yellow(("flux " + cmd).padEnd(36)) + " " + gray(desc));
6709
- }
6698
+ selfCmds.forEach((pair) => console.log(" " + yellow(("flux " + pair[0]).padEnd(36)) + " " + gray(pair[1])));
6710
6699
  console.log();
6711
6700
  console.log(bold("OPTIONS:"));
6712
6701
  console.log(" " + yellow("--out, -o <file> ") + " Output file");
@@ -7379,63 +7368,65 @@ function main() {
7379
7368
  const { positional, opts } = parseArgs(process.argv);
7380
7369
  const cmd = positional[0] ?? "help";
7381
7370
  if (cmd === "compile") {
7382
- return cmdCompile(positional[1], opts);
7371
+ cmdCompile(positional[1], opts);
7383
7372
  } else if (cmd === "run") {
7384
- return cmdRun(positional[1], opts);
7373
+ cmdRun(positional[1], opts);
7385
7374
  } else if (cmd === "check") {
7386
- return cmdCheck(positional.slice(1), opts);
7375
+ cmdCheck(positional.slice(1), opts);
7387
7376
  } else if (cmd === "fmt") {
7388
- return cmdFmt(positional.slice(1), opts);
7377
+ cmdFmt(positional.slice(1), opts);
7389
7378
  } else if (cmd === "format") {
7390
- return cmdFmt(positional.slice(1), opts);
7379
+ cmdFmt(positional.slice(1), opts);
7391
7380
  } else if (cmd === "lint") {
7392
- return cmdLint(positional.slice(1), opts);
7381
+ cmdLint(positional.slice(1), opts);
7393
7382
  } else if (cmd === "bundle") {
7394
- return cmdBundle(positional[1], opts);
7383
+ cmdBundle(positional[1], opts);
7395
7384
  } else if (cmd === "watch") {
7396
- return cmdWatch(positional[1], opts);
7385
+ cmdWatch(positional[1], opts);
7397
7386
  } else if (cmd === "tokens") {
7398
- return cmdTokens(positional[1], opts);
7387
+ cmdTokens(positional[1], opts);
7399
7388
  } else if (cmd === "ast") {
7400
- return cmdAst(positional[1], opts);
7389
+ cmdAst(positional[1], opts);
7401
7390
  } else if (cmd === "repl") {
7402
- return cmdRepl(opts);
7391
+ cmdRepl(opts);
7392
+ } else if (cmd === "test") {
7393
+ runTests(positional.slice(1), opts);
7403
7394
  } else if (cmd === "init") {
7404
- return cmdInit(positional[1], opts);
7395
+ cmdInit(positional[1], opts);
7405
7396
  } else if (cmd === "add") {
7406
- return cmdAdd(positional.slice(1), opts);
7397
+ cmdAdd(positional.slice(1), opts);
7407
7398
  } else if (cmd === "remove") {
7408
- return cmdRemove(positional.slice(1), opts);
7399
+ cmdRemove(positional.slice(1), opts);
7409
7400
  } else if (cmd === "rm") {
7410
- return cmdRemove(positional.slice(1), opts);
7401
+ cmdRemove(positional.slice(1), opts);
7411
7402
  } else if (cmd === "install") {
7412
- return cmdInstall(opts);
7403
+ cmdInstall(opts);
7413
7404
  } else if (cmd === "i") {
7414
- return cmdInstall(opts);
7405
+ cmdInstall(opts);
7415
7406
  } else if (cmd === "list") {
7416
- return cmdList(opts);
7407
+ cmdList(opts);
7417
7408
  } else if (cmd === "ls") {
7418
- return cmdList(opts);
7409
+ cmdList(opts);
7419
7410
  } else if (cmd === "search") {
7420
- return cmdSearch(positional[1], opts);
7411
+ cmdSearch(positional[1], opts);
7421
7412
  } else if (cmd === "info") {
7422
- return cmdInfo(positional[1], opts);
7413
+ cmdInfo(positional[1], opts);
7423
7414
  } else if (cmd === "publish") {
7424
- return cmdPublish(opts);
7415
+ cmdPublish(opts);
7425
7416
  } else if (cmd === "self-hosted") {
7426
- return cmdSelfHosted(positional[1], opts);
7417
+ cmdSelfHosted(positional[1], opts);
7427
7418
  } else if (cmd === "version") {
7428
- return cmdVersion(opts);
7419
+ cmdVersion(opts);
7429
7420
  } else if (cmd === "-v") {
7430
- return cmdVersion(opts);
7421
+ cmdVersion(opts);
7431
7422
  } else if (cmd === "--version") {
7432
- return cmdVersion(opts);
7423
+ cmdVersion(opts);
7433
7424
  } else if (cmd === "help") {
7434
- return showHelp();
7425
+ showHelp();
7435
7426
  } else if (cmd === "--help") {
7436
- return showHelp();
7427
+ showHelp();
7437
7428
  } else if (cmd === "-h") {
7438
- return showHelp();
7429
+ showHelp();
7439
7430
  } else {
7440
7431
  console.error(red("\u2717 Unknown command: " + cmd));
7441
7432
  console.error(gray(" Run: flux help"));