@vixt/core 0.0.9 → 0.0.11

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
@@ -1,5 +1,5 @@
1
1
  import * as vite from 'vite';
2
- import { PluginOption, UserConfig, TransformResult } from 'vite';
2
+ import { PluginOption, ResolvedConfig, TransformResult } from 'vite';
3
3
  import * as c12 from 'c12';
4
4
  import { ConfigLayer, LoadConfigOptions } from 'c12';
5
5
  import { TSConfig } from 'pkg-types';
@@ -47,7 +47,8 @@ interface VixtOptions extends Record<string, any> {
47
47
  extends?: string[];
48
48
  /** modules */
49
49
  modules?: VixtModule[];
50
- vite?: UserConfig;
50
+ /** use on configResolved */
51
+ vite?: ResolvedConfig;
51
52
  }
52
53
  interface VixtConfigLayer extends ConfigLayer<VixtOptions> {
53
54
  }
@@ -115,6 +116,7 @@ declare function defineVixtConfig(input: VixtOptions): VixtOptions;
115
116
  declare const rootDir: string;
116
117
  declare const buildDir = ".vixt";
117
118
  declare const buildTypesDir = ".vixt/types";
119
+ declare const buildLayersDir = ".vixt/layers";
118
120
  declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
119
121
  declare function resolveLayersDirs(layers?: VixtConfigLayer[]): Record<string, string[] | undefined>;
120
122
 
@@ -126,4 +128,4 @@ declare function applyLayerModules(layers?: VixtConfigLayer[]): Promise<VixtModu
126
128
  declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
127
129
  declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
128
130
 
129
- export { type AppHead, type AppOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
131
+ export { type AppHead, type AppOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, alias, app, applyLayerModules, buildDir, buildLayersDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vite from 'vite';
2
- import { PluginOption, UserConfig, TransformResult } from 'vite';
2
+ import { PluginOption, ResolvedConfig, TransformResult } from 'vite';
3
3
  import * as c12 from 'c12';
4
4
  import { ConfigLayer, LoadConfigOptions } from 'c12';
5
5
  import { TSConfig } from 'pkg-types';
@@ -47,7 +47,8 @@ interface VixtOptions extends Record<string, any> {
47
47
  extends?: string[];
48
48
  /** modules */
49
49
  modules?: VixtModule[];
50
- vite?: UserConfig;
50
+ /** use on configResolved */
51
+ vite?: ResolvedConfig;
51
52
  }
52
53
  interface VixtConfigLayer extends ConfigLayer<VixtOptions> {
53
54
  }
@@ -115,6 +116,7 @@ declare function defineVixtConfig(input: VixtOptions): VixtOptions;
115
116
  declare const rootDir: string;
116
117
  declare const buildDir = ".vixt";
117
118
  declare const buildTypesDir = ".vixt/types";
119
+ declare const buildLayersDir = ".vixt/layers";
118
120
  declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
119
121
  declare function resolveLayersDirs(layers?: VixtConfigLayer[]): Record<string, string[] | undefined>;
120
122
 
@@ -126,4 +128,4 @@ declare function applyLayerModules(layers?: VixtConfigLayer[]): Promise<VixtModu
126
128
  declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
127
129
  declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
128
130
 
129
- export { type AppHead, type AppOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
131
+ export { type AppHead, type AppOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, alias, app, applyLayerModules, buildDir, buildLayersDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
package/dist/index.mjs CHANGED
@@ -33,9 +33,10 @@ const alias = defineVixtModule({
33
33
  function defineVixtConfig(input) {
34
34
  return input;
35
35
  }
36
- const rootDir = cwd();
36
+ const rootDir = path.resolve(cwd());
37
37
  const buildDir = ".vixt";
38
38
  const buildTypesDir = `${buildDir}/types`;
39
+ const buildLayersDir = `${buildDir}/layers`;
39
40
  async function loadVixtConfig(opts) {
40
41
  const result = await loadConfig({
41
42
  name: "vixt",
@@ -48,7 +49,14 @@ async function loadVixtConfig(opts) {
48
49
  ...opts?.defaults
49
50
  }
50
51
  });
51
- result.layers = result.layers?.filter((e) => e.cwd);
52
+ result.layers = result.layers?.filter((e) => e.cwd).map((e) => {
53
+ 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) });
56
+ return { ...e, relatedCwd: e.cwd, cwd: newCwd };
57
+ }
58
+ return e;
59
+ });
52
60
  return result;
53
61
  }
54
62
  function resolveLayersDirs(layers = []) {
@@ -188,13 +196,10 @@ const app = defineVixtModule({
188
196
  const name$1 = "vixt:config";
189
197
  const config = defineVixtModule({
190
198
  meta: { name: name$1 },
191
- setup(options, vixt) {
199
+ setup(_, vixt) {
192
200
  return {
193
201
  name: name$1,
194
202
  enforce: "pre",
195
- config(config2) {
196
- vixt.options.vite = config2;
197
- },
198
203
  configResolved(config2) {
199
204
  vixt.options.vite = config2;
200
205
  }
@@ -326,4 +331,4 @@ function createVixtPlugin(loadOptions) {
326
331
  });
327
332
  }
328
333
 
329
- export { alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
334
+ export { alias, app, applyLayerModules, buildDir, buildLayersDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.0.9",
4
+ "version": "0.0.11",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",
@@ -26,8 +26,8 @@
26
26
  "mlly": "1.7.1",
27
27
  "pathe": "^1.1.2",
28
28
  "pkg-types": "^1.1.3",
29
- "tsx": "^4.16.0",
30
- "vite": "^5.3.2",
29
+ "tsx": "^4.16.2",
30
+ "vite": "^5.3.3",
31
31
  "vite-plugin-checker": "^0.7.0",
32
32
  "vue-tsc": "^2.0.24"
33
33
  },