bojuvue 0.4.1 → 0.4.3

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/README.md CHANGED
@@ -16,6 +16,13 @@ npm install bojuvue
16
16
 
17
17
  ## Usage
18
18
 
19
+ Import the stylesheet once, anywhere in your app's entry point — components render
20
+ with no button skin, no dropdown panel background, and raw-size icons without it:
21
+
22
+ ```ts
23
+ import 'bojuvue/style.css'
24
+ ```
25
+
19
26
  ```vue
20
27
  <script setup>
21
28
  import { BVPlatformButton } from 'bojuvue'
@@ -37,6 +44,7 @@ Works as-is in any Vue 3 app. Building a VitePress site instead? Swap the import
37
44
  // .vitepress/theme/index.ts
38
45
  import DefaultTheme from 'vitepress/theme'
39
46
  import { BVPlatformButton, BVMoreButton, BVButton, BVIconButton } from 'bojuvue/vitepress'
47
+ import 'bojuvue/style.css'
40
48
 
41
49
  export default {
42
50
  extends: DefaultTheme,
@@ -49,6 +57,34 @@ export default {
49
57
  }
50
58
  ```
51
59
 
60
+ The same stylesheet covers every component from both import paths — one import is
61
+ enough regardless of which paths you use.
62
+
63
+ ### VitePress SSR builds
64
+
65
+ If your site does a production SSR build (VitePress's default `vitepress build`), add
66
+ this package's Vite plugin to your own `.vitepress/config.mts` so the build doesn't
67
+ break:
68
+
69
+ ```ts
70
+ // .vitepress/config.mts
71
+ import { defineConfig } from 'vitepress'
72
+ import { bojuvue } from 'bojuvue/vite'
73
+
74
+ export default defineConfig({
75
+ vite: { plugins: [bojuvue()] },
76
+ })
77
+ ```
78
+
79
+ Without it, importing anything from `bojuvue/vitepress` can break your SSR build,
80
+ because Vite externalizes `node_modules` dependencies by default during an SSR build —
81
+ which means this package's own internal `vitepress/theme` import gets resolved by
82
+ Node's raw module loader instead of Vite's, and that fails. The plugin tells Vite to
83
+ bundle this package through its own resolver instead, the same way your site's own
84
+ theme code already resolves an identical import successfully. See
85
+ [#70](https://github.com/ScottKirvan/BojuVue/issues/70) for the full failure mode.
86
+ No component API changes — this is the only thing that changes.
87
+
52
88
  Then in any .md page, no import needed:
53
89
 
54
90
  ```md
@@ -0,0 +1,2 @@
1
+ import { Plugin } from 'vite';
2
+ export declare function bojuvue(): Plugin;
@@ -0,0 +1 @@
1
+ export {};
package/dist/vite.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(){return{name:`bojuvue`,config:()=>({ssr:{noExternal:[`bojuvue`]}})}}exports.bojuvue=e;
package/dist/vite.js ADDED
@@ -0,0 +1,9 @@
1
+ //#region src/vite-plugin.ts
2
+ function e() {
3
+ return {
4
+ name: "bojuvue",
5
+ config: () => ({ ssr: { noExternal: ["bojuvue"] } })
6
+ };
7
+ }
8
+ //#endregion
9
+ export { e as bojuvue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bojuvue",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Vue 3 components including a download button that serves each visitor the right build for their OS. Works in any Vue 3 app; VitePress-aware variants included.",
@@ -26,10 +26,17 @@
26
26
  "./vitepress": {
27
27
  "types": "./dist/vitepress.d.ts",
28
28
  "import": "./dist/vitepress.js"
29
- }
29
+ },
30
+ "./vite": {
31
+ "types": "./dist/vite-plugin.d.ts",
32
+ "import": "./dist/vite.js",
33
+ "require": "./dist/vite.cjs"
34
+ },
35
+ "./style.css": "./dist/bojuvue.css",
36
+ "./dist/bojuvue.css": "./dist/bojuvue.css"
30
37
  },
31
38
  "scripts": {
32
- "build": "vue-tsc -b && vite build",
39
+ "build": "vue-tsc -b && vite build && vite build --config vite.plugin-cjs.config.ts",
33
40
  "test": "vitest run"
34
41
  },
35
42
  "devDependencies": {