@vixt/vitepress 0.3.6 → 0.4.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/vitepress",
3
3
  "type": "module",
4
- "version": "0.3.6",
4
+ "version": "0.4.0",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",
@@ -19,10 +19,11 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "vitepress": "^1.6.3",
22
- "@vixt/core": "0.3.6",
23
- "@vixt/vue": "0.3.6"
22
+ "@vixt/core": "0.4.0",
23
+ "@vixt/vue": "0.4.0"
24
24
  },
25
25
  "scripts": {
26
- "build": "unbuild"
26
+ "build": "unbuild",
27
+ "dev": "unbuild --stub"
27
28
  }
28
29
  }
package/dist/index.d.mts DELETED
@@ -1,38 +0,0 @@
1
- import * as vite from 'vite';
2
- import * as _vixt_core from '@vixt/core';
3
- import { Vixt, PluginOptions, VixtOptions } from '@vixt/core';
4
- import { AppOptions } from '@vixt/vue';
5
- import { PluginOptions as PluginOptions$1 } from 'pinia-plugin-persistedstate';
6
- import UnoCSS from 'unocss/vite';
7
- import AutoImport from 'unplugin-auto-import/vite';
8
- import Components from 'unplugin-vue-components/vite';
9
- import VueDevTools from 'vite-plugin-vue-devtools';
10
-
11
- declare function generateMainTs(options: AppOptions, vixt: Vixt): string;
12
- declare const appVitepress: _vixt_core.VixtModule<AppOptions>;
13
-
14
- declare module '@vixt/core' {
15
- interface VixtOptions {
16
- /** https://github.com/antfu/unplugin-vue-components */
17
- components?: PluginOptions<typeof Components>;
18
- /** https://github.com/antfu/unplugin-auto-import */
19
- imports?: PluginOptions<typeof AutoImport>;
20
- /** https://github.com/antfu/unocss */
21
- unocss?: PluginOptions<typeof UnoCSS>;
22
- /** https://github.com/webfansplz/vite-plugin-vue-devtools */
23
- devtools?: PluginOptions<typeof VueDevTools> & {
24
- enabled?: boolean;
25
- };
26
- }
27
- }
28
- declare module '@vixt/core/client' {
29
- interface VixtAppConfig {
30
- /** https://github.com/prazdevs/pinia-plugin-persistedstate */
31
- piniaPersistedState?: PluginOptions$1;
32
- }
33
- }
34
- declare const presetVitepress: _vixt_core.VixtModule<VixtOptions>;
35
-
36
- declare const _default: (options?: VixtOptions | undefined) => vite.PluginOption;
37
-
38
- export { appVitepress, _default as default, generateMainTs, presetVitepress };
package/dist/index.d.ts DELETED
@@ -1,38 +0,0 @@
1
- import * as vite from 'vite';
2
- import * as _vixt_core from '@vixt/core';
3
- import { Vixt, PluginOptions, VixtOptions } from '@vixt/core';
4
- import { AppOptions } from '@vixt/vue';
5
- import { PluginOptions as PluginOptions$1 } from 'pinia-plugin-persistedstate';
6
- import UnoCSS from 'unocss/vite';
7
- import AutoImport from 'unplugin-auto-import/vite';
8
- import Components from 'unplugin-vue-components/vite';
9
- import VueDevTools from 'vite-plugin-vue-devtools';
10
-
11
- declare function generateMainTs(options: AppOptions, vixt: Vixt): string;
12
- declare const appVitepress: _vixt_core.VixtModule<AppOptions>;
13
-
14
- declare module '@vixt/core' {
15
- interface VixtOptions {
16
- /** https://github.com/antfu/unplugin-vue-components */
17
- components?: PluginOptions<typeof Components>;
18
- /** https://github.com/antfu/unplugin-auto-import */
19
- imports?: PluginOptions<typeof AutoImport>;
20
- /** https://github.com/antfu/unocss */
21
- unocss?: PluginOptions<typeof UnoCSS>;
22
- /** https://github.com/webfansplz/vite-plugin-vue-devtools */
23
- devtools?: PluginOptions<typeof VueDevTools> & {
24
- enabled?: boolean;
25
- };
26
- }
27
- }
28
- declare module '@vixt/core/client' {
29
- interface VixtAppConfig {
30
- /** https://github.com/prazdevs/pinia-plugin-persistedstate */
31
- piniaPersistedState?: PluginOptions$1;
32
- }
33
- }
34
- declare const presetVitepress: _vixt_core.VixtModule<VixtOptions>;
35
-
36
- declare const _default: (options?: VixtOptions | undefined) => vite.PluginOption;
37
-
38
- export { appVitepress, _default as default, generateMainTs, presetVitepress };
package/dist/index.mjs DELETED
@@ -1,113 +0,0 @@
1
- import { defineVixtModule, resolveLayersDirs, createVixtPlugin } from '@vixt/core';
2
- import { generateCss, generateAppConfig, generatePlugins } from '@vixt/vue';
3
- import fs from 'fs-extra';
4
- import path from 'pathe';
5
- import defu from 'defu';
6
- import UnoCSS from 'unocss/vite';
7
- import AutoImport from 'unplugin-auto-import/vite';
8
- import Components from 'unplugin-vue-components/vite';
9
- import { VueRouterAutoImports } from 'unplugin-vue-router';
10
- import VueDevTools from 'vite-plugin-vue-devtools';
11
-
12
- function generateMainTs(options, vixt) {
13
- const { buildDir } = vixt.options;
14
- const mainTsPath = path.resolve(".vitepress/theme/index.ts");
15
- if (!fs.existsSync(mainTsPath))
16
- fs.outputFileSync(mainTsPath, `// Generated by Vixt
17
- // This file transform from '${path.basename(buildDir)}/main.ts'
18
- `);
19
- const cssTemplate = generateCss(options);
20
- const appConfigTemplate = generateAppConfig(vixt);
21
- const pluginsTemplate = generatePlugins(vixt);
22
- const code = `// Generated by Vixt
23
- // This file transform to '.vitepress/theme/index.ts'
24
- // @ts-nocheck
25
- ${cssTemplate}
26
- ${appConfigTemplate}
27
- ${pluginsTemplate}
28
-
29
- import 'uno.css'
30
- import { createPinia } from 'pinia'
31
- import { createPersistedState } from 'pinia-plugin-persistedstate'
32
- import DefaultTheme from 'vitepress/theme'
33
-
34
- export default {
35
- extends: DefaultTheme,
36
- enhanceApp(ctx) {
37
- const pinia = createPinia()
38
- pinia.use(createPersistedState(appConfig.piniaPersistedState))
39
- ctx.app.use(pinia)
40
- usePlugins({ ...ctx, pinia, appConfig })
41
- },
42
- }
43
- `;
44
- fs.outputFileSync(path.resolve(buildDir, "main.ts"), code);
45
- return code;
46
- }
47
- const name = "vixt:app";
48
- const defaults$1 = {
49
- css: []
50
- };
51
- const appVitepress = defineVixtModule({
52
- meta: { name, configKey: "app" },
53
- defaults: defaults$1,
54
- setup(options, vixt) {
55
- let mainTsCode;
56
- const mainTsPath = path.resolve(".vitepress/theme/index.ts");
57
- return {
58
- name,
59
- configResolved() {
60
- mainTsCode = generateMainTs(options, vixt);
61
- },
62
- transform: {
63
- order: "pre",
64
- handler(_, id) {
65
- if (id !== mainTsPath)
66
- return;
67
- return mainTsCode;
68
- }
69
- }
70
- };
71
- }
72
- });
73
-
74
- const presetVitepress = defineVixtModule({
75
- async setup(_, vixt) {
76
- const { components, composables = [], constants = [], utils = [], stores = [] } = resolveLayersDirs(vixt._layers);
77
- const { buildTypesDir, buildImportsDir } = vixt.options;
78
- const defaultOptions = {
79
- components: {
80
- dts: `${buildTypesDir}/components.d.ts`,
81
- dirs: components,
82
- directoryAsNamespace: true,
83
- collapseSamePrefixes: true,
84
- extensions: ["vue", "md"],
85
- include: [/\.vue$/, /\.vue\?vue/, /\.md$/]
86
- },
87
- imports: {
88
- include: [/\.[jt]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md/, /\.md\?md/],
89
- imports: ["vue", "@vueuse/core", "pinia", VueRouterAutoImports],
90
- dts: `${buildTypesDir}/auto-imports.d.ts`,
91
- dirs: [...composables, ...constants, ...stores, ...utils, buildImportsDir],
92
- vueTemplate: true
93
- },
94
- unocss: {},
95
- devtools: { enabled: false }
96
- };
97
- const options = vixt.options = defu(vixt.options, defaultOptions);
98
- const plugins = [
99
- Components(options.components),
100
- AutoImport(options.imports),
101
- UnoCSS(options.unocss),
102
- options.devtools?.enabled && VueDevTools(options.devtools)
103
- ];
104
- return plugins;
105
- }
106
- });
107
-
108
- const defaults = {
109
- modules: [appVitepress, presetVitepress]
110
- };
111
- const index = createVixtPlugin({ defaults });
112
-
113
- export { appVitepress, index as default, generateMainTs, presetVitepress };