@wolfstar/schema 0.2.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/LICENSE +201 -0
- package/README.md +58 -0
- package/dist/esm/config.d.ts +398 -0
- package/dist/esm/config.d.ts.map +1 -0
- package/dist/esm/config.js +21 -0
- package/dist/esm/config.js.map +1 -0
- package/dist/esm/index.d.ts +472 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +857 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/config.ts
|
|
2
|
+
/**
|
|
3
|
+
* Typed helper for `stars.config.{ts,mts,cts,js,mjs,cjs}` files.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { defineConfig } from '@wolfstar/http-framework/config';
|
|
8
|
+
*
|
|
9
|
+
* export default defineConfig({
|
|
10
|
+
* entry: 'src/main.ts',
|
|
11
|
+
* build: { tool: 'tsdown' }
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
function defineConfig(config) {
|
|
16
|
+
return config;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { defineConfig };
|
|
21
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../src/config.ts"],"sourcesContent":["import type { StarsConfig } from './types/config.js';\n\nexport type * from './types/config.js';\n\n/**\n * Typed helper for `stars.config.{ts,mts,cts,js,mjs,cjs}` files.\n *\n * @example\n * ```ts\n * import { defineConfig } from '@wolfstar/http-framework/config';\n *\n * export default defineConfig({\n * \tentry: 'src/main.ts',\n * \tbuild: { tool: 'tsdown' }\n * });\n * ```\n */\nexport function defineConfig(config: StarsConfig): StarsConfig {\n\treturn config;\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,aAAa,QAAkC;CAC9D,OAAO;AACR"}
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { StarsBuildConfig, StarsBuildTool, StarsCodegenConfig, StarsCompatibilityVersion, StarsConfig, StarsDevConfig, StarsExperimentalConfig, StarsFutureConfig, StarsI18nCodegenConfig, StarsImportsConfig, StarsNitroConfig, StarsTsdownConfig, StarsTunnelConfig, StarsTypecheckConfig, StarsTypechecker, StarsViteConfig, defineConfig } from "./config.js";
|
|
2
|
+
import { EventEmitter } from "node:events";
|
|
3
|
+
//#region src/config/resolve.d.ts
|
|
4
|
+
interface PackageJsonLike {
|
|
5
|
+
name?: string;
|
|
6
|
+
/** `tsdown` reads its options from here as well as from a `tsdown.config.*`. */
|
|
7
|
+
tsdown?: unknown;
|
|
8
|
+
version?: string;
|
|
9
|
+
main?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
scripts?: Record<string, string>;
|
|
12
|
+
dependencies?: Record<string, string>;
|
|
13
|
+
devDependencies?: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
interface ResolvedBuildConfig {
|
|
16
|
+
readonly tool: StarsBuildTool;
|
|
17
|
+
/** Absolute output directory. */
|
|
18
|
+
readonly outDir: string;
|
|
19
|
+
/** Absolute `tsconfig.json` used by `tsc`, `null` for the other tools. */
|
|
20
|
+
readonly tsconfig: string | null;
|
|
21
|
+
/** Absolute path of the file `node` runs, i.e. the built entry (or the entry itself when `tool` is `none`). */
|
|
22
|
+
readonly output: string;
|
|
23
|
+
/**
|
|
24
|
+
* Absolute path of the build tool's own configuration file (`tsdown.config.*`, `vite.config.*`), `null` when the
|
|
25
|
+
* tool has none — which is always the case for `tsdown` with `future.compatibilityVersion` 4, where the build is
|
|
26
|
+
* configured from `stars.config` alone.
|
|
27
|
+
*/
|
|
28
|
+
readonly configFile: string | null;
|
|
29
|
+
}
|
|
30
|
+
interface ResolvedTypecheckConfig {
|
|
31
|
+
readonly enabled: boolean;
|
|
32
|
+
/** Absolute `tsconfig.json` the type checker runs against, `null` when it could not be found. */
|
|
33
|
+
readonly tsconfig: string | null;
|
|
34
|
+
/** The type checker to run, with `'auto'` already resolved. */
|
|
35
|
+
readonly checker: StarsTypechecker;
|
|
36
|
+
}
|
|
37
|
+
type ResolvedTunnelConfig = {
|
|
38
|
+
readonly mode: 'off';
|
|
39
|
+
} |
|
|
40
|
+
/** A `cloudflared` quick tunnel, whose hostname is only known once it is up. */
|
|
41
|
+
{
|
|
42
|
+
readonly mode: 'quick';
|
|
43
|
+
readonly path: string;
|
|
44
|
+
readonly updateEndpoint: boolean;
|
|
45
|
+
} |
|
|
46
|
+
/** An https URL the user already serves. */
|
|
47
|
+
{
|
|
48
|
+
readonly mode: 'url';
|
|
49
|
+
readonly url: string;
|
|
50
|
+
readonly path: string;
|
|
51
|
+
readonly updateEndpoint: boolean;
|
|
52
|
+
};
|
|
53
|
+
interface ResolvedDevConfig {
|
|
54
|
+
readonly banner: readonly string[] | false | null;
|
|
55
|
+
readonly watch: readonly string[];
|
|
56
|
+
readonly ignore: readonly string[];
|
|
57
|
+
readonly debounce: number;
|
|
58
|
+
readonly env: Readonly<Record<string, string>>;
|
|
59
|
+
readonly nodeArgs: readonly string[];
|
|
60
|
+
readonly args: readonly string[];
|
|
61
|
+
readonly url: string | null;
|
|
62
|
+
readonly health: string | null;
|
|
63
|
+
readonly killTimeout: number;
|
|
64
|
+
readonly typecheck: ResolvedTypecheckConfig;
|
|
65
|
+
readonly tunnel: ResolvedTunnelConfig;
|
|
66
|
+
/** Absolute path of the file the dev session's logs are mirrored into, `null` when disabled. */
|
|
67
|
+
readonly logFile: string | null;
|
|
68
|
+
}
|
|
69
|
+
interface ResolvedNitroConfig {
|
|
70
|
+
readonly [option: string]: unknown;
|
|
71
|
+
readonly preset: string;
|
|
72
|
+
}
|
|
73
|
+
interface ResolvedExperimentalConfig {
|
|
74
|
+
readonly enableVite: boolean;
|
|
75
|
+
readonly enableExternalVite: boolean;
|
|
76
|
+
readonly enableNitro: boolean;
|
|
77
|
+
readonly nitro: ResolvedNitroConfig;
|
|
78
|
+
}
|
|
79
|
+
interface ResolvedFutureConfig {
|
|
80
|
+
readonly compatibilityVersion: StarsCompatibilityVersion;
|
|
81
|
+
}
|
|
82
|
+
interface ResolvedImportsConfig {
|
|
83
|
+
readonly enabled: boolean;
|
|
84
|
+
/** Directory glob patterns, relative to the project root (the way `unimport` scans them). */
|
|
85
|
+
readonly dirs: readonly string[];
|
|
86
|
+
readonly presets: readonly string[];
|
|
87
|
+
readonly exclude: readonly string[];
|
|
88
|
+
/** Absolute path of the generated declaration file. */
|
|
89
|
+
readonly dts: string;
|
|
90
|
+
}
|
|
91
|
+
interface ResolvedI18nCodegenConfig {
|
|
92
|
+
readonly locales: string;
|
|
93
|
+
readonly output: string;
|
|
94
|
+
}
|
|
95
|
+
interface ResolvedCodegenConfig {
|
|
96
|
+
readonly i18n: ResolvedI18nCodegenConfig | null;
|
|
97
|
+
}
|
|
98
|
+
interface ResolvedStarsConfig {
|
|
99
|
+
/** Absolute path of the configuration file, `null` when running on defaults. */
|
|
100
|
+
readonly configFile: string | null;
|
|
101
|
+
/** The directory the CLI was invoked from. */
|
|
102
|
+
readonly cwd: string;
|
|
103
|
+
/** Absolute project root. */
|
|
104
|
+
readonly root: string;
|
|
105
|
+
readonly packageJson: PackageJsonLike | null;
|
|
106
|
+
/** Absolute source entry. */
|
|
107
|
+
readonly entry: string;
|
|
108
|
+
readonly build: ResolvedBuildConfig;
|
|
109
|
+
readonly dev: ResolvedDevConfig;
|
|
110
|
+
readonly codegen: ResolvedCodegenConfig;
|
|
111
|
+
readonly imports: ResolvedImportsConfig;
|
|
112
|
+
readonly experimental: ResolvedExperimentalConfig;
|
|
113
|
+
readonly future: ResolvedFutureConfig;
|
|
114
|
+
/** Raw options merged into `vite.config.*`. */
|
|
115
|
+
readonly vite: Readonly<Record<string, unknown>>;
|
|
116
|
+
/** The `tsdown` build's options: merged over `tsdown.config.*` at compatibility version 3, the whole build at 4. */
|
|
117
|
+
readonly tsdown: Readonly<Record<string, unknown>>;
|
|
118
|
+
}
|
|
119
|
+
interface ResolveConfigOptions {
|
|
120
|
+
cwd: string;
|
|
121
|
+
configFile: string | null;
|
|
122
|
+
config: StarsConfig;
|
|
123
|
+
env?: NodeJS.ProcessEnv;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Applies defaults, validates every option and resolves all paths to absolute ones.
|
|
127
|
+
*
|
|
128
|
+
* @throws {Diagnostic} (from `nostics`, via {@link configDiagnostics}) with an actionable `fix` on the first invalid option.
|
|
129
|
+
*/
|
|
130
|
+
export declare function resolveStarsConfig(options: ResolveConfigOptions): ResolvedStarsConfig;
|
|
131
|
+
/**
|
|
132
|
+
* Presents an absolute path relative to `root` when possible, for display purposes.
|
|
133
|
+
*/
|
|
134
|
+
export declare function displayPath(root: string, path: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* Reads the project's environment layers from `src/.env*` and `.env*` into a plain object, the way `stars dev` and
|
|
137
|
+
* `stars commands` need it:
|
|
138
|
+
* these files are only loaded into `process.env` by the bot itself once it starts (see `@wolfstar/env-utilities`),
|
|
139
|
+
* so by the time the CLI runs they are not there yet. This is a minimal line reader, not a full dotenv
|
|
140
|
+
* implementation — quoting is stripped, but expansion (`dotenv-expand`) is not. Earlier files win, matching
|
|
141
|
+
* dotenv's own precedence.
|
|
142
|
+
*/
|
|
143
|
+
export declare function readProjectEnvFiles(root: string, environment?: string): Record<string, string>;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/config/load.d.ts
|
|
146
|
+
export declare const CONFIG_EXTENSIONS: readonly ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs'];
|
|
147
|
+
export declare const CONFIG_FILE_NAMES: string[];
|
|
148
|
+
interface LoadConfigFileOptions {
|
|
149
|
+
/** The directory to discover the configuration file from. */
|
|
150
|
+
cwd: string;
|
|
151
|
+
/** An explicit configuration file (`--config`), resolved from `cwd`. */
|
|
152
|
+
configFile?: string | null;
|
|
153
|
+
}
|
|
154
|
+
interface LoadedConfigFile {
|
|
155
|
+
/** The absolute path of the loaded file, `null` when running on defaults. */
|
|
156
|
+
configFile: string | null;
|
|
157
|
+
config: StarsConfig;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Finds the first `stars.config.*` file in `cwd`, in {@link CONFIG_FILE_NAMES} order.
|
|
161
|
+
*/
|
|
162
|
+
export declare function discoverConfigFile(cwd: string): string | null;
|
|
163
|
+
/**
|
|
164
|
+
* Loads the raw configuration object. The loader (`c12`) is imported lazily so
|
|
165
|
+
* commands that never touch the configuration stay fast.
|
|
166
|
+
*/
|
|
167
|
+
export declare function loadConfigFile(options: LoadConfigFileOptions): Promise<LoadedConfigFile>;
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/config/errors.d.ts
|
|
170
|
+
/**
|
|
171
|
+
* Structured, stable diagnostic codes for every way a `stars.config.*` can fail to load or validate.
|
|
172
|
+
*
|
|
173
|
+
* This is a plain data error (no exit code or terminal formatting), so nothing here reports anywhere on its own —
|
|
174
|
+
* `reporters` stays empty and each call only builds and returns a `Diagnostic`. That keeps it meaningful outside a
|
|
175
|
+
* CLI, e.g. for a dashboard or test that calls {@link loadStarsConfig} directly; `@wolfstar/cli` is what renders it
|
|
176
|
+
* and picks an exit code (`exitCodeOf`).
|
|
177
|
+
*
|
|
178
|
+
* The `sources` field (populated with the configuration file, when there is one) carries the "which file" grounding
|
|
179
|
+
* `ConfigError` used to expose as `.file`; the "which option" grounding it exposed as `.path` is folded directly into
|
|
180
|
+
* every `why`/`fix` message instead, the way every other diagnostic code already reads.
|
|
181
|
+
*
|
|
182
|
+
* `why` and `fix` are always given the same, fully-typed params object (even when one of them ignores part of it):
|
|
183
|
+
* a bare `() => value` loses nostics' param-type inference (a zero-arg function widens to `unknown` params), so every
|
|
184
|
+
* entry here spells out its shape on both sides instead.
|
|
185
|
+
*/
|
|
186
|
+
export declare const configDiagnostics: import("nostics").Diagnostics<{
|
|
187
|
+
readonly ROOT_NOT_FOUND: {
|
|
188
|
+
why: (p: {
|
|
189
|
+
root: string;
|
|
190
|
+
}) => string;
|
|
191
|
+
fix: (_p: {
|
|
192
|
+
root: string;
|
|
193
|
+
}) => string;
|
|
194
|
+
};
|
|
195
|
+
readonly PACKAGE_JSON_INVALID: {
|
|
196
|
+
why: (p: {
|
|
197
|
+
file: string;
|
|
198
|
+
message: string;
|
|
199
|
+
}) => string;
|
|
200
|
+
fix: (_p: {
|
|
201
|
+
file: string;
|
|
202
|
+
message: string;
|
|
203
|
+
}) => string;
|
|
204
|
+
};
|
|
205
|
+
readonly ENTRY_NOT_FOUND: {
|
|
206
|
+
why: (p: {
|
|
207
|
+
entry: string;
|
|
208
|
+
}) => string;
|
|
209
|
+
fix: (_p: {
|
|
210
|
+
entry: string;
|
|
211
|
+
}) => string;
|
|
212
|
+
};
|
|
213
|
+
readonly ENTRY_DEFAULT_NOT_FOUND: {
|
|
214
|
+
why: (p: {
|
|
215
|
+
root: string;
|
|
216
|
+
defaults: string;
|
|
217
|
+
}) => string;
|
|
218
|
+
fix: (p: {
|
|
219
|
+
root: string;
|
|
220
|
+
defaults: string;
|
|
221
|
+
}) => string;
|
|
222
|
+
};
|
|
223
|
+
readonly INVALID_BUILD_TOOL: {
|
|
224
|
+
why: (p: {
|
|
225
|
+
tool: string;
|
|
226
|
+
}) => string;
|
|
227
|
+
fix: (_p: {
|
|
228
|
+
tool: string;
|
|
229
|
+
}) => string;
|
|
230
|
+
};
|
|
231
|
+
readonly EXPERIMENTAL_BUILD_TOOL: {
|
|
232
|
+
why: (p: {
|
|
233
|
+
tool: string;
|
|
234
|
+
flag: string;
|
|
235
|
+
}) => string;
|
|
236
|
+
fix: (p: {
|
|
237
|
+
tool: string;
|
|
238
|
+
flag: string;
|
|
239
|
+
}) => string;
|
|
240
|
+
};
|
|
241
|
+
readonly BUILD_TOOL_REQUIRED: {
|
|
242
|
+
why: (p: {
|
|
243
|
+
entry: string;
|
|
244
|
+
}) => string;
|
|
245
|
+
fix: (_p: {
|
|
246
|
+
entry: string;
|
|
247
|
+
}) => string;
|
|
248
|
+
};
|
|
249
|
+
readonly TSCONFIG_EXPLICIT_NOT_FOUND: {
|
|
250
|
+
why: (p: {
|
|
251
|
+
tsconfig: string;
|
|
252
|
+
path: string;
|
|
253
|
+
}) => string;
|
|
254
|
+
fix: (p: {
|
|
255
|
+
tsconfig: string;
|
|
256
|
+
path: string;
|
|
257
|
+
}) => string;
|
|
258
|
+
};
|
|
259
|
+
readonly TSCONFIG_NOT_FOUND: {
|
|
260
|
+
why: (p: {
|
|
261
|
+
root: string;
|
|
262
|
+
suggestion: string;
|
|
263
|
+
}) => string;
|
|
264
|
+
fix: (p: {
|
|
265
|
+
root: string;
|
|
266
|
+
suggestion: string;
|
|
267
|
+
}) => string;
|
|
268
|
+
};
|
|
269
|
+
readonly TSDOWN_OPTIONS_REQUIRE_TSDOWN: {
|
|
270
|
+
why: (_p: {
|
|
271
|
+
tool: string;
|
|
272
|
+
}) => string;
|
|
273
|
+
fix: (p: {
|
|
274
|
+
tool: string;
|
|
275
|
+
}) => string;
|
|
276
|
+
};
|
|
277
|
+
readonly VITE_OPTIONS_REQUIRE_VITE: {
|
|
278
|
+
why: (_p: {
|
|
279
|
+
tool: string;
|
|
280
|
+
}) => string;
|
|
281
|
+
fix: (p: {
|
|
282
|
+
tool: string;
|
|
283
|
+
}) => string;
|
|
284
|
+
};
|
|
285
|
+
readonly TSDOWN_CONFIG_FILE_UNSUPPORTED: {
|
|
286
|
+
why: (p: {
|
|
287
|
+
file: string;
|
|
288
|
+
version: number;
|
|
289
|
+
legacyVersion: number;
|
|
290
|
+
}) => string;
|
|
291
|
+
fix: (p: {
|
|
292
|
+
file: string;
|
|
293
|
+
version: number;
|
|
294
|
+
legacyVersion: number;
|
|
295
|
+
}) => string;
|
|
296
|
+
};
|
|
297
|
+
readonly INVALID_TYPE: {
|
|
298
|
+
why: (p: {
|
|
299
|
+
path: string;
|
|
300
|
+
expected: string;
|
|
301
|
+
value: unknown;
|
|
302
|
+
fix: string;
|
|
303
|
+
}) => string;
|
|
304
|
+
fix: (p: {
|
|
305
|
+
path: string;
|
|
306
|
+
expected: string;
|
|
307
|
+
value: unknown;
|
|
308
|
+
fix: string;
|
|
309
|
+
}) => string;
|
|
310
|
+
};
|
|
311
|
+
readonly INVALID_COMPATIBILITY_VERSION: {
|
|
312
|
+
why: (p: {
|
|
313
|
+
value: unknown;
|
|
314
|
+
legacyVersion: number;
|
|
315
|
+
latestVersion: number;
|
|
316
|
+
}) => string;
|
|
317
|
+
fix: (p: {
|
|
318
|
+
value: unknown;
|
|
319
|
+
legacyVersion: number;
|
|
320
|
+
latestVersion: number;
|
|
321
|
+
}) => string;
|
|
322
|
+
};
|
|
323
|
+
readonly UNKNOWN_OPTION: {
|
|
324
|
+
why: (p: {
|
|
325
|
+
path: string;
|
|
326
|
+
parent: string;
|
|
327
|
+
known: string;
|
|
328
|
+
}) => string;
|
|
329
|
+
fix: (p: {
|
|
330
|
+
path: string;
|
|
331
|
+
parent: string;
|
|
332
|
+
known: string;
|
|
333
|
+
}) => string;
|
|
334
|
+
};
|
|
335
|
+
readonly EXPERIMENT_REQUIRED: {
|
|
336
|
+
why: (p: {
|
|
337
|
+
path: string;
|
|
338
|
+
requires: string;
|
|
339
|
+
drop: string;
|
|
340
|
+
}) => string;
|
|
341
|
+
fix: (p: {
|
|
342
|
+
path: string;
|
|
343
|
+
requires: string;
|
|
344
|
+
drop: string;
|
|
345
|
+
}) => string;
|
|
346
|
+
};
|
|
347
|
+
readonly IMPORTS_REQUIRE_TSDOWN: {
|
|
348
|
+
why: (_p: {}) => string;
|
|
349
|
+
fix: (_p: {}) => string;
|
|
350
|
+
};
|
|
351
|
+
readonly LOCALES_NOT_FOUND: {
|
|
352
|
+
why: (p: {
|
|
353
|
+
locales: string;
|
|
354
|
+
}) => string;
|
|
355
|
+
fix: (_p: {
|
|
356
|
+
locales: string;
|
|
357
|
+
}) => string;
|
|
358
|
+
};
|
|
359
|
+
readonly INVALID_URL: {
|
|
360
|
+
why: (p: {
|
|
361
|
+
url: string;
|
|
362
|
+
fix: string;
|
|
363
|
+
}) => string;
|
|
364
|
+
fix: (p: {
|
|
365
|
+
url: string;
|
|
366
|
+
fix: string;
|
|
367
|
+
}) => string;
|
|
368
|
+
};
|
|
369
|
+
readonly TUNNEL_URL_NOT_HTTPS: {
|
|
370
|
+
why: (p: {
|
|
371
|
+
url: string;
|
|
372
|
+
}) => string;
|
|
373
|
+
fix: (_p: {
|
|
374
|
+
url: string;
|
|
375
|
+
}) => string;
|
|
376
|
+
};
|
|
377
|
+
readonly INVALID_TYPECHECKER: {
|
|
378
|
+
why: (p: {
|
|
379
|
+
checker: string;
|
|
380
|
+
}) => string;
|
|
381
|
+
fix: (_p: {
|
|
382
|
+
checker: string;
|
|
383
|
+
}) => string;
|
|
384
|
+
};
|
|
385
|
+
readonly CONFIG_NOT_FOUND: {
|
|
386
|
+
why: (p: {
|
|
387
|
+
file: string;
|
|
388
|
+
cwd: string;
|
|
389
|
+
names: string;
|
|
390
|
+
}) => string;
|
|
391
|
+
fix: (p: {
|
|
392
|
+
file: string;
|
|
393
|
+
cwd: string;
|
|
394
|
+
names: string;
|
|
395
|
+
}) => string;
|
|
396
|
+
};
|
|
397
|
+
readonly CONFIG_LOAD_FAILED: {
|
|
398
|
+
why: (p: {
|
|
399
|
+
message: string;
|
|
400
|
+
}) => string;
|
|
401
|
+
fix: (_p: {
|
|
402
|
+
message: string;
|
|
403
|
+
}) => string;
|
|
404
|
+
};
|
|
405
|
+
readonly CONFIG_NOT_OBJECT: {
|
|
406
|
+
why: (_p: {}) => string;
|
|
407
|
+
fix: (_p: {}) => string;
|
|
408
|
+
};
|
|
409
|
+
}, readonly []>;
|
|
410
|
+
type ConfigDiagnosticCode = keyof typeof configDiagnostics;
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/config/index.d.ts
|
|
413
|
+
export interface LoadStarsConfigOptions {
|
|
414
|
+
/**
|
|
415
|
+
* The directory to discover `stars.config.*` from.
|
|
416
|
+
* @default process.cwd()
|
|
417
|
+
*/
|
|
418
|
+
cwd?: string;
|
|
419
|
+
/** An explicit configuration file, resolved from `cwd`. */
|
|
420
|
+
configFile?: string | null;
|
|
421
|
+
/**
|
|
422
|
+
* Environment used for defaults such as `HTTP_PORT`.
|
|
423
|
+
* @default process.env
|
|
424
|
+
*/
|
|
425
|
+
env?: NodeJS.ProcessEnv;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Loads, validates and resolves a project's `stars.config.*`.
|
|
429
|
+
*
|
|
430
|
+
* @throws {Diagnostic} (from `nostics`, via {@link configDiagnostics}) when the configuration file cannot be loaded or contains an invalid option.
|
|
431
|
+
*/
|
|
432
|
+
export declare function loadStarsConfig(options?: LoadStarsConfigOptions): Promise<ResolvedStarsConfig>;
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region src/types/builder.d.ts
|
|
435
|
+
type BuilderLogLevel = 'debug' | 'info' | 'success' | 'warn' | 'error';
|
|
436
|
+
interface BuildOutcome {
|
|
437
|
+
ok: boolean;
|
|
438
|
+
durationMs: number;
|
|
439
|
+
/** A one-line summary, e.g. the first error. */
|
|
440
|
+
message: string | null;
|
|
441
|
+
}
|
|
442
|
+
interface BuilderEvents {
|
|
443
|
+
start: [];
|
|
444
|
+
/** Coarse, real lifecycle milestones, not an estimate of compiler work remaining. */
|
|
445
|
+
progress: [fraction: number, message: string];
|
|
446
|
+
success: [outcome: BuildOutcome];
|
|
447
|
+
failure: [outcome: BuildOutcome];
|
|
448
|
+
log: [level: BuilderLogLevel, text: string];
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Turns project sources into the runnable output, once or continuously.
|
|
452
|
+
* Implementations report progress through {@link BuilderEvents}.
|
|
453
|
+
*/
|
|
454
|
+
interface Builder extends EventEmitter<BuilderEvents> {
|
|
455
|
+
readonly tool: StarsBuildTool;
|
|
456
|
+
/** Runs a single build. Compilation failures are reported in the outcome; dependency loading may throw. */
|
|
457
|
+
build(): Promise<BuildOutcome>;
|
|
458
|
+
/** Starts watching. Resolves once the watcher is set up; builds are reported through events. */
|
|
459
|
+
watch(): Promise<void>;
|
|
460
|
+
/** Stops watching. */
|
|
461
|
+
close(): Promise<void>;
|
|
462
|
+
}
|
|
463
|
+
/** Services supplied by the host; server integrations never import the CLI. */
|
|
464
|
+
interface BuilderContext {
|
|
465
|
+
/** Resolve build dependencies from the consuming project and report missing dependencies. */
|
|
466
|
+
importFromProject<T>(root: string, id: string, hint: string): Promise<T>;
|
|
467
|
+
/** Create the host's entry transformation for installed plugin registrations. */
|
|
468
|
+
pluginRegistrations(config: ResolvedStarsConfig): object;
|
|
469
|
+
}
|
|
470
|
+
//#endregion
|
|
471
|
+
export { type BuildOutcome, type Builder, type BuilderContext, type BuilderEvents, type BuilderLogLevel, type ConfigDiagnosticCode, type LoadConfigFileOptions, type LoadedConfigFile, type PackageJsonLike, type ResolveConfigOptions, type ResolvedBuildConfig, type ResolvedCodegenConfig, type ResolvedDevConfig, type ResolvedExperimentalConfig, type ResolvedFutureConfig, type ResolvedI18nCodegenConfig, type ResolvedImportsConfig, type ResolvedNitroConfig, type ResolvedStarsConfig, type ResolvedTunnelConfig, type ResolvedTypecheckConfig, type StarsBuildConfig, type StarsBuildTool, type StarsCodegenConfig, type StarsCompatibilityVersion, type StarsConfig, type StarsDevConfig, type StarsExperimentalConfig, type StarsFutureConfig, type StarsI18nCodegenConfig, type StarsImportsConfig, type StarsNitroConfig, type StarsTsdownConfig, type StarsTunnelConfig, type StarsTypecheckConfig, type StarsTypechecker, type StarsViteConfig, defineConfig };
|
|
472
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/config/resolve.ts","../../src/config/load.ts","../../src/config/errors.ts","../../src/config/index.ts","../../src/types/builder.ts"],"mappings":";;;UAciB;EAChB;;EAEA;EACA;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