silgi 0.43.19 → 0.43.21
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/cli/utils/processManager.mjs +27 -15
- package/dist/package.mjs +1 -1
- package/dist/types/event.d.mts +1 -1
- package/dist/types/kits.d.mts +3 -3
- package/package.json +1 -1
|
@@ -14,17 +14,23 @@ async function getProcessesOnPort(port) {
|
|
|
14
14
|
const lines = output.split("\n");
|
|
15
15
|
for (const line of lines) if (line.includes(`:${port}`) && line.includes("LISTENING")) {
|
|
16
16
|
const parts = line.trim().split(/\s+/);
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
17
|
+
const pidStr = parts[parts.length - 1];
|
|
18
|
+
if (!pidStr) continue;
|
|
19
|
+
const pid = Number.parseInt(pidStr);
|
|
20
|
+
if (pid && pid !== 0 && !Number.isNaN(pid)) try {
|
|
19
21
|
const taskList = execSync(`tasklist /FI "PID eq ${pid}" /FO CSV`, { encoding: "utf8" });
|
|
20
|
-
const
|
|
22
|
+
const lines$1 = taskList.split("\n");
|
|
23
|
+
const processLine = lines$1[1];
|
|
21
24
|
if (processLine) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const namePart = processLine.split(",")[0];
|
|
26
|
+
if (namePart) {
|
|
27
|
+
const name = namePart.replace(/"/g, "");
|
|
28
|
+
processes.push({
|
|
29
|
+
pid,
|
|
30
|
+
name,
|
|
31
|
+
port
|
|
32
|
+
});
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
} catch {
|
|
30
36
|
processes.push({
|
|
@@ -40,8 +46,10 @@ async function getProcessesOnPort(port) {
|
|
|
40
46
|
for (const line of lines) if (line.trim()) {
|
|
41
47
|
const parts = line.trim().split(/\s+/);
|
|
42
48
|
const name = parts[0];
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
49
|
+
const pidStr = parts[1];
|
|
50
|
+
if (!name || !pidStr) continue;
|
|
51
|
+
const pid = Number.parseInt(pidStr);
|
|
52
|
+
if (pid && !Number.isNaN(pid) && !processes.some((p) => p.pid === pid)) processes.push({
|
|
45
53
|
pid,
|
|
46
54
|
name,
|
|
47
55
|
port
|
|
@@ -103,8 +111,10 @@ async function killNodeProcessesInDirectory(directory) {
|
|
|
103
111
|
const lines = output.split("\n");
|
|
104
112
|
for (const line of lines) if (line.includes(directory)) {
|
|
105
113
|
const parts = line.split(",");
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
114
|
+
const pidStr = parts[parts.length - 1];
|
|
115
|
+
if (!pidStr) continue;
|
|
116
|
+
const pid = Number.parseInt(pidStr);
|
|
117
|
+
if (pid && !Number.isNaN(pid)) {
|
|
108
118
|
consola.info(`Killing node process ${pid} in ${directory}`);
|
|
109
119
|
if (await killProcessTree(pid)) killedCount++;
|
|
110
120
|
}
|
|
@@ -114,8 +124,10 @@ async function killNodeProcessesInDirectory(directory) {
|
|
|
114
124
|
const lines = output.split("\n");
|
|
115
125
|
for (const line of lines) if (line.includes("node") && line.includes(directory)) {
|
|
116
126
|
const parts = line.trim().split(/\s+/);
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
127
|
+
const pidStr = parts[1];
|
|
128
|
+
if (!pidStr) continue;
|
|
129
|
+
const pid = Number.parseInt(pidStr);
|
|
130
|
+
if (pid && !Number.isNaN(pid)) {
|
|
119
131
|
consola.info(`Killing node process ${pid} in ${directory}`);
|
|
120
132
|
if (await killProcessTree(pid)) killedCount++;
|
|
121
133
|
}
|
package/dist/package.mjs
CHANGED
package/dist/types/event.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { Session } from "h3";
|
|
|
5
5
|
|
|
6
6
|
//#region src/types/event.d.ts
|
|
7
7
|
interface ExtendContext {}
|
|
8
|
-
interface SilgiRuntimeContext extends Record<string, any> {
|
|
8
|
+
interface SilgiRuntimeContext extends ExtendContext, Record<string, any> {
|
|
9
9
|
/* Matched router parameters */
|
|
10
10
|
params?: Record<string, string>;
|
|
11
11
|
protocol: EventProtocol;
|
package/dist/types/kits.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SilgiCLI } from "./silgiCLI.mjs";
|
|
2
2
|
import { BuildSilgi } from "./silgi.mjs";
|
|
3
3
|
import { ESMCodeGenOptions, ESMImport } from "knitwork";
|
|
4
|
-
import * as
|
|
4
|
+
import * as h33 from "h3";
|
|
5
5
|
import { PresetName } from "silgi/presets";
|
|
6
|
-
import * as
|
|
6
|
+
import * as nitropack_types1 from "nitropack/types";
|
|
7
7
|
|
|
8
8
|
//#region src/types/kits.d.ts
|
|
9
9
|
interface SilgiCommands {}
|
|
@@ -24,7 +24,7 @@ interface GenImport {
|
|
|
24
24
|
imports: ESMImport | ESMImport[];
|
|
25
25
|
options?: ESMCodeGenOptions;
|
|
26
26
|
}
|
|
27
|
-
type Framework<T extends PresetName> = T extends "nitro" ?
|
|
27
|
+
type Framework<T extends PresetName> = T extends "nitro" ? nitropack_types1.NitroApp : T extends "nuxt" ? nitropack_types1.NitroApp : T extends "h3" ? h33.Router : never;
|
|
28
28
|
interface DefineFrameworkOptions<T extends PresetName> extends Omit<BuildSilgi, "framework"> {
|
|
29
29
|
framework: Framework<T>;
|
|
30
30
|
}
|