@unhead/addons 2.0.16 → 2.0.18

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.
Files changed (2) hide show
  1. package/README.md +115 -3
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,12 +1,124 @@
1
1
  # @unhead/addons
2
2
 
3
- ## Install
3
+ > Unhead addons for build tools and bundlers
4
+
5
+ [![npm version][npm-version-src]][npm-version-href]
6
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
7
+ [![License][license-src]][license-href]
8
+
9
+ ## Features
10
+
11
+ - 🛠️ Build-time optimizations for Unhead
12
+ - 🌲 Tree-shake server composables from client bundles
13
+ - ⚡ Transform `useSeoMeta` calls for better performance
14
+ - 📦 Support for Vite, Webpack, and other bundlers
15
+
16
+ ## Installation
4
17
 
5
18
  ```bash
6
- # yarn add @unhead/addons
19
+ # npm
7
20
  npm install @unhead/addons
21
+
22
+ # yarn
23
+ yarn add @unhead/addons
24
+
25
+ # pnpm
26
+ pnpm add @unhead/addons
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Vite Plugin
32
+
33
+ ```ts
34
+ import UnheadVite from '@unhead/addons/vite'
35
+ // vite.config.ts
36
+ import { defineConfig } from 'vite'
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ UnheadVite({
41
+ // Options
42
+ })
43
+ ]
44
+ })
45
+ ```
46
+
47
+ ### Webpack Plugin
48
+
49
+ ```js
50
+ // webpack.config.js
51
+ const UnheadWebpack = require('@unhead/addons/webpack')
52
+
53
+ module.exports = {
54
+ plugins: [
55
+ UnheadWebpack({
56
+ // Options
57
+ })
58
+ ]
59
+ }
60
+ ```
61
+
62
+ ### Options
63
+
64
+ ```ts
65
+ interface UnpluginOptions {
66
+ // Tree-shake server-only composables from client bundles
67
+ treeshakeServerComposables?: boolean | TreeshakeServerComposablesOptions
68
+
69
+ // Transform useSeoMeta calls for better performance
70
+ useSeoMetaTransform?: boolean | UseSeoMetaTransformOptions
71
+ }
72
+ ```
73
+
74
+ ## Build Optimizations
75
+
76
+ ### Tree-shake Server Composables
77
+
78
+ Automatically removes server-only Unhead composables from client bundles:
79
+
80
+ ```ts
81
+ // Before (in client bundle):
82
+ import { useServerHead } from '@unhead/vue'
83
+
84
+ useServerHead({ /* ... */ })
85
+
86
+ // After (removed from client bundle):
87
+ // (code is completely removed)
88
+ ```
89
+
90
+ ### SEO Meta Transform
91
+
92
+ Optimizes `useSeoMeta` calls for better performance:
93
+
94
+ ```ts
95
+ // Before:
96
+ useSeoMeta({
97
+ title: 'My Page',
98
+ description: 'Page description'
99
+ })
100
+
101
+ // After (optimized):
102
+ useHead({
103
+ title: 'My Page',
104
+ meta: [{ name: 'description', content: 'Page description' }]
105
+ })
8
106
  ```
9
107
 
10
108
  ## Documentation
11
109
 
12
- See the [Unhead](https://unhead.unjs.io/) for more details.
110
+ Visit the [Unhead documentation](https://unhead.unjs.io/) for more details.
111
+
112
+ ## License
113
+
114
+ [MIT](./LICENSE)
115
+
116
+ <!-- Badges -->
117
+ [npm-version-src]: https://img.shields.io/npm/v/@unhead/addons/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
118
+ [npm-version-href]: https://npmjs.com/package/@unhead/addons
119
+
120
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@unhead/addons.svg?style=flat&colorA=18181B&colorB=28CF8D
121
+ [npm-downloads-href]: https://npmjs.com/package/@unhead/addons
122
+
123
+ [license-src]: https://img.shields.io/github/license/unjs/unhead.svg?style=flat&colorA=18181B&colorB=28CF8D
124
+ [license-href]: https://github.com/unjs/unhead/blob/main/LICENSE
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@unhead/addons",
3
3
  "type": "module",
4
- "version": "2.0.16",
4
+ "version": "2.0.18",
5
+ "description": "Unhead addons for build tools and bundlers.",
5
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
7
  "license": "MIT",
7
8
  "funding": "https://github.com/sponsors/harlan-zw",