@wolfstar/cli 2.2.0 → 2.3.0-next-20261004142621

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.
Files changed (90) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +465 -304
  3. package/dist/{_shared-DJrpalNQ.js → _shared-BIQK0Bhm.js} +2 -2
  4. package/dist/_shared-BIQK0Bhm.js.map +1 -0
  5. package/dist/bridge-BvkmlAOZ.js +410 -0
  6. package/dist/bridge-BvkmlAOZ.js.map +1 -0
  7. package/dist/{build-CluOR8dJ.js → build-DJcc95Yq.js} +5 -5
  8. package/dist/build-DJcc95Yq.js.map +1 -0
  9. package/dist/cli.js +1 -1
  10. package/dist/cli.js.map +1 -1
  11. package/dist/{codegen-D6V1i_fa.js → codegen-aJSyPz-J.js} +4 -4
  12. package/dist/codegen-aJSyPz-J.js.map +1 -0
  13. package/dist/command-diff-BK912Hjc.js +78 -0
  14. package/dist/command-diff-BK912Hjc.js.map +1 -0
  15. package/dist/commands-CIPWQtF0.js +3 -0
  16. package/dist/commands-Clpbqq3K.js +15 -0
  17. package/dist/commands-Clpbqq3K.js.map +1 -0
  18. package/dist/{commands-BJ589_AC.js → commands-DVC7ky6f.js} +259 -9
  19. package/dist/commands-DVC7ky6f.js.map +1 -0
  20. package/dist/completions-D2KYtrrv.js +161 -0
  21. package/dist/completions-D2KYtrrv.js.map +1 -0
  22. package/dist/{dev-DJJZN4NJ.js → dev-oPPVR7d_.js} +434 -28
  23. package/dist/dev-oPPVR7d_.js.map +1 -0
  24. package/dist/{diagnostics-3JRAy8Xj.js → diagnostics-BysbNnPD.js} +22 -1
  25. package/dist/diagnostics-BysbNnPD.js.map +1 -0
  26. package/dist/doctor-DkVUwgDd.js +334 -0
  27. package/dist/doctor-DkVUwgDd.js.map +1 -0
  28. package/dist/errors-COFWKKKw.js.map +1 -1
  29. package/dist/external-CxFKxwi3.js.map +1 -1
  30. package/dist/framework-auto-imports-Gu_PXSyr.js.map +1 -1
  31. package/dist/{hooks-BfDFM38k.js → hooks-Cy6F2bhH.js} +20 -4
  32. package/dist/hooks-Cy6F2bhH.js.map +1 -0
  33. package/dist/index.d.ts +53 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +3 -3
  36. package/dist/{info-C1Kx_4Og.js → info-CKJVMWIT.js} +15 -4
  37. package/dist/info-CKJVMWIT.js.map +1 -0
  38. package/dist/{locales-BzOLRBVg.js → locales-BJAP4HYf.js} +5 -5
  39. package/dist/locales-BJAP4HYf.js.map +1 -0
  40. package/dist/log-view-B7uJEnMR.js +342 -0
  41. package/dist/log-view-B7uJEnMR.js.map +1 -0
  42. package/dist/{nitro-yjqZBh5L.js → nitro-B8u1iVgf.js} +2 -2
  43. package/dist/nitro-B8u1iVgf.js.map +1 -0
  44. package/dist/none-uC_wi_l4.js.map +1 -1
  45. package/dist/output-mode-Bp7Da8vJ.js.map +1 -1
  46. package/dist/{plain-B6z85uQP.js → plain-DG7cy0Kk.js} +7 -2
  47. package/dist/plain-DG7cy0Kk.js.map +1 -0
  48. package/dist/{prepare-Cb45Z4re.js → prepare-BM93i3Rm.js} +4 -4
  49. package/dist/prepare-BM93i3Rm.js.map +1 -0
  50. package/dist/{project-D-8VIcyF.js → project-zlQStwsf.js} +2 -2
  51. package/dist/project-zlQStwsf.js.map +1 -0
  52. package/dist/{run-BiLZqib3.js → run-DMM2YlP3.js} +2 -12
  53. package/dist/run-DMM2YlP3.js.map +1 -0
  54. package/dist/{theme-3Fc_LI-2.js → theme-yS2h5dd_.js} +25 -1
  55. package/dist/theme-yS2h5dd_.js.map +1 -0
  56. package/dist/tsc-C5l5TQGC.js +3 -0
  57. package/dist/{tsc-DEBcwIO0.js → tsc-puVAcwmo.js} +24 -5
  58. package/dist/tsc-puVAcwmo.js.map +1 -0
  59. package/dist/{tsdown-DrWXld54.js → tsdown-Dwt3JhPw.js} +2 -2
  60. package/dist/tsdown-Dwt3JhPw.js.map +1 -0
  61. package/dist/{tui-BRddrLQP.js → tui-nldGSD4c.js} +913 -141
  62. package/dist/tui-nldGSD4c.js.map +1 -0
  63. package/dist/version-BzclCE19.js.map +1 -1
  64. package/dist/{vite-Bf7nrJx7.js → vite-YZUtv2Hk.js} +2 -2
  65. package/dist/vite-YZUtv2Hk.js.map +1 -0
  66. package/package.json +5 -5
  67. package/dist/_shared-DJrpalNQ.js.map +0 -1
  68. package/dist/build-CluOR8dJ.js.map +0 -1
  69. package/dist/codegen-D6V1i_fa.js.map +0 -1
  70. package/dist/commands-BJ589_AC.js.map +0 -1
  71. package/dist/dev-DJJZN4NJ.js.map +0 -1
  72. package/dist/diagnostics-3JRAy8Xj.js.map +0 -1
  73. package/dist/hooks-BfDFM38k.js.map +0 -1
  74. package/dist/info-C1Kx_4Og.js.map +0 -1
  75. package/dist/locales-BzOLRBVg.js.map +0 -1
  76. package/dist/log-buffer-CY82aqnb.js +0 -72
  77. package/dist/log-buffer-CY82aqnb.js.map +0 -1
  78. package/dist/nitro-yjqZBh5L.js.map +0 -1
  79. package/dist/plain-B6z85uQP.js.map +0 -1
  80. package/dist/prepare-Cb45Z4re.js.map +0 -1
  81. package/dist/project-D-8VIcyF.js.map +0 -1
  82. package/dist/run-BiLZqib3.js.map +0 -1
  83. package/dist/theme-3Fc_LI-2.js.map +0 -1
  84. package/dist/tsc-B931Ezh7.js +0 -3
  85. package/dist/tsc-DEBcwIO0.js.map +0 -1
  86. package/dist/tsdown-DrWXld54.js.map +0 -1
  87. package/dist/tui-BRddrLQP.js.map +0 -1
  88. package/dist/tunnel-DHSxOZKr.js +0 -175
  89. package/dist/tunnel-DHSxOZKr.js.map +0 -1
  90. package/dist/vite-Bf7nrJx7.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"errors-COFWKKKw.js","names":[],"sources":["../src/utils/errors.ts"],"sourcesContent":["import { configDiagnostics } from '@wolfstar/schema';\r\nimport { createColors } from 'colorette';\r\nimport { Diagnostic } from 'nostics';\r\nimport { ansiFormatter } from 'nostics/formatters/ansi';\r\nimport { shouldUseColor } from './output-mode.js';\r\n\r\nexport const ExitCode = {\r\n\tOk: 0,\r\n\tError: 1,\r\n\tInvalidConfig: 2,\r\n\tBuildFailed: 3,\r\n\tInterrupted: 130,\r\n\tTerminated: 143\r\n} as const;\r\n\r\nexport type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];\r\n\r\n/** Every `stars.config.*` diagnostic code maps to {@link ExitCode.InvalidConfig}; everything else defaults to `Error`. */\r\nconst CONFIG_DIAGNOSTIC_CODES = new Set<string>(Object.keys(configDiagnostics));\r\n\r\n/** CLI-local diagnostic codes whose exit code isn't the default {@link ExitCode.Error}. */\r\nconst CLI_EXIT_CODES: Partial<Record<string, ExitCode>> = {\r\n\tBUILD_FAILED: ExitCode.BuildFailed,\r\n\tMODULE_FAILED: ExitCode.InvalidConfig\r\n};\r\n\r\n/**\r\n * Formats an error for the terminal: a `Diagnostic` (from `stars.config.*` validation, via\r\n * `@wolfstar/schema`'s `configDiagnostics`, or from the CLI's own `cliDiagnostics`) renders through\r\n * nostics' own ANSI formatter — message, `fix`, `sources` and `docs` — everything else falls back to a crash report.\r\n */\r\nexport async function formatError(error: unknown): Promise<string> {\r\n\tif (error instanceof Diagnostic) {\r\n\t\tconst colors = createColors({ useColor: shouldUseColor() });\r\n\t\treturn ansiFormatter(colors)(error);\r\n\t}\r\n\r\n\t// citty's CLIError (unknown command, missing argument): the message is enough.\r\n\tif (error instanceof Error && error.name === 'CLIError') return error.message;\r\n\tif (error instanceof Error) return renderCrashReport(error);\r\n\treturn String(error);\r\n}\r\n\r\n/**\r\n * Renders an unexpected error (a bug, not something the CLI already explains through a `Diagnostic`) as a\r\n * sourcemapped, syntax-highlighted report — frames and a snippet of the original source instead of a stack trace\r\n * pointing into the bundled `dist/cli.js`.\r\n */\r\nexport async function renderCrashReport(error: unknown, cwd: string = process.cwd()): Promise<string> {\r\n\tconst { createReport, fsLoader, renderAnsi } = await import('my-bad');\r\n\tconst report = await createReport(error, { cwd, loaders: [fsLoader()] });\r\n\treturn renderAnsi(report, { cwd });\r\n}\r\n\r\nexport function exitCodeOf(error: unknown): ExitCode {\r\n\tif (error instanceof Diagnostic) {\r\n\t\tif (CONFIG_DIAGNOSTIC_CODES.has(error.code)) return ExitCode.InvalidConfig;\r\n\t\treturn CLI_EXIT_CODES[error.code] ?? ExitCode.Error;\r\n\t}\r\n\r\n\treturn ExitCode.Error;\r\n}\r\n"],"mappings":";;;;;;;AAMA,MAAa,WAAW;CACvB,IAAI;CACJ,OAAO;CACP,eAAe;CACf,aAAa;CACb,aAAa;CACb,YAAY;AACb;;AAKA,MAAM,0BAA0B,IAAI,IAAY,OAAO,KAAK,iBAAiB,CAAC;;AAG9E,MAAM,iBAAoD;CACzD,cAAc,SAAS;CACvB,eAAe,SAAS;AACzB;;;;;;AAOA,eAAsB,YAAY,OAAiC;CAClE,IAAI,iBAAiB,YAAY;EAChC,MAAM,SAAS,aAAa,EAAE,UAAU,eAAe,EAAE,CAAC;EAC1D,OAAO,cAAc,MAAM,CAAC,CAAC,KAAK;CACnC;CAGA,IAAI,iBAAiB,SAAS,MAAM,SAAS,YAAY,OAAO,MAAM;CACtE,IAAI,iBAAiB,OAAO,OAAO,kBAAkB,KAAK;CAC1D,OAAO,OAAO,KAAK;AACpB;;;;;;AAOA,eAAsB,kBAAkB,OAAgB,MAAc,QAAQ,IAAI,GAAoB;CACrG,MAAM,EAAE,cAAc,UAAU,eAAe,MAAM,OAAO;CAE5D,OAAO,WAAW,MADG,aAAa,OAAO;EAAE;EAAK,SAAS,CAAC,SAAS,CAAC;CAAE,CAAC,GAC7C,EAAE,IAAI,CAAC;AAClC;AAEA,SAAgB,WAAW,OAA0B;CACpD,IAAI,iBAAiB,YAAY;EAChC,IAAI,wBAAwB,IAAI,MAAM,IAAI,GAAG,OAAO,SAAS;EAC7D,OAAO,eAAe,MAAM,SAAS,SAAS;CAC/C;CAEA,OAAO,SAAS;AACjB"}
