@vixt/vue 0.0.5 → 0.0.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.d.mts CHANGED
@@ -1,6 +1,34 @@
1
1
  import * as vite from 'vite';
2
- import { VixtOptions } from '@vixt/core';
2
+ import * as _vixt_core from '@vixt/core';
3
+ import { AppOptions, PluginOptions, VixtOptions } from '@vixt/core';
4
+ import Vue from '@vitejs/plugin-vue';
5
+ import Components from 'unplugin-vue-components/vite';
6
+ import AutoImport from 'unplugin-auto-import/vite';
7
+ import VueDevTools from 'vite-plugin-vue-devtools';
8
+ import VueRouter from 'unplugin-vue-router/vite';
9
+ import UnoCSS from 'unocss/vite';
10
+
11
+ declare const entryVue: _vixt_core.VixtModule<AppOptions>;
12
+
13
+ declare module '@vixt/core' {
14
+ interface VixtOptions {
15
+ vue?: PluginOptions<typeof Vue>;
16
+ /** https://github.com/posva/unplugin-vue-router */
17
+ router?: PluginOptions<typeof VueRouter>;
18
+ /** https://github.com/JohnCampionJr/vite-plugin-vue-layouts */
19
+ layouts?: any;
20
+ /** https://github.com/antfu/unplugin-vue-components */
21
+ components?: PluginOptions<typeof Components>;
22
+ /** https://github.com/antfu/unplugin-auto-import */
23
+ imports?: PluginOptions<typeof AutoImport>;
24
+ /** https://github.com/antfu/unocss */
25
+ unocss?: PluginOptions<typeof UnoCSS>;
26
+ /** https://github.com/webfansplz/vite-plugin-vue-devtools */
27
+ devtools?: PluginOptions<typeof VueDevTools>;
28
+ }
29
+ }
30
+ declare const presetVue: _vixt_core.VixtModule<VixtOptions>;
3
31
 
4
32
  declare const _default: (options?: VixtOptions | undefined) => vite.PluginOption;
5
33
 
6
- export { _default as default };
34
+ export { _default as default, entryVue, presetVue };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,34 @@
1
1
  import * as vite from 'vite';
2
- import { VixtOptions } from '@vixt/core';
2
+ import * as _vixt_core from '@vixt/core';
3
+ import { AppOptions, PluginOptions, VixtOptions } from '@vixt/core';
4
+ import Vue from '@vitejs/plugin-vue';
5
+ import Components from 'unplugin-vue-components/vite';
6
+ import AutoImport from 'unplugin-auto-import/vite';
7
+ import VueDevTools from 'vite-plugin-vue-devtools';
8
+ import VueRouter from 'unplugin-vue-router/vite';
9
+ import UnoCSS from 'unocss/vite';
10
+
11
+ declare const entryVue: _vixt_core.VixtModule<AppOptions>;
12
+
13
+ declare module '@vixt/core' {
14
+ interface VixtOptions {
15
+ vue?: PluginOptions<typeof Vue>;
16
+ /** https://github.com/posva/unplugin-vue-router */
17
+ router?: PluginOptions<typeof VueRouter>;
18
+ /** https://github.com/JohnCampionJr/vite-plugin-vue-layouts */
19
+ layouts?: any;
20
+ /** https://github.com/antfu/unplugin-vue-components */
21
+ components?: PluginOptions<typeof Components>;
22
+ /** https://github.com/antfu/unplugin-auto-import */
23
+ imports?: PluginOptions<typeof AutoImport>;
24
+ /** https://github.com/antfu/unocss */
25
+ unocss?: PluginOptions<typeof UnoCSS>;
26
+ /** https://github.com/webfansplz/vite-plugin-vue-devtools */
27
+ devtools?: PluginOptions<typeof VueDevTools>;
28
+ }
29
+ }
30
+ declare const presetVue: _vixt_core.VixtModule<VixtOptions>;
3
31
 
4
32
  declare const _default: (options?: VixtOptions | undefined) => vite.PluginOption;
5
33
 
