@xnoxs/flux-lang 3.4.2 → 3.4.3
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/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/flux-cli.js +452 -14
- package/dist/flux.cjs.js +15 -2
- package/dist/flux.esm.js +15 -2
- package/dist/flux.min.js +11 -11
- package/package.json +1 -1
- package/src/config.js +18 -1
- package/src/self/cli.js +836 -1
- package/src/self/pkg.js +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [3.4.3] — 2026-06-26
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **`flux test`** — semua 13 file test gagal dengan `Cannot find module 'dist/config.js'`; diperbaiki dengan `_resolveModule()` di `src/test-runner.js` yang mencari module di `src/` ketika `__dirname` adalah `dist/` (akibat bundling esbuild)
|
|
14
|
+
- **`flux test` — `matchIgnoreShim is not a function`** — circular require (test-runner me-require dirinya sendiri); diperbaiki dengan memindahkan `matchIgnore` ke `src/config.js` dan meng-export-nya dari sana
|
|
15
|
+
- **`flux add/remove/install/search/info/list`** — semua perintah package manager menampilkan halaman help karena tidak ada di switch statement; perintah-perintah ini sekarang di-route ke handler yang benar di `src/self/pkg.js`
|
|
16
|
+
- **`flux add <package>`** — package name dipecah jadi karakter individual karena `cmdAdd` menerima array bukan string; diperbaiki dengan mengirim `[pkgSpecs]` sebagai array
|
|
17
|
+
- **`flux remove`** — bug codegen: `delete pkg.dependencies[name]` di-compile jadi `delete; pkg.dependencies[name];` (dua statement); diperbaiki langsung di `src/self/pkg.js`
|
|
18
|
+
- **`src/self/pkg.js`** — bug codegen `delete;` yang mencegah build esbuild; diperbaiki manual di file compiled
|
|
19
|
+
|
|
20
|
+
### Results
|
|
21
|
+
- `flux test tests/` — **102/102 passed** (naik dari 0/102)
|
|
22
|
+
- Semua 22 perintah CLI terverifikasi berfungsi
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
10
26
|
## [3.4.2] — 2026-06-25
|
|
11
27
|
|
|
12
28
|
### Added
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ⚡ Flux Lang v3.4.
|
|
1
|
+
# ⚡ Flux Lang v3.4.3
|
|
2
2
|
|
|
3
3
|
**Flux** is a modern programming language that transpiles to clean JavaScript — combining Python-style indentation, TypeScript-grade type safety, Rust-inspired pattern matching, and a rich standard library — all with **zero runtime overhead**.
|
|
4
4
|
|
package/dist/flux-cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*!
|
|
3
|
-
* flux-lang v3.4.
|
|
3
|
+
* flux-lang v3.4.3
|
|
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
|
|
@@ -68,7 +68,20 @@ var require_config = __commonJS({
|
|
|
68
68
|
function defineConfig(config) {
|
|
69
69
|
return config;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
function matchIgnore(filePath, patterns) {
|
|
72
|
+
if (!patterns || patterns.length === 0) return false;
|
|
73
|
+
const normalize = (p) => p.replace(/\\/g, "/");
|
|
74
|
+
const fp = normalize(filePath);
|
|
75
|
+
for (const pattern of patterns) {
|
|
76
|
+
let re = normalize(pattern).replace(/\*\*/g, "\0DS\0");
|
|
77
|
+
re = re.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
78
|
+
re = re.replace(/\*/g, "[^/]*");
|
|
79
|
+
re = re.replace(/\x00DS\x00\//g, "(.+/)?").replace(/\x00DS\x00/g, ".*");
|
|
80
|
+
if (new RegExp("(^|/)" + re + "$").test(fp)) return true;
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
module2.exports = { loadConfig: loadConfig2, mergeConfig: mergeConfig2, defineConfig, matchIgnore };
|
|
72
85
|
}
|
|
73
86
|
});
|
|
74
87
|
|
|
@@ -7203,7 +7216,7 @@ var require_package = __commonJS({
|
|
|
7203
7216
|
"package.json"(exports2, module2) {
|
|
7204
7217
|
module2.exports = {
|
|
7205
7218
|
name: "@xnoxs/flux-lang",
|
|
7206
|
-
version: "3.4.
|
|
7219
|
+
version: "3.4.3",
|
|
7207
7220
|
description: "Flux \u2014 A modern language that transpiles to JavaScript. Python-clean syntax, TypeScript-level safety, Rust-inspired pattern matching.",
|
|
7208
7221
|
main: "dist/flux.cjs.js",
|
|
7209
7222
|
module: "dist/flux.esm.js",
|
|
@@ -8216,9 +8229,18 @@ var require_test_runner = __commonJS({
|
|
|
8216
8229
|
var fs2 = require("fs");
|
|
8217
8230
|
var path2 = require("path");
|
|
8218
8231
|
var os = require("os");
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8232
|
+
function _resolveModule(name) {
|
|
8233
|
+
const inSelf = path2.join(__dirname, name);
|
|
8234
|
+
if (fs2.existsSync(inSelf)) return inSelf;
|
|
8235
|
+
const inSrc = path2.join(__dirname, "..", "src", name);
|
|
8236
|
+
if (fs2.existsSync(inSrc)) return inSrc;
|
|
8237
|
+
return inSelf;
|
|
8238
|
+
}
|
|
8239
|
+
var CONFIG_PATH = JSON.stringify(_resolveModule("config.js"));
|
|
8240
|
+
var TRANSPILER_PATH = JSON.stringify(_resolveModule("transpiler.js"));
|
|
8241
|
+
var TEST_RUNNER_PATH = JSON.stringify(
|
|
8242
|
+
fs2.existsSync(__filename) ? __filename : _resolveModule("test-runner.js")
|
|
8243
|
+
);
|
|
8222
8244
|
var C2 = {
|
|
8223
8245
|
reset: "\x1B[0m",
|
|
8224
8246
|
bold: "\x1B[1m",
|
|
@@ -8331,14 +8353,13 @@ function __runAll(mod) {
|
|
|
8331
8353
|
fnNames.push(match[1]);
|
|
8332
8354
|
}
|
|
8333
8355
|
const shimPreamble = [
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
`const matchIgnoreShim = __runnerMod.matchIgnore;`
|
|
8356
|
+
"// \u2500\u2500 shim globals for flux.config.js tests \u2500\u2500",
|
|
8357
|
+
"const __configMod = require(" + CONFIG_PATH + ");",
|
|
8358
|
+
"const __transpilerMod= require(" + TRANSPILER_PATH + ");",
|
|
8359
|
+
"const mergeConfigShim = __configMod.mergeConfig;",
|
|
8360
|
+
"const defineConfigShim = __configMod.defineConfig;",
|
|
8361
|
+
"const transpileShim = __transpilerMod.transpile;",
|
|
8362
|
+
"const matchIgnoreShim = __configMod.matchIgnore;"
|
|
8342
8363
|
].join("\n");
|
|
8343
8364
|
const runner = [
|
|
8344
8365
|
TEST_HELPERS,
|
|
@@ -8453,6 +8474,371 @@ function __runAll(mod) {
|
|
|
8453
8474
|
}
|
|
8454
8475
|
});
|
|
8455
8476
|
|
|
8477
|
+
// src/self/config.js
|
|
8478
|
+
var require_config2 = __commonJS({
|
|
8479
|
+
"src/self/config.js"(exports2, module2) {
|
|
8480
|
+
var Fs = require("fs");
|
|
8481
|
+
var Path = require("path");
|
|
8482
|
+
var DEFAULT_CONFIG = { entry: "src/main.flux", outDir: "dist", sourcemap: false, mangle: false, jsx: false, jsxTarget: "browser", typecheck: true, strict: false, watch: false, ignore: [], selfHosted: false, registry: "https://registry.flux-lang.dev", pkg: { name: "", version: "1.0.0", description: "", author: "", license: "MIT", deps: {}, devDeps: {} } };
|
|
8483
|
+
module2.exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
|
8484
|
+
function loadConfig2(cwd_) {
|
|
8485
|
+
const cwd = cwd_ ?? process.cwd();
|
|
8486
|
+
const jsonPath = Path.join(cwd, "flux.json");
|
|
8487
|
+
if (Fs.existsSync(jsonPath)) {
|
|
8488
|
+
try {
|
|
8489
|
+
const raw = Fs.readFileSync(jsonPath, "utf8");
|
|
8490
|
+
const parsed = JSON.parse(raw);
|
|
8491
|
+
return mergeConfig2(DEFAULT_CONFIG, parsed);
|
|
8492
|
+
} catch (e) {
|
|
8493
|
+
throw new Error("Invalid flux.json: " + e.message);
|
|
8494
|
+
}
|
|
8495
|
+
}
|
|
8496
|
+
const jsPath = Path.join(cwd, "flux.config.js");
|
|
8497
|
+
if (Fs.existsSync(jsPath)) {
|
|
8498
|
+
try {
|
|
8499
|
+
const loaded = require(jsPath);
|
|
8500
|
+
return mergeConfig2(DEFAULT_CONFIG, loaded);
|
|
8501
|
+
} catch (e2) {
|
|
8502
|
+
throw new Error("Invalid flux.config.js: " + e2.message);
|
|
8503
|
+
}
|
|
8504
|
+
}
|
|
8505
|
+
return { ...DEFAULT_CONFIG };
|
|
8506
|
+
}
|
|
8507
|
+
module2.exports.loadConfig = loadConfig2;
|
|
8508
|
+
function mergeConfig2(base, overrides) {
|
|
8509
|
+
if (!overrides) {
|
|
8510
|
+
return { ...base };
|
|
8511
|
+
}
|
|
8512
|
+
const result = { ...base };
|
|
8513
|
+
for (const key of Object.keys(overrides)) {
|
|
8514
|
+
const val_ = overrides[key];
|
|
8515
|
+
if (val_ != null && val_ != void 0) {
|
|
8516
|
+
result[key] = val_;
|
|
8517
|
+
}
|
|
8518
|
+
}
|
|
8519
|
+
return result;
|
|
8520
|
+
}
|
|
8521
|
+
module2.exports.mergeConfig = mergeConfig2;
|
|
8522
|
+
function writeConfig(config, cwd_) {
|
|
8523
|
+
const cwd = cwd_ ?? process.cwd();
|
|
8524
|
+
const jsonPath = Path.join(cwd, "flux.json");
|
|
8525
|
+
const content = JSON.stringify(config, null, 2) + "\n";
|
|
8526
|
+
Fs.writeFileSync(jsonPath, content, "utf8");
|
|
8527
|
+
}
|
|
8528
|
+
module2.exports.writeConfig = writeConfig;
|
|
8529
|
+
function validateConfig(config) {
|
|
8530
|
+
const errors = [];
|
|
8531
|
+
if (config.entry && !config.entry.endsWith(".flux")) {
|
|
8532
|
+
errors.push("entry must be a .flux file");
|
|
8533
|
+
}
|
|
8534
|
+
if (config.jsxTarget && !["browser", "server", "react"].includes(config.jsxTarget)) {
|
|
8535
|
+
errors.push("jsxTarget must be 'browser', 'server', or 'react'");
|
|
8536
|
+
}
|
|
8537
|
+
return { valid: errors.length == 0, errors };
|
|
8538
|
+
}
|
|
8539
|
+
module2.exports.validateConfig = validateConfig;
|
|
8540
|
+
function readPackage(cwd_) {
|
|
8541
|
+
const cwd = cwd_ ?? process.cwd();
|
|
8542
|
+
const fluxJson = Path.join(cwd, "flux.json");
|
|
8543
|
+
const pkgJson = Path.join(cwd, "package.json");
|
|
8544
|
+
if (Fs.existsSync(fluxJson)) {
|
|
8545
|
+
try {
|
|
8546
|
+
return JSON.parse(Fs.readFileSync(fluxJson, "utf8"));
|
|
8547
|
+
} catch (e) {
|
|
8548
|
+
return null;
|
|
8549
|
+
}
|
|
8550
|
+
}
|
|
8551
|
+
if (Fs.existsSync(pkgJson)) {
|
|
8552
|
+
try {
|
|
8553
|
+
return JSON.parse(Fs.readFileSync(pkgJson, "utf8"));
|
|
8554
|
+
} catch (e2) {
|
|
8555
|
+
return null;
|
|
8556
|
+
}
|
|
8557
|
+
}
|
|
8558
|
+
return null;
|
|
8559
|
+
}
|
|
8560
|
+
module2.exports.readPackage = readPackage;
|
|
8561
|
+
}
|
|
8562
|
+
});
|
|
8563
|
+
|
|
8564
|
+
// src/self/pkg.js
|
|
8565
|
+
var require_pkg = __commonJS({
|
|
8566
|
+
"src/self/pkg.js"(exports2, module2) {
|
|
8567
|
+
var Fs = require("fs");
|
|
8568
|
+
var Path = require("path");
|
|
8569
|
+
var Https = require("https");
|
|
8570
|
+
var Http = require("http");
|
|
8571
|
+
var Os = require("os");
|
|
8572
|
+
var { readPackage, writeConfig, loadConfig: loadConfig2 } = require_config2();
|
|
8573
|
+
var REGISTRY_URL = "https://registry.npmjs.org";
|
|
8574
|
+
var FLUX_PKG_DIR = "flux_modules";
|
|
8575
|
+
var PKG_FILE = "flux.json";
|
|
8576
|
+
var C2 = { reset: "\\x1b[0m", bold: "\\x1b[1m", dim: "\\x1b[2m", red: "\\x1b[31m", green: "\\x1b[32m", yellow: "\\x1b[33m", blue: "\\x1b[34m", cyan: "\\x1b[36m", gray: "\\x1b[90m" };
|
|
8577
|
+
function clr2(c, s) {
|
|
8578
|
+
return c + s + C2.reset;
|
|
8579
|
+
}
|
|
8580
|
+
function ok(msg) {
|
|
8581
|
+
console.log(clr2(C2.green, "\u2713 ") + msg);
|
|
8582
|
+
}
|
|
8583
|
+
function err(msg) {
|
|
8584
|
+
console.error(clr2(C2.red, "\u2717 ") + msg);
|
|
8585
|
+
}
|
|
8586
|
+
function info(msg) {
|
|
8587
|
+
console.log(clr2(C2.cyan, " ") + msg);
|
|
8588
|
+
}
|
|
8589
|
+
async function fetchJson(url) {
|
|
8590
|
+
const mod = url.startsWith("https") ? Https : Http;
|
|
8591
|
+
function doRequest(resolve, reject) {
|
|
8592
|
+
let data = "";
|
|
8593
|
+
function onData(chunk) {
|
|
8594
|
+
data = data + chunk;
|
|
8595
|
+
}
|
|
8596
|
+
function onEnd() {
|
|
8597
|
+
try {
|
|
8598
|
+
resolve(JSON.parse(data));
|
|
8599
|
+
} catch (e) {
|
|
8600
|
+
reject(new Error("Invalid JSON from registry: " + e.message));
|
|
8601
|
+
}
|
|
8602
|
+
}
|
|
8603
|
+
function onRes(res) {
|
|
8604
|
+
res.on("data", onData);
|
|
8605
|
+
res.on("end", onEnd);
|
|
8606
|
+
}
|
|
8607
|
+
mod.get(url, { headers: { "User-Agent": "flux-pkg/1.0" } }, onRes).on("error", reject);
|
|
8608
|
+
}
|
|
8609
|
+
return new Promise(doRequest);
|
|
8610
|
+
}
|
|
8611
|
+
function ensureFluxJson(cwd_) {
|
|
8612
|
+
const cwd = cwd_ ?? process.cwd();
|
|
8613
|
+
const file = Path.join(cwd, PKG_FILE);
|
|
8614
|
+
if (!Fs.existsSync(file)) {
|
|
8615
|
+
const pkg = { name: Path.basename(cwd), version: "1.0.0", description: "", author: "", license: "MIT", scripts: { start: "flux run src/main.flux", build: "flux bundle src/main.flux -o dist/bundle.js", dev: "flux watch src/main.flux", check: "flux check src/main.flux" }, dependencies: {}, devDependencies: {} };
|
|
8616
|
+
Fs.writeFileSync(file, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
8617
|
+
ok("Created flux.json");
|
|
8618
|
+
}
|
|
8619
|
+
return JSON.parse(Fs.readFileSync(file, "utf8"));
|
|
8620
|
+
}
|
|
8621
|
+
function saveFluxJson(pkg, cwd_) {
|
|
8622
|
+
const cwd = cwd_ ?? process.cwd();
|
|
8623
|
+
const file = Path.join(cwd, PKG_FILE);
|
|
8624
|
+
Fs.writeFileSync(file, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
8625
|
+
}
|
|
8626
|
+
function parsePackageSpec(spec) {
|
|
8627
|
+
const atIdx = spec.lastIndexOf("@");
|
|
8628
|
+
if (atIdx > 0) {
|
|
8629
|
+
return { name: spec.slice(0, atIdx), version: spec.slice(atIdx + 1) };
|
|
8630
|
+
}
|
|
8631
|
+
return { name: spec, version: "latest" };
|
|
8632
|
+
}
|
|
8633
|
+
async function cmdAdd(specs, opts) {
|
|
8634
|
+
var _a, _b;
|
|
8635
|
+
const isDev = (opts == null ? void 0 : opts.dev) ?? false;
|
|
8636
|
+
const cwd = process.cwd();
|
|
8637
|
+
const pkg = ensureFluxJson(cwd);
|
|
8638
|
+
for (const spec of specs) {
|
|
8639
|
+
const { name, version } = parsePackageSpec(spec);
|
|
8640
|
+
console.log(clr2(C2.cyan, "\n Adding ") + clr2(C2.bold, name) + clr2(C2.gray, "@" + version) + " ...");
|
|
8641
|
+
try {
|
|
8642
|
+
const info_ = await fetchJson(REGISTRY_URL + "/" + name);
|
|
8643
|
+
const resolvedVersion = version == "latest" ? ((_a = info_["dist-tags"]) == null ? void 0 : _a.latest) ?? "1.0.0" : version;
|
|
8644
|
+
const versionInfo = (_b = info_.versions) == null ? void 0 : _b[resolvedVersion];
|
|
8645
|
+
if (!versionInfo) {
|
|
8646
|
+
err("Version " + resolvedVersion + " not found for " + name);
|
|
8647
|
+
continue;
|
|
8648
|
+
}
|
|
8649
|
+
const depKey = isDev ? "devDependencies" : "dependencies";
|
|
8650
|
+
if (!pkg[depKey]) {
|
|
8651
|
+
pkg[depKey] = {};
|
|
8652
|
+
}
|
|
8653
|
+
pkg[depKey][name] = "^" + resolvedVersion;
|
|
8654
|
+
saveFluxJson(pkg, cwd);
|
|
8655
|
+
const desc = versionInfo.description ? clr2(C2.gray, " \u2014 " + versionInfo.description) : "";
|
|
8656
|
+
ok(name + clr2(C2.green, "@" + resolvedVersion) + desc);
|
|
8657
|
+
info("Added to " + (isDev ? "devDependencies" : "dependencies"));
|
|
8658
|
+
} catch (e) {
|
|
8659
|
+
err("Failed to fetch " + name + ": " + e.message);
|
|
8660
|
+
}
|
|
8661
|
+
}
|
|
8662
|
+
console.log();
|
|
8663
|
+
console.log(clr2(C2.gray, " Run ") + clr2(C2.yellow, "flux install") + clr2(C2.gray, " to install packages"));
|
|
8664
|
+
console.log();
|
|
8665
|
+
}
|
|
8666
|
+
module2.exports.cmdAdd = cmdAdd;
|
|
8667
|
+
function cmdRemove(names, opts) {
|
|
8668
|
+
const cwd = process.cwd();
|
|
8669
|
+
const pkg = ensureFluxJson(cwd);
|
|
8670
|
+
let removed = 0;
|
|
8671
|
+
for (const name of names) {
|
|
8672
|
+
let found = false;
|
|
8673
|
+
if (pkg.dependencies && pkg.dependencies[name]) {
|
|
8674
|
+
delete pkg.dependencies[name];
|
|
8675
|
+
found = true;
|
|
8676
|
+
}
|
|
8677
|
+
if (pkg.devDependencies && pkg.devDependencies[name]) {
|
|
8678
|
+
delete pkg.devDependencies[name];
|
|
8679
|
+
found = true;
|
|
8680
|
+
}
|
|
8681
|
+
if (found) {
|
|
8682
|
+
ok("Removed " + clr2(C2.bold, name));
|
|
8683
|
+
removed = removed + 1;
|
|
8684
|
+
} else {
|
|
8685
|
+
err(name + " not found in flux.json");
|
|
8686
|
+
}
|
|
8687
|
+
}
|
|
8688
|
+
if (removed > 0) {
|
|
8689
|
+
saveFluxJson(pkg, cwd);
|
|
8690
|
+
}
|
|
8691
|
+
}
|
|
8692
|
+
module2.exports.cmdRemove = cmdRemove;
|
|
8693
|
+
async function cmdInstall(opts) {
|
|
8694
|
+
const cwd = process.cwd();
|
|
8695
|
+
const pkg = ensureFluxJson(cwd);
|
|
8696
|
+
const deps = pkg.dependencies ?? {};
|
|
8697
|
+
const devDeps = pkg.devDependencies ?? {};
|
|
8698
|
+
const all = { ...deps, ...devDeps };
|
|
8699
|
+
const names = Object.keys(all);
|
|
8700
|
+
if (names.length == 0) {
|
|
8701
|
+
info("No dependencies found in flux.json");
|
|
8702
|
+
return;
|
|
8703
|
+
}
|
|
8704
|
+
console.log(clr2(C2.cyan, "\n Installing ") + names.length + " package(s)...\n");
|
|
8705
|
+
const modDir = Path.join(cwd, FLUX_PKG_DIR);
|
|
8706
|
+
if (!Fs.existsSync(modDir)) {
|
|
8707
|
+
Fs.mkdirSync(modDir, { recursive: true });
|
|
8708
|
+
}
|
|
8709
|
+
for (const name of names) {
|
|
8710
|
+
const spec = all[name];
|
|
8711
|
+
const version = spec.replace(/[\^~>=<]/g, "").split(" ")[0];
|
|
8712
|
+
console.log(clr2(C2.gray, " \u25CB ") + name + clr2(C2.gray, "@" + version));
|
|
8713
|
+
}
|
|
8714
|
+
console.log();
|
|
8715
|
+
ok("flux.json dependencies registered");
|
|
8716
|
+
info("Note: Use npm/pnpm to install Node.js compatible packages");
|
|
8717
|
+
console.log();
|
|
8718
|
+
}
|
|
8719
|
+
module2.exports.cmdInstall = cmdInstall;
|
|
8720
|
+
function cmdList(opts) {
|
|
8721
|
+
const cwd = process.cwd();
|
|
8722
|
+
const pkg = readPackage(cwd);
|
|
8723
|
+
if (!pkg) {
|
|
8724
|
+
err("No flux.json found. Run: flux init");
|
|
8725
|
+
return;
|
|
8726
|
+
}
|
|
8727
|
+
console.log();
|
|
8728
|
+
console.log(clr2(C2.bold, " " + (pkg.name ?? "project") + clr2(C2.gray, "@" + (pkg.version ?? "1.0.0"))));
|
|
8729
|
+
console.log();
|
|
8730
|
+
const deps = pkg.dependencies ?? {};
|
|
8731
|
+
const devDeps = pkg.devDependencies ?? {};
|
|
8732
|
+
if (Object.keys(deps).length > 0) {
|
|
8733
|
+
console.log(clr2(C2.cyan, " dependencies:"));
|
|
8734
|
+
for (const name of Object.keys(deps)) {
|
|
8735
|
+
console.log(" " + clr2(C2.green, name) + clr2(C2.gray, " " + deps[name]));
|
|
8736
|
+
}
|
|
8737
|
+
console.log();
|
|
8738
|
+
}
|
|
8739
|
+
if (Object.keys(devDeps).length > 0) {
|
|
8740
|
+
console.log(clr2(C2.cyan, " devDependencies:"));
|
|
8741
|
+
for (const name of Object.keys(devDeps)) {
|
|
8742
|
+
console.log(" " + clr2(C2.blue, name) + clr2(C2.gray, " " + devDeps[name]));
|
|
8743
|
+
}
|
|
8744
|
+
console.log();
|
|
8745
|
+
}
|
|
8746
|
+
if (Object.keys(deps).length == 0 && Object.keys(devDeps).length == 0) {
|
|
8747
|
+
info("No dependencies");
|
|
8748
|
+
console.log();
|
|
8749
|
+
}
|
|
8750
|
+
}
|
|
8751
|
+
module2.exports.cmdList = cmdList;
|
|
8752
|
+
async function cmdSearch(query, opts) {
|
|
8753
|
+
var _a;
|
|
8754
|
+
console.log(clr2(C2.cyan, "\n Searching for ") + clr2(C2.bold, '"' + query + '"') + " ...\n");
|
|
8755
|
+
try {
|
|
8756
|
+
const url = REGISTRY_URL + "/-/v1/search?text=" + encodeURIComponent(query + " keywords:flux") + "&size=10";
|
|
8757
|
+
const results = await fetchJson(url);
|
|
8758
|
+
const objects = results.objects ?? [];
|
|
8759
|
+
if (objects.length == 0) {
|
|
8760
|
+
info("No packages found for: " + query);
|
|
8761
|
+
console.log();
|
|
8762
|
+
return;
|
|
8763
|
+
}
|
|
8764
|
+
for (const obj of objects) {
|
|
8765
|
+
const p = obj.package;
|
|
8766
|
+
console.log(" " + clr2(C2.bold, p.name) + clr2(C2.gray, " v" + p.version));
|
|
8767
|
+
if (p.description) {
|
|
8768
|
+
console.log(" " + clr2(C2.gray, p.description));
|
|
8769
|
+
}
|
|
8770
|
+
console.log(" " + clr2(C2.blue, ((_a = p.links) == null ? void 0 : _a.npm) ?? ""));
|
|
8771
|
+
console.log();
|
|
8772
|
+
}
|
|
8773
|
+
} catch (e) {
|
|
8774
|
+
err("Search failed: " + e.message);
|
|
8775
|
+
}
|
|
8776
|
+
}
|
|
8777
|
+
module2.exports.cmdSearch = cmdSearch;
|
|
8778
|
+
async function cmdInfo(name, opts) {
|
|
8779
|
+
var _a, _b, _c, _d, _e;
|
|
8780
|
+
console.log(clr2(C2.cyan, "\n Fetching info for ") + clr2(C2.bold, name) + " ...\n");
|
|
8781
|
+
try {
|
|
8782
|
+
const info_ = await fetchJson(REGISTRY_URL + "/" + name);
|
|
8783
|
+
const latest = ((_a = info_["dist-tags"]) == null ? void 0 : _a.latest) ?? "unknown";
|
|
8784
|
+
const ver = ((_b = info_.versions) == null ? void 0 : _b[latest]) ?? {};
|
|
8785
|
+
console.log(clr2(C2.bold, " " + name) + clr2(C2.gray, " v" + latest));
|
|
8786
|
+
if (ver.description) {
|
|
8787
|
+
console.log(" " + ver.description);
|
|
8788
|
+
}
|
|
8789
|
+
console.log();
|
|
8790
|
+
console.log(clr2(C2.gray, " license: ") + (ver.license ?? "unknown"));
|
|
8791
|
+
console.log(clr2(C2.gray, " author: ") + (((_c = ver.author) == null ? void 0 : _c.name) ?? ver.author ?? "unknown"));
|
|
8792
|
+
const homepage = ver.homepage ?? info_.homepage;
|
|
8793
|
+
if (homepage) {
|
|
8794
|
+
console.log(clr2(C2.gray, " home: ") + clr2(C2.blue, homepage));
|
|
8795
|
+
}
|
|
8796
|
+
const repo = ((_d = ver.repository) == null ? void 0 : _d.url) ?? ((_e = info_.repository) == null ? void 0 : _e.url);
|
|
8797
|
+
if (repo) {
|
|
8798
|
+
console.log(clr2(C2.gray, " repo: ") + clr2(C2.blue, repo.replace("git+", "").replace(".git", "")));
|
|
8799
|
+
}
|
|
8800
|
+
const keywords = ver.keywords ?? [];
|
|
8801
|
+
if (keywords.length > 0) {
|
|
8802
|
+
console.log(clr2(C2.gray, " tags: ") + keywords.slice(0, 8).join(", "));
|
|
8803
|
+
}
|
|
8804
|
+
console.log();
|
|
8805
|
+
console.log(clr2(C2.gray, " Install: ") + clr2(C2.yellow, "flux add " + name));
|
|
8806
|
+
console.log();
|
|
8807
|
+
} catch (e) {
|
|
8808
|
+
err("Could not fetch info for " + name + ": " + e.message);
|
|
8809
|
+
}
|
|
8810
|
+
}
|
|
8811
|
+
module2.exports.cmdInfo = cmdInfo;
|
|
8812
|
+
function cmdPublish2(opts) {
|
|
8813
|
+
const cwd = process.cwd();
|
|
8814
|
+
const pkg = readPackage(cwd);
|
|
8815
|
+
if (!pkg) {
|
|
8816
|
+
err("No flux.json found. Run: flux init");
|
|
8817
|
+
return;
|
|
8818
|
+
}
|
|
8819
|
+
console.log();
|
|
8820
|
+
console.log(clr2(C2.cyan, " Publishing ") + clr2(C2.bold, pkg.name + "@" + pkg.version) + " ...");
|
|
8821
|
+
console.log();
|
|
8822
|
+
info("Building package...");
|
|
8823
|
+
info("Checking flux.json...");
|
|
8824
|
+
if (!pkg.name) {
|
|
8825
|
+
err("flux.json must have a name field");
|
|
8826
|
+
return;
|
|
8827
|
+
}
|
|
8828
|
+
if (!pkg.version) {
|
|
8829
|
+
err("flux.json must have a version field");
|
|
8830
|
+
return;
|
|
8831
|
+
}
|
|
8832
|
+
console.log();
|
|
8833
|
+
ok("Package ready: " + pkg.name + "@" + pkg.version);
|
|
8834
|
+
info("Run: npm publish to publish to the npm registry");
|
|
8835
|
+
info("Run: flux publish --registry <url> for a custom registry");
|
|
8836
|
+
console.log();
|
|
8837
|
+
}
|
|
8838
|
+
module2.exports.cmdPublish = cmdPublish2;
|
|
8839
|
+
}
|
|
8840
|
+
});
|
|
8841
|
+
|
|
8456
8842
|
// src/cli.js
|
|
8457
8843
|
var fs = require("fs");
|
|
8458
8844
|
var path = require("path");
|
|
@@ -9888,6 +10274,58 @@ function main() {
|
|
|
9888
10274
|
cmdSelfHosted(subArg);
|
|
9889
10275
|
break;
|
|
9890
10276
|
}
|
|
10277
|
+
case "add": {
|
|
10278
|
+
const { cmdAdd } = require_pkg();
|
|
10279
|
+
const pkgSpecs = process.argv.slice(3).filter((a) => !a.startsWith("-"));
|
|
10280
|
+
const isDev = process.argv.includes("--dev");
|
|
10281
|
+
if (!pkgSpecs.length) {
|
|
10282
|
+
console.error(clr(C.red, "Specify a package: flux add <package>"));
|
|
10283
|
+
process.exit(1);
|
|
10284
|
+
}
|
|
10285
|
+
cmdAdd(pkgSpecs, { dev: isDev });
|
|
10286
|
+
break;
|
|
10287
|
+
}
|
|
10288
|
+
case "remove": {
|
|
10289
|
+
const { cmdRemove } = require_pkg();
|
|
10290
|
+
const pkgNames = process.argv.slice(3).filter((a) => !a.startsWith("-"));
|
|
10291
|
+
if (!pkgNames.length) {
|
|
10292
|
+
console.error(clr(C.red, "Specify a package: flux remove <package>"));
|
|
10293
|
+
process.exit(1);
|
|
10294
|
+
}
|
|
10295
|
+
cmdRemove(pkgNames, {});
|
|
10296
|
+
break;
|
|
10297
|
+
}
|
|
10298
|
+
case "install": {
|
|
10299
|
+
const { cmdInstall } = require_pkg();
|
|
10300
|
+
const isGlobal = process.argv.includes("--global") || process.argv.includes("-g");
|
|
10301
|
+
cmdInstall({ global: isGlobal });
|
|
10302
|
+
break;
|
|
10303
|
+
}
|
|
10304
|
+
case "search": {
|
|
10305
|
+
const { cmdSearch } = require_pkg();
|
|
10306
|
+
const query = process.argv.slice(3).filter((a) => !a.startsWith("-")).join(" ");
|
|
10307
|
+
if (!query) {
|
|
10308
|
+
console.error(clr(C.red, "Specify a query: flux search <query>"));
|
|
10309
|
+
process.exit(1);
|
|
10310
|
+
}
|
|
10311
|
+
cmdSearch(query, {});
|
|
10312
|
+
break;
|
|
10313
|
+
}
|
|
10314
|
+
case "info": {
|
|
10315
|
+
const { cmdInfo } = require_pkg();
|
|
10316
|
+
const pkgName = process.argv[3];
|
|
10317
|
+
if (!pkgName) {
|
|
10318
|
+
console.error(clr(C.red, "Specify a package: flux info <package>"));
|
|
10319
|
+
process.exit(1);
|
|
10320
|
+
}
|
|
10321
|
+
cmdInfo(pkgName, {});
|
|
10322
|
+
break;
|
|
10323
|
+
}
|
|
10324
|
+
case "list": {
|
|
10325
|
+
const { cmdList } = require_pkg();
|
|
10326
|
+
cmdList({});
|
|
10327
|
+
break;
|
|
10328
|
+
}
|
|
9891
10329
|
case "repl":
|
|
9892
10330
|
case void 0:
|
|
9893
10331
|
if (!cmd) {
|
package/dist/flux.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* flux-lang v3.4.
|
|
2
|
+
* flux-lang v3.4.3
|
|
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
|
|
@@ -7285,7 +7285,20 @@ var require_config = __commonJS({
|
|
|
7285
7285
|
function defineConfig2(config) {
|
|
7286
7286
|
return config;
|
|
7287
7287
|
}
|
|
7288
|
-
|
|
7288
|
+
function matchIgnore(filePath, patterns) {
|
|
7289
|
+
if (!patterns || patterns.length === 0) return false;
|
|
7290
|
+
const normalize = (p) => p.replace(/\\/g, "/");
|
|
7291
|
+
const fp = normalize(filePath);
|
|
7292
|
+
for (const pattern of patterns) {
|
|
7293
|
+
let re = normalize(pattern).replace(/\*\*/g, "\0DS\0");
|
|
7294
|
+
re = re.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
7295
|
+
re = re.replace(/\*/g, "[^/]*");
|
|
7296
|
+
re = re.replace(/\x00DS\x00\//g, "(.+/)?").replace(/\x00DS\x00/g, ".*");
|
|
7297
|
+
if (new RegExp("(^|/)" + re + "$").test(fp)) return true;
|
|
7298
|
+
}
|
|
7299
|
+
return false;
|
|
7300
|
+
}
|
|
7301
|
+
module2.exports = { loadConfig: loadConfig2, mergeConfig: mergeConfig2, defineConfig: defineConfig2, matchIgnore };
|
|
7289
7302
|
}
|
|
7290
7303
|
});
|
|
7291
7304
|
|
package/dist/flux.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* flux-lang v3.4.
|
|
2
|
+
* flux-lang v3.4.3
|
|
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
|
|
@@ -7290,7 +7290,20 @@ var require_config = __commonJS({
|
|
|
7290
7290
|
function defineConfig(config) {
|
|
7291
7291
|
return config;
|
|
7292
7292
|
}
|
|
7293
|
-
|
|
7293
|
+
function matchIgnore(filePath, patterns) {
|
|
7294
|
+
if (!patterns || patterns.length === 0) return false;
|
|
7295
|
+
const normalize = (p) => p.replace(/\\/g, "/");
|
|
7296
|
+
const fp = normalize(filePath);
|
|
7297
|
+
for (const pattern of patterns) {
|
|
7298
|
+
let re = normalize(pattern).replace(/\*\*/g, "\0DS\0");
|
|
7299
|
+
re = re.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
7300
|
+
re = re.replace(/\*/g, "[^/]*");
|
|
7301
|
+
re = re.replace(/\x00DS\x00\//g, "(.+/)?").replace(/\x00DS\x00/g, ".*");
|
|
7302
|
+
if (new RegExp("(^|/)" + re + "$").test(fp)) return true;
|
|
7303
|
+
}
|
|
7304
|
+
return false;
|
|
7305
|
+
}
|
|
7306
|
+
module.exports = { loadConfig, mergeConfig, defineConfig, matchIgnore };
|
|
7294
7307
|
}
|
|
7295
7308
|
});
|
|
7296
7309
|
|