silgi 0.37.22 → 0.37.23
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/cli/build.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { consola } from 'consola';
|
|
2
2
|
import { createHooks, createDebugger } from 'hookable';
|
|
3
3
|
import { resolve, join, relative, extname, basename, dirname, isAbsolute } from 'pathe';
|
|
4
|
-
import { useSilgiCLI, replaceRuntimeValues,
|
|
4
|
+
import { useSilgiCLI, replaceRuntimeValues, updateRuntimeStorage, silgiCLICtx, autoImportTypes } from 'silgi';
|
|
5
5
|
import { isPresents, addTemplate, addCoreFile, genEnsureSafeVar, writeFile, relativeWithDot, hash, removeExtension, resolveAlias, directoryToURL, addImports, baseHeaderBannerComment, normalizeTemplate, useLogger, resolveSilgiPath, hasSilgiModule, toArray, isDirectory } from 'silgi/kit';
|
|
6
6
|
import { runtimeDir } from 'silgi/runtime/meta';
|
|
7
7
|
import { scanExports, createUnimport, toExports } from 'unimport';
|
|
@@ -1048,10 +1048,6 @@ async function readScanFile(silgi) {
|
|
|
1048
1048
|
alias: silgi.options.alias
|
|
1049
1049
|
});
|
|
1050
1050
|
try {
|
|
1051
|
-
globalThis._silgi_runtime = silgi.options.runtimeConfig;
|
|
1052
|
-
injectedResult.code = `globalThis._silgi_runtime = ${JSON.stringify(silgi.options.runtimeConfig)};
|
|
1053
|
-
${injectedResult.code}`;
|
|
1054
|
-
injectedResult.code = injectedResult.code.replace(/runtimeConfig: \{\}/, `runtimeConfig: ${JSON.stringify(silgi.options.runtimeConfig)}`);
|
|
1055
1051
|
const scanFile = await jiti.evalModule(
|
|
1056
1052
|
injectedResult.code,
|
|
1057
1053
|
{
|
|
@@ -1457,10 +1453,7 @@ async function createSilgiCLI(config = {}, opts = {}) {
|
|
|
1457
1453
|
},
|
|
1458
1454
|
adapters: {}
|
|
1459
1455
|
};
|
|
1460
|
-
|
|
1461
|
-
globalThis.__silgi__.useRuntimeConfig = function() {
|
|
1462
|
-
return silgi?.options?.runtimeConfig || {};
|
|
1463
|
-
};
|
|
1456
|
+
updateRuntimeStorage(silgi.options.runtimeConfig);
|
|
1464
1457
|
if (silgi.options.adapters && Object.keys(silgi.options.adapters)?.length > 0) {
|
|
1465
1458
|
for (const [key, value] of Object.entries(silgi.options.adapters)) {
|
|
1466
1459
|
silgi.adapters[key] = value;
|
|
@@ -1491,7 +1484,6 @@ async function createSilgiCLI(config = {}, opts = {}) {
|
|
|
1491
1484
|
await framework(silgi);
|
|
1492
1485
|
}
|
|
1493
1486
|
await writeScanFiles(silgi);
|
|
1494
|
-
updateRuntimeStorage(silgi.options.runtimeConfig);
|
|
1495
1487
|
silgi.storage = await createStorageCLI(silgi);
|
|
1496
1488
|
silgi.hooks.hook("close", async () => {
|
|
1497
1489
|
await silgi.storage.dispose();
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EnvOptions, SilgiEvent, SilgiRuntimeConfig } from 'silgi/types';
|
|
2
2
|
export declare function updateEnvOptions(): EnvOptions;
|
|
3
|
-
export declare function useSilgiRuntimeConfig<T extends SilgiRuntimeConfig>(event?: SilgiEvent
|
|
3
|
+
export declare function useSilgiRuntimeConfig<T extends SilgiRuntimeConfig>(event?: SilgiEvent): SilgiRuntimeConfig;
|
|
4
4
|
export declare function initRuntimeConfig(envOptions?: EnvOptions, inlineRuntimeConfig?: Record<string, any>): Readonly<Record<string, any>>;
|
|
5
5
|
export declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void;
|
|
6
6
|
export declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
@@ -17,7 +17,7 @@ export function updateEnvOptions() {
|
|
|
17
17
|
asyncRuntimeStorage.set(_sharedRuntimeConfig);
|
|
18
18
|
return envOptions;
|
|
19
19
|
}
|
|
20
|
-
export function useSilgiRuntimeConfig(event
|
|
20
|
+
export function useSilgiRuntimeConfig(event) {
|
|
21
21
|
const runtime = useRuntime();
|
|
22
22
|
if (!event) {
|
|
23
23
|
return runtime;
|