1
+ {"version":3,"file":"errors-COFWKKKw.js","names":[],"sources":["../src/utils/errors.ts"],"sourcesContent":["import { configDiagnostics } from '@wolfstar/schema';\nimport { createColors } from 'colorette';\nimport { Diagnostic } from 'nostics';\nimport { ansiFormatter } from 'nostics/formatters/ansi';\nimport { shouldUseColor } from './output-mode.js';\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\n/** Every `stars.config.*` diagnostic code maps to {@link ExitCode.InvalidConfig}; everything else defaults to `Error`. */\nconst CONFIG_DIAGNOSTIC_CODES = new Set<string>(Object.keys(configDiagnostics));\n\n/** CLI-local diagnostic codes whose exit code isn't the default {@link ExitCode.Error}. */\nconst CLI_EXIT_CODES: Partial<Record<string, ExitCode>> = {\n\tBUILD_FAILED: ExitCode.BuildFailed,\n\tMODULE_FAILED: ExitCode.InvalidConfig\n};\n\n/**\n * Formats an error for the terminal: a `Diagnostic` (from `stars.config.*` validation, via\n * `@wolfstar/schema`'s `configDiagnostics`, or from the CLI's own `cliDiagnostics`) renders through\n * nostics' own ANSI formatter — message, `fix`, `sources` and `docs` — everything else falls back to a crash report.\n */\nexport async function formatError(error: unknown): Promise<string> {\n\tif (error instanceof Diagnostic) {\n\t\tconst colors = createColors({ useColor: shouldUseColor() });\n\t\treturn ansiFormatter(colors)(error);\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 renderCrashReport(error);\n\treturn String(error);\n}\n\n/**\n * Renders an unexpected error (a bug, not something the CLI already explains through a `Diagnostic`) as a\n * sourcemapped, syntax-highlighted report — frames and a snippet of the original source instead of a stack trace\n * pointing into the bundled `dist/cli.js`.\n */\nexport async function renderCrashReport(error: unknown, cwd: string = process.cwd()): Promise<string> {\n\tconst { createReport, fsLoader, renderAnsi } = await import('my-bad');\n\tconst report = await createReport(error, { cwd, loaders: [fsLoader()] });\n\treturn renderAnsi(report, { cwd });\n}\n\nexport function exitCodeOf(error: unknown): ExitCode {\n\tif (error instanceof Diagnostic) {\n\t\tif (CONFIG_DIAGNOSTIC_CODES.has(error.code)) return ExitCode.InvalidConfig;\n\t\treturn CLI_EXIT_CODES[error.code] ?? ExitCode.Error;\n\t}\n\n\treturn ExitCode.Error;\n}\n"],"mappings":";;;;;;;AAMA,MAAa,WAAW;CACvB,IAAI;CACJ,OAAO;CACP,eAAe;CACf,aAAa;CACb,aAAa;CACb,YAAY;AACb;;AAKA,MAAM,0BAA0B,IAAI,IAAY,OAAO,KAAK,iBAAiB,CAAC;;AAG9E,MAAM,iBAAoD;CACzD,cAAc,SAAS;CACvB,eAAe,SAAS;AACzB;;;;;;AAOA,eAAsB,YAAY,OAAiC;CAClE,IAAI,iBAAiB,YAAY;EAChC,MAAM,SAAS,aAAa,EAAE,UAAU,eAAe,EAAE,CAAC;EAC1D,OAAO,cAAc,MAAM,CAAC,CAAC,KAAK;CACnC;CAGA,IAAI,iBAAiB,SAAS,MAAM,SAAS,YAAY,OAAO,MAAM;CACtE,IAAI,iBAAiB,OAAO,OAAO,kBAAkB,KAAK;CAC1D,OAAO,OAAO,KAAK;AACpB;;;;;;AAOA,eAAsB,kBAAkB,OAAgB,MAAc,QAAQ,IAAI,GAAoB;CACrG,MAAM,EAAE,cAAc,UAAU,eAAe,MAAM,OAAO;CAE5D,OAAO,WAAW,MADG,aAAa,OAAO;EAAE;EAAK,SAAS,CAAC,SAAS,CAAC;CAAE,CAAC,GAC7C,EAAE,IAAI,CAAC;AAClC;AAEA,SAAgB,WAAW,OAA0B;CACpD,IAAI,iBAAiB,YAAY;EAChC,IAAI,wBAAwB,IAAI,MAAM,IAAI,GAAG,OAAO,SAAS;EAC7D,OAAO,eAAe,MAAM,SAAS,SAAS;CAC/C;CAEA,OAAO,SAAS;AACjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"external-CxFKxwi3.js","names":[],"sources":["../src/builders/external.ts"],"sourcesContent":["import type { ResolvedStarsConfig, StarsBuildTool } from '@wolfstar/schema';\r\nimport { dirname } from 'node:path';\r\nimport { EventEmitter } from 'node:events';\r\nimport { displayPath } from '@wolfstar/schema';\r\nimport type { Builder, BuilderEvents, BuildOutcome } from './types.js';\r\n\r\n/**\r\n * Runs no build of its own: the project drives one itself (`vite dev`, `vite build --watch`, a task runner, …) and\r\n * this only watches what that build writes, restarting the bot whenever the output changes.\r\n *\r\n * This is what `experimental.enableExternalVite` selects — the CLI stays out of the build's way but keeps the rest\r\n * of `stars dev` (restarts, health, tunnel, type checking, the panel) working.\r\n */\r\nexport class ExternalBuilder extends EventEmitter<BuilderEvents> implements Builder {\r\n\tpublic readonly tool: StarsBuildTool;\r\n\t#watcher: { close(): Promise<void> } | null = null;\r\n\r\n\tpublic constructor(private readonly config: ResolvedStarsConfig) {\r\n\t\tsuper();\r\n\t\tthis.tool = config.build.tool;\r\n\t}\r\n\r\n\tpublic build(): Promise<BuildOutcome> {\r\n\t\tthis.emit('start');\r\n\t\tconst outcome: BuildOutcome = { ok: true, durationMs: 0, message: null };\r\n\t\tthis.emit('success', outcome);\r\n\t\treturn Promise.resolve(outcome);\r\n\t}\r\n\r\n\tpublic async watch(): Promise<void> {\r\n\t\tconst { watch } = await import('chokidar');\r\n\t\tconst target = dirname(this.config.build.output);\r\n\t\tthis.emit('log', 'info', `Watching ${displayPath(this.config.root, target)} for an external build`);\r\n\r\n\t\tconst watcher = watch(target, { ignored: [...this.config.dev.ignore], ignoreInitial: true, cwd: this.config.root });\r\n\t\tthis.#watcher = watcher;\r\n\r\n\t\twatcher.on('all', (event, path) => {\r\n\t\t\tthis.emit('log', 'info', `${event}: ${path}`);\r\n\t\t\tvoid this.build();\r\n\t\t});\r\n\t\twatcher.on('error', (error) => this.emit('log', 'error', error instanceof Error ? error.message : String(error)));\r\n\r\n\t\tawait new Promise<void>((resolve) => watcher.once('ready', resolve));\r\n\t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AAS,MAAM;CACtB;AACD"}
1
+ {"version":3,"file":"external-CxFKxwi3.js","names":[],"sources":["../src/builders/external.ts"],"sourcesContent":["import type { ResolvedStarsConfig, StarsBuildTool } from '@wolfstar/schema';\nimport { dirname } from 'node:path';\nimport { EventEmitter } from 'node:events';\nimport { displayPath } from '@wolfstar/schema';\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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resolveModule"],"sources":["../src/utils/framework-auto-imports.ts"],"sourcesContent":["/**\r\n * `@wolfstar/http-framework/auto-imports`, resolved from the project's own installation rather than declared as a\r\n * dependency of this package — the way `@nuxt/cli` resolves the project's own `nuxt` without depending on it.\r\n * `@wolfstar/http-framework` depends on `@wolfstar/cli` (for its `stars` binary), so the reverse dependency here\r\n * would make the two packages depend on each other.\r\n *\r\n * `mlly`'s `resolve` (the same tool `@wolfstar/http-framework/auto-imports` itself already uses to scan preset\r\n * packages, see its `scanPresetImports`) anchors the resolution at the project root, respecting its `exports`\r\n * `import` condition. A plain `require.resolve` anchored the same way (as `tsdown`/`vite`/`nitro` are resolved\r\n * elsewhere in this package, see `utils/project.ts`) does not work here: those are dual CJS/ESM packages, while\r\n * `@wolfstar/http-framework` is ESM-only, so a CJS-style resolver reports its `./auto-imports` subpath as\r\n * unavailable even though it exists. Anchoring at the project root is also what makes this find the project's real,\r\n * already-built `@wolfstar/http-framework` even though pnpm workspace packages are linked directly (not hoisted or\r\n * nested under `.pnpm`), which is what makes a plain bare-specifier `import()` from this package's own location\r\n * unable to reach it.\r\n *\r\n * The fallback bare specifier is for this repository's own tests, which alias it to source without a build; a\r\n * variable (not a string literal) in the `import()` call keeps TypeScript from requiring `@wolfstar/http-framework`\r\n * to resolve at type-check time too, since only a literal argument triggers module resolution.\r\n */\r\nimport type { ResolvedImportsConfig } from '@wolfstar/schema';\r\nimport { resolve as resolveModule } from 'mlly';\r\nimport { pathToFileURL } from 'node:url';\r\n\r\nconst AUTO_IMPORTS_SPECIFIER = '@wolfstar/http-framework/auto-imports';\r\n\r\nexport interface AutoImportsPluginOptions extends Pick<ResolvedImportsConfig, 'dirs' | 'presets' | 'exclude' | 'dts'> {\r\n\t/** Absolute project root, used to resolve `presets` against the project's own `node_modules`. */\r\n\troot: string;\r\n}\r\n\r\ninterface AutoImportsModule {\r\n\tautoImports(options: AutoImportsPluginOptions): Promise<unknown>;\r\n\tgenerateAutoImportsDts(options: Omit<AutoImportsPluginOptions, 'dts'>): Promise<string>;\r\n}\r\n\r\n/** Loads `@wolfstar/http-framework/auto-imports` from the project at `root`. */\r\nexport async function loadAutoImportsModule(root: string): Promise<AutoImportsModule> {\r\n\tconst url = pathToFileURL(`${root}/package.json`).href;\r\n\tconst target = await resolveModule(AUTO_IMPORTS_SPECIFIER, { url }).catch(() => AUTO_IMPORTS_SPECIFIER);\r\n\treturn (await import(target)) as AutoImportsModule;\r\n}\r\n"],"mappings":";;;;AAwBA,MAAM,yBAAyB;;AAa/B,eAAsB,sBAAsB,MAA0C;CACrF,MAAM,MAAM,cAAc,GAAG,KAAK,cAAc,CAAC,CAAC;CAElD,OAAQ,MAAM,OAAO,MADAA,QAAc,wBAAwB,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,sBAAsB;AAEvG"}
1
+ {"version":3,"file":"framework-auto-imports-Gu_PXSyr.js","names":["resolveModule"],"sources":["../src/utils/framework-auto-imports.ts"],"sourcesContent":["/**\n * `@wolfstar/http-framework/auto-imports`, resolved from the project's own installation rather than declared as a\n * dependency of this package — the way `@nuxt/cli` resolves the project's own `nuxt` without depending on it.\n * `@wolfstar/http-framework` depends on `@wolfstar/cli` (for its `stars` binary), so the reverse dependency here\n * would make the two packages depend on each other.\n *\n * `mlly`'s `resolve` (the same tool `@wolfstar/http-framework/auto-imports` itself already uses to scan preset\n * packages, see its `scanPresetImports`) anchors the resolution at the project root, respecting its `exports`\n * `import` condition. A plain `require.resolve` anchored the same way (as `tsdown`/`vite`/`nitro` are resolved\n * elsewhere in this package, see `utils/project.ts`) does not work here: those are dual CJS/ESM packages, while\n * `@wolfstar/http-framework` is ESM-only, so a CJS-style resolver reports its `./auto-imports` subpath as\n * unavailable even though it exists. Anchoring at the project root is also what makes this find the project's real,\n * already-built `@wolfstar/http-framework` even though pnpm workspace packages are linked directly (not hoisted or\n * nested under `.pnpm`), which is what makes a plain bare-specifier `import()` from this package's own location\n * unable to reach it.\n *\n * The fallback bare specifier is for this repository's own tests, which alias it to source without a build; a\n * variable (not a string literal) in the `import()` call keeps TypeScript from requiring `@wolfstar/http-framework`\n * to resolve at type-check time too, since only a literal argument triggers module resolution.\n */\nimport type { ResolvedImportsConfig } from '@wolfstar/schema';\nimport { resolve as resolveModule } from 'mlly';\nimport { pathToFileURL } from 'node:url';\n\nconst AUTO_IMPORTS_SPECIFIER = '@wolfstar/http-framework/auto-imports';\n\nexport interface AutoImportsPluginOptions extends Pick<ResolvedImportsConfig, 'dirs' | 'presets' | 'exclude' | 'dts'> {\n\t/** Absolute project root, used to resolve `presets` against the project's own `node_modules`. */\n\troot: string;\n}\n\ninterface AutoImportsModule {\n\tautoImports(options: AutoImportsPluginOptions): Promise<unknown>;\n\tgenerateAutoImportsDts(options: Omit<AutoImportsPluginOptions, 'dts'>): Promise<string>;\n}\n\n/** Loads `@wolfstar/http-framework/auto-imports` from the project at `root`. */\nexport async function loadAutoImportsModule(root: string): Promise<AutoImportsModule> {\n\tconst url = pathToFileURL(`${root}/package.json`).href;\n\tconst target = await resolveModule(AUTO_IMPORTS_SPECIFIER, { url }).catch(() => AUTO_IMPORTS_SPECIFIER);\n\treturn (await import(target)) as AutoImportsModule;\n}\n"],"mappings":";;;;AAwBA,MAAM,yBAAyB;;AAa/B,eAAsB,sBAAsB,MAA0C;CACrF,MAAM,MAAM,cAAc,GAAG,KAAK,cAAc,CAAC,CAAC;CAElD,OAAQ,MAAM,OAAO,MADAA,QAAc,wBAAwB,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,sBAAsB;AAEvG"}
@@ -1,6 +1,6 @@
1
1
  import { t as readOwnPackageJson } from "./version-BzclCE19.js";
2
- import { t as cliDiagnostics } from "./diagnostics-3JRAy8Xj.js";
3
- import { i as resolveFromProject, r as resolveBinary, t as findInstalledVersion } from "./project-D-8VIcyF.js";
2
+ import { t as cliDiagnostics } from "./diagnostics-BysbNnPD.js";
3
+ import { i as resolveFromProject, r as resolveBinary, t as findInstalledVersion } from "./project-zlQStwsf.js";
4
4
  import { isAbsolute, join, resolve } from "node:path";
5
5
  import { pathToFileURL } from "node:url";
6
6
  import { loadConfigFile, readProjectEnvFiles, resolveStarsConfig } from "@wolfstar/schema";
@@ -26,6 +26,22 @@ const projectArgs = {
26
26
  description: "Working directory to run from (defaults to the current directory)"
27
27
  }
28
28
  };
29
+ /**
30
+ * Every value of a flag given more than once (`--channel a --channel=b`). citty keeps only the last one of a
31
+ * repeated string flag, so a repeatable flag reads the raw arguments.
32
+ */
33
+ function collectFlag(rawArgs, name) {
34
+ const values = [];
35
+ for (const [index, argument] of rawArgs.entries()) {
36
+ if (argument === "--") break;
37
+ if (argument.startsWith(`--${name}=`)) values.push(argument.slice(name.length + 3));
38
+ else if (argument === `--${name}`) {
39
+ const next = rawArgs[index + 1];
40
+ if (next !== void 0 && !next.startsWith("-")) values.push(next);
41
+ }
42
+ }
43
+ return values;
44
+ }
29
45
  function resolveCwd(args) {
30
46
  return args.cwd ? resolve(process.cwd(), args.cwd) : process.cwd();
31
47
  }
@@ -312,5 +328,5 @@ function reresolve(previous, source, change) {
312
328
  }
313
329
 
314
330
  //#endregion
315
- export { modulesPreloadWarning as a, moduleImportArgs as c, readProjectEnv as i, projectArgs as l, loadProject as n, prepareModulesPreload as o, withProjectEnv as r, envImportArgs as s, applyEnvOptions as t, resolveCwd as u };
316
- //# sourceMappingURL=hooks-BfDFM38k.js.map
331
+ export { modulesPreloadWarning as a, moduleImportArgs as c, resolveCwd as d, readProjectEnv as i, collectFlag as l, loadProject as n, prepareModulesPreload as o, withProjectEnv as r, envImportArgs as s, applyEnvOptions as t, projectArgs as u };
332
+ //# sourceMappingURL=hooks-Cy6F2bhH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-Cy6F2bhH.js","names":["resolveModule"],"sources":["../src/utils/args.ts","../src/utils/env-import.ts","../src/utils/modules.ts","../src/utils/project-env.ts","../src/utils/hooks.ts"],"sourcesContent":["import type { ArgsDef } from 'citty';\nimport { resolve } from 'node:path';\n\n/**\n * Arguments shared by every command that reads the project configuration.\n */\nexport const projectArgs = {\n\tconfig: {\n\t\ttype: 'string',\n\t\talias: 'c',\n\t\tdescription: 'Path to the configuration file (defaults to stars.config.* in the working directory)'\n\t},\n\tcwd: {\n\t\ttype: 'string',\n\t\tdescription: 'Working directory to run from (defaults to the current directory)'\n\t}\n} as const satisfies ArgsDef;\n\nexport interface ProjectArgs {\n\tconfig?: string;\n\tcwd?: string;\n}\n\n/**\n * Every value of a flag given more than once (`--channel a --channel=b`). citty keeps only the last one of a\n * repeated string flag, so a repeatable flag reads the raw arguments.\n */\nexport function collectFlag(rawArgs: readonly string[], name: string): string[] {\n\tconst values: string[] = [];\n\tfor (const [index, argument] of rawArgs.entries()) {\n\t\tif (argument === '--') break;\n\t\tif (argument.startsWith(`--${name}=`)) values.push(argument.slice(name.length + 3));\n\t\telse if (argument === `--${name}`) {\n\t\t\tconst next = rawArgs[index + 1];\n\t\t\tif (next !== undefined && !next.startsWith('-')) values.push(next);\n\t\t}\n\t}\n\n\treturn values;\n}\n\nexport function resolveCwd(args: ProjectArgs): string {\n\treturn args.cwd ? resolve(process.cwd(), args.cwd) : process.cwd();\n}\n","import type { ResolvedStarsConfig } from '@wolfstar/schema';\nimport { envModuleSource, modulesModuleSource } from '@wolfstar/vite-server/internal';\nimport { resolveSync } from 'mlly';\nimport { isAbsolute } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { cliDiagnostics } from './diagnostics.js';\nimport { resolveFromProject } from './project.js';\n\n/** Build tools whose output never passes through the entry transform that registers `env`. */\nexport const UNTRANSFORMED_TOOLS = new Set<string>(['none', 'tsc']);\n\n/**\n * `node` arguments that register `env` before the entry runs, for the build tools the entry transform cannot reach.\n * The preload is a `data:` URL, so `.stars/` gets no generated runtime file; a `data:` URL cannot resolve bare\n * specifiers, so `@wolfstar/env-utilities` is resolved from the project first. When it cannot be resolved nothing is\n * preloaded, and the bot's own import of it reports the missing install.\n */\nexport function envImportArgs(config: ResolvedStarsConfig): string[] {\n\tif (!config.env.enabled || !UNTRANSFORMED_TOOLS.has(config.build.tool)) return [];\n\n\tconst resolved = resolveFromProject(config.root, '@wolfstar/env-utilities');\n\tif (resolved === null) return [];\n\n\tconst source = envModuleSource(config.env.options, pathToFileURL(resolved).href);\n\treturn ['--import', `data:text/javascript,${encodeURIComponent(source)}`];\n}\n\n/**\n * `node` arguments that register the runtime plugins of the installed modules (`ctx.addPlugin`) before the entry\n * runs, for the build tools the entry transform cannot reach. `@wolfstar/http-framework` and every plugin are resolved\n * from the project first, with the `import` condition (both are ESM), because a `data:` URL cannot resolve bare\n * specifiers; the framework is the bot's own copy, so `Client.use` reaches the `Client` the bot constructs. When the\n * framework is not installed nothing is preloaded, and the bot's own import of it reports the missing install.\n */\nexport function moduleImportArgs(config: ResolvedStarsConfig): string[] {\n\tconst plugins = config.runtime?.plugins ?? [];\n\tif (plugins.length === 0 || !UNTRANSFORMED_TOOLS.has(config.build.tool)) return [];\n\n\tconst url = pathToFileURL(`${config.root}/package.json`).href;\n\tlet framework: string;\n\ttry {\n\t\tframework = resolveSync('@wolfstar/http-framework', { url });\n\t} catch {\n\t\treturn [];\n\t}\n\n\tconst source = modulesModuleSource(plugins, {\n\t\tframework,\n\t\tresolve: (from) => {\n\t\t\tif (from.startsWith('file:')) return from;\n\t\t\tif (isAbsolute(from)) return pathToFileURL(from).href;\n\t\t\ttry {\n\t\t\t\treturn resolveSync(from, { url });\n\t\t\t} catch {\n\t\t\t\tthrow cliDiagnostics.DEPENDENCY_MISSING({\n\t\t\t\t\tname: from,\n\t\t\t\t\troot: config.root,\n\t\t\t\t\thint: 'Install the package of the module that registers this plugin.'\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\treturn ['--import', `data:text/javascript,${encodeURIComponent(source)}`];\n}\n","import { ModuleError, setupModules } from '@wolfstar/kit';\nimport type { ResolvedStarsConfig } from '@wolfstar/schema';\nimport { envModuleSource, modulesModuleSource } from '@wolfstar/vite-server/internal';\nimport { resolve as resolveModule } from 'mlly';\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport type { Diagnostic } from 'nostics';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { cliDiagnostics } from './diagnostics.js';\nimport { UNTRANSFORMED_TOOLS } from './env-import.js';\nimport type { StarsHookable } from './hooks.js';\nimport { findInstalledVersion } from './project.js';\nimport { readOwnPackageJson } from './version.js';\n\n/**\n * Where a module specifier is imported from: a relative or absolute path is a file of the project, a `file:` URL is\n * itself, anything else is a package resolved from the project root — with `mlly`, honouring the `import` condition,\n * because installed modules are ESM-only packages a CommonJS `require.resolve` cannot see.\n */\nasync function resolveSpecifier(root: string, specifier: string): Promise<string> {\n\tif (specifier.startsWith('file:')) return specifier;\n\tif (specifier.startsWith('.') || isAbsolute(specifier)) return pathToFileURL(resolve(root, specifier)).href;\n\treturn resolveModule(specifier, { url: pathToFileURL(`${root}/package.json`).href });\n}\n\n/**\n * Runs `setup` of every module in `modules` (see `@wolfstar/kit`) and returns the configuration carrying what they\n * contributed: `runtime`, and `imports.presets` extended by `ctx.addImports`. Without modules the configuration is\n * returned as it is.\n */\nexport async function installModules(config: ResolvedStarsConfig, hooks: StarsHookable): Promise<ResolvedStarsConfig> {\n\tif (config.modules.length === 0) return config;\n\n\ttry {\n\t\tconst runtime = await setupModules({\n\t\t\tconfig,\n\t\t\thooks,\n\t\t\tversions: { framework: findInstalledVersion(config.root, '@wolfstar/http-framework'), stars: readOwnPackageJson().version },\n\t\t\tload: async (specifier) => import(await resolveSpecifier(config.root, specifier))\n\t\t});\n\n\t\tconst presets = [...config.imports.presets, ...runtime.imports.filter((preset) => !config.imports.presets.includes(preset))];\n\t\treturn { ...config, runtime, imports: { ...config.imports, presets } };\n\t} catch (error) {\n\t\tif (error instanceof ModuleError) {\n\t\t\tthrow cliDiagnostics.MODULE_FAILED({ module: error.moduleName, reason: error.code, message: error.message, cause: error });\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\n/**\n * The warning for a project whose runtime plugins reach production only through a `node --import` preload, `null`\n * otherwise. It is not one of `config.warnings`: `stars dev` preloads the plugins itself, so there it would be noise\n * on every start. `stars build` and `stars prepare` report it.\n */\nexport function modulesPreloadWarning(config: ResolvedStarsConfig): Diagnostic | null {\n\tif (!needsPreload(config)) return null;\n\treturn cliDiagnostics.MODULES_PRELOAD_REQUIRED({\n\t\ttool: config.build.tool,\n\t\tplugins: [...new Set(config.runtime.plugins.map((plugin) => plugin.module))].join(', ')\n\t});\n}\n\n/** A build tool the entry transform cannot reach, with runtime plugins to register: they need a `node --import` preload. */\nfunction needsPreload(config: ResolvedStarsConfig): boolean {\n\treturn UNTRANSFORMED_TOOLS.has(config.build.tool) && (config.runtime?.plugins.length ?? 0) > 0;\n}\n\nexport interface ModulesPreloadResult {\n\t/** Absolute path of the preload file. */\n\tpath: string;\n\tstatus: 'written' | 'up-to-date' | 'outdated';\n}\n\n/**\n * Writes `.stars/modules.mjs`, the production counterpart of the preload `stars dev` passes to `node`: `node --import\n * ./.stars/modules.mjs <entry>` registers the runtime plugins of the installed modules for the build tools whose entry\n * cannot be transformed (`tsc`, `none`). Its specifiers are bare, so they resolve from the project's `node_modules`\n * like the bot's own imports. `null` when there is nothing to register.\n *\n * With `env` enabled it is preceded by `.stars/env.mjs`, a separate module imported first: imports of one module are\n * all evaluated before its body runs, so the environment could not be loaded ahead of the plugins from the same file,\n * and a plugin reading `process.env` while it is imported would see nothing.\n */\nexport async function prepareModulesPreload(config: ResolvedStarsConfig, check = false): Promise<ModulesPreloadResult | null> {\n\tif (!needsPreload(config)) return null;\n\n\tconst directory = join(config.root, '.stars');\n\tconst path = join(directory, 'modules.mjs');\n\tconst withEnv = config.env?.enabled === true;\n\t// An absolute path is a `file:` URL in the import, like in `moduleImportArgs`: Node rejects a Windows path there.\n\tconst plugins = modulesModuleSource(config.runtime.plugins, { resolve: (from) => (isAbsolute(from) ? pathToFileURL(from).href : from) });\n\tconst files = [\n\t\t{ path, content: withEnv ? `import \"./env.mjs\";\\n${plugins}` : plugins },\n\t\t...(withEnv ? [{ path: join(directory, 'env.mjs'), content: envModuleSource(config.env.options) }] : [])\n\t];\n\n\tif (check) {\n\t\tconst current = await Promise.all(files.map(async (file) => (await readFile(file.path, 'utf-8').catch(() => null)) === file.content));\n\t\treturn { path, status: current.every(Boolean) ? 'up-to-date' : 'outdated' };\n\t}\n\n\tawait mkdir(directory, { recursive: true });\n\tawait Promise.all(files.map((file) => writeFile(file.path, file.content)));\n\treturn { path, status: 'written' };\n}\n","import { readProjectEnvFiles, type ResolvedStarsConfig } from '@wolfstar/schema';\nimport { execFileSync } from 'node:child_process';\nimport { resolveBinary } from './project.js';\n\n/**\n * The variables the bot will load, for the CLI's own lookups (Discord credentials for the tunnel). With the default\n * loader these are the project's env files, read from `env.path`/`env.env`. With `loader: 'varlock'` they are what\n * `varlock load` resolves from the project's `.env.schema` — a dotenv file may be stale or absent there — and nothing\n * when varlock cannot be run, rather than values the bot never sees.\n */\nexport function readProjectEnv(config: ResolvedStarsConfig): Record<string, string> {\n\tconst { path, env = 'development', loader } = config.env.options;\n\tif (loader !== 'varlock') return readProjectEnvFiles(config.root, env, { path });\n\n\tconst binary = resolveBinary(config.root, 'varlock', 'varlock');\n\tif (binary === null) return {};\n\n\ttry {\n\t\t// The way the bot loads it: `@wolfstar/env-utilities` runs `varlock/auto-load` with no `--env` (it ignores\n\t\t// `env.env` with varlock), in the environment `stars dev` gives the bot.\n\t\tconst output = execFileSync(process.execPath, [binary, 'load', '--format', 'json'], {\n\t\t\tcwd: config.root,\n\t\t\t// Same order as `createSupervisor`: `NODE_ENV` is forced to development after `dev.env`, so it can't differ.\n\t\t\tenv: { ...process.env, ...config.dev.env, NODE_ENV: 'development' },\n\t\t\tencoding: 'utf8',\n\t\t\tstdio: ['ignore', 'pipe', 'ignore'],\n\t\t\ttimeout: 30_000\n\t\t});\n\t\tconst values = JSON.parse(output) as Record<string, unknown>;\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(values)\n\t\t\t\t.filter(([, value]) => value !== undefined && value !== null)\n\t\t\t\t.map(([key, value]) => [key, String(value)])\n\t\t);\n\t} catch {\n\t\treturn {};\n\t}\n}\n","import {\n\tloadConfigFile,\n\tresolveStarsConfig,\n\ttype LoadStarsConfigOptions,\n\ttype ResolveConfigOptions,\n\ttype ResolvedStarsConfig,\n\ttype StarsHookName,\n\ttype StarsHooks\n} from '@wolfstar/schema';\nimport { createHooks, type Hookable } from 'hookable';\nimport { installModules } from './modules.js';\nimport { readProjectEnv } from './project-env.js';\n\nexport type StarsHookable = Hookable<StarsHooks>;\n\n/** What each configuration loaded by {@link loadProject} was resolved from, so `env:options` can re-resolve it. */\nconst sources = new WeakMap<ResolvedStarsConfig, ResolveConfigOptions>();\n\n/** Registers the `hooks` of `stars.config` on a fresh `hookable` instance. */\nexport function createStarsHooks(config: ResolvedStarsConfig): StarsHookable {\n\tconst hooks = createHooks<StarsHooks>();\n\tfor (const [name, callbacks] of Object.entries(config.hooks) as [StarsHookName, readonly StarsHooks[StarsHookName][]][]) {\n\t\tfor (const callback of callbacks) hooks.hook(name, callback);\n\t}\n\n\treturn hooks;\n}\n\n/** Loads `stars.config`, registers its hooks and runs `config:resolved`. */\nexport async function loadProject(options: LoadStarsConfigOptions): Promise<{ config: ResolvedStarsConfig; hooks: StarsHookable }> {\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst loaded = await loadConfigFile({ cwd, configFile: options.configFile });\n\tconst source: ResolveConfigOptions = { cwd, configFile: loaded.configFile, config: loaded.config, env: options.env };\n\tconst resolved = resolveStarsConfig(source);\n\tconst hooks = createStarsHooks(resolved);\n\t// Modules install before `config:resolved`, so that hook already sees what they contributed.\n\tconst config = await installModules(resolved, hooks);\n\tsources.set(config, source);\n\n\tawait hooks.callHook('config:resolved', config);\n\treturn { config, hooks };\n}\n\n/**\n * Runs `env:options` on a copy of the resolved `env` options and returns a configuration carrying the result, which\n * is what the builders write into the entry. The resolved configuration itself is left untouched.\n *\n * When the hook changes the options, the configuration is resolved again with them, so everything read from the env\n * files — the default `dev.url` port above all — matches what the bot will load.\n */\nexport async function applyEnvOptions(config: ResolvedStarsConfig, hooks: StarsHookable): Promise<ResolvedStarsConfig> {\n\tif (!config.env.enabled) return config;\n\n\tconst options = { ...config.env.options };\n\tawait hooks.callHook('env:options', options, config);\n\n\tconst source = sources.get(config);\n\tif (source === undefined || JSON.stringify(options) === JSON.stringify(config.env.options)) {\n\t\treturn { ...config, env: { ...config.env, options } };\n\t}\n\n\treturn reresolve(config, source, { config: { ...source.config, env: { ...options, enabled: true } } });\n}\n\n/**\n * With `loader: 'varlock'`, resolves the configuration again with the variables `varlock load` returns, so the\n * defaults `stars.config` derives from the environment — the `dev.url` port — match what the bot loads. Every other\n * configuration is returned as-is: the schema reads its env files directly.\n */\nexport function withProjectEnv(config: ResolvedStarsConfig): ResolvedStarsConfig {\n\tconst source = sources.get(config);\n\tif (source === undefined || !config.env.enabled || config.env.options.loader !== 'varlock') return config;\n\treturn reresolve(config, source, { projectEnv: readProjectEnv(config) });\n}\n\nfunction reresolve(previous: ResolvedStarsConfig, source: ResolveConfigOptions, change: Partial<ResolveConfigOptions>): ResolvedStarsConfig {\n\tconst next = { ...source, ...change };\n\tconst resolved = resolveStarsConfig(next);\n\t// Modules ran once, against the first resolution: what they contributed carries over to the new one.\n\tconst config = { ...resolved, runtime: previous.runtime, imports: { ...resolved.imports, presets: previous.imports.presets } };\n\tsources.set(config, next);\n\treturn config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAa,cAAc;CAC1B,QAAQ;EACP,MAAM;EACN,OAAO;EACP,aAAa;CACd;CACA,KAAK;EACJ,MAAM;EACN,aAAa;CACd;AACD;;;;;AAWA,SAAgB,YAAY,SAA4B,MAAwB;CAC/E,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,CAAC,OAAO,aAAa,QAAQ,QAAQ,GAAG;EAClD,IAAI,aAAa,MAAM;EACvB,IAAI,SAAS,WAAW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H,QAAQ,IAAI,QAAQ,IAAI;CACxB,OAAO;AACR"}
package/dist/index.d.ts CHANGED
@@ -76,6 +76,41 @@ export declare const cliDiagnostics: import("nostics").Diagnostics<{
76
76
  why: (_p: {}) => string;
77
77
  fix: (_p: {}) => string;
78
78
  };
79
+ readonly DEPLOY_CONFIRMATION_REQUIRED: {
80
+ why: (_p: {}) => string;
81
+ fix: (_p: {}) => string;
82
+ };
83
+ readonly COMMANDS_DIFFER: {
84
+ why: (p: {
85
+ count: number;
86
+ }) => string;
87
+ fix: (_p: {
88
+ count: number;
89
+ }) => string;
90
+ };
91
+ readonly LOCAL_COMMANDS_UNAVAILABLE: {
92
+ why: (p: {
93
+ reason: string;
94
+ fix: string;
95
+ }) => string;
96
+ fix: (p: {
97
+ reason: string;
98
+ fix: string;
99
+ }) => string;
100
+ };
101
+ readonly DOCTOR_FAILED: {
102
+ why: (p: {
103
+ count: number;
104
+ }) => string;
105
+ };
106
+ readonly UNKNOWN_SHELL: {
107
+ why: (p: {
108
+ shell: string;
109
+ }) => string;
110
+ fix: (_p: {
111
+ shell: string;
112
+ }) => string;
113
+ };
79
114
  readonly INVALID_THEME: {
80
115
  why: (p: {
81
116
  theme: string;
@@ -86,6 +121,18 @@ export declare const cliDiagnostics: import("nostics").Diagnostics<{
86
121
  themes: string;
87
122
  }) => string;
88
123
  };
124
+ readonly INVALID_OPTION: {
125
+ why: (p: {
126
+ option: string;
127
+ value: string;
128
+ allowed: string;
129
+ }) => string;
130
+ fix: (p: {
131
+ option: string;
132
+ value: string;
133
+ allowed: string;
134
+ }) => string;
135
+ };
89
136
  readonly CODEGEN_OUTDATED: {
90
137
  why: (_p: {}) => string;
91
138
  };
@@ -182,6 +229,12 @@ interface Theme {
182
229
  success: string;
183
230
  warning: string;
184
231
  error: string;
232
+ /** The `info`, `debug` and `trace` level badges of the dashboard's log stream. */
233
+ info: string;
234
+ debug: string;
235
+ trace: string;
236
+ /** Names worth finding in a log line: a command, a piece, a channel that is switched on. */
237
+ accent: string;
185
238
  text: string | undefined;
186
239
  /** Foreground of a badge painted on `success`, `warning` or `busy`. */
187
240
  onBright: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/run.ts","../src/utils/errors.ts","../src/utils/diagnostics.ts","../src/utils/output-mode.ts","../src/utils/theme.ts"],"mappings":";;wBA8BsB,QAAQ,kBAAyC;;;qBCxB1D;WACZ;WACA;WACA;WACA;WACA;WACA;;YAGW,mBAAmB,uBAAuB;;;;;;wBAgBhC,YAAY,iBAAiB;wBAuBnC,WAAW,iBAAiB;;;;;;;;;;;;;;;;qBCvC/B,kCAAc;;IAKxB,MAAG;;;IAGH,MAAG;IACH,MAAG;;;IAGH,MAAG;IACH,MAAG;;;IAGH,MAAG;MAAQ;MAAgB;;IAC3B,MAAG;MAAQ;MAAgB;;;;IAI3B,MAAG;MAAQ;;;;IAGX,MAAG;MAAQ;;IACX,MAAG;MAAS;;;;IAGZ,MAAG;;;IAGH,MAAG;IACH,MAAG;;;IAGH,MAAG;MAAQ;MAAe;;IAC1B,MAAG;MAAQ;MAAe;;;;IAG1B,MAAG;;;IAGH,MAAG;MAAQ;MAAc;MAAc;;IACvC,MAAG;MAAQ;MAAc;MAAc;;;;IAGvC,MAAG;MAAQ;MAAgB;MAAgB;;IAC3C,MAAG;MAAQ;MAAgB;MAAgB;;;;IAgB3C,MAAG;MAAQ;MAAc;;IAEzB,MAAG;MAAS;MAAc;;;;IAI1B,MAAG;MAAQ;MAAqB;;;;KAKvB,iCAAiC;;;KCzFjC;UAEK;;EAEhB;EACA,MAAM,OAAO;;EAEb;;EAEA;EACA;EACA;;EAEA;;;;;;;wBAUe,kBAAkB,UAAS,2BAAgC;wBAkB3D,gBAAgB,MAAK,OAAO;;;;wBAU5B,eAAe,MAAK,OAAO,YAA0B;;;;wBASrD,qBAAqB,MAAK,OAAO;;;;qBCvDpC;KACD,uBAAuB;KACvB,YAAY,QAAQ;;;;;UAMf;;EAEhB;EACA;EACA;;E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MAAgB;;;;IAgB3C,MAAG;MAAQ;MAAc;;IAEzB,MAAG;MAAS;MAAc;;;;IAI1B,MAAG;MAAQ;MAAqB;;;;KAKvB,iCAAiC;;;KChHjC;UAEK;;EAEhB;EACA,MAAM,OAAO;;EAEb;;EAEA;EACA;EACA;;EAEA;;;;;;;wBAUe,kBAAkB,UAAS,2BAAgC;wBAkB3D,gBAAgB,MAAK,OAAO;;;;wBAU5B,eAAe,MAAK,OAAO,YAA0B;;;;wBASrD,qBAAqB,MAAK,OAAO;;;;qBCvDpC;KACD,uBAAuB;KACvB,YAAY,QAAQ;;;;;UAMf;;EAEhB;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;EACA;;EAEA;;EAEA;;KAGW,mBAAmB;qBAElB,QAAQ,SAAS,OAAO,WAAW;wBAoHhC,aAAa,SAAS,cAAc,MAAK,OAAO,aAA2B;UAI1E;;EAEhB;EACA,MAAM,OAAO;;EAEb,QAAQ;;;;;;wBAOO,sBAAsB,MAAM,KAAmB,SAAS,sBAAsB"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { t as runMain } from "./run-BiLZqib3.js";
1
+ import { t as runMain } from "./run-DMM2YlP3.js";
2
2
  import { i as shouldUseColor, n as prefersReducedMotion, r as resolveOutputMode, t as isCIEnvironment } from "./output-mode-Bp7Da8vJ.js";
3
3
  import { n as exitCodeOf, r as formatError, t as ExitCode } from "./errors-COFWKKKw.js";
4
- import { t as cliDiagnostics } from "./diagnostics-3JRAy8Xj.js";
5
- import { n as THEME_SETTINGS, o as resolveTheme, s as resolveThemeSetting, t as THEMES } from "./theme-3Fc_LI-2.js";
4
+ import { t as cliDiagnostics } from "./diagnostics-BysbNnPD.js";
5
+ import { n as THEME_SETTINGS, o as resolveTheme, s as resolveThemeSetting, t as THEMES } from "./theme-yS2h5dd_.js";
6
6
  import { configDiagnostics, loadStarsConfig } from "@wolfstar/schema";
7
7
 
8
8
  export { ExitCode, THEMES, THEME_SETTINGS, cliDiagnostics, configDiagnostics, exitCodeOf, formatError, isCIEnvironment, loadStarsConfig, prefersReducedMotion, resolveOutputMode, resolveTheme, resolveThemeSetting, runMain, shouldUseColor };
@@ -1,7 +1,7 @@
1
1
  import { t as readOwnPackageJson } from "./version-BzclCE19.js";
2
2
  import { i as shouldUseColor, r as resolveOutputMode } from "./output-mode-Bp7Da8vJ.js";
3
- import { t as findInstalledVersion } from "./project-D-8VIcyF.js";
4
- import { a as modulesPreloadWarning, l as projectArgs, n as loadProject, t as applyEnvOptions, u as resolveCwd } from "./hooks-BfDFM38k.js";
3
+ import { t as findInstalledVersion } from "./project-zlQStwsf.js";
4
+ import { a as modulesPreloadWarning, d as resolveCwd, n as loadProject, t as applyEnvOptions, u as projectArgs } from "./hooks-Cy6F2bhH.js";
5
5
  import { defineCommand } from "citty";
6
6
  import { relative } from "node:path";
7
7
  import { displayPath } from "@wolfstar/schema";
@@ -34,6 +34,10 @@ function collectInfo(config) {
34
34
  future: config.future,
35
35
  env: config.env,
36
36
  hooks: Object.keys(config.hooks),
37
+ modules: {
38
+ installed: (config.runtime?.modules ?? []).map((module) => module.name),
39
+ plugins: (config.runtime?.plugins ?? []).map((plugin) => `${plugin.module} → ${plugin.export} from ${plugin.from}`)
40
+ },
37
41
  warnings: [...config.warnings, modulesPreloadWarning(config)].filter((warning) => warning !== null).map((warning) => `${warning.code}: ${warning.message}`),
38
42
  options: {
39
43
  tsdown: Object.keys(config.tsdown),
@@ -77,12 +81,19 @@ function formatInfo(info, useColor) {
77
81
  row("health", info.dev.health ?? colors.dim("none")),
78
82
  row("typecheck", info.dev.typecheck.enabled ? `${info.dev.typecheck.checker} → ${show(info.dev.typecheck.tsconfig)}` : colors.dim("disabled")),
79
83
  row("tunnel", describeTunnel(info.dev.tunnel, colors)),
80
- row("log file", info.dev.logFile ? show(info.dev.logFile) : colors.dim("disabled"))
84
+ row("log file", info.dev.logFile ? show(info.dev.logFile) : colors.dim("disabled")),
85
+ row("log dir", info.dev.logs.dir ? `${show(info.dev.logs.dir)} (keeps ${info.dev.logs.keep})` : colors.dim("disabled")),
86
+ row("layout", info.dev.layout),
87
+ row("channels", info.dev.logs.channels?.join(", ") ?? colors.dim("all")),
88
+ row("levels", info.dev.logs.levels.join(", ")),
89
+ row("commands", `refresh: ${info.dev.commands.refresh}`),
90
+ row("hmr", info.dev.hmr ? "left to the bot when it hot reloads" : colors.dim("always restart"))
81
91
  ]),
82
92
  section("Codegen", [row("i18n", info.codegen.i18n ? `${show(info.codegen.i18n.locales)} → ${show(info.codegen.i18n.output)}` : colors.dim("disabled"))]),
83
93
  section("Future", [row("compat", `v${info.future.compatibilityVersion} defaults`), ...info.warnings.map((warning) => row("warning", colors.yellow(warning)))]),
84
94
  section("Env", [row("register", info.env.enabled ? colors.green(describeEnvOptions(info.env.options)) : colors.dim("disabled"))]),
85
95
  section("Hooks", [row("registered", info.hooks.join(", ") || colors.dim("none"))]),
96
+ section("Modules", [row("installed", info.modules.installed.join(", ") || colors.dim("none")), ...info.modules.plugins.map((plugin) => row("plugin", plugin))]),
86
97
  section("Experimental", [
87
98
  row("vite", flag(info.experimental.enableVite, colors)),
88
99
  row("nitro", flag(info.experimental.enableNitro, colors)),
@@ -148,4 +159,4 @@ var info_default = defineCommand({
148
159
 
149
160
  //#endregion
150
161
  export { info_default as default };
151
- //# sourceMappingURL=info-C1Kx_4Og.js.map
162
+ //# sourceMappingURL=info-CKJVMWIT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info-CKJVMWIT.js","names":[],"sources":["../src/commands/info.ts"],"sourcesContent":["import { displayPath, type ResolvedStarsConfig, type StarsEnvSetupOptions } from '@wolfstar/schema';\nimport { defineCommand } from 'citty';\nimport { createColors } from 'colorette';\nimport { arch, platform } from 'node:os';\nimport { relative } from 'node:path';\nimport { projectArgs, resolveCwd, type ProjectArgs } from '../utils/args.js';\nimport { applyEnvOptions, loadProject } from '../utils/hooks.js';\nimport { modulesPreloadWarning } from '../utils/modules.js';\nimport { resolveOutputMode, shouldUseColor } from '../utils/output-mode.js';\nimport { findInstalledVersion } from '../utils/project.js';\nimport { readOwnPackageJson } from '../utils/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\tfuture: ResolvedStarsConfig['future'];\n\tenv: ResolvedStarsConfig['env'];\n\t/** The names of the hooks registered in `stars.config`, flattened (`build:done`). */\n\thooks: string[];\n\t/** The installed modules, and the runtime plugins they registered (`module → export from package`). */\n\tmodules: { installed: string[]; plugins: string[] };\n\t/** Non-fatal configuration diagnostics, as `CODE: message`. */\n\twarnings: string[];\n\t/**\n\t * The option names set in the `tsdown`/`vite` blocks. Only the names: the values hold plugins and callbacks,\n\t * which neither serialize to JSON nor read usefully on a terminal.\n\t */\n\toptions: { tsdown: string[]; vite: string[] };\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\tfuture: config.future,\n\t\tenv: config.env,\n\t\thooks: Object.keys(config.hooks),\n\t\tmodules: {\n\t\t\tinstalled: (config.runtime?.modules ?? []).map((module) => module.name),\n\t\t\tplugins: (config.runtime?.plugins ?? []).map((plugin) => `${plugin.module} → ${plugin.export} from ${plugin.from}`)\n\t\t},\n\t\twarnings: [...config.warnings, modulesPreloadWarning(config)]\n\t\t\t.filter((warning) => warning !== null)\n\t\t\t.map((warning) => `${warning.code}: ${warning.message}`),\n\t\toptions: { tsdown: Object.keys(config.tsdown), vite: Object.keys(config.vite) }\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\t// Which file the build tool is configured from: its own, or this project's `stars.config`.\n\t\t\trow('config', info.build.configFile ? show(info.build.configFile) : colors.dim('stars.config')),\n\t\t\trow('options', describeOptions(info, colors)),\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\trow('log dir', info.dev.logs.dir ? `${show(info.dev.logs.dir)} (keeps ${info.dev.logs.keep})` : colors.dim('disabled')),\n\t\t\trow('layout', info.dev.layout),\n\t\t\trow('channels', info.dev.logs.channels?.join(', ') ?? colors.dim('all')),\n\t\t\trow('levels', info.dev.logs.levels.join(', ')),\n\t\t\trow('commands', `refresh: ${info.dev.commands.refresh}`),\n\t\t\trow('hmr', info.dev.hmr ? 'left to the bot when it hot reloads' : colors.dim('always restart'))\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('Future', [\n\t\t\trow('compat', `v${info.future.compatibilityVersion} defaults`),\n\t\t\t...info.warnings.map((warning) => row('warning', colors.yellow(warning)))\n\t\t]),\n\t\tsection('Env', [row('register', info.env.enabled ? colors.green(describeEnvOptions(info.env.options)) : colors.dim('disabled'))]),\n\t\tsection('Hooks', [row('registered', info.hooks.join(', ') || colors.dim('none'))]),\n\t\tsection('Modules', [\n\t\t\trow('installed', info.modules.installed.join(', ') || colors.dim('none')),\n\t\t\t...info.modules.plugins.map((plugin) => row('plugin', plugin))\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\t...(info.experimental.enableNitro ? [row('nitro preset', info.experimental.nitro.preset)] : []),\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 describeOptions(info: ProjectInfo, colors: ReturnType<typeof createColors>): string {\n\tconst names = info.build.tool === 'vite' ? info.options.vite : info.options.tsdown;\n\treturn names.length > 0 ? names.join(', ') : colors.dim('none');\n}\n\nfunction describeEnvOptions(options: Readonly<StarsEnvSetupOptions>): string {\n\tconst entries = Object.entries(options).map(([key, value]) => `${key} ${String(value)}`);\n\treturn entries.length > 0 ? `enabled (${entries.join(', ')})` : 'enabled';\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 project = await loadProject({ cwd: resolveCwd(options), configFile: options.config });\n\t// What the build would use: `env:options` may change the env files.\n\tconst config = await applyEnvOptions(project.config, project.hooks);\n\tconst info = collectInfo(config);\n\tstdout.write(`${options.json ? JSON.stringify(info, null, 2) : formatInfo(info, shouldUseColor())}\\n`);\n}\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\tawait runInfo({ config: args.config, cwd: args.cwd, json: args.json });\n\t}\n});\n"],"mappings":";;;;;;;;;;;AAgDA,SAAgB,YAAY,QAA0C;CACrE,OAAO;EACN,KAAK;GACJ,SAAS,mBAAmB,CAAC,CAAC;GAC9B,MAAM,QAAQ;GACd,UAAU,GAAG,SAAS,EAAE,GAAG,KAAK;GAChC,YAAY,kBAAkB;EAC/B;EACA,SAAS;GACR,KAAK,OAAO;GACZ,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,MAAM,OAAO,aAAa,QAAQ;GAClC,SAAS,OAAO,aAAa,WAAW;GACxC,OAAO,OAAO;GACd,kBAAkB,qBAAqB,OAAO,MAAM,0BAA0B;EAC/E;EACA,OAAO,OAAO;EACd,KAAK,OAAO;EACZ,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,cAAc,OAAO;EACrB,QAAQ,OAAO;EACf,KAAK,OAAO;EACZ,OAAO,OAAO,KAAK,OAAO,KAAK;EAC/B,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A,SAAS,eAAe,QAA8C,QAAiD;CACtH,QAAQ,OAAO,MAAf;EACC,KAAK,SACJ,OAAO;EACR,KAAK,OACJ,OAAO,OAAO;EACf,SACC,OAAO,OAAO,IAAI,UAAU;CAC9B;AACD;AAEA,eAAsB,QAAQ,SAAqC;CAClE,MAAM,SAAS,QAAQ,UAAU,QAAQ;CACzC,MAAM,UAAU,MAAM,YAAY;EAAE,KAAK,WAAW,OAAO;EAAG,YAAY,QAAQ;CAAO,CAAC;CAG1F,MAAM,OAAO,YAAY,MADJ,gBAAgB,QAAQ,QAAQ,QAAQ,KAAK,CACnC;CAC/B,OAAO,MAAM,GAAG,QAAQ,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,WAAW,MAAM,eAAe,CAAC,EAAE,GAAG;AACtG;AAEA,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,QAAQ;GAAE,QAAQ,KAAK;GAAQ,KAAK,KAAK;GAAK,MAAM,KAAK;EAAK,CAAC;CACtE;AACD,CAAC"}
@@ -12,20 +12,20 @@ async function createBuilder(config, hooks) {
12
12
  return new ExternalBuilder(config);
13
13
  }
14
14
  if (config.experimental.enableNitro) {
15
- const { NitroBuilder } = await import("./nitro-yjqZBh5L.js");
15
+ const { NitroBuilder } = await import("./nitro-B8u1iVgf.js");
16
16
  return new NitroBuilder(config);
17
17
  }
18
18
  switch (config.build.tool) {
19
19
  case "tsdown": {
20
- const { TsdownBuilder } = await import("./tsdown-DrWXld54.js");
20
+ const { TsdownBuilder } = await import("./tsdown-Dwt3JhPw.js");
21
21
  return new TsdownBuilder(config, hooks);
22
22
  }
23
23
  case "vite": {
24
- const { ViteBuilder } = await import("./vite-Bf7nrJx7.js");
24
+ const { ViteBuilder } = await import("./vite-YZUtv2Hk.js");
25
25
  return new ViteBuilder(config);
26
26
  }
27
27
  case "tsc": {
28
- const { TscBuilder } = await import("./tsc-B931Ezh7.js");
28
+ const { TscBuilder } = await import("./tsc-C5l5TQGC.js");
29
29
  return new TscBuilder(config);
30
30
  }
31
31
  case "none": {
@@ -94,4 +94,4 @@ var Locales = class extends EventEmitter {
94
94
 
95
95
  //#endregion
96
96
  export { createBuilder as n, Locales as t };
97
- //# sourceMappingURL=locales-BzOLRBVg.js.map
97
+ //# sourceMappingURL=locales-BJAP4HYf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales-BJAP4HYf.js","names":[],"sources":["../src/builders/index.ts","../src/utils/locales.ts"],"sourcesContent":["import type { ResolvedStarsConfig } from '@wolfstar/schema';\nimport type { StarsHookable } from '../utils/hooks.js';\nimport type { Builder } from './types.js';\n\n/**\n * Creates the builder for `build.tool`. `hooks` reach the builders that expose hooks of their own (`tsdown:options`).\n */\nexport async function createBuilder(config: ResolvedStarsConfig, hooks?: StarsHookable): Promise<Builder> {\n\t// The project runs its own build, so the CLI only watches what it writes (see `ExternalBuilder`) — including when\n\t// it is driving `vite build` with its own `nitro()` plugin itself; `build.output` already points at Nitro's\n\t// `server/index.mjs` in that case (see `resolveBuild`).\n\tif (config.experimental.enableExternalVite) {\n\t\tconst { ExternalBuilder } = await import('./external.js');\n\t\treturn new ExternalBuilder(config);\n\t}\n\n\t// Nitro is itself a Vite plugin — there is no separate `nitro build` step — so it is handled before the\n\t// `build.tool` switch below, the same way `enableExternalVite` is.\n\tif (config.experimental.enableNitro) {\n\t\tconst { NitroBuilder } = await import('./nitro.js');\n\t\treturn new NitroBuilder(config);\n\t}\n\n\tswitch (config.build.tool) {\n\t\tcase 'tsdown': {\n\t\t\tconst { TsdownBuilder } = await import('./tsdown.js');\n\t\t\treturn new TsdownBuilder(config, hooks);\n\t\t}\n\t\tcase 'vite': {\n\t\t\tconst { ViteBuilder } = await import('./vite.js');\n\t\t\treturn new ViteBuilder(config);\n\t\t}\n\t\tcase 'tsc': {\n\t\t\tconst { TscBuilder } = await import('./tsc.js');\n\t\t\treturn new TscBuilder(config);\n\t\t}\n\t\tcase 'none': {\n\t\t\tconst { NoneBuilder } = await import('./none.js');\n\t\t\treturn new NoneBuilder(config);\n\t\t}\n\t}\n}\n\nexport type { Builder, BuilderEvents, BuildOutcome } from './types.js';\n","import { EventEmitter } from 'node:events';\nimport { cpSync, existsSync, mkdirSync, rmSync } from 'node:fs';\nimport { dirname, join, relative } from 'node:path';\nimport type { ResolvedStarsConfig } from '@wolfstar/schema';\nimport type { LogLevel } from './log-buffer.js';\n\nexport interface LocalesEvents {\n\tchange: [];\n\tlog: [level: LogLevel, text: string];\n}\n\n/** Keeps the conventional `src/locales` data directory next to the compiled application. */\nexport class Locales extends EventEmitter<LocalesEvents> {\n\treadonly source: string;\n\treadonly destination: string;\n\t#watcher: { close(): Promise<void> } | null = null;\n\n\tpublic constructor(private readonly config: ResolvedStarsConfig) {\n\t\tsuper();\n\t\tthis.source = join(config.root, 'src', 'locales');\n\t\tthis.destination = join(config.build.outDir, 'locales');\n\t}\n\n\tpublic copy(): boolean {\n\t\tif (this.config.build.tool === 'none' || !existsSync(this.source)) return false;\n\t\tmkdirSync(this.destination, { recursive: true });\n\t\tcpSync(this.source, this.destination, { recursive: true, force: true });\n\t\treturn true;\n\t}\n\n\tpublic async watch(): Promise<void> {\n\t\tif (this.config.build.tool === 'none' || !existsSync(this.source) || this.#watcher) return;\n\t\tconst { watch } = await import('chokidar');\n\t\tconst watcher = watch(this.source, { ignoreInitial: true });\n\t\tthis.#watcher = watcher;\n\n\t\twatcher.on('all', (event, path) => {\n\t\t\ttry {\n\t\t\t\tconst target = join(this.destination, relative(this.source, path));\n\t\t\t\tif (event === 'unlink' || event === 'unlinkDir') rmSync(target, { recursive: event === 'unlinkDir', force: true });\n\t\t\t\telse if (existsSync(path)) {\n\t\t\t\t\tmkdirSync(dirname(target), { recursive: true });\n\t\t\t\t\tcpSync(path, target, { recursive: event === 'addDir', force: true });\n\t\t\t\t}\n\t\t\t\tthis.emit('change');\n\t\t\t} catch (error) {\n\t\t\t\tthis.emit('log', 'error', `Failed to copy locales: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t}\n\t\t});\n\t\twatcher.on('error', (error) => this.emit('log', 'error', error instanceof Error ? error.message : String(error)));\n\t\tawait new Promise<void>((resolve) => watcher.once('ready', resolve));\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,eAAsB,cAAc,QAA6B,OAAyC;CAIzG,IAAI,OAAO,aAAa,oBAAoB;EAC3C,MAAM,EAAE,oBAAoB,MAAM,OAAO;EACzC,OAAO,IAAI,gBAAgB,MAAM;CAClC;CAIA,IAAI,OAAO,aAAa,aAAa;EACpC,MAAM,EAAE,iBAAiB,MAAM,OAAO;EACtC,OAAO,IAAI,aAAa,MAAM;CAC/B;CAEA,QAAQ,OAAO,MAAM,MAArB;EACC,KAAK,UAAU;GACd,MAAM,EAAE,kBAAkB,MAAM,OAAO;GACvC,OAAO,IAAI,cAAc,QAAQ,KAAK;EACvC;EACA,KAAK,QAAQ;GACZ,MAAM,EAAE,gBAAgB,MAAM,OAAO;GACrC,OAAO,IAAI,YAAY,MAAM;EAC9B;EACA,KAAK,OAAO;GACX,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,OAAO,IAAI,WAAW,MAAM;EAC7B;EACA,KAAK,QAAQ;GACZ,MAAM,EAAE,gBAAgB,MAAM,OAAO;GACrC,OAAO,IAAI,YAAY,MAAM;EAC9B;CACD;AACD;;;;;AC7BA,IAAa,UAAb,cAA6B,aAA4B;CAKpB;CAJpC,AAAS;CACT,AAAS;CACT,WAA8C;CAE9C,AAAO,YAAY,AAAiB,QAA6B;EAChE,MAAM;EAD6B;EAEnC,KAAK,SAAS,KAAK,OAAO,MAAM,OAAO,SAAS;EAChD,KAAK,cAAc,KA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