@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,255 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vite-build-ssr
|
|
3
|
+
description: Vite 8 library mode and SSR configuration
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build and SSR
|
|
7
|
+
|
|
8
|
+
## Library Mode
|
|
9
|
+
|
|
10
|
+
Build a library for distribution:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
// vite.config.ts
|
|
14
|
+
import { resolve } from 'node:path'
|
|
15
|
+
import { defineConfig } from 'vite'
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
build: {
|
|
19
|
+
lib: {
|
|
20
|
+
entry: resolve(import.meta.dirname, 'lib/main.ts'),
|
|
21
|
+
name: 'MyLib',
|
|
22
|
+
fileName: 'my-lib',
|
|
23
|
+
},
|
|
24
|
+
rolldownOptions: {
|
|
25
|
+
external: ['vue', 'react'],
|
|
26
|
+
output: {
|
|
27
|
+
globals: {
|
|
28
|
+
vue: 'Vue',
|
|
29
|
+
react: 'React',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Note:** Use `import.meta.dirname` (ESM) not `__dirname` (CJS).
|
|
38
|
+
|
|
39
|
+
### Multiple Entries
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
build: {
|
|
43
|
+
lib: {
|
|
44
|
+
entry: {
|
|
45
|
+
'my-lib': resolve(import.meta.dirname, 'lib/main.ts'),
|
|
46
|
+
secondary: resolve(import.meta.dirname, 'lib/secondary.ts'),
|
|
47
|
+
},
|
|
48
|
+
name: 'MyLib',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Output Formats
|
|
54
|
+
|
|
55
|
+
- Single entry: `es` and `umd`
|
|
56
|
+
- Multiple entries: `es` and `cjs`
|
|
57
|
+
|
|
58
|
+
### Package.json Setup
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"name": "my-lib",
|
|
63
|
+
"type": "module",
|
|
64
|
+
"files": ["dist"],
|
|
65
|
+
"main": "./dist/my-lib.umd.cjs",
|
|
66
|
+
"module": "./dist/my-lib.js",
|
|
67
|
+
"exports": {
|
|
68
|
+
".": {
|
|
69
|
+
"import": {
|
|
70
|
+
"types": "./dist/types/index.d.ts",
|
|
71
|
+
"default": "./dist/my-lib.js"
|
|
72
|
+
},
|
|
73
|
+
"require": {
|
|
74
|
+
"types": "./dist/types/index.d.ts",
|
|
75
|
+
"default": "./dist/my-lib.umd.cjs"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"./style.css": "./dist/my-lib.css"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Tip:** List `types` first in each export condition — Node.js resolves conditions top-to-bottom.
|
|
84
|
+
|
|
85
|
+
## Multi-Page App
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
export default defineConfig({
|
|
89
|
+
build: {
|
|
90
|
+
rolldownOptions: {
|
|
91
|
+
input: {
|
|
92
|
+
main: resolve(import.meta.dirname, 'index.html'),
|
|
93
|
+
nested: resolve(import.meta.dirname, 'nested/index.html'),
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Chunk Splitting (Vite 8)
|
|
101
|
+
|
|
102
|
+
The `manualChunks` object form is removed in Vite 8. The function form is deprecated — use `codeSplitting` instead for advanced chunk control.
|
|
103
|
+
|
|
104
|
+
## SSR Development
|
|
105
|
+
|
|
106
|
+
### Middleware Mode
|
|
107
|
+
|
|
108
|
+
Use Vite as middleware in a custom server:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import express from 'express'
|
|
112
|
+
import { createServer as createViteServer } from 'vite'
|
|
113
|
+
|
|
114
|
+
const app = express()
|
|
115
|
+
|
|
116
|
+
const vite = await createViteServer({
|
|
117
|
+
server: { middlewareMode: true },
|
|
118
|
+
appType: 'custom',
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
app.use(vite.middlewares)
|
|
122
|
+
|
|
123
|
+
app.use('*all', async (req, res, next) => {
|
|
124
|
+
const url = req.originalUrl
|
|
125
|
+
|
|
126
|
+
// 1. Read and transform index.html
|
|
127
|
+
let template = await fs.readFile('index.html', 'utf-8')
|
|
128
|
+
template = await vite.transformIndexHtml(url, template)
|
|
129
|
+
|
|
130
|
+
// 2. Load server entry
|
|
131
|
+
const { render } = await vite.ssrLoadModule('/src/entry-server.ts')
|
|
132
|
+
|
|
133
|
+
// 3. Render app
|
|
134
|
+
const appHtml = await render(url)
|
|
135
|
+
|
|
136
|
+
// 4. Inject into template
|
|
137
|
+
const html = template.replace('<!--ssr-outlet-->', appHtml)
|
|
138
|
+
|
|
139
|
+
res.status(200).set({ 'Content-Type': 'text/html' }).end(html)
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
app.listen(5173)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### SSR Build
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"scripts": {
|
|
150
|
+
"build:client": "vite build --outDir dist/client",
|
|
151
|
+
"build:server": "vite build --outDir dist/server --ssr src/entry-server.ts"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The `--ssr` flag:
|
|
157
|
+
- Externalizes dependencies by default
|
|
158
|
+
- Outputs for Node.js consumption
|
|
159
|
+
|
|
160
|
+
### SSR Manifest
|
|
161
|
+
|
|
162
|
+
Generate asset mapping for preload hints:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
vite build --outDir dist/client --ssrManifest
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Creates `dist/client/.vite/ssr-manifest.json` mapping module IDs to chunks.
|
|
169
|
+
|
|
170
|
+
### SSR Externals
|
|
171
|
+
|
|
172
|
+
Control which deps get bundled vs externalized:
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
export default defineConfig({
|
|
176
|
+
ssr: {
|
|
177
|
+
noExternal: ['some-package'], // Bundle this dep
|
|
178
|
+
external: ['another-package'], // Externalize this dep
|
|
179
|
+
},
|
|
180
|
+
})
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Conditional Logic
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
if (import.meta.env.SSR) {
|
|
187
|
+
// Server-only code (tree-shaken from client)
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## JavaScript API
|
|
192
|
+
|
|
193
|
+
### createServer
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
import { createServer } from 'vite'
|
|
197
|
+
|
|
198
|
+
const server = await createServer({
|
|
199
|
+
configFile: false,
|
|
200
|
+
root: import.meta.dirname,
|
|
201
|
+
server: { port: 1337 },
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
await server.listen()
|
|
205
|
+
server.printUrls()
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### build
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
import { build } from 'vite'
|
|
212
|
+
|
|
213
|
+
await build({
|
|
214
|
+
root: './project',
|
|
215
|
+
build: { outDir: 'dist' },
|
|
216
|
+
})
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Vite 8:** `build()` throws `BundleError` (not raw error) with `.errors?: RolldownError[]` array.
|
|
220
|
+
|
|
221
|
+
### preview
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
import { preview } from 'vite'
|
|
225
|
+
|
|
226
|
+
const previewServer = await preview({
|
|
227
|
+
preview: { port: 8080, open: true },
|
|
228
|
+
})
|
|
229
|
+
previewServer.printUrls()
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### resolveConfig
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
import { resolveConfig } from 'vite'
|
|
236
|
+
|
|
237
|
+
const config = await resolveConfig({}, 'build')
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### loadEnv
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
import { loadEnv } from 'vite'
|
|
244
|
+
|
|
245
|
+
const env = loadEnv('development', process.cwd(), '')
|
|
246
|
+
// Loads all env vars (empty prefix = no filtering)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
<!--
|
|
250
|
+
Source references:
|
|
251
|
+
- https://vite.dev/guide/build
|
|
252
|
+
- https://vite.dev/guide/ssr
|
|
253
|
+
- https://vite.dev/guide/api-javascript
|
|
254
|
+
- https://vite.dev/guide/migration
|
|
255
|
+
-->
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vite-config
|
|
3
|
+
description: Vite 8 configuration patterns using vite.config.ts
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vite Configuration
|
|
7
|
+
|
|
8
|
+
## Basic Setup
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
// vite.config.ts
|
|
12
|
+
import { defineConfig } from 'vite'
|
|
13
|
+
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
// config options
|
|
16
|
+
})
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Vite auto-resolves `vite.config.ts` from project root. Supports ES modules syntax regardless of `package.json` type.
|
|
20
|
+
|
|
21
|
+
## Conditional Config
|
|
22
|
+
|
|
23
|
+
Export a function to access command and mode:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
|
|
27
|
+
if (command === 'serve') {
|
|
28
|
+
return { /* dev config */ }
|
|
29
|
+
} else {
|
|
30
|
+
return { /* build config */ }
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- `command`: `'serve'` during dev, `'build'` for production
|
|
36
|
+
- `mode`: `'development'` or `'production'` (or custom via `--mode`)
|
|
37
|
+
|
|
38
|
+
## Async Config
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
export default defineConfig(async ({ command, mode }) => {
|
|
42
|
+
const data = await fetchSomething()
|
|
43
|
+
return { /* config */ }
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Using Environment Variables in Config
|
|
48
|
+
|
|
49
|
+
`.env` files are loaded **after** config resolution. Use `loadEnv` to access them in config:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
53
|
+
|
|
54
|
+
export default defineConfig(({ mode }) => {
|
|
55
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
define: {
|
|
59
|
+
__APP_ENV__: JSON.stringify(env.APP_ENV),
|
|
60
|
+
},
|
|
61
|
+
server: {
|
|
62
|
+
port: env.APP_PORT ? Number(env.APP_PORT) : 5173,
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Key Config Options
|
|
69
|
+
|
|
70
|
+
### resolve.alias
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
export default defineConfig({
|
|
74
|
+
resolve: {
|
|
75
|
+
alias: {
|
|
76
|
+
'@': '/src',
|
|
77
|
+
'~': '/src',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### resolve.tsconfigPaths (Vite 8)
|
|
84
|
+
|
|
85
|
+
Auto-resolve TypeScript path aliases from `tsconfig.json`:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
export default defineConfig({
|
|
89
|
+
resolve: {
|
|
90
|
+
tsconfigPaths: true, // default: false (small perf cost)
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### define (Global Constants)
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
export default defineConfig({
|
|
99
|
+
define: {
|
|
100
|
+
__APP_VERSION__: JSON.stringify('1.0.0'),
|
|
101
|
+
__API_URL__: 'window.__backend_api_url',
|
|
102
|
+
},
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Values must be JSON-serializable or single identifiers. Non-strings auto-wrapped with `JSON.stringify`.
|
|
107
|
+
|
|
108
|
+
### plugins
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import vue from '@vitejs/plugin-vue'
|
|
112
|
+
|
|
113
|
+
export default defineConfig({
|
|
114
|
+
plugins: [vue()],
|
|
115
|
+
})
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Plugins array is flattened; falsy values ignored.
|
|
119
|
+
|
|
120
|
+
### oxc (Vite 8 — replaces esbuild)
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
export default defineConfig({
|
|
124
|
+
oxc: {
|
|
125
|
+
jsx: {
|
|
126
|
+
runtime: 'automatic', // or 'classic'
|
|
127
|
+
importSource: 'react',
|
|
128
|
+
},
|
|
129
|
+
jsxInject: `import React from 'react'`, // auto-inject
|
|
130
|
+
include: ['**/*.ts', '**/*.tsx'], // default: ts, jsx, tsx
|
|
131
|
+
exclude: ['node_modules/**'],
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Set `oxc: false` to disable Oxc transformation entirely.
|
|
137
|
+
|
|
138
|
+
**Note:** The old `esbuild` option still works via compatibility layer but is deprecated. Always use `oxc` in new code.
|
|
139
|
+
|
|
140
|
+
### server.proxy
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
export default defineConfig({
|
|
144
|
+
server: {
|
|
145
|
+
proxy: {
|
|
146
|
+
'/api': {
|
|
147
|
+
target: 'http://localhost:3000',
|
|
148
|
+
changeOrigin: true,
|
|
149
|
+
rewrite: (path) => path.replace(/^\/api/, ''),
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### server.forwardConsole (Vite 8)
|
|
157
|
+
|
|
158
|
+
Route browser console logs to the dev server terminal:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
export default defineConfig({
|
|
162
|
+
server: {
|
|
163
|
+
forwardConsole: true, // useful for AI coding agents detecting runtime errors
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### devtools (Vite 8 — Experimental)
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
export default defineConfig({
|
|
172
|
+
devtools: true, // requires @vitejs/devtools installed; build mode only
|
|
173
|
+
})
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### build.target
|
|
177
|
+
|
|
178
|
+
Default: Baseline Widely Available browsers (Chrome 111+, Firefox 114+, Safari 16.4+).
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
export default defineConfig({
|
|
182
|
+
build: {
|
|
183
|
+
target: 'esnext', // or 'es2020', ['chrome90', 'firefox88']
|
|
184
|
+
},
|
|
185
|
+
})
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### build.rolldownOptions (Vite 8 — replaces rollupOptions)
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
export default defineConfig({
|
|
192
|
+
build: {
|
|
193
|
+
rolldownOptions: {
|
|
194
|
+
external: ['vue'],
|
|
195
|
+
output: {
|
|
196
|
+
globals: { vue: 'Vue' },
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
})
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Note:** `build.rollupOptions` still works via compat layer but is deprecated.
|
|
204
|
+
|
|
205
|
+
## TypeScript Intellisense
|
|
206
|
+
|
|
207
|
+
For plain JS config files:
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
/** @type {import('vite').UserConfig} */
|
|
211
|
+
export default {
|
|
212
|
+
// ...
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Or use `satisfies`:
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
import type { UserConfig } from 'vite'
|
|
220
|
+
|
|
221
|
+
export default {
|
|
222
|
+
// ...
|
|
223
|
+
} satisfies UserConfig
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
<!--
|
|
227
|
+
Source references:
|
|
228
|
+
- https://vite.dev/config/
|
|
229
|
+
- https://vite.dev/guide/
|
|
230
|
+
- https://vite.dev/guide/migration
|
|
231
|
+
-->
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vite-features
|
|
3
|
+
description: Vite-specific import patterns and runtime features
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vite Features
|
|
7
|
+
|
|
8
|
+
## Glob Import
|
|
9
|
+
|
|
10
|
+
Import multiple modules matching a pattern:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const modules = import.meta.glob('./dir/*.ts')
|
|
14
|
+
// { './dir/foo.ts': () => import('./dir/foo.ts'), ... }
|
|
15
|
+
|
|
16
|
+
for (const path in modules) {
|
|
17
|
+
modules[path]().then((mod) => {
|
|
18
|
+
console.log(path, mod)
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Eager Loading
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const modules = import.meta.glob('./dir/*.ts', { eager: true })
|
|
27
|
+
// Modules loaded immediately, no dynamic import
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Named Imports
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
const modules = import.meta.glob('./dir/*.ts', { import: 'setup' })
|
|
34
|
+
// Only imports the 'setup' export from each module
|
|
35
|
+
|
|
36
|
+
const defaults = import.meta.glob('./dir/*.ts', { import: 'default', eager: true })
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Multiple Patterns
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
const modules = import.meta.glob(['./dir/*.ts', './another/*.ts'])
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Negative Patterns
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const modules = import.meta.glob(['./dir/*.ts', '!**/ignored.ts'])
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Custom Queries
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
const svgRaw = import.meta.glob('./icons/*.svg', { query: '?raw', import: 'default' })
|
|
55
|
+
const svgUrls = import.meta.glob('./icons/*.svg', { query: '?url', import: 'default' })
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Asset Import Queries
|
|
59
|
+
|
|
60
|
+
### URL Import
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import imgUrl from './img.png'
|
|
64
|
+
// Returns resolved URL: '/src/img.png' (dev) or '/assets/img.2d8efhg.png' (build)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Explicit URL
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import workletUrl from './worklet.js?url'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Raw String
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import shaderCode from './shader.glsl?raw'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Inline/No-Inline
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import inlined from './small.png?inline' // Force base64 inline
|
|
83
|
+
import notInlined from './large.png?no-inline' // Force separate file
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Web Workers
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import Worker from './worker.ts?worker'
|
|
90
|
+
const worker = new Worker()
|
|
91
|
+
|
|
92
|
+
// Or inline:
|
|
93
|
+
import InlineWorker from './worker.ts?worker&inline'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Preferred pattern using constructor:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
const worker = new Worker(new URL('./worker.ts', import.meta.url), {
|
|
100
|
+
type: 'module',
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### WebAssembly (Vite 8: works in SSR too)
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import init from './module.wasm?init'
|
|
108
|
+
const instance = await init()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Environment Variables
|
|
112
|
+
|
|
113
|
+
### Built-in Constants
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import.meta.env.MODE // 'development' | 'production' | custom
|
|
117
|
+
import.meta.env.BASE_URL // Base URL from config
|
|
118
|
+
import.meta.env.PROD // true in production
|
|
119
|
+
import.meta.env.DEV // true in development
|
|
120
|
+
import.meta.env.SSR // true when running in server
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Custom Variables
|
|
124
|
+
|
|
125
|
+
Only `VITE_` prefixed vars exposed to client:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
# .env
|
|
129
|
+
VITE_API_URL=https://api.example.com
|
|
130
|
+
DB_PASSWORD=secret # NOT exposed to client
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
console.log(import.meta.env.VITE_API_URL) // works
|
|
135
|
+
console.log(import.meta.env.DB_PASSWORD) // undefined
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Mode-specific Files
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
.env # always loaded
|
|
142
|
+
.env.local # always loaded, gitignored
|
|
143
|
+
.env.[mode] # only in specified mode
|
|
144
|
+
.env.[mode].local # only in specified mode, gitignored
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### TypeScript Support
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
// vite-env.d.ts
|
|
151
|
+
interface ImportMetaEnv {
|
|
152
|
+
readonly VITE_API_URL: string
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
interface ImportMeta {
|
|
156
|
+
readonly env: ImportMetaEnv
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### HTML Replacement
|
|
161
|
+
|
|
162
|
+
```html
|
|
163
|
+
<p>Running in %MODE%</p>
|
|
164
|
+
<script>window.API = "%VITE_API_URL%"</script>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## CSS
|
|
168
|
+
|
|
169
|
+
### CSS Modules
|
|
170
|
+
|
|
171
|
+
Any `.module.css` file treated as CSS module:
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
import styles from './component.module.css'
|
|
175
|
+
element.className = styles.button
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Lightning CSS (Vite 8 default for minification)
|
|
179
|
+
|
|
180
|
+
Lightning CSS is now the default CSS minifier. For full Lightning CSS processing:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
export default defineConfig({
|
|
184
|
+
css: {
|
|
185
|
+
transformer: 'lightningcss',
|
|
186
|
+
lightningcss: {
|
|
187
|
+
// Lightning CSS options
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## JSON Import
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
import pkg from './package.json'
|
|
197
|
+
import { version } from './package.json' // Named import with tree-shaking
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## HMR API
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
if (import.meta.hot) {
|
|
204
|
+
import.meta.hot.accept((newModule) => {
|
|
205
|
+
// Handle update
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
import.meta.hot.dispose((data) => {
|
|
209
|
+
// Cleanup before module is replaced
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
import.meta.hot.invalidate() // Force full reload
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
<!--
|
|
217
|
+
Source references:
|
|
218
|
+
- https://vite.dev/guide/features
|
|
219
|
+
- https://vite.dev/guide/env-and-mode
|
|
220
|
+
- https://vite.dev/guide/assets
|
|
221
|
+
- https://vite.dev/guide/api-hmr
|
|
222
|
+
-->
|