silgi 0.29.29 → 0.29.31
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/index.mjs +1 -1
- package/dist/cli/silgi.mjs +12 -3
- package/dist/core/index.mjs +3 -4
- package/dist/index.mjs +1 -0
- package/dist/kit/index.d.mts +2 -1
- package/dist/kit/index.mjs +6 -2
- package/dist/types/index.d.mts +2 -0
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/cli/silgi.mjs
CHANGED
|
@@ -227,7 +227,8 @@ async function prepareCommands(silgi = useSilgiCLI()) {
|
|
|
227
227
|
...Object.fromEntries(Array.from(allTags.values()).map((tag) => [tag, "string"]))
|
|
228
228
|
}
|
|
229
229
|
}),
|
|
230
|
-
""
|
|
230
|
+
"",
|
|
231
|
+
"export {}"
|
|
231
232
|
];
|
|
232
233
|
addTemplate({
|
|
233
234
|
filename: "types/commands.d.ts",
|
|
@@ -364,10 +365,18 @@ async function prepareCoreFile(silgi) {
|
|
|
364
365
|
addBuildFunction: (data) => {
|
|
365
366
|
for (const item of toArray(data)) {
|
|
366
367
|
if (item.where === "after") {
|
|
367
|
-
|
|
368
|
+
if (item.custom) {
|
|
369
|
+
after.push(item.custom);
|
|
370
|
+
} else {
|
|
371
|
+
after.push(item.params?.length ? ` await ${item.name}(option, ${item.params.join(",")})` : ` await ${item.name}(option)`);
|
|
372
|
+
}
|
|
368
373
|
}
|
|
369
374
|
if (item.where === "before") {
|
|
370
|
-
|
|
375
|
+
if (item.custom) {
|
|
376
|
+
before.push(item.custom);
|
|
377
|
+
} else {
|
|
378
|
+
before.push(item.params?.length ? ` await ${item.name}(option, ${item.params.join(",")})` : ` await ${item.name}(option)`);
|
|
379
|
+
}
|
|
371
380
|
}
|
|
372
381
|
}
|
|
373
382
|
}
|
package/dist/core/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { Buffer } from 'node:buffer';
|
|
|
7
7
|
import { klona } from 'klona';
|
|
8
8
|
import { useSilgiRuntimeConfig } from 'silgi/runtime';
|
|
9
9
|
import { createStorage as createStorage$1, builtinDrivers, prefixStorage } from 'unstorage';
|
|
10
|
+
import { isRuntimePresents } from 'silgi/kit';
|
|
10
11
|
export { s as silgiCLICtx, t as tryUseSilgiCLI, u as useSilgiCLI } from '../_chunks/silgiApp.mjs';
|
|
11
12
|
import 'ufo';
|
|
12
13
|
|
|
@@ -718,16 +719,14 @@ function mergeShared(sharedOrArray) {
|
|
|
718
719
|
}
|
|
719
720
|
|
|
720
721
|
function getEvent(event) {
|
|
721
|
-
|
|
722
|
-
if (silgi.options.present === "h3" || silgi.options.present === "nitro" || silgi.options.present === "nuxt") {
|
|
722
|
+
if (isRuntimePresents(["h3", "nitro", "nuxt"])) {
|
|
723
723
|
return event;
|
|
724
724
|
}
|
|
725
725
|
return event;
|
|
726
726
|
}
|
|
727
727
|
function getEventContext(event) {
|
|
728
|
-
const silgi = useSilgi();
|
|
729
728
|
const _event = getEvent(event);
|
|
730
|
-
if (
|
|
729
|
+
if (isRuntimePresents(["h3", "nitro", "nuxt"])) {
|
|
731
730
|
return _event.context;
|
|
732
731
|
}
|
|
733
732
|
return _event;
|
package/dist/index.mjs
CHANGED
package/dist/kit/index.d.mts
CHANGED
|
@@ -312,6 +312,7 @@ declare function hasInstalledModule(moduleKey: string, silgi?: SilgiCLI): boolea
|
|
|
312
312
|
declare const baseHeaderBannerComment: string[];
|
|
313
313
|
declare function processFilePath(src: string): string;
|
|
314
314
|
declare function isPresents(names: PresetName[]): boolean;
|
|
315
|
+
declare function isRuntimePresents(names: PresetName[]): boolean;
|
|
315
316
|
|
|
316
|
-
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory, isH3, isNitro, isNuxt, isPresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|
|
317
|
+
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|
|
317
318
|
export type { FunctionConfig, JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult };
|
package/dist/kit/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as useSilgiCLI$1 } from '../_chunks/silgiApp.mjs';
|
|
2
2
|
import { relative, resolve, dirname, join, normalize, isAbsolute, parse, basename } from 'pathe';
|
|
3
|
-
import { useSilgiCLI,
|
|
3
|
+
import { useSilgiCLI, useSilgi, tryUseSilgiCLI } from 'silgi';
|
|
4
4
|
import { toArray as toArray$1, hash as hash$2 } from 'silgi/kit';
|
|
5
5
|
import { execSync } from 'node:child_process';
|
|
6
6
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
@@ -64,6 +64,10 @@ function isPresents(names) {
|
|
|
64
64
|
const silgi = useSilgiCLI();
|
|
65
65
|
return names.filter((name) => silgi.options.preset.includes(name)).length > 0;
|
|
66
66
|
}
|
|
67
|
+
function isRuntimePresents(names) {
|
|
68
|
+
const silgi = useSilgi();
|
|
69
|
+
return names.filter((name) => silgi.options.preset.includes(name)).length > 0;
|
|
70
|
+
}
|
|
67
71
|
|
|
68
72
|
async function addCommands(data) {
|
|
69
73
|
useSilgiCLI$1().hook("prepare:commands", (commads) => {
|
|
@@ -1041,4 +1045,4 @@ function isValidIp(ip) {
|
|
|
1041
1045
|
return false;
|
|
1042
1046
|
}
|
|
1043
1047
|
|
|
1044
|
-
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, isPresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|
|
1048
|
+
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -192,10 +192,12 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
192
192
|
addBuildFunction: (data: {
|
|
193
193
|
name: string;
|
|
194
194
|
params?: string[];
|
|
195
|
+
custom?: string;
|
|
195
196
|
where: 'before' | 'after';
|
|
196
197
|
}[] | {
|
|
197
198
|
name: string;
|
|
198
199
|
params?: string[];
|
|
200
|
+
custom?: string;
|
|
199
201
|
where: 'before' | 'after';
|
|
200
202
|
}) => void;
|
|
201
203
|
}) => HookResult;
|