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 CHANGED
@@ -16,6 +16,7 @@ import '@clack/prompts';
16
16
  import 'node:fs';
17
17
  import 'dotenv';
18
18
  import 'knitwork';
19
+ import 'node:path';
19
20
  import 'mlly';
20
21
  import 'dev-jiti';
21
22
  import './cli/compatibility.mjs';
@@ -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.replace(/\.mjs$/, "Types.d.mts") : 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(silgi.options.build.typesDir, module.entryPath);
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
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.41.40";
4
+ const version = "0.41.42";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
package/dist/cli/init.mjs CHANGED
@@ -15,6 +15,7 @@ import 'silgi/runtime/meta';
15
15
  import 'unimport';
16
16
  import 'dotenv';
17
17
  import 'knitwork';
18
+ import 'node:path';
18
19
  import 'mlly';
19
20
  import 'dev-jiti';
20
21
  import './compatibility.mjs';
@@ -18,6 +18,7 @@ import '@clack/prompts';
18
18
  import 'node:fs';
19
19
  import 'dotenv';
20
20
  import 'knitwork';
21
+ import 'node:path';
21
22
  import 'mlly';
22
23
  import 'dev-jiti';
23
24
  import './compatibility.mjs';
package/dist/cli/run.mjs CHANGED
@@ -21,6 +21,7 @@ import '@clack/prompts';
21
21
  import 'node:fs';
22
22
  import 'dotenv';
23
23
  import 'knitwork';
24
+ import 'node:path';
24
25
  import 'mlly';
25
26
  import 'dev-jiti';
26
27
  import './compatibility.mjs';
@@ -20,6 +20,7 @@ import '@clack/prompts';
20
20
  import 'node:fs';
21
21
  import 'dotenv';
22
22
  import 'knitwork';
23
+ import 'node:path';
23
24
  import 'mlly';
24
25
  import 'dev-jiti';
25
26
  import './compatibility.mjs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.41.40",
4
+ "version": "0.41.42",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {