silgi 0.22.1 → 0.23.0
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 +2 -0
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/install.mjs +1 -0
- package/dist/cli/prepare.mjs +46 -119
- package/dist/core/index.d.mts +7 -1
- package/dist/core/index.d.ts +7 -1
- package/dist/core/index.mjs +26 -2
- package/dist/meta/index.d.mts +65 -65
- package/dist/meta/index.d.ts +65 -65
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +12 -12
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/dev.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { s as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
|
|
|
9
9
|
import { c as commonArgs, p as prepare } from './prepare.mjs';
|
|
10
10
|
import 'ufo';
|
|
11
11
|
import 'unctx';
|
|
12
|
+
import 'knitwork';
|
|
12
13
|
import 'silgi/kit';
|
|
13
14
|
import 'node:fs';
|
|
14
15
|
import 'node:fs/promises';
|
|
@@ -89,6 +90,7 @@ const dev = defineCommand({
|
|
|
89
90
|
const watchReloadEvents = /* @__PURE__ */ new Set(["add", "addDir", "unlink", "unlinkDir", "change"]);
|
|
90
91
|
let watcher;
|
|
91
92
|
if (silgi.options.devServer.watch.length > 0) {
|
|
93
|
+
silgi.options.devServer.watch = [...new Set(silgi.options.devServer.watch)];
|
|
92
94
|
watcher = watch(silgi.options.devServer.watch, silgi.options.watchOptions);
|
|
93
95
|
watcher.on("all", async (event, path, stats) => {
|
|
94
96
|
if (!watchReloadEvents.has(event)) {
|
package/dist/cli/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { };
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { };
|
package/dist/cli/install.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { resolve } from 'pathe';
|
|
|
6
6
|
import { version } from 'silgi/meta';
|
|
7
7
|
import { c as commonArgs, p as prepare } from './prepare.mjs';
|
|
8
8
|
import { l as loadOptions } from './types.mjs';
|
|
9
|
+
import 'knitwork';
|
|
9
10
|
import 'silgi/kit';
|
|
10
11
|
import 'node:fs/promises';
|
|
11
12
|
import 'hookable';
|
package/dist/cli/prepare.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { defineCommand, runCommand } from 'citty';
|
|
2
2
|
import { join, resolve, relative, dirname, basename, extname, isAbsolute } from 'pathe';
|
|
3
3
|
import { peerDependencies, version } from 'silgi/meta';
|
|
4
|
-
import {
|
|
4
|
+
import { genObjectFromRawEntries, genObjectFromRaw, genObjectFromValues, genString } from 'knitwork';
|
|
5
|
+
import { writeFile, relativeWithDot, hash, resolveAlias, directoryToURL, addTemplate, hasError, parseServices, useSilgiRuntimeConfig, normalizeTemplate, useLogger, initRuntimeConfig, resolveSilgiPath, isDirectory } from 'silgi/kit';
|
|
5
6
|
import { existsSync, promises, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
6
7
|
import { readdir, readFile } from 'node:fs/promises';
|
|
7
8
|
import consola, { consola as consola$1 } from 'consola';
|
|
8
9
|
import { createHooks, createDebugger } from 'hookable';
|
|
9
|
-
import { useSilgiCLI, silgiCLICtx } from 'silgi/core';
|
|
10
|
+
import { useSilgiCLI, replaceRuntimeValues, silgiCLICtx } from 'silgi/core';
|
|
10
11
|
import { runtimeDir } from 'silgi/runtime/meta';
|
|
11
12
|
import { autoImportTypes } from 'silgi/types';
|
|
12
13
|
import { scanExports, createUnimport, toExports } from 'unimport';
|
|
@@ -31,61 +32,6 @@ import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
|
|
|
31
32
|
import { execSync } from 'node:child_process';
|
|
32
33
|
import color from 'picocolors';
|
|
33
34
|
|
|
34
|
-
function serializeRules(rules, options = {}) {
|
|
35
|
-
try {
|
|
36
|
-
const config = {
|
|
37
|
-
indent: 2,
|
|
38
|
-
functionIndent: 2,
|
|
39
|
-
// Daha tutarlı indentasyon için değiştirildi
|
|
40
|
-
...options
|
|
41
|
-
};
|
|
42
|
-
const uniqueId = Date.now().toString(36) + Math.random().toString(36).substring(2, 7);
|
|
43
|
-
const FUNCTION_MARKER = `__SILGI_FUNCTION_${uniqueId}_`;
|
|
44
|
-
const FUNCTION_MARKER_END = `_FUNCTION_END_${uniqueId}__`;
|
|
45
|
-
const safeStringify = (obj) => {
|
|
46
|
-
const cache = [];
|
|
47
|
-
const serialized2 = JSON.stringify(obj, (key, value) => {
|
|
48
|
-
if (typeof value === "function") {
|
|
49
|
-
return `${FUNCTION_MARKER}${value.toString()}${FUNCTION_MARKER_END}`;
|
|
50
|
-
}
|
|
51
|
-
if (typeof value === "object" && value !== null) {
|
|
52
|
-
if (cache.includes(value)) {
|
|
53
|
-
return "[Circular Reference]";
|
|
54
|
-
}
|
|
55
|
-
cache.push(value);
|
|
56
|
-
}
|
|
57
|
-
return value;
|
|
58
|
-
}, config.indent);
|
|
59
|
-
return serialized2;
|
|
60
|
-
};
|
|
61
|
-
const serialized = safeStringify(rules);
|
|
62
|
-
const getIndentLevel = (matchIndex) => {
|
|
63
|
-
const beforeMatch = serialized.substring(0, matchIndex);
|
|
64
|
-
const lastNewline = beforeMatch.lastIndexOf("\n");
|
|
65
|
-
if (lastNewline === -1)
|
|
66
|
-
return 0;
|
|
67
|
-
const lineStart = beforeMatch.substring(lastNewline + 1);
|
|
68
|
-
return lineStart.match(/^\s*/)?.[0].length ?? 0;
|
|
69
|
-
};
|
|
70
|
-
const result = serialized.replace(
|
|
71
|
-
new RegExp(`"${FUNCTION_MARKER}(.*?)${FUNCTION_MARKER_END}"`, "gs"),
|
|
72
|
-
(match, fnContent, offset) => {
|
|
73
|
-
const baseIndent = getIndentLevel(offset);
|
|
74
|
-
const functionBodyIndent = " ".repeat(baseIndent + config.functionIndent);
|
|
75
|
-
return fnContent.replace(/\\n/g, "\n").replace(/\\"/g, '"').replace(/\\\\/g, "\\").split("\n").map((line, i) => {
|
|
76
|
-
if (i === 0)
|
|
77
|
-
return line;
|
|
78
|
-
const trimmedLine = line.trimStart();
|
|
79
|
-
return trimmedLine ? `${functionBodyIndent}${trimmedLine}` : "";
|
|
80
|
-
}).filter(Boolean).join("\n");
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
return result;
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error("Error serializing rules:", error);
|
|
86
|
-
return JSON.stringify(rules, null, 2);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
35
|
async function prepareBuild(silgi) {
|
|
90
36
|
try {
|
|
91
37
|
if (!silgi?.routeRules?.exportRules) {
|
|
@@ -95,14 +41,20 @@ async function prepareBuild(silgi) {
|
|
|
95
41
|
if (!exportedRules || typeof exportedRules !== "object") {
|
|
96
42
|
throw new Error("No valid route rules to export");
|
|
97
43
|
}
|
|
98
|
-
const serialized = serializeRules(exportedRules);
|
|
99
44
|
const content = `/* eslint-disable */
|
|
100
45
|
// @ts-nocheck
|
|
101
46
|
// This file is auto-generated at build time by Silgi
|
|
102
47
|
// Contains route rules with preserved functions
|
|
103
48
|
// DO NOT MODIFY THIS FILE DIRECTLY
|
|
104
49
|
|
|
105
|
-
export const routeRules = ${
|
|
50
|
+
export const routeRules = ${genObjectFromRawEntries(
|
|
51
|
+
Object.entries(exportedRules).map(([key, value]) => {
|
|
52
|
+
if (typeof value === "function") {
|
|
53
|
+
return [key, genObjectFromRaw(value)];
|
|
54
|
+
}
|
|
55
|
+
return [key, genObjectFromValues(value)];
|
|
56
|
+
})
|
|
57
|
+
)}
|
|
106
58
|
`;
|
|
107
59
|
const serverDir = silgi.options.silgi.serverDir;
|
|
108
60
|
if (!serverDir) {
|
|
@@ -223,7 +175,7 @@ async function prepareEnv(silgiConfig) {
|
|
|
223
175
|
await setupDotenv({
|
|
224
176
|
cwd: silgiConfig.rootDir,
|
|
225
177
|
interpolate: true,
|
|
226
|
-
fileName: environment === "
|
|
178
|
+
fileName: environment === ".env" ? ".env" : `.env.${environment}`
|
|
227
179
|
});
|
|
228
180
|
}
|
|
229
181
|
}
|
|
@@ -1453,6 +1405,7 @@ async function writeScanFiles(silgi) {
|
|
|
1453
1405
|
|
|
1454
1406
|
async function createStorageCLI(silgi) {
|
|
1455
1407
|
const storage = createStorage();
|
|
1408
|
+
const runtime = useSilgiRuntimeConfig();
|
|
1456
1409
|
const mounts = klona({
|
|
1457
1410
|
...silgi.options.storage,
|
|
1458
1411
|
...silgi.options.devStorage
|
|
@@ -1460,7 +1413,8 @@ async function createStorageCLI(silgi) {
|
|
|
1460
1413
|
for (const [path, opts] of Object.entries(mounts)) {
|
|
1461
1414
|
if (opts.driver) {
|
|
1462
1415
|
const driver = await import(builtinDrivers[opts.driver] || opts.driver).then((r) => r.default || r);
|
|
1463
|
-
|
|
1416
|
+
const processedOpts = replaceRuntimeValues({ ...opts }, runtime);
|
|
1417
|
+
storage.mount(path, driver(processedOpts));
|
|
1464
1418
|
} else {
|
|
1465
1419
|
silgi.logger.warn(`No \`driver\` set for storage mount point "${path}".`);
|
|
1466
1420
|
}
|
|
@@ -1759,42 +1713,18 @@ async function createSilgiCLI(config = {}, opts = {}) {
|
|
|
1759
1713
|
return silgi;
|
|
1760
1714
|
}
|
|
1761
1715
|
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
return `'${obj.replace(/'/g, "\\'")}'`;
|
|
1775
|
-
}
|
|
1776
|
-
return String(obj);
|
|
1777
|
-
}
|
|
1778
|
-
if (Array.isArray(obj)) {
|
|
1779
|
-
if (obj.length === 0)
|
|
1780
|
-
return "[]";
|
|
1781
|
-
const items = obj.map((item) => serializeToJs(item, indent, level + 1)).join(`,
|
|
1782
|
-
${" ".repeat((level + 1) * indent)}`);
|
|
1783
|
-
return `[
|
|
1784
|
-
${" ".repeat((level + 1) * indent)}${items}
|
|
1785
|
-
${" ".repeat(level * indent)}]`;
|
|
1786
|
-
}
|
|
1787
|
-
const entries = Object.entries(obj);
|
|
1788
|
-
if (entries.length === 0)
|
|
1789
|
-
return "{}";
|
|
1790
|
-
const props = entries.map(([key, value]) => {
|
|
1791
|
-
const keyStr = /^[a-z_$][\w$]*$/i.test(key) ? key : `'${key}'`;
|
|
1792
|
-
return `${keyStr}: ${serializeToJs(value, indent, level + 1)}`;
|
|
1793
|
-
}).join(`,
|
|
1794
|
-
${" ".repeat((level + 1) * indent)}`);
|
|
1795
|
-
return `{
|
|
1796
|
-
${" ".repeat((level + 1) * indent)}${props}
|
|
1797
|
-
${" ".repeat(level * indent)}}`;
|
|
1716
|
+
const reservedCode = /* @__PURE__ */ new Set([
|
|
1717
|
+
"process",
|
|
1718
|
+
"global",
|
|
1719
|
+
"Buffer",
|
|
1720
|
+
"runtime",
|
|
1721
|
+
"runtimeConfig"
|
|
1722
|
+
]);
|
|
1723
|
+
function genEnsureSafeVar(name) {
|
|
1724
|
+
if (reservedCode.has(name)) {
|
|
1725
|
+
return name;
|
|
1726
|
+
}
|
|
1727
|
+
return genString(name);
|
|
1798
1728
|
}
|
|
1799
1729
|
async function prepareConfigs(silgi) {
|
|
1800
1730
|
const _data = {
|
|
@@ -1813,22 +1743,28 @@ async function prepareConfigs(silgi) {
|
|
|
1813
1743
|
}
|
|
1814
1744
|
}
|
|
1815
1745
|
await silgi.callHook("prepare:configs.ts", _data);
|
|
1816
|
-
const runtimeConfig = JSON.parse(JSON.stringify(_data.runtimeConfig || {}));
|
|
1817
|
-
delete _data.runtimeConfig;
|
|
1818
1746
|
const importData = [
|
|
1819
1747
|
"import type { SilgiRuntimeOptions, SilgiRuntimeConfig, SilgiOptions } from 'silgi/types'",
|
|
1820
1748
|
"import { useSilgiRuntimeConfig } from 'silgi/kit'",
|
|
1821
1749
|
"",
|
|
1822
|
-
`export const runtimeConfig: Partial<SilgiRuntimeConfig> = ${
|
|
1750
|
+
`export const runtimeConfig: Partial<SilgiRuntimeConfig> = ${genObjectFromRawEntries(
|
|
1751
|
+
Object.entries(_data.runtimeConfig).map(([key, value]) => [key, genEnsureSafeVar(value)]),
|
|
1752
|
+
""
|
|
1753
|
+
)}`,
|
|
1823
1754
|
"",
|
|
1824
1755
|
"const runtime = useSilgiRuntimeConfig(undefined, runtimeConfig)",
|
|
1825
|
-
"",
|
|
1826
|
-
"export const cliConfigs: Partial<SilgiRuntimeOptions & SilgiOptions> = {",
|
|
1827
|
-
" runtimeConfig: runtime,",
|
|
1828
|
-
` ${serializeToJs(_data).replace(/^\{/, "").replace(/\}$/, "")}`,
|
|
1829
|
-
"}",
|
|
1830
1756
|
""
|
|
1831
1757
|
];
|
|
1758
|
+
delete _data.runtimeConfig;
|
|
1759
|
+
importData.push(`export const cliConfigs: Partial<SilgiRuntimeOptions & SilgiOptions> = ${genObjectFromRawEntries(
|
|
1760
|
+
Object.entries(_data).map(
|
|
1761
|
+
([key, value]) => [key, genEnsureSafeVar(value)]
|
|
1762
|
+
).concat(
|
|
1763
|
+
[
|
|
1764
|
+
["runtimeConfig", "runtime"]
|
|
1765
|
+
]
|
|
1766
|
+
)
|
|
1767
|
+
)}`);
|
|
1832
1768
|
return importData;
|
|
1833
1769
|
}
|
|
1834
1770
|
|
|
@@ -2220,7 +2156,6 @@ async function prepareSchema(silgi) {
|
|
|
2220
2156
|
}
|
|
2221
2157
|
],
|
|
2222
2158
|
events: [],
|
|
2223
|
-
storeBase: [],
|
|
2224
2159
|
hooks: [],
|
|
2225
2160
|
runtimeHooks: [],
|
|
2226
2161
|
runtimeOptions: [],
|
|
@@ -2300,8 +2235,11 @@ async function prepareSchema(silgi) {
|
|
|
2300
2235
|
generateTypes(
|
|
2301
2236
|
await resolveSchema(
|
|
2302
2237
|
{
|
|
2303
|
-
...
|
|
2304
|
-
|
|
2238
|
+
...silgi.options.storages?.reduce((acc, key) => ({ ...acc, [key]: "" }), {}) || {},
|
|
2239
|
+
// 'redis': {} -> 'redis': string
|
|
2240
|
+
...Object.entries(silgi.options.storage).map(([key]) => ({
|
|
2241
|
+
[key]: ""
|
|
2242
|
+
})).reduce((acc, obj) => ({ ...acc, ...obj }), {})
|
|
2305
2243
|
}
|
|
2306
2244
|
),
|
|
2307
2245
|
{
|
|
@@ -2346,19 +2284,8 @@ async function prepareSchema(silgi) {
|
|
|
2346
2284
|
return importData;
|
|
2347
2285
|
}
|
|
2348
2286
|
|
|
2349
|
-
async function prepareStore(silgi) {
|
|
2350
|
-
silgi.hook("prepare:schema.ts", async (options) => {
|
|
2351
|
-
if (silgi.options.storage) {
|
|
2352
|
-
for (const [key, _value] of Object.entries(silgi.options.storage)) {
|
|
2353
|
-
options.storeBase.push(key);
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
});
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
2287
|
async function writeTypesAndFiles(silgi) {
|
|
2360
2288
|
const routerDTS = await generateRouterDTS(silgi);
|
|
2361
|
-
await prepareStore(silgi);
|
|
2362
2289
|
silgi.hook("prepare:types", (opts) => {
|
|
2363
2290
|
opts.references.push({ path: "./schema.d.ts" });
|
|
2364
2291
|
opts.references.push({ path: "./silgi-routes.d.ts" });
|
package/dist/core/index.d.mts
CHANGED
|
@@ -34,6 +34,11 @@ declare function createService<T extends SilgiSchema>(variables: ServiceType<T>)
|
|
|
34
34
|
|
|
35
35
|
declare function createShared(shared: Partial<SilgiRuntimeShareds>): SilgiRuntimeShareds;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Recursively replaces values starting with 'runtime.' with their actual values from runtime config
|
|
39
|
+
*/
|
|
40
|
+
declare function replaceRuntimeValues(obj: any, runtime: any): any;
|
|
41
|
+
|
|
37
42
|
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
38
43
|
declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base'] | (string & {})): Storage<T>;
|
|
39
44
|
|
|
@@ -259,4 +264,5 @@ declare function tryUseSilgiCLI(): SilgiCLI | null;
|
|
|
259
264
|
|
|
260
265
|
declare function storageMount<T extends Storage = Storage>(silgi?: Silgi): (base: keyof SilgiStorageBase, driver: Parameters<Storage['mount']>[1]) => T;
|
|
261
266
|
|
|
262
|
-
export {
|
|
267
|
+
export { ErrorCategory, ErrorFactory, ErrorSeverity, HttpStatus, SilgiError, createSchema, createService, createShared, createSilgi, createStorage, getEvent, getEventContext, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, replaceRuntimeValues, silgiCLICtx, silgiCtx, storageMount, tryUseSilgi, tryUseSilgiCLI, useSilgi, useSilgiCLI, useSilgiStorage };
|
|
268
|
+
export type { BaseError, ErrorMetadata };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ declare function createService<T extends SilgiSchema>(variables: ServiceType<T>)
|
|
|
34
34
|
|
|
35
35
|
declare function createShared(shared: Partial<SilgiRuntimeShareds>): SilgiRuntimeShareds;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Recursively replaces values starting with 'runtime.' with their actual values from runtime config
|
|
39
|
+
*/
|
|
40
|
+
declare function replaceRuntimeValues(obj: any, runtime: any): any;
|
|
41
|
+
|
|
37
42
|
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
38
43
|
declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base'] | (string & {})): Storage<T>;
|
|
39
44
|
|
|
@@ -259,4 +264,5 @@ declare function tryUseSilgiCLI(): SilgiCLI | null;
|
|
|
259
264
|
|
|
260
265
|
declare function storageMount<T extends Storage = Storage>(silgi?: Silgi): (base: keyof SilgiStorageBase, driver: Parameters<Storage['mount']>[1]) => T;
|
|
261
266
|
|
|
262
|
-
export {
|
|
267
|
+
export { ErrorCategory, ErrorFactory, ErrorSeverity, HttpStatus, SilgiError, createSchema, createService, createShared, createSilgi, createStorage, getEvent, getEventContext, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, replaceRuntimeValues, silgiCLICtx, silgiCtx, storageMount, tryUseSilgi, tryUseSilgiCLI, useSilgi, useSilgiCLI, useSilgiStorage };
|
|
268
|
+
export type { BaseError, ErrorMetadata };
|
package/dist/core/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ export { a as silgiCLICtx, t as tryUseSilgiCLI, u as useSilgiCLI } from '../_chu
|
|
|
6
6
|
import { getContext } from 'unctx';
|
|
7
7
|
import { Buffer } from 'node:buffer';
|
|
8
8
|
import { klona } from 'klona';
|
|
9
|
+
import { useSilgiRuntimeConfig } from 'silgi/kit';
|
|
9
10
|
import { createStorage as createStorage$1, builtinDrivers, prefixStorage } from 'unstorage';
|
|
10
11
|
import 'ufo';
|
|
11
12
|
|
|
@@ -416,8 +417,30 @@ async function scanAction(silgi) {
|
|
|
416
417
|
}
|
|
417
418
|
}
|
|
418
419
|
|
|
420
|
+
function replaceRuntimeValues(obj, runtime) {
|
|
421
|
+
if (!obj || typeof obj !== "object")
|
|
422
|
+
return obj;
|
|
423
|
+
for (const key in obj) {
|
|
424
|
+
if (typeof obj[key] === "string" && obj[key].startsWith("runtime.")) {
|
|
425
|
+
const runtimePath = obj[key].substring(8).split(".");
|
|
426
|
+
let value = runtime;
|
|
427
|
+
for (const segment of runtimePath) {
|
|
428
|
+
if (value === void 0 || value === null)
|
|
429
|
+
break;
|
|
430
|
+
value = value[segment];
|
|
431
|
+
}
|
|
432
|
+
if (value !== void 0)
|
|
433
|
+
obj[key] = value;
|
|
434
|
+
} else if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
435
|
+
obj[key] = replaceRuntimeValues(obj[key], runtime);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return obj;
|
|
439
|
+
}
|
|
440
|
+
|
|
419
441
|
async function createStorage(silgi) {
|
|
420
442
|
const storage = createStorage$1();
|
|
443
|
+
const runtime = useSilgiRuntimeConfig();
|
|
421
444
|
const mounts = klona({
|
|
422
445
|
...silgi.options.storage,
|
|
423
446
|
...silgi.options.devStorage
|
|
@@ -425,7 +448,8 @@ async function createStorage(silgi) {
|
|
|
425
448
|
for (const [path, opts] of Object.entries(mounts)) {
|
|
426
449
|
if (opts.driver) {
|
|
427
450
|
const driver = await import(builtinDrivers[opts.driver] || opts.driver).then((r) => r.default || r);
|
|
428
|
-
|
|
451
|
+
const processedOpts = replaceRuntimeValues({ ...opts }, runtime);
|
|
452
|
+
storage.mount(path, driver(processedOpts));
|
|
429
453
|
} else {
|
|
430
454
|
silgi.logger.warn(`No \`driver\` set for storage mount point "${path}".`);
|
|
431
455
|
}
|
|
@@ -729,4 +753,4 @@ function storageMount(silgi) {
|
|
|
729
753
|
};
|
|
730
754
|
}
|
|
731
755
|
|
|
732
|
-
export { ErrorCategory, ErrorFactory, ErrorSeverity, HttpStatus, SilgiError, createSchema, createService, createShared, createSilgi, createStorage, getEvent, getEventContext, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, silgi, silgiCtx, storageMount, tryUseSilgi, useSilgi, useSilgiStorage };
|
|
756
|
+
export { ErrorCategory, ErrorFactory, ErrorSeverity, HttpStatus, SilgiError, createSchema, createService, createShared, createSilgi, createStorage, getEvent, getEventContext, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, replaceRuntimeValues, silgi, silgiCtx, storageMount, tryUseSilgi, useSilgi, useSilgiStorage };
|
package/dist/meta/index.d.mts
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
declare let version: string;
|
|
2
|
+
declare let peerDependencies: {
|
|
3
|
+
"@fastify/deepmerge": string;
|
|
4
|
+
"@nuxt/kit": string;
|
|
5
|
+
"@nuxt/schema": string;
|
|
6
|
+
"@silgi/ecosystem": string;
|
|
7
|
+
h3: string;
|
|
8
|
+
nitropack: string;
|
|
9
|
+
nuxt: string;
|
|
10
|
+
typescript: string;
|
|
11
|
+
vue: string;
|
|
12
|
+
zod: string;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
14
|
+
declare let dependencies: {
|
|
15
|
+
"@clack/prompts": string;
|
|
16
|
+
"@fastify/deepmerge": string;
|
|
17
|
+
"@oxc-parser/wasm": string;
|
|
18
|
+
"@standard-schema/spec": string;
|
|
19
|
+
c12: string;
|
|
20
|
+
chokidar: string;
|
|
21
|
+
citty: string;
|
|
22
|
+
compatx: string;
|
|
23
|
+
consola: string;
|
|
24
|
+
defu: string;
|
|
25
|
+
destr: string;
|
|
26
|
+
"dev-jiti": string;
|
|
27
|
+
"dot-prop": string;
|
|
28
|
+
dotenv: string;
|
|
29
|
+
"escape-string-regexp": string;
|
|
30
|
+
exsolve: string;
|
|
31
|
+
globby: string;
|
|
32
|
+
hookable: string;
|
|
33
|
+
ignore: string;
|
|
34
|
+
klona: string;
|
|
35
|
+
knitwork: string;
|
|
36
|
+
mlly: string;
|
|
37
|
+
ofetch: string;
|
|
38
|
+
ohash: string;
|
|
39
|
+
pathe: string;
|
|
40
|
+
picocolors: string;
|
|
41
|
+
"pkg-types": string;
|
|
42
|
+
scule: string;
|
|
43
|
+
semver: string;
|
|
44
|
+
"std-env": string;
|
|
45
|
+
ufo: string;
|
|
46
|
+
unctx: string;
|
|
47
|
+
unimport: string;
|
|
48
|
+
unstorage: string;
|
|
49
|
+
untyped: string;
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
declare let devDependencies: {
|
|
52
|
+
"@antfu/eslint-config": string;
|
|
53
|
+
"@nuxt/kit": string;
|
|
54
|
+
"@nuxt/schema": string;
|
|
55
|
+
"@silgi/ecosystem": string;
|
|
56
|
+
"@types/node": string;
|
|
57
|
+
"@types/semver": string;
|
|
58
|
+
"@vitest/coverage-v8": string;
|
|
59
|
+
eslint: string;
|
|
60
|
+
h3: string;
|
|
61
|
+
nitropack: string;
|
|
62
|
+
nuxt: string;
|
|
63
|
+
typescript: string;
|
|
64
|
+
unbuild: string;
|
|
65
|
+
vitest: string;
|
|
66
|
+
vue: string;
|
|
67
|
+
zod: string;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export { dependencies, devDependencies, peerDependencies, version };
|
package/dist/meta/index.d.ts
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
declare let version: string;
|
|
2
|
+
declare let peerDependencies: {
|
|
3
|
+
"@fastify/deepmerge": string;
|
|
4
|
+
"@nuxt/kit": string;
|
|
5
|
+
"@nuxt/schema": string;
|
|
6
|
+
"@silgi/ecosystem": string;
|
|
7
|
+
h3: string;
|
|
8
|
+
nitropack: string;
|
|
9
|
+
nuxt: string;
|
|
10
|
+
typescript: string;
|
|
11
|
+
vue: string;
|
|
12
|
+
zod: string;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
14
|
+
declare let dependencies: {
|
|
15
|
+
"@clack/prompts": string;
|
|
16
|
+
"@fastify/deepmerge": string;
|
|
17
|
+
"@oxc-parser/wasm": string;
|
|
18
|
+
"@standard-schema/spec": string;
|
|
19
|
+
c12: string;
|
|
20
|
+
chokidar: string;
|
|
21
|
+
citty: string;
|
|
22
|
+
compatx: string;
|
|
23
|
+
consola: string;
|
|
24
|
+
defu: string;
|
|
25
|
+
destr: string;
|
|
26
|
+
"dev-jiti": string;
|
|
27
|
+
"dot-prop": string;
|
|
28
|
+
dotenv: string;
|
|
29
|
+
"escape-string-regexp": string;
|
|
30
|
+
exsolve: string;
|
|
31
|
+
globby: string;
|
|
32
|
+
hookable: string;
|
|
33
|
+
ignore: string;
|
|
34
|
+
klona: string;
|
|
35
|
+
knitwork: string;
|
|
36
|
+
mlly: string;
|
|
37
|
+
ofetch: string;
|
|
38
|
+
ohash: string;
|
|
39
|
+
pathe: string;
|
|
40
|
+
picocolors: string;
|
|
41
|
+
"pkg-types": string;
|
|
42
|
+
scule: string;
|
|
43
|
+
semver: string;
|
|
44
|
+
"std-env": string;
|
|
45
|
+
ufo: string;
|
|
46
|
+
unctx: string;
|
|
47
|
+
unimport: string;
|
|
48
|
+
unstorage: string;
|
|
49
|
+
untyped: string;
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
declare let devDependencies: {
|
|
52
|
+
"@antfu/eslint-config": string;
|
|
53
|
+
"@nuxt/kit": string;
|
|
54
|
+
"@nuxt/schema": string;
|
|
55
|
+
"@silgi/ecosystem": string;
|
|
56
|
+
"@types/node": string;
|
|
57
|
+
"@types/semver": string;
|
|
58
|
+
"@vitest/coverage-v8": string;
|
|
59
|
+
eslint: string;
|
|
60
|
+
h3: string;
|
|
61
|
+
nitropack: string;
|
|
62
|
+
nuxt: string;
|
|
63
|
+
typescript: string;
|
|
64
|
+
unbuild: string;
|
|
65
|
+
vitest: string;
|
|
66
|
+
vue: string;
|
|
67
|
+
zod: string;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export { dependencies, devDependencies, peerDependencies, version };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -241,7 +241,6 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
241
241
|
extends?: boolean;
|
|
242
242
|
isSilgiContext?: boolean;
|
|
243
243
|
}[];
|
|
244
|
-
storeBase: string[];
|
|
245
244
|
hooks: {
|
|
246
245
|
key: string;
|
|
247
246
|
value: string;
|
|
@@ -1134,4 +1133,5 @@ interface ServiceParseModule {
|
|
|
1134
1133
|
|
|
1135
1134
|
declare const autoImportTypes: string[];
|
|
1136
1135
|
|
|
1137
|
-
export {
|
|
1136
|
+
export { autoImportTypes };
|
|
1137
|
+
export type { AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, CaptureError, CapturedErrorContext, CommandType, CreateScope, DeepPartial, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenerateAppOptions, GraphQLJSON, HookResult, ImportItem, LoadConfigOptions, MergedSilgiSchema, MethodHandlerType, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, Namespaces, NitroBuildInfo, PrepareCore, RequiredServiceType, ResolvedMethodHandlerType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedServiceType, ResolvedSilgiTemplate, RouteRules, ScanFile, ServiceParse, ServiceParseModule, ServiceType, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvents, SilgiFrameworkInfo, SilgiFunction, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOperation, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRouteRules, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeRouteRules, SilgiRuntimeRouteRulesConfig, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiServiceInterface, SilgiStorageBase, SilgiTemplate, SilgiURIs, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, URIsTypes };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -241,7 +241,6 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
241
241
|
extends?: boolean;
|
|
242
242
|
isSilgiContext?: boolean;
|
|
243
243
|
}[];
|
|
244
|
-
storeBase: string[];
|
|
245
244
|
hooks: {
|
|
246
245
|
key: string;
|
|
247
246
|
value: string;
|
|
@@ -1134,4 +1133,5 @@ interface ServiceParseModule {
|
|
|
1134
1133
|
|
|
1135
1134
|
declare const autoImportTypes: string[];
|
|
1136
1135
|
|
|
1137
|
-
export {
|
|
1136
|
+
export { autoImportTypes };
|
|
1137
|
+
export type { AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, CaptureError, CapturedErrorContext, CommandType, CreateScope, DeepPartial, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenerateAppOptions, GraphQLJSON, HookResult, ImportItem, LoadConfigOptions, MergedSilgiSchema, MethodHandlerType, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, Namespaces, NitroBuildInfo, PrepareCore, RequiredServiceType, ResolvedMethodHandlerType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedServiceType, ResolvedSilgiTemplate, RouteRules, ScanFile, ServiceParse, ServiceParseModule, ServiceType, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvents, SilgiFrameworkInfo, SilgiFunction, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOperation, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRouteRules, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeRouteRules, SilgiRuntimeRouteRulesConfig, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiServiceInterface, SilgiStorageBase, SilgiTemplate, SilgiURIs, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, URIsTypes };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silgi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
@@ -113,13 +113,13 @@
|
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@clack/prompts": "^0.10.0",
|
|
115
115
|
"@fastify/deepmerge": "^3.0.0",
|
|
116
|
-
"@oxc-parser/wasm": "^0.
|
|
116
|
+
"@oxc-parser/wasm": "^0.60.0",
|
|
117
117
|
"@standard-schema/spec": "^1.0.0",
|
|
118
118
|
"c12": "^3.0.2",
|
|
119
119
|
"chokidar": "^4.0.3",
|
|
120
120
|
"citty": "^0.1.6",
|
|
121
121
|
"compatx": "^0.1.8",
|
|
122
|
-
"consola": "^3.4.
|
|
122
|
+
"consola": "^3.4.2",
|
|
123
123
|
"defu": "^6.1.4",
|
|
124
124
|
"destr": "^2.0.3",
|
|
125
125
|
"dev-jiti": "^2.4.2",
|
|
@@ -148,20 +148,20 @@
|
|
|
148
148
|
"untyped": "^2.0.0"
|
|
149
149
|
},
|
|
150
150
|
"devDependencies": {
|
|
151
|
-
"@antfu/eslint-config": "^4.
|
|
152
|
-
"@nuxt/kit": "^3.16.
|
|
153
|
-
"@nuxt/schema": "^3.16.
|
|
154
|
-
"@silgi/ecosystem": "^0.
|
|
155
|
-
"@types/node": "^22.13.
|
|
151
|
+
"@antfu/eslint-config": "^4.10.2",
|
|
152
|
+
"@nuxt/kit": "^3.16.1",
|
|
153
|
+
"@nuxt/schema": "^3.16.1",
|
|
154
|
+
"@silgi/ecosystem": "^0.3.0",
|
|
155
|
+
"@types/node": "^22.13.11",
|
|
156
156
|
"@types/semver": "^7.5.8",
|
|
157
157
|
"@vitest/coverage-v8": "3.0.5",
|
|
158
|
-
"eslint": "^9.
|
|
158
|
+
"eslint": "^9.23.0",
|
|
159
159
|
"h3": "^1.15.1",
|
|
160
|
-
"nitropack": "^2.11.
|
|
161
|
-
"nuxt": "^3.16.
|
|
160
|
+
"nitropack": "^2.11.7",
|
|
161
|
+
"nuxt": "^3.16.1",
|
|
162
162
|
"typescript": "^5.8.2",
|
|
163
163
|
"unbuild": "^3.5.0",
|
|
164
|
-
"vitest": "^3.0.
|
|
164
|
+
"vitest": "^3.0.9",
|
|
165
165
|
"vue": "^3.5.13",
|
|
166
166
|
"zod": "^3.24.2"
|
|
167
167
|
},
|