silgi 0.37.24 → 0.37.27
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 +2 -23
- 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/runtime/internal/config.d.mts +1 -1
- package/dist/runtime/internal/config.mjs +4 -1
- package/dist/types/index.d.mts +3 -4
- 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
|
}
|
|
@@ -1636,22 +1619,18 @@ async function prepareConfigs(silgi) {
|
|
|
1636
1619
|
"import type { SilgiRuntimeOptions, SilgiRuntimeConfig, SilgiOptions } from 'silgi/types'",
|
|
1637
1620
|
"import { useSilgiRuntimeConfig } from 'silgi/runtime'",
|
|
1638
1621
|
"",
|
|
1639
|
-
`export const runtimeConfig:
|
|
1622
|
+
`export const runtimeConfig: SilgiRuntimeConfig = ${genObjectFromRawEntries(
|
|
1640
1623
|
Object.entries(_data.runtimeConfig).map(([key, value]) => [key, genEnsureSafeVar(value)]),
|
|
1641
1624
|
""
|
|
1642
1625
|
)}`,
|
|
1643
1626
|
"",
|
|
1644
|
-
"const
|
|
1627
|
+
"export const localRuntimeConfig = useSilgiRuntimeConfig(undefined, runtimeConfig)",
|
|
1645
1628
|
""
|
|
1646
1629
|
];
|
|
1647
1630
|
delete _data.runtimeConfig;
|
|
1648
1631
|
importData.push(`export const cliConfigs: Partial<SilgiRuntimeOptions & SilgiOptions> = ${genObjectFromRawEntries(
|
|
1649
1632
|
Object.entries(_data).map(
|
|
1650
1633
|
([key, value]) => [key, genEnsureSafeVar(value)]
|
|
1651
|
-
).concat(
|
|
1652
|
-
[
|
|
1653
|
-
["runtimeConfig", "runtime"]
|
|
1654
|
-
]
|
|
1655
1634
|
)
|
|
1656
1635
|
)}`);
|
|
1657
1636
|
importData.unshift(...baseHeaderBannerComment);
|
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';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EnvOptions, SilgiEvent, SilgiRuntimeConfig } from 'silgi/types';
|
|
2
2
|
export declare function updateEnvOptions(runtime: SilgiRuntimeConfig): EnvOptions;
|
|
3
|
-
export declare function useSilgiRuntimeConfig<T extends SilgiRuntimeConfig>(event?: SilgiEvent): SilgiRuntimeConfig;
|
|
3
|
+
export declare function useSilgiRuntimeConfig<T extends SilgiRuntimeConfig>(event?: SilgiEvent, localRuntimeConfig?: SilgiRuntimeConfig): SilgiRuntimeConfig;
|
|
4
4
|
export declare function initRuntimeConfig(envOptions?: EnvOptions, inlineRuntimeConfig?: Record<string, any>): Readonly<Record<string, any>>;
|
|
5
5
|
export declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void;
|
|
6
6
|
export declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
@@ -28,7 +28,10 @@ function sharedRuntimeConfig(runtime) {
|
|
|
28
28
|
}
|
|
29
29
|
return inlineRuntimeConfig;
|
|
30
30
|
}
|
|
31
|
-
export function useSilgiRuntimeConfig(event) {
|
|
31
|
+
export function useSilgiRuntimeConfig(event, localRuntimeConfig) {
|
|
32
|
+
if (localRuntimeConfig) {
|
|
33
|
+
return sharedRuntimeConfig(localRuntimeConfig);
|
|
34
|
+
}
|
|
32
35
|
const runtime = useRuntime();
|
|
33
36
|
if (!event) {
|
|
34
37
|
return sharedRuntimeConfig(runtime);
|
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: {
|