silgi 0.4.0 → 0.4.2

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,6 +1,6 @@
1
1
  const name = "silgi";
2
2
  const type = "module";
3
- const version = "0.4.0";
3
+ const version = "0.4.2";
4
4
  const packageManager = "pnpm@9.15.1";
5
5
  const sideEffects = false;
6
6
  const exports = {
@@ -41,6 +41,12 @@ async function h3Framework(silgi, skip = false) {
41
41
  ],
42
42
  from: "nitropack/types"
43
43
  };
44
+ data.events.push({
45
+ key: "H3Event",
46
+ value: "H3Event",
47
+ extends: true,
48
+ isSilgiContext: false
49
+ });
44
50
  });
45
51
  silgi.hook("after:prepare:schema.ts", (data) => {
46
52
  data.unshift("type FrameworkContextExtends = NitroApp");
@@ -84,7 +90,13 @@ async function nitroFramework(silgi, skip = false) {
84
90
  await h3Framework(silgi, true);
85
91
  }
86
92
 
87
- const frameworkSetup = [h3Framework, nitroFramework];
93
+ async function nuxtFramework(silgi, skip = false) {
94
+ if (silgi.options.preset !== "nuxt" && skip === false)
95
+ return;
96
+ await nitroFramework(silgi, true);
97
+ }
98
+
99
+ const frameworkSetup = [h3Framework, nitroFramework, nuxtFramework];
88
100
 
89
101
  async function prepare$1(silgi) {
90
102
  await prepareDir(silgi.options.output.dir);
@@ -875,6 +887,10 @@ async function installModules(silgi) {
875
887
  default: true,
876
888
  conditions: silgi.options.conditions
877
889
  });
890
+ if (silgiModule.name !== "silgiNormalizedModule") {
891
+ silgi.scanModules = silgi.scanModules.filter((m) => m.entryPath !== module.entryPath);
892
+ continue;
893
+ }
878
894
  await installModule(silgiModule, silgi);
879
895
  } catch (err) {
880
896
  silgi.logger.error(err);
@@ -1272,7 +1288,6 @@ async function createSilgiCLI(config = {}, opts = {}) {
1272
1288
  close: () => silgi.hooks.callHook("close", silgi),
1273
1289
  storage: undefined,
1274
1290
  scanModules: [],
1275
- _modules: [],
1276
1291
  callHook: hooks.callHook,
1277
1292
  addHooks: hooks.addHooks,
1278
1293
  hook: hooks.hook,
@@ -656,7 +656,7 @@ async function silgiGenerateType(silgi) {
656
656
  jsxFactory: "h",
657
657
  jsxFragmentFactory: "Fragment",
658
658
  allowImportingTsExtensions: true,
659
- customConditions: ["silgiTypes"],
659
+ ...silgi.options.typescript.customConditions ? { customConditions: ["silgiTypes"] } : {},
660
660
  paths: {
661
661
  "#imports": [
662
662
  relativeWithDot(tsconfigDir, join(silgi.options.build.typesDir, "silgi-imports"))
@@ -1,7 +1,7 @@
1
1
  import { Buffer } from 'node:buffer';
2
2
  import { GraphQLSchema } from 'graphql';
3
3
  import { SilgiCLI, GraphQLJSON, SilgiPreset, SilgiPresetMeta } from 'silgi/types';
4
- import { w as ModuleOptions, y as ModuleDefinition, F as SilgiModule } from '../shared/silgi.DSHNePNA.mjs';
4
+ import { w as ModuleOptions, y as ModuleDefinition, F as SilgiModule } from '../shared/silgi.CzUPBllI.mjs';
5
5
  import 'defu';
6
6
  import '@graphql-tools/utils';
7
7
  import 'pkg-types';
@@ -1,7 +1,7 @@
1
1
  import { Buffer } from 'node:buffer';
2
2
  import { GraphQLSchema } from 'graphql';
3
3
  import { SilgiCLI, GraphQLJSON, SilgiPreset, SilgiPresetMeta } from 'silgi/types';
4
- import { w as ModuleOptions, y as ModuleDefinition, F as SilgiModule } from '../shared/silgi.D8h2AAVk.js';
4
+ import { w as ModuleOptions, y as ModuleDefinition, F as SilgiModule } from '../shared/silgi.D_LzzCtJ.js';
5
5
  import 'defu';
6
6
  import '@graphql-tools/utils';
7
7
  import 'pkg-types';
@@ -185,7 +185,7 @@ function _defineSilgiModule(definition) {
185
185
  const options = defu(inlineOptions, nuxtConfigOptions, optionsDefaults);
186
186
  return Promise.resolve(options);
187
187
  }
188
- async function normalizedModule(inlineOptions, silgi = tryUseSilgiCLI()) {
188
+ async function silgiNormalizedModule(inlineOptions, silgi = tryUseSilgiCLI()) {
189
189
  if (!silgi) {
190
190
  throw new TypeError("Cannot use module outside of Silgi context");
191
191
  }
@@ -227,9 +227,9 @@ ${issues.toString()}`);
227
227
  }
228
228
  });
229
229
  }
230
- normalizedModule.getMeta = () => Promise.resolve(module.meta);
231
- normalizedModule.getOptions = getOptions;
232
- return normalizedModule;
230
+ silgiNormalizedModule.getMeta = () => Promise.resolve(module.meta);
231
+ silgiNormalizedModule.getOptions = getOptions;
232
+ return silgiNormalizedModule;
233
233
  }
234
234
 
235
235
  function defineSilgiPreset(preset, meta) {
@@ -1,3 +1,3 @@
1
- const version = "0.4.0";
1
+ const version = "0.4.2";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "0.4.0";
1
+ const version = "0.4.2";
2
2
 
3
3
  export { version };
@@ -1,2 +1,2 @@
1
- declare const _default: readonly [any, any, any];
1
+ declare const _default: readonly [any, any, any, any];
2
2
  export default _default;
@@ -1,8 +1,10 @@
1
1
  import _h3 from "./h3/preset.mjs";
2
2
  import _nitro from "./nitro/preset.mjs";
3
3
  import _npmpackage from "./npmpackage/preset.mjs";
4
+ import _nuxt from "./nuxt/preset.mjs";
4
5
  export default [
5
6
  ..._h3,
6
7
  ..._nitro,
7
- ..._npmpackage
8
+ ..._npmpackage,
9
+ ..._nuxt
8
10
  ];
@@ -1,5 +1,5 @@
1
1
  export interface PresetOptions {
2
2
  }
3
3
  export declare const presetsWithConfig: readonly [];
4
- export type PresetName = "h3" | "nitro" | "npm-package";
5
- export type PresetNameInput = "h3" | "nitro" | "npm-package" | "npmPackage" | "npm_package" | (string & {});
4
+ export type PresetName = "h3" | "nitro" | "npm-package" | "nuxt";
5
+ export type PresetNameInput = "h3" | "nitro" | "npm-package" | "npmPackage" | "npm_package" | "nuxt" | (string & {});
@@ -0,0 +1,2 @@
1
+ declare const _default: readonly [any];
2
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { defineSilgiPreset } from "silgi/kit";
2
+ const nuxt = defineSilgiPreset(
3
+ {
4
+ static: true,
5
+ output: {
6
+ dir: "{{ rootDir }}/.output",
7
+ publicDir: "{{ output.dir }}/public"
8
+ },
9
+ prerender: {
10
+ crawlLinks: true
11
+ },
12
+ typescript: {
13
+ generateTsConfig: false,
14
+ tsconfigPath: ".nuxt/silgi.tsconfig.json"
15
+ },
16
+ commands: {
17
+ preview: "npx serve ./public"
18
+ }
19
+ },
20
+ {
21
+ name: "nuxt",
22
+ static: true,
23
+ url: import.meta.url
24
+ }
25
+ );
26
+ export default [nuxt];
@@ -43,7 +43,7 @@ type BaseSchemaType<T extends StandardSchemaV1> = {
43
43
  [Action in BaseSilgiMethodType]?: Record<string, {
44
44
  input?: T;
45
45
  output?: T;
46
- routerParams?: T;
46
+ router?: T;
47
47
  }>;
48
48
  };
49
49
 
@@ -43,7 +43,7 @@ type BaseSchemaType<T extends StandardSchemaV1> = {
43
43
  [Action in BaseSilgiMethodType]?: Record<string, {
44
44
  input?: T;
45
45
  output?: T;
46
- routerParams?: T;
46
+ router?: T;
47
47
  }>;
48
48
  };
49
49
 
@@ -1,5 +1,5 @@
1
- import { D as DefaultNamespaces, B as BaseSchemaType, S as SilgiServiceInterface } from '../shared/silgi.DSHNePNA.mjs';
2
- export { A as AppConfig, o as Awaitable, l as BaseSilgiMethodType, W as CaptureError, V as CapturedErrorContext, C as CreateScope, n as DeepPartial, m as DefaultHooks, N as EventHandlerResponse, a2 as ExtendShared, ae as ExtractInputFromURI, af as ExtractOutputFromURI, ag as ExtractRouterParamsFromURI, a3 as FrameworkContext, a7 as ImportItem, L as LoadConfigOptions, Y as MergedSilgiSchema, O as MethodHandlerType, Q as MethodResponse, K as MethodSchemaType, G as ModuleConfigurations, y as ModuleDefinition, v as ModuleHookContext, M as ModuleMeta, w as ModuleOptions, z as ModuleSetupInstallResult, E as ModuleSetupReturn, ab as NitroBuildInfo, _ as RequiredServiceType, P as ResolvedMethodHandlerType, R as ResolvedModuleMeta, x as ResolvedModuleOptions, $ as ResolvedServiceType, Z as ServiceType, a4 as Silgi, U as SilgiAppPlugin, a8 as SilgiCLI, b as SilgiCLIConfig, a9 as SilgiCLIDynamicConfig, c as SilgiCLIHooks, a as SilgiCLIOptions, u as SilgiCompatibility, d as SilgiCompatibilityIssue, e as SilgiCompatibilityIssues, a5 as SilgiConfig, a0 as SilgiDefaultShared, g as SilgiEvent, aa as SilgiFrameworkInfo, a6 as SilgiFunction, k as SilgiHook, p as SilgiHooks, h as SilgiMethods, F as SilgiModule, t as SilgiModuleInput, r as SilgiModuleMethods, s as SilgiModuleOptions, a1 as SilgiModuleShared, q as SilgiModules, i as SilgiNamespaces, H as SilgiOperation, f as SilgiOptions, I as SilgiPreset, J as SilgiPresetMeta, j as SilgiRouterTypes, X as SilgiSchema, ai as SilgiStorageBase, ac as SilgiURIs, ak as StorageConfig, aj as StorageKeyGenerator, al as StorageKeyParams, ah as StorageMounts, T as TSReference, ad as URIsTypes } from '../shared/silgi.DSHNePNA.mjs';
1
+ import { D as DefaultNamespaces, B as BaseSchemaType, S as SilgiServiceInterface } from '../shared/silgi.CzUPBllI.mjs';
2
+ export { A as AppConfig, o as Awaitable, l as BaseSilgiMethodType, W as CaptureError, V as CapturedErrorContext, C as CreateScope, n as DeepPartial, m as DefaultHooks, N as EventHandlerResponse, a2 as ExtendShared, ae as ExtractInputFromURI, af as ExtractOutputFromURI, ag as ExtractRouterParamsFromURI, a3 as FrameworkContext, a7 as ImportItem, L as LoadConfigOptions, Y as MergedSilgiSchema, O as MethodHandlerType, Q as MethodResponse, K as MethodSchemaType, G as ModuleConfigurations, y as ModuleDefinition, v as ModuleHookContext, M as ModuleMeta, w as ModuleOptions, z as ModuleSetupInstallResult, E as ModuleSetupReturn, ab as NitroBuildInfo, _ as RequiredServiceType, P as ResolvedMethodHandlerType, R as ResolvedModuleMeta, x as ResolvedModuleOptions, $ as ResolvedServiceType, Z as ServiceType, a4 as Silgi, U as SilgiAppPlugin, a8 as SilgiCLI, b as SilgiCLIConfig, a9 as SilgiCLIDynamicConfig, c as SilgiCLIHooks, a as SilgiCLIOptions, u as SilgiCompatibility, d as SilgiCompatibilityIssue, e as SilgiCompatibilityIssues, a5 as SilgiConfig, a0 as SilgiDefaultShared, g as SilgiEvent, aa as SilgiFrameworkInfo, a6 as SilgiFunction, k as SilgiHook, p as SilgiHooks, h as SilgiMethods, F as SilgiModule, t as SilgiModuleInput, r as SilgiModuleMethods, s as SilgiModuleOptions, a1 as SilgiModuleShared, q as SilgiModules, i as SilgiNamespaces, H as SilgiOperation, f as SilgiOptions, I as SilgiPreset, J as SilgiPresetMeta, j as SilgiRouterTypes, X as SilgiSchema, ai as SilgiStorageBase, ac as SilgiURIs, ak as StorageConfig, aj as StorageKeyGenerator, al as StorageKeyParams, ah as StorageMounts, T as TSReference, ad as URIsTypes } from '../shared/silgi.CzUPBllI.mjs';
3
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
4
4
  import 'defu';
5
5
  import '@graphql-tools/utils';
@@ -1,5 +1,5 @@
1
- import { D as DefaultNamespaces, B as BaseSchemaType, S as SilgiServiceInterface } from '../shared/silgi.D8h2AAVk.js';
2
- export { A as AppConfig, o as Awaitable, l as BaseSilgiMethodType, W as CaptureError, V as CapturedErrorContext, C as CreateScope, n as DeepPartial, m as DefaultHooks, N as EventHandlerResponse, a2 as ExtendShared, ae as ExtractInputFromURI, af as ExtractOutputFromURI, ag as ExtractRouterParamsFromURI, a3 as FrameworkContext, a7 as ImportItem, L as LoadConfigOptions, Y as MergedSilgiSchema, O as MethodHandlerType, Q as MethodResponse, K as MethodSchemaType, G as ModuleConfigurations, y as ModuleDefinition, v as ModuleHookContext, M as ModuleMeta, w as ModuleOptions, z as ModuleSetupInstallResult, E as ModuleSetupReturn, ab as NitroBuildInfo, _ as RequiredServiceType, P as ResolvedMethodHandlerType, R as ResolvedModuleMeta, x as ResolvedModuleOptions, $ as ResolvedServiceType, Z as ServiceType, a4 as Silgi, U as SilgiAppPlugin, a8 as SilgiCLI, b as SilgiCLIConfig, a9 as SilgiCLIDynamicConfig, c as SilgiCLIHooks, a as SilgiCLIOptions, u as SilgiCompatibility, d as SilgiCompatibilityIssue, e as SilgiCompatibilityIssues, a5 as SilgiConfig, a0 as SilgiDefaultShared, g as SilgiEvent, aa as SilgiFrameworkInfo, a6 as SilgiFunction, k as SilgiHook, p as SilgiHooks, h as SilgiMethods, F as SilgiModule, t as SilgiModuleInput, r as SilgiModuleMethods, s as SilgiModuleOptions, a1 as SilgiModuleShared, q as SilgiModules, i as SilgiNamespaces, H as SilgiOperation, f as SilgiOptions, I as SilgiPreset, J as SilgiPresetMeta, j as SilgiRouterTypes, X as SilgiSchema, ai as SilgiStorageBase, ac as SilgiURIs, ak as StorageConfig, aj as StorageKeyGenerator, al as StorageKeyParams, ah as StorageMounts, T as TSReference, ad as URIsTypes } from '../shared/silgi.D8h2AAVk.js';
1
+ import { D as DefaultNamespaces, B as BaseSchemaType, S as SilgiServiceInterface } from '../shared/silgi.D_LzzCtJ.js';
2
+ export { A as AppConfig, o as Awaitable, l as BaseSilgiMethodType, W as CaptureError, V as CapturedErrorContext, C as CreateScope, n as DeepPartial, m as DefaultHooks, N as EventHandlerResponse, a2 as ExtendShared, ae as ExtractInputFromURI, af as ExtractOutputFromURI, ag as ExtractRouterParamsFromURI, a3 as FrameworkContext, a7 as ImportItem, L as LoadConfigOptions, Y as MergedSilgiSchema, O as MethodHandlerType, Q as MethodResponse, K as MethodSchemaType, G as ModuleConfigurations, y as ModuleDefinition, v as ModuleHookContext, M as ModuleMeta, w as ModuleOptions, z as ModuleSetupInstallResult, E as ModuleSetupReturn, ab as NitroBuildInfo, _ as RequiredServiceType, P as ResolvedMethodHandlerType, R as ResolvedModuleMeta, x as ResolvedModuleOptions, $ as ResolvedServiceType, Z as ServiceType, a4 as Silgi, U as SilgiAppPlugin, a8 as SilgiCLI, b as SilgiCLIConfig, a9 as SilgiCLIDynamicConfig, c as SilgiCLIHooks, a as SilgiCLIOptions, u as SilgiCompatibility, d as SilgiCompatibilityIssue, e as SilgiCompatibilityIssues, a5 as SilgiConfig, a0 as SilgiDefaultShared, g as SilgiEvent, aa as SilgiFrameworkInfo, a6 as SilgiFunction, k as SilgiHook, p as SilgiHooks, h as SilgiMethods, F as SilgiModule, t as SilgiModuleInput, r as SilgiModuleMethods, s as SilgiModuleOptions, a1 as SilgiModuleShared, q as SilgiModules, i as SilgiNamespaces, H as SilgiOperation, f as SilgiOptions, I as SilgiPreset, J as SilgiPresetMeta, j as SilgiRouterTypes, X as SilgiSchema, ai as SilgiStorageBase, ac as SilgiURIs, ak as StorageConfig, aj as StorageKeyGenerator, al as StorageKeyParams, ah as StorageMounts, T as TSReference, ad as URIsTypes } from '../shared/silgi.D_LzzCtJ.js';
3
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
4
4
  import 'defu';
5
5
  import '@graphql-tools/utils';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "sideEffects": false,
6
6
  "exports": {
7
7
  "./cli": {