silgi 0.9.9 → 0.9.11

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.9";
1
+ const version = "0.9.11";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.3.0",
4
4
  "@nuxt/kit": "^3.15.4",
@@ -0,0 +1,109 @@
1
+ import * as p from '@clack/prompts';
2
+ import { existsSync, promises } from 'node:fs';
3
+ import * as dotenv from 'dotenv';
4
+ import { resolve } from 'pathe';
5
+
6
+ async function setupDotenv(options) {
7
+ const targetEnvironment = options.env ?? process.env;
8
+ const environment = await loadDotenv({
9
+ cwd: options.cwd,
10
+ fileName: options.fileName ?? ".env",
11
+ env: targetEnvironment,
12
+ interpolate: options.interpolate ?? true
13
+ });
14
+ for (const key in environment) {
15
+ if (!key.startsWith("_") && targetEnvironment[key] === void 0) {
16
+ targetEnvironment[key] = environment[key];
17
+ }
18
+ }
19
+ return environment;
20
+ }
21
+ async function loadDotenv(options) {
22
+ const environment = /* @__PURE__ */ Object.create(null);
23
+ const dotenvFile = resolve(options.cwd, options.fileName);
24
+ if (existsSync(dotenvFile)) {
25
+ const parsed = dotenv.parse(await promises.readFile(dotenvFile, "utf8"));
26
+ Object.assign(environment, parsed);
27
+ }
28
+ if (!options.env?._applied) {
29
+ Object.assign(environment, options.env);
30
+ environment._applied = true;
31
+ }
32
+ if (options.interpolate) {
33
+ interpolate(environment);
34
+ }
35
+ return environment;
36
+ }
37
+ function interpolate(target, source = {}, parse = (v) => v) {
38
+ function getValue(key) {
39
+ return source[key] === void 0 ? target[key] : source[key];
40
+ }
41
+ function interpolate2(value, parents = []) {
42
+ if (typeof value !== "string") {
43
+ return value;
44
+ }
45
+ const matches = value.match(/(.?\$\{?[\w:]*\}?)/g) || [];
46
+ return parse(
47
+ matches.reduce((newValue, match) => {
48
+ const parts = /(.?)\$\{?([\w:]+)?\}?/.exec(match) || [];
49
+ const prefix = parts[1];
50
+ let value2, replacePart;
51
+ if (prefix === "\\") {
52
+ replacePart = parts[0] || "";
53
+ value2 = replacePart.replace(String.raw`\$`, "$");
54
+ } else {
55
+ const key = parts[2];
56
+ replacePart = (parts[0] || "").slice(prefix.length);
57
+ if (parents.includes(key)) {
58
+ console.warn(
59
+ `Please avoid recursive environment variables ( loop: ${parents.join(
60
+ " > "
61
+ )} > ${key} )`
62
+ );
63
+ return "";
64
+ }
65
+ value2 = getValue(key);
66
+ value2 = interpolate2(value2, [...parents, key]);
67
+ }
68
+ return value2 === void 0 ? newValue : newValue.replace(replacePart, value2);
69
+ }, value)
70
+ );
71
+ }
72
+ for (const key in target) {
73
+ target[key] = interpolate2(getValue(key));
74
+ }
75
+ }
76
+
77
+ async function prepareEnv(silgiConfig) {
78
+ const customEnvironments = silgiConfig.environments;
79
+ const environment = await p.select({
80
+ message: "Select an environment",
81
+ options: customEnvironments?.length > 0 ? customEnvironments.map((env) => ({
82
+ label: env.fileName,
83
+ value: env.fileName
84
+ })) : [
85
+ { label: "Development (.env.dev)", value: "dev" },
86
+ { label: "Docker (.env.docker)", value: "docker" },
87
+ { label: "Staging (.env.staging)", value: "staging" },
88
+ { label: "Testing (.env.testing)", value: "testing" },
89
+ { label: "Production (.env)", value: ".env" }
90
+ ]
91
+ });
92
+ const findEnv = customEnvironments?.find((env) => env.fileName === environment);
93
+ if (findEnv) {
94
+ await setupDotenv({
95
+ cwd: findEnv.cwd || silgiConfig.rootDir,
96
+ interpolate: findEnv.interpolate,
97
+ fileName: findEnv.fileName,
98
+ env: findEnv.env
99
+ });
100
+ } else {
101
+ await setupDotenv({
102
+ cwd: silgiConfig.rootDir,
103
+ interpolate: true,
104
+ fileName: environment === "prod" ? ".env" : `.env.${environment}`
105
+ });
106
+ }
107
+ }
108
+
109
+ export { prepareEnv as p };
@@ -22,6 +22,9 @@ const SilgiCLIDefaults = {
22
22
  appConfig: {},
23
23
  appConfigFiles: [],
24
24
  commandType: "prepare",
25
+ runtimeConfig: {
26
+ app: { baseURL: "/" }
27
+ },
25
28
  // Dirs
26
29
  scanDirs: [],
27
30
  build: {
@@ -6,7 +6,7 @@ import { promises, existsSync, readFileSync, writeFileSync, mkdirSync } from 'no
6
6
  import { readdir } from 'node:fs/promises';
7
7
  import { resolvePath, parseNodeModulePath, lookupNodeModuleSubpath, resolveModuleExportNames, resolve as resolve$1 } from 'mlly';
8
8
  import { resolveAlias } from 'pathe/utils';
9
- import { relativeWithDot, isDirectory, writeFile, resolveAlias as resolveAlias$1, resolvePath as resolvePath$1, normalizeTemplate, useLogger, addTemplate } from 'silgi/kit';
9
+ import { relativeWithDot, isDirectory, writeFile, resolveAlias as resolveAlias$1, resolvePath as resolvePath$1, normalizeTemplate, useLogger, addTemplate, applyEnv } from 'silgi/kit';
10
10
  import { runtimeDir } from 'silgi/runtime/meta';
11
11
  import { toExports, scanExports, createUnimport } from 'unimport';
12
12
  import { createJiti } from 'dev-jiti';
@@ -16,6 +16,7 @@ import { s as silgiGenerateType } from './types.mjs';
16
16
  import { c as commonArgs } from './common.mjs';
17
17
  import { createHooks, createDebugger } from 'hookable';
18
18
  import { useSilgiCLI, silgiCLICtx } from 'silgi/core';
19
+ import { p as prepareEnv } from './env.mjs';
19
20
  import { pascalCase } from 'scule';
20
21
  import { h as hasInstalledModule } from './compatibility.mjs';
21
22
  import { pathToFileURL, fileURLToPath } from 'node:url';
@@ -27,6 +28,8 @@ import { parseSync } from '@oxc-parser/wasm';
27
28
  import { klona } from 'klona';
28
29
  import { createStorage, builtinDrivers } from 'unstorage';
29
30
  import { l as loadOptions } from './loader.mjs';
31
+ import '@clack/prompts';
32
+ import 'dotenv';
30
33
  import 'semver/functions/satisfies.js';
31
34
  import 'c12';
32
35
  import 'compatx';
@@ -1771,6 +1774,35 @@ async function installPackages(silgi) {
1771
1774
  });
1772
1775
  }
