@biggora/claude-plugins 1.2.0 → 1.2.2
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 +11 -4
- package/package.json +1 -1
- package/registry/registry.json +319 -244
- package/specs/coding.md +24 -0
- package/specs/pod.md +2 -0
- package/src/skills/captcha/README.md +221 -0
- package/src/skills/captcha/SKILL.md +355 -0
- package/src/skills/captcha/references/captcha-types.md +254 -0
- package/src/skills/captcha/references/services.md +172 -0
- package/src/skills/captcha/references/stealth.md +238 -0
- package/src/skills/captcha/scripts/solve_captcha.py +323 -0
- package/src/skills/captcha/scripts/solve_image_grid.py +350 -0
- package/src/skills/google-merchant-api/SKILL.md +581 -0
- package/src/skills/google-merchant-api/references/accounts.md +247 -0
- package/src/skills/google-merchant-api/references/content-api-legacy.md +216 -0
- package/src/skills/google-merchant-api/references/datasources.md +233 -0
- package/src/skills/google-merchant-api/references/inventories.md +201 -0
- package/src/skills/google-merchant-api/references/migration.md +267 -0
- package/src/skills/google-merchant-api/references/products.md +316 -0
- package/src/skills/google-merchant-api/references/promotions.md +201 -0
- package/src/skills/google-merchant-api/references/reports.md +240 -0
- package/src/skills/lv-aggregators-api/SKILL.md +113 -0
- package/src/skills/lv-aggregators-api/references/integration-guide.md +368 -0
- package/src/skills/lv-aggregators-api/references/kurpirkt.md +103 -0
- package/src/skills/lv-aggregators-api/references/salidzini.md +122 -0
- package/src/skills/tailwindcss-best-practices/SKILL.md +180 -0
- package/src/skills/tailwindcss-best-practices/references/best-practices-utility-patterns.md +87 -0
- package/src/skills/tailwindcss-best-practices/references/core-installation.md +109 -0
- package/src/skills/tailwindcss-best-practices/references/core-preflight.md +200 -0
- package/src/skills/tailwindcss-best-practices/references/core-responsive.md +163 -0
- package/src/skills/tailwindcss-best-practices/references/core-source-detection.md +114 -0
- package/src/skills/tailwindcss-best-practices/references/core-theme.md +108 -0
- package/src/skills/tailwindcss-best-practices/references/core-utility-classes.md +59 -0
- package/src/skills/tailwindcss-best-practices/references/core-variants.md +204 -0
- package/src/skills/tailwindcss-best-practices/references/effects-form-controls.md +76 -0
- package/src/skills/tailwindcss-best-practices/references/effects-mask.md +91 -0
- package/src/skills/tailwindcss-best-practices/references/effects-scroll-snap.md +59 -0
- package/src/skills/tailwindcss-best-practices/references/effects-text-shadow.md +78 -0
- package/src/skills/tailwindcss-best-practices/references/effects-transition-animation.md +80 -0
- package/src/skills/tailwindcss-best-practices/references/effects-visibility-interactivity.md +82 -0
- package/src/skills/tailwindcss-best-practices/references/features-content-detection.md +175 -0
- package/src/skills/tailwindcss-best-practices/references/features-custom-styles.md +203 -0
- package/src/skills/tailwindcss-best-practices/references/features-dark-mode.md +137 -0
- package/src/skills/tailwindcss-best-practices/references/features-functions-directives.md +241 -0
- package/src/skills/tailwindcss-best-practices/references/features-upgrade.md +160 -0
- package/src/skills/tailwindcss-best-practices/references/layout-aspect-ratio.md +39 -0
- package/src/skills/tailwindcss-best-practices/references/layout-columns.md +80 -0
- package/src/skills/tailwindcss-best-practices/references/layout-display.md +110 -0
- package/src/skills/tailwindcss-best-practices/references/layout-flexbox.md +112 -0
- package/src/skills/tailwindcss-best-practices/references/layout-grid.md +87 -0
- package/src/skills/tailwindcss-best-practices/references/layout-height.md +97 -0
- package/src/skills/tailwindcss-best-practices/references/layout-inset.md +103 -0
- package/src/skills/tailwindcss-best-practices/references/layout-logical-properties.md +92 -0
- package/src/skills/tailwindcss-best-practices/references/layout-margin.md +126 -0
- package/src/skills/tailwindcss-best-practices/references/layout-min-max-sizing.md +63 -0
- package/src/skills/tailwindcss-best-practices/references/layout-object-fit-position.md +64 -0
- package/src/skills/tailwindcss-best-practices/references/layout-overflow.md +57 -0
- package/src/skills/tailwindcss-best-practices/references/layout-padding.md +77 -0
- package/src/skills/tailwindcss-best-practices/references/layout-position.md +85 -0
- package/src/skills/tailwindcss-best-practices/references/layout-tables.md +67 -0
- package/src/skills/tailwindcss-best-practices/references/layout-width.md +102 -0
- package/src/skills/tailwindcss-best-practices/references/transform-base.md +68 -0
- package/src/skills/tailwindcss-best-practices/references/transform-rotate.md +70 -0
- package/src/skills/tailwindcss-best-practices/references/transform-scale.md +83 -0
- package/src/skills/tailwindcss-best-practices/references/transform-skew.md +62 -0
- package/src/skills/tailwindcss-best-practices/references/transform-translate.md +77 -0
- package/src/skills/tailwindcss-best-practices/references/typography-font-text.md +142 -0
- package/src/skills/tailwindcss-best-practices/references/typography-list-style.md +65 -0
- package/src/skills/tailwindcss-best-practices/references/typography-text-align.md +60 -0
- package/src/skills/tailwindcss-best-practices/references/visual-background.md +76 -0
- package/src/skills/tailwindcss-best-practices/references/visual-border.md +108 -0
- package/src/skills/tailwindcss-best-practices/references/visual-effects.md +111 -0
- package/src/skills/tailwindcss-best-practices/references/visual-svg.md +82 -0
- package/src/skills/test-mobile-app/SKILL.md +11 -6
- package/src/skills/test-mobile-app/scripts/analyze_apk.py +15 -4
- package/src/skills/test-mobile-app/scripts/check_environment.py +5 -5
- package/src/skills/test-mobile-app/scripts/run_tests.py +1 -1
- package/src/skills/test-web-ui/SKILL.md +264 -84
- package/src/skills/test-web-ui/scripts/discover.py +25 -12
- package/src/skills/test-web-ui/scripts/run_tests.py +3 -2
- package/src/skills/vite-best-practices/SKILL.md +115 -0
- package/src/skills/vite-best-practices/references/build-and-ssr.md +255 -0
- package/src/skills/vite-best-practices/references/core-config.md +231 -0
- package/src/skills/vite-best-practices/references/core-features.md +222 -0
- package/src/skills/vite-best-practices/references/core-plugin-api.md +294 -0
- package/src/skills/vite-best-practices/references/environment-api.md +108 -0
- package/src/skills/vite-best-practices/references/rolldown-migration.md +242 -0
- package/codex-cli-workspace/iteration-1/benchmark.json +0 -122
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/eval_metadata.json +0 -13
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/with_skill/grading.json +0 -52
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/with_skill/outputs/response.md +0 -163
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/with_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/without_skill/grading.json +0 -58
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/without_skill/outputs/response.md +0 -151
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/without_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/eval_metadata.json +0 -13
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/grading.json +0 -52
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/outputs/response.md +0 -86
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/grading.json +0 -58
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/outputs/response.md +0 -164
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/eval_metadata.json +0 -13
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/with_skill/grading.json +0 -52
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/with_skill/outputs/response.md +0 -130
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/with_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/without_skill/grading.json +0 -64
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/without_skill/outputs/response.md +0 -209
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/without_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/review.html +0 -1325
- package/gemini-cli-workspace/iteration-1/benchmark.json +0 -86
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/eval_metadata.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/with_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/with_skill/outputs/response.md +0 -401
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/without_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/without_skill/outputs/response.md +0 -405
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/eval_metadata.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/outputs/response.md +0 -212
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/outputs/response.md +0 -427
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/eval_metadata.json +0 -32
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/with_skill/grading.json +0 -32
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/with_skill/outputs/response.md +0 -171
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/without_skill/grading.json +0 -32
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/without_skill/outputs/response.md +0 -199
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/review.html +0 -1325
- package/gemini-cli-workspace/iteration-2/benchmark.json +0 -173
- package/gemini-cli-workspace/iteration-2/benchmark.md +0 -28
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/eval_metadata.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/with_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/with_skill/outputs/response.md +0 -195
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/without_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/without_skill/outputs/response.md +0 -377
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/eval_metadata.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/with_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/with_skill/outputs/response.md +0 -127
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/without_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/without_skill/outputs/response.md +0 -164
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/eval_metadata.json +0 -32
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/with_skill/grading.json +0 -32
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/with_skill/outputs/response.md +0 -91
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/without_skill/grading.json +0 -32
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/without_skill/outputs/response.md +0 -112
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-viewer.html +0 -1325
- package/screen-recording-workspace/evals.json +0 -41
- package/screen-recording-workspace/iteration-1/benchmark.json +0 -102
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/eval_metadata.json +0 -31
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/with_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/with_skill/outputs/demo.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/with_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/without_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/without_skill/outputs/demo.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/without_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/eval_metadata.json +0 -31
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/with_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/with_skill/outputs/region_capture.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/with_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/without_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/without_skill/outputs/region_capture.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/without_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/eval_metadata.json +0 -31
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/with_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/with_skill/outputs/fallback_recording.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/with_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/without_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/without_skill/outputs/fallback_recording.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/without_skill/outputs/record_screen.py +0 -67
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/without_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/review.html +0 -1325
- package/src/skills/codex-cli/evals/evals.json +0 -47
- package/src/skills/gemini-cli/evals/evals.json +0 -46
- package/src/skills/tm-search/evals/evals.json +0 -23
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vite-plugin-api
|
|
3
|
+
description: Vite plugin authoring with Rolldown hooks and Vite-specific hooks (Vite 8)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vite Plugin API
|
|
7
|
+
|
|
8
|
+
Vite plugins extend Rolldown's plugin interface with Vite-specific hooks. Refer to Rolldown's plugin documentation for the base API.
|
|
9
|
+
|
|
10
|
+
## Basic Structure
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import type { Plugin } from 'vite'
|
|
14
|
+
|
|
15
|
+
function myPlugin(): Plugin {
|
|
16
|
+
return {
|
|
17
|
+
name: 'my-plugin',
|
|
18
|
+
// hooks...
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Vite-Specific Hooks
|
|
24
|
+
|
|
25
|
+
### config
|
|
26
|
+
|
|
27
|
+
Modify config before resolution:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
const plugin = () => ({
|
|
31
|
+
name: 'add-alias',
|
|
32
|
+
config: () => ({
|
|
33
|
+
resolve: {
|
|
34
|
+
alias: { foo: 'bar' },
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### configResolved
|
|
41
|
+
|
|
42
|
+
Access final resolved config:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const plugin = () => {
|
|
46
|
+
let config: ResolvedConfig
|
|
47
|
+
return {
|
|
48
|
+
name: 'read-config',
|
|
49
|
+
configResolved(resolvedConfig) {
|
|
50
|
+
config = resolvedConfig
|
|
51
|
+
},
|
|
52
|
+
transform(code, id) {
|
|
53
|
+
if (config.command === 'serve') { /* dev */ }
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### configureServer
|
|
60
|
+
|
|
61
|
+
Add custom middleware to dev server:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const plugin = () => ({
|
|
65
|
+
name: 'custom-middleware',
|
|
66
|
+
configureServer(server) {
|
|
67
|
+
server.middlewares.use((req, res, next) => {
|
|
68
|
+
// handle request
|
|
69
|
+
next()
|
|
70
|
+
})
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Return function to run **after** internal middlewares:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
configureServer(server) {
|
|
79
|
+
return () => {
|
|
80
|
+
server.middlewares.use((req, res, next) => {
|
|
81
|
+
// runs after Vite's middlewares
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### transformIndexHtml
|
|
88
|
+
|
|
89
|
+
Transform HTML entry files:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const plugin = () => ({
|
|
93
|
+
name: 'html-transform',
|
|
94
|
+
transformIndexHtml(html) {
|
|
95
|
+
return html.replace(/<title>(.*?)<\/title>/, '<title>New Title</title>')
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Inject tags:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
transformIndexHtml() {
|
|
104
|
+
return [
|
|
105
|
+
{ tag: 'script', attrs: { src: '/inject.js' }, injectTo: 'body' },
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### handleHotUpdate
|
|
111
|
+
|
|
112
|
+
Custom HMR handling:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
handleHotUpdate({ server, modules, timestamp }) {
|
|
116
|
+
server.ws.send({ type: 'custom', event: 'special-update', data: {} })
|
|
117
|
+
return [] // empty = skip default HMR
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Virtual Modules
|
|
122
|
+
|
|
123
|
+
Serve virtual content without files on disk:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { exactRegex } from '@rolldown/pluginutils'
|
|
127
|
+
|
|
128
|
+
const plugin = () => {
|
|
129
|
+
const virtualModuleId = 'virtual:my-module'
|
|
130
|
+
const resolvedId = '\0' + virtualModuleId
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
name: 'virtual-module',
|
|
134
|
+
resolveId: {
|
|
135
|
+
filter: { id: exactRegex(virtualModuleId) },
|
|
136
|
+
handler() {
|
|
137
|
+
return resolvedId
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
load: {
|
|
141
|
+
filter: { id: exactRegex(resolvedId) },
|
|
142
|
+
handler() {
|
|
143
|
+
return `export const msg = "from virtual module"`
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Usage:
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
import { msg } from 'virtual:my-module'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Convention: prefix user-facing path with `virtual:`, prefix resolved id with `\0`.
|
|
157
|
+
|
|
158
|
+
**Note:** The older function-based syntax (`resolveId(id) { ... }`) still works — the filter-based syntax above is the newer, more performant pattern from Rolldown.
|
|
159
|
+
|
|
160
|
+
## Hook Filters (Vite 8 / Rolldown)
|
|
161
|
+
|
|
162
|
+
Hook filters reduce overhead by letting plugins declare which files they care about, so hooks are only called when relevant:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
{
|
|
166
|
+
name: 'transform-ts',
|
|
167
|
+
transform: {
|
|
168
|
+
filter: { id: /\.(ts|tsx)$/ },
|
|
169
|
+
handler(code, id) {
|
|
170
|
+
// Only called for .ts/.tsx files
|
|
171
|
+
return { code: transform(code), map: null }
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## moduleType in load/transform (Vite 8)
|
|
178
|
+
|
|
179
|
+
When converting non-JS content to JavaScript, you must specify `moduleType: 'js'` so Rolldown interprets the output correctly:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
{
|
|
183
|
+
name: 'txt-loader',
|
|
184
|
+
load(id) {
|
|
185
|
+
if (id.endsWith('.txt')) {
|
|
186
|
+
const content = fs.readFileSync(id, 'utf-8')
|
|
187
|
+
return {
|
|
188
|
+
code: `export default ${JSON.stringify(content)}`,
|
|
189
|
+
moduleType: 'js',
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Plugin Ordering
|
|
197
|
+
|
|
198
|
+
Use `enforce` to control execution order:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
{
|
|
202
|
+
name: 'pre-plugin',
|
|
203
|
+
enforce: 'pre', // runs before core plugins
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
{
|
|
207
|
+
name: 'post-plugin',
|
|
208
|
+
enforce: 'post', // runs after build plugins
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Order: Alias → `enforce: 'pre'` → Core → User (no enforce) → Build → `enforce: 'post'` → Post-build
|
|
213
|
+
|
|
214
|
+
## Conditional Application
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
{
|
|
218
|
+
name: 'build-only',
|
|
219
|
+
apply: 'build', // or 'serve'
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Function form:
|
|
223
|
+
{
|
|
224
|
+
apply(config, { command }) {
|
|
225
|
+
return command === 'build' && !config.build.ssr
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Universal Hooks (from Rolldown)
|
|
231
|
+
|
|
232
|
+
These work in both dev and build:
|
|
233
|
+
|
|
234
|
+
- `resolveId(id, importer)` — Resolve import paths
|
|
235
|
+
- `load(id)` — Load module content
|
|
236
|
+
- `transform(code, id)` — Transform module code
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
transform(code, id) {
|
|
240
|
+
if (id.endsWith('.custom')) {
|
|
241
|
+
return { code: compile(code), map: null }
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Note:** `moduleParsed` hook is NOT called during dev in Vite 8.
|
|
247
|
+
|
|
248
|
+
## Detecting Rolldown at Runtime
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
transform(code, id) {
|
|
252
|
+
if (this.meta.rolldownVersion) {
|
|
253
|
+
// Running on Rolldown-powered Vite (8+)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Client-Server Communication
|
|
259
|
+
|
|
260
|
+
Server to client:
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
configureServer(server) {
|
|
264
|
+
server.ws.send('my:event', { msg: 'hello' })
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Client side:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
if (import.meta.hot) {
|
|
272
|
+
import.meta.hot.on('my:event', (data) => {
|
|
273
|
+
console.log(data.msg)
|
|
274
|
+
})
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Client to server:
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
// Client
|
|
282
|
+
import.meta.hot.send('my:from-client', { msg: 'Hey!' })
|
|
283
|
+
|
|
284
|
+
// Server
|
|
285
|
+
server.ws.on('my:from-client', (data, client) => {
|
|
286
|
+
client.send('my:ack', { msg: 'Got it!' })
|
|
287
|
+
})
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
<!--
|
|
291
|
+
Source references:
|
|
292
|
+
- https://vite.dev/guide/api-plugin
|
|
293
|
+
- https://vite.dev/guide/migration
|
|
294
|
+
-->
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vite-environment-api
|
|
3
|
+
description: Vite 6+ Environment API for multiple runtime environments
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Environment API (Vite 6+)
|
|
7
|
+
|
|
8
|
+
The Environment API formalizes multiple runtime environments beyond the traditional client/SSR split.
|
|
9
|
+
|
|
10
|
+
## Concept
|
|
11
|
+
|
|
12
|
+
Before Vite 6: Two implicit environments (`client` and `ssr`).
|
|
13
|
+
|
|
14
|
+
Vite 6+: Configure as many environments as needed (browser, node server, edge server, etc.).
|
|
15
|
+
|
|
16
|
+
## Basic Configuration
|
|
17
|
+
|
|
18
|
+
For SPA/MPA, nothing changes—options apply to the implicit `client` environment:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
export default defineConfig({
|
|
22
|
+
build: { sourcemap: false },
|
|
23
|
+
optimizeDeps: { include: ['lib'] },
|
|
24
|
+
})
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Multiple Environments
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
export default defineConfig({
|
|
31
|
+
build: { sourcemap: false }, // Inherited by all environments
|
|
32
|
+
optimizeDeps: { include: ['lib'] }, // Client only
|
|
33
|
+
environments: {
|
|
34
|
+
// SSR environment
|
|
35
|
+
server: {},
|
|
36
|
+
// Edge runtime environment
|
|
37
|
+
edge: {
|
|
38
|
+
resolve: { noExternal: true },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Environments inherit top-level config. Some options (like `optimizeDeps`) only apply to `client` by default.
|
|
45
|
+
|
|
46
|
+
## Environment Options
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
interface EnvironmentOptions {
|
|
50
|
+
define?: Record<string, any>
|
|
51
|
+
resolve?: EnvironmentResolveOptions
|
|
52
|
+
optimizeDeps: DepOptimizationOptions
|
|
53
|
+
consumer?: 'client' | 'server'
|
|
54
|
+
dev: DevOptions
|
|
55
|
+
build: BuildOptions
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Custom Environment Instances
|
|
60
|
+
|
|
61
|
+
Runtime providers can define custom environments:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { customEnvironment } from 'vite-environment-provider'
|
|
65
|
+
|
|
66
|
+
export default defineConfig({
|
|
67
|
+
environments: {
|
|
68
|
+
ssr: customEnvironment({
|
|
69
|
+
build: { outDir: '/dist/ssr' },
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Example: Cloudflare's Vite plugin runs code in `workerd` runtime during development.
|
|
76
|
+
|
|
77
|
+
## Backward Compatibility
|
|
78
|
+
|
|
79
|
+
- `server.moduleGraph` returns mixed client/SSR view
|
|
80
|
+
- `ssrLoadModule` still works
|
|
81
|
+
- Existing SSR apps work unchanged
|
|
82
|
+
|
|
83
|
+
## When to Use
|
|
84
|
+
|
|
85
|
+
- **End users**: Usually don't need to configure—frameworks handle it
|
|
86
|
+
- **Plugin authors**: Use for environment-aware transformations
|
|
87
|
+
- **Framework authors**: Create custom environments for their runtime needs
|
|
88
|
+
|
|
89
|
+
## Plugin Environment Access
|
|
90
|
+
|
|
91
|
+
Plugins can access environment in hooks:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
{
|
|
95
|
+
name: 'env-aware',
|
|
96
|
+
transform(code, id, options) {
|
|
97
|
+
if (options?.ssr) {
|
|
98
|
+
// SSR-specific transform
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
<!--
|
|
105
|
+
Source references:
|
|
106
|
+
- https://vite.dev/guide/api-environment
|
|
107
|
+
- https://vite.dev/blog/announcing-vite6
|
|
108
|
+
-->
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vite-rolldown
|
|
3
|
+
description: Vite 8 Rolldown bundler and Oxc transformer migration from Vite 7
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Rolldown Migration (Vite 8)
|
|
7
|
+
|
|
8
|
+
Vite 8 (stable March 2026) replaces esbuild+Rollup with Rolldown, a unified Rust-based bundler. Performance gains of 10-30x for production builds are typical.
|
|
9
|
+
|
|
10
|
+
## What Changed
|
|
11
|
+
|
|
12
|
+
| Before (Vite 7) | After (Vite 8) | Compat Layer |
|
|
13
|
+
|-----------------|----------------|--------------|
|
|
14
|
+
| esbuild (dev transform) | Oxc Transformer | `esbuild` auto-converts to `oxc` |
|
|
15
|
+
| esbuild (dep pre-bundling) | Rolldown | `esbuildOptions` auto-converts |
|
|
16
|
+
| esbuild (JS minification) | Oxc Minifier | `minify: 'esbuild'` = fallback |
|
|
17
|
+
| esbuild (CSS minification) | Lightning CSS | `cssMinify: 'esbuild'` = fallback |
|
|
18
|
+
| Rollup (production build) | Rolldown | `rollupOptions` auto-converts |
|
|
19
|
+
| `rollupOptions` | `rolldownOptions` | deprecated, auto-converts |
|
|
20
|
+
| `esbuild` option | `oxc` option | deprecated, auto-converts |
|
|
21
|
+
|
|
22
|
+
**Important:** A compatibility layer auto-converts old config names, so many projects upgrade with zero config changes. However, both `esbuild` and `rollupOptions` are deprecated and will be removed in a future version. Always use the new names in new code.
|
|
23
|
+
|
|
24
|
+
## Config Migration
|
|
25
|
+
|
|
26
|
+
### rollupOptions → rolldownOptions
|
|
27
|
+
|
|
28
|
+
Direct rename. Internal structure (`external`, `output.globals`) stays the same:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
// Before (Vite 7)
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
build: {
|
|
34
|
+
rollupOptions: {
|
|
35
|
+
external: ['vue'],
|
|
36
|
+
output: { globals: { vue: 'Vue' } },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
// After (Vite 8)
|
|
42
|
+
export default defineConfig({
|
|
43
|
+
build: {
|
|
44
|
+
rolldownOptions: {
|
|
45
|
+
external: ['vue'],
|
|
46
|
+
output: { globals: { vue: 'Vue' } },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Also applies to `worker.rollupOptions` → `worker.rolldownOptions`.
|
|
53
|
+
|
|
54
|
+
### esbuild → oxc (JavaScript Transforms)
|
|
55
|
+
|
|
56
|
+
Complete mapping of esbuild JSX options to Oxc:
|
|
57
|
+
|
|
58
|
+
| esbuild | oxc equivalent |
|
|
59
|
+
|---------|---------------|
|
|
60
|
+
| `jsx: 'transform'` | `jsx: { runtime: 'classic' }` |
|
|
61
|
+
| `jsx: 'automatic'` | `jsx: { runtime: 'automatic' }` |
|
|
62
|
+
| `jsx: 'preserve'` | `jsx: 'preserve'` |
|
|
63
|
+
| `jsxFactory: 'h'` | `jsx.pragma: 'h'` |
|
|
64
|
+
| `jsxFragment: 'Fragment'` | `jsx.pragmaFrag: 'Fragment'` |
|
|
65
|
+
| `jsxImportSource: 'react'` | `jsx.importSource: 'react'` |
|
|
66
|
+
| `jsxDev` | `jsx.development` |
|
|
67
|
+
| `jsxSideEffects` | `jsx.pure` |
|
|
68
|
+
| `jsxInject` | `jsxInject` (same) |
|
|
69
|
+
| `include`/`exclude` | `include`/`exclude` (same) |
|
|
70
|
+
| `define` | `define` (same) |
|
|
71
|
+
|
|
72
|
+
**Not supported in Oxc:** `esbuild.supported` option.
|
|
73
|
+
|
|
74
|
+
**Not supported:** Native decorator lowering — use Babel or SWC plugins.
|
|
75
|
+
|
|
76
|
+
**Example — Preact classic JSX:**
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
// Before (Vite 7)
|
|
80
|
+
export default defineConfig({
|
|
81
|
+
esbuild: {
|
|
82
|
+
jsxFactory: 'h',
|
|
83
|
+
jsxFragment: 'Fragment',
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// After (Vite 8)
|
|
88
|
+
export default defineConfig({
|
|
89
|
+
oxc: {
|
|
90
|
+
jsx: {
|
|
91
|
+
runtime: 'classic',
|
|
92
|
+
pragma: 'h',
|
|
93
|
+
pragmaFrag: 'Fragment',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Example — React automatic:**
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
export default defineConfig({
|
|
103
|
+
oxc: {
|
|
104
|
+
jsx: {
|
|
105
|
+
runtime: 'automatic',
|
|
106
|
+
importSource: 'react',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### optimizeDeps.esbuildOptions → optimizeDeps.rolldownOptions
|
|
113
|
+
|
|
114
|
+
Auto-converted options:
|
|
115
|
+
|
|
116
|
+
| esbuildOptions | rolldownOptions equivalent |
|
|
117
|
+
|---------------|--------------------------|
|
|
118
|
+
| `minify` | `output.minify` |
|
|
119
|
+
| `treeShaking` | `treeshake` |
|
|
120
|
+
| `define` | `transform.define` |
|
|
121
|
+
| `loader` | `moduleTypes` |
|
|
122
|
+
| `preserveSymlinks` | `!resolve.symlinks` |
|
|
123
|
+
| `resolveExtensions` | `resolve.extensions` |
|
|
124
|
+
| `mainFields` | `resolve.mainFields` |
|
|
125
|
+
| `conditions` | `resolve.conditionNames` |
|
|
126
|
+
| `keepNames` | `output.keepNames` |
|
|
127
|
+
| `platform` | `platform` |
|
|
128
|
+
| `plugins` | `plugins` (partial support) |
|
|
129
|
+
|
|
130
|
+
### Minification
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
// Vite 8 default: Oxc minifier
|
|
134
|
+
build: { minify: true } // uses Oxc
|
|
135
|
+
|
|
136
|
+
// Fallback to esbuild (requires installing esbuild)
|
|
137
|
+
build: { minify: 'esbuild' }
|
|
138
|
+
|
|
139
|
+
// CSS: Lightning CSS is default
|
|
140
|
+
build: { cssMinify: true } // uses Lightning CSS
|
|
141
|
+
build: { cssMinify: 'esbuild' } // fallback (requires esbuild)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Not supported by Oxc minifier:** `mangleProps`, `reserveProps`, `mangleQuoted`, `mangleCache`.
|
|
145
|
+
|
|
146
|
+
### esbuild.banner/footer
|
|
147
|
+
|
|
148
|
+
No direct equivalent. Use a custom plugin with the `transform` hook instead.
|
|
149
|
+
|
|
150
|
+
## Breaking Changes
|
|
151
|
+
|
|
152
|
+
### manualChunks
|
|
153
|
+
|
|
154
|
+
- Object form **removed**
|
|
155
|
+
- Function form **deprecated** → use `codeSplitting` option instead
|
|
156
|
+
|
|
157
|
+
### CommonJS Interop
|
|
158
|
+
|
|
159
|
+
The `default` import from CJS modules follows new rules. If the importer is `.mjs`/`.mts`, or the closest `package.json` has `"type": "module"`, or `module.exports.__esModule` is not true, then `default` = `module.exports` (not `module.exports.default`).
|
|
160
|
+
|
|
161
|
+
Temporary workaround: `legacy.inconsistentCjsInterop: true`.
|
|
162
|
+
|
|
163
|
+
### Format Sniffing Removed
|
|
164
|
+
|
|
165
|
+
Vite no longer sniffs file content to choose between `browser` and `module` fields. `resolve.mainFields` order is always respected.
|
|
166
|
+
|
|
167
|
+
### build() Error Handling
|
|
168
|
+
|
|
169
|
+
`build()` now throws `BundleError` (not raw error) with `.errors?: RolldownError[]` array.
|
|
170
|
+
|
|
171
|
+
### Removed Config Options
|
|
172
|
+
|
|
173
|
+
| Removed | Replacement |
|
|
174
|
+
|---------|-------------|
|
|
175
|
+
| `build.commonjsOptions` | No-op (Rolldown handles CJS natively) |
|
|
176
|
+
| `build.dynamicImportVarsOptions.warnOnError` | No-op |
|
|
177
|
+
| `resolve.alias[].customResolver` | Use custom plugin with `resolveId` hook |
|
|
178
|
+
| `rollupOptions.output.manualChunks` (object form) | Use function form or `codeSplitting` |
|
|
179
|
+
| `rollupOptions.watch.chokidar` | `rolldownOptions.watch.watcher` |
|
|
180
|
+
|
|
181
|
+
### Unsupported Output Formats
|
|
182
|
+
|
|
183
|
+
`'system'` and `'amd'` output formats are not supported by Rolldown.
|
|
184
|
+
|
|
185
|
+
### Node.js Requirements
|
|
186
|
+
|
|
187
|
+
Node.js 20.19+ or 22.12+ required (same as Vite 7).
|
|
188
|
+
|
|
189
|
+
## Plugin Compatibility
|
|
190
|
+
|
|
191
|
+
Most Vite/Rollup plugins work unchanged because Rolldown supports the Rollup plugin API. If a plugin only works during build:
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
{
|
|
195
|
+
...rollupPlugin(),
|
|
196
|
+
enforce: 'post',
|
|
197
|
+
apply: 'build',
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Note:** `moduleParsed` hook is NOT called during dev. Plugins relying on it need adjustment.
|
|
202
|
+
|
|
203
|
+
Detect Rolldown at runtime: `this.meta.rolldownVersion`.
|
|
204
|
+
|
|
205
|
+
## Gradual Migration
|
|
206
|
+
|
|
207
|
+
For large projects, migrate via `rolldown-vite` first:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Step 1: Test with rolldown-vite (still Vite 7)
|
|
211
|
+
pnpm add -D rolldown-vite
|
|
212
|
+
|
|
213
|
+
# Replace vite import in config
|
|
214
|
+
import { defineConfig } from 'rolldown-vite'
|
|
215
|
+
|
|
216
|
+
# Step 2: Once stable, upgrade to Vite 8
|
|
217
|
+
pnpm add -D vite@8
|
|
218
|
+
|
|
219
|
+
# Revert the import
|
|
220
|
+
import { defineConfig } from 'vite'
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Overriding Vite in Frameworks
|
|
224
|
+
|
|
225
|
+
When framework depends on older Vite:
|
|
226
|
+
|
|
227
|
+
```json
|
|
228
|
+
{
|
|
229
|
+
"pnpm": {
|
|
230
|
+
"overrides": {
|
|
231
|
+
"vite": "8.0.0"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
<!--
|
|
238
|
+
Source references:
|
|
239
|
+
- https://vite.dev/blog/announcing-vite8
|
|
240
|
+
- https://vite.dev/guide/migration
|
|
241
|
+
- https://vite.dev/config/shared-options#oxc
|
|
242
|
+
-->
|