silgi 0.22.2 → 0.23.1
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 +1 -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 +49 -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 +3 -2
- package/dist/types/index.d.ts +3 -2
- package/package.json +12 -12
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/dev.mjs
CHANGED
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
|
}
|
|
@@ -1550,6 +1504,9 @@ async function generateApp(app, options = {}) {
|
|
|
1550
1504
|
}
|
|
1551
1505
|
if (template.modified && template.write) {
|
|
1552
1506
|
dirs.add(dirname(fullPath));
|
|
1507
|
+
if (template.skipIfExists && existsSync(fullPath)) {
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1553
1510
|
writes.push(() => writeFileSync(fullPath, contents, "utf8"));
|
|
1554
1511
|
}
|
|
1555
1512
|
}
|
|
@@ -1759,42 +1716,18 @@ async function createSilgiCLI(config = {}, opts = {}) {
|
|
|
1759
1716
|
return silgi;
|
|
1760
1717
|
}
|
|
1761
1718
|
|
|
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)}}`;
|
|
1719
|
+
const reservedCode = /* @__PURE__ */ new Set([
|
|
1720
|
+
"process",
|
|
1721
|
+
"global",
|
|
1722
|
+
"Buffer",
|
|
1723
|
+
"runtime",
|
|
1724
|
+
"runtimeConfig"
|
|
1725
|
+
]);
|
|
1726
|
+
function genEnsureSafeVar(name) {
|
|
1727
|
+
if (reservedCode.has(name)) {
|
|
1728
|
+
return name;
|
|
1729
|
+
}
|
|
1730
|
+
return genString(name);
|
|
1798
1731
|
}
|
|
1799
1732
|
async function prepareConfigs(silgi) {
|
|
1800
1733
|
const _data = {
|
|
@@ -1813,22 +1746,28 @@ async function prepareConfigs(silgi) {
|
|
|
1813
1746
|
}
|
|
1814
1747
|
}
|
|
1815
1748
|
await silgi.callHook("prepare:configs.ts", _data);
|
|
1816
|
-
const runtimeConfig = JSON.parse(JSON.stringify(_data.runtimeConfig || {}));
|
|
1817
|
-
delete _data.runtimeConfig;
|
|
1818
1749
|
const importData = [
|
|
1819
1750
|
"import type { SilgiRuntimeOptions, SilgiRuntimeConfig, SilgiOptions } from 'silgi/types'",
|
|
1820
1751
|
"import { useSilgiRuntimeConfig } from 'silgi/kit'",
|
|
1821
1752
|
"",
|
|
1822
|
-
`export const runtimeConfig: Partial<SilgiRuntimeConfig> = ${
|
|
1753
|
+
`export const runtimeConfig: Partial<SilgiRuntimeConfig> = ${genObjectFromRawEntries(
|
|
1754
|
+
Object.entries(_data.runtimeConfig).map(([key, value]) => [key, genEnsureSafeVar(value)]),
|
|
1755
|
+
""
|
|
1756
|
+
)}`,
|
|
1823
1757
|
"",
|
|
1824
1758
|
"const runtime = useSilgiRuntimeConfig(undefined, runtimeConfig)",
|
|
1825
|
-
"",
|
|
1826
|
-
"export const cliConfigs: Partial<SilgiRuntimeOptions & SilgiOptions> = {",
|
|
1827
|
-
" runtimeConfig: runtime,",
|
|
1828
|
-
` ${serializeToJs(_data).replace(/^\{/, "").replace(/\}$/, "")}`,
|
|
1829
|
-
"}",
|
|
1830
1759
|
""
|
|
1831
1760
|
];
|
|
1761
|
+
delete _data.runtimeConfig;
|
|
1762
|
+
importData.push(`export const cliConfigs: Partial<SilgiRuntimeOptions & SilgiOptions> = ${genObjectFromRawEntries(
|
|
1763
|
+
Object.entries(_data).map(
|
|
1764
|
+
([key, value]) => [key, genEnsureSafeVar(value)]
|
|
1765
|
+
).concat(
|
|
1766
|
+
[
|
|
1767
|
+
["runtimeConfig", "runtime"]
|
|
1768
|
+
]
|
|
1769
|
+
)
|
|
1770
|
+
)}`);
|
|
1832
1771
|
return importData;
|
|
1833
1772
|
}
|
|
1834
1773
|
|
|
@@ -2220,7 +2159,6 @@ async function prepareSchema(silgi) {
|
|
|
2220
2159
|
}
|
|
2221
2160
|
],
|
|
2222
2161
|
events: [],
|
|
2223
|
-
storeBase: [],
|
|
2224
2162
|
hooks: [],
|
|
2225
2163
|
runtimeHooks: [],
|
|
2226
2164
|
runtimeOptions: [],
|
|
@@ -2300,8 +2238,11 @@ async function prepareSchema(silgi) {
|
|
|
2300
2238
|
generateTypes(
|
|
2301
2239
|
await resolveSchema(
|
|
2302
2240
|
{
|
|
2303
|
-
...
|
|
2304
|
-
|
|
2241
|
+
...silgi.options.storages?.reduce((acc, key) => ({ ...acc, [key]: "" }), {}) || {},
|
|
2242
|
+
// 'redis': {} -> 'redis': string
|
|
2243
|
+
...Object.entries(silgi.options.storage).map(([key]) => ({
|
|
2244
|
+
[key]: ""
|
|
2245
|
+
})).reduce((acc, obj) => ({ ...acc, ...obj }), {})
|
|
2305
2246
|
}
|
|
2306
2247
|
),
|
|
2307
2248
|
{
|
|
@@ -2346,19 +2287,8 @@ async function prepareSchema(silgi) {
|
|
|
2346
2287
|
return importData;
|
|
2347
2288
|
}
|
|
2348
2289
|
|
|
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
2290
|
async function writeTypesAndFiles(silgi) {
|
|
2360
2291
|
const routerDTS = await generateRouterDTS(silgi);
|
|
2361
|
-
await prepareStore(silgi);
|
|
2362
2292
|
silgi.hook("prepare:types", (opts) => {
|
|
2363
2293
|
opts.references.push({ path: "./schema.d.ts" });
|
|
2364
2294
|
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
|
@@ -143,6 +143,7 @@ interface SilgiTemplate<Options = TemplateDefaultOptions> {
|
|
|
143
143
|
}) => string | Promise<string>;
|
|
144
144
|
/** Write to filesystem */
|
|
145
145
|
write?: boolean;
|
|
146
|
+
skipIfExists?: boolean;
|
|
146
147
|
}
|
|
147
148
|
interface ResolvedSilgiTemplate<Options = TemplateDefaultOptions> extends SilgiTemplate<Options> {
|
|
148
149
|
filename: string;
|
|
@@ -241,7 +242,6 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
241
242
|
extends?: boolean;
|
|
242
243
|
isSilgiContext?: boolean;
|
|
243
244
|
}[];
|
|
244
|
-
storeBase: string[];
|
|
245
245
|
hooks: {
|
|
246
246
|
key: string;
|
|
247
247
|
value: string;
|
|
@@ -1134,4 +1134,5 @@ interface ServiceParseModule {
|
|
|
1134
1134
|
|
|
1135
1135
|
declare const autoImportTypes: string[];
|
|
1136
1136
|
|
|
1137
|
-
export {
|
|
1137
|
+
export { autoImportTypes };
|
|
1138
|
+
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
|
@@ -143,6 +143,7 @@ interface SilgiTemplate<Options = TemplateDefaultOptions> {
|
|
|
143
143
|
}) => string | Promise<string>;
|
|
144
144
|
/** Write to filesystem */
|
|
145
145
|
write?: boolean;
|
|
146
|
+
skipIfExists?: boolean;
|
|
146
147
|
}
|
|
147
148
|
interface ResolvedSilgiTemplate<Options = TemplateDefaultOptions> extends SilgiTemplate<Options> {
|
|
148
149
|
filename: string;
|
|
@@ -241,7 +242,6 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
241
242
|
extends?: boolean;
|
|
242
243
|
isSilgiContext?: boolean;
|
|
243
244
|
}[];
|
|
244
|
-
storeBase: string[];
|
|
245
245
|
hooks: {
|
|
246
246
|
key: string;
|
|
247
247
|
value: string;
|
|
@@ -1134,4 +1134,5 @@ interface ServiceParseModule {
|
|
|
1134
1134
|
|
|
1135
1135
|
declare const autoImportTypes: string[];
|
|
1136
1136
|
|
|
1137
|
-
export {
|
|
1137
|
+
export { autoImportTypes };
|
|
1138
|
+
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.1",
|
|
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
|
},
|