silgi 0.29.22 → 0.29.24
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/cli/dev.mjs +5 -5
- package/dist/cli/index.mjs +2 -2
- package/dist/cli/init.mjs +13 -16
- package/dist/cli/install.mjs +4 -4
- package/dist/cli/prepare.mjs +16 -11
- package/dist/cli/silgi.mjs +244 -246
- package/dist/types/index.d.mts +8 -25
- package/package.json +1 -1
package/dist/cli/dev.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from 'pathe';
|
|
|
6
6
|
import { useSilgiCLI } from 'silgi';
|
|
7
7
|
import { version } from 'silgi/meta';
|
|
8
8
|
import { a as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
|
|
9
|
-
import {
|
|
9
|
+
import { b as commonArgs, a as command$1 } from './prepare.mjs';
|
|
10
10
|
import 'unctx';
|
|
11
11
|
import './silgi.mjs';
|
|
12
12
|
import 'apiful/openapi';
|
|
@@ -52,7 +52,7 @@ async function reloadScan(path, _stats) {
|
|
|
52
52
|
await silgi.callHook("reload:scan", path, _stats);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const command = defineCommand({
|
|
56
56
|
meta: {
|
|
57
57
|
name: "dev",
|
|
58
58
|
description: "Start the development server for the project",
|
|
@@ -70,7 +70,7 @@ const dev = defineCommand({
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
async run() {
|
|
73
|
-
await runCommand(
|
|
73
|
+
await runCommand(command$1, {
|
|
74
74
|
rawArgs: ["--commandType", "dev", "--dev", "true"]
|
|
75
75
|
});
|
|
76
76
|
const silgi = useSilgiCLI();
|
|
@@ -103,7 +103,7 @@ const dev = defineCommand({
|
|
|
103
103
|
silgi.errors = [];
|
|
104
104
|
try {
|
|
105
105
|
await reloadScan(path, stats);
|
|
106
|
-
await runCommand(
|
|
106
|
+
await runCommand(command$1, {
|
|
107
107
|
rawArgs: ["--commands", "run", "--dev", "true"]
|
|
108
108
|
});
|
|
109
109
|
} catch (error) {
|
|
@@ -132,4 +132,4 @@ const dev = defineCommand({
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
export {
|
|
135
|
+
export { command as default };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { defineCommand, runMain } from 'citty';
|
|
3
3
|
|
|
4
|
-
const version = "0.29.
|
|
4
|
+
const version = "0.29.24";
|
|
5
5
|
const packageJson = {
|
|
6
6
|
version: version};
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ const main = defineCommand({
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
subCommands: {
|
|
21
|
-
prepare: () => import('./prepare.mjs').then(function (n) { return n.
|
|
21
|
+
prepare: () => import('./prepare.mjs').then(function (n) { return n.p; }).then((m) => m.default),
|
|
22
22
|
init: () => import('./init.mjs').then((m) => m.default),
|
|
23
23
|
run: () => import('./prepare.mjs').then(function (n) { return n.r; }).then((m) => m.default),
|
|
24
24
|
install: () => import('./install.mjs').then((m) => m.default),
|
package/dist/cli/init.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import * as p from '@clack/prompts';
|
|
|
4
4
|
import { defineCommand, runCommand } from 'citty';
|
|
5
5
|
import consola from 'consola';
|
|
6
6
|
import { dirname } from 'pathe';
|
|
7
|
-
import {
|
|
7
|
+
import { isPresents } from 'silgi/kit';
|
|
8
|
+
import { c as cancelOnCancel, a as command$1 } from './prepare.mjs';
|
|
8
9
|
import 'silgi/meta';
|
|
9
10
|
import './silgi.mjs';
|
|
10
11
|
import 'apiful/openapi';
|
|
11
|
-
import 'silgi/kit';
|
|
12
12
|
import 'knitwork';
|
|
13
13
|
import 'mlly';
|
|
14
14
|
import 'pathe/utils';
|
|
@@ -45,7 +45,7 @@ import 'node:child_process';
|
|
|
45
45
|
import '../_chunks/silgiApp.mjs';
|
|
46
46
|
import 'unctx';
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const command = defineCommand({
|
|
49
49
|
meta: {
|
|
50
50
|
name: "Silgi Init",
|
|
51
51
|
description: "Initialize silgi config",
|
|
@@ -61,12 +61,10 @@ const init = defineCommand({
|
|
|
61
61
|
{ label: "Nuxt", value: "nuxt" },
|
|
62
62
|
{ label: "H3", value: "h3" },
|
|
63
63
|
{ label: "NPM Package", value: "npm-package" }
|
|
64
|
-
]
|
|
64
|
+
],
|
|
65
|
+
initialValue: "h3"
|
|
65
66
|
});
|
|
66
|
-
|
|
67
|
-
consola.info("Silgi config initialization canceled");
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
67
|
+
cancelOnCancel({ value: framework });
|
|
70
68
|
const context = [
|
|
71
69
|
`import { defineSilgiConfig } from 'silgi/config'`,
|
|
72
70
|
"",
|
|
@@ -79,20 +77,19 @@ const init = defineCommand({
|
|
|
79
77
|
"})",
|
|
80
78
|
""
|
|
81
79
|
];
|
|
82
|
-
if (
|
|
80
|
+
if (isPresents(["nitro", "nuxt"])) {
|
|
83
81
|
const plugin = [
|
|
84
82
|
`import { buildSilgi } from '../silgi/core'`,
|
|
85
83
|
"",
|
|
86
84
|
"export default defineNitroPlugin(async (nitro) => {",
|
|
87
85
|
"",
|
|
88
|
-
"
|
|
89
|
-
" nitro,",
|
|
90
|
-
" {
|
|
91
|
-
" {",
|
|
86
|
+
" await buildSilgi({",
|
|
87
|
+
" framework: nitro,",
|
|
88
|
+
" options: {",
|
|
92
89
|
" putStorage: useStorage(),",
|
|
93
90
|
" runtimeConfig: useRuntimeConfig(),",
|
|
94
91
|
" },",
|
|
95
|
-
" )",
|
|
92
|
+
" })",
|
|
96
93
|
"})",
|
|
97
94
|
""
|
|
98
95
|
];
|
|
@@ -100,7 +97,7 @@ const init = defineCommand({
|
|
|
100
97
|
await fsp.mkdir(dirname(file), { recursive: true });
|
|
101
98
|
writeFileSync(file, plugin.join("\n"));
|
|
102
99
|
consola.success("Silgi plugin created, see server/plugins/silgi.ts");
|
|
103
|
-
runCommand(
|
|
100
|
+
runCommand(command$1, {
|
|
104
101
|
rawArgs: ["--env", ".env"]
|
|
105
102
|
});
|
|
106
103
|
}
|
|
@@ -109,4 +106,4 @@ const init = defineCommand({
|
|
|
109
106
|
}
|
|
110
107
|
});
|
|
111
108
|
|
|
112
|
-
export {
|
|
109
|
+
export { command as default };
|
package/dist/cli/install.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { consola } from 'consola';
|
|
|
4
4
|
import { version } from 'silgi/meta';
|
|
5
5
|
import { addNPMPackage, addTemplate } from 'silgi/kit';
|
|
6
6
|
import { u as useSilgiCLI } from '../_chunks/silgiApp.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { b as commonArgs, a as command$1 } from './prepare.mjs';
|
|
8
8
|
import 'unctx';
|
|
9
9
|
import 'pathe';
|
|
10
10
|
import './silgi.mjs';
|
|
@@ -90,7 +90,7 @@ async function installPackages(silgi = useSilgiCLI()) {
|
|
|
90
90
|
return packages;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const
|
|
93
|
+
const command = defineCommand({
|
|
94
94
|
meta: {
|
|
95
95
|
name: "install",
|
|
96
96
|
description: "Install dependencies from the install.json file.",
|
|
@@ -104,7 +104,7 @@ const install = defineCommand({
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
async run() {
|
|
107
|
-
await runCommand(
|
|
107
|
+
await runCommand(command$1, {
|
|
108
108
|
rawArgs: ["--commandType", "install"]
|
|
109
109
|
}).catch(() => {
|
|
110
110
|
});
|
|
@@ -133,4 +133,4 @@ const install = defineCommand({
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
-
export {
|
|
136
|
+
export { command as default };
|
package/dist/cli/prepare.mjs
CHANGED
|
@@ -44,7 +44,7 @@ async function scanCommands(silgi = useSilgiCLI()) {
|
|
|
44
44
|
getContents: () => JSON.stringify(commands, null, 2)
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
silgi.hook("
|
|
47
|
+
silgi.hook("before:schema.ts", async () => {
|
|
48
48
|
const allTags = commands.reduce((acc, commandGroup) => {
|
|
49
49
|
Object.values(commandGroup).forEach((command) => {
|
|
50
50
|
if (command.tags) {
|
|
@@ -71,7 +71,12 @@ async function scanCommands(silgi = useSilgiCLI()) {
|
|
|
71
71
|
),
|
|
72
72
|
""
|
|
73
73
|
];
|
|
74
|
-
|
|
74
|
+
addTemplate({
|
|
75
|
+
filename: "types/commands.d.ts",
|
|
76
|
+
write: true,
|
|
77
|
+
where: ".silgi",
|
|
78
|
+
getContents: () => data.join("\n")
|
|
79
|
+
});
|
|
75
80
|
});
|
|
76
81
|
return commands;
|
|
77
82
|
}
|
|
@@ -91,7 +96,7 @@ function cancelOnCancel({
|
|
|
91
96
|
handleCancel();
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
const
|
|
99
|
+
const command$1 = defineCommand({
|
|
95
100
|
meta: {
|
|
96
101
|
name: "run",
|
|
97
102
|
description: "Run a command from the CLI",
|
|
@@ -114,7 +119,7 @@ const run = defineCommand({
|
|
|
114
119
|
},
|
|
115
120
|
async run({ args }) {
|
|
116
121
|
if (args.prepare) {
|
|
117
|
-
await runCommand(
|
|
122
|
+
await runCommand(command, {
|
|
118
123
|
rawArgs: ["--commandType", "run"]
|
|
119
124
|
});
|
|
120
125
|
}
|
|
@@ -189,12 +194,12 @@ const run = defineCommand({
|
|
|
189
194
|
}
|
|
190
195
|
});
|
|
191
196
|
|
|
192
|
-
const run
|
|
197
|
+
const run = {
|
|
193
198
|
__proto__: null,
|
|
194
|
-
default:
|
|
199
|
+
default: command$1
|
|
195
200
|
};
|
|
196
201
|
|
|
197
|
-
const
|
|
202
|
+
const command = defineCommand({
|
|
198
203
|
meta: {
|
|
199
204
|
name: "prepare",
|
|
200
205
|
description: "Generate types for the project",
|
|
@@ -235,16 +240,16 @@ const prepare = defineCommand({
|
|
|
235
240
|
});
|
|
236
241
|
await build(silgi);
|
|
237
242
|
if (args.commandType !== "run") {
|
|
238
|
-
await runCommand(
|
|
243
|
+
await runCommand(command$1, {
|
|
239
244
|
rawArgs: ["--tag", "init", "--prepare", "false"]
|
|
240
245
|
});
|
|
241
246
|
}
|
|
242
247
|
}
|
|
243
248
|
});
|
|
244
249
|
|
|
245
|
-
const prepare
|
|
250
|
+
const prepare = {
|
|
246
251
|
__proto__: null,
|
|
247
|
-
default:
|
|
252
|
+
default: command
|
|
248
253
|
};
|
|
249
254
|
|
|
250
|
-
export {
|
|
255
|
+
export { command as a, commonArgs as b, cancelOnCancel as c, prepare as p, run as r };
|
package/dist/cli/silgi.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateDTS } from 'apiful/openapi';
|
|
2
2
|
import consola$1, { consola } from 'consola';
|
|
3
|
-
import { join, resolve, dirname,
|
|
4
|
-
import { hasSilgiModule, addTemplate, normalizeTemplate, useLogger, genEnsureSafeVar, baseHeaderBannerComment, addImports, hash, toArray, writeFile, relativeWithDot, isDirectory, addCoreFile, resolveAlias as resolveAlias$1, directoryToURL, hasError, parseServices, resolveSilgiPath } from 'silgi/kit';
|
|
3
|
+
import { join, resolve, dirname, relative, isAbsolute, basename, extname } from 'pathe';
|
|
4
|
+
import { hasSilgiModule, addTemplate, normalizeTemplate, useLogger, genEnsureSafeVar, baseHeaderBannerComment, addImports, hash, toArray, writeFile, relativeWithDot, isDirectory, isPresents, addCoreFile, resolveAlias as resolveAlias$1, directoryToURL, hasError, parseServices, resolveSilgiPath } from 'silgi/kit';
|
|
5
5
|
import { mkdirSync, existsSync, writeFileSync, promises, readFileSync } from 'node:fs';
|
|
6
6
|
import { readdir, readFile } from 'node:fs/promises';
|
|
7
7
|
import { genObjectFromRawEntries, genImport, genTypeImport, genObjectFromRaw, genObjectFromValues } from 'knitwork';
|
|
@@ -486,80 +486,41 @@ ${methodEntries}
|
|
|
486
486
|
return context;
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
async function createDTSFramework(silgi) {
|
|
490
|
-
const importItems = {
|
|
491
|
-
"silgi/types": {
|
|
492
|
-
import: [
|
|
493
|
-
{
|
|
494
|
-
name: "SilgiRuntimeContext",
|
|
495
|
-
type: true,
|
|
496
|
-
key: "SilgiRuntimeContext"
|
|
497
|
-
}
|
|
498
|
-
],
|
|
499
|
-
from: "silgi/types"
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
const customImports = [];
|
|
503
|
-
const customContent = [];
|
|
504
|
-
await silgi.callHook("prepare:createDTSFramework", {
|
|
505
|
-
importItems,
|
|
506
|
-
customImports,
|
|
507
|
-
customContent
|
|
508
|
-
});
|
|
509
|
-
const content = [
|
|
510
|
-
...Object.entries(importItems).map(([_name, { from, import: imports }]) => {
|
|
511
|
-
const path = isAbsolute(from) ? relativeWithDot(silgi.options.build.typesDir, from) : from;
|
|
512
|
-
if (silgi.options.typescript.removeFileExtension) {
|
|
513
|
-
from = from.replace(/\.(js|ts|mjs|cjs|jsx|tsx)$/, "");
|
|
514
|
-
}
|
|
515
|
-
return `import { ${imports.map(({ type, name }) => type ? `type ${name}` : name).join(", ")} } from '${path}'`;
|
|
516
|
-
}),
|
|
517
|
-
"",
|
|
518
|
-
...customImports,
|
|
519
|
-
"",
|
|
520
|
-
...customContent,
|
|
521
|
-
""
|
|
522
|
-
];
|
|
523
|
-
return {
|
|
524
|
-
content,
|
|
525
|
-
importItems
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
|
|
529
489
|
async function prepareSchema(silgi) {
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
490
|
+
const { genImports, genTypeImports, addImportItem, addImportItemType } = addImports({
|
|
491
|
+
imports: [
|
|
492
|
+
{
|
|
493
|
+
specifier: relativeWithDot(
|
|
494
|
+
silgi.options.build.typesDir,
|
|
495
|
+
`${silgi.options.silgi.serverDir}/scan`
|
|
496
|
+
),
|
|
497
|
+
imports: [
|
|
498
|
+
{
|
|
499
|
+
name: "modulesURIs"
|
|
500
|
+
}
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
],
|
|
504
|
+
typeImports: [
|
|
505
|
+
{
|
|
506
|
+
specifier: "silgi/types",
|
|
507
|
+
imports: [
|
|
508
|
+
{
|
|
509
|
+
name: "URIsTypes"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: "Namespaces"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
name: "SilgiRuntimeContext"
|
|
516
|
+
}
|
|
517
|
+
]
|
|
518
|
+
}
|
|
519
|
+
]
|
|
520
|
+
});
|
|
560
521
|
const data = {
|
|
561
|
-
|
|
562
|
-
|
|
522
|
+
addImportItem,
|
|
523
|
+
addImportItemType,
|
|
563
524
|
options: [],
|
|
564
525
|
contexts: [],
|
|
565
526
|
actions: [],
|
|
@@ -577,26 +538,34 @@ async function prepareSchema(silgi) {
|
|
|
577
538
|
routeRules: [],
|
|
578
539
|
routeRulesConfig: []
|
|
579
540
|
};
|
|
580
|
-
await silgi.callHook("
|
|
581
|
-
relativeWithDot(silgi.options.build.typesDir, `${silgi.options.silgi.serverDir}/core
|
|
582
|
-
const silgiScanTS = relativeWithDot(silgi.options.build.typesDir, `${silgi.options.silgi.serverDir}/scan
|
|
541
|
+
await silgi.callHook("before:schema.ts", data);
|
|
542
|
+
relativeWithDot(silgi.options.build.typesDir, `${silgi.options.silgi.serverDir}/core`);
|
|
543
|
+
const silgiScanTS = relativeWithDot(silgi.options.build.typesDir, `${silgi.options.silgi.serverDir}/scan`);
|
|
583
544
|
let addSilgiContext = false;
|
|
584
545
|
const importsContent = [
|
|
585
|
-
...
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
return `import { ${imports.map(({ type, name }) => type ? `type ${name}` : name).join(", ")} } from '${path}'`;
|
|
546
|
+
...genImports.map(({ specifier, imports, options }) => {
|
|
547
|
+
return genImport(specifier, imports, options);
|
|
548
|
+
}),
|
|
549
|
+
...genTypeImports.map(({ specifier, imports }) => {
|
|
550
|
+
return genTypeImport(specifier, Array.isArray(imports) ? imports : [imports]);
|
|
591
551
|
}),
|
|
592
|
-
"",
|
|
593
|
-
...data.customImports,
|
|
594
552
|
""
|
|
595
553
|
];
|
|
596
554
|
const importData = [
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
555
|
+
generateTypes(
|
|
556
|
+
await resolveSchema(
|
|
557
|
+
{
|
|
558
|
+
...silgi.options.namespaces?.reduce((acc, key) => ({ ...acc, [key]: "" }), {}) || {}
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
{
|
|
562
|
+
interfaceName: "InferredNamespaces",
|
|
563
|
+
addExport: false,
|
|
564
|
+
addDefaults: false,
|
|
565
|
+
allowExtraKeys: false,
|
|
566
|
+
indentation: 0
|
|
567
|
+
}
|
|
568
|
+
),
|
|
600
569
|
"",
|
|
601
570
|
`type SchemaExtends = Namespaces<typeof import('${silgiScanTS}')['schemas']>`,
|
|
602
571
|
"",
|
|
@@ -693,7 +662,7 @@ async function prepareSchema(silgi) {
|
|
|
693
662
|
"",
|
|
694
663
|
"export {}"
|
|
695
664
|
];
|
|
696
|
-
await silgi.callHook("after:
|
|
665
|
+
await silgi.callHook("after:schema.ts", importData);
|
|
697
666
|
importData.unshift(...importsContent);
|
|
698
667
|
return importData;
|
|
699
668
|
}
|
|
@@ -703,10 +672,8 @@ async function writeTypesAndFiles(silgi) {
|
|
|
703
672
|
silgi.hook("prepare:types", (opts) => {
|
|
704
673
|
opts.references.push({ path: "./schema.d.ts" });
|
|
705
674
|
opts.references.push({ path: "./silgi-routes.d.ts" });
|
|
706
|
-
opts.references.push({ path: "./framework.d.ts" });
|
|
707
675
|
});
|
|
708
676
|
const schemaContent = await prepareSchema(silgi);
|
|
709
|
-
const frameworkDTS = await createDTSFramework(silgi);
|
|
710
677
|
const { declarations, tsConfig } = await silgiGenerateType(silgi);
|
|
711
678
|
const tsConfigPath = resolve(
|
|
712
679
|
silgi.options.rootDir,
|
|
@@ -780,10 +747,6 @@ async function writeTypesAndFiles(silgi) {
|
|
|
780
747
|
path: tsConfigPath,
|
|
781
748
|
contents: JSON.stringify(tsConfig, null, 2)
|
|
782
749
|
});
|
|
783
|
-
buildFiles.push({
|
|
784
|
-
path: join(typesDir, "framework.d.ts"),
|
|
785
|
-
contents: frameworkDTS.content.join("\n")
|
|
786
|
-
});
|
|
787
750
|
for await (const file of buildFiles) {
|
|
788
751
|
if (!silgi.errors.length) {
|
|
789
752
|
await writeFile(
|
|
@@ -835,9 +798,9 @@ export const routeRules = ${genObjectFromRawEntries(
|
|
|
835
798
|
async function build(silgi) {
|
|
836
799
|
await prepare();
|
|
837
800
|
await generateApiFul(silgi);
|
|
838
|
-
await writeTypesAndFiles(silgi);
|
|
839
801
|
await writeCoreFile(silgi);
|
|
840
802
|
await prepareBuild(silgi);
|
|
803
|
+
await writeTypesAndFiles(silgi);
|
|
841
804
|
await generateApp(silgi);
|
|
842
805
|
}
|
|
843
806
|
|
|
@@ -950,41 +913,39 @@ async function prepareEnv(silgiConfig) {
|
|
|
950
913
|
|
|
951
914
|
async function emptyFramework(silgi) {
|
|
952
915
|
if (silgi.options.preset === "npm-package" || !silgi.options.preset) {
|
|
953
|
-
silgi.hook("after:
|
|
916
|
+
silgi.hook("after:schema.ts", (data) => {
|
|
954
917
|
data.unshift("type FrameworkContextExtends = {}");
|
|
955
918
|
});
|
|
956
919
|
}
|
|
957
920
|
}
|
|
958
921
|
|
|
959
922
|
async function h3Framework(silgi, skip = false) {
|
|
960
|
-
if (
|
|
923
|
+
if (!isPresents(["h3"]) && skip === false)
|
|
961
924
|
return;
|
|
962
|
-
if (
|
|
963
|
-
silgi.hook("after:
|
|
925
|
+
if (isPresents(["h3"])) {
|
|
926
|
+
silgi.hook("after:schema.ts", (data) => {
|
|
964
927
|
data.unshift("type FrameworkContextExtends = NitroApp");
|
|
965
928
|
});
|
|
966
929
|
}
|
|
967
|
-
silgi.hook("
|
|
968
|
-
data.
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
from: "h3"
|
|
987
|
-
};
|
|
930
|
+
silgi.hook("before:schema.ts", (data) => {
|
|
931
|
+
data.addImportItemType([
|
|
932
|
+
{
|
|
933
|
+
imports: [
|
|
934
|
+
{
|
|
935
|
+
name: "H3Event"
|
|
936
|
+
}
|
|
937
|
+
],
|
|
938
|
+
specifier: "h3"
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
imports: [
|
|
942
|
+
{
|
|
943
|
+
name: "NitroApp"
|
|
944
|
+
}
|
|
945
|
+
],
|
|
946
|
+
specifier: "nitropack/types"
|
|
947
|
+
}
|
|
948
|
+
]);
|
|
988
949
|
data.events.push({
|
|
989
950
|
key: "H3Event",
|
|
990
951
|
value: "H3Event",
|
|
@@ -992,24 +953,22 @@ async function h3Framework(silgi, skip = false) {
|
|
|
992
953
|
isSilgiContext: false
|
|
993
954
|
});
|
|
994
955
|
});
|
|
995
|
-
silgi.hook("prepare:
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
""
|
|
1012
|
-
);
|
|
956
|
+
silgi.hook("prepare:types", (opts) => {
|
|
957
|
+
addTemplate({
|
|
958
|
+
filename: "types/h3.d.ts",
|
|
959
|
+
where: ".silgi",
|
|
960
|
+
getContents: () => {
|
|
961
|
+
return [
|
|
962
|
+
"import type { SilgiRuntimeContext } from 'silgi/types'",
|
|
963
|
+
"",
|
|
964
|
+
'declare module "h3" {',
|
|
965
|
+
" interface H3EventContext extends SilgiRuntimeContext {}",
|
|
966
|
+
"}",
|
|
967
|
+
""
|
|
968
|
+
].join("\n");
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
opts.references.push({ path: "./h3.d.ts" });
|
|
1013
972
|
});
|
|
1014
973
|
addCoreFile({
|
|
1015
974
|
before: ({ silgiConfigs }) => {
|
|
@@ -1047,45 +1006,41 @@ async function h3Framework(silgi, skip = false) {
|
|
|
1047
1006
|
}
|
|
1048
1007
|
|
|
1049
1008
|
async function nitroFramework(silgi, skip = false) {
|
|
1050
|
-
if (
|
|
1009
|
+
if (!isPresents(["nitro"]) && skip === false)
|
|
1051
1010
|
return;
|
|
1052
|
-
silgi.hook("
|
|
1053
|
-
data.
|
|
1054
|
-
|
|
1011
|
+
silgi.hook("before:schema.ts", (data) => {
|
|
1012
|
+
data.addImportItemType({
|
|
1013
|
+
imports: [
|
|
1055
1014
|
{
|
|
1056
|
-
name: "NitroApp"
|
|
1057
|
-
type: true,
|
|
1058
|
-
key: "NitroApp"
|
|
1015
|
+
name: "NitroApp"
|
|
1059
1016
|
}
|
|
1060
1017
|
],
|
|
1061
|
-
|
|
1062
|
-
};
|
|
1018
|
+
specifier: "nitropack/types"
|
|
1019
|
+
});
|
|
1063
1020
|
});
|
|
1064
|
-
silgi.hook("after:
|
|
1021
|
+
silgi.hook("after:schema.ts", (data) => {
|
|
1065
1022
|
data.unshift("type FrameworkContextExtends = NitroApp");
|
|
1066
1023
|
});
|
|
1067
1024
|
silgi.options.plugins.push({
|
|
1068
1025
|
packageImport: "silgi/runtime/internal/nitro",
|
|
1069
1026
|
path: join(runtimeDir, "internal/nitro")
|
|
1070
1027
|
});
|
|
1071
|
-
silgi.hook("prepare:
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
""
|
|
1088
|
-
);
|
|
1028
|
+
silgi.hook("prepare:types", (opts) => {
|
|
1029
|
+
addTemplate({
|
|
1030
|
+
filename: "types/nitro.d.ts",
|
|
1031
|
+
where: ".silgi",
|
|
1032
|
+
getContents: () => {
|
|
1033
|
+
return [
|
|
1034
|
+
"import type { NitroRuntimeConfig } from 'nitropack/types'",
|
|
1035
|
+
"",
|
|
1036
|
+
'declare module "silgi/types" {',
|
|
1037
|
+
" interface SilgiRuntimeConfig extends NitroRuntimeConfig {}",
|
|
1038
|
+
"}",
|
|
1039
|
+
""
|
|
1040
|
+
].join("\n");
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
opts.references.push({ path: "./nitro.d.ts" });
|
|
1089
1044
|
});
|
|
1090
1045
|
if (silgi.options.imports !== false) {
|
|
1091
1046
|
silgi.options.imports.presets ??= [];
|
|
@@ -1107,7 +1062,7 @@ const frameworkSetup = [
|
|
|
1107
1062
|
];
|
|
1108
1063
|
|
|
1109
1064
|
async function registerModuleExportScan(silgi) {
|
|
1110
|
-
silgi.hook("
|
|
1065
|
+
silgi.hook("before:schema.ts", async (options) => {
|
|
1111
1066
|
for (const module of silgi.scanModules) {
|
|
1112
1067
|
const moduleReExports = [];
|
|
1113
1068
|
if (!module.entryPath) {
|
|
@@ -1124,106 +1079,147 @@ async function registerModuleExportScan(silgi) {
|
|
|
1124
1079
|
const hasTypeExport = (name) => moduleReExports.find((exp) => exp.names?.includes(name));
|
|
1125
1080
|
const configKey = module.meta.configKey;
|
|
1126
1081
|
const moduleName = module.meta.name || module.meta._packageName;
|
|
1127
|
-
options.
|
|
1128
|
-
import: [],
|
|
1129
|
-
from: module.meta._packageName ? moduleName : relativeWithDot(silgi.options.build.typesDir, module.entryPath)
|
|
1130
|
-
};
|
|
1082
|
+
const specifier = module.meta._packageName ? moduleName : relativeWithDot(silgi.options.build.typesDir, module.entryPath);
|
|
1131
1083
|
if (hasTypeExport("ModuleOptions")) {
|
|
1132
|
-
const importName =
|
|
1133
|
-
options.
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1084
|
+
const importName = hash(`${configKey}ModuleOptions`);
|
|
1085
|
+
options.addImportItemType({
|
|
1086
|
+
imports: [
|
|
1087
|
+
{
|
|
1088
|
+
as: importName,
|
|
1089
|
+
name: "ModuleOptions"
|
|
1090
|
+
}
|
|
1091
|
+
],
|
|
1092
|
+
specifier
|
|
1137
1093
|
});
|
|
1138
1094
|
options.options.push({ key: configKey, value: importName });
|
|
1139
1095
|
}
|
|
1140
1096
|
if (hasTypeExport("ModuleRuntimeOptions")) {
|
|
1141
|
-
const importName =
|
|
1142
|
-
options.
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1097
|
+
const importName = hash(`${configKey}ModuleRuntimeOptions`);
|
|
1098
|
+
options.addImportItemType({
|
|
1099
|
+
imports: [
|
|
1100
|
+
{
|
|
1101
|
+
as: importName,
|
|
1102
|
+
name: "ModuleRuntimeOptions"
|
|
1103
|
+
}
|
|
1104
|
+
],
|
|
1105
|
+
specifier
|
|
1146
1106
|
});
|
|
1147
1107
|
options.runtimeOptions.push({ key: configKey, value: importName });
|
|
1148
1108
|
}
|
|
1149
1109
|
if (hasTypeExport("ModuleRuntimeShareds")) {
|
|
1150
|
-
const importName =
|
|
1151
|
-
options.
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1110
|
+
const importName = hash(`${configKey}ModuleRuntimeShareds`);
|
|
1111
|
+
options.addImportItemType({
|
|
1112
|
+
imports: [
|
|
1113
|
+
{
|
|
1114
|
+
as: importName,
|
|
1115
|
+
name: "ModuleRuntimeShareds"
|
|
1116
|
+
}
|
|
1117
|
+
],
|
|
1118
|
+
specifier
|
|
1155
1119
|
});
|
|
1156
1120
|
options.shareds.push({ key: configKey, value: importName });
|
|
1157
1121
|
}
|
|
1158
1122
|
if (hasTypeExport("ModuleEvents")) {
|
|
1159
|
-
const importName =
|
|
1160
|
-
options.
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1123
|
+
const importName = hash(`${configKey}ModuleEvents`);
|
|
1124
|
+
options.addImportItemType({
|
|
1125
|
+
imports: [
|
|
1126
|
+
{
|
|
1127
|
+
as: importName,
|
|
1128
|
+
name: "ModuleEvents"
|
|
1129
|
+
}
|
|
1130
|
+
],
|
|
1131
|
+
specifier
|
|
1164
1132
|
});
|
|
1165
1133
|
options.events.push({ key: configKey, value: importName });
|
|
1166
1134
|
}
|
|
1167
1135
|
if (hasTypeExport("ModuleRuntimeContexts")) {
|
|
1168
|
-
const importName =
|
|
1169
|
-
options.
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1136
|
+
const importName = hash(`${configKey}ModuleRuntimeContexts`);
|
|
1137
|
+
options.addImportItemType({
|
|
1138
|
+
imports: [
|
|
1139
|
+
{
|
|
1140
|
+
as: importName,
|
|
1141
|
+
name: "ModuleRuntimeContexts"
|
|
1142
|
+
}
|
|
1143
|
+
],
|
|
1144
|
+
specifier
|
|
1173
1145
|
});
|
|
1174
1146
|
options.contexts.push({ key: configKey, value: importName });
|
|
1175
1147
|
}
|
|
1176
1148
|
if (hasTypeExport("ModuleHooks")) {
|
|
1177
|
-
const importName =
|
|
1178
|
-
options.
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1149
|
+
const importName = hash(`${configKey}ModuleHooks`);
|
|
1150
|
+
options.addImportItemType({
|
|
1151
|
+
imports: [
|
|
1152
|
+
{
|
|
1153
|
+
as: importName,
|
|
1154
|
+
name: "ModuleHooks"
|
|
1155
|
+
}
|
|
1156
|
+
],
|
|
1157
|
+
specifier
|
|
1182
1158
|
});
|
|
1183
1159
|
options.hooks.push({ key: configKey, value: importName });
|
|
1184
1160
|
}
|
|
1185
1161
|
if (hasTypeExport("ModuleRuntimeHooks")) {
|
|
1186
|
-
const importName =
|
|
1187
|
-
options.
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1162
|
+
const importName = hash(`${configKey}RuntimeHooks`);
|
|
1163
|
+
options.addImportItemType({
|
|
1164
|
+
imports: [
|
|
1165
|
+
{
|
|
1166
|
+
as: importName,
|
|
1167
|
+
name: "ModuleRuntimeHooks"
|
|
1168
|
+
}
|
|
1169
|
+
],
|
|
1170
|
+
specifier
|
|
1191
1171
|
});
|
|
1192
1172
|
options.runtimeHooks.push({ key: configKey, value: importName });
|
|
1193
1173
|
}
|
|
1194
1174
|
if (hasTypeExport("ModuleRuntimeActions")) {
|
|
1195
|
-
const importName =
|
|
1196
|
-
options.
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1175
|
+
const importName = hash(`${configKey}ModuleRuntimeActions`);
|
|
1176
|
+
options.addImportItemType({
|
|
1177
|
+
imports: [
|
|
1178
|
+
{
|
|
1179
|
+
as: importName,
|
|
1180
|
+
name: "ModuleRuntimeActions"
|
|
1181
|
+
}
|
|
1182
|
+
],
|
|
1183
|
+
specifier
|
|
1200
1184
|
});
|
|
1201
1185
|
options.actions.push({ key: configKey, value: importName });
|
|
1202
1186
|
}
|
|
1203
1187
|
if (hasTypeExport("ModuleRuntimeMethods")) {
|
|
1204
|
-
const importName =
|
|
1205
|
-
options.
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1188
|
+
const importName = hash(`${configKey}ModuleRuntimeMethods`);
|
|
1189
|
+
options.addImportItemType({
|
|
1190
|
+
imports: [
|
|
1191
|
+
{
|
|
1192
|
+
as: importName,
|
|
1193
|
+
name: "ModuleRuntimeMethods"
|
|
1194
|
+
}
|
|
1195
|
+
],
|
|
1196
|
+
specifier
|
|
1209
1197
|
});
|
|
1210
1198
|
options.methods.push({ key: configKey, value: importName });
|
|
1211
1199
|
}
|
|
1212
1200
|
if (hasTypeExport("ModuleRuntimeRouteRules")) {
|
|
1213
|
-
const importName =
|
|
1214
|
-
options.
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1201
|
+
const importName = hash(`${configKey}ModuleRuntimeRouteRules`);
|
|
1202
|
+
options.addImportItemType({
|
|
1203
|
+
imports: [
|
|
1204
|
+
{
|
|
1205
|
+
as: importName,
|
|
1206
|
+
name: "ModuleRuntimeRouteRules"
|
|
1207
|
+
}
|
|
1208
|
+
],
|
|
1209
|
+
specifier
|
|
1218
1210
|
});
|
|
1219
1211
|
options.routeRules.push({ key: configKey, value: importName });
|
|
1220
1212
|
}
|
|
1221
1213
|
if (hasTypeExport("ModuleRuntimeRouteRulesConfig")) {
|
|
1222
|
-
const importName =
|
|
1223
|
-
options.
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1214
|
+
const importName = hash(`${configKey}ModuleRuntimeRouteRulesConfig`);
|
|
1215
|
+
options.addImportItemType({
|
|
1216
|
+
imports: [
|
|
1217
|
+
{
|
|
1218
|
+
as: importName,
|
|
1219
|
+
name: "ModuleRuntimeRouteRulesConfig"
|
|
1220
|
+
}
|
|
1221
|
+
],
|
|
1222
|
+
specifier
|
|
1227
1223
|
});
|
|
1228
1224
|
options.routeRulesConfig.push({ key: configKey, value: importName });
|
|
1229
1225
|
}
|
|
@@ -1793,7 +1789,7 @@ async function scanExportFile(silgi) {
|
|
|
1793
1789
|
return { exportName, path, _name, type: "context" };
|
|
1794
1790
|
}));
|
|
1795
1791
|
}
|
|
1796
|
-
silgi.hook("
|
|
1792
|
+
silgi.hook("before:scan.ts", (options) => {
|
|
1797
1793
|
for (const { exportName, path, _name, type } of scanTS) {
|
|
1798
1794
|
if (!path.includes("vfs")) {
|
|
1799
1795
|
silgi.options.devServer.watch.push(path);
|
|
@@ -1818,7 +1814,7 @@ async function scanExportFile(silgi) {
|
|
|
1818
1814
|
});
|
|
1819
1815
|
}
|
|
1820
1816
|
});
|
|
1821
|
-
silgi.hook("
|
|
1817
|
+
silgi.hook("before:schema.ts", (options) => {
|
|
1822
1818
|
for (const { exportName, path, _name, type } of schemaTS) {
|
|
1823
1819
|
if (!path.includes("vfs")) {
|
|
1824
1820
|
silgi.options.devServer.watch.push(path);
|
|
@@ -1835,13 +1831,14 @@ async function scanExportFile(silgi) {
|
|
|
1835
1831
|
value: _name
|
|
1836
1832
|
});
|
|
1837
1833
|
}
|
|
1838
|
-
options.
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1834
|
+
options.addImportItem({
|
|
1835
|
+
imports: [
|
|
1836
|
+
{
|
|
1837
|
+
name: _name,
|
|
1838
|
+
as: exportName
|
|
1839
|
+
}
|
|
1840
|
+
],
|
|
1841
|
+
specifier: relativeWithDot(silgi.options.build.typesDir, path)
|
|
1845
1842
|
});
|
|
1846
1843
|
}
|
|
1847
1844
|
});
|
|
@@ -1952,7 +1949,7 @@ ${injectedResult.code}`;
|
|
|
1952
1949
|
}
|
|
1953
1950
|
}
|
|
1954
1951
|
|
|
1955
|
-
async function
|
|
1952
|
+
async function prepareScanFile(silgi) {
|
|
1956
1953
|
const { genImports, genTypeImports, addImportItem, addImportItemType } = addImports({
|
|
1957
1954
|
imports: [
|
|
1958
1955
|
{
|
|
@@ -1992,11 +1989,7 @@ async function prepareServerFiles(silgi) {
|
|
|
1992
1989
|
const scanned = {
|
|
1993
1990
|
uris: {},
|
|
1994
1991
|
services: [],
|
|
1995
|
-
shareds: [
|
|
1996
|
-
`createShared({
|
|
1997
|
-
modulesURIs,
|
|
1998
|
-
})`
|
|
1999
|
-
],
|
|
1992
|
+
shareds: [],
|
|
2000
1993
|
schemas: [],
|
|
2001
1994
|
modulesURIs: {},
|
|
2002
1995
|
addImportItem,
|
|
@@ -2006,9 +1999,14 @@ async function prepareServerFiles(silgi) {
|
|
|
2006
1999
|
defu(scanned.uris, silgi.uris);
|
|
2007
2000
|
}
|
|
2008
2001
|
if (silgi.modulesURIs) {
|
|
2002
|
+
scanned.shareds.push(
|
|
2003
|
+
`createShared({
|
|
2004
|
+
modulesURIs,
|
|
2005
|
+
})`
|
|
2006
|
+
);
|
|
2009
2007
|
defu(scanned.modulesURIs, silgi.modulesURIs);
|
|
2010
2008
|
}
|
|
2011
|
-
await silgi.callHook("
|
|
2009
|
+
await silgi.callHook("before:scan.ts", scanned);
|
|
2012
2010
|
if (scanned.services.length > 0) {
|
|
2013
2011
|
addImportItem({
|
|
2014
2012
|
specifier: "silgi",
|
|
@@ -2066,14 +2064,14 @@ async function prepareServerFiles(silgi) {
|
|
|
2066
2064
|
scanned.shareds.length > 0 ? "])" : "}",
|
|
2067
2065
|
""
|
|
2068
2066
|
];
|
|
2069
|
-
await silgi.callHook("after:
|
|
2067
|
+
await silgi.callHook("after:scan.ts", importData);
|
|
2070
2068
|
importData.unshift(...importsContent);
|
|
2071
2069
|
importData.unshift(...baseHeaderBannerComment);
|
|
2072
2070
|
return importData;
|
|
2073
2071
|
}
|
|
2074
2072
|
|
|
2075
2073
|
async function writeScanFiles(silgi) {
|
|
2076
|
-
const data = await
|
|
2074
|
+
const data = await prepareScanFile(silgi);
|
|
2077
2075
|
if (!silgi.errors.length) {
|
|
2078
2076
|
await writeFile(
|
|
2079
2077
|
resolve(silgi.options.silgi.serverDir, "scan.ts"),
|
|
@@ -2083,7 +2081,7 @@ async function writeScanFiles(silgi) {
|
|
|
2083
2081
|
await readScanFile(silgi);
|
|
2084
2082
|
buildUriMap(silgi);
|
|
2085
2083
|
parseServices(silgi);
|
|
2086
|
-
silgi.hook("
|
|
2084
|
+
silgi.hook("before:scan.ts", (file) => {
|
|
2087
2085
|
file.uris = {
|
|
2088
2086
|
...file.uris,
|
|
2089
2087
|
...silgi.uris
|
package/dist/types/index.d.mts
CHANGED
|
@@ -34,23 +34,6 @@ interface SilgiCompatibilityIssues extends Array<SilgiCompatibilityIssue> {
|
|
|
34
34
|
toString: () => string;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated
|
|
39
|
-
*/
|
|
40
|
-
interface ImportItem {
|
|
41
|
-
importItems: {
|
|
42
|
-
[key: string]: {
|
|
43
|
-
import: {
|
|
44
|
-
type?: boolean;
|
|
45
|
-
name: string;
|
|
46
|
-
key: string;
|
|
47
|
-
}[];
|
|
48
|
-
from: string;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
customImports: string[];
|
|
52
|
-
customContent?: string[];
|
|
53
|
-
}
|
|
54
37
|
interface SilgiCLI {
|
|
55
38
|
_ignore?: Ignore;
|
|
56
39
|
errors: {
|
|
@@ -185,7 +168,6 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
185
168
|
*/
|
|
186
169
|
'close': (silgi: SilgiCLI) => HookResult;
|
|
187
170
|
'reload:scan': (path: string, stats?: Stats) => HookResult;
|
|
188
|
-
'prepare:createDTSFramework': (options: ImportItem) => HookResult;
|
|
189
171
|
/**
|
|
190
172
|
* Allows extending compatibility checks.
|
|
191
173
|
* @param compatibility Compatibility object
|
|
@@ -218,7 +200,7 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
218
200
|
}) => void;
|
|
219
201
|
}) => HookResult;
|
|
220
202
|
'after:core.ts': (content: string[]) => HookResult;
|
|
221
|
-
'
|
|
203
|
+
'before:scan.ts': (data: {
|
|
222
204
|
uris: Record<string, string>;
|
|
223
205
|
services: string[];
|
|
224
206
|
shareds: string[];
|
|
@@ -227,8 +209,10 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
227
209
|
addImportItem: (data: GenImport | GenImport[]) => void;
|
|
228
210
|
addImportItemType: (data: GenImport | GenImport[]) => void;
|
|
229
211
|
}) => HookResult;
|
|
230
|
-
'after:
|
|
231
|
-
'
|
|
212
|
+
'after:scan.ts': (content: string[]) => HookResult;
|
|
213
|
+
'before:schema.ts': (options: {
|
|
214
|
+
addImportItem: (data: GenImport | GenImport[]) => void;
|
|
215
|
+
addImportItemType: (data: GenImport | GenImport[]) => void;
|
|
232
216
|
options: {
|
|
233
217
|
key: string;
|
|
234
218
|
value: string;
|
|
@@ -279,9 +263,8 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
279
263
|
key: string;
|
|
280
264
|
value: string;
|
|
281
265
|
}[];
|
|
282
|
-
}
|
|
283
|
-
'after:
|
|
284
|
-
'prepare:framework.d.ts': (options: {} & ImportItem) => HookResult;
|
|
266
|
+
}) => HookResult;
|
|
267
|
+
'after:schema.ts': (content: string[]) => HookResult;
|
|
285
268
|
'prepare:configs.ts': (cliOptions: Record<string, any>) => HookResult;
|
|
286
269
|
/**
|
|
287
270
|
* Called during `SilgiCLI` generation, to allow customizing, modifying or adding new files to the build directory (either virtually or to written to `.nuxt`).
|
|
@@ -1196,4 +1179,4 @@ interface ServiceParseModule {
|
|
|
1196
1179
|
(params: ServiceParse): Awaited<void> | void;
|
|
1197
1180
|
}
|
|
1198
1181
|
|
|
1199
|
-
export type { AllPaths, AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CreateScope, DeepPartial, DeepRequired, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParams, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenImport, GenerateAppOptions, GraphQLJSON, HookResult, HttpMethod,
|
|
1182
|
+
export type { AllPaths, AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CreateScope, DeepPartial, DeepRequired, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParams, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenImport, GenerateAppOptions, GraphQLJSON, HookResult, HttpMethod, LoadConfigOptions, MergedSilgiSchema, MethodHandlerType, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, Namespaces, NitroBuildInfo, RequiredServiceType, ResolvedMethodHandlerType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedServiceType, ResolvedSilgiTemplate, RouteRules, RouterParams, ScanFile, ServiceParse, ServiceParseModule, ServiceType, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvents, SilgiFetchClient, SilgiFetchOptions, SilgiFrameworkInfo, SilgiFunction, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOperation, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRouteRules, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeRouteRules, SilgiRuntimeRouteRulesConfig, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiServiceInterface, SilgiStorageBase, SilgiTemplate, SilgiURIs, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, TrimAfterFourSlashes, URIsTypes };
|