@kimesh/cli 0.1.0-nightly.20260120032145 → 0.1.0-nightly.20260120063147
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/bin/km.mjs +0 -0
- package/dist/_shared-CEwpPT2B.js +84 -0
- package/dist/build-Ce4Dm8mI.js +34 -0
- package/dist/commands/init.d.ts +24 -0
- package/dist/commands/init.js +198 -0
- package/dist/dev-o5sR0-kW.js +75 -0
- package/dist/generate-Dx64ract.js +21 -0
- package/dist/index.d.ts +361 -1
- package/dist/index.js +80 -1
- package/dist/kit-BcEYldTS.js +39 -0
- package/dist/layer-D829AuwM.js +258 -0
- package/dist/main-CCPXvZyj.d.ts +10 -0
- package/dist/main-DncTPs_e.js +47 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/prepare-DScUWnaY.js +45 -0
- package/dist/run-DCL2u7IK.js +15 -0
- package/dist/run-DiuH8yNF.d.ts +8 -0
- package/dist/run.d.ts +1 -1
- package/dist/run.js +2 -5
- package/package.json +32 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,362 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { main$1 as main, version$1 as version } from "./main-CCPXvZyj.js";
|
|
2
|
+
import { run$1 as run } from "./run-DiuH8yNF.js";
|
|
3
|
+
import * as citty2 from "citty";
|
|
4
|
+
import * as consola0 from "consola";
|
|
5
|
+
import * as _kimesh_kit0 from "@kimesh/kit";
|
|
6
|
+
|
|
7
|
+
//#region src/commands/index.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Command registry with lazy loading
|
|
10
|
+
* Commands are only imported when actually used
|
|
11
|
+
*/
|
|
12
|
+
declare const commands: {
|
|
13
|
+
readonly dev: () => Promise<citty2.CommandDef<{
|
|
14
|
+
port: {
|
|
15
|
+
type: "string";
|
|
16
|
+
alias: string;
|
|
17
|
+
description: string;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
host: {
|
|
21
|
+
type: "string";
|
|
22
|
+
alias: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
open: {
|
|
26
|
+
type: "boolean";
|
|
27
|
+
alias: string;
|
|
28
|
+
description: string;
|
|
29
|
+
default: false;
|
|
30
|
+
};
|
|
31
|
+
layers: {
|
|
32
|
+
type: "string";
|
|
33
|
+
alias: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
"exclude-layers": {
|
|
37
|
+
type: "string";
|
|
38
|
+
alias: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
root: {
|
|
42
|
+
type: "string";
|
|
43
|
+
alias: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
config: {
|
|
47
|
+
type: "string";
|
|
48
|
+
alias: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
logLevel: {
|
|
52
|
+
type: "string";
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
}>>;
|
|
56
|
+
readonly build: () => Promise<citty2.CommandDef<{
|
|
57
|
+
minify: {
|
|
58
|
+
type: "boolean";
|
|
59
|
+
description: string;
|
|
60
|
+
default: true;
|
|
61
|
+
};
|
|
62
|
+
sourcemap: {
|
|
63
|
+
type: "boolean";
|
|
64
|
+
description: string;
|
|
65
|
+
default: false;
|
|
66
|
+
};
|
|
67
|
+
root: {
|
|
68
|
+
type: "string";
|
|
69
|
+
alias: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
config: {
|
|
73
|
+
type: "string";
|
|
74
|
+
alias: string;
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
logLevel: {
|
|
78
|
+
type: "string";
|
|
79
|
+
description: string;
|
|
80
|
+
};
|
|
81
|
+
}>>;
|
|
82
|
+
readonly generate: () => Promise<citty2.CommandDef<{
|
|
83
|
+
root: {
|
|
84
|
+
type: "string";
|
|
85
|
+
alias: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
config: {
|
|
89
|
+
type: "string";
|
|
90
|
+
alias: string;
|
|
91
|
+
description: string;
|
|
92
|
+
};
|
|
93
|
+
logLevel: {
|
|
94
|
+
type: "string";
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
}>>;
|
|
98
|
+
readonly prepare: () => Promise<citty2.CommandDef<{
|
|
99
|
+
verbose: {
|
|
100
|
+
type: "boolean";
|
|
101
|
+
alias: string;
|
|
102
|
+
description: string;
|
|
103
|
+
default: false;
|
|
104
|
+
};
|
|
105
|
+
root: {
|
|
106
|
+
type: "string";
|
|
107
|
+
alias: string;
|
|
108
|
+
description: string;
|
|
109
|
+
};
|
|
110
|
+
config: {
|
|
111
|
+
type: "string";
|
|
112
|
+
alias: string;
|
|
113
|
+
description: string;
|
|
114
|
+
};
|
|
115
|
+
logLevel: {
|
|
116
|
+
type: "string";
|
|
117
|
+
description: string;
|
|
118
|
+
};
|
|
119
|
+
}>>;
|
|
120
|
+
readonly layer: () => Promise<citty2.CommandDef<citty2.ArgsDef>>;
|
|
121
|
+
readonly init: () => Promise<citty2.CommandDef<{
|
|
122
|
+
root: {
|
|
123
|
+
type: "string";
|
|
124
|
+
alias: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
force: {
|
|
128
|
+
type: "boolean";
|
|
129
|
+
alias: string;
|
|
130
|
+
description: string;
|
|
131
|
+
default: false;
|
|
132
|
+
};
|
|
133
|
+
typescript: {
|
|
134
|
+
type: "boolean";
|
|
135
|
+
alias: string;
|
|
136
|
+
description: string;
|
|
137
|
+
default: true;
|
|
138
|
+
};
|
|
139
|
+
}>>;
|
|
140
|
+
readonly start: () => Promise<citty2.CommandDef<{
|
|
141
|
+
port: {
|
|
142
|
+
type: "string";
|
|
143
|
+
alias: string;
|
|
144
|
+
description: string;
|
|
145
|
+
default: string;
|
|
146
|
+
};
|
|
147
|
+
host: {
|
|
148
|
+
type: "string";
|
|
149
|
+
alias: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
open: {
|
|
153
|
+
type: "boolean";
|
|
154
|
+
alias: string;
|
|
155
|
+
description: string;
|
|
156
|
+
default: false;
|
|
157
|
+
};
|
|
158
|
+
layers: {
|
|
159
|
+
type: "string";
|
|
160
|
+
alias: string;
|
|
161
|
+
description: string;
|
|
162
|
+
};
|
|
163
|
+
"exclude-layers": {
|
|
164
|
+
type: "string";
|
|
165
|
+
alias: string;
|
|
166
|
+
description: string;
|
|
167
|
+
};
|
|
168
|
+
root: {
|
|
169
|
+
type: "string";
|
|
170
|
+
alias: string;
|
|
171
|
+
description: string;
|
|
172
|
+
};
|
|
173
|
+
config: {
|
|
174
|
+
type: "string";
|
|
175
|
+
alias: string;
|
|
176
|
+
description: string;
|
|
177
|
+
};
|
|
178
|
+
logLevel: {
|
|
179
|
+
type: "string";
|
|
180
|
+
description: string;
|
|
181
|
+
};
|
|
182
|
+
}>>;
|
|
183
|
+
};
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/utils/kit.d.ts
|
|
186
|
+
/**
|
|
187
|
+
* Dynamically load @kimesh/kit from the project context
|
|
188
|
+
* Falls back to bundled version if not found
|
|
189
|
+
*/
|
|
190
|
+
declare function loadKit(root?: string): Promise<typeof _kimesh_kit0>;
|
|
191
|
+
/**
|
|
192
|
+
* Get cached kit instance or throw if not loaded
|
|
193
|
+
*/
|
|
194
|
+
declare function getKit(): typeof _kimesh_kit0;
|
|
195
|
+
/**
|
|
196
|
+
* Clear kit cache (useful for testing)
|
|
197
|
+
*/
|
|
198
|
+
declare function clearKitCache(): void;
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/utils/paths.d.ts
|
|
201
|
+
/**
|
|
202
|
+
* Get the directory of the current module
|
|
203
|
+
*/
|
|
204
|
+
declare function getCurrentDir(importMetaUrl: string): string;
|
|
205
|
+
/**
|
|
206
|
+
* Resolve project root, handling various inputs
|
|
207
|
+
*/
|
|
208
|
+
declare function resolveRoot(input?: string): string;
|
|
209
|
+
/**
|
|
210
|
+
* Get the .kimesh build directory
|
|
211
|
+
*/
|
|
212
|
+
declare function getBuildDir(root: string): string;
|
|
213
|
+
/**
|
|
214
|
+
* Check if we're running from a global installation
|
|
215
|
+
*/
|
|
216
|
+
declare function isGlobalInstall(): boolean;
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/utils/logger.d.ts
|
|
219
|
+
declare const logger: consola0.ConsolaInstance;
|
|
220
|
+
/**
|
|
221
|
+
* Print a banner header
|
|
222
|
+
*/
|
|
223
|
+
declare function banner(text: string, version?: string): void;
|
|
224
|
+
/**
|
|
225
|
+
* Print a step in a process
|
|
226
|
+
*/
|
|
227
|
+
declare function step(message: string): void;
|
|
228
|
+
/**
|
|
229
|
+
* Print a success message
|
|
230
|
+
*/
|
|
231
|
+
declare function success(message: string): void;
|
|
232
|
+
/**
|
|
233
|
+
* Print timing information
|
|
234
|
+
*/
|
|
235
|
+
declare function timing(label: string, ms: number): void;
|
|
236
|
+
/**
|
|
237
|
+
* Create a spinner for long operations
|
|
238
|
+
*/
|
|
239
|
+
declare function withSpinner<T>(message: string, fn: () => Promise<T>): Promise<T>;
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/commands/_shared.d.ts
|
|
242
|
+
/**
|
|
243
|
+
* Shared arguments used across multiple commands
|
|
244
|
+
*/
|
|
245
|
+
declare const sharedArgs: {
|
|
246
|
+
root: {
|
|
247
|
+
type: "string";
|
|
248
|
+
alias: string;
|
|
249
|
+
description: string;
|
|
250
|
+
};
|
|
251
|
+
config: {
|
|
252
|
+
type: "string";
|
|
253
|
+
alias: string;
|
|
254
|
+
description: string;
|
|
255
|
+
};
|
|
256
|
+
logLevel: {
|
|
257
|
+
type: "string";
|
|
258
|
+
description: string;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Dev command specific arguments
|
|
263
|
+
*/
|
|
264
|
+
declare const devArgs: {
|
|
265
|
+
port: {
|
|
266
|
+
type: "string";
|
|
267
|
+
alias: string;
|
|
268
|
+
description: string;
|
|
269
|
+
default: string;
|
|
270
|
+
};
|
|
271
|
+
host: {
|
|
272
|
+
type: "string";
|
|
273
|
+
alias: string;
|
|
274
|
+
description: string;
|
|
275
|
+
};
|
|
276
|
+
open: {
|
|
277
|
+
type: "boolean";
|
|
278
|
+
alias: string;
|
|
279
|
+
description: string;
|
|
280
|
+
default: false;
|
|
281
|
+
};
|
|
282
|
+
layers: {
|
|
283
|
+
type: "string";
|
|
284
|
+
alias: string;
|
|
285
|
+
description: string;
|
|
286
|
+
};
|
|
287
|
+
"exclude-layers": {
|
|
288
|
+
type: "string";
|
|
289
|
+
alias: string;
|
|
290
|
+
description: string;
|
|
291
|
+
};
|
|
292
|
+
root: {
|
|
293
|
+
type: "string";
|
|
294
|
+
alias: string;
|
|
295
|
+
description: string;
|
|
296
|
+
};
|
|
297
|
+
config: {
|
|
298
|
+
type: "string";
|
|
299
|
+
alias: string;
|
|
300
|
+
description: string;
|
|
301
|
+
};
|
|
302
|
+
logLevel: {
|
|
303
|
+
type: "string";
|
|
304
|
+
description: string;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Build command specific arguments
|
|
309
|
+
*/
|
|
310
|
+
declare const buildArgs: {
|
|
311
|
+
minify: {
|
|
312
|
+
type: "boolean";
|
|
313
|
+
description: string;
|
|
314
|
+
default: true;
|
|
315
|
+
};
|
|
316
|
+
sourcemap: {
|
|
317
|
+
type: "boolean";
|
|
318
|
+
description: string;
|
|
319
|
+
default: false;
|
|
320
|
+
};
|
|
321
|
+
root: {
|
|
322
|
+
type: "string";
|
|
323
|
+
alias: string;
|
|
324
|
+
description: string;
|
|
325
|
+
};
|
|
326
|
+
config: {
|
|
327
|
+
type: "string";
|
|
328
|
+
alias: string;
|
|
329
|
+
description: string;
|
|
330
|
+
};
|
|
331
|
+
logLevel: {
|
|
332
|
+
type: "string";
|
|
333
|
+
description: string;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Prepare command specific arguments
|
|
338
|
+
*/
|
|
339
|
+
declare const prepareArgs: {
|
|
340
|
+
verbose: {
|
|
341
|
+
type: "boolean";
|
|
342
|
+
alias: string;
|
|
343
|
+
description: string;
|
|
344
|
+
default: false;
|
|
345
|
+
};
|
|
346
|
+
root: {
|
|
347
|
+
type: "string";
|
|
348
|
+
alias: string;
|
|
349
|
+
description: string;
|
|
350
|
+
};
|
|
351
|
+
config: {
|
|
352
|
+
type: "string";
|
|
353
|
+
alias: string;
|
|
354
|
+
description: string;
|
|
355
|
+
};
|
|
356
|
+
logLevel: {
|
|
357
|
+
type: "string";
|
|
358
|
+
description: string;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
//#endregion
|
|
2
362
|
export { banner, buildArgs, clearKitCache, commands, devArgs, getBuildDir, getCurrentDir, getKit, isGlobalInstall, loadKit, logger, main, prepareArgs, resolveRoot, run, sharedArgs, step, success, timing, version, withSpinner };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { commands, main, version } from "./main-DncTPs_e.js";
|
|
2
|
+
import { run } from "./run-DCL2u7IK.js";
|
|
3
|
+
import { clearKitCache, getKit, loadKit } from "./kit-BcEYldTS.js";
|
|
4
|
+
import { buildArgs, devArgs, prepareArgs, sharedArgs } from "./_shared-CEwpPT2B.js";
|
|
5
|
+
import consola from "consola";
|
|
6
|
+
import pc from "picocolors";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { dirname, resolve } from "node:path";
|
|
2
9
|
|
|
10
|
+
//#region src/utils/paths.ts
|
|
11
|
+
/**
|
|
12
|
+
* Get the directory of the current module
|
|
13
|
+
*/
|
|
14
|
+
function getCurrentDir(importMetaUrl) {
|
|
15
|
+
return dirname(fileURLToPath(importMetaUrl));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve project root, handling various inputs
|
|
19
|
+
*/
|
|
20
|
+
function resolveRoot(input) {
|
|
21
|
+
if (!input) return process.cwd();
|
|
22
|
+
return resolve(process.cwd(), input);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the .kimesh build directory
|
|
26
|
+
*/
|
|
27
|
+
function getBuildDir(root) {
|
|
28
|
+
return resolve(root, ".kimesh");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if we're running from a global installation
|
|
32
|
+
*/
|
|
33
|
+
function isGlobalInstall() {
|
|
34
|
+
const execPath = process.argv[1] || "";
|
|
35
|
+
return execPath.includes("/lib/node_modules/") || execPath.includes("\\node_modules\\npm\\");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/utils/logger.ts
|
|
40
|
+
const logger = consola.withTag("kmi");
|
|
41
|
+
/**
|
|
42
|
+
* Print a banner header
|
|
43
|
+
*/
|
|
44
|
+
function banner(text, version$1) {
|
|
45
|
+
const versionStr = version$1 ? ` v${version$1}` : "";
|
|
46
|
+
consola.log(pc.cyan(`\n 🚀 ${text}${versionStr}\n`));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Print a step in a process
|
|
50
|
+
*/
|
|
51
|
+
function step(message) {
|
|
52
|
+
consola.info(`${pc.blue("›")} ${message}`);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Print a success message
|
|
56
|
+
*/
|
|
57
|
+
function success(message) {
|
|
58
|
+
consola.success(pc.green("✓") + " " + message);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Print timing information
|
|
62
|
+
*/
|
|
63
|
+
function timing(label, ms) {
|
|
64
|
+
consola.info(`${label}: ${pc.cyan(`${ms}ms`)}`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create a spinner for long operations
|
|
68
|
+
*/
|
|
69
|
+
async function withSpinner(message, fn) {
|
|
70
|
+
consola.start(message);
|
|
71
|
+
try {
|
|
72
|
+
const result = await fn();
|
|
73
|
+
consola.success(message);
|
|
74
|
+
return result;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
consola.fail(message);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
3
82
|
export { banner, buildArgs, clearKitCache, commands, devArgs, getBuildDir, getCurrentDir, getKit, isGlobalInstall, loadKit, logger, main, prepareArgs, resolveRoot, run, sharedArgs, step, success, timing, version, withSpinner };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import consola from "consola";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { resolveModulePath } from "exsolve";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/kit.ts
|
|
6
|
+
let _kit;
|
|
7
|
+
/**
|
|
8
|
+
* Dynamically load @kimesh/kit from the project context
|
|
9
|
+
* Falls back to bundled version if not found
|
|
10
|
+
*/
|
|
11
|
+
async function loadKit(root = process.cwd()) {
|
|
12
|
+
if (_kit) return _kit;
|
|
13
|
+
try {
|
|
14
|
+
const kitPath = resolveModulePath("@kimesh/kit", { from: root });
|
|
15
|
+
const kitUrl = pathToFileURL(kitPath).href;
|
|
16
|
+
_kit = await import(kitUrl);
|
|
17
|
+
consola.debug(`Loaded @kimesh/kit from: ${kitPath}`);
|
|
18
|
+
} catch {
|
|
19
|
+
consola.debug("Using bundled @kimesh/kit");
|
|
20
|
+
_kit = await import("@kimesh/kit");
|
|
21
|
+
}
|
|
22
|
+
return _kit;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get cached kit instance or throw if not loaded
|
|
26
|
+
*/
|
|
27
|
+
function getKit() {
|
|
28
|
+
if (!_kit) throw new Error("@kimesh/kit not loaded. Call loadKit() first.");
|
|
29
|
+
return _kit;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Clear kit cache (useful for testing)
|
|
33
|
+
*/
|
|
34
|
+
function clearKitCache() {
|
|
35
|
+
_kit = void 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { clearKitCache, getKit, loadKit };
|