silgi 0.19.27 → 0.19.29

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.19.27";
1
+ const version = "0.19.29";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -4,7 +4,7 @@ import consola$1, { consola } from 'consola';
4
4
  import { createHooks, createDebugger } from 'hookable';
5
5
  import { resolve, join, relative, dirname, basename, extname, isAbsolute } from 'pathe';
6
6
  import { useSilgiCLI, silgiCLICtx } from 'silgi/core';
7
- import { relativeWithDot, hash, resolveAlias, directoryToURL, writeFile, parseServices, normalizeTemplate, useLogger, addTemplate, initRuntimeConfig, hasError as hasError$1, resolveSilgiPath, isDirectory } from 'silgi/kit';
7
+ import { relativeWithDot, hash, resolveAlias, directoryToURL, addTemplate, writeFile, parseServices, normalizeTemplate, useLogger, initRuntimeConfig, hasError as hasError$1, resolveSilgiPath, isDirectory } from 'silgi/kit';
8
8
  import { runtimeDir } from 'silgi/runtime/meta';
9
9
  import { autoImportTypes } from 'silgi/types';
10
10
  import { scanExports, createUnimport, toExports } from 'unimport';
@@ -18,6 +18,7 @@ import { fileURLToPath } from 'node:url';
18
18
  import defu, { defu as defu$1 } from 'defu';
19
19
  import { resolveModuleURL } from 'exsolve';
20
20
  import { isRelative, withTrailingSlash } from 'ufo';
21
+ import { generateTypes, resolveSchema } from 'untyped';
21
22
  import { globby } from 'globby';
22
23
  import ignore from 'ignore';
23
24
  import { parseSync } from '@oxc-parser/wasm';
@@ -26,7 +27,6 @@ import { createStorage, builtinDrivers } from 'unstorage';
26
27
  import { peerDependencies } from 'silgi/meta';
27
28
  import { l as loadOptions, s as silgiGenerateType } from './types.mjs';
28
29
  import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
29
- import { generateTypes, resolveSchema } from 'untyped';
30
30
 
31
31
  async function prepare(_silgi) {
32
32
  }
@@ -713,6 +713,49 @@ ${cycleStr}`);
713
713
  return order;
714
714
  }
715
715
 
716
+ async function commands(silgi) {
717
+ const commands2 = {
718
+ ...silgi.options.commands
719
+ };
720
+ await silgi.callHook("prepare:commands", commands2);
721
+ addTemplate({
722
+ filename: "cli.json",
723
+ where: ".silgi",
724
+ write: true,
725
+ getContents: () => JSON.stringify(commands2, null, 2)
726
+ });
727
+ silgi.hook("prepare:schema.ts", async (object) => {
728
+ console.log("prepare:schema.ts");
729
+ const allTags = Object.values(commands2).reduce((acc, commandGroup) => {
730
+ Object.values(commandGroup).forEach((command) => {
731
+ if (command.tags) {
732
+ command.tags.forEach((tag) => acc.add(tag));
733
+ }
734
+ });
735
+ return acc;
736
+ }, /* @__PURE__ */ new Set());
737
+ const data = [
738
+ "",
739
+ generateTypes(
740
+ await resolveSchema(
741
+ {
742
+ ...Object.fromEntries(Array.from(allTags.values()).map((tag) => [tag, "string"]))
743
+ }
744
+ ),
745
+ {
746
+ interfaceName: "SilgiCommandsExtended",
747
+ addExport: false,
748
+ addDefaults: false,
749
+ allowExtraKeys: false,
750
+ indentation: 0
751
+ }
752
+ ),
753
+ ""
754
+ ];
755
+ object.customImports?.push(...data);
756
+ });
757
+ }
758
+
716
759
  function buildUriMap(silgi, currentPath = []) {
717
760
  const uriMap = /* @__PURE__ */ new Map();
718
761
  function traverse(node, path = []) {
@@ -1456,19 +1499,6 @@ async function compileTemplate(template, ctx) {
1456
1499
  throw new Error(`[nuxt] Invalid template. Templates must have either \`src\` or \`getContents\`: ${JSON.stringify(template)}`);
1457
1500
  }
1458
1501
 
