silgi 0.43.17 → 0.43.19

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.
Files changed (70) hide show
  1. package/dist/build.d.mts +2 -2
  2. package/dist/cli/build/dev.d.mts +4 -3
  3. package/dist/cli/build/dev.mjs +30 -44
  4. package/dist/cli/build/prepare.d.mts +1 -1
  5. package/dist/cli/commands/init.mjs +1 -1
  6. package/dist/cli/commands/run.mjs +14 -60
  7. package/dist/cli/commands/watch.mjs +114 -9
  8. package/dist/cli/config/index.d.mts +2 -2
  9. package/dist/cli/config/loader.d.mts +1 -1
  10. package/dist/cli/config/resolvers/compatibility.mjs +1 -1
  11. package/dist/cli/config/types.d.mts +1 -1
  12. package/dist/cli/core/app.mjs +1 -1
  13. package/dist/cli/index.mjs +1 -1
  14. package/dist/cli/module/install.mjs +1 -1
  15. package/dist/cli/module/scan.mjs +6 -6
  16. package/dist/cli/scan/prepareCommands.mjs +1 -1
  17. package/dist/cli/scan/scanExportFile.mjs +3 -3
  18. package/dist/cli/scan/writeTypesAndFiles.mjs +1 -1
  19. package/dist/cli/utils/compatibility.mjs +1 -1
  20. package/dist/cli/utils/processManager.mjs +158 -0
  21. package/dist/core/context.d.mts +1 -1
  22. package/dist/core/createSilgi.d.mts +1 -1
  23. package/dist/core/error.d.mts +1 -1
  24. package/dist/core/event.d.mts +1 -1
  25. package/dist/core/index.d.mts +19 -19
  26. package/dist/core/response.d.mts +2 -2
  27. package/dist/core/silgi.d.mts +1 -1
  28. package/dist/core/silgiApp.d.mts +1 -1
  29. package/dist/core/storage.d.mts +1 -1
  30. package/dist/core/unctx.d.mts +1 -1
  31. package/dist/core/utils/event-stream.d.mts +2 -2
  32. package/dist/core/utils/event.d.mts +1 -1
  33. package/dist/core/utils/internal/event-stream.d.mts +1 -1
  34. package/dist/core/utils/merge.d.mts +1 -1
  35. package/dist/core/utils/middleware.d.mts +1 -1
  36. package/dist/core/utils/resolver.d.mts +1 -1
  37. package/dist/core/utils/runtime.d.mts +1 -1
  38. package/dist/core/utils/schema.d.mts +1 -1
  39. package/dist/core/utils/service.d.mts +1 -1
  40. package/dist/core/utils/shared.d.mts +1 -1
  41. package/dist/core/utils/storage.d.mts +1 -1
  42. package/dist/index.d.mts +19 -19
  43. package/dist/kit/add/add-commands.d.mts +1 -1
  44. package/dist/kit/add/add-core-file.d.mts +1 -1
  45. package/dist/kit/add/add-imports.d.mts +1 -1
  46. package/dist/kit/add/add-npm.d.mts +1 -1
  47. package/dist/kit/define.d.mts +1 -1
  48. package/dist/kit/errors.d.mts +1 -1
  49. package/dist/kit/esm.d.mts +1 -1
  50. package/dist/kit/fs.d.mts +1 -1
  51. package/dist/kit/function-utils.d.mts +1 -1
  52. package/dist/kit/function-utils.mjs +1 -1
  53. package/dist/kit/gen.d.mts +1 -1
  54. package/dist/kit/hash.d.mts +1 -1
  55. package/dist/kit/index.d.mts +21 -21
  56. package/dist/kit/index.mjs +1 -1
  57. package/dist/kit/isFramework.d.mts +1 -1
  58. package/dist/kit/logger.d.mts +1 -1
  59. package/dist/kit/migration.d.mts +1 -1
  60. package/dist/kit/migration.mjs +1 -1
  61. package/dist/kit/module.d.mts +1 -1
  62. package/dist/kit/path.d.mts +1 -1
  63. package/dist/kit/preset.d.mts +1 -1
  64. package/dist/kit/resolve.d.mts +1 -1
  65. package/dist/kit/resolve.mjs +1 -1
  66. package/dist/kit/template.d.mts +1 -1
  67. package/dist/kit/useRequest.d.mts +1 -1
  68. package/dist/kit/utils.d.mts +1 -1
  69. package/dist/package.mjs +8 -9
  70. package/package.json +18 -19
