silgi 0.20.10 → 0.20.12

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.10";
1
+ const version = "0.20.12";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -906,7 +906,11 @@ async function prepareServerFiles(silgi) {
906
906
  const scanned = {
907
907
  uris: {},
908
908
  services: [],
909
- shareds: [],
909
+ shareds: [
910
+ `createShared({
911
+ modulesURIs,
912
+ })`
913
+ ],
910
914
  schemas: [],
911
915
  modulesURIs: {},
912
916
  customImports: [],
@@ -966,7 +970,6 @@ async function prepareServerFiles(silgi) {
966
970
  scanned.services.length > 0 ? "])" : "}",
967
971
  "",
968
972
  scanned.shareds.length > 0 ? "export const shareds = mergeShared([" : "export const shareds = {",
969
- " modulesURIs,",
970
973
  ...scanned.shareds.map((name) => {
971
974
  return ` ${name},`;
972
975
  }),
@@ -2141,7 +2144,7 @@ async function prepareSchema(silgi) {
2141
2144
  shareds: [
2142
2145
  {
2143
2146
  key: "modulesURIs",
2144
- value: "typeof modulesURIs"
2147
+ value: "{ modulesURIs: typeof modulesURIs }"
2145
2148
  }
2146
2149
  ],
2147
2150
  events: [],
@@ -2,6 +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';
5
6
  import { IncomingMessage } from 'node:http';
6
7
 
7
8
  declare function hasError(type: SilgiCLI['errors'][0]['type'], silgi?: SilgiCLI): boolean;
@@ -122,6 +123,7 @@ declare function addTemplate<T>(_template: SilgiTemplate<T> | string): ResolvedS
122
123
  declare function normalizeTemplate<T>(template: SilgiTemplate<T> | string, buildDir?: string): ResolvedSilgiTemplate<T>;
123
124
 
124
125
  declare function useRequest(event: SilgiEvents): IncomingMessage;
126
+ declare function useResponse(event: SilgiEvents): IncomingMessage | http.ServerResponse<IncomingMessage>;
125
127
  declare function getIpAddress(event: SilgiEvents): string | false;
126
128
  /**
127
129
  * Extract the client's IP address from request headers with high accuracy
@@ -150,4 +152,4 @@ declare const MODE_RE: RegExp;
150
152
  declare function hasSilgiModule(moduleKey: string, silgi?: SilgiCLI): boolean;
151
153
  declare function hasInstalledModule(moduleKey: string, silgi?: SilgiCLI): boolean;
152
154
 
153
- export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, getIpAddress, hasError, hasInstalledModule, hasSilgiModule, hash, initRuntimeConfig, ipAddress, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, parseServices, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useSilgiRuntimeConfig, writeFile };
155
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, getIpAddress, hasError, hasInstalledModule, hasSilgiModule, hash, initRuntimeConfig, ipAddress, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, parseServices, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, useSilgiRuntimeConfig, writeFile };
@@ -2,6 +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';
5
6
  import { IncomingMessage } from 'node:http';
6
7
 
7
8
  declare function hasError(type: SilgiCLI['errors'][0]['type'], silgi?: SilgiCLI): boolean;
@@ -122,6 +123,7 @@ declare function addTemplate<T>(_template: SilgiTemplate<T> | string): ResolvedS
122
123
  declare function normalizeTemplate<T>(template: SilgiTemplate<T> | string, buildDir?: string): ResolvedSilgiTemplate<T>;
123
124
 
124
125
  declare function useRequest(event: SilgiEvents): IncomingMessage;
126
+ declare function useResponse(event: SilgiEvents): IncomingMessage | http.ServerResponse<IncomingMessage>;
125
127
  declare function getIpAddress(event: SilgiEvents): string | false;
126
128
  /**
127
129
  * Extract the client's IP address from request headers with high accuracy
@@ -150,4 +152,4 @@ declare const MODE_RE: RegExp;
150
152
  declare function hasSilgiModule(moduleKey: string, silgi?: SilgiCLI): boolean;
151
153
  declare function hasInstalledModule(moduleKey: string, silgi?: SilgiCLI): boolean;
152
154
 
153
- export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, getIpAddress, hasError, hasInstalledModule, hasSilgiModule, hash, initRuntimeConfig, ipAddress, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, parseServices, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useSilgiRuntimeConfig, writeFile };
155
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, getIpAddress, hasError, hasInstalledModule, hasSilgiModule, hash, initRuntimeConfig, ipAddress, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, parseServices, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, useSilgiRuntimeConfig, writeFile };
@@ -478,6 +478,13 @@ function useRequest(event) {
478
478
  }
479
479
  return event;
480
480
  }
481
+ function useResponse(event) {
482
+ const silgi = useSilgi();
483
+ if (silgi.options.present === "nuxt" || silgi.options.present === "nitro" || silgi.options.present === "h3") {
484
+ return event.node.res;
485
+ }
486
+ return event;
487
+ }
481
488
  function getIpAddress(event) {
482
489
  const silgi = useSilgi();
483
490
  if (silgi.options.present === "nuxt" || silgi.options.present === "nitro" || silgi.options.present === "h3") {
@@ -552,4 +559,4 @@ function isValidIp(ip) {
552
559
  return false;
553
560
  }
554
561
 
555
- export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, getIpAddress, hasInstalledModule, hasSilgiModule, hash, initRuntimeConfig, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, parseServices, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useSilgiRuntimeConfig, writeFile };
562
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, getIpAddress, hasInstalledModule, hasSilgiModule, hash, initRuntimeConfig, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, parseServices, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, useSilgiRuntimeConfig, writeFile };
@@ -1,4 +1,4 @@
1
- const version = "0.20.10";
1
+ const version = "0.20.12";
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.10";
1
+ const version = "0.20.12";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.20.10",
4
+ "version": "0.20.12",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {