silgi 0.20.37 → 0.20.38
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 +21 -20
- package/dist/cli/prepare.mjs +2 -3
- 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({
|
|
@@ -82,16 +73,26 @@ const dev = defineCommand({
|
|
|
82
73
|
let watcher;
|
|
83
74
|
if (silgi.options.devServer.watch.length > 0) {
|
|
84
75
|
watcher = watch(silgi.options.devServer.watch, silgi.options.watchOptions);
|
|
85
|
-
watcher.on("add", async (
|
|
76
|
+
watcher.on("add", async (path, stats) => {
|
|
77
|
+
const startTime = performance.now();
|
|
78
|
+
await reloadScan(path, stats);
|
|
86
79
|
await runCommand(prepare, {
|
|
87
80
|
rawArgs: ["--commands", "run"]
|
|
88
81
|
});
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
silgi.errors = [];
|
|
83
|
+
const endTime = performance.now();
|
|
84
|
+
const elapsedTime = Math.round(endTime - startTime);
|
|
85
|
+
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
86
|
+
}).on("change", async (path, stats) => {
|
|
87
|
+
const startTime = performance.now();
|
|
88
|
+
await reloadScan(path, stats);
|
|
91
89
|
await runCommand(prepare, {
|
|
92
90
|
rawArgs: ["--commands", "run"]
|
|
93
91
|
});
|
|
94
|
-
|
|
92
|
+
silgi.errors = [];
|
|
93
|
+
const endTime = performance.now();
|
|
94
|
+
const elapsedTime = Math.round(endTime - startTime);
|
|
95
|
+
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
process.on("SIGINT", async () => {
|
package/dist/cli/prepare.mjs
CHANGED
|
@@ -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