silgi 0.9.28 → 0.9.30
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/kit/index.d.mts +1 -2
- package/dist/kit/index.d.ts +1 -2
- package/dist/kit/index.mjs +12 -8
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/kit/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiEvents, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -83,7 +82,7 @@ declare function resolveSilgiModule(base: string, paths: string[]): Promise<stri
|
|
|
83
82
|
*
|
|
84
83
|
* This mirrors the runtime behavior of Nitro.
|
|
85
84
|
*/
|
|
86
|
-
declare function useSilgiRuntimeConfig(event?: SilgiEvents):
|
|
85
|
+
declare function useSilgiRuntimeConfig(event?: SilgiEvents): any;
|
|
87
86
|
declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
88
87
|
|
|
89
88
|
/**
|
package/dist/kit/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiEvents, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -83,7 +82,7 @@ declare function resolveSilgiModule(base: string, paths: string[]): Promise<stri
|
|
|
83
82
|
*
|
|
84
83
|
* This mirrors the runtime behavior of Nitro.
|
|
85
84
|
*/
|
|
86
|
-
declare function useSilgiRuntimeConfig(event?: SilgiEvents):
|
|
85
|
+
declare function useSilgiRuntimeConfig(event?: SilgiEvents): any;
|
|
87
86
|
declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
88
87
|
|
|
89
88
|
/**
|
package/dist/kit/index.mjs
CHANGED
|
@@ -12,7 +12,6 @@ import { c as checkSilgiCompatibility } from '../cli/compatibility.mjs';
|
|
|
12
12
|
import { existsSync, promises } from 'node:fs';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
14
|
import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
|
|
15
|
-
import process$1 from 'node:process';
|
|
16
15
|
import destr from 'destr';
|
|
17
16
|
import { klona } from 'klona';
|
|
18
17
|
import 'semver/functions/satisfies.js';
|
|
@@ -256,11 +255,14 @@ async function resolveSilgiModule(base, paths) {
|
|
|
256
255
|
return resolved;
|
|
257
256
|
}
|
|
258
257
|
|
|
259
|
-
const _inlineRuntimeConfig =
|
|
258
|
+
const _inlineRuntimeConfig = (
|
|
259
|
+
/** */
|
|
260
|
+
process.env.RUNTIME_CONFIG
|
|
261
|
+
);
|
|
260
262
|
const envOptions = {
|
|
261
263
|
prefix: "NITRO_",
|
|
262
|
-
altPrefix: _inlineRuntimeConfig?.nitro.envPrefix ?? process
|
|
263
|
-
envExpansion: _inlineRuntimeConfig?.nitro.envExpansion ?? process
|
|
264
|
+
altPrefix: _inlineRuntimeConfig?.nitro.envPrefix ?? process.env.NITRO_ENV_PREFIX ?? "_",
|
|
265
|
+
envExpansion: _inlineRuntimeConfig?.nitro.envExpansion ?? process.env.NITRO_ENV_EXPANSION ?? false
|
|
264
266
|
};
|
|
265
267
|
const _sharedRuntimeConfig = _deepFreeze(
|
|
266
268
|
applyEnv(klona(_inlineRuntimeConfig ?? {}), envOptions)
|
|
@@ -275,17 +277,19 @@ function useSilgiRuntimeConfig(event) {
|
|
|
275
277
|
if (!event) {
|
|
276
278
|
return _sharedRuntimeConfig;
|
|
277
279
|
}
|
|
278
|
-
|
|
280
|
+
const runtimeConfig = klona(_inlineRuntimeConfig);
|
|
281
|
+
applyEnv(runtimeConfig, envOptions);
|
|
282
|
+
return runtimeConfig;
|
|
279
283
|
}
|
|
280
284
|
return applyEnv(klona(silgi.runtimeConfig), {
|
|
281
285
|
prefix: "NITRO_",
|
|
282
286
|
altPrefix: "NUXT_",
|
|
283
287
|
silgiPrefix: "SILGI_",
|
|
284
|
-
envExpansion: silgi.options.experimental?.envExpansion ?? !!process
|
|
288
|
+
envExpansion: silgi.options.experimental?.envExpansion ?? !!process.env.NITRO_ENV_EXPANSION,
|
|
285
289
|
...silgi.envOptions
|
|
286
290
|
});
|
|
287
291
|
}
|
|
288
|
-
function getEnv(key, opts, env = process
|
|
292
|
+
function getEnv(key, opts, env = process.env) {
|
|
289
293
|
const envKey = snakeCase(key).toUpperCase();
|
|
290
294
|
return destr(
|
|
291
295
|
env[opts.prefix + envKey] ?? env[opts.altPrefix + envKey] ?? env[opts.silgiPrefix + envKey]
|
|
@@ -317,7 +321,7 @@ function applyEnv(obj, opts, parentKey = "") {
|
|
|
317
321
|
return obj;
|
|
318
322
|
}
|
|
319
323
|
const envExpandRx = /\{\{([^{}]*)\}\}/g;
|
|
320
|
-
function _expandFromEnv(value, env = process
|
|
324
|
+
function _expandFromEnv(value, env = process.env) {
|
|
321
325
|
return value.replace(envExpandRx, (match, key) => {
|
|
322
326
|
return env[key] || match;
|
|
323
327
|
});
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED