silgi 0.30.4 → 0.30.6
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/build.mjs +7 -76
- package/dist/cli/dev.mjs +83 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/watch.mjs +10 -53
- package/package.json +5 -4
- package/dist/cli/devServer.mjs +0 -8
package/dist/build.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
export { p as prepareBuild, w as watchDev } from './cli/dev.mjs';
|
|
2
|
+
import 'chokidar';
|
|
3
|
+
import 'consola';
|
|
4
|
+
import 'pathe';
|
|
5
|
+
import 'perfect-debounce';
|
|
6
|
+
import './_chunks/silgiApp.mjs';
|
|
7
7
|
import 'unctx';
|
|
8
8
|
import 'silgi';
|
|
9
|
+
import './cli/build.mjs';
|
|
9
10
|
import 'hookable';
|
|
10
11
|
import 'silgi/kit';
|
|
11
12
|
import 'silgi/runtime/meta';
|
|
@@ -43,73 +44,3 @@ import 'pkg-types';
|
|
|
43
44
|
import 'apiful/openapi';
|
|
44
45
|
import 'pathe/utils';
|
|
45
46
|
import 'untyped';
|
|
46
|
-
|
|
47
|
-
async function prepareBuild(config) {
|
|
48
|
-
const silgi = await createSilgiCLI({
|
|
49
|
-
commandType: config?.commandType || "prepare",
|
|
50
|
-
...config
|
|
51
|
-
});
|
|
52
|
-
await build(silgi);
|
|
53
|
-
return silgi;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async function watchDev() {
|
|
57
|
-
await prepareBuild({
|
|
58
|
-
commandType: "prepare",
|
|
59
|
-
activeEnvironment: ".env"
|
|
60
|
-
});
|
|
61
|
-
const silgi = useSilgiCLI();
|
|
62
|
-
silgi.options.watchOptions.ignored ??= [];
|
|
63
|
-
silgi.options.watchOptions.ignoreInitial = true;
|
|
64
|
-
if (Array.isArray(silgi.options.watchOptions.ignored)) {
|
|
65
|
-
silgi.options.watchOptions.ignored.push(
|
|
66
|
-
`!${join(silgi.options.silgi.serverDir, "config")}`
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
silgi.options.devServer.watch.push(
|
|
70
|
-
join(silgi.options.serverDir, "services"),
|
|
71
|
-
join(silgi.options.serverDir, "schemas"),
|
|
72
|
-
join(silgi.options.serverDir, "shared"),
|
|
73
|
-
join(silgi.options.serverDir, "utils"),
|
|
74
|
-
join(silgi.options.serverDir, "types"),
|
|
75
|
-
join(silgi.options.silgi.serverDir, "config"),
|
|
76
|
-
join(silgi.options.rootDir, "silgi.config.ts")
|
|
77
|
-
);
|
|
78
|
-
const watchReloadEvents = /* @__PURE__ */ new Set(["add", "addDir", "unlink", "unlinkDir", "change"]);
|
|
79
|
-
let watcher;
|
|
80
|
-
if (silgi.options.devServer.watch.length > 0) {
|
|
81
|
-
silgi.options.devServer.watch = [...new Set(silgi.options.devServer.watch)];
|
|
82
|
-
watcher = watch(silgi.options.devServer.watch, silgi.options.watchOptions);
|
|
83
|
-
watcher.on("all", async (event, path, stats) => {
|
|
84
|
-
if (!watchReloadEvents.has(event)) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const startTime = performance.now();
|
|
88
|
-
silgi.errors = [];
|
|
89
|
-
try {
|
|
90
|
-
await reloadScan(path, stats);
|
|
91
|
-
await prepareBuild({
|
|
92
|
-
commandType: "prepare",
|
|
93
|
-
activeEnvironment: ".env"
|
|
94
|
-
});
|
|
95
|
-
} catch (error) {
|
|
96
|
-
consola.withTag("silgi").error(error);
|
|
97
|
-
}
|
|
98
|
-
silgi.errors = [];
|
|
99
|
-
const endTime = performance.now();
|
|
100
|
-
const elapsedTime = Math.round(endTime - startTime);
|
|
101
|
-
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
102
|
-
}).on("error", (error) => {
|
|
103
|
-
consola.withTag("silgi").error(error);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
async function close() {
|
|
107
|
-
await silgiCLIIClose();
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
watcher,
|
|
111
|
-
close
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export { prepareBuild, watchDev };
|
package/dist/cli/dev.mjs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { watch } from 'chokidar';
|
|
2
|
+
import consola from 'consola';
|
|
3
|
+
import { join, basename } from 'pathe';
|
|
4
|
+
import { debounce } from 'perfect-debounce';
|
|
5
|
+
import { u as useSilgiCLI$1, a as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
|
|
6
|
+
import { useSilgiCLI } from 'silgi';
|
|
7
|
+
import { c as createSilgiCLI, b as build } from './build.mjs';
|
|
8
|
+
|
|
9
|
+
async function reloadScan(path, _stats) {
|
|
10
|
+
const silgi = useSilgiCLI();
|
|
11
|
+
await silgi.callHook("reload:scan", path, _stats);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function prepareBuild(config) {
|
|
15
|
+
const silgi = await createSilgiCLI({
|
|
16
|
+
commandType: config?.commandType || "prepare",
|
|
17
|
+
...config
|
|
18
|
+
});
|
|
19
|
+
await build(silgi);
|
|
20
|
+
return silgi;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function watchDev() {
|
|
24
|
+
let watcher;
|
|
25
|
+
async function load() {
|
|
26
|
+
await prepareBuild({
|
|
27
|
+
commandType: "prepare",
|
|
28
|
+
activeEnvironment: ".env"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const reload = debounce(load);
|
|
32
|
+
const silgi = useSilgiCLI$1();
|
|
33
|
+
silgi.options.watchOptions.ignored ??= [];
|
|
34
|
+
silgi.options.watchOptions.ignoreInitial = true;
|
|
35
|
+
if (Array.isArray(silgi.options.watchOptions.ignored)) {
|
|
36
|
+
silgi.options.watchOptions.ignored.push(
|
|
37
|
+
`!${join(silgi.options.silgi.serverDir, "config")}`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
silgi.options.devServer.watch.push(
|
|
41
|
+
join(silgi.options.serverDir, "services"),
|
|
42
|
+
join(silgi.options.serverDir, "schemas"),
|
|
43
|
+
join(silgi.options.serverDir, "shared"),
|
|
44
|
+
join(silgi.options.serverDir, "utils"),
|
|
45
|
+
join(silgi.options.serverDir, "types"),
|
|
46
|
+
join(silgi.options.silgi.serverDir, "config"),
|
|
47
|
+
join(silgi.options.silgi.serverDir, "modules"),
|
|
48
|
+
join(silgi.options.rootDir, "silgi.config.ts")
|
|
49
|
+
);
|
|
50
|
+
const watchReloadEvents = /* @__PURE__ */ new Set(["add", "addDir", "unlink", "unlinkDir", "change"]);
|
|
51
|
+
if (silgi.options.devServer.watch.length > 0) {
|
|
52
|
+
silgi.options.devServer.watch = [...new Set(silgi.options.devServer.watch)];
|
|
53
|
+
watcher = watch(silgi.options.devServer.watch, silgi.options.watchOptions);
|
|
54
|
+
watcher.on("all", async (event, path, stats) => {
|
|
55
|
+
if (!watchReloadEvents.has(event)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const startTime = performance.now();
|
|
59
|
+
silgi.errors = [];
|
|
60
|
+
try {
|
|
61
|
+
await reloadScan(path, stats);
|
|
62
|
+
await reload();
|
|
63
|
+
} catch (error) {
|
|
64
|
+
consola.withTag("silgi").error(error);
|
|
65
|
+
}
|
|
66
|
+
silgi.errors = [];
|
|
67
|
+
const endTime = performance.now();
|
|
68
|
+
const elapsedTime = Math.round(endTime - startTime);
|
|
69
|
+
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
70
|
+
}).on("error", (error) => {
|
|
71
|
+
consola.withTag("silgi").error(error);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
async function close() {
|
|
75
|
+
await silgiCLIIClose();
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
watcher,
|
|
79
|
+
close
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { prepareBuild as p, watchDev as w };
|
package/dist/cli/index.mjs
CHANGED
package/dist/cli/watch.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { basename } from 'node:path';
|
|
2
|
-
import { watch } from 'chokidar';
|
|
3
1
|
import { defineCommand, runCommand } from 'citty';
|
|
4
2
|
import consola from 'consola';
|
|
5
|
-
import { join } from 'pathe';
|
|
6
|
-
import { useSilgiCLI } from 'silgi';
|
|
7
3
|
import { version } from 'silgi/meta';
|
|
8
|
-
import {
|
|
9
|
-
import { r as reloadScan } from './devServer.mjs';
|
|
4
|
+
import { w as watchDev } from './dev.mjs';
|
|
10
5
|
import { b as commonArgs, a as command$1 } from './prepare.mjs';
|
|
6
|
+
import 'chokidar';
|
|
7
|
+
import 'pathe';
|
|
8
|
+
import 'perfect-debounce';
|
|
9
|
+
import '../_chunks/silgiApp.mjs';
|
|
11
10
|
import 'unctx';
|
|
11
|
+
import 'silgi';
|
|
12
12
|
import './build.mjs';
|
|
13
13
|
import 'hookable';
|
|
14
14
|
import 'silgi/kit';
|
|
@@ -69,56 +69,13 @@ const command = defineCommand({
|
|
|
69
69
|
await runCommand(command$1, {
|
|
70
70
|
rawArgs: ["--commandType", "dev", "--dev", "true"]
|
|
71
71
|
});
|
|
72
|
-
const
|
|
73
|
-
silgi.options.watchOptions.ignored ??= [];
|
|
74
|
-
silgi.options.watchOptions.ignoreInitial = true;
|
|
75
|
-
if (Array.isArray(silgi.options.watchOptions.ignored)) {
|
|
76
|
-
silgi.options.watchOptions.ignored.push(
|
|
77
|
-
`!${join(silgi.options.silgi.serverDir, "config")}`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
silgi.options.devServer.watch.push(
|
|
81
|
-
join(silgi.options.serverDir, "services"),
|
|
82
|
-
join(silgi.options.serverDir, "schemas"),
|
|
83
|
-
join(silgi.options.serverDir, "shared"),
|
|
84
|
-
join(silgi.options.serverDir, "utils"),
|
|
85
|
-
join(silgi.options.serverDir, "types"),
|
|
86
|
-
join(silgi.options.silgi.serverDir, "config"),
|
|
87
|
-
join(silgi.options.rootDir, "silgi.config.ts")
|
|
88
|
-
);
|
|
89
|
-
const watchReloadEvents = /* @__PURE__ */ new Set(["add", "addDir", "unlink", "unlinkDir", "change"]);
|
|
90
|
-
let watcher;
|
|
91
|
-
if (silgi.options.devServer.watch.length > 0) {
|
|
92
|
-
silgi.options.devServer.watch = [...new Set(silgi.options.devServer.watch)];
|
|
93
|
-
watcher = watch(silgi.options.devServer.watch, silgi.options.watchOptions);
|
|
94
|
-
watcher.on("all", async (event, path, stats) => {
|
|
95
|
-
if (!watchReloadEvents.has(event)) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const startTime = performance.now();
|
|
99
|
-
silgi.errors = [];
|
|
100
|
-
try {
|
|
101
|
-
await reloadScan(path, stats);
|
|
102
|
-
await runCommand(command$1, {
|
|
103
|
-
rawArgs: ["--commands", "run", "--dev", "true"]
|
|
104
|
-
});
|
|
105
|
-
} catch (error) {
|
|
106
|
-
consola.withTag("silgi").error(error);
|
|
107
|
-
}
|
|
108
|
-
silgi.errors = [];
|
|
109
|
-
const endTime = performance.now();
|
|
110
|
-
const elapsedTime = Math.round(endTime - startTime);
|
|
111
|
-
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
112
|
-
}).on("error", (error) => {
|
|
113
|
-
consola.withTag("silgi").error(error);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
72
|
+
const watch = await watchDev();
|
|
116
73
|
process.on("SIGINT", async () => {
|
|
117
74
|
consola.withTag("silgi").info("Shutting down...");
|
|
118
|
-
if (
|
|
119
|
-
|
|
75
|
+
if (watch) {
|
|
76
|
+
watch.close();
|
|
120
77
|
}
|
|
121
|
-
await
|
|
78
|
+
await watch.close();
|
|
122
79
|
process.exit(0);
|
|
123
80
|
});
|
|
124
81
|
consola.withTag("silgi").success("Prepare completed");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silgi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.6",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"exsolve": "^1.0.5",
|
|
99
99
|
"globby": "^14.1.0",
|
|
100
100
|
"hookable": "^5.5.3",
|
|
101
|
-
"ignore": "^7.0.
|
|
101
|
+
"ignore": "^7.0.4",
|
|
102
102
|
"klona": "^2.0.6",
|
|
103
103
|
"knitwork": "^1.2.0",
|
|
104
104
|
"magicast": "^0.3.5",
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"ofetch": "^1.4.1",
|
|
107
107
|
"ohash": "^2.0.11",
|
|
108
108
|
"pathe": "^2.0.3",
|
|
109
|
+
"perfect-debounce": "^1.0.0",
|
|
109
110
|
"picocolors": "^1.1.1",
|
|
110
111
|
"pkg-types": "^2.1.0",
|
|
111
112
|
"rfc6902": "^5.1.2",
|
|
@@ -123,8 +124,8 @@
|
|
|
123
124
|
"@antfu/eslint-config": "^4.12.0",
|
|
124
125
|
"@nuxt/kit": "^3.16.2",
|
|
125
126
|
"@nuxt/schema": "^3.16.2",
|
|
126
|
-
"@silgi/ecosystem": "^0.
|
|
127
|
-
"@types/node": "^22.
|
|
127
|
+
"@silgi/ecosystem": "^0.6.2",
|
|
128
|
+
"@types/node": "^22.15.2",
|
|
128
129
|
"@types/semver": "^7.7.0",
|
|
129
130
|
"@vitest/coverage-v8": "3.0.5",
|
|
130
131
|
"eslint": "^9.25.1",
|