silgi 0.9.27 → 0.9.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/_chunks/index.mjs +1 -1
- package/dist/kit/index.d.mts +2 -2
- package/dist/kit/index.d.ts +2 -2
- package/dist/kit/index.mjs +28 -2
- 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
|
@@ -2,7 +2,7 @@ import { Buffer } from 'node:buffer';
|
|
|
2
2
|
import * as consola from 'consola';
|
|
3
3
|
import { ConsolaOptions } from 'consola';
|
|
4
4
|
import * as silgi_types from 'silgi/types';
|
|
5
|
-
import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
|
|
5
|
+
import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiEvents, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Resolve a module from a given root path using an algorithm patterned on
|
|
@@ -83,7 +83,7 @@ declare function resolveSilgiModule(base: string, paths: string[]): Promise<stri
|
|
|
83
83
|
*
|
|
84
84
|
* This mirrors the runtime behavior of Nitro.
|
|
85
85
|
*/
|
|
86
|
-
declare function useSilgiRuntimeConfig(): silgi_types.SilgiRuntimeOptions;
|
|
86
|
+
declare function useSilgiRuntimeConfig(event?: SilgiEvents): silgi_types.SilgiRuntimeOptions | undefined;
|
|
87
87
|
declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
88
88
|
|
|
89
89
|
/**
|
package/dist/kit/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Buffer } from 'node:buffer';
|
|
|
2
2
|
import * as consola from 'consola';
|
|
3
3
|
import { ConsolaOptions } from 'consola';
|
|
4
4
|
import * as silgi_types from 'silgi/types';
|
|
5
|
-
import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
|
|
5
|
+
import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiEvents, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Resolve a module from a given root path using an algorithm patterned on
|
|
@@ -83,7 +83,7 @@ declare function resolveSilgiModule(base: string, paths: string[]): Promise<stri
|
|
|
83
83
|
*
|
|
84
84
|
* This mirrors the runtime behavior of Nitro.
|
|
85
85
|
*/
|
|
86
|
-
declare function useSilgiRuntimeConfig(): silgi_types.SilgiRuntimeOptions;
|
|
86
|
+
declare function useSilgiRuntimeConfig(event?: SilgiEvents): silgi_types.SilgiRuntimeOptions | undefined;
|
|
87
87
|
declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
88
88
|
|
|
89
89
|
/**
|
package/dist/kit/index.mjs
CHANGED
|
@@ -256,10 +256,26 @@ async function resolveSilgiModule(base, paths) {
|
|
|
256
256
|
return resolved;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
const _inlineRuntimeConfig = process$1.env.RUNTIME_CONFIG;
|
|
260
|
+
const envOptions = {
|
|
261
|
+
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
|
+
};
|
|
265
|
+
const _sharedRuntimeConfig = _deepFreeze(
|
|
266
|
+
applyEnv(klona(_inlineRuntimeConfig ?? {}), envOptions)
|
|
267
|
+
);
|
|
268
|
+
function useSilgiRuntimeConfig(event) {
|
|
260
269
|
const silgi = tryUseSilgi();
|
|
261
270
|
if (!silgi) {
|
|
262
|
-
|
|
271
|
+
const data = globalThis.$silgiSharedRuntimeConfig;
|
|
272
|
+
if (data) {
|
|
273
|
+
return data;
|
|
274
|
+
}
|
|
275
|
+
if (!event) {
|
|
276
|
+
return _sharedRuntimeConfig;
|
|
277
|
+
}
|
|
278
|
+
return;
|
|
263
279
|
}
|
|
264
280
|
return applyEnv(klona(silgi.runtimeConfig), {
|
|
265
281
|
prefix: "NITRO_",
|
|
@@ -306,6 +322,16 @@ function _expandFromEnv(value, env = process$1.env) {
|
|
|
306
322
|
return env[key] || match;
|
|
307
323
|
});
|
|
308
324
|
}
|
|
325
|
+
function _deepFreeze(object) {
|
|
326
|
+
const propNames = Object.getOwnPropertyNames(object);
|
|
327
|
+
for (const name of propNames) {
|
|
328
|
+
const value = object[name];
|
|
329
|
+
if (value && typeof value === "object") {
|
|
330
|
+
_deepFreeze(value);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return Object.freeze(object);
|
|
334
|
+
}
|
|
309
335
|
|
|
310
336
|
const RELATIVE_RE = /^([^.])/;
|
|
311
337
|
function relativeWithDot(from, to) {
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED