silgi 0.29.36 → 0.29.37
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 +3 -7
- package/dist/kit/index.d.mts +2 -1
- package/dist/kit/index.mjs +10 -2
- 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, 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';
|
|
4
|
+
import { hasSilgiModule, addTemplate, normalizeTemplate, useLogger, genEnsureSafeVar, baseHeaderBannerComment, addImports, hash, toArray, writeFile, relativeWithDot, isDirectory, isPresents, addCoreFile, resolveAlias as resolveAlias$1, directoryToURL, hasError, removeExtension, 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 { genAugmentation, genObjectFromRawEntries, genImport, genTypeImport, genObjectFromRaw, genObjectFromValues } from 'knitwork';
|
|
@@ -1860,10 +1860,8 @@ async function scanExportFile(silgi) {
|
|
|
1860
1860
|
if (type === "schema") {
|
|
1861
1861
|
options.schemas.push(_name);
|
|
1862
1862
|
}
|
|
1863
|
-
const relativePath = relativeWithDot(silgi.options.silgi.serverDir, path);
|
|
1864
|
-
const isExtension = silgi.options.typescript.removeFileExtension ? relativePath.replace(/\.+$/, "") : relativePath;
|
|
1865
1863
|
options.addImportItem({
|
|
1866
|
-
specifier:
|
|
1864
|
+
specifier: removeExtension(relativeWithDot(silgi.options.silgi.serverDir, path)),
|
|
1867
1865
|
imports: [
|
|
1868
1866
|
{
|
|
1869
1867
|
name: exportName,
|
|
@@ -1890,8 +1888,6 @@ async function scanExportFile(silgi) {
|
|
|
1890
1888
|
value: _name
|
|
1891
1889
|
});
|
|
1892
1890
|
}
|
|
1893
|
-
const relativePath = relativeWithDot(silgi.options.silgi.serverDir, path);
|
|
1894
|
-
const isExtension = silgi.options.typescript.removeFileExtension ? relativePath.replace(/\.+$/, "") : relativePath;
|
|
1895
1891
|
options.addImportItem({
|
|
1896
1892
|
imports: [
|
|
1897
1893
|
{
|
|
@@ -1899,7 +1895,7 @@ async function scanExportFile(silgi) {
|
|
|
1899
1895
|
as: _name
|
|
1900
1896
|
}
|
|
1901
1897
|
],
|
|
1902
|
-
specifier:
|
|
1898
|
+
specifier: removeExtension(relativeWithDot(silgi.options.build.typesDir, path))
|
|
1903
1899
|
});
|
|
1904
1900
|
}
|
|
1905
1901
|
});
|
package/dist/kit/index.d.mts
CHANGED
|
@@ -313,6 +313,7 @@ declare const baseHeaderBannerComment: string[];
|
|
|
313
313
|
declare function processFilePath(src: string): string;
|
|
314
314
|
declare function isPresents(names: PresetName[]): boolean;
|
|
315
315
|
declare function isRuntimePresents(names: PresetName[]): boolean;
|
|
316
|
+
declare function removeExtension(filePath: string): string;
|
|
316
317
|
|
|
317
|
-
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|
|
318
|
+
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, removeExtension, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|
|
318
319
|
export type { FunctionConfig, JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult };
|
package/dist/kit/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as useSilgiCLI$1 } from '../_chunks/silgiApp.mjs';
|
|
2
|
-
import { relative, resolve, dirname, join, normalize, isAbsolute, parse, basename } from 'pathe';
|
|
2
|
+
import { relative, extname, resolve, dirname, join, normalize, isAbsolute, parse, basename } from 'pathe';
|
|
3
3
|
import { useSilgiCLI, useSilgi, tryUseSilgiCLI } from 'silgi';
|
|
4
4
|
import { toArray as toArray$1, hash as hash$2 } from 'silgi/kit';
|
|
5
5
|
import { execSync } from 'node:child_process';
|
|
@@ -68,6 +68,14 @@ function isRuntimePresents(names) {
|
|
|
68
68
|
const silgi = useSilgi();
|
|
69
69
|
return names.includes(silgi.options.present);
|
|
70
70
|
}
|
|
71
|
+
function removeExtension(filePath) {
|
|
72
|
+
const silgi = useSilgiCLI();
|
|
73
|
+
if (silgi.options.typescript.removeFileExtension) {
|
|
74
|
+
const ext = extname(filePath);
|
|
75
|
+
return ext ? filePath.slice(0, -ext.length) : filePath;
|
|
76
|
+
}
|
|
77
|
+
return filePath;
|
|
78
|
+
}
|
|
71
79
|
|
|
72
80
|
async function addCommands(data) {
|
|
73
81
|
useSilgiCLI$1().hook("prepare:commands", (commads) => {
|
|
@@ -1045,4 +1053,4 @@ function isValidIp(ip) {
|
|
|
1045
1053
|
return false;
|
|
1046
1054
|
}
|
|
1047
1055
|
|
|
1048
|
-
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|
|
1056
|
+
export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, removeExtension, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
|