silgi 0.20.37 → 0.20.39
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/dist/_chunks/index.mjs +1 -1
- package/dist/cli/dev.mjs +22 -20
- package/dist/cli/prepare.mjs +6 -7
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/dev.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
import { basename } from 'node:path';
|
|
1
2
|
import { watch } from 'chokidar';
|
|
2
3
|
import { defineCommand, runCommand } from 'citty';
|
|
3
4
|
import consola from 'consola';
|
|
4
5
|
import { useSilgiCLI } from 'silgi/core';
|
|
5
6
|
import { version } from 'silgi/meta';
|
|
6
7
|
import { s as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
|
|
7
|
-
import {
|
|
8
|
-
import { h as hasError } from './compatibility.mjs';
|
|
9
|
-
import { s as scanFiles, w as writeScanFiles, g as generateApp, c as commonArgs, p as prepare } from './prepare.mjs';
|
|
8
|
+
import { c as commonArgs, p as prepare } from './prepare.mjs';
|
|
10
9
|
import 'ufo';
|
|
11
10
|
import 'unctx';
|
|
12
|
-
import '
|
|
11
|
+
import 'pathe';
|
|
13
12
|
import 'silgi/kit';
|
|
14
13
|
import 'node:fs';
|
|
15
14
|
import 'node:fs/promises';
|
|
@@ -21,6 +20,8 @@ import '@clack/prompts';
|
|
|
21
20
|
import 'dotenv';
|
|
22
21
|
import 'mlly';
|
|
23
22
|
import 'dev-jiti';
|
|
23
|
+
import './compatibility.mjs';
|
|
24
|
+
import 'semver/functions/satisfies.js';
|
|
24
25
|
import 'node:url';
|
|
25
26
|
import 'defu';
|
|
26
27
|
import 'exsolve';
|
|
@@ -42,19 +43,9 @@ import 'pathe/utils';
|
|
|
42
43
|
import 'node:child_process';
|
|
43
44
|
import 'picocolors';
|
|
44
45
|
|
|
45
|
-
async function reloadScan(
|
|
46
|
-
const
|
|
47
|
-
silgi.errors = [];
|
|
46
|
+
async function reloadScan(path, _stats) {
|
|
47
|
+
const silgi = useSilgiCLI();
|
|
48
48
|
await silgi.callHook("reload:scan", path, _stats);
|
|
49
|
-
await scanFiles(silgi, silgi.options.devServer.watch);
|
|
50
|
-
if (!hasError("Parser", silgi)) {
|
|
51
|
-
await writeScanFiles(silgi);
|
|
52
|
-
}
|
|
53
|
-
await generateApp(silgi);
|
|
54
|
-
silgi.errors = [];
|
|
55
|
-
const endTime = performance.now();
|
|
56
|
-
const elapsedTime = Math.round(endTime - startTime);
|
|
57
|
-
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
58
49
|
}
|
|
59
50
|
|
|
60
51
|
const dev = defineCommand({
|
|
@@ -79,19 +70,30 @@ const dev = defineCommand({
|
|
|
79
70
|
rawArgs: ["--commands", "run"]
|
|
80
71
|
});
|
|
81
72
|
const silgi = useSilgiCLI();
|
|
73
|
+
silgi.options.dev = true;
|
|
82
74
|
let watcher;
|
|
83
75
|
if (silgi.options.devServer.watch.length > 0) {
|
|
84
76
|
watcher = watch(silgi.options.devServer.watch, silgi.options.watchOptions);
|
|
85
|
-
watcher.on("add", async (
|
|
77
|
+
watcher.on("add", async (path, stats) => {
|
|
78
|
+
const startTime = performance.now();
|
|
79
|
+
await reloadScan(path, stats);
|
|
86
80
|
await runCommand(prepare, {
|
|
87
81
|
rawArgs: ["--commands", "run"]
|
|
88
82
|
});
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
silgi.errors = [];
|
|
84
|
+
const endTime = performance.now();
|
|
85
|
+
const elapsedTime = Math.round(endTime - startTime);
|
|
86
|
+
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
87
|
+
}).on("change", async (path, stats) => {
|
|
88
|
+
const startTime = performance.now();
|
|
89
|
+
await reloadScan(path, stats);
|
|
91
90
|
await runCommand(prepare, {
|
|
92
91
|
rawArgs: ["--commands", "run"]
|
|
93
92
|
});
|
|
94
|
-
|
|
93
|
+
silgi.errors = [];
|
|
94
|
+
const endTime = performance.now();
|
|
95
|
+
const elapsedTime = Math.round(endTime - startTime);
|
|
96
|
+
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
99
|
process.on("SIGINT", async () => {
|
package/dist/cli/prepare.mjs
CHANGED
|
@@ -564,11 +564,11 @@ async function installModules(silgi, prepare = false) {
|
|
|
564
564
|
silgi.options.isPreparingModules = prepare;
|
|
565
565
|
const jiti = createJiti(silgi.options.rootDir, {
|
|
566
566
|
alias: silgi.options.alias,
|
|
567
|
-
fsCache:
|
|
568
|
-
moduleCache:
|
|
567
|
+
fsCache: true,
|
|
568
|
+
moduleCache: true
|
|
569
569
|
});
|
|
570
570
|
for (const module of silgi.scanModules) {
|
|
571
|
-
if (hasInstalledModule(module.meta.configKey)) {
|
|
571
|
+
if (hasInstalledModule(module.meta.configKey) && !silgi.options.dev) {
|
|
572
572
|
silgi.logger.info(`Module ${module.meta.configKey} installed`);
|
|
573
573
|
}
|
|
574
574
|
try {
|
|
@@ -899,7 +899,7 @@ async function readScanFile(silgi) {
|
|
|
899
899
|
throw new Error("Failed to inject imports");
|
|
900
900
|
}
|
|
901
901
|
const jiti = createJiti(silgi.options.rootDir, {
|
|
902
|
-
fsCache:
|
|
902
|
+
fsCache: true,
|
|
903
903
|
moduleCache: false,
|
|
904
904
|
debug: silgi.options.debug,
|
|
905
905
|
alias: silgi.options.alias
|
|
@@ -1290,11 +1290,10 @@ class SchemaParser {
|
|
|
1290
1290
|
}
|
|
1291
1291
|
|
|
1292
1292
|
async function scanFiles$1(silgi, watchFiles) {
|
|
1293
|
-
const isWatch = watchFiles && watchFiles.length > 0;
|
|
1294
1293
|
const filePaths = /* @__PURE__ */ new Set();
|
|
1295
1294
|
const scannedPaths = [];
|
|
1296
1295
|
const dir = silgi.options.serverDir;
|
|
1297
|
-
const files =
|
|
1296
|
+
const files = (await globby(dir, { cwd: silgi.options.rootDir, ignore: silgi.options.ignore })).sort();
|
|
1298
1297
|
if (files.length) {
|
|
1299
1298
|
const siblings = await readdir(dirname(dir)).catch(() => []);
|
|
1300
1299
|
const directory = basename(dir);
|
|
@@ -2664,4 +2663,4 @@ const prepare$1 = {
|
|
|
2664
2663
|
default: prepare
|
|
2665
2664
|
};
|
|
2666
2665
|
|
|
2667
|
-
export { prepare$1 as a, commonArgs as c,
|
|
2666
|
+
export { prepare$1 as a, commonArgs as c, prepare as p, run$1 as r };
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED