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.
@@ -1,4 +1,4 @@
1
- const version = "0.9.28";
1
+ const version = "0.9.30";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -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): silgi_types.SilgiRuntimeOptions | undefined;
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
  /**
@@ -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): silgi_types.SilgiRuntimeOptions | undefined;
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
  /**
@@ -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 = process$1.env.RUNTIME_CONFIG;
258
+ const _inlineRuntimeConfig = (
259
+ /** */
260
+ process.env.RUNTIME_CONFIG
261
+ );
260
262
  const envOptions = {
261
263
  prefix: "NITRO_",
262
- altPrefix: _inlineRuntimeConfig?.nitro.envPrefix ?? process$1.env.NITRO_ENV_PREFIX ?? "_",
263
- envExpansion: _inlineRuntimeConfig?.nitro.envExpansion ?? process$1.env.NITRO_ENV_EXPANSION ?? false
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
- return;
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$1.env.NITRO_ENV_EXPANSION,
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$1.env) {
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$1.env) {
324
+ function _expandFromEnv(value, env = process.env) {
321
325
  return value.replace(envExpandRx, (match, key) => {
322
326
  return env[key] || match;
323
327
  });
@@ -1,4 +1,4 @@
1
- const version = "0.9.28";
1
+ const version = "0.9.30";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -1,4 +1,4 @@
1
- const version = "0.9.28";
1
+ const version = "0.9.30";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.9.28",
4
+ "version": "0.9.30",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {