silgi 0.9.16 → 0.9.18
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/prepare.mjs +3 -1
- package/dist/core/index.mjs +2 -0
- package/dist/kit/index.d.mts +2 -1
- package/dist/kit/index.d.ts +2 -1
- package/dist/kit/index.mjs +3 -3
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -146,6 +146,8 @@ async function readCoreFile(silgi) {
|
|
|
146
146
|
});
|
|
147
147
|
try {
|
|
148
148
|
if (silgi.options.commandType === "prepare") {
|
|
149
|
+
injectedResult.code = `global.$silgiSharedRuntimeConfig = ${JSON.stringify(silgi.options.runtimeConfig)};
|
|
150
|
+
${injectedResult.code}`;
|
|
149
151
|
injectedResult.code = injectedResult.code.replace(/runtimeConfig: \{\}/, `runtimeConfig: ${JSON.stringify(silgi.options.runtimeConfig)}`);
|
|
150
152
|
}
|
|
151
153
|
const coreFile = await jiti.evalModule(
|
|
@@ -625,12 +627,12 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
625
627
|
" modulesURIs,",
|
|
626
628
|
` plugins: [${plugins.join(", ")}],`,
|
|
627
629
|
_data._silgiConfigs.length > 0 ? ` ${_data._silgiConfigs.map((config) => typeof config === "string" ? config : typeof config === "object" ? Object.entries(config).map(([key, value]) => `${key}: ${value}`).join(",\n ") : "").join(",\n ")},` : "",
|
|
630
|
+
" runtimeConfig: {},",
|
|
628
631
|
" ...buildOptions,",
|
|
629
632
|
" options: mergeDeep(",
|
|
630
633
|
" moduleOptions || {},",
|
|
631
634
|
" {",
|
|
632
635
|
` present: '${silgi.options.preset}',`,
|
|
633
|
-
" runtimeConfig: {},",
|
|
634
636
|
" ...cliOptions,",
|
|
635
637
|
" },",
|
|
636
638
|
" ) as any,",
|
package/dist/core/index.mjs
CHANGED
|
@@ -503,6 +503,8 @@ async function createSilgi(config) {
|
|
|
503
503
|
ready: () => {
|
|
504
504
|
return hooks.callHook("ready", silgi);
|
|
505
505
|
},
|
|
506
|
+
envOptions: config.envOptions ?? {},
|
|
507
|
+
runtimeConfig: config.runtimeConfig ?? {},
|
|
506
508
|
close: () => hooks.callHook("close", silgi),
|
|
507
509
|
logger: createConsola(defu(config.options?.consolaOptions ?? {}, {
|
|
508
510
|
tag: "silgi"
|
package/dist/kit/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
2
|
import * as consola from 'consola';
|
|
3
3
|
import { ConsolaOptions } from 'consola';
|
|
4
|
+
import * as silgi_types from 'silgi/types';
|
|
4
5
|
import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -76,7 +77,7 @@ declare function resolveSilgiModule(base: string, paths: string[]): Promise<stri
|
|
|
76
77
|
*
|
|
77
78
|
* This mirrors the runtime behavior of Nitro.
|
|
78
79
|
*/
|
|
79
|
-
declare function useSilgiRuntimeConfig():
|
|
80
|
+
declare function useSilgiRuntimeConfig(): silgi_types.SilgiRuntimeOptions;
|
|
80
81
|
declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
81
82
|
|
|
82
83
|
/**
|
package/dist/kit/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
2
|
import * as consola from 'consola';
|
|
3
3
|
import { ConsolaOptions } from 'consola';
|
|
4
|
+
import * as silgi_types from 'silgi/types';
|
|
4
5
|
import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -76,7 +77,7 @@ declare function resolveSilgiModule(base: string, paths: string[]): Promise<stri
|
|
|
76
77
|
*
|
|
77
78
|
* This mirrors the runtime behavior of Nitro.
|
|
78
79
|
*/
|
|
79
|
-
declare function useSilgiRuntimeConfig():
|
|
80
|
+
declare function useSilgiRuntimeConfig(): silgi_types.SilgiRuntimeOptions;
|
|
80
81
|
declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
81
82
|
|
|
82
83
|
/**
|
package/dist/kit/index.mjs
CHANGED
|
@@ -246,14 +246,14 @@ async function resolveSilgiModule(base, paths) {
|
|
|
246
246
|
function useSilgiRuntimeConfig() {
|
|
247
247
|
const silgi = tryUseSilgi();
|
|
248
248
|
if (!silgi) {
|
|
249
|
-
return
|
|
249
|
+
return globalThis.$silgiSharedRuntimeConfig;
|
|
250
250
|
}
|
|
251
|
-
return applyEnv(klona(silgi.
|
|
251
|
+
return applyEnv(klona(silgi.runtimeConfig), {
|
|
252
252
|
prefix: "NITRO_",
|
|
253
253
|
altPrefix: "NUXT_",
|
|
254
254
|
silgiPrefix: "SILGI_",
|
|
255
255
|
envExpansion: silgi.options.experimental?.envExpansion ?? !!process$1.env.NITRO_ENV_EXPANSION,
|
|
256
|
-
...silgi.
|
|
256
|
+
...silgi.envOptions
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
function getEnv(key, opts, env = process$1.env) {
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
package/dist/types/index.d.mts
CHANGED
|
@@ -934,6 +934,10 @@ interface Silgi {
|
|
|
934
934
|
close: () => Promise<void>;
|
|
935
935
|
logger: ConsolaInstance;
|
|
936
936
|
storage: Storage;
|
|
937
|
+
envOptions: EnvOptions;
|
|
938
|
+
runtimeConfig: SilgiRuntimeOptions & {
|
|
939
|
+
[key: string]: any;
|
|
940
|
+
};
|
|
937
941
|
options: SilgiOptions & SilgiRuntimeOptions;
|
|
938
942
|
captureError: CaptureError;
|
|
939
943
|
}
|
|
@@ -957,10 +961,6 @@ type CaptureError = (error: Error, context: CapturedErrorContext) => void;
|
|
|
957
961
|
interface SilgiOptions {
|
|
958
962
|
consolaOptions?: Partial<ConsolaOptions>;
|
|
959
963
|
present: PresetNameInput;
|
|
960
|
-
envOptions: EnvOptions;
|
|
961
|
-
runtimeConfig: SilgiRuntimeOptions & {
|
|
962
|
-
[key: string]: any;
|
|
963
|
-
};
|
|
964
964
|
/**
|
|
965
965
|
* Set to `true` to enable debug mode.
|
|
966
966
|
*
|
package/dist/types/index.d.ts
CHANGED
|
@@ -934,6 +934,10 @@ interface Silgi {
|
|
|
934
934
|
close: () => Promise<void>;
|
|
935
935
|
logger: ConsolaInstance;
|
|
936
936
|
storage: Storage;
|
|
937
|
+
envOptions: EnvOptions;
|
|
938
|
+
runtimeConfig: SilgiRuntimeOptions & {
|
|
939
|
+
[key: string]: any;
|
|
940
|
+
};
|
|
937
941
|
options: SilgiOptions & SilgiRuntimeOptions;
|
|
938
942
|
captureError: CaptureError;
|
|
939
943
|
}
|
|
@@ -957,10 +961,6 @@ type CaptureError = (error: Error, context: CapturedErrorContext) => void;
|
|
|
957
961
|
interface SilgiOptions {
|
|
958
962
|
consolaOptions?: Partial<ConsolaOptions>;
|
|
959
963
|
present: PresetNameInput;
|
|
960
|
-
envOptions: EnvOptions;
|
|
961
|
-
runtimeConfig: SilgiRuntimeOptions & {
|
|
962
|
-
[key: string]: any;
|
|
963
|
-
};
|
|
964
964
|
/**
|
|
965
965
|
* Set to `true` to enable debug mode.
|
|
966
966
|
*
|