@vixt/vue 0.9.0 → 0.11.0
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/client/client.d.ts +22 -0
- package/dist/client/entry.d.ts +2 -5
- package/dist/client/entry.js +2 -5
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +2 -0
- package/dist/client/plugins/router.d.ts +2 -2
- package/dist/client/plugins/router.js +2 -4
- package/dist/node/index.d.mts +9 -0
- package/dist/node/index.mjs +37 -0
- package/dist/node/modules/preset-vue.d.mts +7 -0
- package/dist/node/modules/preset-vue.mjs +2 -0
- package/dist/node/modules/virtual-root-component.d.mts +7 -0
- package/dist/node/modules/virtual-root-component.mjs +2 -0
- package/dist/node/node.d.mts +30 -0
- package/dist/node/preset-vue-CS1Dp3Yf.mjs +83 -0
- package/dist/{index.mjs → node/virtual-root-component-6LvPEGIT.mjs} +291 -380
- package/dist/types/index.d.ts +2 -2
- package/package.json +10 -15
- package/dist/client/plugins/pinia.d.ts +0 -6
- package/dist/client/plugins/pinia.js +0 -18
- package/dist/index.d.mts +0 -7
- package/dist/types/client.d.ts +0 -20
- package/dist/types/node.d.ts +0 -28
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { App } from "vue";
|
|
2
|
+
import { RouteRecord, Router, RouterOptions } from "vue-router";
|
|
3
|
+
|
|
4
|
+
//#region src/client/client.d.ts
|
|
5
|
+
interface VueVixtAppConfig {
|
|
6
|
+
/** https://router.vuejs.org/api/interfaces/RouterOptions.html */
|
|
7
|
+
router?: Partial<RouterOptions>;
|
|
8
|
+
}
|
|
9
|
+
interface VueVixtApp {
|
|
10
|
+
/** Vue app instance */
|
|
11
|
+
app: App;
|
|
12
|
+
/** Router instance */
|
|
13
|
+
router: Router;
|
|
14
|
+
/** Router routes */
|
|
15
|
+
routes: RouteRecord[];
|
|
16
|
+
}
|
|
17
|
+
declare module '@vixt/core/client' {
|
|
18
|
+
interface VixtAppConfig extends VueVixtAppConfig {}
|
|
19
|
+
interface VixtApp extends VueVixtApp {}
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { VueVixtApp, VueVixtAppConfig };
|
package/dist/client/entry.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "virtual:uno.css";
|
|
3
|
-
import * as vue from "vue";
|
|
4
|
-
|
|
1
|
+
import * as _$vue from "vue";
|
|
5
2
|
//#region src/client/entry.d.ts
|
|
6
|
-
declare function entry(): vue.App<Element>;
|
|
3
|
+
declare function entry(): _$vue.App<Element>;
|
|
7
4
|
//#endregion
|
|
8
5
|
export { entry as default };
|
package/dist/client/entry.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { createApp } from "vue";
|
|
1
2
|
import "virtual:vixt:css";
|
|
2
|
-
import "virtual:uno.css";
|
|
3
3
|
import { applyPlugins, createVixtApp } from "@vixt/core/client";
|
|
4
4
|
import appConfig from "virtual:vixt:app-config";
|
|
5
5
|
import plugins from "virtual:vixt:plugins";
|
|
6
6
|
import RootComponent from "virtual:vixt:root-component.vue";
|
|
7
|
-
import { createApp } from "vue";
|
|
8
|
-
|
|
9
7
|
//#region src/client/entry.ts
|
|
10
8
|
function entry() {
|
|
11
9
|
const app = createApp(RootComponent);
|
|
@@ -22,6 +20,5 @@ function entry() {
|
|
|
22
20
|
return app;
|
|
23
21
|
}
|
|
24
22
|
entry();
|
|
25
|
-
|
|
26
23
|
//#endregion
|
|
27
|
-
export { entry as default };
|
|
24
|
+
export { entry as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as _vixt_core_client0 from "@vixt/core/client";
|
|
1
|
+
import * as _$_vixt_core_client0 from "@vixt/core/client";
|
|
2
2
|
|
|
3
3
|
//#region src/client/plugins/router.d.ts
|
|
4
|
-
declare const _default: _vixt_core_client0.VixtPlugin;
|
|
4
|
+
declare const _default: _$_vixt_core_client0.VixtPlugin;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { _default as default };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { createRouter, createWebHistory } from "vue-router";
|
|
1
2
|
import { defineVixtPlugin } from "@vixt/core/client";
|
|
2
3
|
import { setupLayouts } from "virtual:generated-layouts";
|
|
3
|
-
import { createRouter, createWebHistory } from "vue-router";
|
|
4
4
|
import { routes } from "vue-router/auto-routes";
|
|
5
|
-
|
|
6
5
|
//#region src/client/plugins/router.ts
|
|
7
6
|
var router_default = defineVixtPlugin({
|
|
8
7
|
name: "vixt:router",
|
|
@@ -18,6 +17,5 @@ var router_default = defineVixtPlugin({
|
|
|
18
17
|
vixt.router = router;
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
|
-
|
|
22
20
|
//#endregion
|
|
23
|
-
export { router_default as default };
|
|
21
|
+
export { router_default as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VueVixtOptions } from "./node.mjs";
|
|
2
|
+
import * as _$_vixt_core0 from "@vixt/core";
|
|
3
|
+
import * as _$vite from "vite";
|
|
4
|
+
|
|
5
|
+
//#region src/node/index.d.ts
|
|
6
|
+
/** @hidden */
|
|
7
|
+
declare const _default: (options?: _$_vixt_core0.VixtOptions | undefined) => _$vite.PluginOption;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { VueVixtOptions, _default as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { a as __toESM, i as require_lib, n as virtual_root_component_default, r as resolvePathSync } from "./virtual-root-component-6LvPEGIT.mjs";
|
|
2
|
+
import { t as preset_vue_default } from "./preset-vue-CS1Dp3Yf.mjs";
|
|
3
|
+
import { VueVixtOptions } from "./node.d.mts";
|
|
4
|
+
import { createVixtPlugin } from "@vixt/core";
|
|
5
|
+
import { VueRouterAutoImports } from "vue-router/unplugin";
|
|
6
|
+
//#region src/node/index.ts
|
|
7
|
+
/** @module vue */
|
|
8
|
+
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
9
|
+
const plugins = ["@vixt/vue/client/plugins/router"];
|
|
10
|
+
/** @hidden */
|
|
11
|
+
var node_default = createVixtPlugin({ defaults: {
|
|
12
|
+
modules: [preset_vue_default, virtual_root_component_default],
|
|
13
|
+
plugins,
|
|
14
|
+
app: {
|
|
15
|
+
entryFile: "main.ts",
|
|
16
|
+
entryCode: import_lib.default.readFileSync(resolvePathSync("@vixt/vue/client/entry"), "utf-8"),
|
|
17
|
+
head: { meta: [{ charset: "utf-8" }, {
|
|
18
|
+
name: "viewport",
|
|
19
|
+
content: "width=device-width, initial-scale=1.0"
|
|
20
|
+
}] }
|
|
21
|
+
},
|
|
22
|
+
imports: {
|
|
23
|
+
imports: ["vue", VueRouterAutoImports],
|
|
24
|
+
vueTemplate: true
|
|
25
|
+
},
|
|
26
|
+
typescript: { tsConfig: {
|
|
27
|
+
compilerOptions: { types: [
|
|
28
|
+
"@vixt/vue/types",
|
|
29
|
+
"vue-router/auto",
|
|
30
|
+
"vite-plugin-vue-layouts/client"
|
|
31
|
+
] },
|
|
32
|
+
vueCompilerOptions: { plugins: ["vue-router/volar/sfc-typed-router", "vue-router/volar/sfc-route-blocks"] }
|
|
33
|
+
} },
|
|
34
|
+
vite: { optimizeDeps: { exclude: plugins } }
|
|
35
|
+
} });
|
|
36
|
+
//#endregion
|
|
37
|
+
export { VueVixtOptions, node_default as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _$_vixt_core0 from "@vixt/core";
|
|
2
|
+
|
|
3
|
+
//#region src/node/modules/virtual-root-component.d.ts
|
|
4
|
+
declare function isEmptyCode(code?: string): boolean;
|
|
5
|
+
declare const _default: _$_vixt_core0.VixtModule<_$_vixt_core0.ModuleOptions>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default as default, isEmptyCode };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ExtractPluginOptions } from "@vixt/core";
|
|
2
|
+
import Vue from "@vitejs/plugin-vue";
|
|
3
|
+
import VueJsx from "@vitejs/plugin-vue-jsx";
|
|
4
|
+
import Components from "unplugin-vue-components/vite";
|
|
5
|
+
import VueDevTools from "vite-plugin-vue-devtools";
|
|
6
|
+
import Layouts from "vite-plugin-vue-layouts";
|
|
7
|
+
import VueRouter from "vue-router/vite";
|
|
8
|
+
|
|
9
|
+
//#region src/node/node.d.ts
|
|
10
|
+
interface VueVixtOptions {
|
|
11
|
+
/** https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue */
|
|
12
|
+
vue?: ExtractPluginOptions<typeof Vue>;
|
|
13
|
+
/** https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx */
|
|
14
|
+
vueJsx?: ExtractPluginOptions<typeof VueJsx>;
|
|
15
|
+
/** https://router.vuejs.org/file-based-routing/ */
|
|
16
|
+
router?: ExtractPluginOptions<typeof VueRouter>;
|
|
17
|
+
/** https://github.com/JohnCampionJr/vite-plugin-vue-layouts */
|
|
18
|
+
layouts?: ExtractPluginOptions<typeof Layouts>;
|
|
19
|
+
/** https://github.com/unplugin/unplugin-vue-components */
|
|
20
|
+
components?: ExtractPluginOptions<typeof Components>;
|
|
21
|
+
/** https://github.com/webfansplz/vite-plugin-vue-devtools */
|
|
22
|
+
devtools?: ExtractPluginOptions<typeof VueDevTools> & {
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
declare module '@vixt/core' {
|
|
27
|
+
interface VixtOptions extends VueVixtOptions {}
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { VueVixtOptions };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineVixtModule, resolveLayersDirs } from "@vixt/core";
|
|
2
|
+
import Vue from "@vitejs/plugin-vue";
|
|
3
|
+
import VueJsx from "@vitejs/plugin-vue-jsx";
|
|
4
|
+
import Components from "unplugin-vue-components/vite";
|
|
5
|
+
import VueDevTools from "vite-plugin-vue-devtools";
|
|
6
|
+
import Layouts from "vite-plugin-vue-layouts";
|
|
7
|
+
import VueRouter from "vue-router/vite";
|
|
8
|
+
//#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
|
|
9
|
+
function isPlainObject(value) {
|
|
10
|
+
if (value === null || typeof value !== "object") return false;
|
|
11
|
+
const prototype = Object.getPrototypeOf(value);
|
|
12
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
13
|
+
if (Symbol.iterator in value) return false;
|
|
14
|
+
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
18
|
+
if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
19
|
+
const object = { ...defaults };
|
|
20
|
+
for (const key of Object.keys(baseObject)) {
|
|
21
|
+
if (key === "__proto__" || key === "constructor") continue;
|
|
22
|
+
const value = baseObject[key];
|
|
23
|
+
if (value === null || value === void 0) continue;
|
|
24
|
+
if (merger && merger(object, key, value, namespace)) continue;
|
|
25
|
+
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
26
|
+
else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
27
|
+
else object[key] = value;
|
|
28
|
+
}
|
|
29
|
+
return object;
|
|
30
|
+
}
|
|
31
|
+
function createDefu(merger) {
|
|
32
|
+
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
33
|
+
}
|
|
34
|
+
const defu = createDefu();
|
|
35
|
+
var preset_vue_default = defineVixtModule({
|
|
36
|
+
meta: { name: "vixt:preset-vue" },
|
|
37
|
+
setup(_, vixt) {
|
|
38
|
+
const { components = [], pages = [], layouts = [] } = resolveLayersDirs([...vixt._layers].reverse());
|
|
39
|
+
const { buildTypesDir } = vixt.options;
|
|
40
|
+
const defaultOptions = {
|
|
41
|
+
vue: {},
|
|
42
|
+
vueJsx: {},
|
|
43
|
+
router: {
|
|
44
|
+
dts: `${buildTypesDir}/typed-router.d.ts`,
|
|
45
|
+
routesFolder: pages,
|
|
46
|
+
extendRoute(route) {
|
|
47
|
+
const node = route.node.value;
|
|
48
|
+
const overrides = node._overrides;
|
|
49
|
+
if (overrides.size <= 1) return;
|
|
50
|
+
for (const pageDir of [...pages].reverse()) {
|
|
51
|
+
const matched = [...overrides.keys()].find((e) => e.match(pageDir));
|
|
52
|
+
if (matched) {
|
|
53
|
+
node.components.set("default", matched);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
layouts: {
|
|
60
|
+
layoutsDirs: layouts,
|
|
61
|
+
pagesDirs: pages
|
|
62
|
+
},
|
|
63
|
+
components: {
|
|
64
|
+
dts: `${buildTypesDir}/components.d.ts`,
|
|
65
|
+
dirs: [...components].reverse(),
|
|
66
|
+
directoryAsNamespace: true,
|
|
67
|
+
collapseSamePrefixes: true
|
|
68
|
+
},
|
|
69
|
+
devtools: { enabled: false }
|
|
70
|
+
};
|
|
71
|
+
const options = vixt.options = defu(vixt.options, defaultOptions);
|
|
72
|
+
return [
|
|
73
|
+
VueRouter(options.router),
|
|
74
|
+
Vue(options.vue),
|
|
75
|
+
VueJsx(options.vueJsx),
|
|
76
|
+
Layouts(options.layouts),
|
|
77
|
+
Components(options.components),
|
|
78
|
+
options.devtools?.enabled && VueDevTools(options.devtools)
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
//#endregion
|
|
83
|
+
export { preset_vue_default as t };
|