@vixt/core 0.7.0 → 0.7.1

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.
@@ -137,6 +137,12 @@ interface VixtOptions {
137
137
  plugins?: string[];
138
138
  /** typescript */
139
139
  typescript?: TypescriptOptions;
140
+ /**
141
+ * Whether to copy layers from `node_modules` to `.vixt/layers`
142
+ * @default true
143
+ * @experimental
144
+ */
145
+ copyLayers?: boolean;
140
146
  /** custom options */
141
147
  [key: string]: any;
142
148
  }
@@ -74,13 +74,23 @@ async function loadVixtConfig(opts) {
74
74
  return result;
75
75
  }
76
76
  function applyLayers(layers, config) {
77
- const { rootDir } = config;
77
+ const { rootDir, buildLayersDir, copyLayers = true } = config;
78
78
  return layers.filter((e) => e.cwd).map((layer) => {
79
79
  layer.config ??= {};
80
80
  layer.config.meta ??= {};
81
81
  const meta = layer.config.meta;
82
82
  const layerName = meta.name || layer.cwd.split("/").pop();
83
83
  if (!isSamePath(layer.cwd, resolve(rootDir))) meta.alias = `#/layers/${layerName}`;
84
+ if (copyLayers && layer.cwd?.includes("node_modules")) {
85
+ const newCwd = resolve(buildLayersDir, layerName);
86
+ fs.removeSync(newCwd);
87
+ fs.copySync(layer.cwd, newCwd, { filter: (src) => {
88
+ const nodeModulesPath = resolve(layer.cwd, "node_modules");
89
+ const tsConfigPath = resolve(layer.cwd, "tsconfig.json");
90
+ return !isSamePath(src, nodeModulesPath) && !isSamePath(src, tsConfigPath);
91
+ } });
92
+ layer.cwd = newCwd;
93
+ }
84
94
  layer.config.rootDir ??= layer.cwd;
85
95
  layer.config.srcDir ??= resolve(layer.config.rootDir, "src");
86
96
  layer.config.modulesDir ??= resolve(layer.config.srcDir, "modules");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.7.0",
4
+ "version": "0.7.1",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://soullyoko.github.io/vixt/",