silgi 0.29.12 → 0.29.14
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/index.mjs +1 -1
- package/dist/cli/silgi.mjs +25 -21
- package/dist/types/index.d.mts +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
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
3
|
import { join, resolve, dirname, isAbsolute, relative, basename, extname } from 'pathe';
|
|
4
|
-
import { hasSilgiModule, addTemplate, normalizeTemplate, useLogger, genEnsureSafeVar, toArray, hash, writeFile, relativeWithDot, isDirectory, resolveAlias as resolveAlias$1, directoryToURL, hasError, parseServices, resolveSilgiPath } from 'silgi/kit';
|
|
4
|
+
import { hasSilgiModule, addTemplate, normalizeTemplate, useLogger, genEnsureSafeVar, toArray, hash, writeFile, relativeWithDot, isDirectory, 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';
|
|
@@ -364,7 +364,7 @@ async function prepareCoreFile(silgi) {
|
|
|
364
364
|
silgiConfigs: [],
|
|
365
365
|
addImportItem,
|
|
366
366
|
addImportItemType,
|
|
367
|
-
|
|
367
|
+
addBuildFunction: (data) => {
|
|
368
368
|
for (const item of toArray(data)) {
|
|
369
369
|
if (item.where === "after") {
|
|
370
370
|
after.push(item.params?.length ? ` await ${item.name}(option, ${item.params.join(",")})` : ` await ${item.name}(option)`);
|
|
@@ -398,6 +398,7 @@ async function prepareCoreFile(silgi) {
|
|
|
398
398
|
"",
|
|
399
399
|
"export async function buildSilgi(option: BuildSilgi) {",
|
|
400
400
|
"",
|
|
401
|
+
"// buildSilgiBefore",
|
|
401
402
|
...before,
|
|
402
403
|
"",
|
|
403
404
|
"const silgi = await createSilgi({",
|
|
@@ -423,6 +424,7 @@ async function prepareCoreFile(silgi) {
|
|
|
423
424
|
" }) as any,",
|
|
424
425
|
" })",
|
|
425
426
|
"",
|
|
427
|
+
"// buildSilgiAfter",
|
|
426
428
|
...after,
|
|
427
429
|
"",
|
|
428
430
|
" return silgi",
|
|
@@ -1061,26 +1063,28 @@ async function h3Framework(silgi, skip = false) {
|
|
|
1061
1063
|
""
|
|
1062
1064
|
);
|
|
1063
1065
|
});
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
errors
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
context.event.waitUntil
|
|
1066
|
+
addCoreFile({
|
|
1067
|
+
before: ({ silgiConfigs }) => {
|
|
1068
|
+
silgiConfigs.push({
|
|
1069
|
+
captureError: `(silgi, error, context = {}) => {
|
|
1070
|
+
const promise = silgi.hooks
|
|
1071
|
+
.callHookParallel('error', silgi, error, context)
|
|
1072
|
+
.catch((error_) => {
|
|
1073
|
+
console.error('Error while capturing another error', error_)
|
|
1074
|
+
})
|
|
1075
|
+
|
|
1076
|
+
if (context.event && isEvent(context.event)) {
|
|
1077
|
+
const errors = context.event.context.nitro?.errors
|
|
1078
|
+
if (errors) {
|
|
1079
|
+
errors.push({ error, context })
|
|
1080
|
+
}
|
|
1081
|
+
if (context.event.waitUntil) {
|
|
1082
|
+
context.event.waitUntil(promise)
|
|
1083
|
+
}
|
|
1080
1084
|
}
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1085
|
+
}`
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1084
1088
|
});
|
|
1085
1089
|
if (silgi.options.imports !== false) {
|
|
1086
1090
|
const h3Exports = await resolveModuleExportNames("h3", {
|
package/dist/types/index.d.mts
CHANGED
|
@@ -297,7 +297,7 @@ interface PrepareCore {
|
|
|
297
297
|
silgiConfigs: Record<string, any>[];
|
|
298
298
|
addImportItem: (data: GenImport | GenImport[]) => void;
|
|
299
299
|
addImportItemType: (data: GenImport | GenImport[]) => void;
|
|
300
|
-
|
|
300
|
+
addBuildFunction: (data: {
|
|
301
301
|
name: string;
|
|
302
302
|
params?: string[];
|
|
303
303
|
where: 'before' | 'after';
|