@@ -0,0 +1,158 @@
1
+ import consola from "consola";
2
+ import { execSync } from "node:child_process";
3
+
4
+ //#region src/cli/utils/processManager.ts
5
+ const isWindows = process.platform === "win32";
6
+ /**
7
+ * Get all processes using a specific port
8
+ */
9
+ async function getProcessesOnPort(port) {
10
+ const processes = [];
11
+ try {
12
+ if (isWindows) {
13
+ const output = execSync("netstat -ano", { encoding: "utf8" });
14
+ const lines = output.split("\n");
15
+ for (const line of lines) if (line.includes(`:${port}`) && line.includes("LISTENING")) {
16
+ const parts = line.trim().split(/\s+/);
17
+ const pid = Number.parseInt(parts[parts.length - 1]);
18
+ if (pid && pid !== 0) try {
19
+ const taskList = execSync(`tasklist /FI "PID eq ${pid}" /FO CSV`, { encoding: "utf8" });
20
+ const processLine = taskList.split("\n")[1];
21
+ if (processLine) {
22
+ const name = processLine.split(",")[0].replace(/"/g, "");
23
+ processes.push({
24
+ pid,
25
+ name,
26
+ port
27
+ });
28
+ }
29
+ } catch {
30
+ processes.push({
31
+ pid,
32
+ name: "unknown",
33
+ port
34
+ });
35
+ }
36
+ }
37
+ } else try {
38
+ const output = execSync(`lsof -i:${port} -P -n`, { encoding: "utf8" });
39
+ const lines = output.split("\n").slice(1);
40
+ for (const line of lines) if (line.trim()) {
41
+ const parts = line.trim().split(/\s+/);
42
+ const name = parts[0];
43
+ const pid = Number.parseInt(parts[1]);
44
+ if (pid && !processes.some((p) => p.pid === pid)) processes.push({
45
+ pid,
46
+ name,
47
+ port
48
+ });
49
+ }
50
+ } catch {}
51
+ } catch (error) {
52
+ consola.debug(`Failed to get processes on port ${port}:`, error);
53
+ }
54
+ return processes;
55
+ }
56
+ /**
57
+ * Kill a process and all its children
58
+ */
59
+ async function killProcessTree(pid, signal = "SIGKILL") {
60
+ try {
61
+ if (isWindows) {
62
+ execSync(`taskkill /F /T /PID ${pid}`, { stdio: "ignore" });
63
+ return true;
64
+ } else try {
65
+ process.kill(-pid, signal);
66
+ return true;
67
+ } catch {
68
+ process.kill(pid, signal);
69
+ return true;
70
+ }
71
+ } catch (error) {
72
+ consola.debug(`Failed to kill process ${pid}:`, error);
73
+ return false;
74
+ }
75
+ }
76
+ /**
77
+ * Kill all processes on a specific port
78
+ */
79
+ async function killPortProcesses(port) {
80
+ const processes = await getProcessesOnPort(port);
81
+ let killedCount = 0;
82
+ for (const proc of processes) {
83
+ consola.info(`Killing ${proc.name} (PID: ${proc.pid}) on port ${port}`);
84
+ if (await killProcessTree(proc.pid)) killedCount++;
85
+ }
86
+ return killedCount;
87
+ }
88
+ /**
89
+ * Find and kill all Node.js processes in a directory
90
+ */
91
+ async function killNodeProcessesInDirectory(directory) {
92
+ let killedCount = 0;
93
+ try {
94
+ if (isWindows) {
95
+ const output = execSync("wmic process where \"name='node.exe'\" get ProcessId,CommandLine /FORMAT:CSV", {
96
+ encoding: "utf8",
97
+ stdio: [
98
+ "ignore",
99
+ "pipe",
100
+ "ignore"
101
+ ]
102
+ });
103
+ const lines = output.split("\n");
104
+ for (const line of lines) if (line.includes(directory)) {
105
+ const parts = line.split(",");
106
+ const pid = Number.parseInt(parts[parts.length - 1]);
107
+ if (pid) {
108
+ consola.info(`Killing node process ${pid} in ${directory}`);
109
+ if (await killProcessTree(pid)) killedCount++;
110
+ }
111
+ }
112
+ } else {
113
+ const output = execSync("ps aux", { encoding: "utf8" });
114
+ const lines = output.split("\n");
115
+ for (const line of lines) if (line.includes("node") && line.includes(directory)) {
116
+ const parts = line.trim().split(/\s+/);
117
+ const pid = Number.parseInt(parts[1]);
118
+ if (pid) {
119
+ consola.info(`Killing node process ${pid} in ${directory}`);
120
+ if (await killProcessTree(pid)) killedCount++;
121
+ }
122
+ }
123
+ }
124
+ } catch (error) {
125
+ consola.debug("Failed to find node processes:", error);
126
+ }
127
+ return killedCount;
128
+ }
129
+ /**
130
+ * Aggressive cleanup: kill all processes on common dev ports
131
+ */
132
+ async function aggressiveCleanup() {
133
+ const commonPorts = [
134
+ 3e3,
135
+ 3001,
136
+ 4e3,
137
+ 5e3,
138
+ 5173,
139
+ 8080,
140
+ 8e3,
141
+ 9e3
142
+ ];
143
+ consola.info("Performing aggressive cleanup...");
144
+ for (const port of commonPorts) {
145
+ const processes = await getProcessesOnPort(port);
146
+ if (processes.length > 0) {
147
+ consola.info(`Found ${processes.length} process(es) on port ${port}`);
148
+ await killPortProcesses(port);
149
+ }
150
+ }
151
+ const cwd = process.cwd();
152
+ const killedInDir = await killNodeProcessesInDirectory(cwd);
153
+ if (killedInDir > 0) consola.info(`Killed ${killedInDir} node process(es) in ${cwd}`);
154
+ consola.success("Aggressive cleanup complete");
155
+ }
156
+
157
+ //#endregion
158
+ export { aggressiveCleanup, killPortProcesses, killProcessTree };
@@ -27,4 +27,4 @@ declare function useRuntime(): SilgiRuntimeConfig;
27
27
  * ```
28
28
  */
29
29
  //#endregion
30
- export { updateRuntimeStorage, useRuntime };
30
+ export { updateRuntimeStorage as updateRuntimeStorage$1, useRuntime as useRuntime$1 };
@@ -3,4 +3,4 @@ import { Silgi, SilgiConfig } from "silgi/types";
3
3
  //#region src/core/createSilgi.d.ts
4
4
  declare function createSilgi(config: SilgiConfig): Promise<Silgi>;
5
5
  //#endregion
6
- export { createSilgi };
6
+ export { createSilgi as createSilgi$1 };
@@ -62,4 +62,4 @@ declare function createError<DataT = unknown>(input: string | (Partial<SilgiErro
62
62
  */
63
63
  declare function isError<DataT = unknown>(input: any): input is SilgiError<DataT>;
64
64
  //#endregion
65
- export { SilgiError, createError, isError };
65
+ export { SilgiError as SilgiError$1, createError as createError$1, isError as isError$1 };
@@ -23,4 +23,4 @@ declare class SilgiEventResponse {
23
23
  get headers(): Headers;
24
24
  }
25
25
  //#endregion
26
- export { SilgiHttpEvent };
26
+ export { SilgiHttpEvent as SilgiHttpEvent$1 };
@@ -1,22 +1,22 @@
1
- import { updateRuntimeStorage, useRuntime } from "./context.mjs";
2
- import { createSilgi } from "./createSilgi.mjs";
3
- import { SilgiError, createError, isError } from "./error.mjs";
4
- import { SilgiHttpEvent } from "./event.mjs";
5
- import { handleResponse, kHandled, kNotFound } from "./response.mjs";
6
- import { getWebsocket, handler, middleware, silgiFetch } from "./silgi.mjs";
7
- import { silgiCLICtx, tryUseSilgiCLI, useSilgiCLI } from "./silgiApp.mjs";
8
- import { storageMount } from "./storage.mjs";
9
- import { silgiCtx, tryUseSilgi, useSilgi } from "./unctx.mjs";
10
- import { createEventStream } from "./utils/event-stream.mjs";
11
- import { getEvent, getEventContext } from "./utils/event.mjs";
12
- import { deepMergeObjects } from "./utils/merge.mjs";
13
- import { createMiddleware } from "./utils/middleware.mjs";
14
- import { createResolver, getUrlPrefix } from "./utils/resolver.mjs";
15
- import { replaceRuntimeValues } from "./utils/runtime.mjs";
16
- import { createSchema } from "./utils/schema.mjs";
17
- import { createService, createWebSocket, defineServiceSetup } from "./utils/service.mjs";
18
- import { createShared } from "./utils/shared.mjs";
19
- import { createStorage, useSilgiStorage } from "./utils/storage.mjs";
1
+ import { updateRuntimeStorage$1 as updateRuntimeStorage, useRuntime$1 as useRuntime } from "./context.mjs";
2
+ import { createSilgi$1 as createSilgi } from "./createSilgi.mjs";
3
+ import { SilgiError$1 as SilgiError, createError$1 as createError, isError$1 as isError } from "./error.mjs";
4
+ import { SilgiHttpEvent$1 as SilgiHttpEvent } from "./event.mjs";
5
+ import { handleResponse$1 as handleResponse, kHandled$1 as kHandled, kNotFound$1 as kNotFound } from "./response.mjs";
6
+ import { getWebsocket$1 as getWebsocket, handler$1 as handler, middleware$1 as middleware, silgiFetch$1 as silgiFetch } from "./silgi.mjs";
7
+ import { silgiCLICtx$1 as silgiCLICtx, tryUseSilgiCLI$1 as tryUseSilgiCLI, useSilgiCLI$1 as useSilgiCLI } from "./silgiApp.mjs";
8
+ import { storageMount$1 as storageMount } from "./storage.mjs";
9
+ import { silgiCtx$1 as silgiCtx, tryUseSilgi$1 as tryUseSilgi, useSilgi$1 as useSilgi } from "./unctx.mjs";
10
+ import { createEventStream$1 as createEventStream } from "./utils/event-stream.mjs";
11
+ import { getEvent$1 as getEvent, getEventContext$1 as getEventContext } from "./utils/event.mjs";
12
+ import { deepMergeObjects$1 as deepMergeObjects } from "./utils/merge.mjs";
13
+ import { createMiddleware$1 as createMiddleware } from "./utils/middleware.mjs";
14
+ import { createResolver$2 as createResolver, getUrlPrefix$1 as getUrlPrefix } from "./utils/resolver.mjs";
15
+ import { replaceRuntimeValues$1 as replaceRuntimeValues } from "./utils/runtime.mjs";
16
+ import { createSchema$1 as createSchema } from "./utils/schema.mjs";
17
+ import { createService$1 as createService, createWebSocket$1 as createWebSocket, defineServiceSetup$1 as defineServiceSetup } from "./utils/service.mjs";
18
+ import { createShared$1 as createShared } from "./utils/shared.mjs";
19
+ import { createStorage$1 as createStorage, useSilgiStorage$1 as useSilgiStorage } from "./utils/storage.mjs";
20
20
 
21
21
  //#region src/core/index.d.ts
22
22
  // TODO: bunlari yinede destekle.
@@ -1,4 +1,4 @@
1
- import { SilgiError } from "./error.mjs";
1
+ import { SilgiError$1 as SilgiError } from "./error.mjs";
2
2
  import { SilgiEvent } from "silgi/types";
3
3
 
4
4
  //#region src/core/response.d.ts
@@ -17,4 +17,4 @@ declare const kNotFound: symbol;
17
17
  declare const kHandled: symbol;
18
18
  declare function handleResponse(val: unknown, event: SilgiEvent, config: SilgiHandlerConfig): Response | Promise<Response>;
19
19
  //#endregion
20
- export { handleResponse, kHandled, kNotFound };
20
+ export { handleResponse as handleResponse$1, kHandled as kHandled$1, kNotFound as kNotFound$1 };
@@ -16,4 +16,4 @@ declare function middleware(event: SilgiEvent): Promise<any>;
16
16
  declare function handler(event: SilgiEvent): Promise<any>;
17
17
  declare function getWebsocket(silgi?: Silgi): WebSocketOptions;
18
18
  //#endregion
19
- export { getWebsocket, handler, middleware, silgiFetch };
19
+ export { getWebsocket as getWebsocket$1, handler as handler$1, middleware as middleware$1, silgiFetch as silgiFetch$1 };
@@ -6,4 +6,4 @@ declare const silgiCLICtx: UseContext<SilgiCLI>;
6
6
  declare function useSilgiCLI(): SilgiCLI;
7
7
  declare function tryUseSilgiCLI(): SilgiCLI | null;
8
8
  //#endregion
9
- export { silgiCLICtx, tryUseSilgiCLI, useSilgiCLI };
9
+ export { silgiCLICtx as silgiCLICtx$1, tryUseSilgiCLI as tryUseSilgiCLI$1, useSilgiCLI as useSilgiCLI$1 };
@@ -4,4 +4,4 @@ import { Silgi, SilgiStorageBase } from "silgi/types";
4
4
  //#region src/core/storage.d.ts
5
5
  declare function storageMount<T extends Storage = Storage>(silgi?: Silgi): (base: keyof SilgiStorageBase, driver: Parameters<Storage["mount"]>[1]) => T;
6
6
  //#endregion
7
- export { storageMount };
7
+ export { storageMount as storageMount$1 };
@@ -18,4 +18,4 @@ declare function useSilgi(): Silgi;
18
18
  */
19
19
  declare function tryUseSilgi(): Silgi | null;
20
20
  //#endregion
21
- export { silgiCtx, tryUseSilgi, useSilgi };
21
+ export { silgiCtx as silgiCtx$1, tryUseSilgi as tryUseSilgi$1, useSilgi as useSilgi$1 };
@@ -1,4 +1,4 @@
1
- import { EventStream } from "./internal/event-stream.mjs";
1
+ import { EventStream$1 as EventStream } from "./internal/event-stream.mjs";
2
2
  import { SilgiEvent } from "silgi/types";
3
3
 
4
4
  //#region src/core/utils/event-stream.d.ts
@@ -50,4 +50,4 @@ interface EventStreamMessage {
50
50
  */
51
51
  declare function createEventStream(event: SilgiEvent, opts?: EventStreamOptions): EventStream;
52
52
  //#endregion
53
- export { EventStreamMessage, EventStreamOptions, createEventStream };
53
+ export { EventStreamMessage, EventStreamOptions, createEventStream as createEventStream$1 };
@@ -5,4 +5,4 @@ import { SilgiEvent, SilgiRuntimeContext } from "silgi/types";
5
5
  declare function getEvent<T extends SilgiEvent>(event?: SilgiEvent): T;
6
6
  declare function getEventContext<T extends SilgiRuntimeContext>(event?: SilgiEvent): T;
7
7
  //#endregion
8
- export { getEvent, getEventContext };
8
+ export { getEvent as getEvent$1, getEventContext as getEventContext$1 };
@@ -42,4 +42,4 @@ declare class EventStream {
42
42
  send(): Promise<BodyInit>;
43
43
  }
44
44
  //#endregion
45
- export { EventStream };
45
+ export { EventStream as EventStream$1 };
@@ -11,4 +11,4 @@ import { MergeAll } from "silgi/types";
11
11
  */
12
12
  declare function deepMergeObjects<T extends readonly Record<string, any>[]>(schemas: [...T]): MergeAll<T>;
13
13
  //#endregion
14
- export { deepMergeObjects };
14
+ export { deepMergeObjects as deepMergeObjects$1 };
@@ -11,4 +11,4 @@ declare function createMiddleware<S extends WildcardVariants<keyof Routers>, Use
11
11
  path: Path;
12
12
  }): CreateMiddlewareResult<Path, UsedMethod, Key>;
13
13
  //#endregion
14
- export { CreateMiddlewareResult, createMiddleware };
14
+ export { CreateMiddlewareResult, createMiddleware as createMiddleware$1 };
@@ -4,4 +4,4 @@ import { Resolvers, SilgiURL } from "silgi/types";
4
4
  declare function createResolver(resolver: Resolvers): Resolvers;
5
5
  declare function getUrlPrefix(path: string, method?: string): SilgiURL;
6
6
  //#endregion
7
- export { createResolver, getUrlPrefix };
7
+ export { createResolver as createResolver$2, getUrlPrefix as getUrlPrefix$1 };
@@ -4,4 +4,4 @@
4
4
  */
5
5
  declare function replaceRuntimeValues(obj: any, runtime: any): any;
6
6
  //#endregion
7
- export { replaceRuntimeValues };
7
+ export { replaceRuntimeValues as replaceRuntimeValues$1 };
@@ -31,4 +31,4 @@ declare function createSchema<Key extends string, Schema extends BaseMethodSchem
31
31
  key: Key;
32
32
  } & Schema): { [K in Key]: Schema };
33
33
  //#endregion
34
- export { createSchema };
34
+ export { createSchema as createSchema$1 };
@@ -10,4 +10,4 @@ declare function defineServiceSetup<Method extends HTTPMethod, Path extends keyo
10
10
  declare function createService<Path extends string, Method extends HTTPMethod, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false>(params: ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>): Record<`http:${Method}:${Path}`, ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>>;
11
11
  declare function createWebSocket<Path extends string, Method extends HTTPMethod>(params: WebSocketServiceSetup<Method, Path>): Record<`websocket:${Method}:${Path}`, WebSocketServiceSetup<Method, Path>>;
12
12
  //#endregion
13
- export { createService, createWebSocket, defineServiceSetup };
13
+ export { createService as createService$1, createWebSocket as createWebSocket$1, defineServiceSetup as defineServiceSetup$1 };
@@ -3,4 +3,4 @@ import { SilgiRuntimeShareds } from "silgi/types";
3
3
  //#region src/core/utils/shared.d.ts
4
4
  declare function createShared(shared: Partial<SilgiRuntimeShareds>): SilgiRuntimeShareds;
5
5
  //#endregion
6
- export { createShared };
6
+ export { createShared as createShared$1 };
@@ -21,4 +21,4 @@ declare function createStorage$1(silgi: Silgi): Promise<Storage<StorageValue>>;
21
21
  // }
22
22
  declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>["base"] | (string & {})): Storage<T>;
23
23
  //#endregion
24
- export { createStorage$1 as createStorage, useSilgiStorage };
24
+ export { createStorage$1, useSilgiStorage as useSilgiStorage$1 };
package/dist/index.d.mts CHANGED
@@ -1,21 +1,21 @@
1
- import { updateRuntimeStorage, useRuntime } from "./core/context.mjs";
2
- import { createSilgi } from "./core/createSilgi.mjs";
3
- import { SilgiError, createError, isError } from "./core/error.mjs";
4
- import { SilgiHttpEvent } from "./core/event.mjs";
5
- import { handleResponse, kHandled, kNotFound } from "./core/response.mjs";
6
- import { getWebsocket, handler, middleware, silgiFetch } from "./core/silgi.mjs";
7
- import { silgiCLICtx, tryUseSilgiCLI, useSilgiCLI } from "./core/silgiApp.mjs";
8
- import { storageMount } from "./core/storage.mjs";
9
- import { silgiCtx, tryUseSilgi, useSilgi } from "./core/unctx.mjs";
10
- import { createEventStream } from "./core/utils/event-stream.mjs";
11
- import { getEvent, getEventContext } from "./core/utils/event.mjs";
12
- import { deepMergeObjects } from "./core/utils/merge.mjs";
13
- import { createMiddleware } from "./core/utils/middleware.mjs";
14
- import { createResolver, getUrlPrefix } from "./core/utils/resolver.mjs";
15
- import { replaceRuntimeValues } from "./core/utils/runtime.mjs";
16
- import { createSchema } from "./core/utils/schema.mjs";
17
- import { createService, createWebSocket, defineServiceSetup } from "./core/utils/service.mjs";
18
- import { createShared } from "./core/utils/shared.mjs";
19
- import { createStorage, useSilgiStorage } from "./core/utils/storage.mjs";
1
+ import { updateRuntimeStorage$1 as updateRuntimeStorage, useRuntime$1 as useRuntime } from "./core/context.mjs";
2
+ import { createSilgi$1 as createSilgi } from "./core/createSilgi.mjs";
3
+ import { SilgiError$1 as SilgiError, createError$1 as createError, isError$1 as isError } from "./core/error.mjs";
4
+ import { SilgiHttpEvent$1 as SilgiHttpEvent } from "./core/event.mjs";
5
+ import { handleResponse$1 as handleResponse, kHandled$1 as kHandled, kNotFound$1 as kNotFound } from "./core/response.mjs";
6
+ import { getWebsocket$1 as getWebsocket, handler$1 as handler, middleware$1 as middleware, silgiFetch$1 as silgiFetch } from "./core/silgi.mjs";
7
+ import { silgiCLICtx$1 as silgiCLICtx, tryUseSilgiCLI$1 as tryUseSilgiCLI, useSilgiCLI$1 as useSilgiCLI } from "./core/silgiApp.mjs";
8
+ import { storageMount$1 as storageMount } from "./core/storage.mjs";
9
+ import { silgiCtx$1 as silgiCtx, tryUseSilgi$1 as tryUseSilgi, useSilgi$1 as useSilgi } from "./core/unctx.mjs";
10
+ import { createEventStream$1 as createEventStream } from "./core/utils/event-stream.mjs";
11
+ import { getEvent$1 as getEvent, getEventContext$1 as getEventContext } from "./core/utils/event.mjs";
12
+ import { deepMergeObjects$1 as deepMergeObjects } from "./core/utils/merge.mjs";
13
+ import { createMiddleware$1 as createMiddleware } from "./core/utils/middleware.mjs";
14
+ import { createResolver$2 as createResolver, getUrlPrefix$1 as getUrlPrefix } from "./core/utils/resolver.mjs";
15
+ import { replaceRuntimeValues$1 as replaceRuntimeValues } from "./core/utils/runtime.mjs";
16
+ import { createSchema$1 as createSchema } from "./core/utils/schema.mjs";
17
+ import { createService$1 as createService, createWebSocket$1 as createWebSocket, defineServiceSetup$1 as defineServiceSetup } from "./core/utils/service.mjs";
18
+ import { createShared$1 as createShared } from "./core/utils/shared.mjs";
19
+ import { createStorage$1 as createStorage, useSilgiStorage$1 as useSilgiStorage } from "./core/utils/storage.mjs";
20
20
  import { autoImportTypes } from "./core/index.mjs";
21
21
  export { SilgiError, SilgiHttpEvent, autoImportTypes, createError, createEventStream, createMiddleware, createResolver, createSchema, createService, createShared, createSilgi, createStorage, createWebSocket, deepMergeObjects, defineServiceSetup, getEvent, getEventContext, getUrlPrefix, getWebsocket, handleResponse, handler, isError, kHandled, kNotFound, middleware, replaceRuntimeValues, silgiCLICtx, silgiCtx, silgiFetch, storageMount, tryUseSilgi, tryUseSilgiCLI, updateRuntimeStorage, useRuntime, useSilgi, useSilgiCLI, useSilgiStorage };
@@ -3,4 +3,4 @@ import { Commands } from "silgi/types";
3
3
  //#region src/kit/add/add-commands.d.ts
4
4
  declare function addCommands(data: Commands | Commands[]): Promise<void>;
5
5
  //#endregion
6
- export { addCommands };
6
+ export { addCommands as addCommands$1 };
@@ -6,4 +6,4 @@ declare function addCoreFile(data: {
6
6
  after?: SilgiCLIHooks["after:core.ts"];
7
7
  }): Promise<void>;
8
8
  //#endregion
9
- export { addCoreFile };
9
+ export { addCoreFile as addCoreFile$1 };
@@ -11,4 +11,4 @@ declare function addImports(data?: {
11
11
  addImportItemType: (data: GenImport | GenImport[]) => void;
12
12
  };
13
13
  //#endregion
14
- export { addImports };
14
+ export { addImports as addImports$1 };
@@ -11,4 +11,4 @@ declare function addNPMPackage(data: {
11
11
  when?: boolean;
12
12
  }): Promise<void>;
13
13
  //#endregion
14
- export { addNPMPackage };
14
+ export { addNPMPackage as addNPMPackage$1 };
@@ -25,4 +25,4 @@ declare function defineFramework<T extends PresetName>(preset: T): {
25
25
  build(callback: (options: DefineFrameworkOptions<T>) => void | Promise<void>): (options: DefineFrameworkOptions<T>) => Promise<void>;
26
26
  };
27
27
  //#endregion
28
- export { defineFramework };
28
+ export { defineFramework as defineFramework$1 };
@@ -3,4 +3,4 @@ import { SilgiCLI } from "silgi/types";
3
3
  //#region src/kit/errors.d.ts
4
4
  declare function hasError(type: SilgiCLI["errors"][0]["type"], silgi?: SilgiCLI): boolean;
5
5
  //#endregion
6
- export { hasError };
6
+ export { hasError as hasError$1 };
@@ -8,4 +8,4 @@ declare function directoryToURL(dir: string): URL;
8
8
  */
9
9
  declare function tryResolveModule(id: string, url?: string | string[]): Promise<string | undefined>;
10
10
  //#endregion
11
- export { directoryToURL, tryResolveModule };
11
+ export { directoryToURL as directoryToURL$1, tryResolveModule as tryResolveModule$1 };
package/dist/kit/fs.d.mts CHANGED
@@ -4,4 +4,4 @@ import { Buffer } from "node:buffer";
4
4
  declare function writeFile(file: string, contents: Buffer | string, log?: boolean): Promise<void>;
5
5
  declare function isDirectory(path: string): Promise<boolean>;
6
6
  //#endregion
7
- export { isDirectory, writeFile };
7
+ export { isDirectory as isDirectory$1, writeFile as writeFile$1 };
@@ -24,4 +24,4 @@ declare function createFunction(name: string, args?: any): FunctionConfig;
24
24
  */
25
25
  declare function formatFunctions(configs: FunctionConfig[], indentation?: number, specialVars?: string[], deduplicateArgs?: boolean): string;
26
26
  //#endregion
27
- export { FunctionConfig, createFunction, createFunctionConfigs, formatFunctions };
27
+ export { FunctionConfig, createFunction as createFunction$1, createFunctionConfigs as createFunctionConfigs$1, formatFunctions as formatFunctions$1 };
@@ -24,7 +24,7 @@ function createFunction(name, args = {}) {
24
24
  */
25
25
  function formatFunctions(configs, indentation = 4, specialVars = [], deduplicateArgs = false) {
26
26
  const indent = " ".repeat(indentation);
27
- const argMap = /* @__PURE__ */ new Map();
27
+ const argMap = new Map();
28
28
  const argVarDeclarations = [];
29
29
  let argCounter = 0;
30
30
  if (deduplicateArgs) configs.forEach((config) => {
@@ -2,4 +2,4 @@
2
2
  declare function genEnsureSafeVar(name: string | any): string;
3
3
  declare function getAllEntries(obj: object): [string, any][];
4
4
  //#endregion
5
- export { genEnsureSafeVar, getAllEntries };
5
+ export { genEnsureSafeVar as genEnsureSafeVar$1, getAllEntries as getAllEntries$1 };
@@ -1,4 +1,4 @@
1
1
  //#region src/kit/hash.d.ts
2
2
  declare function hash(data: any): string;
3
3
  //#endregion
4
- export { hash };
4
+ export { hash as hash$1 };
@@ -1,22 +1,22 @@
1
- import { addCommands } from "./add/add-commands.mjs";
2
- import { addCoreFile } from "./add/add-core-file.mjs";
3
- import { addImports } from "./add/add-imports.mjs";
4
- import { addNPMPackage } from "./add/add-npm.mjs";
5
- import { defineFramework } from "./define.mjs";
6
- import { hasError } from "./errors.mjs";
7
- import { directoryToURL, tryResolveModule } from "./esm.mjs";
8
- import { isDirectory, writeFile } from "./fs.mjs";
9
- import { FunctionConfig, createFunction, createFunctionConfigs, formatFunctions } from "./function-utils.mjs";
10
- import { genEnsureSafeVar, getAllEntries } from "./gen.mjs";
11
- import { hash } from "./hash.mjs";
12
- import { isH3, isNitro, isNuxt } from "./isFramework.mjs";
13
- import { useLogger } from "./logger.mjs";
14
- import { JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult, MigrationStatus, generateMigration, getMigration, listMigrations, migrationDown, migrationUp } from "./migration.mjs";
15
- import { defineSilgiModule } from "./module.mjs";
16
- import { prettyPath, resolveSilgiPath } from "./path.mjs";
17
- import { defineSilgiPreset } from "./preset.mjs";
18
- import { createResolver, resolveAlias, resolvePath, resolveSilgiModule } from "./resolve.mjs";
19
- import { addTemplate, normalizeTemplate } from "./template.mjs";
20
- import { getIpAddress, useRequest } from "./useRequest.mjs";
21
- import { MODE_RE, baseHeaderBannerComment, filterInPlace, getServicePath, hasInstalledModule, hasSilgiModule, isPresents, isRuntimePresents, processFilePath, relativeWithDot, removeExtension, toArray } from "./utils.mjs";
1
+ import { addCommands$1 as addCommands } from "./add/add-commands.mjs";
2
+ import { addCoreFile$1 as addCoreFile } from "./add/add-core-file.mjs";
3
+ import { addImports$1 as addImports } from "./add/add-imports.mjs";
4
+ import { addNPMPackage$1 as addNPMPackage } from "./add/add-npm.mjs";
5
+ import { defineFramework$1 as defineFramework } from "./define.mjs";
6
+ import { hasError$1 as hasError } from "./errors.mjs";
7
+ import { directoryToURL$1 as directoryToURL, tryResolveModule$1 as tryResolveModule } from "./esm.mjs";
8
+ import { isDirectory$1 as isDirectory, writeFile$1 as writeFile } from "./fs.mjs";
9
+ import { FunctionConfig, createFunction$1 as createFunction, createFunctionConfigs$1 as createFunctionConfigs, formatFunctions$1 as formatFunctions } from "./function-utils.mjs";
10
+ import { genEnsureSafeVar$1 as genEnsureSafeVar, getAllEntries$1 as getAllEntries } from "./gen.mjs";
11
+ import { hash$1 as hash } from "./hash.mjs";
12
+ import { isH3$1 as isH3, isNitro$1 as isNitro, isNuxt$1 as isNuxt } from "./isFramework.mjs";
13
+ import { useLogger$1 as useLogger } from "./logger.mjs";
14
+ import { JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult, MigrationStatus$1 as MigrationStatus, generateMigration$1 as generateMigration, getMigration$1 as getMigration, listMigrations$1 as listMigrations, migrationDown$1 as migrationDown, migrationUp$1 as migrationUp } from "./migration.mjs";
15
+ import { defineSilgiModule$1 as defineSilgiModule } from "./module.mjs";
16
+ import { prettyPath$1 as prettyPath, resolveSilgiPath$1 as resolveSilgiPath } from "./path.mjs";
17
+ import { defineSilgiPreset$1 as defineSilgiPreset } from "./preset.mjs";
18
+ import { createResolver$3 as createResolver, resolveAlias$1 as resolveAlias, resolvePath$1 as resolvePath, resolveSilgiModule$1 as resolveSilgiModule } from "./resolve.mjs";
19
+ import { addTemplate$1 as addTemplate, normalizeTemplate$1 as normalizeTemplate } from "./template.mjs";
20
+ import { getIpAddress$1 as getIpAddress, useRequest$1 as useRequest } from "./useRequest.mjs";
21
+ import { MODE_RE$1 as MODE_RE, baseHeaderBannerComment$1 as baseHeaderBannerComment, filterInPlace$1 as filterInPlace, getServicePath$1 as getServicePath, hasInstalledModule$2 as hasInstalledModule, hasSilgiModule$1 as hasSilgiModule, isPresents$1 as isPresents, isRuntimePresents$1 as isRuntimePresents, processFilePath$1 as processFilePath, relativeWithDot$1 as relativeWithDot, removeExtension$1 as removeExtension, toArray$1 as toArray } from "./utils.mjs";
22
22
  export { FunctionConfig, JsonPatch, MODE_RE, MigrationData, MigrationInfo, MigrationOptions, MigrationResult, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineFramework, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, getServicePath, hasError, hasInstalledModule, hasSilgiModule, hash, isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, prettyPath, processFilePath, relativeWithDot, removeExtension, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useRequest, writeFile };
@@ -16,7 +16,7 @@ import { useLogger } from "./logger.mjs";
16
16
  import { MigrationStatus, generateMigration, getMigration, listMigrations, migrationDown, migrationUp } from "./migration.mjs";
17
17
  import { defineSilgiModule } from "./module.mjs";
18
18
  import { defineSilgiPreset } from "./preset.mjs";
19
- import { createResolver, resolveAlias, resolvePath, resolveSilgiModule } from "./resolve.mjs";
19
+ import { createResolver$1 as createResolver, resolveAlias, resolvePath, resolveSilgiModule } from "./resolve.mjs";
20
20
  import { addTemplate, normalizeTemplate } from "./template.mjs";
21
21
  import { getIpAddress, useRequest } from "./useRequest.mjs";
22
22
 
@@ -3,4 +3,4 @@ declare function isNuxt(): boolean;
3
3
  declare function isNitro(): boolean;
4
4
  declare function isH3(): boolean;
5
5
  //#endregion
6
- export { isH3, isNitro, isNuxt };
6
+ export { isH3 as isH3$1, isNitro as isNitro$1, isNuxt as isNuxt$1 };
@@ -3,4 +3,4 @@ import { ConsolaInstance, ConsolaOptions } from "consola";
3
3
  //#region src/kit/logger.d.ts
4
4
  declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
5
5
  //#endregion
6
- export { useLogger };
6
+ export { useLogger as useLogger$1 };
@@ -110,4 +110,4 @@ declare function migrationUp(migrationsDir: string, targetTimestamp?: number): P
110
110
  */
111
111
  declare function migrationDown(migrationsDir: string, targetTimestamp?: number): Promise<MigrationResult>;
112
112
  //#endregion
113
- export { JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult, MigrationStatus, generateMigration, getMigration, listMigrations, migrationDown, migrationUp };
113
+ export { JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult, MigrationStatus as MigrationStatus$1, generateMigration as generateMigration$1, getMigration as getMigration$1, listMigrations as listMigrations$1, migrationDown as migrationDown$1, migrationUp as migrationUp$1 };
@@ -79,7 +79,7 @@ async function generateMigration(data, directoryPath, fileNamePrefix = "data_",
79
79
  const latestInfo = {
80
80
  timestamp,
81
81
  file: fileName,
82
- created: (/* @__PURE__ */ new Date()).toISOString(),
82
+ created: new Date().toISOString(),
83
83
  description,
84
84
  isPatch
85
85
  };
@@ -11,4 +11,4 @@ declare function defineSilgiModule<TOptions extends ModuleOptionsCustom>(): {
11
11
  with: <TOptionsDefaults extends Partial<TOptions>>(definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | SilgiModule<TOptions, TOptionsDefaults, true>) => SilgiModule<TOptions, TOptionsDefaults, true>;
12
12
  };
13
13
  //#endregion
14
- export { defineSilgiModule };
14
+ export { defineSilgiModule as defineSilgiModule$1 };
@@ -4,4 +4,4 @@ import { SilgiCLI } from "silgi/types";
4
4
  declare function prettyPath(p: string, highlight?: boolean): string;
5
5
  declare function resolveSilgiPath(path: string, silgiCLIOptions: SilgiCLI["options"], base?: string): string;
6
6
  //#endregion
7
- export { prettyPath, resolveSilgiPath };
7
+ export { prettyPath as prettyPath$1, resolveSilgiPath as resolveSilgiPath$1 };
@@ -5,4 +5,4 @@ declare function defineSilgiPreset<P extends SilgiPreset, M extends SilgiPresetM
5
5
  _meta: SilgiPresetMeta;
6
6
  };
7
7
  //#endregion
8
- export { defineSilgiPreset };
8
+ export { defineSilgiPreset as defineSilgiPreset$1 };
@@ -34,4 +34,4 @@ interface Resolver {
34
34
  declare function createResolver(base: string | URL): Resolver;
35
35
  declare function resolveSilgiModule(base: string, paths: string[]): Promise<string[]>;
36
36
  //#endregion
37
- export { createResolver, resolveAlias, resolvePath, resolveSilgiModule };
37
+ export { createResolver as createResolver$3, resolveAlias as resolveAlias$1, resolvePath as resolvePath$1, resolveSilgiModule as resolveSilgiModule$1 };