silgi 0.9.15 → 0.9.17

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.15";
1
+ const version = "0.9.17";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.3.0",
4
4
  "@nuxt/kit": "^3.15.4",
@@ -146,9 +146,10 @@ async function readCoreFile(silgi) {
146
146
  });
147
147
  try {
148
148
  if (silgi.options.commandType === "prepare") {
149
- injectedResult.code = injectedResult.code.replace(/runtimeConfig: \{\}/, "runtimeConfig: globalThis.$silgiSharedRuntimeConfig");
149
+ injectedResult.code = `global.$silgiSharedRuntimeConfig = ${JSON.stringify(silgi.options.runtimeConfig)};
150
+ ${injectedResult.code}`;
151
+ injectedResult.code = injectedResult.code.replace(/runtimeConfig: \{\}/, `runtimeConfig: ${JSON.stringify(silgi.options.runtimeConfig)}`);
150
152
  }
151
- console.log(injectedResult.code);
152
153
  const coreFile = await jiti.evalModule(
153
154
  injectedResult.code,
154
155
  {
@@ -1800,7 +1801,7 @@ function useCLIRuntimeConfig(silgi) {
1800
1801
  const _sharedRuntimeConfig = _deepFreeze(
1801
1802
  applyEnv(klona(_inlineRuntimeConfig), envOptions)
1802
1803
  );
1803
- globalThis.$silgiSharedRuntimeConfig = _sharedRuntimeConfig;
1804
+ silgi.options.runtimeConfig = _sharedRuntimeConfig;
1804
1805
  return _sharedRuntimeConfig;
1805
1806
  }
1806
1807
 
@@ -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(): Record<string, any> | undefined;
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
  /**
@@ -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(): Record<string, any> | undefined;
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
  /**
@@ -246,7 +246,7 @@ async function resolveSilgiModule(base, paths) {
246
246
  function useSilgiRuntimeConfig() {
247
247
  const silgi = tryUseSilgi();
248
248
  if (!silgi) {
249
- return void 0;
249
+ return globalThis.$silgiSharedRuntimeConfig;
250
250
  }
251
251
  return applyEnv(klona(silgi.options.runtimeConfig), {
252
252
  prefix: "NITRO_",
@@ -1,4 +1,4 @@
1
- const version = "0.9.15";
1
+ const version = "0.9.17";
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.15";
1
+ const version = "0.9.17";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.3.0",
4
4
  "@nuxt/kit": "^3.15.4",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.9.15",
4
+ "version": "0.9.17",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {