@vixt/core 0.0.11 → 0.0.13
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.d.ts +4 -0
- package/dist/index.mjs +22 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cwd } from 'node:process';
|
|
2
1
|
import path from 'pathe';
|
|
2
|
+
import { cwd } from 'node:process';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import 'tsx/esm';
|
|
5
5
|
import { pathToFileURL } from 'mlly';
|
|
@@ -11,17 +11,19 @@ const name$3 = "vixt:alias";
|
|
|
11
11
|
const alias = defineVixtModule({
|
|
12
12
|
meta: { name: name$3 },
|
|
13
13
|
setup(_, vixt) {
|
|
14
|
+
const { rootDir, buildDir } = vixt.options;
|
|
14
15
|
return {
|
|
15
16
|
name: name$3,
|
|
16
17
|
config() {
|
|
17
18
|
return {
|
|
18
|
-
root:
|
|
19
|
+
root: rootDir,
|
|
19
20
|
resolve: {
|
|
20
21
|
alias: {
|
|
21
|
-
"@": `${path.resolve(
|
|
22
|
-
"~": `${path.resolve(
|
|
23
|
-
"@@": path.resolve(
|
|
24
|
-
"~~": path.resolve(
|
|
22
|
+
"@": `${path.resolve(rootDir, "src")}`,
|
|
23
|
+
"~": `${path.resolve(rootDir, "src")}`,
|
|
24
|
+
"@@": path.resolve(rootDir),
|
|
25
|
+
"~~": path.resolve(rootDir),
|
|
26
|
+
"#": path.resolve(rootDir, buildDir)
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
};
|
|
@@ -46,19 +48,28 @@ async function loadVixtConfig(opts) {
|
|
|
46
48
|
rootDir,
|
|
47
49
|
buildDir,
|
|
48
50
|
buildTypesDir,
|
|
51
|
+
buildLayersDir,
|
|
49
52
|
...opts?.defaults
|
|
50
53
|
}
|
|
51
54
|
});
|
|
52
55
|
result.layers = result.layers?.filter((e) => e.cwd).map((e) => {
|
|
53
56
|
if (e.cwd !== rootDir) {
|
|
54
|
-
const
|
|
55
|
-
|
|
57
|
+
const layerRootDir = e.cwd.split("/").pop();
|
|
58
|
+
const newCwd = path.resolve(rootDir, buildLayersDir, layerRootDir);
|
|
59
|
+
fs.copySync(e.cwd, newCwd, { filter: (src) => {
|
|
60
|
+
const nodeModulesPath = path.resolve(e.cwd, "node_modules");
|
|
61
|
+
const tsConfigPath = path.resolve(e.cwd, "tsconfig.json");
|
|
62
|
+
return !isSamePath(src, nodeModulesPath) && !isSamePath(src, tsConfigPath);
|
|
63
|
+
} });
|
|
56
64
|
return { ...e, relatedCwd: e.cwd, cwd: newCwd };
|
|
57
65
|
}
|
|
58
66
|
return e;
|
|
59
67
|
});
|
|
60
68
|
return result;
|
|
61
69
|
}
|
|
70
|
+
function isSamePath(a, b) {
|
|
71
|
+
return path.resolve(a) === path.resolve(b);
|
|
72
|
+
}
|
|
62
73
|
function resolveLayersDirs(layers = []) {
|
|
63
74
|
const dirs = {};
|
|
64
75
|
for (const layer of layers) {
|
|
@@ -279,7 +290,9 @@ const defaults = {
|
|
|
279
290
|
"@": ["../src"],
|
|
280
291
|
"@/*": ["../src/*"],
|
|
281
292
|
"~": ["../src"],
|
|
282
|
-
"~/*": ["../src/*"]
|
|
293
|
+
"~/*": ["../src/*"],
|
|
294
|
+
"#": ["."],
|
|
295
|
+
"#/*": ["./*"]
|
|
283
296
|
},
|
|
284
297
|
types: ["vite/client"]
|
|
285
298
|
},
|