@xnoxs/flux-lang 4.0.6 → 4.0.8
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 +62 -62
- 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/src/self/cli.flux +1 -1
- package/src/self/cli.js +70 -32
- package/src/self/transpiler.flux +1 -1
- package/src/self/transpiler.js +3 -1
package/dist/flux-cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! flux-lang v4.0.
|
|
1
|
+
/*! flux-lang v4.0.8 - 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
|
-
// ../../../tmp/flux-
|
|
12
|
+
// ../../../tmp/flux-pub8/src/self/lexer.js
|
|
13
13
|
var require_lexer = __commonJS({
|
|
14
|
-
"../../../tmp/flux-
|
|
14
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
620
|
+
// ../../../tmp/flux-pub8/src/self/parser.js
|
|
621
621
|
var require_parser = __commonJS({
|
|
622
|
-
"../../../tmp/flux-
|
|
622
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
2132
|
+
// ../../../tmp/flux-pub8/src/self/codegen.js
|
|
2133
2133
|
var require_codegen = __commonJS({
|
|
2134
|
-
"../../../tmp/flux-
|
|
2134
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
2843
|
+
// ../../../tmp/flux-pub8/src/self/css-preprocessor.js
|
|
2844
2844
|
var require_css_preprocessor = __commonJS({
|
|
2845
|
-
"../../../tmp/flux-
|
|
2845
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
3204
|
+
// ../../../tmp/flux-pub8/src/self/jsx.js
|
|
3205
3205
|
var require_jsx = __commonJS({
|
|
3206
|
-
"../../../tmp/flux-
|
|
3206
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
3555
|
+
// ../../../tmp/flux-pub8/src/self/checker.js
|
|
3556
3556
|
var require_checker = __commonJS({
|
|
3557
|
-
"../../../tmp/flux-
|
|
3557
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
3846
|
+
// ../../../tmp/flux-pub8/src/self/type-checker.js
|
|
3847
3847
|
var require_type_checker = __commonJS({
|
|
3848
|
-
"../../../tmp/flux-
|
|
3848
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
4894
|
+
// ../../../tmp/flux-pub8/src/self/transpiler.js
|
|
4895
4895
|
var require_transpiler = __commonJS({
|
|
4896
|
-
"../../../tmp/flux-
|
|
4896
|
+
"../../../tmp/flux-pub8/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();
|
|
@@ -4909,7 +4909,7 @@ var require_transpiler = __commonJS({
|
|
|
4909
4909
|
const pkgPath = Path2.resolve(__dirname, "../../package.json");
|
|
4910
4910
|
return JSON.parse(Fs2.readFileSync(pkgPath, "utf8")).version;
|
|
4911
4911
|
} catch (e) {
|
|
4912
|
-
return "4.0.
|
|
4912
|
+
return "4.0.7";
|
|
4913
4913
|
}
|
|
4914
4914
|
}
|
|
4915
4915
|
var FLUX_VERSION2 = _readFluxVersion();
|
|
@@ -4987,9 +4987,9 @@ var require_transpiler = __commonJS({
|
|
|
4987
4987
|
}
|
|
4988
4988
|
});
|
|
4989
4989
|
|
|
4990
|
-
// ../../../tmp/flux-
|
|
4990
|
+
// ../../../tmp/flux-pub8/src/self/bundler.js
|
|
4991
4991
|
var require_bundler = __commonJS({
|
|
4992
|
-
"../../../tmp/flux-
|
|
4992
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
5167
|
+
// ../../../tmp/flux-pub8/src/self/formatter.js
|
|
5168
5168
|
var require_formatter = __commonJS({
|
|
5169
|
-
"../../../tmp/flux-
|
|
5169
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
5276
|
+
// ../../../tmp/flux-pub8/src/self/linter.js
|
|
5277
5277
|
var require_linter = __commonJS({
|
|
5278
|
-
"../../../tmp/flux-
|
|
5278
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
6040
|
+
// ../../../tmp/flux-pub8/src/self/test-runner.js
|
|
6041
6041
|
var require_test_runner = __commonJS({
|
|
6042
|
-
"../../../tmp/flux-
|
|
6042
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
6207
|
+
// ../../../tmp/flux-pub8/src/self/config.js
|
|
6208
6208
|
var require_config = __commonJS({
|
|
6209
|
-
"../../../tmp/flux-
|
|
6209
|
+
"../../../tmp/flux-pub8/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
|
-
// ../../../tmp/flux-
|
|
6306
|
+
// ../../../tmp/flux-pub8/src/self/pkg.js
|
|
6307
6307
|
var require_pkg = __commonJS({
|
|
6308
|
-
"../../../tmp/flux-
|
|
6308
|
+
"../../../tmp/flux-pub8/src/self/pkg.js"(exports2, module2) {
|
|
6309
6309
|
"use strict";
|
|
6310
6310
|
var Fs2 = require("fs");
|
|
6311
6311
|
var Path2 = require("path");
|
|
@@ -6629,7 +6629,7 @@ var require_pkg = __commonJS({
|
|
|
6629
6629
|
}
|
|
6630
6630
|
});
|
|
6631
6631
|
|
|
6632
|
-
// ../../../tmp/flux-
|
|
6632
|
+
// ../../../tmp/flux-pub8/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: "
|
|
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
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;
|
|
@@ -7367,65 +7367,65 @@ function main() {
|
|
|
7367
7367
|
const { positional, opts } = parseArgs(process.argv);
|
|
7368
7368
|
const cmd = positional[0] ?? "help";
|
|
7369
7369
|
if (cmd === "compile") {
|
|
7370
|
-
cmdCompile(positional[1], opts);
|
|
7370
|
+
return cmdCompile(positional[1], opts);
|
|
7371
7371
|
} else if (cmd === "run") {
|
|
7372
|
-
cmdRun(positional[1], opts);
|
|
7372
|
+
return cmdRun(positional[1], opts);
|
|
7373
7373
|
} else if (cmd === "check") {
|
|
7374
|
-
cmdCheck(positional.slice(1), opts);
|
|
7374
|
+
return cmdCheck(positional.slice(1), opts);
|
|
7375
7375
|
} else if (cmd === "fmt") {
|
|
7376
|
-
cmdFmt(positional.slice(1), opts);
|
|
7376
|
+
return cmdFmt(positional.slice(1), opts);
|
|
7377
7377
|
} else if (cmd === "format") {
|
|
7378
|
-
cmdFmt(positional.slice(1), opts);
|
|
7378
|
+
return cmdFmt(positional.slice(1), opts);
|
|
7379
7379
|
} else if (cmd === "lint") {
|
|
7380
|
-
cmdLint(positional.slice(1), opts);
|
|
7380
|
+
return cmdLint(positional.slice(1), opts);
|
|
7381
7381
|
} else if (cmd === "bundle") {
|
|
7382
|
-
cmdBundle(positional[1], opts);
|
|
7382
|
+
return cmdBundle(positional[1], opts);
|
|
7383
7383
|
} else if (cmd === "watch") {
|
|
7384
|
-
cmdWatch(positional[1], opts);
|
|
7384
|
+
return cmdWatch(positional[1], opts);
|
|
7385
7385
|
} else if (cmd === "tokens") {
|
|
7386
|
-
cmdTokens(positional[1], opts);
|
|
7386
|
+
return cmdTokens(positional[1], opts);
|
|
7387
7387
|
} else if (cmd === "ast") {
|
|
7388
|
-
cmdAst(positional[1], opts);
|
|
7388
|
+
return cmdAst(positional[1], opts);
|
|
7389
7389
|
} else if (cmd === "repl") {
|
|
7390
|
-
cmdRepl(opts);
|
|
7390
|
+
return cmdRepl(opts);
|
|
7391
7391
|
} else if (cmd === "test") {
|
|
7392
|
-
runTests(positional
|
|
7392
|
+
return runTests(positional[1] ?? "tests/", (src) => transpile(src, {}));
|
|
7393
7393
|
} else if (cmd === "init") {
|
|
7394
|
-
cmdInit(positional[1], opts);
|
|
7394
|
+
return cmdInit(positional[1], opts);
|
|
7395
7395
|
} else if (cmd === "add") {
|
|
7396
|
-
cmdAdd(positional.slice(1), opts);
|
|
7396
|
+
return cmdAdd(positional.slice(1), opts);
|
|
7397
7397
|
} else if (cmd === "remove") {
|
|
7398
|
-
cmdRemove(positional.slice(1), opts);
|
|
7398
|
+
return cmdRemove(positional.slice(1), opts);
|
|
7399
7399
|
} else if (cmd === "rm") {
|
|
7400
|
-
cmdRemove(positional.slice(1), opts);
|
|
7400
|
+
return cmdRemove(positional.slice(1), opts);
|
|
7401
7401
|
} else if (cmd === "install") {
|
|
7402
|
-
cmdInstall(opts);
|
|
7402
|
+
return cmdInstall(opts);
|
|
7403
7403
|
} else if (cmd === "i") {
|
|
7404
|
-
cmdInstall(opts);
|
|
7404
|
+
return cmdInstall(opts);
|
|
7405
7405
|
} else if (cmd === "list") {
|
|
7406
|
-
cmdList(opts);
|
|
7406
|
+
return cmdList(opts);
|
|
7407
7407
|
} else if (cmd === "ls") {
|
|
7408
|
-
cmdList(opts);
|
|
7408
|
+
return cmdList(opts);
|
|
7409
7409
|
} else if (cmd === "search") {
|
|
7410
|
-
cmdSearch(positional[1], opts);
|
|
7410
|
+
return cmdSearch(positional[1], opts);
|
|
7411
7411
|
} else if (cmd === "info") {
|
|
7412
|
-
cmdInfo(positional[1], opts);
|
|
7412
|
+
return cmdInfo(positional[1], opts);
|
|
7413
7413
|
} else if (cmd === "publish") {
|
|
7414
|
-
cmdPublish(opts);
|
|
7414
|
+
return cmdPublish(opts);
|
|
7415
7415
|
} else if (cmd === "self-hosted") {
|
|
7416
|
-
cmdSelfHosted(positional[1], opts);
|
|
7416
|
+
return cmdSelfHosted(positional[1], opts);
|
|
7417
7417
|
} else if (cmd === "version") {
|
|
7418
|
-
cmdVersion(opts);
|
|
7418
|
+
return cmdVersion(opts);
|
|
7419
7419
|
} else if (cmd === "-v") {
|
|
7420
|
-
cmdVersion(opts);
|
|
7420
|
+
return cmdVersion(opts);
|
|
7421
7421
|
} else if (cmd === "--version") {
|
|
7422
|
-
cmdVersion(opts);
|
|
7422
|
+
return cmdVersion(opts);
|
|
7423
7423
|
} else if (cmd === "help") {
|
|
7424
|
-
showHelp();
|
|
7424
|
+
return showHelp();
|
|
7425
7425
|
} else if (cmd === "--help") {
|
|
7426
|
-
showHelp();
|
|
7426
|
+
return showHelp();
|
|
7427
7427
|
} else if (cmd === "-h") {
|
|
7428
|
-
showHelp();
|
|
7428
|
+
return showHelp();
|
|
7429
7429
|
} else {
|
|
7430
7430
|
console.error(red("\u2717 Unknown command: " + cmd));
|
|
7431
7431
|
console.error(gray(" Run: flux help"));
|
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": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
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",
|
package/src/self/cli.flux
CHANGED
|
@@ -1028,7 +1028,7 @@ fn main():
|
|
|
1028
1028
|
when "tokens": cmdTokens(positional[1], opts)
|
|
1029
1029
|
when "ast": cmdAst(positional[1], opts)
|
|
1030
1030
|
when "repl": cmdRepl(opts)
|
|
1031
|
-
when "test": runTests(positional
|
|
1031
|
+
when "test": runTests(positional[1] ?? 'tests/', src -> transpile(src, {}))
|
|
1032
1032
|
when "init": cmdInit(positional[1], opts)
|
|
1033
1033
|
when "add": cmdAdd(positional.slice(1), opts)
|
|
1034
1034
|
when "remove": cmdRemove(positional.slice(1), opts)
|
package/src/self/cli.js
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
/* compiled from src/self/cli.flux */
|
|
2
2
|
'use strict';
|
|
3
|
-
//
|
|
3
|
+
// ── Flux stdlib ──
|
|
4
|
+
|
|
5
|
+
function forEach(arr, fn) { arr.forEach(fn); return arr; }
|
|
6
|
+
|
|
7
|
+
function find(arr, fn) { return arr.find(fn); }
|
|
8
|
+
|
|
9
|
+
function some(arr, fn) { return arr.some(fn); }
|
|
10
|
+
|
|
11
|
+
function join(arr, sep) { return arr.join(sep != null ? sep : ','); }
|
|
12
|
+
|
|
13
|
+
function clamp(val, min, max) {
|
|
14
|
+
return Math.min(Math.max(val, min), max);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function max(arr) {
|
|
18
|
+
if (arguments.length > 1) return Math.max.apply(null, arguments);
|
|
19
|
+
return Math.max.apply(null, arr);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function padStart(s, len, char) {
|
|
23
|
+
return String(s).padStart(len, char || ' ');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function padEnd(s, len, char) {
|
|
27
|
+
return String(s).padEnd(len, char || ' ');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function trim(s) { return String(s).trim(); }
|
|
31
|
+
|
|
32
|
+
function trimEnd(s) { return String(s).trimEnd(); }
|
|
33
|
+
|
|
34
|
+
function startsWith(s, prefix) { return String(s).startsWith(prefix); }
|
|
35
|
+
|
|
36
|
+
function endsWith(s, suffix) { return String(s).endsWith(suffix); }
|
|
37
|
+
|
|
38
|
+
function repeat(s, n) { return String(s).repeat(n); }
|
|
39
|
+
// ── end stdlib ──
|
|
40
|
+
|
|
41
|
+
// Generated by Flux Transpiler v3.2.0
|
|
4
42
|
"use strict";
|
|
5
43
|
|
|
6
44
|
const Fs = require("fs");
|
|
@@ -15,7 +53,7 @@ const { loadConfig } = require("./config");
|
|
|
15
53
|
const { cmdAdd, cmdRemove, cmdInstall, cmdList, cmdSearch, cmdInfo, cmdPublish } = require("./pkg");
|
|
16
54
|
const VERSION = (FLUX_VERSION ?? "3.0.0");
|
|
17
55
|
const STAGE = (FLUX_STAGE ?? "self-hosted");
|
|
18
|
-
const C = { reset: "
|
|
56
|
+
const 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" };
|
|
19
57
|
const noColor = (process.env.NO_COLOR || !process.stdout.isTTY);
|
|
20
58
|
function clr(c, s) {
|
|
21
59
|
return (noColor ? s : ((c + s) + C.reset));
|
|
@@ -770,94 +808,94 @@ function main() {
|
|
|
770
808
|
const { positional, opts } = parseArgs(process.argv);
|
|
771
809
|
const cmd = (positional[0] ?? "help");
|
|
772
810
|
if (cmd === "compile") {
|
|
773
|
-
cmdCompile(positional[1], opts);
|
|
811
|
+
return cmdCompile(positional[1], opts);
|
|
774
812
|
}
|
|
775
813
|
else if (cmd === "run") {
|
|
776
|
-
cmdRun(positional[1], opts);
|
|
814
|
+
return cmdRun(positional[1], opts);
|
|
777
815
|
}
|
|
778
816
|
else if (cmd === "check") {
|
|
779
|
-
cmdCheck(positional.slice(1), opts);
|
|
817
|
+
return cmdCheck(positional.slice(1), opts);
|
|
780
818
|
}
|
|
781
819
|
else if (cmd === "fmt") {
|
|
782
|
-
cmdFmt(positional.slice(1), opts);
|
|
820
|
+
return cmdFmt(positional.slice(1), opts);
|
|
783
821
|
}
|
|
784
822
|
else if (cmd === "format") {
|
|
785
|
-
cmdFmt(positional.slice(1), opts);
|
|
823
|
+
return cmdFmt(positional.slice(1), opts);
|
|
786
824
|
}
|
|
787
825
|
else if (cmd === "lint") {
|
|
788
|
-
cmdLint(positional.slice(1), opts);
|
|
826
|
+
return cmdLint(positional.slice(1), opts);
|
|
789
827
|
}
|
|
790
828
|
else if (cmd === "bundle") {
|
|
791
|
-
cmdBundle(positional[1], opts);
|
|
829
|
+
return cmdBundle(positional[1], opts);
|
|
792
830
|
}
|
|
793
831
|
else if (cmd === "watch") {
|
|
794
|
-
cmdWatch(positional[1], opts);
|
|
832
|
+
return cmdWatch(positional[1], opts);
|
|
795
833
|
}
|
|
796
834
|
else if (cmd === "tokens") {
|
|
797
|
-
cmdTokens(positional[1], opts);
|
|
835
|
+
return cmdTokens(positional[1], opts);
|
|
798
836
|
}
|
|
799
837
|
else if (cmd === "ast") {
|
|
800
|
-
cmdAst(positional[1], opts);
|
|
838
|
+
return cmdAst(positional[1], opts);
|
|
801
839
|
}
|
|
802
840
|
else if (cmd === "repl") {
|
|
803
|
-
cmdRepl(opts);
|
|
841
|
+
return cmdRepl(opts);
|
|
804
842
|
}
|
|
805
843
|
else if (cmd === "test") {
|
|
806
|
-
runTests(positional
|
|
844
|
+
return runTests((positional[1] ?? "tests/"), (src) => transpile(src, { }));
|
|
807
845
|
}
|
|
808
846
|
else if (cmd === "init") {
|
|
809
|
-
cmdInit(positional[1], opts);
|
|
847
|
+
return cmdInit(positional[1], opts);
|
|
810
848
|
}
|
|
811
849
|
else if (cmd === "add") {
|
|
812
|
-
cmdAdd(positional.slice(1), opts);
|
|
850
|
+
return cmdAdd(positional.slice(1), opts);
|
|
813
851
|
}
|
|
814
852
|
else if (cmd === "remove") {
|
|
815
|
-
cmdRemove(positional.slice(1), opts);
|
|
853
|
+
return cmdRemove(positional.slice(1), opts);
|
|
816
854
|
}
|
|
817
855
|
else if (cmd === "rm") {
|
|
818
|
-
cmdRemove(positional.slice(1), opts);
|
|
856
|
+
return cmdRemove(positional.slice(1), opts);
|
|
819
857
|
}
|
|
820
858
|
else if (cmd === "install") {
|
|
821
|
-
cmdInstall(opts);
|
|
859
|
+
return cmdInstall(opts);
|
|
822
860
|
}
|
|
823
861
|
else if (cmd === "i") {
|
|
824
|
-
cmdInstall(opts);
|
|
862
|
+
return cmdInstall(opts);
|
|
825
863
|
}
|
|
826
864
|
else if (cmd === "list") {
|
|
827
|
-
cmdList(opts);
|
|
865
|
+
return cmdList(opts);
|
|
828
866
|
}
|
|
829
867
|
else if (cmd === "ls") {
|
|
830
|
-
cmdList(opts);
|
|
868
|
+
return cmdList(opts);
|
|
831
869
|
}
|
|
832
870
|
else if (cmd === "search") {
|
|
833
|
-
cmdSearch(positional[1], opts);
|
|
871
|
+
return cmdSearch(positional[1], opts);
|
|
834
872
|
}
|
|
835
873
|
else if (cmd === "info") {
|
|
836
|
-
cmdInfo(positional[1], opts);
|
|
874
|
+
return cmdInfo(positional[1], opts);
|
|
837
875
|
}
|
|
838
876
|
else if (cmd === "publish") {
|
|
839
|
-
cmdPublish(opts);
|
|
877
|
+
return cmdPublish(opts);
|
|
840
878
|
}
|
|
841
879
|
else if (cmd === "self-hosted") {
|
|
842
|
-
cmdSelfHosted(positional[1], opts);
|
|
880
|
+
return cmdSelfHosted(positional[1], opts);
|
|
843
881
|
}
|
|
844
882
|
else if (cmd === "version") {
|
|
845
|
-
cmdVersion(opts);
|
|
883
|
+
return cmdVersion(opts);
|
|
846
884
|
}
|
|
847
885
|
else if (cmd === "-v") {
|
|
848
|
-
cmdVersion(opts);
|
|
886
|
+
return cmdVersion(opts);
|
|
849
887
|
}
|
|
850
888
|
else if (cmd === "--version") {
|
|
851
|
-
cmdVersion(opts);
|
|
889
|
+
return cmdVersion(opts);
|
|
852
890
|
}
|
|
853
891
|
else if (cmd === "help") {
|
|
854
|
-
showHelp();
|
|
892
|
+
return showHelp();
|
|
855
893
|
}
|
|
856
894
|
else if (cmd === "--help") {
|
|
857
|
-
showHelp();
|
|
895
|
+
return showHelp();
|
|
858
896
|
}
|
|
859
897
|
else if (cmd === "-h") {
|
|
860
|
-
showHelp();
|
|
898
|
+
return showHelp();
|
|
861
899
|
}
|
|
862
900
|
else {
|
|
863
901
|
console.error(red(("✗ Unknown command: " + cmd)));
|
package/src/self/transpiler.flux
CHANGED
|
@@ -24,7 +24,7 @@ fn _readFluxVersion():
|
|
|
24
24
|
val pkgPath = Path.resolve(__dirname, "../../package.json")
|
|
25
25
|
return JSON.parse(Fs.readFileSync(pkgPath, "utf8")).version
|
|
26
26
|
catch(e):
|
|
27
|
-
return "4.0.
|
|
27
|
+
return "4.0.7"
|
|
28
28
|
|
|
29
29
|
export val FLUX_VERSION = _readFluxVersion()
|
|
30
30
|
export val FLUX_STAGE = "self-hosted"
|
package/src/self/transpiler.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* compiled from src/self/transpiler.flux */
|
|
2
|
+
'use strict';
|
|
1
3
|
// Generated by Flux Transpiler v3.2.0
|
|
2
4
|
"use strict";
|
|
3
5
|
|
|
@@ -16,7 +18,7 @@ function _readFluxVersion() {
|
|
|
16
18
|
return JSON.parse(Fs.readFileSync(pkgPath, "utf8")).version;
|
|
17
19
|
}
|
|
18
20
|
catch (e) {
|
|
19
|
-
return "4.0.
|
|
21
|
+
return "4.0.7";
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
const FLUX_VERSION = _readFluxVersion();
|