silgi 0.41.40 → 0.41.42
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/build.mjs +1 -0
- package/dist/cli/build.mjs +9 -5
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/init.mjs +1 -0
- package/dist/cli/install.mjs +1 -0
- package/dist/cli/run.mjs +1 -0
- package/dist/cli/watch.mjs +1 -0
- package/package.json +1 -1
package/dist/build.mjs
CHANGED
package/dist/cli/build.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { consola } from 'consola';
|
|
2
2
|
import { createHooks, createDebugger } from 'hookable';
|
|
3
|
-
import { resolve, join, relative, extname, basename, dirname, isAbsolute } from 'pathe';
|
|
3
|
+
import { resolve, join, relative, extname, basename, dirname as dirname$1, isAbsolute } from 'pathe';
|
|
4
4
|
import { useSilgiCLI, replaceRuntimeValues, silgiCLICtx, autoImportTypes } from 'silgi';
|
|
5
5
|
import { isPresents, addTemplate, addCoreFile, genEnsureSafeVar, getServicePath, writeFile, relativeWithDot, hash, removeExtension, resolveAlias, directoryToURL, baseHeaderBannerComment, addImports, resolveSilgiPath, hasSilgiModule, normalizeTemplate, useLogger, toArray, isDirectory } from 'silgi/kit';
|
|
6
6
|
import { initRuntimeConfig, useRuntimeConfig, sharedRuntimeConfig } from 'silgi/runtime';
|
|
@@ -10,6 +10,7 @@ import * as p from '@clack/prompts';
|
|
|
10
10
|
import { existsSync, promises, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
11
11
|
import * as dotenv from 'dotenv';
|
|
12
12
|
import { genImport, genTypeImport, genObjectFromRawEntries, genAugmentation } from 'knitwork';
|
|
13
|
+
import { join as join$1, dirname } from 'node:path';
|
|
13
14
|
import { findTypeExports, findExports, resolvePath, parseNodeModulePath, lookupNodeModuleSubpath } from 'mlly';
|
|
14
15
|
import { createJiti } from 'dev-jiti';
|
|
15
16
|
import { h as hasInstalledModule } from './compatibility.mjs';
|
|
@@ -326,7 +327,7 @@ async function registerModuleExportScan(silgi) {
|
|
|
326
327
|
if (!module.entryPath) {
|
|
327
328
|
continue;
|
|
328
329
|
}
|
|
329
|
-
const path = module.meta._packageName ? module.entryPath
|
|
330
|
+
const path = module.meta._packageName ? join$1(dirname(module.entryPath), "types/index.d.mts") : join$1(dirname(module.entryPath), "types/index.ts");
|
|
330
331
|
const moduleTypes = await promises.readFile(path, "utf8").catch(() => "");
|
|
331
332
|
const normalisedModuleTypes = moduleTypes.replace(/export\s*\{.*?\}/gs, (match) => match.replace(/\b(type|interface)\b/g, ""));
|
|
332
333
|
for (const e of findTypeExports(normalisedModuleTypes)) {
|
|
@@ -338,7 +339,10 @@ async function registerModuleExportScan(silgi) {
|
|
|
338
339
|
const hasTypeExport = (name) => moduleReExports.find((exp) => exp.names?.includes(name));
|
|
339
340
|
const configKey = module.meta.configKey;
|
|
340
341
|
const moduleName = module.meta.name || module.meta._packageName;
|
|
341
|
-
const specifier = module.meta._packageName ? moduleName : relativeWithDot(
|
|
342
|
+
const specifier = module.meta._packageName ? moduleName : relativeWithDot(
|
|
343
|
+
silgi.options.build.typesDir,
|
|
344
|
+
join$1(dirname(module.entryPath), "types/index")
|
|
345
|
+
);
|
|
342
346
|
if (hasTypeExport("ModuleOptions")) {
|
|
343
347
|
const importName = hash(`${configKey}ModuleOptions`);
|
|
344
348
|
options.addImportItemType({
|
|
@@ -690,7 +694,7 @@ function registerExportsWithHooks(silgiInstance, runtimeExports, typeExports, pa
|
|
|
690
694
|
}
|
|
691
695
|
async function verifyDirectoryCaseSensitivity(directoryPath, rootDirectory) {
|
|
692
696
|
const directoryName = basename(directoryPath);
|
|
693
|
-
const parentDirectory = dirname(directoryPath);
|
|
697
|
+
const parentDirectory = dirname$1(directoryPath);
|
|
694
698
|
try {
|
|
695
699
|
const siblingEntries = await readdir(parentDirectory);
|
|
696
700
|
if (!siblingEntries.includes(directoryName)) {
|
|
@@ -1585,7 +1589,7 @@ async function generateApp(app, options = {}) {
|
|
|
1585
1589
|
logger.info(`Compiled \`${template.filename}\` in ${setupTime}ms`);
|
|
1586
1590
|
}
|
|
1587
1591
|
if (template.modified && template.write) {
|
|
1588
|
-
dirs.add(dirname(fullPath));
|
|
1592
|
+
dirs.add(dirname$1(fullPath));
|
|
1589
1593
|
if (template.skipIfExists && existsSync(fullPath)) {
|
|
1590
1594
|
return;
|
|
1591
1595
|
}
|
package/dist/cli/index.mjs
CHANGED
package/dist/cli/init.mjs
CHANGED
package/dist/cli/install.mjs
CHANGED
package/dist/cli/run.mjs
CHANGED
package/dist/cli/watch.mjs
CHANGED