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