1773
1776
 
1777
+ function _deepFreeze(object) {
1778
+ const propNames = Object.getOwnPropertyNames(object);
1779
+ for (const name of propNames) {
1780
+ const value = object[name];
1781
+ if (value && typeof value === "object") {
1782
+ _deepFreeze(value);
1783
+ }
1784
+ }
1785
+ return Object.freeze(object);
1786
+ }
1787
+ function useCLIRuntimeConfig(silgi) {
1788
+ const _inlineRuntimeConfig = silgi.options.runtimeConfig;
1789
+ const envOptions = {
1790
+ prefix: "NITRO_",
1791
+ altPrefix: process.env.NITRO_ENV_PREFIX ?? process.env.SILGI_ENV_PREFIX ?? "_",
1792
+ silgiPrefix: "SILGI_",
1793
+ envExpansion: process.env.NITRO_ENV_EXPANSION ?? process.env.SILGI_ENV_EXPANSION ?? false,
1794
+ ...silgi.options.envOptions
1795
+ };
1796
+ silgi.hook("prepare:core.ts", (data) => {
1797
+ data.cliOptions.envOptions = envOptions;
1798
+ });
1799
+ const _sharedRuntimeConfig = _deepFreeze(
1800
+ applyEnv(klona(_inlineRuntimeConfig), envOptions)
1801
+ );
1802
+ console.log(_sharedRuntimeConfig, "asdasdasd");
1803
+ return _sharedRuntimeConfig;
1804
+ }
1805
+
1774
1806
  const GLOB_SCAN_PATTERN = "**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}";
