silgi 0.38.3 → 0.38.5
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/core/index.mjs +1 -1
- package/dist/kit/index.d.mts +6 -5
- package/dist/kit/index.mjs +2 -13
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.mjs
CHANGED
|
@@ -322,7 +322,7 @@ async function createSilgi(config) {
|
|
|
322
322
|
}
|
|
323
323
|
for (const route in silgi.middlewares) {
|
|
324
324
|
const routeObject = silgi.middlewares[route];
|
|
325
|
-
if ("global" in routeObject
|
|
325
|
+
if ("global" in routeObject) {
|
|
326
326
|
const global = routeObject.global ?? false;
|
|
327
327
|
const method = routeObject.method ?? false;
|
|
328
328
|
if (global && !method) {
|
package/dist/kit/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { PresetName } from 'silgi/presets';
|
|
|
3
3
|
import { Buffer } from 'node:buffer';
|
|
4
4
|
import { ConsolaOptions, ConsolaInstance } from 'consola';
|
|
5
5
|
import * as rfc6902 from 'rfc6902';
|
|
6
|
-
import { IncomingMessage
|
|
6
|
+
import { IncomingMessage } from 'node:http';
|
|
7
7
|
|
|
8
8
|
declare function addCommands(data: Commands | Commands[]): Promise<void>;
|
|
9
9
|
|
|
@@ -275,17 +275,18 @@ declare function addTemplate<T>(_template: SilgiTemplate<T> | string): ResolvedS
|
|
|
275
275
|
*/
|
|
276
276
|
declare function normalizeTemplate<T>(template: SilgiTemplate<T> | string, buildDir?: string): ResolvedSilgiTemplate<T>;
|
|
277
277
|
|
|
278
|
+
/**
|
|
279
|
+
* @deprecated
|
|
280
|
+
*/
|
|
278
281
|
declare function useRequest<T extends IncomingMessage>(event: SilgiEvent): T | (IncomingMessage & {
|
|
279
282
|
originalUrl?: string;
|
|
280
283
|
});
|
|
281
|
-
declare function useResponse<T extends ServerResponse>(event: SilgiEvent): ServerResponse;
|
|
282
|
-
declare function getIpAddress(event: SilgiEvent): string;
|
|
283
284
|
/**
|
|
284
285
|
* Extract the client's IP address from request headers with high accuracy
|
|
285
286
|
* @param req - The incoming HTTP request (Fetch API Request)
|
|
286
287
|
* @returns The client's IP address or empty string if not found
|
|
287
288
|
*/
|
|
288
|
-
declare function
|
|
289
|
+
declare function getIpAddress(req: Request): string;
|
|
289
290
|
|
|
290
291
|
declare function relativeWithDot(from: string, to: string): string;
|
|
291
292
|
declare function toArray<T>(value: T | T[]): T[];
|
|
@@ -311,5 +312,5 @@ declare function isPresents(names: PresetName[]): boolean;
|
|
|
311
312
|
declare function isRuntimePresents(names: PresetName[]): boolean;
|
|
312
313
|
declare function removeExtension(filePath: string, force?: boolean): string;
|
|
313
314
|
|
|
314
|
-
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineFramework, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash,
|
|
315
|
+
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineFramework, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, prettyPath, processFilePath, relativeWithDot, removeExtension, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useRequest, writeFile };
|
|
315
316
|
export type { FunctionConfig, JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult };
|
package/dist/kit/index.mjs
CHANGED
|
@@ -932,18 +932,7 @@ function useRequest(event) {
|
|
|
932
932
|
}
|
|
933
933
|
return event;
|
|
934
934
|
}
|
|
935
|
-
function
|
|
936
|
-
const silgi = useSilgi();
|
|
937
|
-
if (silgi.options.present === "nuxt" || silgi.options.present === "nitro" || silgi.options.present === "h3") {
|
|
938
|
-
return event.node.res;
|
|
939
|
-
}
|
|
940
|
-
return event;
|
|
941
|
-
}
|
|
942
|
-
function getIpAddress(event) {
|
|
943
|
-
const _ipAddress = ipAddress(event.req);
|
|
944
|
-
return _ipAddress;
|
|
945
|
-
}
|
|
946
|
-
function ipAddress(req) {
|
|
935
|
+
function getIpAddress(req) {
|
|
947
936
|
const headers = [
|
|
948
937
|
"cf-connecting-ip",
|
|
949
938
|
// Cloudflare
|
|
@@ -1006,4 +995,4 @@ function isValidIp(ip) {
|
|
|
1006
995
|
return false;
|
|
1007
996
|
}
|
|
1008
997
|
|
|
1009
|
-
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineFramework, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash,
|
|
998
|
+
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineFramework, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, prettyPath, processFilePath, relativeWithDot, removeExtension, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useRequest, writeFile };
|