@kimesh/kit 0.2.10 → 0.2.11-nightly.20260126101410

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/index.d.mts CHANGED
@@ -1801,6 +1801,10 @@ interface InternalAliasConfig {
1801
1801
  *
1802
1802
  * Each entry maps an internal alias (#kimesh/...) to the actual internal
1803
1803
  * package subpath export (@kimesh/...) that should be resolved and re-exported.
1804
+ *
1805
+ * Note: #kimesh/middleware/plugin is NOT included here because it's generated
1806
+ * dynamically by the kit plugin (middleware-plugin.mjs) using createMiddlewarePlugin
1807
+ * with the scanned middleware registry. This avoids virtual module import issues.
1804
1808
  */
1805
1809
  declare const INTERNAL_ALIASES: InternalAliasConfig[];
1806
1810
  /**
package/dist/index.mjs CHANGED
@@ -1032,7 +1032,14 @@ function generatePluginsTemplate(options) {
1032
1032
  imports.push("// Module-registered plugins");
1033
1033
  for (const plugin of pluginsWithSrc) {
1034
1034
  const varName = toVariableName(plugin.name || "module", index);
1035
- const importPath = plugin.src.startsWith("@") || plugin.src.startsWith(".") || plugin.src.startsWith("#") || plugin.src.startsWith("kimesh/") ? plugin.src : relative(buildDir, plugin.src).replace(/\.ts$/, "");
1035
+ const isPackageOrAliasPath = plugin.src.startsWith("@") || plugin.src.startsWith(".") || plugin.src.startsWith("#") || plugin.src.startsWith("kimesh/");
1036
+ let importPath;
1037
+ if (isPackageOrAliasPath) importPath = plugin.src;
1038
+ else {
1039
+ let relativePath = relative(buildDir, plugin.src).replace(/\.ts$/, "");
1040
+ if (!relativePath.startsWith(".") && !relativePath.startsWith("/")) relativePath = "./" + relativePath;
1041
+ importPath = relativePath;
1042
+ }
1036
1043
  imports.push(`import ${varName} from '${importPath}'`);
1037
1044
  pluginVars.push(varName);
1038
1045
  index++;
@@ -1102,24 +1109,20 @@ function addPluginsTemplate(kimesh, discoveredPlugins) {
1102
1109
  *
1103
1110
  * Each entry maps an internal alias (#kimesh/...) to the actual internal
1104
1111
  * package subpath export (@kimesh/...) that should be resolved and re-exported.
1112
+ *
1113
+ * Note: #kimesh/middleware/plugin is NOT included here because it's generated
1114
+ * dynamically by the kit plugin (middleware-plugin.mjs) using createMiddlewarePlugin
1115
+ * with the scanned middleware registry. This avoids virtual module import issues.
1105
1116
  */
1106
- const INTERNAL_ALIASES = [
1107
- {
1108
- alias: "#kimesh/head/plugin",
1109
- packageSpecifier: "@kimesh/head/plugin",
1110
- filename: "head-plugin.mjs"
1111
- },
1112
- {
1113
- alias: "#kimesh/router-runtime/default-app",
1114
- packageSpecifier: "@kimesh/router-runtime/default-app",
1115
- filename: "router-runtime-default-app.mjs"
1116
- },
1117
- {
1118
- alias: "#kimesh/middleware/plugin",
1119
- packageSpecifier: "@kimesh/router-runtime/middleware/plugin",
1120
- filename: "middleware-plugin.mjs"
1121
- }
1122
- ];
1117
+ const INTERNAL_ALIASES = [{
1118
+ alias: "#kimesh/head/plugin",
1119
+ packageSpecifier: "@kimesh/head/plugin",
1120
+ filename: "head-plugin.mjs"
1121
+ }, {
1122
+ alias: "#kimesh/router-runtime/default-app",
1123
+ packageSpecifier: "@kimesh/router-runtime/default-app",
1124
+ filename: "router-runtime-default-app.mjs"
1125
+ }];
1123
1126
  /**
1124
1127
  * Resolve a package specifier to an absolute file path.
1125
1128
  * This uses exsolve/createRequire to find the package from @kimesh/kit's location.
@@ -2794,9 +2797,22 @@ function kimeshPlugin(options = {}) {
2794
2797
  writeFileSync(registryPath, registryCode, "utf-8");
2795
2798
  const typesCode = generateMiddlewareTypes(middlewareResult);
2796
2799
  writeFileSync(join$1(resolvedDirs.buildDir, "middleware.d.ts"), typesCode, "utf-8");
2800
+ writeFileSync(join$1(resolvedDirs.buildDir, "middleware-plugin.mjs"), `/**
2801
+ * Kimesh Middleware Plugin - Auto-generated
2802
+ * DO NOT EDIT - This file is regenerated when middleware files change
2803
+ */
2804
+
2805
+ import { createMiddlewarePlugin } from '@kimesh/router-runtime'
2806
+ import { globalMiddleware, namedMiddleware } from './middleware.gen'
2807
+
2808
+ export default createMiddlewarePlugin({
2809
+ globalMiddleware,
2810
+ namedMiddleware,
2811
+ })
2812
+ `, "utf-8");
2797
2813
  if (debug) consola.info(`[Kimesh] Middleware: ${middlewareResult.globalMiddleware.length} global, ${middlewareResult.namedMiddleware.length} named`);
2798
- const middlewarePluginSrc = "#kimesh/middleware/plugin";
2799
- if (!state.kimesh._registries.runtimePlugins.some((p) => p.src === middlewarePluginSrc)) {
2814
+ const middlewarePluginSrc = join$1(resolvedDirs.buildDir, "middleware-plugin.mjs");
2815
+ if (!state.kimesh._registries.runtimePlugins.some((p) => p.name === "middleware")) {
2800
2816
  state.kimesh._registries.runtimePlugins.push({
2801
2817
  src: middlewarePluginSrc,
2802
2818
  name: "middleware"
@@ -2896,7 +2912,14 @@ function kimeshPlugin(options = {}) {
2896
2912
  sourcemap: resolvedBuildConfig.sourcemap,
2897
2913
  minify: resolvedBuildConfig.minify,
2898
2914
  rollupOptions: command === "build" ? { input: join$1(resolvedDirs.buildDir, "index.html") } : void 0
2899
- }
2915
+ },
2916
+ optimizeDeps: { exclude: [
2917
+ "#kimesh/routes",
2918
+ "#kimesh/app",
2919
+ "#kimesh/context",
2920
+ "#kimesh/plugins",
2921
+ "#kimesh/middleware"
2922
+ ] }
2900
2923
  }, userViteOptions);
2901
2924
  },
2902
2925
  configResolved(resolvedConfig) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimesh/kit",
3
- "version": "0.2.10",
3
+ "version": "0.2.11-nightly.20260126101410",
4
4
  "description": "Build-time engine for Kimesh framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "vue": "^3.5.0"
32
32
  },
33
33
  "dependencies": {
34
- "@kimesh/auto-import": "0.2.10",
35
- "@kimesh/layers": "0.2.10",
36
- "@kimesh/router-generator": "0.2.10",
34
+ "@kimesh/auto-import": "workspace:*",
35
+ "@kimesh/layers": "workspace:*",
36
+ "@kimesh/router-generator": "workspace:*",
37
37
  "@vitejs/plugin-vue": "^6.0.3",
38
38
  "c12": "^3.3.3",
39
39
  "consola": "^3.4.2",