mbler 0.2.7-rc.4 → 0.2.7-rc.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/build.d.ts CHANGED
@@ -68,7 +68,6 @@ declare class Build {
68
68
  currentConfig: MblerConfigData | null;
69
69
  srcDirs: { [key in 'behavior' | 'resources']: string } | null;
70
70
  outdirs: { [key in 'behavior' | 'resources' | 'dist']: string } | null;
71
- mcxTs: typeof import('typescript');
72
71
  mcxLanguagePluginCreator: ((ts: typeof import('typescript')) => LanguagePlugin<unknown>) | null;
73
72
  constructor(opts: Record<string, string>, baseBuildDir: string, resolve: (a: number) => void, isWatch?: boolean);
74
73
  /**
@@ -11,11 +11,10 @@ import * as readline from "readline";
11
11
  import * as fs$2 from "node:fs";
12
12
  import fs$1 from "node:fs";
13
13
  import os, { homedir, tmpdir } from "node:os";
14
- import _chalk from "chalk";
15
14
  import crypto from "node:crypto";
16
15
  import { env } from "node:process";
16
+ import { styleText } from "node:util";
17
17
  import { createMCXLanguagePlugin } from "@mbler/mcx-server";
18
- import ts from "typescript";
19
18
  import { runTsc } from "@volar/typescript/lib/quickstart/runTsc.js";
20
19
  //#region \0rolldown/runtime.js
21
20
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
@@ -69,13 +68,19 @@ const templateMblerConfig = {
69
68
  //#endregion
70
69
  //#region src/version.ts
71
70
  var version_default = {
72
- commit: `commit 53a3a7ef95de3fc1e7256ff30fee7a8f6f86cf00
71
+ commit: `commit 85f665dae2e6951b64fd1f021a8bb151c5776b15
73
72
  Author: ruanhor <3915264929@qq.com>
74
- Date: Sat Jun 13 18:11:33 2026 +0800
73
+ Date: Sat Jun 13 22:04:15 2026 +0800
75
74
 
76
- chore: let @@mbler/mcx-server dep to 0.1.1-rc.1
75
+ refactor(cli): add declarative command framework with typed params
76
+
77
+ - Add src/cli/command.ts with CommandDef, parseArgs, parseRawParams
78
+ - Refactor CLI dispatcher to use CommandDef-based dispatch
79
+ - Convert all 11 command handlers to declarative CommandDef format
80
+ - Fix parseParam to handle -flag=value correctly
81
+ - Add 63 new tests for CLI framework and publisher modules
77
82
  `,
78
- version: "0.2.7-rc.3"
83
+ version: "0.2.7-rc.4"
79
84
  };
80
85
  //#endregion
81
86
  //#region src/i18n/zh.ts
@@ -588,7 +593,6 @@ const BuildConfig = {
588
593
  };
589
594
  //#endregion
590
595
  //#region src/utils/index.ts
591
- const chalk = _chalk instanceof Function ? _chalk : _chalk.default;
592
596
  async function FileExist(file) {
593
597
  try {
594
598
  if (await fs$3.stat(file)) return true;
@@ -757,7 +761,9 @@ const config = {
757
761
  * Returns negative if a < b, positive if a > b, zero if equal.
758
762
  */
759
763
  const Sapi = function() {
760
- const { json } = __require("npm-registry-fetch");
764
+ async function json(path) {
765
+ return await (await fetch("https://registry.npmjs.com" + path)).json();
766
+ }
761
767
  const cacheFile = path$1.join(config.tmpdir, "_sapi_version.json");
762
768
  let cacheData = null;
763
769
  /**
@@ -973,7 +979,7 @@ var Postgress = class {
973
979
  const barWidth = 30;
974
980
  const filledWidth = Math.round(barWidth * percentage);
975
981
  const emptyWidth = barWidth - filledWidth;
976
- showText(`\n\u001B[1A\r[${`${chalk.green("█".repeat(filledWidth))}${chalk.white("█".repeat(emptyWidth))}`}] ${chalk.blue(`${Math.round(percentage * 100)}%`)} (${current}/${this.max})`, false);
982
+ showText(`\n\u001B[1A\r[${`${styleText("green", "█".repeat(filledWidth))}${styleText("white", "█".repeat(emptyWidth))}`}] ${styleText("blue", `${Math.round(percentage * 100)}%`)} (${current}/${this.max})`, false);
977
983
  if (current == this.max) showText("", true);
978
984
  }
979
985
  };
@@ -1011,20 +1017,11 @@ var Build = class {
1011
1017
  currentConfig = null;
1012
1018
  srcDirs = null;
1013
1019
  outdirs = null;
1014
- mcxTs;
1015
1020
  mcxLanguagePluginCreator = null;
1016
1021
  constructor(opts, baseBuildDir, resolve, isWatch = false) {
1017
1022
  this.baseBuildDir = baseBuildDir;
1018
1023
  this.resolve = resolve;
1019
1024
  this.isWatch = isWatch;
1020
- try {
1021
- const tsModule = ts;
1022
- this.mcxLanguagePluginCreator = createMCXLanguagePlugin;
1023
- this.mcxTs = tsModule;
1024
- } catch (error) {
1025
- this.mcxTs = ts;
1026
- Logger.w("Build", `Failed to initialize MCX language plugin: ${error}`);
1027
- }
1028
1025
  }
1029
1026
  /**
1030
1027
  * Start the watch mode.
@@ -1181,7 +1178,7 @@ var Build = class {
1181
1178
  if (!this.isWatch) progress.update(100);
1182
1179
  if (!this.isWatch) {
1183
1180
  const elapsed = ((performance.now() - buildStart) / 1e3).toFixed(2);
1184
- showText(`[${chalk.green("mbler")}] ${chalk.green(`✓ built in ${elapsed}s`)}`);
1181
+ showText(`[${styleText("green", "mbler")}] ${styleText("green", `✓ built in ${elapsed}s`)}`);
1185
1182
  this.resolve(0);
1186
1183
  }
1187
1184
  }
@@ -1213,7 +1210,7 @@ var Build = class {
1213
1210
  moduleDir,
1214
1211
  tsconfigPath,
1215
1212
  sourcemap: false,
1216
- ts: this.mcxTs
1213
+ ts: await import("typescript")
1217
1214
  };
1218
1215
  if (this.mcxLanguagePluginCreator) pluginConfig.mcxLanguagePlugin = this.mcxLanguagePluginCreator;
1219
1216
  plugin.push(mcxDef.rolldownPlugin(pluginConfig, this.outdirs));
@@ -1376,7 +1373,7 @@ var Build = class {
1376
1373
  if (isBehaviorChange) await handlerBP();
1377
1374
  if (isResourcesChange) await handlerRP();
1378
1375
  }
1379
- showText(`[${chalk.green("mbler")}] ${chalk.bgYellow(`file changed: ${filePath}`)}`);
1376
+ showText(`[${styleText("green", "mbler")}] ${styleText("bgYellow", `file changed: ${filePath}`)}`);
1380
1377
  }
1381
1378
  async createWatcher() {
1382
1379
  const isBundle = this.currentConfig?.build?.bundle !== false;
@@ -1520,7 +1517,7 @@ function watch(cliParam, work) {
1520
1517
  const build = new Build(cliParam.opts, work, resolve, true);
1521
1518
  build.start().then(() => {
1522
1519
  build.watch();
1523
- showText(`[${chalk.green("mbler")}] ${chalk.bgYellow("watching for file changes...")}`);
1520
+ showText(`[${styleText("green", "mbler")}] ${styleText("bgYellow", "watching for file changes...")}`);
1524
1521
  });
1525
1522
  } catch (err) {
1526
1523
  if (err instanceof Error) reject(`[watcher]: error ${err.stack || err.message}`);