@wolfstar/cli 0.2.0 → 0.3.0
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/README.md +45 -15
- package/dist/{build-CvSvbsYN.js → build-DbGs9-s8.js} +4 -4
- package/dist/{build-CvSvbsYN.js.map → build-DbGs9-s8.js.map} +1 -1
- package/dist/{build-B6xw00Ee.js → build-DkMulM4f.js} +2 -2
- package/dist/{build-B6xw00Ee.js.map → build-DkMulM4f.js.map} +1 -1
- package/dist/{builders-D97Uqjwg.js → builders-NkAoPRdw.js} +2 -2
- package/dist/{builders-D97Uqjwg.js.map → builders-NkAoPRdw.js.map} +1 -1
- package/dist/cli.js +6 -6
- package/dist/{codegen-mYkL-GBf.js → codegen-1kW_OnrL.js} +2 -2
- package/dist/{codegen-mYkL-GBf.js.map → codegen-1kW_OnrL.js.map} +1 -1
- package/dist/{codegen-DjPOn7cp.js → codegen-DHQH83M3.js} +2 -2
- package/dist/{codegen-DjPOn7cp.js.map → codegen-DHQH83M3.js.map} +1 -1
- package/dist/{commands-Dw2LFWV-.js → commands-BkZNThm8.js} +2 -2
- package/dist/{commands-Dw2LFWV-.js.map → commands-BkZNThm8.js.map} +1 -1
- package/dist/{commands-BkGKs_Bg.js → commands-DwqViJ2V.js} +4 -4
- package/dist/{commands-BkGKs_Bg.js.map → commands-DwqViJ2V.js.map} +1 -1
- package/dist/{dev-BCgaVd0m.js → dev-BazJrPZ3.js} +2 -2
- package/dist/{dev-BCgaVd0m.js.map → dev-BazJrPZ3.js.map} +1 -1
- package/dist/{dev-CWA_JVTb.js → dev-C6HogNjR.js} +80 -65
- package/dist/dev-C6HogNjR.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{info-Czh4LUsD.js → info-BrxKCcUW.js} +2 -2
- package/dist/{info-Czh4LUsD.js.map → info-BrxKCcUW.js.map} +1 -1
- package/dist/{info-BqxpktLG.js → info-rYRLITnv.js} +2 -2
- package/dist/{info-BqxpktLG.js.map → info-rYRLITnv.js.map} +1 -1
- package/dist/log-buffer-D-nj2ZEU.js +72 -0
- package/dist/log-buffer-D-nj2ZEU.js.map +1 -0
- package/dist/{output-mode-ChrOf0LO.js → output-mode-Cxes6YUW.js} +4 -2
- package/dist/output-mode-Cxes6YUW.js.map +1 -0
- package/dist/{prepare-BXcm2Ukp.js → prepare-90XQCoak.js} +1 -1
- package/dist/{prepare-D5NZ0w4t.js → prepare-CHLrneYU.js} +2 -2
- package/dist/{prepare-D5NZ0w4t.js.map → prepare-CHLrneYU.js.map} +1 -1
- package/dist/{prepare-CVf88_Or.js → prepare-hOwjyelr.js} +2 -2
- package/dist/{prepare-CVf88_Or.js.map → prepare-hOwjyelr.js.map} +1 -1
- package/dist/{tsdown-BEFq2API.js → tsdown-Do8vjnIK.js} +23 -6
- package/dist/tsdown-Do8vjnIK.js.map +1 -0
- package/dist/tui-C2P91TgW.js +938 -0
- package/dist/tui-C2P91TgW.js.map +1 -0
- package/package.json +7 -6
- package/dist/dev-CWA_JVTb.js.map +0 -1
- package/dist/output-mode-ChrOf0LO.js.map +0 -1
- package/dist/tsdown-BEFq2API.js.map +0 -1
- package/dist/tui-BTRFsLQR.js +0 -770
- package/dist/tui-BTRFsLQR.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-
|
|
1
|
+
{"version":3,"file":"prepare-CHLrneYU.js","names":[],"sources":["../src/lib/tasks/prepare.ts"],"sourcesContent":["import { generateAutoImportsDts } from '@wolfstar/http-framework/auto-imports';\nimport { displayPath, loadStarsConfig, type ResolvedStarsConfig } from '@wolfstar/http-framework/config';\nimport { createColors } from 'colorette';\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport type { ProjectArgs } from '../args.js';\nimport { resolveCwd } from '../args.js';\nimport { CliError, ExitCode } from '../errors.js';\nimport { shouldUseColor } from '../output-mode.js';\n\nexport interface PrepareTaskOptions extends ProjectArgs {\n\tcheck?: boolean;\n\tjson?: boolean;\n\tstdout?: NodeJS.WritableStream;\n}\n\nexport type PrepareResult =\n\t| { enabled: false; dts: null; status: null }\n\t| { enabled: true; dts: string; status: 'written' | 'up-to-date' | 'outdated' };\n\n/**\n * Generates `imports.dts` (see {@link StarsImportsConfig} in `@wolfstar/http-framework/config`), the way `nuxt\n * prepare` regenerates `.nuxt/imports.d.ts`. Run automatically by `stars dev` and `stars build` before the first\n * build; `--check` fails instead of writing, for CI.\n */\nexport async function runPrepare(options: PrepareTaskOptions): Promise<void> {\n\tconst stdout = options.stdout ?? process.stdout;\n\tconst colors = createColors({ useColor: shouldUseColor() && !options.json });\n\tconst config = await loadStarsConfig({ cwd: resolveCwd(options), configFile: options.config });\n\tconst result = await prepareAutoImports(config, Boolean(options.check));\n\n\tif (options.json) {\n\t\tstdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n\t} else if (!result.enabled) {\n\t\tstdout.write(`${colors.dim('stars')} nothing to prepare (auto imports are disabled)\\n`);\n\t} else {\n\t\tconst paint = result.status === 'outdated' ? colors.red : colors.green;\n\t\tstdout.write(`${colors.dim('stars')} imports: ${paint(result.status)} ${displayPath(config.root, result.dts)}\\n`);\n\t}\n\n\tif (result.status === 'outdated') {\n\t\tthrow new CliError('The auto imports declaration file is out of date, run `stars prepare` to update it.', {\n\t\t\tcode: 'PREPARE_OUTDATED',\n\t\t\texitCode: ExitCode.Error\n\t\t});\n\t}\n}\n\n/**\n * Regenerates `imports.dts` unconditionally, used by `stars dev`/`stars build` before the first build so the\n * declaration file exists (and is current) even when the user never ran `stars prepare` themselves.\n */\nexport async function prepareAutoImports(config: ResolvedStarsConfig, check = false): Promise<PrepareResult> {\n\tif (!config.imports.enabled) return { enabled: false, dts: null, status: null };\n\n\tconst { dirs, presets, exclude, dts } = config.imports;\n\tconst content = await generateAutoImportsDts({ root: config.root, dirs, presets, exclude });\n\n\tif (check) {\n\t\tconst existing = await readFile(dts, 'utf-8').catch(() => null);\n\t\treturn { enabled: true, dts, status: existing === content ? 'up-to-date' : 'outdated' };\n\t}\n\n\tawait mkdir(dirname(dts), { recursive: true });\n\tawait writeFile(dts, content);\n\treturn { enabled: true, dts, status: 'written' };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,eAAsB,WAAW,SAA4C;CAC5E,MAAM,SAAS,QAAQ,UAAU,QAAQ;CACzC,MAAM,SAAS,aAAa,EAAE,UAAU,eAAe,KAAK,CAAC,QAAQ,KAAK,CAAC;CAC3E,MAAM,SAAS,MAAM,gBAAgB;EAAE,KAAK,WAAW,OAAO;EAAG,YAAY,QAAQ;CAAO,CAAC;CAC7F,MAAM,SAAS,MAAM,mBAAmB,QAAQ,QAAQ,QAAQ,KAAK,CAAC;CAEtE,IAAI,QAAQ,MACX,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,GAAG;MAC7C,IAAI,CAAC,OAAO,SAClB,OAAO,MAAM,GAAG,OAAO,IAAI,OAAO,EAAE,kDAAkD;MAChF;EACN,MAAM,QAAQ,OAAO,WAAW,aAAa,OAAO,MAAM,OAAO;EACjE,OAAO,MAAM,GAAG,OAAO,IAAI,OAAO,EAAE,YAAY,MAAM,OAAO,MAAM,EAAE,GAAG,YAAY,OAAO,MAAM,OAAO,GAAG,EAAE,GAAG;CACjH;CAEA,IAAI,OAAO,WAAW,YACrB,MAAM,IAAI,SAAS,uFAAuF;EACzG,MAAM;EACN,UAAU,SAAS;CACpB,CAAC;AAEH;;;;;AAMA,eAAsB,mBAAmB,QAA6B,QAAQ,OAA+B;CAC5G,IAAI,CAAC,OAAO,QAAQ,SAAS,OAAO;EAAE,SAAS;EAAO,KAAK;EAAM,QAAQ;CAAK;CAE9E,MAAM,EAAE,MAAM,SAAS,SAAS,QAAQ,OAAO;CAC/C,MAAM,UAAU,MAAM,uBAAuB;EAAE,MAAM,OAAO;EAAM;EAAM;EAAS;CAAQ,CAAC;CAE1F,IAAI,OAEH,OAAO;EAAE,SAAS;EAAM;EAAK,QAAQ,MADd,SAAS,KAAK,OAAO,CAAC,CAAC,YAAY,IAAI,MACZ,UAAU,eAAe;CAAW;CAGvF,MAAM,MAAM,QAAQ,GAAG,GAAG,EAAE,WAAW,KAAK,CAAC;CAC7C,MAAM,UAAU,KAAK,OAAO;CAC5B,OAAO;EAAE,SAAS;EAAM;EAAK,QAAQ;CAAU;AAChD"}
|
|
@@ -21,7 +21,7 @@ var prepare_default = defineCommand({
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
async run({ args }) {
|
|
24
|
-
const { runPrepare } = await import("./prepare-
|
|
24
|
+
const { runPrepare } = await import("./prepare-90XQCoak.js");
|
|
25
25
|
await runPrepare({
|
|
26
26
|
config: args.config,
|
|
27
27
|
cwd: args.cwd,
|
|
@@ -33,4 +33,4 @@ var prepare_default = defineCommand({
|
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
35
35
|
export { prepare_default as default };
|
|
36
|
-
//# sourceMappingURL=prepare-
|
|
36
|
+
//# sourceMappingURL=prepare-hOwjyelr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-
|
|
1
|
+
{"version":3,"file":"prepare-hOwjyelr.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"}
|
|
@@ -73,6 +73,7 @@ var TsdownBuilder = class extends EventEmitter {
|
|
|
73
73
|
...plugins.length > 0 ? { plugins } : {},
|
|
74
74
|
...Object.keys(alias).length > 0 ? { alias } : {},
|
|
75
75
|
cwd: this.config.root,
|
|
76
|
+
logLevel: "warn",
|
|
76
77
|
customLogger: this.#logger()
|
|
77
78
|
};
|
|
78
79
|
}
|
|
@@ -117,7 +118,7 @@ var TsdownBuilder = class extends EventEmitter {
|
|
|
117
118
|
treeshake: true,
|
|
118
119
|
minify: false,
|
|
119
120
|
dts: false,
|
|
120
|
-
deps: {
|
|
121
|
+
deps: { neverBundle: true },
|
|
121
122
|
...build.tsconfig === null ? {} : { tsconfig: build.tsconfig }
|
|
122
123
|
};
|
|
123
124
|
}
|
|
@@ -152,15 +153,31 @@ var TsdownBuilder = class extends EventEmitter {
|
|
|
152
153
|
#watchOptions(options) {
|
|
153
154
|
const hooks = options.hooks ?? {};
|
|
154
155
|
const prepare = hooks["build:prepare"];
|
|
156
|
+
const before = hooks["build:before"];
|
|
157
|
+
const done = hooks["build:done"];
|
|
155
158
|
const success = options.onSuccess;
|
|
156
159
|
return {
|
|
157
160
|
...options,
|
|
158
161
|
watch: true,
|
|
162
|
+
plugins: [{
|
|
163
|
+
name: "stars:dev-progress",
|
|
164
|
+
buildStart: () => {
|
|
165
|
+
if (this.#startedAt === 0) this.#begin();
|
|
166
|
+
this.emit("progress", .25, "bundling app");
|
|
167
|
+
}
|
|
168
|
+
}, ...toArray(options.plugins)],
|
|
159
169
|
hooks: {
|
|
160
170
|
...hooks,
|
|
161
171
|
"build:prepare": async (...args) => {
|
|
162
|
-
if (typeof prepare === "function") await prepare(...args);
|
|
163
172
|
if (this.#startedAt === 0) this.#begin();
|
|
173
|
+
if (typeof prepare === "function") await prepare(...args);
|
|
174
|
+
},
|
|
175
|
+
"build:before": async (...args) => {
|
|
176
|
+
if (typeof before === "function") await before(...args);
|
|
177
|
+
},
|
|
178
|
+
"build:done": async (...args) => {
|
|
179
|
+
this.emit("progress", .5, "finishing build");
|
|
180
|
+
if (typeof done === "function") await done(...args);
|
|
164
181
|
}
|
|
165
182
|
},
|
|
166
183
|
onSuccess: async (...args) => {
|
|
@@ -191,8 +208,8 @@ var TsdownBuilder = class extends EventEmitter {
|
|
|
191
208
|
};
|
|
192
209
|
const warned = /* @__PURE__ */ new Set();
|
|
193
210
|
return {
|
|
194
|
-
level: "
|
|
195
|
-
info: (
|
|
211
|
+
level: "warn",
|
|
212
|
+
info: () => {},
|
|
196
213
|
warn: (...args) => log("warn", args),
|
|
197
214
|
warnOnce: (...args) => {
|
|
198
215
|
const key = args.map(String).join(" ");
|
|
@@ -205,7 +222,7 @@ var TsdownBuilder = class extends EventEmitter {
|
|
|
205
222
|
log("error", args);
|
|
206
223
|
if (this.#startedAt !== 0 && this.#bundles.length > 0) this.#finish(errorSummary(args));
|
|
207
224
|
},
|
|
208
|
-
success: (
|
|
225
|
+
success: () => {},
|
|
209
226
|
clearScreen: () => {}
|
|
210
227
|
};
|
|
211
228
|
}
|
|
@@ -222,4 +239,4 @@ function errorSummary(args) {
|
|
|
222
239
|
|
|
223
240
|
//#endregion
|
|
224
241
|
export { TsdownBuilder };
|
|
225
|
-
//# sourceMappingURL=tsdown-
|
|
242
|
+
//# sourceMappingURL=tsdown-Do8vjnIK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdown-Do8vjnIK.js","names":["#load","#options","#begin","#bundles","#finish","#hadError","#watchOptions","#defaults","#plugins","#alias","#logger","#startedAt"],"sources":["../src/lib/builders/tsdown.ts"],"sourcesContent":["import { EventEmitter } from 'node:events';\nimport { dirname, extname, relative, resolve } from 'node:path';\nimport type { ResolvedStarsConfig } from '@wolfstar/http-framework/config';\nimport { importFromProject } from '../project.js';\nimport type { Builder, BuilderEvents, BuildOutcome } from './types.js';\n\ntype TsdownModule = typeof import('tsdown');\ntype TsdownLogger = import('tsdown').Logger;\ntype TsdownBundle = import('tsdown').TsdownBundle;\ntype TsdownInlineConfig = NonNullable<Parameters<TsdownModule['build']>[0]>;\ntype TsdownOptions = Record<string, unknown>;\ntype AnyFunction = (...args: never[]) => unknown;\n\nconst INSTALL_HINT = \"Install it with `pnpm add -D tsdown`, or set `build.tool` to 'tsc' or 'none'.\";\nconst TYPESCRIPT_EXTENSIONS = new Set(['.ts', '.mts', '.cts']);\n/** `./src/lib` and `../shared` are paths; `preact/compat` is a module id and must be left alone. */\nconst RELATIVE_PATH = /^\\.\\.?[/\\\\]/;\n\n/**\n * Builds through the project's own `tsdown`, configured from `stars.config`.\n *\n * From `future.compatibilityVersion` 4 on this is the whole configuration: the entry's directory, `build.outDir` and\n * `build.tsconfig` produce the defaults a bot needs, the project's `tsdown` block is layered on top, and the auto\n * imports plugin is wired in — one configuration file instead of two. At 3 the project's own `tsdown.config.*` is\n * still loaded and everything here is merged over it by `tsdown` itself: scalars from `stars.config` win, and\n * `plugins` are appended rather than replaced.\n */\nexport class TsdownBuilder extends EventEmitter<BuilderEvents> implements Builder {\n\tpublic readonly tool = 'tsdown' as const;\n\t#bundles: TsdownBundle[] = [];\n\t#hadError = false;\n\t#startedAt = 0;\n\n\tpublic constructor(private readonly config: ResolvedStarsConfig) {\n\t\tsuper();\n\t}\n\n\tpublic async build(): Promise<BuildOutcome> {\n\t\tconst tsdown = await this.#load();\n\t\tconst options = await this.#options();\n\t\tthis.#begin();\n\n\t\ttry {\n\t\t\tthis.#bundles = await tsdown.build(options as TsdownInlineConfig);\n\t\t\treturn this.#finish(this.#hadError ? 'The build reported errors' : null);\n\t\t} catch (error) {\n\t\t\treturn this.#finish(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\n\tpublic async watch(): Promise<void> {\n\t\tconst tsdown = await this.#load();\n\t\tconst options = await this.#options();\n\n\t\tthis.#begin();\n\t\tthis.#bundles = await tsdown.build(this.#watchOptions(options) as TsdownInlineConfig);\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tconst bundles = this.#bundles;\n\t\tthis.#bundles = [];\n\t\tawait Promise.allSettled(bundles.map((bundle) => bundle[Symbol.asyncDispose]()));\n\t}\n\n\t#load(): Promise<TsdownModule> {\n\t\treturn importFromProject<TsdownModule>(this.config.root, 'tsdown', INSTALL_HINT);\n\t}\n\n\t/**\n\t * The options handed to `tsdown.build()`, with the project's own `tsdown` block already layered on top of the\n\t * defaults (and of the plugins `stars` contributes).\n\t */\n\tasync #options(): Promise<TsdownOptions> {\n\t\tconst user = this.config.tsdown as TsdownOptions;\n\t\t// A `tsdown.config.*` (or `package.json#tsdown`) is the project's own; `build.configFile` is `null` from\n\t\t// compatibility version 4 on, where loading one is a configuration error rather than a fallback.\n\t\tconst defaults = this.config.build.configFile === null ? this.#defaults() : {};\n\t\tconst plugins = [...(await this.#plugins()), ...toArray(user.plugins)];\n\t\t// `plugins` and `alias` are added to rather than replaced: a project declaring one of its own would\n\t\t// otherwise silently drop the auto imports transform, or every `~`/`@` import in its sources.\n\t\tconst alias = { ...(defaults.alias as object), ...this.#alias(user.alias) };\n\n\t\treturn {\n\t\t\t...defaults,\n\t\t\t...user,\n\t\t\t...(plugins.length > 0 ? { plugins } : {}),\n\t\t\t...(Object.keys(alias).length > 0 ? { alias } : {}),\n\t\t\t// Last, and so not overridable: these are how the CLI talks to `tsdown` rather than project build options —\n\t\t\t// the project root it resolves from, its own compact progress UI, and the logger that feeds diagnostics to\n\t\t\t// the dev panel. `logLevel` also covers the few lifecycle messages tsdown writes through its global logger.\n\t\t\tcwd: this.config.root,\n\t\t\tlogLevel: 'warn',\n\t\t\tcustomLogger: this.#logger()\n\t\t};\n\t}\n\n\t/**\n\t * What `stars.config` alone says the build is — the configuration a bot would otherwise write out by hand, taken\n\t * from the ones the WolfStar bots already keep next to theirs:\n\t *\n\t * - every source file next to the entry (minus tests), emitted one-to-one (`unbundle`) so the stores keep\n\t * loading pieces from `dist/commands` and friends at runtime;\n\t * - ESM on `platform: 'node'`, with the extension `build.output` — and so `stars dev`, `package.json#main` and\n\t * `node dist/…` — expects;\n\t * - sourcemaps and treeshaking on, minification off: a bot is deployed, not shipped, so readable stack traces\n\t * are worth more than bytes;\n\t * - dependencies left in `node_modules` rather than bundled into the output;\n\t * - Nuxt's own alias prefixes: `~` and `@` for the entry's directory, `~~` and `@@` for the project root;\n\t * - no declaration files: nothing consumes a bot's `dist/`, and emitting them roughly doubles the build. A\n\t * project that wants them sets `tsdown: { dts: true }`.\n\t *\n\t * Every one of these is overridable through the project's `tsdown` block.\n\t */\n\t#defaults(): TsdownOptions {\n\t\tconst { root, entry, build } = this.config;\n\t\tconst source = dirname(entry);\n\t\tconst sourceDir = relative(root, source) || '.';\n\t\tconst extensions = TYPESCRIPT_EXTENSIONS.has(extname(entry)) ? '{ts,mts,cts}' : '{js,mjs,cjs}';\n\n\t\treturn {\n\t\t\tconfig: false,\n\t\t\tentry: [`${sourceDir}/**/*.${extensions}`, `!${sourceDir}/**/*.{test,spec}.${extensions}`],\n\t\t\t// The prefixes Nuxt gives every project, pointing at the same two places its own do: the source\n\t\t\t// directory and the project root. A project's tsconfig needs the matching `paths` for them to type.\n\t\t\talias: { '~': source, '@': source, '~~': root, '@@': root },\n\t\t\tformat: 'esm',\n\t\t\tplatform: 'node',\n\t\t\tunbundle: true,\n\t\t\toutDir: build.outDir,\n\t\t\toutExtensions: () => ({ js: extname(build.output) }),\n\t\t\tsourcemap: true,\n\t\t\tclean: true,\n\t\t\ttreeshake: true,\n\t\t\tminify: false,\n\t\t\tdts: false,\n\t\t\tdeps: { neverBundle: true },\n\t\t\t...(build.tsconfig === null ? {} : { tsconfig: build.tsconfig })\n\t\t};\n\t}\n\n\t/**\n\t * The project's own aliases, with relative targets resolved against the project root the way every other path in\n\t * `stars.config` is. Module ids (`preact/compat`) and absolute paths are passed through untouched.\n\t */\n\t#alias(alias: unknown): Record<string, unknown> {\n\t\tif (alias === null || typeof alias !== 'object' || Array.isArray(alias)) return {};\n\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(alias as Record<string, unknown>).map(([key, value]) => [\n\t\t\t\tkey,\n\t\t\t\ttypeof value === 'string' && RELATIVE_PATH.test(value) ? resolve(this.config.root, value) : value\n\t\t\t])\n\t\t);\n\t}\n\n\t/**\n\t * The auto imports transform, the way `nuxt dev` wires its own into the build rather than asking the project to.\n\t * `stars dev`/`stars build` regenerate its declaration file (`stars prepare`) before the first build.\n\t */\n\tasync #plugins(): Promise<unknown[]> {\n\t\tif (!this.config.imports.enabled) return [];\n\n\t\tconst { autoImports } = await import('@wolfstar/http-framework/auto-imports');\n\t\tconst { dirs, presets, exclude, dts } = this.config.imports;\n\t\treturn [await autoImports({ root: this.config.root, dirs, presets, exclude, dts })];\n\t}\n\n\t/**\n\t * Watch mode reports through the same events a single build does. The project's own `hooks`/`onSuccess` still\n\t * run: they are the reason a build is watched at all in some projects.\n\t */\n\t#watchOptions(options: TsdownOptions): TsdownOptions {\n\t\tconst hooks = (options.hooks ?? {}) as Record<string, unknown>;\n\t\tconst prepare = hooks['build:prepare'];\n\t\tconst before = hooks['build:before'];\n\t\tconst done = hooks['build:done'];\n\t\tconst success = options.onSuccess;\n\n\t\treturn {\n\t\t\t...options,\n\t\t\twatch: true,\n\t\t\t// tsdown's build:before runs once when the watcher is configured, not on every rebuild. Rolldown's\n\t\t\t// buildStart is the actual per-build boundary, including recovery after a failed compilation.\n\t\t\tplugins: [\n\t\t\t\t{\n\t\t\t\t\tname: 'stars:dev-progress',\n\t\t\t\t\tbuildStart: () => {\n\t\t\t\t\t\tif (this.#startedAt === 0) this.#begin();\n\t\t\t\t\t\tthis.emit('progress', 0.25, 'bundling app');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t...toArray(options.plugins)\n\t\t\t],\n\t\t\thooks: {\n\t\t\t\t...hooks,\n\t\t\t\t'build:prepare': async (...args: never[]) => {\n\t\t\t\t\tif (this.#startedAt === 0) this.#begin();\n\t\t\t\t\tif (typeof prepare === 'function') await (prepare as AnyFunction)(...args);\n\t\t\t\t},\n\t\t\t\t'build:before': async (...args: never[]) => {\n\t\t\t\t\tif (typeof before === 'function') await (before as AnyFunction)(...args);\n\t\t\t\t},\n\t\t\t\t'build:done': async (...args: never[]) => {\n\t\t\t\t\tthis.emit('progress', 0.5, 'finishing build');\n\t\t\t\t\tif (typeof done === 'function') await (done as AnyFunction)(...args);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonSuccess: async (...args: never[]) => {\n\t\t\t\tif (typeof success === 'function') await (success as AnyFunction)(...args);\n\t\t\t\tthis.#finish(null);\n\t\t\t}\n\t\t};\n\t}\n\n\t#begin(): void {\n\t\tthis.#hadError = false;\n\t\tthis.#startedAt = performance.now();\n\t\tthis.emit('start');\n\t}\n\n\t#finish(message: string | null): BuildOutcome {\n\t\tconst outcome: BuildOutcome = {\n\t\t\tok: message === null && !this.#hadError,\n\t\t\tdurationMs: Math.round(performance.now() - this.#startedAt),\n\t\t\tmessage\n\t\t};\n\t\tthis.#startedAt = 0;\n\t\tthis.emit(outcome.ok ? 'success' : 'failure', outcome);\n\t\treturn outcome;\n\t}\n\n\t#logger(): TsdownLogger {\n\t\tconst log = (level: 'info' | 'warn' | 'error' | 'success', args: unknown[]) => {\n\t\t\t// tsdown passes its (possibly undefined) name label and other blanks as separate arguments.\n\t\t\tconst text = args\n\t\t\t\t.filter((argument) => argument !== undefined && argument !== null && argument !== false && argument !== '')\n\t\t\t\t.map((argument) => (argument instanceof Error ? (argument.stack ?? argument.message) : String(argument)))\n\t\t\t\t.join(' ');\n\t\t\tthis.emit('log', level, text);\n\t\t};\n\n\t\tconst warned = new Set<string>();\n\t\treturn {\n\t\t\t// `stars` owns the build progress and completion messages. Keeping tsdown at `warn` avoids copying its\n\t\t\t// entry list, target, output table and completion line into the dev session while preserving diagnostics\n\t\t\t// that need action from the project.\n\t\t\tlevel: 'warn',\n\t\t\tinfo: () => {},\n\t\t\twarn: (...args) => log('warn', args),\n\t\t\twarnOnce: (...args) => {\n\t\t\t\tconst key = args.map(String).join(' ');\n\t\t\t\tif (warned.has(key)) return;\n\t\t\t\twarned.add(key);\n\t\t\t\tlog('warn', args);\n\t\t\t},\n\t\t\terror: (...args) => {\n\t\t\t\tthis.#hadError = true;\n\t\t\t\tlog('error', args);\n\t\t\t\t// In watch mode tsdown never calls `onSuccess` after an error, report the failure now.\n\t\t\t\tif (this.#startedAt !== 0 && this.#bundles.length > 0) this.#finish(errorSummary(args));\n\t\t\t},\n\t\t\tsuccess: () => {},\n\t\t\tclearScreen: () => {}\n\t\t};\n\t}\n}\n\nfunction toArray(value: unknown): unknown[] {\n\tif (value === undefined || value === null || value === false) return [];\n\treturn Array.isArray(value) ? value : [value];\n}\n\nfunction errorSummary(args: unknown[]): string {\n\tconst first = args[0];\n\tif (first instanceof Error) return first.message.split('\\n')[0] ?? 'Build failed';\n\treturn String(first ?? 'Build failed').split('\\n')[0] ?? 'Build failed';\n}\n"],"mappings":";;;;;AAaA,MAAM,eAAe;AACrB,MAAM,wCAAwB,IAAI,IAAI;CAAC;CAAO;CAAQ;AAAM,CAAC;;AAE7D,MAAM,gBAAgB;;;;;;;;;;AAWtB,IAAa,gBAAb,cAAmC,aAA+C;CAM7C;CALpC,AAAgB,OAAO;CACvB,WAA2B,CAAC;CAC5B,YAAY;CACZ,aAAa;CAEb,AAAO,YAAY,AAAiB,Q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