@kimesh/kit 0.2.6 → 0.2.7
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.mjs +41 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import consola from "consola";
|
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
10
10
|
import fg from "fast-glob";
|
|
11
|
-
import { basename, extname, isAbsolute as isAbsolute$1, join as join$1, relative, resolve as resolve$1 } from "pathe";
|
|
11
|
+
import { basename, dirname as dirname$1, extname, isAbsolute as isAbsolute$1, join as join$1, relative, resolve as resolve$1 } from "pathe";
|
|
12
12
|
import ignore from "ignore";
|
|
13
13
|
import pc from "picocolors";
|
|
14
14
|
import { defu } from "defu";
|
|
@@ -2163,6 +2163,44 @@ function findWorkspaceRoot(startDir) {
|
|
|
2163
2163
|
return startDir;
|
|
2164
2164
|
}
|
|
2165
2165
|
/**
|
|
2166
|
+
* Try to resolve a package path from multiple locations
|
|
2167
|
+
* This handles various package manager layouts (npm, pnpm, bun, yarn)
|
|
2168
|
+
*/
|
|
2169
|
+
function tryResolvePackage(packageName, fromDir) {
|
|
2170
|
+
const require = createRequire(join$1(fromDir, "package.json"));
|
|
2171
|
+
try {
|
|
2172
|
+
return dirname$1(require.resolve(`${packageName}/package.json`));
|
|
2173
|
+
} catch {
|
|
2174
|
+
const locations = [join$1(fromDir, "node_modules", packageName), join$1(findWorkspaceRoot(fromDir), "node_modules", packageName)];
|
|
2175
|
+
for (const loc of locations) if (existsSync(join$1(loc, "package.json"))) return loc;
|
|
2176
|
+
return null;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
/**
|
|
2180
|
+
* Build aliases for @kimesh/* packages
|
|
2181
|
+
* This ensures Vite can resolve these packages regardless of package manager
|
|
2182
|
+
*/
|
|
2183
|
+
function buildKimeshPackageAliases(rootDir, debug$1) {
|
|
2184
|
+
const packages = [
|
|
2185
|
+
"@kimesh/router-runtime",
|
|
2186
|
+
"@kimesh/head",
|
|
2187
|
+
"@kimesh/query",
|
|
2188
|
+
"@kimesh/kit",
|
|
2189
|
+
"@kimesh/layers",
|
|
2190
|
+
"@kimesh/auto-import",
|
|
2191
|
+
"@kimesh/router-generator"
|
|
2192
|
+
];
|
|
2193
|
+
const aliases = {};
|
|
2194
|
+
for (const pkg of packages) {
|
|
2195
|
+
const resolved = tryResolvePackage(pkg, rootDir);
|
|
2196
|
+
if (resolved) {
|
|
2197
|
+
aliases[pkg] = resolved;
|
|
2198
|
+
if (debug$1) consola.debug(`[Kimesh] Resolved ${pkg} -> ${resolved}`);
|
|
2199
|
+
} else if (debug$1) consola.warn(`[Kimesh] Could not resolve ${pkg}`);
|
|
2200
|
+
}
|
|
2201
|
+
return aliases;
|
|
2202
|
+
}
|
|
2203
|
+
/**
|
|
2166
2204
|
* Process all configured modules using the new v2 system
|
|
2167
2205
|
*/
|
|
2168
2206
|
async function processModules(kimesh, debug$1) {
|
|
@@ -2300,6 +2338,7 @@ function kimeshPlugin(options = {}) {
|
|
|
2300
2338
|
generateModulesTypeDeclaration(config.modules, state.generatedDir);
|
|
2301
2339
|
await writeTemplates(state.kimesh);
|
|
2302
2340
|
const userAliases = buildAliases(config, resolvedDirs.srcDir, configRoot);
|
|
2341
|
+
const kimeshPackageAliases = buildKimeshPackageAliases(configRoot, debug$1);
|
|
2303
2342
|
const moduleAliases = {};
|
|
2304
2343
|
for (const alias of state.kimesh._registries.aliases) if (typeof alias.find === "string") moduleAliases[alias.find] = alias.replacement;
|
|
2305
2344
|
const appVuePath = resolve$1(resolvedDirs.srcDir, "app.vue");
|
|
@@ -2352,6 +2391,7 @@ function kimeshPlugin(options = {}) {
|
|
|
2352
2391
|
__KIMESH_LAYERS_CONFIG__: JSON.stringify(layerConfigMap)
|
|
2353
2392
|
},
|
|
2354
2393
|
resolve: { alias: {
|
|
2394
|
+
...kimeshPackageAliases,
|
|
2355
2395
|
"#kimesh/routes": join$1(resolvedDirs.buildDir, "routes.gen.ts"),
|
|
2356
2396
|
"#kimesh/app": existsSync(appVuePath) ? appVuePath : "@kimesh/router-runtime/default-app",
|
|
2357
2397
|
"#kimesh/context": join$1(resolvedDirs.srcDir, "app.context.ts"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimesh/kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Build-time engine for Kimesh framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"vue": "^3.5.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@kimesh/auto-import": "0.2.
|
|
34
|
-
"@kimesh/layers": "0.2.
|
|
35
|
-
"@kimesh/router-generator": "0.2.
|
|
33
|
+
"@kimesh/auto-import": "0.2.7",
|
|
34
|
+
"@kimesh/layers": "0.2.7",
|
|
35
|
+
"@kimesh/router-generator": "0.2.7",
|
|
36
36
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
37
37
|
"c12": "^3.3.3",
|
|
38
38
|
"consola": "^3.4.2",
|