@vixt/core 0.0.11 → 0.0.12

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
@@ -43,6 +43,10 @@ interface VixtOptions extends Record<string, any> {
43
43
  * @default '.vixt/types'
44
44
  */
45
45
  buildTypesDir?: string;
46
+ /**
47
+ * @default '.vixt/layers'
48
+ */
49
+ buildLayersDir?: string;
46
50
  /** layers */
47
51
  extends?: string[];
48
52
  /** modules */
package/dist/index.d.ts CHANGED
@@ -43,6 +43,10 @@ interface VixtOptions extends Record<string, any> {
43
43
  * @default '.vixt/types'
44
44
  */
45
45
  buildTypesDir?: string;
46
+ /**
47
+ * @default '.vixt/layers'
48
+ */
49
+ buildLayersDir?: string;
46
50
  /** layers */
47
51
  extends?: string[];
48
52
  /** modules */
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: vixt.options.rootDir,
19
+ root: rootDir,
19
20
  resolve: {
20
21
  alias: {
21
- "@": `${path.resolve(cwd(), "src")}`,
22
- "~": `${path.resolve(cwd(), "src")}`,
23
- "@@": path.resolve(cwd()),
24
- "~~": path.resolve(cwd())
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 newCwd = path.resolve(rootDir, buildLayersDir, e.cwd.split("/").pop());
55
- fs.copySync(e.cwd, newCwd, { filter: (src) => !/node_modules|tsconfig/.test(src) });
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
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.0.11",
4
+ "version": "0.0.12",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",