@vixt/vue 0.1.9 → 0.1.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 +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.mjs +25 -8
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import * as _vixt_core from '@vixt/core';
|
|
3
3
|
import { PluginOptions, VixtOptions } from '@vixt/core';
|
|
4
|
+
import { TreeNode } from 'unplugin-vue-router';
|
|
5
|
+
import { RouterOptions } from 'vue-router';
|
|
6
|
+
import { PersistedStateFactoryOptions } from 'pinia-plugin-persistedstate';
|
|
4
7
|
import Vue from '@vitejs/plugin-vue';
|
|
5
8
|
import Layouts from 'vite-plugin-vue-layouts';
|
|
6
9
|
import Components from 'unplugin-vue-components/vite';
|
|
@@ -28,8 +31,16 @@ declare module '@vixt/core' {
|
|
|
28
31
|
};
|
|
29
32
|
}
|
|
30
33
|
}
|
|
34
|
+
declare module '@vixt/core/client' {
|
|
35
|
+
interface VixtAppConfig {
|
|
36
|
+
router?: RouterOptions;
|
|
37
|
+
/** https://github.com/prazdevs/pinia-plugin-persistedstate */
|
|
38
|
+
piniaPersistedState?: PersistedStateFactoryOptions;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
declare function normalizeRouteName(route: TreeNode['value'], name?: string): string;
|
|
31
42
|
declare const presetVue: _vixt_core.VixtModule<VixtOptions>;
|
|
32
43
|
|
|
33
44
|
declare const _default: (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
34
45
|
|
|
35
|
-
export { _default as default, presetVue };
|
|
46
|
+
export { _default as default, normalizeRouteName, presetVue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import * as _vixt_core from '@vixt/core';
|
|
3
3
|
import { PluginOptions, VixtOptions } from '@vixt/core';
|
|
4
|
+
import { TreeNode } from 'unplugin-vue-router';
|
|
5
|
+
import { RouterOptions } from 'vue-router';
|
|
6
|
+
import { PersistedStateFactoryOptions } from 'pinia-plugin-persistedstate';
|
|
4
7
|
import Vue from '@vitejs/plugin-vue';
|
|
5
8
|
import Layouts from 'vite-plugin-vue-layouts';
|
|
6
9
|
import Components from 'unplugin-vue-components/vite';
|
|
@@ -28,8 +31,16 @@ declare module '@vixt/core' {
|
|
|
28
31
|
};
|
|
29
32
|
}
|
|
30
33
|
}
|
|
34
|
+
declare module '@vixt/core/client' {
|
|
35
|
+
interface VixtAppConfig {
|
|
36
|
+
router?: RouterOptions;
|
|
37
|
+
/** https://github.com/prazdevs/pinia-plugin-persistedstate */
|
|
38
|
+
piniaPersistedState?: PersistedStateFactoryOptions;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
declare function normalizeRouteName(route: TreeNode['value'], name?: string): string;
|
|
31
42
|
declare const presetVue: _vixt_core.VixtModule<VixtOptions>;
|
|
32
43
|
|
|
33
44
|
declare const _default: (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
34
45
|
|
|
35
|
-
export { _default as default, presetVue };
|
|
46
|
+
export { _default as default, normalizeRouteName, presetVue };
|
package/dist/index.mjs
CHANGED
|
@@ -9,13 +9,30 @@ import VueRouter from 'unplugin-vue-router/vite';
|
|
|
9
9
|
import { VueRouterAutoImports } from 'unplugin-vue-router';
|
|
10
10
|
import UnoCSS from 'unocss/vite';
|
|
11
11
|
|
|
12
|
+
function normalizeRouteName(route, name = "") {
|
|
13
|
+
if (route.rawSegment && route.rawSegment !== "index") {
|
|
14
|
+
name = name ? `${route.rawSegment}-${name}` : route.rawSegment;
|
|
15
|
+
}
|
|
16
|
+
if (route.parent) {
|
|
17
|
+
name = normalizeRouteName(route.parent, name);
|
|
18
|
+
}
|
|
19
|
+
return name.replace(/\[|\]|\.\.\./g, "");
|
|
20
|
+
}
|
|
12
21
|
const presetVue = defineVixtModule({
|
|
13
22
|
async setup(_, vixt) {
|
|
14
|
-
const { components, composables = [], constants = [], utils = [], stores = [], pages, layouts } = resolveLayersDirs(vixt._layers);
|
|
15
|
-
const { buildTypesDir } = vixt.options;
|
|
23
|
+
const { components, composables = [], constants = [], utils = [], stores = [], pages, layouts } = resolveLayersDirs(vixt._layers, vixt.options);
|
|
24
|
+
const { buildTypesDir, buildImportsDir } = vixt.options;
|
|
16
25
|
const defaultOptions = {
|
|
17
26
|
vue: {},
|
|
18
|
-
router: {
|
|
27
|
+
router: {
|
|
28
|
+
dts: `${buildTypesDir}/typed-router.d.ts`,
|
|
29
|
+
routesFolder: pages,
|
|
30
|
+
getRouteName(route) {
|
|
31
|
+
if (route.path === "/")
|
|
32
|
+
return "index";
|
|
33
|
+
return normalizeRouteName(route.value);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
19
36
|
layouts: { layoutsDirs: layouts?.reverse(), pagesDirs: pages },
|
|
20
37
|
components: {
|
|
21
38
|
dts: `${buildTypesDir}/components.d.ts`,
|
|
@@ -26,7 +43,7 @@ const presetVue = defineVixtModule({
|
|
|
26
43
|
imports: {
|
|
27
44
|
imports: ["vue", "@vueuse/core", "pinia", VueRouterAutoImports],
|
|
28
45
|
dts: `${buildTypesDir}/auto-imports.d.ts`,
|
|
29
|
-
dirs: [...composables, ...constants, ...stores, ...utils],
|
|
46
|
+
dirs: [...composables, ...constants, ...stores, ...utils, buildImportsDir],
|
|
30
47
|
vueTemplate: true
|
|
31
48
|
},
|
|
32
49
|
unocss: {},
|
|
@@ -61,17 +78,17 @@ import { routes } from 'vue-router/auto-routes'
|
|
|
61
78
|
import { setupLayouts } from 'virtual:generated-layouts'
|
|
62
79
|
|
|
63
80
|
const pinia = createPinia()
|
|
64
|
-
pinia.use(createPersistedState())
|
|
81
|
+
pinia.use(createPersistedState(appConfig.piniaPersistedState))
|
|
65
82
|
|
|
66
83
|
const router = createRouter({
|
|
67
84
|
routes: setupLayouts(routes),
|
|
68
85
|
history: createWebHistory('${app.baseURL}'),
|
|
86
|
+
...appConfig.router,
|
|
69
87
|
})
|
|
70
88
|
|
|
71
89
|
const app = createApp(App)
|
|
72
90
|
app.use(pinia).use(router)
|
|
73
|
-
|
|
74
|
-
Object.values(plugins).forEach((plugin) => typeof plugin === 'function' && plugin({ app, router, routes, pinia, appConfig }))
|
|
91
|
+
usePlugins({ app, router, routes, pinia, appConfig })
|
|
75
92
|
|
|
76
93
|
app.mount('#${app.rootId}')
|
|
77
94
|
`;
|
|
@@ -88,4 +105,4 @@ app.mount('#${app.rootId}')
|
|
|
88
105
|
};
|
|
89
106
|
const index = createVixtPlugin({ defaults });
|
|
90
107
|
|
|
91
|
-
export { index as default, presetVue };
|
|
108
|
+
export { index as default, normalizeRouteName, presetVue };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixt/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.11",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/SoulLyoko/vixt#readme",
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@vitejs/plugin-vue": "^5.1.2",
|
|
22
|
-
"@vitejs/plugin-vue-jsx": "^4.0.
|
|
23
|
-
"@vueuse/core": "^
|
|
24
|
-
"pinia": "^2.2.
|
|
22
|
+
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
|
23
|
+
"@vueuse/core": "^11.0.1",
|
|
24
|
+
"pinia": "^2.2.2",
|
|
25
25
|
"pinia-plugin-persistedstate": "^3.2.1",
|
|
26
26
|
"unocss": "0.61.5",
|
|
27
27
|
"unplugin-auto-import": "^0.18.2",
|
|
28
|
-
"unplugin-vue-components": "^0.27.
|
|
29
|
-
"unplugin-vue-router": "^0.10.
|
|
30
|
-
"vite-plugin-vue-devtools": "^7.3.
|
|
28
|
+
"unplugin-vue-components": "^0.27.4",
|
|
29
|
+
"unplugin-vue-router": "^0.10.7",
|
|
30
|
+
"vite-plugin-vue-devtools": "^7.3.8",
|
|
31
31
|
"vite-plugin-vue-layouts": "^0.11.0",
|
|
32
|
-
"vue": "^3.4.
|
|
33
|
-
"vue-router": "4.4.
|
|
34
|
-
"@vixt/core": "0.1.
|
|
32
|
+
"vue": "^3.4.38",
|
|
33
|
+
"vue-router": "^4.4.3",
|
|
34
|
+
"@vixt/core": "0.1.11"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "unbuild"
|