1459
- async function commands(silgi) {
1460
- const commands2 = {
1461
- ...silgi.options.commands
1462
- };
1463
- await silgi.callHook("prepare:commands", commands2);
1464
- addTemplate({
1465
- filename: "cli.json",
1466
- where: ".silgi",
1467
- write: true,
1468
- getContents: () => JSON.stringify(commands2, null, 2)
1469
- });
1470
- }
1471
-
1472
1502
  async function installPackages(silgi) {
1473
1503
  const packages = {
1474
1504
  dependencies: {
@@ -2207,6 +2237,8 @@ async function prepareSchema(silgi) {
2207
2237
  " interface SilgiRuntimeMethods extends RuntimeMethodExtends {}",
2208
2238
  " interface SilgiRuntimeRouteRules extends RuntimeRouteRulesExtends {}",
2209
2239
  " interface SilgiRuntimeRouteRulesConfig extends RuntimeRouteRulesConfigExtends {}",
2240
+ " interface SilgiCommands extends SilgiCommandsExtended {}",
2241
+ "",
2210
2242
  "}",
2211
2243
  "",
2212
2244
  "export {}"
package/dist/cli/dev.mjs CHANGED
@@ -23,6 +23,7 @@ import 'dev-jiti';
23
23
  import 'node:url';
24
24
  import 'defu';
25
25
  import 'exsolve';
26
+ import 'untyped';
26
27
  import 'globby';
27
28
  import 'ignore';
28
29
  import '@oxc-parser/wasm';
@@ -37,7 +38,6 @@ import 'consola/utils';
37
38
  import 'escape-string-regexp';
38
39
  import 'pkg-types';
39
40
  import 'pathe/utils';
40
- import 'untyped';
41
41
 
42
42
  async function reloadScan(silgi, path, _stats) {
43
43
  const startTime = performance.now();
@@ -25,13 +25,13 @@ import 'semver/functions/satisfies.js';
25
25
  import 'node:url';
26
26
  import 'defu';
27
27
  import 'exsolve';
28
+ import 'untyped';
28
29
  import 'globby';
29
30
  import 'ignore';
30
31
  import '@oxc-parser/wasm';
31
32
  import 'klona';
32
33
  import 'unstorage';
33
34
  import 'pathe/utils';
34
- import 'untyped';
35
35
  import 'picocolors';
36
36
  import 'c12';
37
37
  import 'compatx';
@@ -1,4 +1,4 @@
1
- const version = "0.19.27";
1
+ const version = "0.19.29";
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.19.27";
1
+ const version = "0.19.29";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -42,6 +42,8 @@ interface ImportItem {
42
42
  customImports: string[];
43
43
  customContent?: string[];
44
44
  }
45
+ interface SilgiCommands {
46
+ }
45
47
  interface SilgiCLI {
46
48
  _ignore?: Ignore;
47
49
  errors: {
@@ -279,7 +281,7 @@ interface SilgiCLIHooks extends SilgiHooks {
279
281
  type: 'function' | 'command';
280
282
  handler: string;
281
283
  description?: string;
282
- tags?: string[];
284
+ tags?: (keyof SilgiCommands)[];
283
285
  enabled?: boolean;
284
286
  }>>) => HookResult;
285
287
  'prepare:installPackages': (packages: Record<'dependencies' | 'devDependencies', Record<string, string>>) => HookResult;
@@ -1129,4 +1131,4 @@ interface ServiceParseModule {
1129
1131
 
1130
1132
  declare const autoImportTypes: string[];
1131
1133
 
1132
- export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type CaptureError, type CapturedErrorContext, type CommandType, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DefaultRouteConfig, type DefaultRouteRules, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractPathParamsFromURI, type ExtractQueryParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type RouteRules, type ScanFile, type SchemaPreparationOptions, type ServiceParse, type ServiceParseModule, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouteRules, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeConfig, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeRouteRules, type SilgiRuntimeRouteRulesConfig, type SilgiRuntimeShareds, type SilgiRuntimeSharedsExtend, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
1134
+ export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type CaptureError, type CapturedErrorContext, type CommandType, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DefaultRouteConfig, type DefaultRouteRules, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractPathParamsFromURI, type ExtractQueryParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type RouteRules, type ScanFile, type SchemaPreparationOptions, type ServiceParse, type ServiceParseModule, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCommands, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouteRules, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeConfig, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeRouteRules, type SilgiRuntimeRouteRulesConfig, type SilgiRuntimeShareds, type SilgiRuntimeSharedsExtend, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
@@ -42,6 +42,8 @@ interface ImportItem {
42
42
  customImports: string[];
43
43
  customContent?: string[];
44
44
  }
45
+ interface SilgiCommands {
46
+ }
45
47
  interface SilgiCLI {
46
48
  _ignore?: Ignore;
47
49
  errors: {
@@ -279,7 +281,7 @@ interface SilgiCLIHooks extends SilgiHooks {
279
281
  type: 'function' | 'command';
280
282
  handler: string;
281
283
  description?: string;
282
- tags?: string[];
284
+ tags?: (keyof SilgiCommands)[];
283
285
  enabled?: boolean;
284
286
  }>>) => HookResult;
285
287
  'prepare:installPackages': (packages: Record<'dependencies' | 'devDependencies', Record<string, string>>) => HookResult;
@@ -1129,4 +1131,4 @@ interface ServiceParseModule {
1129
1131
 
1130
1132
  declare const autoImportTypes: string[];
1131
1133
 
1132
- export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type CaptureError, type CapturedErrorContext, type CommandType, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DefaultRouteConfig, type DefaultRouteRules, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractPathParamsFromURI, type ExtractQueryParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type RouteRules, type ScanFile, type SchemaPreparationOptions, type ServiceParse, type ServiceParseModule, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouteRules, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeConfig, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeRouteRules, type SilgiRuntimeRouteRulesConfig, type SilgiRuntimeShareds, type SilgiRuntimeSharedsExtend, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
1134
+ export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type CaptureError, type CapturedErrorContext, type CommandType, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DefaultRouteConfig, type DefaultRouteRules, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractPathParamsFromURI, type ExtractQueryParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type RouteRules, type ScanFile, type SchemaPreparationOptions, type ServiceParse, type ServiceParseModule, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCommands, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouteRules, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeConfig, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeRouteRules, type SilgiRuntimeRouteRulesConfig, type SilgiRuntimeShareds, type SilgiRuntimeSharedsExtend, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.19.27",
4
+ "version": "0.19.29",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {