silgi 0.7.45 → 0.7.46
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.
- package/dist/_chunks/index.mjs +1 -1
- package/dist/cli/prepare.mjs +37 -42
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/types/index.d.mts +18 -16
- package/dist/types/index.d.ts +18 -16
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -600,48 +600,42 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
600
600
|
importItems[pkg.name].from = isAbsolute(id) ? relativeWithDot(relativeRootDir, id) : id;
|
|
601
601
|
}
|
|
602
602
|
}));
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
603
|
+
const _data = {
|
|
604
|
+
customImports: data._customImports || [],
|
|
605
|
+
uris: [],
|
|
606
|
+
services: [],
|
|
607
|
+
shareds: [],
|
|
608
|
+
schemas: [],
|
|
609
|
+
buildSilgiExtraContent: [],
|
|
610
|
+
beforeBuildSilgiExtraContent: [],
|
|
611
|
+
cliOptions: {},
|
|
612
|
+
afterCliOptions: [],
|
|
613
|
+
_silgiConfigs: [],
|
|
614
|
+
customContent: [],
|
|
615
|
+
importItems
|
|
616
|
+
};
|
|
612
617
|
for (const module of silgi.scanModules) {
|
|
613
|
-
|
|
618
|
+
_data.cliOptions[module.meta.configKey] = {
|
|
614
619
|
...module.options
|
|
615
620
|
};
|
|
616
621
|
}
|
|
617
|
-
await silgi.callHook("prepare:core.ts",
|
|
618
|
-
importItems,
|
|
619
|
-
customImports,
|
|
620
|
-
uris,
|
|
621
|
-
services,
|
|
622
|
-
shareds,
|
|
623
|
-
schemas,
|
|
624
|
-
buildSilgiExtraContent,
|
|
625
|
-
beforeBuildSilgiExtraContent,
|
|
626
|
-
_silgiOptions,
|
|
627
|
-
_silgiConfigs
|
|
628
|
-
});
|
|
622
|
+
await silgi.callHook("prepare:core.ts", _data);
|
|
629
623
|
if (importItems["#silgi/vfs"].import.length === 0) {
|
|
630
624
|
delete importItems["#silgi/vfs"];
|
|
631
625
|
}
|
|
632
|
-
if (services.length > 0) {
|
|
626
|
+
if (_data.services.length > 0) {
|
|
633
627
|
importItems["silgi/core"].import.push({ name: "mergeServices" });
|
|
634
628
|
}
|
|
635
|
-
if (shareds.length > 0) {
|
|
629
|
+
if (_data.shareds.length > 0) {
|
|
636
630
|
importItems["silgi/core"].import.push({ name: "mergeShared" });
|
|
637
631
|
}
|
|
638
|
-
if (schemas.length > 0) {
|
|
632
|
+
if (_data.schemas.length > 0) {
|
|
639
633
|
importItems["silgi/core"].import.push({ name: "mergeSchemas" });
|
|
640
634
|
}
|
|
641
635
|
const plugins = [];
|
|
642
636
|
for (const plugin of silgi.options.plugins) {
|
|
643
637
|
const pluginImportName = `_${hash(plugin.packageImport)}`;
|
|
644
|
-
customImports.push(`import ${pluginImportName} from '${plugin.packageImport}'`);
|
|
638
|
+
_data.customImports.push(`import ${pluginImportName} from '${plugin.packageImport}'`);
|
|
645
639
|
plugins.push(pluginImportName);
|
|
646
640
|
}
|
|
647
641
|
const importsContent = [
|
|
@@ -649,38 +643,39 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
649
643
|
return `import { ${imports.map(({ type, name }) => type ? `type ${name}` : name).join(", ")} } from '${from}'`;
|
|
650
644
|
}),
|
|
651
645
|
"",
|
|
652
|
-
...customImports,
|
|
646
|
+
..._data.customImports,
|
|
653
647
|
""
|
|
654
648
|
];
|
|
655
649
|
const importData = [
|
|
650
|
+
`export const cliOptions = ${JSON.stringify(_data.cliOptions, null, 2)}`,
|
|
651
|
+
"",
|
|
652
|
+
..._data.afterCliOptions,
|
|
656
653
|
"",
|
|
657
654
|
"export const uris = {}",
|
|
658
655
|
"",
|
|
659
656
|
"export const modulesURIs = {}",
|
|
660
657
|
"",
|
|
661
|
-
schemas.length > 0 ? "export const schemas = mergeSchemas([" : "export const schemas = {",
|
|
662
|
-
...schemas.map((name) => {
|
|
658
|
+
_data.schemas.length > 0 ? "export const schemas = mergeSchemas([" : "export const schemas = {",
|
|
659
|
+
..._data.schemas.map((name) => {
|
|
663
660
|
return ` ${name},`;
|
|
664
661
|
}),
|
|
665
|
-
schemas.length > 0 ? "])" : "}",
|
|
662
|
+
_data.schemas.length > 0 ? "])" : "}",
|
|
666
663
|
"",
|
|
667
|
-
services.length > 0 ? "export const services = mergeServices([" : "export const services = {",
|
|
668
|
-
...services.map((name) => {
|
|
664
|
+
_data.services.length > 0 ? "export const services = mergeServices([" : "export const services = {",
|
|
665
|
+
..._data.services.map((name) => {
|
|
669
666
|
return ` ${name},`;
|
|
670
667
|
}),
|
|
671
|
-
services.length > 0 ? "])" : "}",
|
|
668
|
+
_data.services.length > 0 ? "])" : "}",
|
|
672
669
|
"",
|
|
673
|
-
shareds.length > 0 ? "export const shareds = mergeShared([" : "export const shareds = {",
|
|
674
|
-
...shareds.map((name) => {
|
|
670
|
+
_data.shareds.length > 0 ? "export const shareds = mergeShared([" : "export const shareds = {",
|
|
671
|
+
..._data.shareds.map((name) => {
|
|
675
672
|
return ` ${name},`;
|
|
676
673
|
}),
|
|
677
|
-
shareds.length > 0 ? "])" : "}",
|
|
678
|
-
"",
|
|
679
|
-
`export const _silgiOptions = ${JSON.stringify(_silgiOptions, null, 2)}`,
|
|
674
|
+
_data.shareds.length > 0 ? "])" : "}",
|
|
680
675
|
"",
|
|
681
676
|
"export async function buildSilgi(framework: FrameworkContext, moduleOptions?: Partial<SilgiRuntimeOptions>,buildOptions?: Partial<BuildConfig>) {",
|
|
682
677
|
"",
|
|
683
|
-
beforeBuildSilgiExtraContent.length > 0 ? beforeBuildSilgiExtraContent.map(({ value, type }) => {
|
|
678
|
+
_data.beforeBuildSilgiExtraContent.length > 0 ? _data.beforeBuildSilgiExtraContent.map(({ value, type }) => {
|
|
684
679
|
return type === "function" ? value : `const ${value}`;
|
|
685
680
|
}) : "",
|
|
686
681
|
"",
|
|
@@ -692,20 +687,20 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
692
687
|
" uris,",
|
|
693
688
|
" modulesURIs,",
|
|
694
689
|
` plugins: [${plugins.join(", ")}],`,
|
|
695
|
-
_silgiConfigs.length > 0 ? ` ${_silgiConfigs.map((config) => typeof config === "string" ? config : typeof config === "object" ? Object.entries(config).map(([key, value]) => `${key}: ${value}`).join(",\n ") : "").join(",\n ")},` : "",
|
|
690
|
+
_data._silgiConfigs.length > 0 ? ` ${_data._silgiConfigs.map((config) => typeof config === "string" ? config : typeof config === "object" ? Object.entries(config).map(([key, value]) => `${key}: ${value}`).join(",\n ") : "").join(",\n ")},` : "",
|
|
696
691
|
" ...buildOptions,",
|
|
697
692
|
" options: mergeDeep(",
|
|
698
693
|
" moduleOptions || {},",
|
|
699
694
|
" {",
|
|
700
695
|
` present: '${silgi.options.preset}',`,
|
|
701
|
-
" ...
|
|
696
|
+
" ...cliOptions,",
|
|
702
697
|
" },",
|
|
703
698
|
" ) as any,",
|
|
704
699
|
" })",
|
|
705
700
|
"",
|
|
706
701
|
...frameworkContext,
|
|
707
702
|
"",
|
|
708
|
-
...buildSilgiExtraContent,
|
|
703
|
+
..._data.buildSilgiExtraContent,
|
|
709
704
|
"",
|
|
710
705
|
" return silgi",
|
|
711
706
|
"}",
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
package/dist/types/index.d.mts
CHANGED
|
@@ -223,6 +223,22 @@ interface SilgiHooks {
|
|
|
223
223
|
interface GenerateAppOptions {
|
|
224
224
|
filter?: (template: ResolvedSilgiTemplate<any>) => boolean;
|
|
225
225
|
}
|
|
226
|
+
interface PrepareCore extends ImportItem {
|
|
227
|
+
uris: string[];
|
|
228
|
+
services: string[];
|
|
229
|
+
shareds: string[];
|
|
230
|
+
schemas: string[];
|
|
231
|
+
buildSilgiExtraContent: string[];
|
|
232
|
+
beforeBuildSilgiExtraContent: {
|
|
233
|
+
value: string;
|
|
234
|
+
type: 'function' | 'variable';
|
|
235
|
+
}[];
|
|
236
|
+
cliOptions: {
|
|
237
|
+
[key: string]: any;
|
|
238
|
+
};
|
|
239
|
+
afterCliOptions: string[];
|
|
240
|
+
_silgiConfigs: any[];
|
|
241
|
+
}
|
|
226
242
|
interface SchemaPreparationOptions extends ImportItem {
|
|
227
243
|
options: {
|
|
228
244
|
key: string;
|
|
@@ -306,21 +322,7 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
306
322
|
tsConfig: TSConfig;
|
|
307
323
|
}) => HookResult;
|
|
308
324
|
'finish:types': (data: CoreTs) => HookResult;
|
|
309
|
-
'prepare:core.ts': (
|
|
310
|
-
uris: string[];
|
|
311
|
-
services: string[];
|
|
312
|
-
shareds: string[];
|
|
313
|
-
schemas: string[];
|
|
314
|
-
buildSilgiExtraContent: string[];
|
|
315
|
-
beforeBuildSilgiExtraContent: {
|
|
316
|
-
value: string;
|
|
317
|
-
type: 'function' | 'variable';
|
|
318
|
-
}[];
|
|
319
|
-
_silgiOptions: {
|
|
320
|
-
[key: string]: any;
|
|
321
|
-
};
|
|
322
|
-
_silgiConfigs: any[];
|
|
323
|
-
} & ImportItem) => HookResult;
|
|
325
|
+
'prepare:core.ts': (data: PrepareCore) => HookResult;
|
|
324
326
|
'after:prepare:core.ts': (content: string[]) => HookResult;
|
|
325
327
|
'prepare:schema.ts': (options: SchemaPreparationOptions) => HookResult;
|
|
326
328
|
'after:prepare:schema.ts': (content: string[]) => HookResult;
|
|
@@ -948,4 +950,4 @@ type Namespaces<T extends BaseNamespaceType> = {
|
|
|
948
950
|
|
|
949
951
|
declare const autoImportTypes: string[];
|
|
950
952
|
|
|
951
|
-
export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, 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 RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, 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 SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
|
|
953
|
+
export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, 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 SchemaPreparationOptions, 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 SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -223,6 +223,22 @@ interface SilgiHooks {
|
|
|
223
223
|
interface GenerateAppOptions {
|
|
224
224
|
filter?: (template: ResolvedSilgiTemplate<any>) => boolean;
|
|
225
225
|
}
|
|
226
|
+
interface PrepareCore extends ImportItem {
|
|
227
|
+
uris: string[];
|
|
228
|
+
services: string[];
|
|
229
|
+
shareds: string[];
|
|
230
|
+
schemas: string[];
|
|
231
|
+
buildSilgiExtraContent: string[];
|
|
232
|
+
beforeBuildSilgiExtraContent: {
|
|
233
|
+
value: string;
|
|
234
|
+
type: 'function' | 'variable';
|
|
235
|
+
}[];
|
|
236
|
+
cliOptions: {
|
|
237
|
+
[key: string]: any;
|
|
238
|
+
};
|
|
239
|
+
afterCliOptions: string[];
|
|
240
|
+
_silgiConfigs: any[];
|
|
241
|
+
}
|
|
226
242
|
interface SchemaPreparationOptions extends ImportItem {
|
|
227
243
|
options: {
|
|
228
244
|
key: string;
|
|
@@ -306,21 +322,7 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
306
322
|
tsConfig: TSConfig;
|
|
307
323
|
}) => HookResult;
|
|
308
324
|
'finish:types': (data: CoreTs) => HookResult;
|
|
309
|
-
'prepare:core.ts': (
|
|
310
|
-
uris: string[];
|
|
311
|
-
services: string[];
|
|
312
|
-
shareds: string[];
|
|
313
|
-
schemas: string[];
|
|
314
|
-
buildSilgiExtraContent: string[];
|
|
315
|
-
beforeBuildSilgiExtraContent: {
|
|
316
|
-
value: string;
|
|
317
|
-
type: 'function' | 'variable';
|
|
318
|
-
}[];
|
|
319
|
-
_silgiOptions: {
|
|
320
|
-
[key: string]: any;
|
|
321
|
-
};
|
|
322
|
-
_silgiConfigs: any[];
|
|
323
|
-
} & ImportItem) => HookResult;
|
|
325
|
+
'prepare:core.ts': (data: PrepareCore) => HookResult;
|
|
324
326
|
'after:prepare:core.ts': (content: string[]) => HookResult;
|
|
325
327
|
'prepare:schema.ts': (options: SchemaPreparationOptions) => HookResult;
|
|
326
328
|
'after:prepare:schema.ts': (content: string[]) => HookResult;
|
|
@@ -948,4 +950,4 @@ type Namespaces<T extends BaseNamespaceType> = {
|
|
|
948
950
|
|
|
949
951
|
declare const autoImportTypes: string[];
|
|
950
952
|
|
|
951
|
-
export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, 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 RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, 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 SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
|
|
953
|
+
export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, 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 SchemaPreparationOptions, 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 SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
|