silgi 0.24.18 → 0.24.20
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/dev.mjs +2 -3
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/install.mjs +2 -3
- package/dist/cli/prepare.mjs +2376 -12
- package/dist/core/index.d.mts +34 -34
- package/dist/core/index.mjs +3 -3
- package/dist/index.d.mts +2 -17
- package/dist/index.mjs +2 -33
- package/dist/kit/index.d.mts +20 -19
- package/dist/kit/index.mjs +84 -83
- package/dist/types/index.d.mts +1 -1
- package/package.json +3 -2
- package/dist/cli/writeTypesAndFiles.mjs +0 -2376
- package/dist/_chunks/{routeRules.mjs → silgiApp.mjs} +22 -22
package/dist/core/index.d.mts
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Silgi, SilgiCLI, SilgiConfig, SilgiEvents, SilgiFunction, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, SilgiRuntimeSharedsExtend, SilgiRuntimeContext, DefaultNamespaces, BaseSchemaType, SilgiRuntimeShareds, StorageConfig, SilgiStorageBase } from 'silgi/types';
|
|
1
|
+
import { SilgiConfig, Silgi, SilgiEvents, SilgiFunction, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, SilgiRuntimeSharedsExtend, SilgiRuntimeContext, DefaultNamespaces, BaseSchemaType, SilgiRuntimeShareds, StorageConfig, SilgiCLI, SilgiStorageBase } from 'silgi/types';
|
|
3
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
3
|
import { Storage, StorageValue } from 'unstorage';
|
|
5
|
-
|
|
6
|
-
declare const silgiCtx: unctx.UseContext<Silgi>;
|
|
7
|
-
declare function useSilgi(): Silgi;
|
|
8
|
-
/**
|
|
9
|
-
* Get access to Nuxt instance.
|
|
10
|
-
*
|
|
11
|
-
* Returns null if Nuxt instance is unavailable.
|
|
12
|
-
* @example
|
|
13
|
-
* ```js
|
|
14
|
-
* const silgi = tryUseSilgi()
|
|
15
|
-
* if (silgi) {
|
|
16
|
-
* // Do something
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
declare function tryUseSilgi(): Silgi | null;
|
|
21
|
-
|
|
22
|
-
declare const silgiCLICtx: unctx.UseContext<SilgiCLI>;
|
|
23
|
-
declare function useSilgiCLI(): SilgiCLI;
|
|
24
|
-
/**
|
|
25
|
-
* Get access to Nuxt instance.
|
|
26
|
-
*
|
|
27
|
-
* Returns null if Nuxt instance is unavailable.
|
|
28
|
-
* @example
|
|
29
|
-
* ```js
|
|
30
|
-
* const silgi = tryUseSilgi()
|
|
31
|
-
* if (silgi) {
|
|
32
|
-
* // Do something
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
declare function tryUseSilgiCLI(): SilgiCLI | null;
|
|
4
|
+
import * as unctx from 'unctx';
|
|
37
5
|
|
|
38
6
|
declare function createSilgi(config: SilgiConfig): Promise<Silgi>;
|
|
39
7
|
|
|
@@ -263,6 +231,38 @@ declare class SilgiError extends Error implements BaseError {
|
|
|
263
231
|
}
|
|
264
232
|
declare function isBaseError(error: unknown): error is BaseError;
|
|
265
233
|
|
|
234
|
+
declare const silgiCtx: unctx.UseContext<Silgi>;
|
|
235
|
+
declare function useSilgi(): Silgi;
|
|
236
|
+
/**
|
|
237
|
+
* Get access to Nuxt instance.
|
|
238
|
+
*
|
|
239
|
+
* Returns null if Nuxt instance is unavailable.
|
|
240
|
+
* @example
|
|
241
|
+
* ```js
|
|
242
|
+
* const silgi = tryUseSilgi()
|
|
243
|
+
* if (silgi) {
|
|
244
|
+
* // Do something
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
declare function tryUseSilgi(): Silgi | null;
|
|
249
|
+
|
|
250
|
+
declare const silgiCLICtx: unctx.UseContext<SilgiCLI>;
|
|
251
|
+
declare function useSilgiCLI(): SilgiCLI;
|
|
252
|
+
/**
|
|
253
|
+
* Get access to Nuxt instance.
|
|
254
|
+
*
|
|
255
|
+
* Returns null if Nuxt instance is unavailable.
|
|
256
|
+
* @example
|
|
257
|
+
* ```js
|
|
258
|
+
* const silgi = tryUseSilgi()
|
|
259
|
+
* if (silgi) {
|
|
260
|
+
* // Do something
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
declare function tryUseSilgiCLI(): SilgiCLI | null;
|
|
265
|
+
|
|
266
266
|
declare function storageMount<T extends Storage = Storage>(silgi?: Silgi): (base: keyof SilgiStorageBase, driver: Parameters<Storage['mount']>[1]) => T;
|
|
267
267
|
|
|
268
268
|
declare const autoImportTypes: string[];
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getContext } from 'unctx';
|
|
2
|
-
import { c as createRouteRules } from '../_chunks/routeRules.mjs';
|
|
3
|
-
export { s as silgiCLICtx, t as tryUseSilgiCLI, u as useSilgiCLI } from '../_chunks/routeRules.mjs';
|
|
4
1
|
import { createConsola } from 'consola';
|
|
5
2
|
import defu, { defu as defu$1 } from 'defu';
|
|
6
3
|
import { createHooks } from 'hookable';
|
|
4
|
+
import { c as createRouteRules } from '../_chunks/silgiApp.mjs';
|
|
5
|
+
export { s as silgiCLICtx, t as tryUseSilgiCLI, u as useSilgiCLI } from '../_chunks/silgiApp.mjs';
|
|
6
|
+
import { getContext } from 'unctx';
|
|
7
7
|
import { Buffer } from 'node:buffer';
|
|
8
8
|
import { klona } from 'klona';
|
|
9
9
|
import { useSilgiRuntimeConfig } from 'silgi/runtime';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
export { BaseError, ErrorCategory, ErrorFactory, ErrorMetadata, ErrorSeverity, HttpStatus, SilgiError, autoImportTypes, createSchema, createService, createShared, createSilgi, createStorage, getEvent, getEventContext, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, replaceRuntimeValues, silgi, silgiCLICtx, silgiCtx, storageMount, tryUseSilgi, tryUseSilgiCLI, useSilgi, useSilgiCLI, useSilgiStorage } from './core/index.mjs';
|
|
2
|
-
import
|
|
3
|
-
import 'unctx';
|
|
2
|
+
import 'silgi/types';
|
|
4
3
|
import '@standard-schema/spec';
|
|
5
4
|
import 'unstorage';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Prepares route rules for the build
|
|
9
|
-
*/
|
|
10
|
-
declare function prepareBuild(silgi: SilgiCLI): Promise<void>;
|
|
11
|
-
|
|
12
|
-
declare function prepare(_silgi: SilgiCLI): Promise<void>;
|
|
13
|
-
|
|
14
|
-
declare function createSilgiCLI(config?: SilgiCLIConfig, opts?: LoadConfigOptions): Promise<SilgiCLI>;
|
|
15
|
-
|
|
16
|
-
declare function writeCoreFile(silgi: SilgiCLI): Promise<void>;
|
|
17
|
-
|
|
18
|
-
declare function writeTypesAndFiles(silgi: SilgiCLI): Promise<void>;
|
|
19
|
-
|
|
20
|
-
export { createSilgiCLI, prepare, prepareBuild, writeCoreFile, writeTypesAndFiles };
|
|
5
|
+
import 'unctx';
|
package/dist/index.mjs
CHANGED
|
@@ -1,42 +1,11 @@
|
|
|
1
1
|
export { ErrorCategory, ErrorFactory, ErrorSeverity, HttpStatus, SilgiError, autoImportTypes, createSchema, createService, createShared, createSilgi, createStorage, getEvent, getEventContext, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, replaceRuntimeValues, silgi, silgiCtx, storageMount, tryUseSilgi, useSilgi, useSilgiStorage } from './core/index.mjs';
|
|
2
|
-
export {
|
|
3
|
-
export { s as silgiCLICtx, t as tryUseSilgiCLI, u as useSilgiCLI } from './_chunks/routeRules.mjs';
|
|
4
|
-
import 'unctx';
|
|
2
|
+
export { s as silgiCLICtx, t as tryUseSilgiCLI, u as useSilgiCLI } from './_chunks/silgiApp.mjs';
|
|
5
3
|
import 'consola';
|
|
6
4
|
import 'defu';
|
|
7
5
|
import 'hookable';
|
|
6
|
+
import 'unctx';
|
|
8
7
|
import 'node:buffer';
|
|
9
8
|
import 'klona';
|
|
10
9
|
import 'silgi/runtime';
|
|
11
10
|
import 'unstorage';
|
|
12
|
-
import 'knitwork';
|
|
13
|
-
import 'pathe';
|
|
14
|
-
import 'silgi/kit';
|
|
15
|
-
import 'node:fs';
|
|
16
|
-
import 'node:fs/promises';
|
|
17
|
-
import 'silgi';
|
|
18
|
-
import 'silgi/runtime/meta';
|
|
19
|
-
import 'unimport';
|
|
20
|
-
import '@clack/prompts';
|
|
21
|
-
import 'dotenv';
|
|
22
|
-
import 'mlly';
|
|
23
|
-
import 'dev-jiti';
|
|
24
|
-
import './cli/compatibility.mjs';
|
|
25
|
-
import 'semver/functions/satisfies.js';
|
|
26
|
-
import 'silgi/meta';
|
|
27
|
-
import 'node:url';
|
|
28
|
-
import 'exsolve';
|
|
29
11
|
import 'ufo';
|
|
30
|
-
import 'untyped';
|
|
31
|
-
import 'globby';
|
|
32
|
-
import 'ignore';
|
|
33
|
-
import '@oxc-parser/wasm';
|
|
34
|
-
import './cli/types.mjs';
|
|
35
|
-
import 'c12';
|
|
36
|
-
import 'compatx';
|
|
37
|
-
import 'klona/full';
|
|
38
|
-
import 'std-env';
|
|
39
|
-
import 'consola/utils';
|
|
40
|
-
import 'escape-string-regexp';
|
|
41
|
-
import 'pkg-types';
|
|
42
|
-
import 'pathe/utils';
|
package/dist/kit/index.d.mts
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import { ConsolaOptions, ConsolaInstance } from 'consola';
|
|
2
1
|
import { SilgiCLI, ModuleOptionsCustom, ModuleDefinition, SilgiModule, ServiceParseModule, SilgiPreset, SilgiPresetMeta, SilgiTemplate, ResolvedSilgiTemplate, SilgiEvents } from 'silgi/types';
|
|
3
2
|
import { Buffer } from 'node:buffer';
|
|
3
|
+
import * as consola from 'consola';
|
|
4
|
+
import { ConsolaOptions } from 'consola';
|
|
4
5
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
5
6
|
|
|
6
|
-
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
|
|
7
|
-
|
|
8
7
|
declare function hasError(type: SilgiCLI['errors'][0]['type'], silgi?: SilgiCLI): boolean;
|
|
9
8
|
|
|
9
|
+
declare function directoryToURL(dir: string): URL;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a module from a given root path using an algorithm patterned on
|
|
12
|
+
* the upcoming `import.meta.resolve`. It returns a file URL
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
declare function tryResolveModule(id: string, url?: string | string[]): Promise<string | undefined>;
|
|
17
|
+
|
|
10
18
|
declare function writeFile(file: string, contents: Buffer | string, log?: boolean): Promise<void>;
|
|
11
19
|
declare function isDirectory(path: string): Promise<boolean>;
|
|
12
20
|
|
|
21
|
+
declare function genEnsureSafeVar(name: string | any): string;
|
|
22
|
+
declare function getAllEntries(obj: object): [string, any][];
|
|
23
|
+
|
|
13
24
|
declare function hash(data: any): string;
|
|
14
25
|
|
|
26
|
+
declare function isNuxt(): boolean;
|
|
27
|
+
declare function isNitro(): boolean;
|
|
28
|
+
declare function isH3(): boolean;
|
|
29
|
+
|
|
30
|
+
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola.ConsolaInstance;
|
|
31
|
+
|
|
15
32
|
/**
|
|
16
33
|
* Define a Silgi module, automatically merging defaults with user provided options, installing
|
|
17
34
|
* any hooks that are provided, and calling an optional setup function for full control.
|
|
@@ -110,22 +127,6 @@ declare function getIpAddress(event: SilgiEvents): string | false;
|
|
|
110
127
|
*/
|
|
111
128
|
declare function ipAddress(req: IncomingMessage): string;
|
|
112
129
|
|
|
113
|
-
declare function directoryToURL(dir: string): URL;
|
|
114
|
-
/**
|
|
115
|
-
* Resolve a module from a given root path using an algorithm patterned on
|
|
116
|
-
* the upcoming `import.meta.resolve`. It returns a file URL
|
|
117
|
-
*
|
|
118
|
-
* @internal
|
|
119
|
-
*/
|
|
120
|
-
declare function tryResolveModule(id: string, url?: string | string[]): Promise<string | undefined>;
|
|
121
|
-
|
|
122
|
-
declare function genEnsureSafeVar(name: string | any): string;
|
|
123
|
-
declare function getAllEntries(obj: object): [string, any][];
|
|
124
|
-
|
|
125
|
-
declare function isNuxt(): boolean;
|
|
126
|
-
declare function isNitro(): boolean;
|
|
127
|
-
declare function isH3(): boolean;
|
|
128
|
-
|
|
129
130
|
declare function relativeWithDot(from: string, to: string): string;
|
|
130
131
|
/** @since 3.9.0 */
|
|
131
132
|
declare function toArray<T>(value: T | T[]): T[];
|
package/dist/kit/index.mjs
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import consola$1, { consola } from 'consola';
|
|
2
1
|
import { tryUseSilgiCLI, useSilgiCLI, useSilgi } from 'silgi';
|
|
2
|
+
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
3
|
+
import { resolvePath as resolvePath$1 } from 'mlly';
|
|
3
4
|
import fsp from 'node:fs/promises';
|
|
5
|
+
import consola, { consola as consola$1 } from 'consola';
|
|
4
6
|
import { relative, resolve, dirname, normalize, isAbsolute, join, parse, basename } from 'pathe';
|
|
5
7
|
import { colors } from 'consola/utils';
|
|
6
8
|
import { getProperty } from 'dot-prop';
|
|
9
|
+
import { genString, genObjectFromRaw, genObjectFromValues, genObjectFromRawEntries } from 'knitwork';
|
|
7
10
|
import { hash as hash$1 } from 'ohash';
|
|
8
11
|
import { camelCase } from 'scule';
|
|
9
12
|
import { defu } from 'defu';
|
|
10
13
|
import { c as checkSilgiCompatibility } from '../cli/compatibility.mjs';
|
|
11
14
|
import { withLeadingSlash } from 'ufo';
|
|
12
15
|
import { existsSync, promises } from 'node:fs';
|
|
13
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
14
|
-
import { resolvePath as resolvePath$1 } from 'mlly';
|
|
15
16
|
import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
|
|
16
17
|
import { hash as hash$2 } from 'silgi/kit';
|
|
17
|
-
import { genString, genObjectFromRaw, genObjectFromValues, genObjectFromRawEntries } from 'knitwork';
|
|
18
18
|
import 'semver/functions/satisfies.js';
|
|
19
19
|
import 'silgi/meta';
|
|
20
20
|
|
|
21
|
-
function useLogger(tag, options = {}) {
|
|
22
|
-
return tag ? consola.create(options).withTag(tag) : consola;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
21
|
function hasError(type, silgi) {
|
|
26
22
|
silgi = silgi ?? tryUseSilgiCLI() ?? void 0;
|
|
27
23
|
if (silgi && silgi.errors.some((error) => error.type === type)) {
|
|
@@ -30,6 +26,16 @@ function hasError(type, silgi) {
|
|
|
30
26
|
return false;
|
|
31
27
|
}
|
|
32
28
|
|
|
29
|
+
function directoryToURL(dir) {
|
|
30
|
+
return pathToFileURL(`${dir}/`);
|
|
31
|
+
}
|
|
32
|
+
async function tryResolveModule(id, url = import.meta.url) {
|
|
33
|
+
try {
|
|
34
|
+
return await resolvePath$1(id, { url });
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
function prettyPath(p, highlight = true) {
|
|
34
40
|
p = relative(process.cwd(), p);
|
|
35
41
|
return highlight ? colors.cyan(p) : p;
|
|
@@ -50,7 +56,7 @@ function _compilePathTemplate(contents) {
|
|
|
50
56
|
return (params) => contents.replace(/\{\{ ?([\w.]+) ?\}\}/g, (_, match) => {
|
|
51
57
|
const val = getProperty(params, match);
|
|
52
58
|
if (!val) {
|
|
53
|
-
consola
|
|
59
|
+
consola.warn(
|
|
54
60
|
`cannot resolve template param '${match}' in ${contents.slice(0, 20)}`
|
|
55
61
|
);
|
|
56
62
|
}
|
|
@@ -70,7 +76,7 @@ async function writeFile(file, contents, log = false) {
|
|
|
70
76
|
typeof contents === "string" ? "utf8" : void 0
|
|
71
77
|
);
|
|
72
78
|
if (log) {
|
|
73
|
-
consola.info("Generated", prettyPath(file));
|
|
79
|
+
consola$1.info("Generated", prettyPath(file));
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
async function isDirectory$1(path) {
|
|
@@ -81,10 +87,78 @@ async function isDirectory$1(path) {
|
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
|
|
90
|
+
const reservedCode = /* @__PURE__ */ new Set([
|
|
91
|
+
"process",
|
|
92
|
+
"global",
|
|
93
|
+
"runtime",
|
|
94
|
+
"runtimeConfig"
|
|
95
|
+
]);
|
|
96
|
+
function genEnsureSafeVar(name) {
|
|
97
|
+
if (typeof name !== "string") {
|
|
98
|
+
return genString(name);
|
|
99
|
+
}
|
|
100
|
+
for (const reserved of reservedCode) {
|
|
101
|
+
if (name === reserved || name.startsWith(`${reserved}.`)) {
|
|
102
|
+
return name;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return genString(name);
|
|
106
|
+
}
|
|
107
|
+
function getAllEntries(obj) {
|
|
108
|
+
return Object.entries(obj).map(([
|
|
109
|
+
key,
|
|
110
|
+
value
|
|
111
|
+
]) => {
|
|
112
|
+
if (typeof value === "function") {
|
|
113
|
+
return [key, genObjectFromRaw(value)];
|
|
114
|
+
}
|
|
115
|
+
if (typeof value === "string") {
|
|
116
|
+
return [key, genEnsureSafeVar(value)];
|
|
117
|
+
}
|
|
118
|
+
if (typeof value === "object" && value !== null) {
|
|
119
|
+
if (Array.isArray(value)) {
|
|
120
|
+
return [key, genObjectFromValues(value.map(
|
|
121
|
+
(item) => typeof item === "object" && item !== null ? genObjectFromRawEntries(getAllEntries(item)) : item
|
|
122
|
+
))];
|
|
123
|
+
} else {
|
|
124
|
+
return [key, genObjectFromRawEntries(getAllEntries(value))];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return [key, value];
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
84
131
|
function hash(data) {
|
|
85
132
|
return camelCase(hash$1(data));
|
|
86
133
|
}
|
|
87
134
|
|
|
135
|
+
function isNuxt() {
|
|
136
|
+
const silgi = useSilgi();
|
|
137
|
+
if (silgi.options.present === "nitro" || silgi.options.present === "h3" || silgi.options.present === "nuxt") {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
function isNitro() {
|
|
143
|
+
const silgi = useSilgi();
|
|
144
|
+
if (silgi.options.present === "nitro" || silgi.options.present === "h3") {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
function isH3() {
|
|
150
|
+
const silgi = useSilgi();
|
|
151
|
+
if (silgi.options.present === "h3") {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const logger = consola$1;
|
|
158
|
+
function useLogger(tag, options = {}) {
|
|
159
|
+
return tag ? logger.create(options).withTag(tag) : logger;
|
|
160
|
+
}
|
|
161
|
+
|
|
88
162
|
function defineSilgiModule(definition) {
|
|
89
163
|
if (definition) {
|
|
90
164
|
return _defineSilgiModule(definition);
|
|
@@ -452,77 +526,4 @@ function isValidIp(ip) {
|
|
|
452
526
|
return false;
|
|
453
527
|
}
|
|
454
528
|
|
|
455
|
-
function directoryToURL(dir) {
|
|
456
|
-
return pathToFileURL(`${dir}/`);
|
|
457
|
-
}
|
|
458
|
-
async function tryResolveModule(id, url = import.meta.url) {
|
|
459
|
-
try {
|
|
460
|
-
return await resolvePath$1(id, { url });
|
|
461
|
-
} catch {
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
const reservedCode = /* @__PURE__ */ new Set([
|
|
466
|
-
"process",
|
|
467
|
-
"global",
|
|
468
|
-
"runtime",
|
|
469
|
-
"runtimeConfig"
|
|
470
|
-
]);
|
|
471
|
-
function genEnsureSafeVar(name) {
|
|
472
|
-
if (typeof name !== "string") {
|
|
473
|
-
return genString(name);
|
|
474
|
-
}
|
|
475
|
-
for (const reserved of reservedCode) {
|
|
476
|
-
if (name === reserved || name.startsWith(`${reserved}.`)) {
|
|
477
|
-
return name;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return genString(name);
|
|
481
|
-
}
|
|
482
|
-
function getAllEntries(obj) {
|
|
483
|
-
return Object.entries(obj).map(([
|
|
484
|
-
key,
|
|
485
|
-
value
|
|
486
|
-
]) => {
|
|
487
|
-
if (typeof value === "function") {
|
|
488
|
-
return [key, genObjectFromRaw(value)];
|
|
489
|
-
}
|
|
490
|
-
if (typeof value === "string") {
|
|
491
|
-
return [key, genEnsureSafeVar(value)];
|
|
492
|
-
}
|
|
493
|
-
if (typeof value === "object" && value !== null) {
|
|
494
|
-
if (Array.isArray(value)) {
|
|
495
|
-
return [key, genObjectFromValues(value.map(
|
|
496
|
-
(item) => typeof item === "object" && item !== null ? genObjectFromRawEntries(getAllEntries(item)) : item
|
|
497
|
-
))];
|
|
498
|
-
} else {
|
|
499
|
-
return [key, genObjectFromRawEntries(getAllEntries(value))];
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
return [key, value];
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
function isNuxt() {
|
|
507
|
-
const silgi = useSilgi();
|
|
508
|
-
if (silgi.options.present === "nitro" || silgi.options.present === "h3" || silgi.options.present === "nuxt") {
|
|
509
|
-
return true;
|
|
510
|
-
}
|
|
511
|
-
return false;
|
|
512
|
-
}
|
|
513
|
-
function isNitro() {
|
|
514
|
-
const silgi = useSilgi();
|
|
515
|
-
if (silgi.options.present === "nitro" || silgi.options.present === "h3") {
|
|
516
|
-
return true;
|
|
517
|
-
}
|
|
518
|
-
return false;
|
|
519
|
-
}
|
|
520
|
-
function isH3() {
|
|
521
|
-
const silgi = useSilgi();
|
|
522
|
-
if (silgi.options.present === "h3") {
|
|
523
|
-
return true;
|
|
524
|
-
}
|
|
525
|
-
return false;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
529
|
export { MODE_RE, addTemplate, baseHeaderBannerComment, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, genEnsureSafeVar, getAllEntries, getIpAddress, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -578,7 +578,7 @@ interface SilgiCLIOptions extends PresetOptions {
|
|
|
578
578
|
commandType: CommandType;
|
|
579
579
|
routeRules: SilgiRouteRules$1;
|
|
580
580
|
environments: DotenvOptions$1[];
|
|
581
|
-
activeEnvironment:
|
|
581
|
+
activeEnvironment: string;
|
|
582
582
|
envOptions: EnvOptions$1;
|
|
583
583
|
runtimeConfig: SilgiRuntimeConfig$1 & {
|
|
584
584
|
[key: string]: any;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silgi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.24.
|
|
4
|
+
"version": "0.24.20",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
8
8
|
"./package.json": "./package.json",
|
|
9
|
-
".": "./dist/index.mjs",
|
|
9
|
+
".": "./dist/core/index.mjs",
|
|
10
|
+
"./core": "./dist/core/index.mjs",
|
|
10
11
|
"./cli": "./dist/cli/index.mjs",
|
|
11
12
|
"./cli/config": "./dist/cli/config/index.mjs",
|
|
12
13
|
"./kit": "./dist/kit/index.mjs",
|