Commit 3e1a9ca
feat(gdu): add Overdrive barrel-splitting Vite plugin (#408)
* feat(gdu): add Overdrive barrel-splitting Vite plugin
Rewrites `import { X } from '@autoguru/overdrive'` into deep component
imports (e.g. `@autoguru/overdrive/components/Box`) during Vite builds,
enabling granular tree-shaking and eliminating Vanilla Extract CSS
side-effect leakage from unused components.
Includes a 136-entry export manifest covering all components, hooks,
styles, themes, and utils — with a generator script for regeneration
when Overdrive updates.
Validated: fmo-booking builds identically (227 JS chunks, 82 CSS files,
zero barrel imports in output, build-manifest.json unchanged).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(gdu): fix dev mode env token replacement for Vite 8/OXC
Vite 8 with OXC does not replace custom process.env.X dotted member
expressions via the define config. In production the mfeEnvTokens
plugin handles this, but dev mode had no equivalent — causing
process.env.mfeBasePath etc. to evaluate to undefined and breaking
Router basename resolution.
- Add devEnvReplace plugin to runSPA-vite.ts that inlines env values
via pre-transform string replacement in dev mode
- Spread envDefines (not remainingDefines) into base define so the
dev plugin can extract process.env.X entries
- Add apply: 'build' to overdriveBarrelSplit to skip it in dev mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(gdu): address lint errors and review feedback
- Extract OverdriveCategory type alias (sonarjs/use-type-alias)
- Reduce processTopLevelBarrel cognitive complexity by extracting
category detection helper (sonarjs/cognitive-complexity)
- Use String.raw for regex escape string (unicorn/prefer-string-raw)
- Flip negated ternary condition (unicorn/no-negated-condition)
- Add empty line between import groups (import/order)
- Use JSON.stringify for manifest output values to handle special chars
- Use full path in regeneration command doc comment
- Use proper JS identifier regex pattern for $ in export names
- Remove non-portable shebang from manifest generator
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 75b3143 commit 3e1a9ca
File tree
5 files changed
+869
-10
lines changed- packages/gdu
- commands/start
- config/vite
- plugins
5 files changed
+869
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
84 | 124 | | |
85 | 125 | | |
86 | 126 | | |
| |||
215 | 255 | | |
216 | 256 | | |
217 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
218 | 267 | | |
219 | 268 | | |
220 | 269 | | |
221 | 270 | | |
222 | 271 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
| 272 | + | |
229 | 273 | | |
230 | 274 | | |
231 | 275 | | |
| |||
293 | 337 | | |
294 | 338 | | |
295 | 339 | | |
| 340 | + | |
296 | 341 | | |
297 | 342 | | |
298 | 343 | | |
| |||
0 commit comments