silgi 0.38.2 → 0.38.4

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.38.2";
4
+ const version = "0.38.4";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -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, ServerResponse } from 'node:http';
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 | boolean;
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 ipAddress(req: Request): string;
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, ipAddress, isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, prettyPath, processFilePath, relativeWithDot, removeExtension, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
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 };
@@ -932,18 +932,7 @@ function useRequest(event) {
932
932
  }
933
933
  return event;
934
934
  }
935
- function useResponse(event) {
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, ipAddress, 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, useResponse, writeFile };
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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.38.2",
4
+ "version": "0.38.4",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {