@wolfstar/cli 0.1.0-next-20260904111115
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/LICENSE +201 -0
- package/README.md +151 -0
- package/dist/args-Ch1KXUMn.js +24 -0
- package/dist/args-Ch1KXUMn.js.map +1 -0
- package/dist/build-Ct6zabKg.js +22 -0
- package/dist/build-Ct6zabKg.js.map +1 -0
- package/dist/build-DU76s-Ec.js +39 -0
- package/dist/build-DU76s-Ec.js.map +1 -0
- package/dist/builders-BzLMIm9Y.js +44 -0
- package/dist/builders-BzLMIm9Y.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +58 -0
- package/dist/cli.js.map +1 -0
- package/dist/codegen-DjPOn7cp.js +95 -0
- package/dist/codegen-DjPOn7cp.js.map +1 -0
- package/dist/codegen-mYkL-GBf.js +36 -0
- package/dist/codegen-mYkL-GBf.js.map +1 -0
- package/dist/commands-BkGKs_Bg.js +88 -0
- package/dist/commands-BkGKs_Bg.js.map +1 -0
- package/dist/commands-Dw2LFWV-.js +233 -0
- package/dist/commands-Dw2LFWV-.js.map +1 -0
- package/dist/dev-DWg8l23a.js +604 -0
- package/dist/dev-DWg8l23a.js.map +1 -0
- package/dist/dev-QUxuLcXj.js +30 -0
- package/dist/dev-QUxuLcXj.js.map +1 -0
- package/dist/errors-Bket6XFn.js +50 -0
- package/dist/errors-Bket6XFn.js.map +1 -0
- package/dist/external-Bk4EESdT.js +59 -0
- package/dist/external-Bk4EESdT.js.map +1 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/info-B-8rAIn6.js +106 -0
- package/dist/info-B-8rAIn6.js.map +1 -0
- package/dist/info-DRTYYvVB.js +30 -0
- package/dist/info-DRTYYvVB.js.map +1 -0
- package/dist/none-DEo7zEr9.js +50 -0
- package/dist/none-DEo7zEr9.js.map +1 -0
- package/dist/output-mode-ChrOf0LO.js +46 -0
- package/dist/output-mode-ChrOf0LO.js.map +1 -0
- package/dist/plain-CEe4X_Cz.js +43 -0
- package/dist/plain-CEe4X_Cz.js.map +1 -0
- package/dist/prepare-BXcm2Ukp.js +3 -0
- package/dist/prepare-CVf88_Or.js +36 -0
- package/dist/prepare-CVf88_Or.js.map +1 -0
- package/dist/prepare-D5NZ0w4t.js +68 -0
- package/dist/prepare-D5NZ0w4t.js.map +1 -0
- package/dist/process-supervisor-CJOdmp0W.js +128 -0
- package/dist/process-supervisor-CJOdmp0W.js.map +1 -0
- package/dist/project-DHF3qdm-.js +66 -0
- package/dist/project-DHF3qdm-.js.map +1 -0
- package/dist/tsc-BqZfDTD0.js +133 -0
- package/dist/tsc-BqZfDTD0.js.map +1 -0
- package/dist/tsc-CovVAtfo.js +3 -0
- package/dist/tsdown-DlAs0rSI.js +104 -0
- package/dist/tsdown-DlAs0rSI.js.map +1 -0
- package/dist/tui-BTRFsLQR.js +770 -0
- package/dist/tui-BTRFsLQR.js.map +1 -0
- package/dist/tunnel-B8Id4-lR.js +205 -0
- package/dist/tunnel-B8Id4-lR.js.map +1 -0
- package/dist/version-DN6Uho-Y.js +30 -0
- package/dist/version-DN6Uho-Y.js.map +1 -0
- package/dist/vite-D3vYFsqa.js +93 -0
- package/dist/vite-D3vYFsqa.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as projectArgs } from "./args-Ch1KXUMn.js";
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/dev.ts
|
|
5
|
+
var dev_default = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "dev",
|
|
8
|
+
description: "Build, run and restart the bot on changes"
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
...projectArgs,
|
|
12
|
+
tui: {
|
|
13
|
+
type: "boolean",
|
|
14
|
+
description: "Interactive terminal UI; use --no-tui (or STARS_TUI=plain) for plain line output",
|
|
15
|
+
default: true
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
async run({ args }) {
|
|
19
|
+
const { runDev } = await import("./dev-DWg8l23a.js");
|
|
20
|
+
await runDev({
|
|
21
|
+
config: args.config,
|
|
22
|
+
cwd: args.cwd,
|
|
23
|
+
tui: args.tui ? void 0 : false
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { dev_default as default };
|
|
30
|
+
//# sourceMappingURL=dev-QUxuLcXj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-QUxuLcXj.js","names":[],"sources":["../src/commands/dev.ts"],"sourcesContent":["import { defineCommand } from 'citty';\nimport { projectArgs } from '../lib/args.js';\n\nexport default defineCommand({\n\tmeta: {\n\t\tname: 'dev',\n\t\tdescription: 'Build, run and restart the bot on changes'\n\t},\n\targs: {\n\t\t...projectArgs,\n\t\ttui: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Interactive terminal UI; use --no-tui (or STARS_TUI=plain) for plain line output',\n\t\t\tdefault: true\n\t\t}\n\t},\n\tasync run({ args }) {\n\t\tconst { runDev } = await import('../lib/tasks/dev.js');\n\t\tawait runDev({ config: args.config, cwd: args.cwd, tui: args.tui ? undefined : false });\n\t}\n});\n"],"mappings":";;;;AAGA,kBAAe,cAAc;CAC5B,MAAM;EACL,MAAM;EACN,aAAa;CACd;CACA,MAAM;EACL,GAAG;EACH,KAAK;GACJ,MAAM;GACN,aAAa;GACb,SAAS;EACV;CACD;CACA,MAAM,IAAI,EAAE,QAAQ;EACnB,MAAM,EAAE,WAAW,MAAM,OAAO;EAChC,MAAM,OAAO;GAAE,QAAQ,KAAK;GAAQ,KAAK,KAAK;GAAK,KAAK,KAAK,MAAM,SAAY;EAAM,CAAC;CACvF;AACD,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ConfigError } from "@wolfstar/http-framework/config";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/errors.ts
|
|
4
|
+
const ExitCode = {
|
|
5
|
+
Ok: 0,
|
|
6
|
+
Error: 1,
|
|
7
|
+
InvalidConfig: 2,
|
|
8
|
+
BuildFailed: 3,
|
|
9
|
+
Interrupted: 130,
|
|
10
|
+
Terminated: 143
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* An error the CLI reports to the user without a stack trace.
|
|
14
|
+
*/
|
|
15
|
+
var CliError = class extends Error {
|
|
16
|
+
code;
|
|
17
|
+
hint;
|
|
18
|
+
exitCode;
|
|
19
|
+
constructor(message, options) {
|
|
20
|
+
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
21
|
+
this.name = "CliError";
|
|
22
|
+
this.code = options.code;
|
|
23
|
+
this.hint = options.hint ?? null;
|
|
24
|
+
this.exitCode = options.exitCode ?? ExitCode.Error;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Formats an error for the terminal: message, optional location and hint.
|
|
29
|
+
*
|
|
30
|
+
* `ConfigError` comes from `@wolfstar/http-framework/config`: the framework validates `stars.config.*` and throws a
|
|
31
|
+
* plain data error, the CLI decides how it looks on a terminal and which exit code it gets ({@link exitCodeOf}).
|
|
32
|
+
*/
|
|
33
|
+
function formatError(error) {
|
|
34
|
+
if (error instanceof ConfigError) {
|
|
35
|
+
const location = [error.file, error.path ? `option \`${error.path}\`` : null].filter(Boolean).join(" › ");
|
|
36
|
+
return [`${error.message}${location ? ` (${location})` : ""}`, error.hint ? ` hint: ${error.hint}` : null].filter(Boolean).join("\n");
|
|
37
|
+
}
|
|
38
|
+
if (error instanceof CliError) return [error.message, error.hint ? ` hint: ${error.hint}` : null].filter(Boolean).join("\n");
|
|
39
|
+
if (error instanceof Error && error.name === "CLIError") return error.message;
|
|
40
|
+
if (error instanceof Error) return error.stack ?? error.message;
|
|
41
|
+
return String(error);
|
|
42
|
+
}
|
|
43
|
+
function exitCodeOf(error) {
|
|
44
|
+
if (error instanceof ConfigError) return ExitCode.InvalidConfig;
|
|
45
|
+
return error instanceof CliError ? error.exitCode : ExitCode.Error;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { formatError as i, ExitCode as n, exitCodeOf as r, CliError as t };
|
|
50
|
+
//# sourceMappingURL=errors-Bket6XFn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-Bket6XFn.js","names":[],"sources":["../src/lib/errors.ts"],"sourcesContent":["import { ConfigError } from '@wolfstar/http-framework/config';\n\nexport const ExitCode = {\n\tOk: 0,\n\tError: 1,\n\tInvalidConfig: 2,\n\tBuildFailed: 3,\n\tInterrupted: 130,\n\tTerminated: 143\n} as const;\n\nexport type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];\n\nexport interface CliErrorOptions {\n\t/** A stable, machine readable code. */\n\tcode: string;\n\t/** A short, actionable suggestion. */\n\thint?: string;\n\texitCode?: ExitCode;\n\tcause?: unknown;\n}\n\n/**\n * An error the CLI reports to the user without a stack trace.\n */\nexport class CliError extends Error {\n\tpublic readonly code: string;\n\tpublic readonly hint: string | null;\n\tpublic readonly exitCode: ExitCode;\n\n\tpublic constructor(message: string, options: CliErrorOptions) {\n\t\tsuper(message, options.cause === undefined ? undefined : { cause: options.cause });\n\t\tthis.name = 'CliError';\n\t\tthis.code = options.code;\n\t\tthis.hint = options.hint ?? null;\n\t\tthis.exitCode = options.exitCode ?? ExitCode.Error;\n\t}\n}\n\n/**\n * Formats an error for the terminal: message, optional location and hint.\n *\n * `ConfigError` comes from `@wolfstar/http-framework/config`: the framework validates `stars.config.*` and throws a\n * plain data error, the CLI decides how it looks on a terminal and which exit code it gets ({@link exitCodeOf}).\n */\nexport function formatError(error: unknown): string {\n\tif (error instanceof ConfigError) {\n\t\tconst location = [error.file, error.path ? `option \\`${error.path}\\`` : null].filter(Boolean).join(' › ');\n\t\treturn [`${error.message}${location ? ` (${location})` : ''}`, error.hint ? ` hint: ${error.hint}` : null].filter(Boolean).join('\\n');\n\t}\n\n\tif (error instanceof CliError) {\n\t\treturn [error.message, error.hint ? ` hint: ${error.hint}` : null].filter(Boolean).join('\\n');\n\t}\n\n\t// citty's CLIError (unknown command, missing argument): the message is enough.\n\tif (error instanceof Error && error.name === 'CLIError') return error.message;\n\tif (error instanceof Error) return error.stack ?? error.message;\n\treturn String(error);\n}\n\nexport function exitCodeOf(error: unknown): ExitCode {\n\tif (error instanceof ConfigError) return ExitCode.InvalidConfig;\n\treturn error instanceof CliError ? error.exitCode : ExitCode.Error;\n}\n"],"mappings":";;;AAEA,MAAa,WAAW;CACvB,IAAI;CACJ,OAAO;CACP,eAAe;CACf,aAAa;CACb,aAAa;CACb,YAAY;AACb;;;;AAgBA,IAAa,WAAb,cAA8B,MAAM;CACnC,AAAgB;CAChB,AAAgB;CAChB,AAAgB;CAEhB,AAAO,YAAY,SAAiB,SAA0B;EAC7D,MAAM,SAAS,QAAQ,UAAU,SAAY,SAAY,EAAE,OAAO,QAAQ,MAAM,CAAC;EACjF,KAAK,OAAO;EACZ,KAAK,OAAO,QAAQ;EACpB,KAAK,OAAO,QAAQ,QAAQ;EAC5B,KAAK,WAAW,QAAQ,YAAY,SAAS;CAC9C;AACD;;;;;;;AAQA,SAAgB,YAAY,OAAwB;CACnD,IAAI,iBAAiB,aAAa;EACjC,MAAM,WAAW,CAAC,MAAM,MAAM,MAAM,OAAO,YAAY,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK;EACxG,OAAO,CAAC,GAAG,MAAM,UAAU,WAAW,KAAK,SAAS,KAAK,MAAM,MAAM,OAAO,WAAW,MAAM,SAAS,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;CACtI;CAEA,IAAI,iBAAiB,UACpB,OAAO,CAAC,MAAM,SAAS,MAAM,OAAO,WAAW,MAAM,SAAS,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;CAI9F,IAAI,iBAAiB,SAAS,MAAM,SAAS,YAAY,OAAO,MAAM;CACtE,IAAI,iBAAiB,OAAO,OAAO,MAAM,SAAS,MAAM;CACxD,OAAO,OAAO,KAAK;AACpB;AAEA,SAAgB,WAAW,OAA0B;CACpD,IAAI,iBAAiB,aAAa,OAAO,SAAS;CAClD,OAAO,iBAAiB,WAAW,MAAM,WAAW,SAAS;AAC9D"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { displayPath } from "@wolfstar/http-framework/config";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/builders/external.ts
|
|
6
|
+
/**
|
|
7
|
+
* Runs no build of its own: the project drives one itself (`vite dev`, `vite build --watch`, a task runner, …) and
|
|
8
|
+
* this only watches what that build writes, restarting the bot whenever the output changes.
|
|
9
|
+
*
|
|
10
|
+
* This is what `experimental.enableExternalVite` selects — the CLI stays out of the build's way but keeps the rest
|
|
11
|
+
* of `stars dev` (restarts, health, tunnel, type checking, the panel) working.
|
|
12
|
+
*/
|
|
13
|
+
var ExternalBuilder = class extends EventEmitter {
|
|
14
|
+
config;
|
|
15
|
+
tool;
|
|
16
|
+
#watcher = null;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
super();
|
|
19
|
+
this.config = config;
|
|
20
|
+
this.tool = config.build.tool;
|
|
21
|
+
}
|
|
22
|
+
build() {
|
|
23
|
+
this.emit("start");
|
|
24
|
+
const outcome = {
|
|
25
|
+
ok: true,
|
|
26
|
+
durationMs: 0,
|
|
27
|
+
message: null
|
|
28
|
+
};
|
|
29
|
+
this.emit("success", outcome);
|
|
30
|
+
return Promise.resolve(outcome);
|
|
31
|
+
}
|
|
32
|
+
async watch() {
|
|
33
|
+
const { watch } = await import("chokidar");
|
|
34
|
+
const target = dirname(this.config.build.output);
|
|
35
|
+
this.emit("log", "info", `Watching ${displayPath(this.config.root, target)} for an external build`);
|
|
36
|
+
const watcher = watch(target, {
|
|
37
|
+
ignored: [...this.config.dev.ignore],
|
|
38
|
+
ignoreInitial: true,
|
|
39
|
+
cwd: this.config.root
|
|
40
|
+
});
|
|
41
|
+
this.#watcher = watcher;
|
|
42
|
+
watcher.on("all", (event, path) => {
|
|
43
|
+
this.emit("log", "info", `${event}: ${path}`);
|
|
44
|
+
this.build();
|
|
45
|
+
});
|
|
46
|
+
watcher.on("error", (error) => this.emit("log", "error", error instanceof Error ? error.message : String(error)));
|
|
47
|
+
await new Promise((resolve) => watcher.once("ready", resolve));
|
|
48
|
+
await this.build();
|
|
49
|
+
}
|
|
50
|
+
async close() {
|
|
51
|
+
const watcher = this.#watcher;
|
|
52
|
+
this.#watcher = null;
|
|
53
|
+
await watcher?.close();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { ExternalBuilder };
|
|
59
|
+
//# sourceMappingURL=external-Bk4EESdT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-Bk4EESdT.js","names":["#watcher"],"sources":["../src/lib/builders/external.ts"],"sourcesContent":["import type { ResolvedStarsConfig, StarsBuildTool } from '@wolfstar/http-framework/config';\nimport { dirname } from 'node:path';\nimport { EventEmitter } from 'node:events';\nimport { displayPath } from '@wolfstar/http-framework/config';\nimport type { Builder, BuilderEvents, BuildOutcome } from './types.js';\n\n/**\n * Runs no build of its own: the project drives one itself (`vite dev`, `vite build --watch`, a task runner, …) and\n * this only watches what that build writes, restarting the bot whenever the output changes.\n *\n * This is what `experimental.enableExternalVite` selects — the CLI stays out of the build's way but keeps the rest\n * of `stars dev` (restarts, health, tunnel, type checking, the panel) working.\n */\nexport class ExternalBuilder extends EventEmitter<BuilderEvents> implements Builder {\n\tpublic readonly tool: StarsBuildTool;\n\t#watcher: { close(): Promise<void> } | null = null;\n\n\tpublic constructor(private readonly config: ResolvedStarsConfig) {\n\t\tsuper();\n\t\tthis.tool = config.build.tool;\n\t}\n\n\tpublic build(): Promise<BuildOutcome> {\n\t\tthis.emit('start');\n\t\tconst outcome: BuildOutcome = { ok: true, durationMs: 0, message: null };\n\t\tthis.emit('success', outcome);\n\t\treturn Promise.resolve(outcome);\n\t}\n\n\tpublic async watch(): Promise<void> {\n\t\tconst { watch } = await import('chokidar');\n\t\tconst target = dirname(this.config.build.output);\n\t\tthis.emit('log', 'info', `Watching ${displayPath(this.config.root, target)} for an external build`);\n\n\t\tconst watcher = watch(target, { ignored: [...this.config.dev.ignore], ignoreInitial: true, cwd: this.config.root });\n\t\tthis.#watcher = watcher;\n\n\t\twatcher.on('all', (event, path) => {\n\t\t\tthis.emit('log', 'info', `${event}: ${path}`);\n\t\t\tvoid this.build();\n\t\t});\n\t\twatcher.on('error', (error) => this.emit('log', 'error', error instanceof Error ? error.message : String(error)));\n\n\t\tawait new Promise<void>((resolve) => watcher.once('ready', resolve));\n\t\tawait this.build();\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tconst watcher = this.#watcher;\n\t\tthis.#watcher = null;\n\t\tawait watcher?.close();\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAa,kBAAb,cAAqC,aAA+C;CAI/C;CAHpC,AAAgB;CAChB,WAA8C;CAE9C,AAAO,YAAY,AAAiB,QAA6B;EAChE,MAAM;EAD6B;EAEnC,KAAK,OAAO,OAAO,MAAM;CAC1B;CAEA,AAAO,QAA+B;EACrC,KAAK,KAAK,OAAO;EACjB,MAAM,UAAwB;GAAE,IAAI;GAAM,YAAY;GAAG,SAAS;EAAK;EACvE,KAAK,KAAK,WAAW,OAAO;EAC5B,OAAO,QAAQ,QAAQ,OAAO;CAC/B;CAEA,MAAa,QAAuB;EACnC,MAAM,EAAE,UAAU,MAAM,OAAO;EAC/B,MAAM,SAAS,QAAQ,KAAK,OAAO,MAAM,MAAM;EAC/C,KAAK,KAAK,OAAO,QAAQ,YAAY,YAAY,KAAK,OAAO,MAAM,MAAM,EAAE,uBAAuB;EAElG,MAAM,UAAU,MAAM,QAAQ;GAAE,SAAS,CAAC,GAAG,KAAK,OAAO,IAAI,MAAM;GAAG,eAAe;GAAM,KAAK,KAAK,OAAO;EAAK,CAAC;EAClH,KAAKA,WAAW;EAEhB,QAAQ,GAAG,QAAQ,OAAO,SAAS;GAClC,KAAK,KAAK,OAAO,QAAQ,GAAG,MAAM,IAAI,MAAM;GAC5C,AAAK,KAAK,MAAM;EACjB,CAAC;EACD,QAAQ,GAAG,UAAU,UAAU,KAAK,KAAK,OAAO,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC;EAEhH,MAAM,IAAI,SAAe,YAAY,QAAQ,KAAK,SAAS,OAAO,CAAC;EACnE,MAAM,KAAK,MAAM;CAClB;CAEA,MAAa,QAAuB;EACnC,MAAM,UAAU,KAAKA;EACrB,KAAKA,WAAW;EAChB,MAAM,SAAS,MAAM;CACtB;AACD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ConfigError, ConfigErrorOptions, ResolvedStarsConfig, loadStarsConfig } from "@wolfstar/http-framework/config";
|
|
2
|
+
//#region src/lib/errors.d.ts
|
|
3
|
+
declare const ExitCode: {
|
|
4
|
+
readonly Ok: 0;
|
|
5
|
+
readonly Error: 1;
|
|
6
|
+
readonly InvalidConfig: 2;
|
|
7
|
+
readonly BuildFailed: 3;
|
|
8
|
+
readonly Interrupted: 130;
|
|
9
|
+
readonly Terminated: 143;
|
|
10
|
+
};
|
|
11
|
+
type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
|
|
12
|
+
interface CliErrorOptions {
|
|
13
|
+
/** A stable, machine readable code. */
|
|
14
|
+
code: string;
|
|
15
|
+
/** A short, actionable suggestion. */
|
|
16
|
+
hint?: string;
|
|
17
|
+
exitCode?: ExitCode;
|
|
18
|
+
cause?: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An error the CLI reports to the user without a stack trace.
|
|
22
|
+
*/
|
|
23
|
+
declare class CliError extends Error {
|
|
24
|
+
readonly code: string;
|
|
25
|
+
readonly hint: string | null;
|
|
26
|
+
readonly exitCode: ExitCode;
|
|
27
|
+
constructor(message: string, options: CliErrorOptions);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Formats an error for the terminal: message, optional location and hint.
|
|
31
|
+
*
|
|
32
|
+
* `ConfigError` comes from `@wolfstar/http-framework/config`: the framework validates `stars.config.*` and throws a
|
|
33
|
+
* plain data error, the CLI decides how it looks on a terminal and which exit code it gets ({@link exitCodeOf}).
|
|
34
|
+
*/
|
|
35
|
+
declare function formatError(error: unknown): string;
|
|
36
|
+
declare function exitCodeOf(error: unknown): ExitCode;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/lib/output-mode.d.ts
|
|
39
|
+
type OutputMode = 'tui' | 'plain';
|
|
40
|
+
interface ResolveOutputModeOptions {
|
|
41
|
+
/** `--no-tui` (`tui: false`) or `--tui` (`tui: true`) from the command line. */
|
|
42
|
+
tui?: boolean;
|
|
43
|
+
env?: NodeJS.ProcessEnv;
|
|
44
|
+
/** Whether stdout is an interactive terminal. */
|
|
45
|
+
isTTY?: boolean;
|
|
46
|
+
/** Whether the process runs in a CI environment. */
|
|
47
|
+
isCI?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Decides between the interactive TUI and plain line output.
|
|
51
|
+
*
|
|
52
|
+
* Precedence: `--no-tui` › `STARS_TUI=plain` › non-interactive stdout, CI or `TERM=dumb`.
|
|
53
|
+
*/
|
|
54
|
+
declare function resolveOutputMode(options?: ResolveOutputModeOptions): OutputMode;
|
|
55
|
+
declare function isCIEnvironment(env?: NodeJS.ProcessEnv): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether colours should be emitted, honouring `NO_COLOR` and `FORCE_COLOR`.
|
|
58
|
+
*/
|
|
59
|
+
declare function shouldUseColor(env?: NodeJS.ProcessEnv, isTTY?: boolean): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether animations (spinners, blinking status) should be avoided.
|
|
62
|
+
*/
|
|
63
|
+
declare function prefersReducedMotion(env?: NodeJS.ProcessEnv): boolean;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { CliError, type CliErrorOptions, ConfigError, type ConfigErrorOptions, ExitCode, type OutputMode, type ResolveOutputModeOptions, type ResolvedStarsConfig, exitCodeOf, formatError, isCIEnvironment, loadStarsConfig, prefersReducedMotion, resolveOutputMode, shouldUseColor };
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/lib/errors.ts","../src/lib/output-mode.ts"],"mappings":";;cAEa;WACZ;WACA;WACA;WACA;WACA;WACA;;KAGW,mBAAmB,uBAAuB;UAErC;;EAEhB;;EAEA;EACA,WAAW;EACX;;;;;cAMY,iBAAiB;WACb;WACA;WACA,UAAU;EAE1B,YAAmB,iBAAiB,SAAS;;;;;;;;iBAe9B,YAAY;iBAgBZ,WAAW,iBAAiB;;;KC7DhC;UAEK;;EAEhB;EACA,MAAM,OAAO;;EAEb;;EAEA;;;;;;;iBAUe,kBAAkB,UAAS,2BAAgC;iBAgB3D,gBAAgB,MAAK,OAAO;;;;iBAU5B,eAAe,MAAK,OAAO,YAA0B;;;;iBASrD,qBAAqB,MAAK,OAAO"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { i as formatError, n as ExitCode, r as exitCodeOf, t as CliError } from "./errors-Bket6XFn.js";
|
|
2
|
+
import { i as shouldUseColor, n as prefersReducedMotion, r as resolveOutputMode, t as isCIEnvironment } from "./output-mode-ChrOf0LO.js";
|
|
3
|
+
import { ConfigError, loadStarsConfig } from "@wolfstar/http-framework/config";
|
|
4
|
+
|
|
5
|
+
export { CliError, ConfigError, ExitCode, exitCodeOf, formatError, isCIEnvironment, loadStarsConfig, prefersReducedMotion, resolveOutputMode, shouldUseColor };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { t as readOwnPackageJson } from "./version-DN6Uho-Y.js";
|
|
2
|
+
import { i as shouldUseColor, r as resolveOutputMode } from "./output-mode-ChrOf0LO.js";
|
|
3
|
+
import { n as resolveCwd } from "./args-Ch1KXUMn.js";
|
|
4
|
+
import { t as findInstalledVersion } from "./project-DHF3qdm-.js";
|
|
5
|
+
import { displayPath, loadStarsConfig } from "@wolfstar/http-framework/config";
|
|
6
|
+
import { relative } from "node:path";
|
|
7
|
+
import { createColors } from "colorette";
|
|
8
|
+
import { arch, platform } from "node:os";
|
|
9
|
+
|
|
10
|
+
//#region src/lib/tasks/info.ts
|
|
11
|
+
function collectInfo(config) {
|
|
12
|
+
return {
|
|
13
|
+
cli: {
|
|
14
|
+
version: readOwnPackageJson().version,
|
|
15
|
+
node: process.version,
|
|
16
|
+
platform: `${platform()} ${arch()}`,
|
|
17
|
+
outputMode: resolveOutputMode()
|
|
18
|
+
},
|
|
19
|
+
project: {
|
|
20
|
+
cwd: config.cwd,
|
|
21
|
+
root: config.root,
|
|
22
|
+
configFile: config.configFile,
|
|
23
|
+
name: config.packageJson?.name ?? null,
|
|
24
|
+
version: config.packageJson?.version ?? null,
|
|
25
|
+
entry: config.entry,
|
|
26
|
+
frameworkVersion: findInstalledVersion(config.root, "@wolfstar/http-framework")
|
|
27
|
+
},
|
|
28
|
+
build: config.build,
|
|
29
|
+
dev: config.dev,
|
|
30
|
+
codegen: config.codegen,
|
|
31
|
+
imports: config.imports,
|
|
32
|
+
experimental: config.experimental
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function formatInfo(info, useColor) {
|
|
36
|
+
const colors = createColors({ useColor });
|
|
37
|
+
const { root } = info.project;
|
|
38
|
+
const show = (path) => path === null ? colors.dim("none") : displayPath(root, path);
|
|
39
|
+
const row = (label, value) => ` ${colors.dim(label.padEnd(12))}${value}`;
|
|
40
|
+
const section = (title, rows) => [colors.bold(title), ...rows].join("\n");
|
|
41
|
+
return [
|
|
42
|
+
section(`stars ${colors.green(`v${info.cli.version}`)}`, [
|
|
43
|
+
row("node", info.cli.node),
|
|
44
|
+
row("platform", info.cli.platform),
|
|
45
|
+
row("output", info.cli.outputMode),
|
|
46
|
+
row("framework", info.project.frameworkVersion ? `@wolfstar/http-framework v${info.project.frameworkVersion}` : colors.yellow("@wolfstar/http-framework not installed"))
|
|
47
|
+
]),
|
|
48
|
+
section("Project", [
|
|
49
|
+
row("name", info.project.name ? `${info.project.name}${info.project.version ? colors.dim(` v${info.project.version}`) : ""}` : colors.dim("unnamed")),
|
|
50
|
+
row("root", root),
|
|
51
|
+
row("config", info.project.configFile ? relative(root, info.project.configFile) || info.project.configFile : colors.dim("none (defaults)")),
|
|
52
|
+
row("entry", show(info.project.entry))
|
|
53
|
+
]),
|
|
54
|
+
section("Build", [
|
|
55
|
+
row("tool", info.build.tool),
|
|
56
|
+
row("outDir", show(info.build.outDir)),
|
|
57
|
+
row("tsconfig", show(info.build.tsconfig)),
|
|
58
|
+
row("runs", show(info.build.output))
|
|
59
|
+
]),
|
|
60
|
+
section("Dev", [
|
|
61
|
+
row("watch", info.dev.watch.map(show).join(", ")),
|
|
62
|
+
row("debounce", `${info.dev.debounce}ms`),
|
|
63
|
+
row("node args", info.dev.nodeArgs.join(" ") || colors.dim("none")),
|
|
64
|
+
row("args", info.dev.args.join(" ") || colors.dim("none")),
|
|
65
|
+
row("url", info.dev.url ?? colors.dim("unknown, set dev.url or HTTP_PORT")),
|
|
66
|
+
row("health", info.dev.health ?? colors.dim("none")),
|
|
67
|
+
row("typecheck", info.dev.typecheck.enabled ? `${info.dev.typecheck.checker} → ${show(info.dev.typecheck.tsconfig)}` : colors.dim("disabled")),
|
|
68
|
+
row("tunnel", describeTunnel(info.dev.tunnel, colors)),
|
|
69
|
+
row("log file", info.dev.logFile ? show(info.dev.logFile) : colors.dim("disabled"))
|
|
70
|
+
]),
|
|
71
|
+
section("Codegen", [row("i18n", info.codegen.i18n ? `${show(info.codegen.i18n.locales)} → ${show(info.codegen.i18n.output)}` : colors.dim("disabled"))]),
|
|
72
|
+
section("Experimental", [
|
|
73
|
+
row("vite", flag(info.experimental.enableVite, colors)),
|
|
74
|
+
row("nitro", flag(info.experimental.enableNitro, colors)),
|
|
75
|
+
row("external", flag(info.experimental.enableExternalVite, colors))
|
|
76
|
+
]),
|
|
77
|
+
section("Imports", [
|
|
78
|
+
row("auto", info.imports.enabled ? colors.green("enabled") : colors.dim("disabled")),
|
|
79
|
+
row("dirs", info.imports.dirs.map(show).join(", ")),
|
|
80
|
+
row("presets", info.imports.presets.join(", ") || colors.dim("none")),
|
|
81
|
+
row("dts", show(info.imports.dts))
|
|
82
|
+
])
|
|
83
|
+
].join("\n\n");
|
|
84
|
+
}
|
|
85
|
+
function flag(enabled, colors) {
|
|
86
|
+
return enabled ? colors.green("enabled") : colors.dim("disabled");
|
|
87
|
+
}
|
|
88
|
+
function describeTunnel(tunnel, colors) {
|
|
89
|
+
switch (tunnel.mode) {
|
|
90
|
+
case "quick": return "cloudflared quick tunnel";
|
|
91
|
+
case "url": return tunnel.url;
|
|
92
|
+
default: return colors.dim("disabled");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function runInfo(options) {
|
|
96
|
+
const stdout = options.stdout ?? process.stdout;
|
|
97
|
+
const info = collectInfo(await loadStarsConfig({
|
|
98
|
+
cwd: resolveCwd(options),
|
|
99
|
+
configFile: options.config
|
|
100
|
+
}));
|
|
101
|
+
stdout.write(`${options.json ? JSON.stringify(info, null, 2) : formatInfo(info, shouldUseColor())}\n`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
export { runInfo };
|
|
106
|
+
//# sourceMappingURL=info-B-8rAIn6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-B-8rAIn6.js","names":[],"sources":["../src/lib/tasks/info.ts"],"sourcesContent":["import { createColors } from 'colorette';\nimport { arch, platform } from 'node:os';\nimport { relative } from 'node:path';\nimport type { ProjectArgs } from '../args.js';\nimport { resolveCwd } from '../args.js';\nimport { loadStarsConfig } from '@wolfstar/http-framework/config';\nimport { displayPath, type ResolvedStarsConfig } from '@wolfstar/http-framework/config';\nimport { resolveOutputMode, shouldUseColor } from '../output-mode.js';\nimport { findInstalledVersion } from '../project.js';\nimport { readOwnPackageJson } from '../version.js';\n\nexport interface InfoOptions extends ProjectArgs {\n\tjson?: boolean;\n\tstdout?: NodeJS.WritableStream;\n}\n\nexport interface ProjectInfo {\n\tcli: { version: string; node: string; platform: string; outputMode: 'tui' | 'plain' };\n\tproject: {\n\t\tcwd: string;\n\t\troot: string;\n\t\tconfigFile: string | null;\n\t\tname: string | null;\n\t\tversion: string | null;\n\t\tentry: string;\n\t\tframeworkVersion: string | null;\n\t};\n\tbuild: ResolvedStarsConfig['build'];\n\tdev: ResolvedStarsConfig['dev'];\n\tcodegen: ResolvedStarsConfig['codegen'];\n\timports: ResolvedStarsConfig['imports'];\n\texperimental: ResolvedStarsConfig['experimental'];\n}\n\nexport function collectInfo(config: ResolvedStarsConfig): ProjectInfo {\n\treturn {\n\t\tcli: {\n\t\t\tversion: readOwnPackageJson().version,\n\t\t\tnode: process.version,\n\t\t\tplatform: `${platform()} ${arch()}`,\n\t\t\toutputMode: resolveOutputMode()\n\t\t},\n\t\tproject: {\n\t\t\tcwd: config.cwd,\n\t\t\troot: config.root,\n\t\t\tconfigFile: config.configFile,\n\t\t\tname: config.packageJson?.name ?? null,\n\t\t\tversion: config.packageJson?.version ?? null,\n\t\t\tentry: config.entry,\n\t\t\tframeworkVersion: findInstalledVersion(config.root, '@wolfstar/http-framework')\n\t\t},\n\t\tbuild: config.build,\n\t\tdev: config.dev,\n\t\tcodegen: config.codegen,\n\t\timports: config.imports,\n\t\texperimental: config.experimental\n\t};\n}\n\nexport function formatInfo(info: ProjectInfo, useColor: boolean): string {\n\tconst colors = createColors({ useColor });\n\tconst { root } = info.project;\n\tconst show = (path: string | null) => (path === null ? colors.dim('none') : displayPath(root, path));\n\tconst row = (label: string, value: string) => ` ${colors.dim(label.padEnd(12))}${value}`;\n\tconst section = (title: string, rows: string[]) => [colors.bold(title), ...rows].join('\\n');\n\n\treturn [\n\t\tsection(`stars ${colors.green(`v${info.cli.version}`)}`, [\n\t\t\trow('node', info.cli.node),\n\t\t\trow('platform', info.cli.platform),\n\t\t\trow('output', info.cli.outputMode),\n\t\t\trow(\n\t\t\t\t'framework',\n\t\t\t\tinfo.project.frameworkVersion\n\t\t\t\t\t? `@wolfstar/http-framework v${info.project.frameworkVersion}`\n\t\t\t\t\t: colors.yellow('@wolfstar/http-framework not installed')\n\t\t\t)\n\t\t]),\n\t\tsection('Project', [\n\t\t\trow(\n\t\t\t\t'name',\n\t\t\t\tinfo.project.name\n\t\t\t\t\t? `${info.project.name}${info.project.version ? colors.dim(` v${info.project.version}`) : ''}`\n\t\t\t\t\t: colors.dim('unnamed')\n\t\t\t),\n\t\t\trow('root', root),\n\t\t\trow(\n\t\t\t\t'config',\n\t\t\t\tinfo.project.configFile ? relative(root, info.project.configFile) || info.project.configFile : colors.dim('none (defaults)')\n\t\t\t),\n\t\t\trow('entry', show(info.project.entry))\n\t\t]),\n\t\tsection('Build', [\n\t\t\trow('tool', info.build.tool),\n\t\t\trow('outDir', show(info.build.outDir)),\n\t\t\trow('tsconfig', show(info.build.tsconfig)),\n\t\t\trow('runs', show(info.build.output))\n\t\t]),\n\t\tsection('Dev', [\n\t\t\trow('watch', info.dev.watch.map(show).join(', ')),\n\t\t\trow('debounce', `${info.dev.debounce}ms`),\n\t\t\trow('node args', info.dev.nodeArgs.join(' ') || colors.dim('none')),\n\t\t\trow('args', info.dev.args.join(' ') || colors.dim('none')),\n\t\t\trow('url', info.dev.url ?? colors.dim('unknown, set dev.url or HTTP_PORT')),\n\t\t\trow('health', info.dev.health ?? colors.dim('none')),\n\t\t\trow(\n\t\t\t\t'typecheck',\n\t\t\t\tinfo.dev.typecheck.enabled ? `${info.dev.typecheck.checker} → ${show(info.dev.typecheck.tsconfig)}` : colors.dim('disabled')\n\t\t\t),\n\t\t\trow('tunnel', describeTunnel(info.dev.tunnel, colors)),\n\t\t\trow('log file', info.dev.logFile ? show(info.dev.logFile) : colors.dim('disabled'))\n\t\t]),\n\t\tsection('Codegen', [\n\t\t\trow('i18n', info.codegen.i18n ? `${show(info.codegen.i18n.locales)} → ${show(info.codegen.i18n.output)}` : colors.dim('disabled'))\n\t\t]),\n\t\tsection('Experimental', [\n\t\t\trow('vite', flag(info.experimental.enableVite, colors)),\n\t\t\trow('nitro', flag(info.experimental.enableNitro, colors)),\n\t\t\trow('external', flag(info.experimental.enableExternalVite, colors))\n\t\t]),\n\t\tsection('Imports', [\n\t\t\trow('auto', info.imports.enabled ? colors.green('enabled') : colors.dim('disabled')),\n\t\t\trow('dirs', info.imports.dirs.map(show).join(', ')),\n\t\t\trow('presets', info.imports.presets.join(', ') || colors.dim('none')),\n\t\t\trow('dts', show(info.imports.dts))\n\t\t])\n\t].join('\\n\\n');\n}\n\nfunction flag(enabled: boolean, colors: ReturnType<typeof createColors>): string {\n\treturn enabled ? colors.green('enabled') : colors.dim('disabled');\n}\n\nfunction describeTunnel(tunnel: ResolvedStarsConfig['dev']['tunnel'], colors: ReturnType<typeof createColors>): string {\n\tswitch (tunnel.mode) {\n\t\tcase 'quick':\n\t\t\treturn 'cloudflared quick tunnel';\n\t\tcase 'url':\n\t\t\treturn tunnel.url;\n\t\tdefault:\n\t\t\treturn colors.dim('disabled');\n\t}\n}\n\nexport async function runInfo(options: InfoOptions): Promise<void> {\n\tconst stdout = options.stdout ?? process.stdout;\n\tconst config = await loadStarsConfig({ cwd: resolveCwd(options), configFile: options.config });\n\tconst info = collectInfo(config);\n\tstdout.write(`${options.json ? JSON.stringify(info, null, 2) : formatInfo(info, shouldUseColor())}\\n`);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as projectArgs } from "./args-Ch1KXUMn.js";
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/info.ts
|
|
5
|
+
var info_default = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "info",
|
|
8
|
+
description: "Print the resolved project configuration and environment"
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
...projectArgs,
|
|
12
|
+
json: {
|
|
13
|
+
type: "boolean",
|
|
14
|
+
description: "Print machine-readable JSON",
|
|
15
|
+
default: false
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
async run({ args }) {
|
|
19
|
+
const { runInfo } = await import("./info-B-8rAIn6.js");
|
|
20
|
+
await runInfo({
|
|
21
|
+
config: args.config,
|
|
22
|
+
cwd: args.cwd,
|
|
23
|
+
json: args.json
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { info_default as default };
|
|
30
|
+
//# sourceMappingURL=info-DRTYYvVB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-DRTYYvVB.js","names":[],"sources":["../src/commands/info.ts"],"sourcesContent":["import { defineCommand } from 'citty';\nimport { projectArgs } from '../lib/args.js';\n\nexport default defineCommand({\n\tmeta: {\n\t\tname: 'info',\n\t\tdescription: 'Print the resolved project configuration and environment'\n\t},\n\targs: {\n\t\t...projectArgs,\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Print machine-readable JSON',\n\t\t\tdefault: false\n\t\t}\n\t},\n\tasync run({ args }) {\n\t\tconst { runInfo } = await import('../lib/tasks/info.js');\n\t\tawait runInfo({ config: args.config, cwd: args.cwd, json: args.json });\n\t}\n});\n"],"mappings":";;;;AAGA,mBAAe,cAAc;CAC5B,MAAM;EACL,MAAM;EACN,aAAa;CACd;CACA,MAAM;EACL,GAAG;EACH,MAAM;GACL,MAAM;GACN,aAAa;GACb,SAAS;EACV;CACD;CACA,MAAM,IAAI,EAAE,QAAQ;EACnB,MAAM,EAAE,YAAY,MAAM,OAAO;EACjC,MAAM,QAAQ;GAAE,QAAQ,KAAK;GAAQ,KAAK,KAAK;GAAK,MAAM,KAAK;EAAK,CAAC;CACtE;AACD,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/builders/none.ts
|
|
4
|
+
/**
|
|
5
|
+
* No build step: watches the configured paths and reports every change as an instant successful "build".
|
|
6
|
+
*/
|
|
7
|
+
var NoneBuilder = class extends EventEmitter {
|
|
8
|
+
config;
|
|
9
|
+
tool = "none";
|
|
10
|
+
#watcher = null;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
super();
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
build() {
|
|
16
|
+
this.emit("start");
|
|
17
|
+
const outcome = {
|
|
18
|
+
ok: true,
|
|
19
|
+
durationMs: 0,
|
|
20
|
+
message: null
|
|
21
|
+
};
|
|
22
|
+
this.emit("success", outcome);
|
|
23
|
+
return Promise.resolve(outcome);
|
|
24
|
+
}
|
|
25
|
+
async watch() {
|
|
26
|
+
const { watch } = await import("chokidar");
|
|
27
|
+
const watcher = watch([...this.config.dev.watch], {
|
|
28
|
+
ignored: [...this.config.dev.ignore],
|
|
29
|
+
ignoreInitial: true,
|
|
30
|
+
cwd: this.config.root
|
|
31
|
+
});
|
|
32
|
+
this.#watcher = watcher;
|
|
33
|
+
watcher.on("all", (event, path) => {
|
|
34
|
+
this.emit("log", "info", `${event}: ${path}`);
|
|
35
|
+
this.build();
|
|
36
|
+
});
|
|
37
|
+
watcher.on("error", (error) => this.emit("log", "error", error instanceof Error ? error.message : String(error)));
|
|
38
|
+
await new Promise((resolve) => watcher.once("ready", resolve));
|
|
39
|
+
await this.build();
|
|
40
|
+
}
|
|
41
|
+
async close() {
|
|
42
|
+
const watcher = this.#watcher;
|
|
43
|
+
this.#watcher = null;
|
|
44
|
+
await watcher?.close();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { NoneBuilder };
|
|
50
|
+
//# sourceMappingURL=none-DEo7zEr9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"none-DEo7zEr9.js","names":["#watcher"],"sources":["../src/lib/builders/none.ts"],"sourcesContent":["import { EventEmitter } from 'node:events';\nimport type { ResolvedStarsConfig } from '@wolfstar/http-framework/config';\nimport type { Builder, BuilderEvents, BuildOutcome } from './types.js';\n\n/**\n * No build step: watches the configured paths and reports every change as an instant successful \"build\".\n */\nexport class NoneBuilder extends EventEmitter<BuilderEvents> implements Builder {\n\tpublic readonly tool = 'none' as const;\n\t#watcher: { close(): Promise<void> } | null = null;\n\n\tpublic constructor(private readonly config: ResolvedStarsConfig) {\n\t\tsuper();\n\t}\n\n\tpublic build(): Promise<BuildOutcome> {\n\t\tthis.emit('start');\n\t\tconst outcome: BuildOutcome = { ok: true, durationMs: 0, message: null };\n\t\tthis.emit('success', outcome);\n\t\treturn Promise.resolve(outcome);\n\t}\n\n\tpublic async watch(): Promise<void> {\n\t\tconst { watch } = await import('chokidar');\n\t\tconst watcher = watch([...this.config.dev.watch], {\n\t\t\tignored: [...this.config.dev.ignore],\n\t\t\tignoreInitial: true,\n\t\t\tcwd: this.config.root\n\t\t});\n\t\tthis.#watcher = watcher;\n\n\t\twatcher.on('all', (event, path) => {\n\t\t\tthis.emit('log', 'info', `${event}: ${path}`);\n\t\t\tvoid this.build();\n\t\t});\n\t\twatcher.on('error', (error) => this.emit('log', 'error', error instanceof Error ? error.message : String(error)));\n\n\t\tawait new Promise<void>((resolve) => watcher.once('ready', resolve));\n\t\tawait this.build();\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tconst watcher = this.#watcher;\n\t\tthis.#watcher = null;\n\t\tawait watcher?.close();\n\t}\n}\n"],"mappings":";;;;;;AAOA,IAAa,cAAb,cAAiC,aAA+C;CAI3C;CAHpC,AAAgB,OAAO;CACvB,WAA8C;CAE9C,AAAO,YAAY,AAAiB,QAA6B;EAChE,MAAM;EAD6B;CAEpC;CAEA,AAAO,QAA+B;EACrC,KAAK,KAAK,OAAO;EACjB,MAAM,UAAwB;GAAE,IAAI;GAAM,YAAY;GAAG,SAAS;EAAK;EACvE,KAAK,KAAK,WAAW,OAAO;EAC5B,OAAO,QAAQ,QAAQ,OAAO;CAC/B;CAEA,MAAa,QAAuB;EACnC,MAAM,EAAE,UAAU,MAAM,OAAO;EAC/B,MAAM,UAAU,MAAM,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,GAAG;GACjD,SAAS,CAAC,GAAG,KAAK,OAAO,IAAI,MAAM;GACnC,eAAe;GACf,KAAK,KAAK,OAAO;EAClB,CAAC;EACD,KAAKA,WAAW;EAEhB,QAAQ,GAAG,QAAQ,OAAO,SAAS;GAClC,KAAK,KAAK,OAAO,QAAQ,GAAG,MAAM,IAAI,MAAM;GAC5C,AAAK,KAAK,MAAM;EACjB,CAAC;EACD,QAAQ,GAAG,UAAU,UAAU,KAAK,KAAK,OAAO,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC;EAEhH,MAAM,IAAI,SAAe,YAAY,QAAQ,KAAK,SAAS,OAAO,CAAC;EACnE,MAAM,KAAK,MAAM;CAClB;CAEA,MAAa,QAAuB;EACnC,MAAM,UAAU,KAAKA;EACrB,KAAKA,WAAW;EAChB,MAAM,SAAS,MAAM;CACtB;AACD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/lib/output-mode.ts
|
|
2
|
+
const truthy = /* @__PURE__ */ new Set([
|
|
3
|
+
"1",
|
|
4
|
+
"true",
|
|
5
|
+
"yes",
|
|
6
|
+
"on"
|
|
7
|
+
]);
|
|
8
|
+
/**
|
|
9
|
+
* Decides between the interactive TUI and plain line output.
|
|
10
|
+
*
|
|
11
|
+
* Precedence: `--no-tui` › `STARS_TUI=plain` › non-interactive stdout, CI or `TERM=dumb`.
|
|
12
|
+
*/
|
|
13
|
+
function resolveOutputMode(options = {}) {
|
|
14
|
+
const env = options.env ?? process.env;
|
|
15
|
+
const isTTY = options.isTTY ?? Boolean(process.stdout.isTTY);
|
|
16
|
+
const isCI = options.isCI ?? isCIEnvironment(env);
|
|
17
|
+
if (options.tui === false) return "plain";
|
|
18
|
+
const forced = env.STARS_TUI?.trim().toLowerCase();
|
|
19
|
+
if (forced === "plain" || forced === "0" || forced === "false" || forced === "off") return "plain";
|
|
20
|
+
if (forced === "tui" || forced && truthy.has(forced)) return isTTY ? "tui" : "plain";
|
|
21
|
+
if (options.tui === true) return isTTY ? "tui" : "plain";
|
|
22
|
+
if (!isTTY || isCI || env.TERM === "dumb") return "plain";
|
|
23
|
+
return "tui";
|
|
24
|
+
}
|
|
25
|
+
function isCIEnvironment(env = process.env) {
|
|
26
|
+
return Boolean(env.CI && !["false", "0"].includes(env.CI.toLowerCase())) || Boolean(env.GITHUB_ACTIONS || env.GITLAB_CI || env.BUILDKITE || env.CIRCLECI);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Whether colours should be emitted, honouring `NO_COLOR` and `FORCE_COLOR`.
|
|
30
|
+
*/
|
|
31
|
+
function shouldUseColor(env = process.env, isTTY = Boolean(process.stdout.isTTY)) {
|
|
32
|
+
if (env.NO_COLOR !== void 0 && env.NO_COLOR !== "") return false;
|
|
33
|
+
if (env.FORCE_COLOR !== void 0) return env.FORCE_COLOR !== "0";
|
|
34
|
+
return isTTY && env.TERM !== "dumb";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether animations (spinners, blinking status) should be avoided.
|
|
38
|
+
*/
|
|
39
|
+
function prefersReducedMotion(env = process.env) {
|
|
40
|
+
const value = env.STARS_REDUCED_MOTION ?? env.REDUCED_MOTION;
|
|
41
|
+
return value !== void 0 && value !== "" && value !== "0" && value.toLowerCase() !== "false";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { shouldUseColor as i, prefersReducedMotion as n, resolveOutputMode as r, isCIEnvironment as t };
|
|
46
|
+
//# sourceMappingURL=output-mode-ChrOf0LO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-mode-ChrOf0LO.js","names":[],"sources":["../src/lib/output-mode.ts"],"sourcesContent":["export type OutputMode = 'tui' | 'plain';\n\nexport interface ResolveOutputModeOptions {\n\t/** `--no-tui` (`tui: false`) or `--tui` (`tui: true`) from the command line. */\n\ttui?: boolean;\n\tenv?: NodeJS.ProcessEnv;\n\t/** Whether stdout is an interactive terminal. */\n\tisTTY?: boolean;\n\t/** Whether the process runs in a CI environment. */\n\tisCI?: boolean;\n}\n\nconst truthy = new Set(['1', 'true', 'yes', 'on']);\n\n/**\n * Decides between the interactive TUI and plain line output.\n *\n * Precedence: `--no-tui` › `STARS_TUI=plain` › non-interactive stdout, CI or `TERM=dumb`.\n */\nexport function resolveOutputMode(options: ResolveOutputModeOptions = {}): OutputMode {\n\tconst env = options.env ?? process.env;\n\tconst isTTY = options.isTTY ?? Boolean(process.stdout.isTTY);\n\tconst isCI = options.isCI ?? isCIEnvironment(env);\n\n\tif (options.tui === false) return 'plain';\n\n\tconst forced = env.STARS_TUI?.trim().toLowerCase();\n\tif (forced === 'plain' || forced === '0' || forced === 'false' || forced === 'off') return 'plain';\n\tif (forced === 'tui' || (forced && truthy.has(forced))) return isTTY ? 'tui' : 'plain';\n\n\tif (options.tui === true) return isTTY ? 'tui' : 'plain';\n\tif (!isTTY || isCI || env.TERM === 'dumb') return 'plain';\n\treturn 'tui';\n}\n\nexport function isCIEnvironment(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn (\n\t\tBoolean(env.CI && !['false', '0'].includes(env.CI.toLowerCase())) ||\n\t\tBoolean(env.GITHUB_ACTIONS || env.GITLAB_CI || env.BUILDKITE || env.CIRCLECI)\n\t);\n}\n\n/**\n * Whether colours should be emitted, honouring `NO_COLOR` and `FORCE_COLOR`.\n */\nexport function shouldUseColor(env: NodeJS.ProcessEnv = process.env, isTTY = Boolean(process.stdout.isTTY)): boolean {\n\tif (env.NO_COLOR !== undefined && env.NO_COLOR !== '') return false;\n\tif (env.FORCE_COLOR !== undefined) return env.FORCE_COLOR !== '0';\n\treturn isTTY && env.TERM !== 'dumb';\n}\n\n/**\n * Whether animations (spinners, blinking status) should be avoided.\n */\nexport function prefersReducedMotion(env: NodeJS.ProcessEnv = process.env): boolean {\n\tconst value = env.STARS_REDUCED_MOTION ?? env.REDUCED_MOTION;\n\treturn value !== undefined && value !== '' && value !== '0' && value.toLowerCase() !== 'false';\n}\n"],"mappings":";AAYA,MAAM,yBAAS,IAAI,IAAI;CAAC;CAAK;CAAQ;CAAO;AAAI,CAAC;;;;;;AAOjD,SAAgB,kBAAkB,UAAoC,CAAC,GAAe;CACrF,MAAM,MAAM,QAAQ,OAAO,QAAQ;CACnC,MAAM,QAAQ,QAAQ,SAAS,QAAQ,QAAQ,OAAO,KAAK;CAC3D,MAAM,OAAO,QAAQ,QAAQ,gBAAgB,GAAG;CAEhD,IAAI,QAAQ,QAAQ,OAAO,OAAO;CAElC,MAAM,SAAS,IAAI,WAAW,KAAK,CAAC,CAAC,YAAY;CACjD,IAAI,WAAW,WAAW,WAAW,OAAO,WAAW,WAAW,WAAW,OAAO,OAAO;CAC3F,IAAI,WAAW,SAAU,UAAU,OAAO,IAAI,MAAM,GAAI,OAAO,QAAQ,QAAQ;CAE/E,IAAI,QAAQ,QAAQ,MAAM,OAAO,QAAQ,QAAQ;CACjD,IAAI,CAAC,SAAS,QAAQ,IAAI,SAAS,QAAQ,OAAO;CAClD,OAAO;AACR;AAEA,SAAgB,gBAAgB,MAAyB,QAAQ,KAAc;CAC9E,OACC,QAAQ,IAAI,MAAM,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,IAAI,GAAG,YAAY,CAAC,CAAC,KAChE,QAAQ,IAAI,kBAAkB,IAAI,aAAa,IAAI,aAAa,IAAI,QAAQ;AAE9E;;;;AAKA,SAAgB,eAAe,MAAyB,QAAQ,KAAK,QAAQ,QAAQ,QAAQ,OAAO,KAAK,GAAY;CACpH,IAAI,IAAI,aAAa,UAAa,IAAI,aAAa,IAAI,OAAO;CAC9D,IAAI,IAAI,gBAAgB,QAAW,OAAO,IAAI,gBAAgB;CAC9D,OAAO,SAAS,IAAI,SAAS;AAC9B;;;;AAKA,SAAgB,qBAAqB,MAAyB,QAAQ,KAAc;CACnF,MAAM,QAAQ,IAAI,wBAAwB,IAAI;CAC9C,OAAO,UAAU,UAAa,UAAU,MAAM,UAAU,OAAO,MAAM,YAAY,MAAM;AACxF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createColors } from "colorette";
|
|
2
|
+
|
|
3
|
+
//#region src/renderers/plain.ts
|
|
4
|
+
/**
|
|
5
|
+
* Line-oriented renderer for non-interactive terminals, CI and redirected output.
|
|
6
|
+
*/
|
|
7
|
+
function createPlainRenderer(service, options = {}) {
|
|
8
|
+
const stdout = options.stdout ?? process.stdout;
|
|
9
|
+
const colors = createColors({ useColor: options.color ?? false });
|
|
10
|
+
const write = (text) => stdout.write(`${text}\n`);
|
|
11
|
+
const prefixes = {
|
|
12
|
+
stars: colors.cyan("stars"),
|
|
13
|
+
build: colors.magenta("build"),
|
|
14
|
+
tsc: colors.blue("tsc"),
|
|
15
|
+
tunnel: colors.yellow("tunnel"),
|
|
16
|
+
app: null
|
|
17
|
+
};
|
|
18
|
+
const onEntry = (entry) => {
|
|
19
|
+
const prefix = prefixes[entry.source];
|
|
20
|
+
if (!prefix) {
|
|
21
|
+
write(entry.text);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const paint = entry.level === "error" ? colors.red : entry.level === "warn" ? colors.yellow : entry.level === "success" ? colors.green : (value) => value;
|
|
25
|
+
write(`${prefix} ${paint(entry.text)}`);
|
|
26
|
+
};
|
|
27
|
+
const onClear = () => write(`${prefixes.stars} logs cleared`);
|
|
28
|
+
return {
|
|
29
|
+
start() {
|
|
30
|
+
service.logs.on("entry", onEntry);
|
|
31
|
+
service.logs.on("clear", onClear);
|
|
32
|
+
return new Promise(() => {});
|
|
33
|
+
},
|
|
34
|
+
stop() {
|
|
35
|
+
service.logs.off("entry", onEntry);
|
|
36
|
+
service.logs.off("clear", onClear);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { createPlainRenderer };
|
|
43
|
+
//# sourceMappingURL=plain-CEe4X_Cz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-CEe4X_Cz.js","names":[],"sources":["../src/renderers/plain.ts"],"sourcesContent":["import { createColors } from 'colorette';\nimport type { DevService } from '../lib/dev-service.js';\nimport type { LogEntry } from '../lib/log-buffer.js';\n\nexport interface PlainRendererOptions {\n\tstdout?: NodeJS.WritableStream;\n\tcolor?: boolean;\n\t/** Whether to attach process signal handlers. */\n\tsignals?: boolean;\n}\n\nexport interface Renderer {\n\t/** Starts rendering. Resolves when the user asks to quit (or never, in plain mode without signals). */\n\tstart(): Promise<void>;\n\t/** Stops rendering and restores the terminal. */\n\tstop(): void;\n}\n\n/**\n * Line-oriented renderer for non-interactive terminals, CI and redirected output.\n */\nexport function createPlainRenderer(service: DevService, options: PlainRendererOptions = {}): Renderer {\n\tconst stdout = options.stdout ?? process.stdout;\n\tconst colors = createColors({ useColor: options.color ?? false });\n\tconst write = (text: string) => stdout.write(`${text}\\n`);\n\n\tconst prefixes = {\n\t\tstars: colors.cyan('stars'),\n\t\tbuild: colors.magenta('build'),\n\t\ttsc: colors.blue('tsc'),\n\t\ttunnel: colors.yellow('tunnel'),\n\t\tapp: null\n\t} as const;\n\n\tconst onEntry = (entry: LogEntry) => {\n\t\tconst prefix = prefixes[entry.source];\n\t\tif (!prefix) {\n\t\t\twrite(entry.text);\n\t\t\treturn;\n\t\t}\n\n\t\tconst paint =\n\t\t\tentry.level === 'error'\n\t\t\t\t? colors.red\n\t\t\t\t: entry.level === 'warn'\n\t\t\t\t\t? colors.yellow\n\t\t\t\t\t: entry.level === 'success'\n\t\t\t\t\t\t? colors.green\n\t\t\t\t\t\t: (value: string) => value;\n\t\twrite(`${prefix} ${paint(entry.text)}`);\n\t};\n\n\tconst onClear = () => write(`${prefixes.stars} logs cleared`);\n\n\treturn {\n\t\tstart() {\n\t\t\tservice.logs.on('entry', onEntry);\n\t\t\tservice.logs.on('clear', onClear);\n\t\t\treturn new Promise<void>(() => {});\n\t\t},\n\t\tstop() {\n\t\t\tservice.logs.off('entry', onEntry);\n\t\t\tservice.logs.off('clear', onClear);\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;AAqBA,SAAgB,oBAAoB,SAAqB,UAAgC,CAAC,GAAa;CACtG,MAAM,SAAS,QAAQ,UAAU,QAAQ;CACzC,MAAM,SAAS,aAAa,EAAE,UAAU,QAAQ,SAAS,MAAM,CAAC;CAChE,MAAM,SAAS,SAAiB,OAAO,MAAM,GAAG,KAAK,GAAG;CAExD,MAAM,WAAW;EAChB,OAAO,OAAO,KAAK,OAAO;EAC1B,OAAO,OAAO,QAAQ,OAAO;EAC7B,KAAK,OAAO,KAAK,KAAK;EACtB,QAAQ,OAAO,OAAO,QAAQ;EAC9B,KAAK;CACN;CAEA,MAAM,WAAW,UAAoB;EACpC,MAAM,SAAS,SAAS,MAAM;EAC9B,IAAI,CAAC,QAAQ;GACZ,MAAM,MAAM,IAAI;GAChB;EACD;EAEA,MAAM,QACL,MAAM,UAAU,UACb,OAAO,MACP,MAAM,UAAU,SACf,OAAO,SACP,MAAM,UAAU,YACf,OAAO,SACN,UAAkB;EACzB,MAAM,GAAG,OAAO,GAAG,MAAM,MAAM,IAAI,GAAG;CACvC;CAEA,MAAM,gBAAgB,MAAM,GAAG,SAAS,MAAM,cAAc;CAE5D,OAAO;EACN,QAAQ;GACP,QAAQ,KAAK,GAAG,SAAS,OAAO;GAChC,QAAQ,KAAK,GAAG,SAAS,OAAO;GAChC,OAAO,IAAI,cAAoB,CAAC,CAAC;EAClC;EACA,OAAO;GACN,QAAQ,KAAK,IAAI,SAAS,OAAO;GACjC,QAAQ,KAAK,IAAI,SAAS,OAAO;EAClC;CACD;AACD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { t as projectArgs } from "./args-Ch1KXUMn.js";
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/prepare.ts
|
|
5
|
+
var prepare_default = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "prepare",
|
|
8
|
+
description: "Generate the auto imports declaration file (imports.dts)"
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
...projectArgs,
|
|
12
|
+
check: {
|
|
13
|
+
type: "boolean",
|
|
14
|
+
description: "Fail when the generated file is out of date instead of writing it",
|
|
15
|
+
default: false
|
|
16
|
+
},
|
|
17
|
+
json: {
|
|
18
|
+
type: "boolean",
|
|
19
|
+
description: "Print machine-readable JSON",
|
|
20
|
+
default: false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
async run({ args }) {
|
|
24
|
+
const { runPrepare } = await import("./prepare-BXcm2Ukp.js");
|
|
25
|
+
await runPrepare({
|
|
26
|
+
config: args.config,
|
|
27
|
+
cwd: args.cwd,
|
|
28
|
+
check: args.check,
|
|
29
|
+
json: args.json
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { prepare_default as default };
|
|
36
|
+
//# sourceMappingURL=prepare-CVf88_Or.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-CVf88_Or.js","names":[],"sources":["../src/commands/prepare.ts"],"sourcesContent":["import { defineCommand } from 'citty';\nimport { projectArgs } from '../lib/args.js';\n\nexport default defineCommand({\n\tmeta: {\n\t\tname: 'prepare',\n\t\tdescription: 'Generate the auto imports declaration file (imports.dts)'\n\t},\n\targs: {\n\t\t...projectArgs,\n\t\tcheck: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Fail when the generated file is out of date instead of writing it',\n\t\t\tdefault: false\n\t\t},\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Print machine-readable JSON',\n\t\t\tdefault: false\n\t\t}\n\t},\n\tasync run({ args }) {\n\t\tconst { runPrepare } = await import('../lib/tasks/prepare.js');\n\t\tawait runPrepare({ config: args.config, cwd: args.cwd, check: args.check, json: args.json });\n\t}\n});\n"],"mappings":";;;;AAGA,sBAAe,cAAc;CAC5B,MAAM;EACL,MAAM;EACN,aAAa;CACd;CACA,MAAM;EACL,GAAG;EACH,OAAO;GACN,MAAM;GACN,aAAa;GACb,SAAS;EACV;EACA,MAAM;GACL,MAAM;GACN,aAAa;GACb,SAAS;EACV;CACD;CACA,MAAM,IAAI,EAAE,QAAQ;EACnB,MAAM,EAAE,eAAe,MAAM,OAAO;EACpC,MAAM,WAAW;GAAE,QAAQ,KAAK;GAAQ,KAAK,KAAK;GAAK,OAAO,KAAK;GAAO,MAAM,KAAK;EAAK,CAAC;CAC5F;AACD,CAAC"}
|