silgi 0.37.25 → 0.37.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/build.mjs +7 -20
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/types.mjs +1 -4
- package/dist/core/index.mjs +2 -2
- package/dist/index.mjs +1 -1
- package/dist/types/index.d.mts +4 -5
- package/package.json +1 -1
package/dist/cli/build.mjs
CHANGED
|
@@ -303,23 +303,6 @@ async function nitroFramework(silgi, skip = false) {
|
|
|
303
303
|
packageImport: "silgi/runtime/internal/nitro",
|
|
304
304
|
path: join(runtimeDir, "internal/nitro")
|
|
305
305
|
});
|
|
306
|
-
silgi.hook("prepare:types", (opts) => {
|
|
307
|
-
addTemplate({
|
|
308
|
-
filename: "types/nitro.d.ts",
|
|
309
|
-
where: ".silgi",
|
|
310
|
-
getContents: () => {
|
|
311
|
-
return [
|
|
312
|
-
"import type { NitroRuntimeConfig } from 'nitropack/types'",
|
|
313
|
-
"",
|
|
314
|
-
'declare module "silgi/types" {',
|
|
315
|
-
" interface SilgiRuntimeConfig extends NitroRuntimeConfig {}",
|
|
316
|
-
"}",
|
|
317
|
-
""
|
|
318
|
-
].join("\n");
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
opts.references.push({ path: "./nitro.d.ts" });
|
|
322
|
-
});
|
|
323
306
|
if (silgi.options.imports !== false) {
|
|
324
307
|
silgi.options.imports.presets ??= [];
|
|
325
308
|
}
|
|
@@ -1454,8 +1437,12 @@ async function createSilgiCLI(config = {}, opts = {}) {
|
|
|
1454
1437
|
adapters: {}
|
|
1455
1438
|
};
|
|
1456
1439
|
updateRuntimeStorage(silgi.options.runtimeConfig);
|
|
1457
|
-
|
|
1458
|
-
|
|
1440
|
+
let adapters = silgi.options.adapters;
|
|
1441
|
+
if (typeof adapters === "function") {
|
|
1442
|
+
adapters = await adapters();
|
|
1443
|
+
}
|
|
1444
|
+
if (adapters && typeof adapters === "object" && Object.keys(adapters)?.length > 0) {
|
|
1445
|
+
for (const [key, value] of Object.entries(adapters)) {
|
|
1459
1446
|
silgi.adapters[key] = value;
|
|
1460
1447
|
}
|
|
1461
1448
|
}
|
|
@@ -1636,7 +1623,7 @@ async function prepareConfigs(silgi) {
|
|
|
1636
1623
|
"import type { SilgiRuntimeOptions, SilgiRuntimeConfig, SilgiOptions } from 'silgi/types'",
|
|
1637
1624
|
"import { useSilgiRuntimeConfig } from 'silgi/runtime'",
|
|
1638
1625
|
"",
|
|
1639
|
-
`export const runtimeConfig:
|
|
1626
|
+
`export const runtimeConfig: SilgiRuntimeConfig = ${genObjectFromRawEntries(
|
|
1640
1627
|
Object.entries(_data.runtimeConfig).map(([key, value]) => [key, genEnsureSafeVar(value)]),
|
|
1641
1628
|
""
|
|
1642
1629
|
)}`,
|
package/dist/cli/index.mjs
CHANGED
package/dist/cli/types.mjs
CHANGED
|
@@ -20,15 +20,12 @@ const SilgiCLIDefaults = {
|
|
|
20
20
|
schemaVendor: "zod",
|
|
21
21
|
// timing: isDebug,
|
|
22
22
|
logLevel: isTest ? 1 : 3,
|
|
23
|
-
// runtimeConfig: { app: {}, silgi: {} },
|
|
24
23
|
appConfig: {},
|
|
25
24
|
appConfigFiles: [],
|
|
26
25
|
commandType: "prepare",
|
|
27
26
|
commands: [],
|
|
28
27
|
runtimeConfig: {
|
|
29
|
-
silgi: {
|
|
30
|
-
version: "0.0.1"
|
|
31
|
-
}
|
|
28
|
+
silgi: {}
|
|
32
29
|
},
|
|
33
30
|
storages: [],
|
|
34
31
|
devServer: {
|
package/dist/core/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { createConsola } from 'consola';
|
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
import { createHooks } from 'hookable';
|
|
4
4
|
import { createRouter, addRoute, findRoute } from 'rou3';
|
|
5
|
+
import { useSilgiRuntimeConfig } from 'silgi/runtime';
|
|
5
6
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
7
|
import { createContext, getContext } from 'unctx';
|
|
7
8
|
import { Buffer } from 'node:buffer';
|
|
8
9
|
import { klona } from 'klona';
|
|
9
|
-
import { useSilgiRuntimeConfig } from 'silgi/runtime';
|
|
10
10
|
import { createStorage as createStorage$1, builtinDrivers, prefixStorage } from 'unstorage';
|
|
11
11
|
import { FastURL, FastResponse } from 'srvx';
|
|
12
12
|
export { s as silgiCLICtx, t as tryUseSilgiCLI, u as useSilgiCLI } from '../_chunks/silgiApp.mjs';
|
|
@@ -346,7 +346,7 @@ async function createSilgi(config) {
|
|
|
346
346
|
silgi.shared.storage = (...data) => {
|
|
347
347
|
return useSilgiStorage(...data);
|
|
348
348
|
};
|
|
349
|
-
silgi.shared.
|
|
349
|
+
silgi.shared.useRuntimeConfig = useSilgiRuntimeConfig;
|
|
350
350
|
if (silgiCtx.tryUse()) {
|
|
351
351
|
silgiCtx.unset();
|
|
352
352
|
silgiCtx.set(silgi);
|
package/dist/index.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import 'consola';
|
|
|
4
4
|
import 'defu';
|
|
5
5
|
import 'hookable';
|
|
6
6
|
import 'rou3';
|
|
7
|
+
import 'silgi/runtime';
|
|
7
8
|
import 'node:async_hooks';
|
|
8
9
|
import 'unctx';
|
|
9
10
|
import 'node:buffer';
|
|
10
11
|
import 'klona';
|
|
11
|
-
import 'silgi/runtime';
|
|
12
12
|
import 'unstorage';
|
|
13
13
|
import 'srvx';
|
package/dist/types/index.d.mts
CHANGED
|
@@ -26,6 +26,7 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
|
26
26
|
import { NitroApp } from 'nitropack';
|
|
27
27
|
import { RouterContext } from 'rou3';
|
|
28
28
|
import { silgiFetch } from 'silgi';
|
|
29
|
+
import { useSilgiRuntimeConfig } from 'silgi/runtime';
|
|
29
30
|
import { ProviderName } from 'std-env';
|
|
30
31
|
import { FetchOptions, FetchResponse } from 'ofetch';
|
|
31
32
|
|
|
@@ -591,7 +592,7 @@ interface StorageKeyParams<TInput = unknown> {
|
|
|
591
592
|
|
|
592
593
|
interface SilgiRuntimeShareds extends SilgiRuntimeSharedsExtend {
|
|
593
594
|
storage: <T extends StorageValue = StorageValue>(base: StorageConfig<T>['base']) => Storage<T>;
|
|
594
|
-
|
|
595
|
+
useRuntimeConfig: typeof useSilgiRuntimeConfig;
|
|
595
596
|
$fetch: typeof silgiFetch;
|
|
596
597
|
silgi: Silgi;
|
|
597
598
|
}
|
|
@@ -933,9 +934,7 @@ interface SilgiCLIOptions extends PresetOptions {
|
|
|
933
934
|
environments: DotenvOptions$1[];
|
|
934
935
|
activeEnvironment: 'prod' | 'docker' | 'staging' | 'testing' | '.env' | (string & {});
|
|
935
936
|
envOptions: EnvOptions$1;
|
|
936
|
-
runtimeConfig: SilgiRuntimeConfig$1
|
|
937
|
-
[key: string]: any;
|
|
938
|
-
};
|
|
937
|
+
runtimeConfig: SilgiRuntimeConfig$1;
|
|
939
938
|
storages: string[];
|
|
940
939
|
hooks: NestedHooks<SilgiCLIHooks$1>;
|
|
941
940
|
plugins: {
|
|
@@ -1152,7 +1151,7 @@ interface SilgiCLIOptions extends PresetOptions {
|
|
|
1152
1151
|
ignoreOptions: Options;
|
|
1153
1152
|
installPackages: Record<'dependencies' | 'devDependencies', Record<string, string>>;
|
|
1154
1153
|
apiFul: ApifulConfig;
|
|
1155
|
-
adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema
|
|
1154
|
+
adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>> | (() => Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>) | (() => Promise<Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>>);
|
|
1156
1155
|
}
|
|
1157
1156
|
/**
|
|
1158
1157
|
* Silgi input config (silgi.config)
|