silgi 0.20.12 → 0.20.14

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,4 +1,4 @@
1
- const version = "0.20.12";
1
+ const version = "0.20.14";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
package/dist/cli/dev.mjs CHANGED
@@ -54,6 +54,7 @@ async function reloadScan(silgi, path, _stats) {
54
54
  if (!hasError("Parser", silgi)) {
55
55
  await writeScanFiles(silgi);
56
56
  }
57
+ await silgi.callHook("reload:scan", path, _stats);
57
58
  silgi.errors = [];
58
59
  const endTime = performance.now();
59
60
  const elapsedTime = Math.round(endTime - startTime);
@@ -2,8 +2,7 @@ import { SilgiCLI, ModuleOptionsCustom, ModuleDefinition, SilgiModule, ServicePa
2
2
  import { Buffer } from 'node:buffer';
3
3
  import * as consola from 'consola';
4
4
  import { ConsolaOptions } from 'consola';
5
- import * as http from 'http';
6
- import { IncomingMessage } from 'node:http';
5
+ import { IncomingMessage, ServerResponse } from 'node:http';
7
6
 
8
7
  declare function hasError(type: SilgiCLI['errors'][0]['type'], silgi?: SilgiCLI): boolean;
9
8
 
@@ -122,8 +121,10 @@ declare function addTemplate<T>(_template: SilgiTemplate<T> | string): ResolvedS
122
121
  */
123
122
  declare function normalizeTemplate<T>(template: SilgiTemplate<T> | string, buildDir?: string): ResolvedSilgiTemplate<T>;
124
123
 
125
- declare function useRequest(event: SilgiEvents): IncomingMessage;
126
- declare function useResponse(event: SilgiEvents): IncomingMessage | http.ServerResponse<IncomingMessage>;
124
+ declare function useRequest<T extends IncomingMessage>(event: SilgiEvents): T | (IncomingMessage & {
125
+ originalUrl?: string;
126
+ });
127
+ declare function useResponse<T extends ServerResponse>(event: SilgiEvents): ServerResponse<IncomingMessage>;
127
128
  declare function getIpAddress(event: SilgiEvents): string | false;
128
129
  /**
129
130
  * Extract the client's IP address from request headers with high accuracy
@@ -2,8 +2,7 @@ import { SilgiCLI, ModuleOptionsCustom, ModuleDefinition, SilgiModule, ServicePa
2
2
  import { Buffer } from 'node:buffer';
3
3
  import * as consola from 'consola';
4
4
  import { ConsolaOptions } from 'consola';
5
- import * as http from 'http';
6
- import { IncomingMessage } from 'node:http';
5
+ import { IncomingMessage, ServerResponse } from 'node:http';
7
6
 
8
7
  declare function hasError(type: SilgiCLI['errors'][0]['type'], silgi?: SilgiCLI): boolean;
9
8
 
@@ -122,8 +121,10 @@ declare function addTemplate<T>(_template: SilgiTemplate<T> | string): ResolvedS
122
121
  */
123
122
  declare function normalizeTemplate<T>(template: SilgiTemplate<T> | string, buildDir?: string): ResolvedSilgiTemplate<T>;
124
123
 
125
- declare function useRequest(event: SilgiEvents): IncomingMessage;
126
- declare function useResponse(event: SilgiEvents): IncomingMessage | http.ServerResponse<IncomingMessage>;
124
+ declare function useRequest<T extends IncomingMessage>(event: SilgiEvents): T | (IncomingMessage & {
125
+ originalUrl?: string;
126
+ });
127
+ declare function useResponse<T extends ServerResponse>(event: SilgiEvents): ServerResponse<IncomingMessage>;
127
128
  declare function getIpAddress(event: SilgiEvents): string | false;
128
129
  /**
129
130
  * Extract the client's IP address from request headers with high accuracy
@@ -1,4 +1,4 @@
1
- const version = "0.20.12";
1
+ const version = "0.20.14";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -1,4 +1,4 @@
1
- const version = "0.20.12";
1
+ const version = "0.20.14";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -9,6 +9,7 @@ import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
9
9
  import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, RouteRules as RouteRules$1, ModuleMeta as ModuleMeta$1, SilgiRouteRules as SilgiRouteRules$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$1, SilgiRuntimeConfig as SilgiRuntimeConfig$1, ServiceParseModule as ServiceParseModule$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
10
10
  import { UnimportPluginOptions } from 'unimport/unplugin';
11
11
  import { Defu } from 'defu';
12
+ import { Stats } from 'node:fs';
12
13
  import { Unimport } from 'unimport';
13
14
  import { Storage, TransactionOptions, BuiltinDriverName, StorageValue } from 'unstorage';
14
15
  import { StandardSchemaV1 } from '@standard-schema/spec';
@@ -233,6 +234,7 @@ interface SilgiCLIHooks extends SilgiHooks {
233
234
  * @returns Promise
234
235
  */
235
236
  'close': (silgi: SilgiCLI) => HookResult;
237
+ 'reload:scan': (path: string, stats?: Stats) => HookResult;
236
238
  'prepare:createCoreFramework': (options: Pick<ImportItem, 'customImports' | 'importItems'> & {
237
239
  functions?: {
238
240
  name: string;
@@ -9,6 +9,7 @@ import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
9
9
  import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, RouteRules as RouteRules$1, ModuleMeta as ModuleMeta$1, SilgiRouteRules as SilgiRouteRules$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$1, SilgiRuntimeConfig as SilgiRuntimeConfig$1, ServiceParseModule as ServiceParseModule$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
10
10
  import { UnimportPluginOptions } from 'unimport/unplugin';
11
11
  import { Defu } from 'defu';
12
+ import { Stats } from 'node:fs';
12
13
  import { Unimport } from 'unimport';
13
14
  import { Storage, TransactionOptions, BuiltinDriverName, StorageValue } from 'unstorage';
14
15
  import { StandardSchemaV1 } from '@standard-schema/spec';
@@ -233,6 +234,7 @@ interface SilgiCLIHooks extends SilgiHooks {
233
234
  * @returns Promise
234
235
  */
235
236
  'close': (silgi: SilgiCLI) => HookResult;
237
+ 'reload:scan': (path: string, stats?: Stats) => HookResult;
236
238
  'prepare:createCoreFramework': (options: Pick<ImportItem, 'customImports' | 'importItems'> & {
237
239
  functions?: {
238
240
  name: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.20.12",
4
+ "version": "0.20.14",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {