@kimesh/kit 0.2.9 → 0.2.10-nightly.20260126101306
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 +4 -0
- package/dist/index.mjs +53 -23
- package/package.json +4 -4
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
|
|
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
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
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.
|
|
@@ -1734,24 +1737,31 @@ function generateKimeshDts() {
|
|
|
1734
1737
|
* DO NOT EDIT - This file is auto-generated by Kimesh.
|
|
1735
1738
|
*/
|
|
1736
1739
|
|
|
1740
|
+
import type { KimeshConfig } from '@kimesh/kit'
|
|
1741
|
+
|
|
1737
1742
|
export {}
|
|
1738
1743
|
|
|
1739
1744
|
declare global {
|
|
1740
1745
|
/**
|
|
1741
|
-
* Define Kimesh configuration with type inference.
|
|
1746
|
+
* Define Kimesh configuration with full type inference.
|
|
1742
1747
|
* This function is available globally in kimesh.config.ts files.
|
|
1743
1748
|
*
|
|
1744
1749
|
* @example
|
|
1745
1750
|
* \`\`\`ts
|
|
1746
1751
|
* export default defineKmConfig({
|
|
1747
1752
|
* name: 'my-app',
|
|
1753
|
+
* extends: ['@my-org/shared-layer'],
|
|
1754
|
+
* modules: ['@kimesh/tailwindcss'],
|
|
1748
1755
|
* dev: {
|
|
1749
1756
|
* port: 3000,
|
|
1750
1757
|
* },
|
|
1758
|
+
* runtimeConfig: {
|
|
1759
|
+
* apiBase: '/api',
|
|
1760
|
+
* },
|
|
1751
1761
|
* })
|
|
1752
1762
|
* \`\`\`
|
|
1753
1763
|
*/
|
|
1754
|
-
const defineKmConfig:
|
|
1764
|
+
const defineKmConfig: (config: KimeshConfig) => KimeshConfig
|
|
1755
1765
|
}
|
|
1756
1766
|
`;
|
|
1757
1767
|
}
|
|
@@ -2787,9 +2797,22 @@ function kimeshPlugin(options = {}) {
|
|
|
2787
2797
|
writeFileSync(registryPath, registryCode, "utf-8");
|
|
2788
2798
|
const typesCode = generateMiddlewareTypes(middlewareResult);
|
|
2789
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");
|
|
2790
2813
|
if (debug) consola.info(`[Kimesh] Middleware: ${middlewareResult.globalMiddleware.length} global, ${middlewareResult.namedMiddleware.length} named`);
|
|
2791
|
-
const middlewarePluginSrc = "
|
|
2792
|
-
if (!state.kimesh._registries.runtimePlugins.some((p) => p.
|
|
2814
|
+
const middlewarePluginSrc = join$1(resolvedDirs.buildDir, "middleware-plugin.mjs");
|
|
2815
|
+
if (!state.kimesh._registries.runtimePlugins.some((p) => p.name === "middleware")) {
|
|
2793
2816
|
state.kimesh._registries.runtimePlugins.push({
|
|
2794
2817
|
src: middlewarePluginSrc,
|
|
2795
2818
|
name: "middleware"
|
|
@@ -2889,7 +2912,14 @@ function kimeshPlugin(options = {}) {
|
|
|
2889
2912
|
sourcemap: resolvedBuildConfig.sourcemap,
|
|
2890
2913
|
minify: resolvedBuildConfig.minify,
|
|
2891
2914
|
rollupOptions: command === "build" ? { input: join$1(resolvedDirs.buildDir, "index.html") } : void 0
|
|
2892
|
-
}
|
|
2915
|
+
},
|
|
2916
|
+
optimizeDeps: { exclude: [
|
|
2917
|
+
"#kimesh/routes",
|
|
2918
|
+
"#kimesh/app",
|
|
2919
|
+
"#kimesh/context",
|
|
2920
|
+
"#kimesh/plugins",
|
|
2921
|
+
"#kimesh/middleware"
|
|
2922
|
+
] }
|
|
2893
2923
|
}, userViteOptions);
|
|
2894
2924
|
},
|
|
2895
2925
|
configResolved(resolvedConfig) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimesh/kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10-nightly.20260126101306",
|
|
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": "
|
|
35
|
-
"@kimesh/layers": "
|
|
36
|
-
"@kimesh/router-generator": "
|
|
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",
|