1775
1807
  async function scanAndSyncOptions(silgi) {
1776
1808
  const scannedModules = await scanModules(silgi);
@@ -1808,6 +1840,7 @@ async function scanDir(silgi, dir, name) {
1808
1840
 
1809
1841
  async function createSilgiCLI(config = {}, opts = {}) {
1810
1842
  const options = await loadOptions(config, opts);
1843
+ await prepareEnv(options);
1811
1844
  const hooks = createHooks();
1812
1845
  const silgi = {
1813
1846
  modulesURIs: {},
@@ -1832,6 +1865,7 @@ async function createSilgiCLI(config = {}, opts = {}) {
1832
1865
  async updateConfig(_config) {
1833
1866
  }
1834
1867
  };
1868
+ useCLIRuntimeConfig(silgi);
1835
1869
  if (silgiCLICtx.tryUse()) {
1836
1870
  silgiCLICtx.unset();
1837
1871
  silgiCLICtx.set(silgi);
package/dist/cli/run.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { execSync } from 'node:child_process';
2
- import { existsSync, promises, readFileSync } from 'node:fs';
2
+ import { readFileSync } from 'node:fs';
3
3
  import * as p from '@clack/prompts';
4
4
  import { defineCommand } from 'citty';
5
5
  import { consola } from 'consola';
@@ -8,8 +8,9 @@ import { resolve } from 'pathe';
8
8
  import color from 'picocolors';
9
9
  import { version } from 'silgi/meta';
10
10
  import { c as commonArgs } from './common.mjs';
11
- import * as dotenv from 'dotenv';
11
+ import { p as prepareEnv } from './env.mjs';
12
12
  import { l as loadOptions } from './loader.mjs';
13
+ import 'dotenv';
13
14
  import 'c12';
14
15
  import 'compatx';
15
16
  import 'klona/full';
@@ -22,77 +23,6 @@ import 'silgi/kit';
22
23
  import 'silgi/runtime/meta';
23
24
  import 'ufo';
24
25
 
25
- async function setupDotenv(options) {
26
- const targetEnvironment = options.env ?? process.env;
27
- const environment = await loadDotenv({
28
- cwd: options.cwd,
29
- fileName: options.fileName ?? ".env",
30
- env: targetEnvironment,
31
- interpolate: options.interpolate ?? true
32
- });
33
- for (const key in environment) {
34
- if (!key.startsWith("_") && targetEnvironment[key] === void 0) {
35
- targetEnvironment[key] = environment[key];
36
- }
37
- }
38
- return environment;
39
- }
40
- async function loadDotenv(options) {
41
- const environment = /* @__PURE__ */ Object.create(null);
42
- const dotenvFile = resolve(options.cwd, options.fileName);
43
- if (existsSync(dotenvFile)) {
44
- const parsed = dotenv.parse(await promises.readFile(dotenvFile, "utf8"));
45
- Object.assign(environment, parsed);
46
- }
47
- if (!options.env?._applied) {
48
- Object.assign(environment, options.env);
49
- environment._applied = true;
50
- }
51
- if (options.interpolate) {
52
- interpolate(environment);
53
- }
54
- return environment;
55
- }
56
- function interpolate(target, source = {}, parse = (v) => v) {
57
- function getValue(key) {
58
- return source[key] === void 0 ? target[key] : source[key];
59
- }
60
- function interpolate2(value, parents = []) {
61
- if (typeof value !== "string") {
62
- return value;
63
- }
64
- const matches = value.match(/(.?\$\{?[\w:]*\}?)/g) || [];
65
- return parse(
66
- matches.reduce((newValue, match) => {
67
- const parts = /(.?)\$\{?([\w:]+)?\}?/.exec(match) || [];
68
- const prefix = parts[1];
69
- let value2, replacePart;
70
- if (prefix === "\\") {
71
- replacePart = parts[0] || "";
72
- value2 = replacePart.replace(String.raw`\$`, "$");
73
- } else {
74
- const key = parts[2];
75
- replacePart = (parts[0] || "").slice(prefix.length);
76
- if (parents.includes(key)) {
77
- console.warn(
78
- `Please avoid recursive environment variables ( loop: ${parents.join(
79
- " > "
80
- )} > ${key} )`
81
- );
82
- return "";
83
- }
84
- value2 = getValue(key);
85
- value2 = interpolate2(value2, [...parents, key]);
86
- }
87
- return value2 === void 0 ? newValue : newValue.replace(replacePart, value2);
88
- }, value)
89
- );
90
- }
91
- for (const key in target) {
92
- target[key] = interpolate2(getValue(key));
93
- }
94
- }
95
-
96
26
  const run = defineCommand({
97
27
  meta: {
98
28
  name: "run",
@@ -120,35 +50,7 @@ const run = defineCommand({
120
50
  consola.info("Empty command list, maybe forgot pnpm silgi prepare?");
121
51
  return;
122
52
  }
123
- const customEnvironments = silgiConfig.environments;
124
- const environment = await p.select({
125
- message: "Select an environment",
126
- options: customEnvironments?.length > 0 ? customEnvironments.map((env) => ({
127
- label: env.fileName,
128
- value: env.fileName
129
- })) : [
130
- { label: "Development (.env.dev)", value: "dev" },
131
- { label: "Docker (.env.docker)", value: "docker" },
132
- { label: "Staging (.env.staging)", value: "staging" },
133
- { label: "Testing (.env.testing)", value: "testing" },
134
- { label: "Production (.env)", value: ".env" }
135
- ]
136
- });
137
- const findEnv = customEnvironments?.find((env) => env.fileName === environment);
138
- if (findEnv) {
139
- await setupDotenv({
140
- cwd: findEnv.cwd || silgiConfig.rootDir,
141
- interpolate: findEnv.interpolate,
142
- fileName: findEnv.fileName,
143
- env: findEnv.env
144
- });
145
- } else {
146
- await setupDotenv({
147
- cwd: silgiConfig.rootDir,
148
- interpolate: true,
149
- fileName: environment === "prod" ? ".env" : `.env.${environment}`
150
- });
151
- }
53
+ await prepareEnv(silgiConfig);
152
54
  let selectedCommands = [];
153
55
  if (tags) {
154
56
  for (const commandName of Object.keys(cliJson)) {
@@ -1,7 +1,7 @@
1
1
  import { Buffer } from 'node:buffer';
2
2
  import * as consola from 'consola';
3
3
  import { ConsolaOptions } from 'consola';
4
- import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
4
+ import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
5
5
 
6
6
  /**
7
7
  * Resolve a module from a given root path using an algorithm patterned on
@@ -77,6 +77,7 @@ declare function resolveSilgiModule(base: string, paths: string[]): Promise<stri
77
77
  * This mirrors the runtime behavior of Nitro.
78
78
  */
79
79
  declare function useSilgiRuntimeConfig(): Record<string, any> | undefined;
80
+ declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
80
81
 
81
82
  /**
82
83
  * Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
@@ -107,4 +108,4 @@ declare const MODE_RE: RegExp;
107
108
  declare function hasSilgiModule(moduleKey: string, silgi?: SilgiCLI): boolean;
108
109
  declare function hasInstalledModule(moduleKey: string, silgi?: SilgiCLI): boolean;
109
110
 
110
- export { MODE_RE, addTemplate, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
111
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
@@ -1,7 +1,7 @@
1
1
  import { Buffer } from 'node:buffer';
2
2
  import * as consola from 'consola';
3
3
  import { ConsolaOptions } from 'consola';
4
- import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
4
+ import { ModuleOptionsCustom, ModuleDefinition, SilgiModule, SilgiCLI, SilgiPreset, SilgiPresetMeta, EnvOptions, SilgiTemplate, ResolvedSilgiTemplate } from 'silgi/types';
5
5
 
6
6
  /**
7
7
  * Resolve a module from a given root path using an algorithm patterned on
@@ -77,6 +77,7 @@ declare function resolveSilgiModule(base: string, paths: string[]): Promise<stri
77
77
  * This mirrors the runtime behavior of Nitro.
78
78
  */
79
79
  declare function useSilgiRuntimeConfig(): Record<string, any> | undefined;
80
+ declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
80
81
 
81
82
  /**
82
83
  * Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
@@ -107,4 +108,4 @@ declare const MODE_RE: RegExp;
107
108
  declare function hasSilgiModule(moduleKey: string, silgi?: SilgiCLI): boolean;
108
109
  declare function hasInstalledModule(moduleKey: string, silgi?: SilgiCLI): boolean;
109
110
 
110
- export { MODE_RE, addTemplate, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
111
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
@@ -252,8 +252,8 @@ function useSilgiRuntimeConfig() {
252
252
  prefix: "NITRO_",
253
253
  altPrefix: "NUXT_",
254
254
  silgiPrefix: "SILGI_",
255
- // TODO: add more prefixes ecosystem-wide
256
- envExpansion: silgi.options.experimental?.envExpansion ?? !!process$1.env.NITRO_ENV_EXPANSION
255
+ envExpansion: silgi.options.experimental?.envExpansion ?? !!process$1.env.NITRO_ENV_EXPANSION,
256
+ ...silgi.options.envOptions
257
257
  });
258
258
  }
259
259
  function getEnv(key, opts, env = process$1.env) {
@@ -360,4 +360,4 @@ function normalizeTemplate(template, buildDir) {
360
360
  return template;
361
361
  }
362
362
 
363
- export { MODE_RE, addTemplate, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
363
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
@@ -1,4 +1,4 @@
1
- const version = "0.9.9";
1
+ const version = "0.9.11";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.3.0",
4
4
  "@nuxt/kit": "^3.15.4",
@@ -1,4 +1,4 @@
1
- const version = "0.9.9";
1
+ const version = "0.9.11";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.3.0",
4
4
  "@nuxt/kit": "^3.15.4",
@@ -8,6 +8,9 @@ const nitro = defineSilgiPreset(
8
8
  },
9
9
  prerender: {
10
10
  crawlLinks: true
11
+ },
12
+ envOptions: {
13
+ prefix: "NITRO_"
11
14
  }
12
15
  },
13
16
  {
@@ -8,6 +8,10 @@ const nuxt = defineSilgiPreset(
8
8
  },
9
9
  prerender: {
10
10
  crawlLinks: true
11
+ },
12
+ envOptions: {
13
+ prefix: "NITRO_",
14
+ altPrefix: "NUXT_"
11
15
  }
12
16
  },
13
17
  {
@@ -6,7 +6,7 @@ import { Hookable, NestedHooks } from 'hookable';
6
6
  import { Ignore, Options } from 'ignore';
7
7
  import { TSConfig } from 'pkg-types';
8
8
  import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
9
- import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, DotenvOptions as DotenvOptions$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
9
+ import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
10
10
  import { UnimportPluginOptions } from 'unimport/unplugin';
11
11
  import { StandardSchemaV1 } from '@standard-schema/spec';
12
12
  import { Defu } from 'defu';
@@ -557,6 +557,10 @@ interface SilgiCLIOptions extends PresetOptions {
557
557
  };
558
558
  commandType: CommandType;
559
559
  environments: DotenvOptions$1[];
560
+ envOptions: EnvOptions$1;
561
+ runtimeConfig: SilgiRuntimeOptions & {
562
+ [key: string]: any;
563
+ };
560
564
  namespaces: string[];
561
565
  hooks: NestedHooks<SilgiCLIHooks$1>;
562
566
  plugins: {
@@ -771,6 +775,13 @@ interface LoadConfigOptions {
771
775
  compatibilityDate?: CompatibilityDateSpec;
772
776
  }
773
777
 
778
+ interface EnvOptions {
779
+ prefix?: string;
780
+ altPrefix?: string;
781
+ silgiPrefix?: string;
782
+ envExpansion?: boolean;
783
+ }
784
+
774
785
  type CustomDriverName = string & {
775
786
  _custom?: any;
776
787
  };
@@ -944,6 +955,7 @@ type CaptureError = (error: Error, context: CapturedErrorContext) => void;
944
955
  interface SilgiOptions {
945
956
  consolaOptions?: Partial<ConsolaOptions>;
946
957
  present: PresetNameInput;
958
+ envOptions: EnvOptions;
947
959
  runtimeConfig: SilgiRuntimeOptions & {
948
960
  [key: string]: any;
949
961
  };
@@ -1010,4 +1022,4 @@ type Namespaces<T extends BaseNamespaceType> = {
1010
1022
 
1011
1023
  declare const autoImportTypes: string[];
1012
1024
 
1013
- export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CommandType, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DotenvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
1025
+ export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CommandType, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
@@ -6,7 +6,7 @@ import { Hookable, NestedHooks } from 'hookable';
6
6
  import { Ignore, Options } from 'ignore';
7
7
  import { TSConfig } from 'pkg-types';
8
8
  import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
9
- import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, DotenvOptions as DotenvOptions$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
9
+ import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
10
10
  import { UnimportPluginOptions } from 'unimport/unplugin';
11
11
  import { StandardSchemaV1 } from '@standard-schema/spec';
12
12
  import { Defu } from 'defu';
@@ -557,6 +557,10 @@ interface SilgiCLIOptions extends PresetOptions {
557
557
  };
558
558
  commandType: CommandType;
559
559
  environments: DotenvOptions$1[];
560
+ envOptions: EnvOptions$1;
561
+ runtimeConfig: SilgiRuntimeOptions & {
562
+ [key: string]: any;
563
+ };
560
564
  namespaces: string[];
561
565
  hooks: NestedHooks<SilgiCLIHooks$1>;
562
566
  plugins: {
@@ -771,6 +775,13 @@ interface LoadConfigOptions {
771
775
  compatibilityDate?: CompatibilityDateSpec;
772
776
  }
773
777
 
778
+ interface EnvOptions {
779
+ prefix?: string;
780
+ altPrefix?: string;
781
+ silgiPrefix?: string;
782
+ envExpansion?: boolean;
783
+ }
784
+
774
785
  type CustomDriverName = string & {
775
786
  _custom?: any;
776
787
  };
@@ -944,6 +955,7 @@ type CaptureError = (error: Error, context: CapturedErrorContext) => void;
944
955
  interface SilgiOptions {
945
956
  consolaOptions?: Partial<ConsolaOptions>;
946
957
  present: PresetNameInput;
958
+ envOptions: EnvOptions;
947
959
  runtimeConfig: SilgiRuntimeOptions & {
948
960
  [key: string]: any;
949
961
  };
@@ -1010,4 +1022,4 @@ type Namespaces<T extends BaseNamespaceType> = {
1010
1022
 
1011
1023
  declare const autoImportTypes: string[];
1012
1024
 
1013
- export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CommandType, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DotenvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
1025
+ export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CommandType, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.9.9",
4
+ "version": "0.9.11",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {