silgi 0.7.44 → 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 +39 -43
- 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
|
@@ -559,7 +559,8 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
559
559
|
let importItems = {
|
|
560
560
|
"silgi/core": {
|
|
561
561
|
import: [
|
|
562
|
-
{ name: "createSilgi" }
|
|
562
|
+
{ name: "createSilgi" },
|
|
563
|
+
{ name: "createShared" }
|
|
563
564
|
],
|
|
564
565
|
from: "silgi/core"
|
|
565
566
|
},
|
|
@@ -599,48 +600,42 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
599
600
|
importItems[pkg.name].from = isAbsolute(id) ? relativeWithDot(relativeRootDir, id) : id;
|
|
600
601
|
}
|
|
601
602
|
}));
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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
|
+
};
|
|
611
617
|
for (const module of silgi.scanModules) {
|
|
612
|
-
|
|
618
|
+
_data.cliOptions[module.meta.configKey] = {
|
|
613
619
|
...module.options
|
|
614
620
|
};
|
|
615
621
|
}
|
|
616
|
-
await silgi.callHook("prepare:core.ts",
|
|
617
|
-
importItems,
|
|
618
|
-
customImports,
|
|
619
|
-
uris,
|
|
620
|
-
services,
|
|
621
|
-
shareds,
|
|
622
|
-
schemas,
|
|
623
|
-
buildSilgiExtraContent,
|
|
624
|
-
beforeBuildSilgiExtraContent,
|
|
625
|
-
_silgiOptions,
|
|
626
|
-
_silgiConfigs
|
|
627
|
-
});
|
|
622
|
+
await silgi.callHook("prepare:core.ts", _data);
|
|
628
623
|
if (importItems["#silgi/vfs"].import.length === 0) {
|
|
629
624
|
delete importItems["#silgi/vfs"];
|
|
630
625
|
}
|
|
631
|
-
if (services.length > 0) {
|
|
626
|
+
if (_data.services.length > 0) {
|
|
632
627
|
importItems["silgi/core"].import.push({ name: "mergeServices" });
|
|
633
628
|
}
|
|
634
|
-
if (shareds.length > 0) {
|
|
629
|
+
if (_data.shareds.length > 0) {
|
|
635
630
|
importItems["silgi/core"].import.push({ name: "mergeShared" });
|
|
636
631
|
}
|
|
637
|
-
if (schemas.length > 0) {
|
|
632
|
+
if (_data.schemas.length > 0) {
|
|
638
633
|
importItems["silgi/core"].import.push({ name: "mergeSchemas" });
|
|
639
634
|
}
|
|
640
635
|
const plugins = [];
|
|
641
636
|
for (const plugin of silgi.options.plugins) {
|
|
642
637
|
const pluginImportName = `_${hash(plugin.packageImport)}`;
|
|
643
|
-
customImports.push(`import ${pluginImportName} from '${plugin.packageImport}'`);
|
|
638
|
+
_data.customImports.push(`import ${pluginImportName} from '${plugin.packageImport}'`);
|
|
644
639
|
plugins.push(pluginImportName);
|
|
645
640
|
}
|
|
646
641
|
const importsContent = [
|
|
@@ -648,38 +643,39 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
648
643
|
return `import { ${imports.map(({ type, name }) => type ? `type ${name}` : name).join(", ")} } from '${from}'`;
|
|
649
644
|
}),
|
|
650
645
|
"",
|
|
651
|
-
...customImports,
|
|
646
|
+
..._data.customImports,
|
|
652
647
|
""
|
|
653
648
|
];
|
|
654
649
|
const importData = [
|
|
650
|
+
`export const cliOptions = ${JSON.stringify(_data.cliOptions, null, 2)}`,
|
|
651
|
+
"",
|
|
652
|
+
..._data.afterCliOptions,
|
|
655
653
|
"",
|
|
656
654
|
"export const uris = {}",
|
|
657
655
|
"",
|
|
658
656
|
"export const modulesURIs = {}",
|
|
659
657
|
"",
|
|
660
|
-
schemas.length > 0 ? "export const schemas = mergeSchemas([" : "export const schemas = {",
|
|
661
|
-
...schemas.map((name) => {
|
|
658
|
+
_data.schemas.length > 0 ? "export const schemas = mergeSchemas([" : "export const schemas = {",
|
|
659
|
+
..._data.schemas.map((name) => {
|
|
662
660
|
return ` ${name},`;
|
|
663
661
|
}),
|
|
664
|
-
schemas.length > 0 ? "])" : "}",
|
|
662
|
+
_data.schemas.length > 0 ? "])" : "}",
|
|
665
663
|
"",
|
|
666
|
-
services.length > 0 ? "export const services = mergeServices([" : "export const services = {",
|
|
667
|
-
...services.map((name) => {
|
|
664
|
+
_data.services.length > 0 ? "export const services = mergeServices([" : "export const services = {",
|
|
665
|
+
..._data.services.map((name) => {
|
|
668
666
|
return ` ${name},`;
|
|
669
667
|
}),
|
|
670
|
-
services.length > 0 ? "])" : "}",
|
|
668
|
+
_data.services.length > 0 ? "])" : "}",
|
|
671
669
|
"",
|
|
672
|
-
shareds.length > 0 ? "export const shareds = mergeShared([" : "export const shareds = {",
|
|
673
|
-
...shareds.map((name) => {
|
|
670
|
+
_data.shareds.length > 0 ? "export const shareds = mergeShared([" : "export const shareds = {",
|
|
671
|
+
..._data.shareds.map((name) => {
|
|
674
672
|
return ` ${name},`;
|
|
675
673
|
}),
|
|
676
|
-
shareds.length > 0 ? "])" : "}",
|
|
677
|
-
"",
|
|
678
|
-
`export const _silgiOptions = ${JSON.stringify(_silgiOptions, null, 2)}`,
|
|
674
|
+
_data.shareds.length > 0 ? "])" : "}",
|
|
679
675
|
"",
|
|
680
676
|
"export async function buildSilgi(framework: FrameworkContext, moduleOptions?: Partial<SilgiRuntimeOptions>,buildOptions?: Partial<BuildConfig>) {",
|
|
681
677
|
"",
|
|
682
|
-
beforeBuildSilgiExtraContent.length > 0 ? beforeBuildSilgiExtraContent.map(({ value, type }) => {
|
|
678
|
+
_data.beforeBuildSilgiExtraContent.length > 0 ? _data.beforeBuildSilgiExtraContent.map(({ value, type }) => {
|
|
683
679
|
return type === "function" ? value : `const ${value}`;
|
|
684
680
|
}) : "",
|
|
685
681
|
"",
|
|
@@ -691,20 +687,20 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
691
687
|
" uris,",
|
|
692
688
|
" modulesURIs,",
|
|
693
689
|
` plugins: [${plugins.join(", ")}],`,
|
|
694
|
-
_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 ")},` : "",
|
|
695
691
|
" ...buildOptions,",
|
|
696
692
|
" options: mergeDeep(",
|
|
697
693
|
" moduleOptions || {},",
|
|
698
694
|
" {",
|
|
699
695
|
` present: '${silgi.options.preset}',`,
|
|
700
|
-
" ...
|
|
696
|
+
" ...cliOptions,",
|
|
701
697
|
" },",
|
|
702
698
|
" ) as any,",
|
|
703
699
|
" })",
|
|
704
700
|
"",
|
|
705
701
|
...frameworkContext,
|
|
706
702
|
"",
|
|
707
|
-
...buildSilgiExtraContent,
|
|
703
|
+
..._data.buildSilgiExtraContent,
|
|
708
704
|
"",
|
|
709
705
|
" return silgi",
|
|
710
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 };
|