@vixt/vitepress 0.10.1 → 0.11.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.
@@ -0,0 +1,14 @@
1
+ import { EnhanceAppContext, Theme } from "vitepress";
2
+
3
+ //#region src/client/client.d.ts
4
+ interface VitepressVixtAppConfig {
5
+ Layout?: Theme['Layout'];
6
+ extends?: Theme['extends'];
7
+ }
8
+ interface VitepressVixtApp extends EnhanceAppContext {}
9
+ declare module '@vixt/core/client' {
10
+ interface VixtAppConfig extends VitepressVixtAppConfig {}
11
+ interface VixtApp extends VitepressVixtApp {}
12
+ }
13
+ //#endregion
14
+ export { VitepressVixtApp, VitepressVixtAppConfig };
@@ -1,5 +1,4 @@
1
1
  import { Theme } from "vitepress";
2
-
3
2
  //#region src/client/entry.d.ts
4
3
  declare const _default: Theme;
5
4
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import "virtual:vixt:css";
2
- import "uno.css";
3
2
  import { applyPlugins, createVixtApp } from "@vixt/core/client";
4
3
  import appConfig from "virtual:vixt:app-config";
5
4
  import plugins from "virtual:vixt:plugins";
@@ -0,0 +1,2 @@
1
+ import { VitepressVixtApp, VitepressVixtAppConfig } from "./client.js";
2
+ export { VitepressVixtApp, VitepressVixtAppConfig };
File without changes
@@ -1,7 +1,9 @@
1
+ import { VitepressVixtOptions } from "./node.mjs";
1
2
  import * as _$_vixt_core0 from "@vixt/core";
2
3
  import * as _$vite from "vite";
3
4
 
4
- //#region src/index.d.ts
5
+ //#region src/node/index.d.ts
6
+ /** @hidden */
5
7
  declare const _default: (options?: _$_vixt_core0.VixtOptions | undefined) => _$vite.PluginOption;
6
8
  //#endregion
7
- export { _default as default };
9
+ export { VitepressVixtOptions, _default as default };
@@ -0,0 +1,35 @@
1
+ import preset_vitepress_default from "./modules/preset-vitepress.mjs";
2
+ import { cwd } from "node:process";
3
+ import { createVixtPlugin } from "@vixt/core";
4
+ import fs from "fs-extra";
5
+ import { resolvePathSync } from "mlly";
6
+ import path from "pathe";
7
+ //#region src/node/index.ts
8
+ /** @module vitepress */
9
+ /** @hidden */
10
+ var node_default = createVixtPlugin({ defaults: {
11
+ srcDir: path.resolve(cwd(), ".vitepress/theme"),
12
+ modules: [preset_vitepress_default],
13
+ app: {
14
+ entryFile: "index.ts",
15
+ entryCode: fs.readFileSync(resolvePathSync("@vixt/vitepress/client/entry"), "utf-8"),
16
+ transformIndexHtml: false
17
+ },
18
+ imports: {
19
+ include: [
20
+ /\.[jt]sx?$/,
21
+ /\.vue$/,
22
+ /\.vue\?vue/,
23
+ /\.md/,
24
+ /\.md\?md/
25
+ ],
26
+ imports: ["vue", "vitepress"],
27
+ vueTemplate: true
28
+ },
29
+ typescript: { tsConfig: {
30
+ compilerOptions: { types: ["@vixt/vitepress/types"] },
31
+ include: ["../.vitepress/**/*"]
32
+ } }
33
+ } });
34
+ //#endregion
35
+ export { node_default as default };
@@ -0,0 +1,6 @@
1
+ import * as _$vite from "vite";
2
+
3
+ //#region src/node/modules/config-patch.d.ts
4
+ declare const _default: (options?: any) => _$vite.PluginOption;
5
+ //#endregion
6
+ export { _default as default };
@@ -0,0 +1,13 @@
1
+ import { defineVitePlugin } from "@vixt/core";
2
+ //#region src/node/modules/config-patch.ts
3
+ var config_patch_default = defineVitePlugin(() => {
4
+ return {
5
+ name: "vixt:config-patch",
6
+ config(config) {
7
+ const siteBase = config.vitepress?.userConfig?.base;
8
+ if (siteBase) return { base: siteBase };
9
+ }
10
+ };
11
+ });
12
+ //#endregion
13
+ export { config_patch_default as default };
@@ -0,0 +1,7 @@
1
+ import * as _$_vixt_core0 from "@vixt/core";
2
+ import { VixtOptions } from "@vixt/core";
3
+
4
+ //#region src/node/modules/preset-vitepress.d.ts
5
+ declare const _default: _$_vixt_core0.VixtModule<VixtOptions>;
6
+ //#endregion
7
+ export { _default as default };
@@ -0,0 +1,36 @@
1
+ import config_patch_default from "./config-patch.mjs";
2
+ import { defineVixtModule, resolveLayersDirs } from "@vixt/core";
3
+ import defu from "defu";
4
+ import Components from "unplugin-vue-components/vite";
5
+ import VueDevTools from "vite-plugin-vue-devtools";
6
+ var preset_vitepress_default = defineVixtModule({
7
+ meta: { name: "vixt:preset-vitepress" },
8
+ setup(_, vixt) {
9
+ const { components = [] } = resolveLayersDirs([...vixt._layers].reverse());
10
+ const { buildTypesDir } = vixt.options;
11
+ const defaultOptions = {
12
+ components: {
13
+ dts: `${buildTypesDir}/components.d.ts`,
14
+ dirs: [...components].reverse(),
15
+ directoryAsNamespace: true,
16
+ collapseSamePrefixes: true,
17
+ extensions: ["vue", "md"],
18
+ include: [
19
+ /\.vue$/,
20
+ /\.vue\?vue/,
21
+ /\.md$/,
22
+ /\.md\?md/
23
+ ]
24
+ },
25
+ devtools: { enabled: false }
26
+ };
27
+ const options = vixt.options = defu(vixt.options, defaultOptions);
28
+ return [
29
+ Components(options.components),
30
+ options.devtools?.enabled && VueDevTools(options.devtools),
31
+ config_patch_default()
32
+ ];
33
+ }
34
+ });
35
+ //#endregion
36
+ export { preset_vitepress_default as default };
@@ -0,0 +1,24 @@
1
+ import { ExtractPluginOptions } from "@vixt/core";
2
+ import Components from "unplugin-vue-components/vite";
3
+ import VueDevTools from "vite-plugin-vue-devtools";
4
+ import { SiteConfig } from "vitepress";
5
+
6
+ //#region src/node/node.d.ts
7
+ interface VitepressVixtOptions {
8
+ /** https://github.com/antfu/unplugin-vue-components */
9
+ components?: ExtractPluginOptions<typeof Components>;
10
+ /** https://github.com/webfansplz/vite-plugin-vue-devtools */
11
+ devtools?: ExtractPluginOptions<typeof VueDevTools> & {
12
+ enabled?: boolean;
13
+ };
14
+ }
15
+ declare module '@vixt/core' {
16
+ interface VixtOptions extends VitepressVixtOptions {}
17
+ }
18
+ declare module 'vite' {
19
+ interface UserConfig {
20
+ vitepress?: SiteConfig;
21
+ }
22
+ }
23
+ //#endregion
24
+ export { VitepressVixtOptions };
@@ -1,2 +1,2 @@
1
- import './client.d'
2
- import './node.d'
1
+ import '../client/client.d'
2
+ import '../node/node.d'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/vitepress",
3
3
  "type": "module",
