@xnoxs/flux-lang 4.0.4 → 4.0.6

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,4 @@
1
- /*! flux-lang v4.0.4 - MIT License */
1
+ /*! flux-lang v4.0.6 - MIT License */
2
2
  "use strict";
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __commonJS = (cb, mod) => function __require() {
@@ -9,9 +9,9 @@ var __commonJS = (cb, mod) => function __require() {
9
9
  }
10
10
  };
11
11
 
12
- // src/self/lexer.js
12
+ // ../../../tmp/flux-publish-v5/src/self/lexer.js
13
13
  var require_lexer = __commonJS({
14
- "src/self/lexer.js"(exports2, module2) {
14
+ "../../../tmp/flux-publish-v5/src/self/lexer.js"(exports2, module2) {
15
15
  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
16
  module2.exports.T = T;
17
17
  var TokenType = T;
@@ -617,9 +617,9 @@ var require_lexer = __commonJS({
617
617
  }
618
618
  });
619
619
 
620
- // src/self/parser.js
620
+ // ../../../tmp/flux-publish-v5/src/self/parser.js
621
621
  var require_parser = __commonJS({
622
- "src/self/parser.js"(exports2, module2) {
622
+ "../../../tmp/flux-publish-v5/src/self/parser.js"(exports2, module2) {
623
623
  var { T } = require_lexer();
624
624
  function makeParseError(msg, tok) {
625
625
  const line = (tok == null ? void 0 : tok.line) ?? "?";
@@ -2129,9 +2129,9 @@ var require_parser = __commonJS({
2129
2129
  }
2130
2130
  });
2131
2131
 
2132
- // src/self/codegen.js
2132
+ // ../../../tmp/flux-publish-v5/src/self/codegen.js
2133
2133
  var require_codegen = __commonJS({
2134
- "src/self/codegen.js"(exports2, module2) {
2134
+ "../../../tmp/flux-publish-v5/src/self/codegen.js"(exports2, module2) {
2135
2135
  var { Lexer, lexerize, T } = require_lexer();
2136
2136
  var { Parser, makeParser } = require_parser();
2137
2137
  function _a(_e) {
@@ -2840,9 +2840,9 @@ var require_codegen = __commonJS({
2840
2840
  }
2841
2841
  });
2842
2842
 
2843
- // src/self/css-preprocessor.js
2843
+ // ../../../tmp/flux-publish-v5/src/self/css-preprocessor.js
2844
2844
  var require_css_preprocessor = __commonJS({
2845
- "src/self/css-preprocessor.js"(exports2, module2) {
2845
+ "../../../tmp/flux-publish-v5/src/self/css-preprocessor.js"(exports2, module2) {
2846
2846
  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
2847
  module2.exports.CSS_PROP_MAP = CSS_PROP_MAP;
2848
2848
  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 +3201,9 @@ var require_css_preprocessor = __commonJS({
3201
3201
  }
3202
3202
  });
3203
3203
 
3204
- // src/self/jsx.js
3204
+ // ../../../tmp/flux-publish-v5/src/self/jsx.js
3205
3205
  var require_jsx = __commonJS({
3206
- "src/self/jsx.js"(exports2, module2) {
3206
+ "../../../tmp/flux-publish-v5/src/self/jsx.js"(exports2, module2) {
3207
3207
  "use strict";
3208
3208
  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
3209
  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 +3552,9 @@ var require_jsx = __commonJS({
3552
3552
  }
3553
3553
  });
3554
3554
 
3555
- // src/self/checker.js
3555
+ // ../../../tmp/flux-publish-v5/src/self/checker.js
3556
3556
  var require_checker = __commonJS({
3557
- "src/self/checker.js"(exports2, module2) {
3557
+ "../../../tmp/flux-publish-v5/src/self/checker.js"(exports2, module2) {
3558
3558
  "use strict";
3559
3559
  var CheckError = class {
3560
3560
  constructor(message, loc, hint, name, line, col) {
@@ -3843,9 +3843,9 @@ var require_checker = __commonJS({
3843
3843
  }
3844
3844
  });
3845
3845
 
3846
- // src/self/type-checker.js
3846
+ // ../../../tmp/flux-publish-v5/src/self/type-checker.js
3847
3847
  var require_type_checker = __commonJS({
3848
- "src/self/type-checker.js"(exports2, module2) {
3848
+ "../../../tmp/flux-publish-v5/src/self/type-checker.js"(exports2, module2) {
3849
3849
  var T_ANY = Object.freeze({ kind: "any" });
3850
3850
  module2.exports.T_ANY = T_ANY;
3851
3851
  var T_UNKNOWN = Object.freeze({ kind: "unknown" });
@@ -4891,9 +4891,9 @@ var require_type_checker = __commonJS({
4891
4891
  }
4892
4892
  });
4893
4893
 
4894
- // src/self/transpiler.js
4894
+ // ../../../tmp/flux-publish-v5/src/self/transpiler.js
4895
4895
  var require_transpiler = __commonJS({
4896
- "src/self/transpiler.js"(exports2, module2) {
4896
+ "../../../tmp/flux-publish-v5/src/self/transpiler.js"(exports2, module2) {
4897
4897
  "use strict";
4898
4898
  var { Lexer, lexerize, T } = require_lexer();
4899
4899
  var { Parser, makeParser } = require_parser();
@@ -4987,9 +4987,9 @@ var require_transpiler = __commonJS({
4987
4987
  }
4988
4988
  });
4989
4989
 
4990
- // src/self/bundler.js
4990
+ // ../../../tmp/flux-publish-v5/src/self/bundler.js
4991
4991
  var require_bundler = __commonJS({
4992
- "src/self/bundler.js"(exports2, module2) {
4992
+ "../../../tmp/flux-publish-v5/src/self/bundler.js"(exports2, module2) {
4993
4993
  "use strict";
4994
4994
  var Fs2 = require("fs");
4995
4995
  var Path2 = require("path");
@@ -5164,9 +5164,9 @@ var require_bundler = __commonJS({
5164
5164
  }
5165
5165
  });
5166
5166
 
5167
- // src/self/formatter.js
5167
+ // ../../../tmp/flux-publish-v5/src/self/formatter.js
5168
5168
  var require_formatter = __commonJS({
5169
- "src/self/formatter.js"(exports2, module2) {
5169
+ "../../../tmp/flux-publish-v5/src/self/formatter.js"(exports2, module2) {
5170
5170
  function normalizeOperators(line) {
5171
5171
  if ((line.match(/:/g) ?? []).length > 2) {
5172
5172
  return line;
@@ -5273,9 +5273,9 @@ var require_formatter = __commonJS({
5273
5273
  }
5274
5274
  });
5275
5275
 
5276
- // src/self/linter.js
5276
+ // ../../../tmp/flux-publish-v5/src/self/linter.js
5277
5277
  var require_linter = __commonJS({
5278
- "src/self/linter.js"(exports2, module2) {
5278
+ "../../../tmp/flux-publish-v5/src/self/linter.js"(exports2, module2) {
5279
5279
  var { lexerize } = require_lexer();
5280
5280
  var { makeParser } = require_parser();
5281
5281
  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 +6037,9 @@ var require_linter = __commonJS({
6037
6037
  }
6038
6038
  });
6039
6039
 
6040
- // src/self/test-runner.js
6040
+ // ../../../tmp/flux-publish-v5/src/self/test-runner.js
6041
6041
  var require_test_runner = __commonJS({
6042
- "src/self/test-runner.js"(exports2, module2) {
6042
+ "../../../tmp/flux-publish-v5/src/self/test-runner.js"(exports2, module2) {
6043
6043
  var Fs2 = require("fs");
6044
6044
  var Path2 = require("path");
6045
6045
  var Os2 = require("os");
@@ -6204,9 +6204,9 @@ function __runTest(name, fn) {
6204
6204
  }
6205
6205
  });
6206
6206
 
6207
- // src/self/config.js
6207
+ // ../../../tmp/flux-publish-v5/src/self/config.js
6208
6208
  var require_config = __commonJS({
6209
- "src/self/config.js"(exports2, module2) {
6209
+ "../../../tmp/flux-publish-v5/src/self/config.js"(exports2, module2) {
6210
6210
  "use strict";
6211
6211
  var Fs2 = require("fs");
6212
6212
  var Path2 = require("path");
@@ -6303,9 +6303,9 @@ var require_config = __commonJS({
6303
6303
  }
6304
6304
  });
6305
6305
 
6306
- // src/self/pkg.js
6306
+ // ../../../tmp/flux-publish-v5/src/self/pkg.js
6307
6307
  var require_pkg = __commonJS({
6308
- "src/self/pkg.js"(exports2, module2) {
6308
+ "../../../tmp/flux-publish-v5/src/self/pkg.js"(exports2, module2) {
6309
6309
  "use strict";
6310
6310
  var Fs2 = require("fs");
6311
6311
  var Path2 = require("path");
@@ -6314,7 +6314,7 @@ var require_pkg = __commonJS({
6314
6314
  var Os2 = require("os");
6315
6315
  var { readPackage } = require_config();
6316
6316
  var REGISTRY_URL = "https://registry.npmjs.org";
6317
- var ESC = "\x1B";
6317
+ var ESC = "\\u001b";
6318
6318
  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
6319
  function clr2(c, s) {
6320
6320
  return c + s + C2.reset;
@@ -6336,7 +6336,7 @@ var require_pkg = __commonJS({
6336
6336
  }
6337
6337
  let frame = 0;
6338
6338
  function tick() {
6339
- stdout.write("\r" + clr2(C2.cyan, SPIN_FRAMES[frame % SPIN_FRAMES.length]) + " " + label + " ");
6339
+ stdout.write("\\r" + clr2(C2.cyan, SPIN_FRAMES[frame % SPIN_FRAMES.length]) + " " + label + " ");
6340
6340
  frame = frame + 1;
6341
6341
  }
6342
6342
  const timer = setInterval(tick, 80);
@@ -6347,7 +6347,7 @@ var require_pkg = __commonJS({
6347
6347
  return;
6348
6348
  }
6349
6349
  clearInterval(timer);
6350
- stdout.write("\r" + ESC + "[2K");
6350
+ stdout.write("\\r" + ESC + "[2K");
6351
6351
  }
6352
6352
  async function fetchJson(url) {
6353
6353
  const mod = url.startsWith("https") ? Https : Http;
@@ -6629,7 +6629,7 @@ var require_pkg = __commonJS({
6629
6629
  }
6630
6630
  });
6631
6631
 
6632
- // src/self/cli.js
6632
+ // ../../../tmp/flux-publish-v5/src/self/cli.js
6633
6633
  var Fs = require("fs");
6634
6634
  var Path = require("path");
6635
6635
  var Os = require("os");
@@ -6642,7 +6642,7 @@ var { loadConfig } = require_config();
6642
6642
  var { cmdAdd, cmdRemove, cmdInstall, cmdList, cmdSearch, cmdInfo, cmdPublish } = require_pkg();
6643
6643
  var VERSION = FLUX_VERSION ?? "3.0.0";
6644
6644
  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" };
6645
+ 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
6646
  var noColor = process.env.NO_COLOR || !process.stdout.isTTY;
6647
6647
  function clr(c, s) {
6648
6648
  return noColor ? s : c + s + C.reset;
@@ -6682,31 +6682,19 @@ function showHelp() {
6682
6682
  console.log(" flux <command> [options]\n");
6683
6683
  console.log(bold("COMPILER:"));
6684
6684
  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
- }
6685
+ compilerCmds.forEach((pair) => console.log(" " + green(("flux " + pair[0]).padEnd(36)) + " " + gray(pair[1])));
6689
6686
  console.log();
6690
6687
  console.log(bold("TOOLING:"));
6691
6688
  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
- }
6689
+ toolCmds.forEach((pair) => console.log(" " + green(("flux " + pair[0]).padEnd(36)) + " " + gray(pair[1])));
6696
6690
  console.log();
6697
6691
  console.log(bold("PACKAGE MANAGER:"));
6698
6692
  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
- }
6693
+ pkgCmds.forEach((pair) => console.log(" " + cyan(("flux " + pair[0]).padEnd(36)) + " " + gray(pair[1])));
6703
6694
  console.log();
6704
6695
  console.log(bold("SELF-HOSTED:"));
6705
6696
  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
- }
6697
+ selfCmds.forEach((pair) => console.log(" " + yellow(("flux " + pair[0]).padEnd(36)) + " " + gray(pair[1])));
6710
6698
  console.log();
6711
6699
  console.log(bold("OPTIONS:"));
6712
6700
  console.log(" " + yellow("--out, -o <file> ") + " Output file");
@@ -7379,63 +7367,65 @@ function main() {
7379
7367
  const { positional, opts } = parseArgs(process.argv);
7380
7368
  const cmd = positional[0] ?? "help";
7381
7369
  if (cmd === "compile") {
7382
- return cmdCompile(positional[1], opts);
7370
+ cmdCompile(positional[1], opts);
7383
7371
  } else if (cmd === "run") {
7384
- return cmdRun(positional[1], opts);
7372
+ cmdRun(positional[1], opts);
7385
7373
  } else if (cmd === "check") {
7386
- return cmdCheck(positional.slice(1), opts);
7374
+ cmdCheck(positional.slice(1), opts);
7387
7375
  } else if (cmd === "fmt") {
7388
- return cmdFmt(positional.slice(1), opts);
7376
+ cmdFmt(positional.slice(1), opts);
7389
7377
  } else if (cmd === "format") {
7390
- return cmdFmt(positional.slice(1), opts);
7378
+ cmdFmt(positional.slice(1), opts);
7391
7379
  } else if (cmd === "lint") {
7392
- return cmdLint(positional.slice(1), opts);
7380
+ cmdLint(positional.slice(1), opts);
7393
7381
  } else if (cmd === "bundle") {
7394
- return cmdBundle(positional[1], opts);
7382
+ cmdBundle(positional[1], opts);
7395
7383
  } else if (cmd === "watch") {
7396
- return cmdWatch(positional[1], opts);
7384
+ cmdWatch(positional[1], opts);
7397
7385
  } else if (cmd === "tokens") {
7398
- return cmdTokens(positional[1], opts);
7386
+ cmdTokens(positional[1], opts);
7399
7387
  } else if (cmd === "ast") {
7400
- return cmdAst(positional[1], opts);
7388
+ cmdAst(positional[1], opts);
7401
7389
  } else if (cmd === "repl") {
7402
- return cmdRepl(opts);
7390
+ cmdRepl(opts);
7391
+ } else if (cmd === "test") {
7392
+ runTests(positional.slice(1), opts);
7403
7393
  } else if (cmd === "init") {
7404
- return cmdInit(positional[1], opts);
7394
+ cmdInit(positional[1], opts);
7405
7395
  } else if (cmd === "add") {
7406
- return cmdAdd(positional.slice(1), opts);
7396
+ cmdAdd(positional.slice(1), opts);
7407
7397
  } else if (cmd === "remove") {
7408
- return cmdRemove(positional.slice(1), opts);
7398
+ cmdRemove(positional.slice(1), opts);
7409
7399
  } else if (cmd === "rm") {
7410
- return cmdRemove(positional.slice(1), opts);
7400
+ cmdRemove(positional.slice(1), opts);
7411
7401
  } else if (cmd === "install") {
7412
- return cmdInstall(opts);
7402
+ cmdInstall(opts);
7413
7403
  } else if (cmd === "i") {
7414
- return cmdInstall(opts);
7404
+ cmdInstall(opts);
7415
7405
  } else if (cmd === "list") {
7416
- return cmdList(opts);
7406
+ cmdList(opts);
7417
7407
  } else if (cmd === "ls") {
7418
- return cmdList(opts);
7408
+ cmdList(opts);
7419
7409
  } else if (cmd === "search") {
7420
- return cmdSearch(positional[1], opts);
7410
+ cmdSearch(positional[1], opts);
7421
7411
  } else if (cmd === "info") {
7422
- return cmdInfo(positional[1], opts);
7412
+ cmdInfo(positional[1], opts);
7423
7413
  } else if (cmd === "publish") {
7424
- return cmdPublish(opts);
7414
+ cmdPublish(opts);
7425
7415
  } else if (cmd === "self-hosted") {
7426
- return cmdSelfHosted(positional[1], opts);
7416
+ cmdSelfHosted(positional[1], opts);
7427
7417
  } else if (cmd === "version") {
7428
- return cmdVersion(opts);
7418
+ cmdVersion(opts);
7429
7419
  } else if (cmd === "-v") {
7430
- return cmdVersion(opts);
7420
+ cmdVersion(opts);
7431
7421
  } else if (cmd === "--version") {
7432
- return cmdVersion(opts);
7422
+ cmdVersion(opts);
7433
7423
  } else if (cmd === "help") {
7434
- return showHelp();
7424
+ showHelp();
7435
7425
  } else if (cmd === "--help") {
7436
- return showHelp();
7426
+ showHelp();
7437
7427
  } else if (cmd === "-h") {
7438
- return showHelp();
7428
+ showHelp();
7439
7429
  } else {
7440
7430
  console.error(red("\u2717 Unknown command: " + cmd));
7441
7431
  console.error(gray(" Run: flux help"));