@kimesh/auto-import 0.2.33 → 0.2.34

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.
Files changed (2) hide show
  1. package/dist/index.mjs +16 -4
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -490,14 +490,25 @@ function generateAutoImportsDts(registry) {
490
490
  "}"
491
491
  ].join("\n");
492
492
  }
493
+ /**
494
+ * Normalize import paths for user-facing type declarations.
495
+ *
496
+ * Since the tsconfig generator adds explicit path mappings for @kimesh/* packages
497
+ * (resolving to the actual package locations), we can use the internal package paths
498
+ * which provide full type information.
499
+ */
500
+ function normalizeImportPath(importPath) {
501
+ return importPath;
502
+ }
493
503
  const SPECIAL_FUNCTION_DECLARATIONS = { defineKimeshMiddleware: ` function defineKimeshMiddleware(middleware: import('@kimesh/router-runtime').RouteMiddleware): import('@kimesh/router-runtime').RouteMiddleware
494
504
  function defineKimeshMiddleware(definition: import('@kimesh/router-runtime').MiddlewareDefinition): import('@kimesh/router-runtime').RouteMiddleware` };
495
505
  function formatGlobalDeclaration(entry) {
496
506
  const comment = entry.layer !== "app" ? ` // from ${entry.layer}` : "";
497
507
  if (SPECIAL_FUNCTION_DECLARATIONS[entry.name]) return SPECIAL_FUNCTION_DECLARATIONS[entry.name];
498
- if (entry.isType) return ` type ${entry.name} = import('${entry.from}').${entry.name}${comment}`;
499
- if (entry.isDefault) return ` const ${entry.name}: typeof import('${entry.from}').default${comment}`;
500
- return ` const ${entry.name}: typeof import('${entry.from}').${entry.name}${comment}`;
508
+ const importPath = normalizeImportPath(entry.from);
509
+ if (entry.isType) return ` type ${entry.name} = import('${importPath}').${entry.name}${comment}`;
510
+ if (entry.isDefault) return ` const ${entry.name}: typeof import('${importPath}').default${comment}`;
511
+ return ` const ${entry.name}: typeof import('${importPath}').${entry.name}${comment}`;
501
512
  }
502
513
  function generateEslintGlobals(registry) {
503
514
  const globals = {};
@@ -541,7 +552,8 @@ function generatePresetComponentsDts(registry) {
541
552
  " export interface GlobalComponents {"
542
553
  ];
543
554
  const componentDeclarations = presetComponents.map(([name, entry]) => {
544
- return ` ${name}: ${entry.isDefault ? `typeof import('${entry.from}').default` : `typeof import('${entry.from}')['${entry.name}']`}`;
555
+ const normalizedPath = normalizeImportPath(entry.from);
556
+ return ` ${name}: ${entry.isDefault ? `typeof import('${normalizedPath}').default` : `typeof import('${normalizedPath}')['${entry.name}']`}`;
545
557
  });
546
558
  return [
547
559
  ...header,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimesh/auto-import",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
4
4
  "description": "OXC-powered auto-import system for Kimesh framework with layer support",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "test": "vitest"
26
26
  },
27
27
  "dependencies": {
28
- "@kimesh/shared": "0.2.33",
28
+ "@kimesh/shared": "0.2.34",
29
29
  "@vue/compiler-sfc": "^3.5.26",
30
30
  "consola": "^3.4.2",
31
31
  "magic-string": "^0.30.21",