4
- "version": "0.10.1",
4
+ "version": "0.11.1",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://soullyoko.github.io/vixt/",
@@ -12,19 +12,19 @@
12
12
  "vitepress"
13
13
  ],
14
14
  "exports": {
15
- ".": "./dist/index.mjs",
15
+ ".": "./dist/node/index.mjs",
16
16
  "./client/*": "./dist/client/*.js",
17
17
  "./types": "./dist/types/index.d.ts",
18
18
  "./package.json": "./package.json"
19
19
  },
20
- "main": "./dist/index.mjs",
20
+ "main": "./dist/node/index.mjs",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "files": [
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
26
  "vitepress": "^2.0.0-alpha.17",
27
- "@vixt/core": "0.10.1",
28
- "@vixt/vue": "0.10.1"
27
+ "@vixt/core": "0.11.1",
28
+ "@vixt/vue": "0.11.1"
29
29
  }
30
30
  }
@@ -1,6 +0,0 @@
1
- import * as _$_vixt_core_client0 from "@vixt/core/client";
2
-
3
- //#region src/client/plugins/pinia.d.ts
4
- declare const _default: _$_vixt_core_client0.VixtPlugin;
5
- //#endregion
6
- export { _default as default };
@@ -1,16 +0,0 @@
1
- import { defineVixtPlugin } from "@vixt/core/client";
2
- import { createPinia } from "pinia";
3
- import { createPersistedState } from "pinia-plugin-persistedstate";
4
- //#region src/client/plugins/pinia.ts
5
- var pinia_default = defineVixtPlugin({
6
- name: "vixt:pinia",
7
- setup(vixt) {
8
- const { app, appConfig } = vixt;
9
- const pinia = createPinia();
10
- pinia.use(createPersistedState(appConfig.piniaPersistedState));
11
- app.use(pinia);
12
- vixt.pinia = pinia;
13
- }
14
- });
15
- //#endregion
16
- export { pinia_default as default };
package/dist/index.mjs DELETED
@@ -1,92 +0,0 @@
1
- import { cwd } from "node:process";
2
- import { VixtClientAutoImports, createVixtPlugin, defineVitePlugin, defineVixtModule, resolveLayersDirs } from "@vixt/core";
3
- import fs from "fs-extra";
4
- import { resolvePathSync } from "mlly";
5
- import path from "pathe";
6
- import defu from "defu";
7
- import UnoCSS from "unocss/vite";
8
- import AutoImport from "unplugin-auto-import/vite";
9
- import Components from "unplugin-vue-components/vite";
10
- import VueDevTools from "vite-plugin-vue-devtools";
11
- //#region src/modules/config-patch.ts
12
- var config_patch_default = defineVitePlugin(() => {
13
- return {
14
- name: "vixt:config-patch",
15
- config(config) {
16
- const siteBase = config.vitepress?.userConfig?.base;
17
- if (siteBase) return { base: siteBase };
18
- }
19
- };
20
- });
21
- var preset_vitepress_default = defineVixtModule({
22
- meta: { name: "vixt:preset-vitepress" },
23
- setup(_, vixt) {
24
- const { components = [], composables = [], constants = [], utils = [], stores = [] } = resolveLayersDirs([...vixt._layers].reverse());
25
- const { buildTypesDir } = vixt.options;
26
- const defaultOptions = {
27
- components: {
28
- dts: `${buildTypesDir}/components.d.ts`,
29
- dirs: [...components].reverse(),
30
- directoryAsNamespace: true,
31
- collapseSamePrefixes: true,
32
- extensions: ["vue", "md"],
33
- include: [
34
- /\.vue$/,
35
- /\.vue\?vue/,
36
- /\.md$/,
37
- /\.md\?md/
38
- ]
39
- },
40
- imports: {
41
- include: [
42
- /\.[jt]sx?$/,
43
- /\.vue$/,
44
- /\.vue\?vue/,
45
- /\.md/,
46
- /\.md\?md/
47
- ],
48
- imports: [
49
- "vue",
50
- "@vueuse/core",
51
- "pinia",
52
- VixtClientAutoImports
53
- ],
54
- dts: `${buildTypesDir}/auto-imports.d.ts`,
55
- dirs: [
56
- composables,
57
- constants,
58
- stores,
59
- utils
60
- ].flat(),
61
- vueTemplate: true
62
- },
63
- unocss: {},
64
- devtools: { enabled: false }
65
- };
66
- const options = vixt.options = defu(vixt.options, defaultOptions);
67
- return [
68
- Components(options.components),
69
- AutoImport(options.imports),
70
- UnoCSS(options.unocss),
71
- options.devtools?.enabled && VueDevTools(options.devtools),
72
- config_patch_default()
73
- ];
74
- }
75
- });
76
- //#endregion
77
- //#region src/index.ts
78
- const plugins = ["@vixt/vitepress/client/plugins/pinia"];
79
- var src_default = createVixtPlugin({ defaults: {
80
- srcDir: path.resolve(cwd(), ".vitepress/theme"),
81
- modules: [preset_vitepress_default],
82
- plugins,
83
- app: {
84
- entryFile: "index.ts",
85
- entryCode: fs.readFileSync(resolvePathSync("@vixt/vitepress/client/entry"), "utf-8"),
86
- transformIndexHtml: false
87
- },
88
- typescript: { tsConfig: { compilerOptions: { types: ["@vixt/vitepress/types"] } } },
89
- vite: { optimizeDeps: { exclude: plugins } }
90
- } });
91
- //#endregion
92
- export { src_default as default };
@@ -1,15 +0,0 @@
1
- import type { Pinia } from 'pinia'
2
- import type { PluginOptions as PersistedStateOptions } from 'pinia-plugin-persistedstate'
3
- import type { EnhanceAppContext } from 'vitepress'
4
-
5
- declare module '@vixt/core/client' {
6
- interface VixtAppConfig {
7
- /** https://github.com/prazdevs/pinia-plugin-persistedstate */
8
- piniaPersistedState?: PersistedStateOptions
9
- }
10
-
11
- interface VixtApp extends EnhanceAppContext {
12
- pinia: Pinia
13
- appConfig: VixtAppConfig
14
- }
15
- }
@@ -1,25 +0,0 @@
1
- import type { ExtractPluginOptions } from '@vixt/core'
2
- import type UnoCSS from 'unocss/vite'
3
- import type AutoImport from 'unplugin-auto-import/vite'
4
- import type Components from 'unplugin-vue-components/vite'
5
- import type VueDevTools from 'vite-plugin-vue-devtools'
6
- import type { SiteConfig } from 'vitepress'
7
-
8
- declare module '@vixt/core' {
9
- interface VixtOptions {
10
- /** https://github.com/antfu/unplugin-vue-components */
11
- components?: ExtractPluginOptions<typeof Components>
12
- /** https://github.com/antfu/unplugin-auto-import */
13
- imports?: ExtractPluginOptions<typeof AutoImport>
14
- /** https://github.com/antfu/unocss */
15
- unocss?: ExtractPluginOptions<typeof UnoCSS>
16
- /** https://github.com/webfansplz/vite-plugin-vue-devtools */
17
- devtools?: ExtractPluginOptions<typeof VueDevTools> & { enabled?: boolean }
18
- }
19
- }
20
-
21
- declare module 'vite' {
22
- interface UserConfig {
23
- vitepress?: SiteConfig
24
- }
25
- }