6
- export { _default as default };
34
+ export { _default as default, entryVue, presetVue };
package/dist/index.mjs CHANGED
@@ -18,11 +18,10 @@ function resolveLayersPlugins(layers, from) {
18
18
  return `${pluginsDir}/*.ts`;
19
19
  });
20
20
  }
21
- function generateMainTs(options, vixt, config) {
22
- const { buildDir } = vixt.options;
23
- const { rootId } = options;
24
- const layersPluginsPath = resolveLayersPlugins(vixt._layers, path.join(config.root, buildDir));
25
- const baseURL = options?.baseURL ?? config.env.BASE_URL ?? "/";
21
+ function generateMainTs(options, vixt) {
22
+ const { buildDir, rootDir } = vixt.options;
23
+ const { rootId, baseURL } = options;
24
+ const layersPluginsPath = resolveLayersPlugins(vixt._layers, path.join(rootDir, buildDir));
26
25
  const cssTemplate = options?.css?.map((e) => `import '${e}'`).join("\n");
27
26
  const code = `/** Generated by Vixt */
28
27
  // @ts-nocheck
@@ -32,8 +31,8 @@ import { routes } from 'vue-router/auto-routes'
32
31
  import { setupLayouts } from 'virtual:generated-layouts'
33
32
  import { createPinia } from 'pinia'
34
33
  import { createPersistedState } from 'pinia-plugin-persistedstate'
35
- import App from '@/App.vue'
36
34
 
35
+ import App from '@/App.vue'
37
36
  ${cssTemplate}
38
37
 
39
38
  const pinia = createPinia()
@@ -53,23 +52,22 @@ Object.values(plugins).forEach((plugin) => typeof plugin === 'function' && plugi
53
52
 
54
53
  app.mount('#${rootId}')
55
54
  `;
56
- fs.outputFileSync(path.resolve(config.root, `${buildDir}/main.ts`), code);
55
+ fs.outputFileSync(path.resolve(rootDir, buildDir, "main.ts"), code);
57
56
  return code;
58
57
  }
59
- const name = "vixt:entry";
58
+ const name = "vixt:entry-vue";
60
59
  const defaults$1 = {
60
+ baseURL: "/",
61
61
  rootId: "app",
62
62
  css: ["virtual:uno.css"]
63
63
  };
64
- const entry = defineVixtModule({
64
+ const entryVue = defineVixtModule({
65
65
  meta: { name, configKey: "app" },
66
66
  defaults: defaults$1,
67
67
  setup(options, vixt) {
68
+ generateMainTs(options, vixt);
68
69
  return {
69
- name: "vixt:entry",
70
- configResolved(config) {
71
- generateMainTs(options, vixt, config);
72
- }
70
+ name
73
71
  };
74
72
  }
75
73
  });
@@ -113,7 +111,7 @@ const presetVue = defineVixtModule({
113
111
  });
114
112
 
115
113
  const defaults = {
116
- modules: [entry, presetVue],
114
+ modules: [entryVue, presetVue],
117
115
  app: {
118
116
  head: {
119
117
  link: [{ rel: "icon", href: "/favicon.ico" }]
@@ -121,9 +119,10 @@ const defaults = {
121
119
  },
122
120
  typescript: {
123
121
  references: ["types/typed-router.d.ts", "types/components.d.ts", "types/auto-imports.d.ts", "types/vite-env.d.ts"],
124
- tsConfig: { compilerOptions: { types: ["vite-plugin-vue-layouts/client", "unplugin-vue-router/client"] } }
122
+ tsConfig: { compilerOptions: { types: ["vite-plugin-vue-layouts/client", "unplugin-vue-router/client"] } },
123
+ typeCheck: { vueTsc: true }
125
124
  }
126
125
  };
127
126
  const index = createVixtPlugin({ defaults });
128
127
 
129
- export { index as default };
128
+ export { index as default, entryVue, presetVue };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/vue",
3
3
  "type": "module",
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",
@@ -31,7 +31,7 @@
31
31
  "vite-plugin-vue-layouts": "^0.11.0",
32
32
  "vue": "^3.4.31",
33
33
  "vue-router": "^4.4.0",
34
- "@vixt/core": "0.0.5"
34
+ "@vixt/core": "0.0.7"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "unbuild"