tailwind-styled-v4 5.0.11 → 5.0.13

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 (110) hide show
  1. package/README.md +100 -4
  2. package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
  3. package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
  4. package/dist/analyzer.d.mts +4 -4
  5. package/dist/analyzer.d.ts +4 -4
  6. package/dist/analyzer.js +34 -69
  7. package/dist/analyzer.js.map +1 -1
  8. package/dist/analyzer.mjs +33 -68
  9. package/dist/analyzer.mjs.map +1 -1
  10. package/dist/animate.d.mts +4 -0
  11. package/dist/animate.d.ts +4 -0
  12. package/dist/animate.js +33 -11
  13. package/dist/animate.js.map +1 -1
  14. package/dist/animate.mjs +33 -11
  15. package/dist/animate.mjs.map +1 -1
  16. package/dist/atomic.js +57 -6
  17. package/dist/atomic.js.map +1 -1
  18. package/dist/atomic.mjs +57 -6
  19. package/dist/atomic.mjs.map +1 -1
  20. package/dist/cli.js +404 -190
  21. package/dist/cli.js.map +1 -1
  22. package/dist/cli.mjs +401 -187
  23. package/dist/cli.mjs.map +1 -1
  24. package/dist/compiler.d.mts +2700 -212
  25. package/dist/compiler.d.ts +2700 -212
  26. package/dist/compiler.js +1996 -503
  27. package/dist/compiler.js.map +1 -1
  28. package/dist/compiler.mjs +1847 -448
  29. package/dist/compiler.mjs.map +1 -1
  30. package/dist/devtools.js +17 -4
  31. package/dist/devtools.js.map +1 -1
  32. package/dist/devtools.mjs +17 -4
  33. package/dist/devtools.mjs.map +1 -1
  34. package/dist/engine.d.mts +11 -470
  35. package/dist/engine.d.ts +11 -470
  36. package/dist/engine.js +2777 -455
  37. package/dist/engine.js.map +1 -1
  38. package/dist/engine.mjs +2776 -454
  39. package/dist/engine.mjs.map +1 -1
  40. package/dist/index-BDQw13kn.d.ts +464 -0
  41. package/dist/index-DJv28Uzq.d.mts +464 -0
  42. package/dist/index.browser.mjs +143 -255
  43. package/dist/index.browser.mjs.map +1 -1
  44. package/dist/index.d.mts +23 -39
  45. package/dist/index.d.ts +23 -39
  46. package/dist/index.js +7234 -1400
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.mjs +7234 -1400
  49. package/dist/index.mjs.map +1 -1
  50. package/dist/next.d.mts +44 -1
  51. package/dist/next.d.ts +44 -1
  52. package/dist/next.js +3224 -1065
  53. package/dist/next.js.map +1 -1
  54. package/dist/next.mjs +3223 -1066
  55. package/dist/next.mjs.map +1 -1
  56. package/dist/rspack.d.mts +9 -0
  57. package/dist/rspack.d.ts +9 -0
  58. package/dist/rspack.js +99 -61
  59. package/dist/rspack.js.map +1 -1
  60. package/dist/rspack.mjs +99 -61
  61. package/dist/rspack.mjs.map +1 -1
  62. package/dist/runtime-css.d.mts +8 -0
  63. package/dist/runtime-css.d.ts +8 -0
  64. package/dist/runtime-css.js +23 -7
  65. package/dist/runtime-css.js.map +1 -1
  66. package/dist/runtime-css.mjs +23 -7
  67. package/dist/runtime-css.mjs.map +1 -1
  68. package/dist/scanner.js +16 -37
  69. package/dist/scanner.js.map +1 -1
  70. package/dist/scanner.mjs +15 -36
  71. package/dist/scanner.mjs.map +1 -1
  72. package/dist/shared.d.mts +107 -1
  73. package/dist/shared.d.ts +107 -1
  74. package/dist/shared.js +3014 -466
  75. package/dist/shared.js.map +1 -1
  76. package/dist/shared.mjs +3008 -445
  77. package/dist/shared.mjs.map +1 -1
  78. package/dist/svelte.js +39 -35
  79. package/dist/svelte.js.map +1 -1
  80. package/dist/svelte.mjs +38 -34
  81. package/dist/svelte.mjs.map +1 -1
  82. package/dist/theme.js +85 -76
  83. package/dist/theme.js.map +1 -1
  84. package/dist/theme.mjs +83 -74
  85. package/dist/theme.mjs.map +1 -1
  86. package/dist/turbopackLoader.js +2351 -187
  87. package/dist/turbopackLoader.js.map +1 -1
  88. package/dist/turbopackLoader.mjs +2351 -187
  89. package/dist/turbopackLoader.mjs.map +1 -1
  90. package/dist/tw.js +404 -190
  91. package/dist/tw.js.map +1 -1
  92. package/dist/tw.mjs +401 -187
  93. package/dist/tw.mjs.map +1 -1
  94. package/dist/vite.js +2657 -320
  95. package/dist/vite.js.map +1 -1
  96. package/dist/vite.mjs +2657 -320
  97. package/dist/vite.mjs.map +1 -1
  98. package/dist/vue.js +39 -35
  99. package/dist/vue.js.map +1 -1
  100. package/dist/vue.mjs +38 -34
  101. package/dist/vue.mjs.map +1 -1
  102. package/dist/webpackLoader.js +190 -33
  103. package/dist/webpackLoader.js.map +1 -1
  104. package/dist/webpackLoader.mjs +190 -33
  105. package/dist/webpackLoader.mjs.map +1 -1
  106. package/native/index.node +0 -0
  107. package/native/tailwind-styled-native.node +0 -0
  108. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  109. package/package.json +9 -4
  110. package/CHANGELOG.md +0 -285
package/CHANGELOG.md DELETED
@@ -1,285 +0,0 @@
1
- # Changelog
2
-
3
- Semua perubahan signifikan pada project ini didokumentasikan di file ini.
4
-
5
- ---
6
-
7
- ## [5.0.6-canary] — 2026-04-29
8
-
9
- > Rilis canary terkini. Versi ini mencerminkan state aktual dari source code.
10
-
11
- ### ⚠️ Breaking Changes
12
-
13
- ### CI/CD Consolidation
14
- - **Removed legacy workflows**: `build-matrix.yml`, `compat-matrix.yml`, `example-next-app.yml`, `plugin-registry-benchmark.yml`, `plugin-registry-test.yml`, `publish-benchmark.yml`, `quality.yml`, `release-candidate-gate.yml`, `rust-parser-regression.yml`, `scale-benchmark.yml`, `test-coverage.yml`
15
- - **New unified CI**: All CI/CD functionality consolidated into `ci.yml`
16
- - **New release workflow**: `release-candidate.yml` replaces `release-candidate-gate.yml`
17
- - **Updated workflows**: `benchmark.yml`, `dependencies.yml`, `publish-alpha.yml`, `publish.yml`
18
-
19
- ### Build Configuration
20
- - `native/Cargo.lock` is now tracked for reproducible native builds
21
- - `package-lock.json` added to root for consistent npm dependency management
22
- - Removed temporary clippy output files (`native/clippy-final.txt`, `native/clippy-warnings.txt`)
23
- - `examples/next-js-app/package-lock.json` now tracked
24
-
25
- ### 📦 Packages (26 total)
26
-
27
- | Domain | Package |
28
- |---|---|
29
- | Core | `@tailwind-styled/core`, `@tailwind-styled/runtime`, `@tailwind-styled/shared` |
30
- | Compiler | `@tailwind-styled/compiler`, `@tailwind-styled/syntax`, `@tailwind-styled/atomic` |
31
- | Build | `@tailwind-styled/engine`, `@tailwind-styled/scanner`, `@tailwind-styled/analyzer` |
32
- | Adapters | `@tailwind-styled/next`, `@tailwind-styled/vite`, `@tailwind-styled/rspack` |
33
- | Styling | `@tailwind-styled/animate`, `@tailwind-styled/theme`, `@tailwind-styled/preset`, `@tailwind-styled/runtime-css` |
34
- | Plugins | `@tailwind-styled/plugin`, `@tailwind-styled/plugin-api`, `@tailwind-styled/plugin-registry` |
35
- | Infra | `@tailwind-styled/dashboard`, `@tailwind-styled/devtools`, `@tailwind-styled/studio-desktop` |
36
- | Framework | `@tailwind-styled/vue`, `@tailwind-styled/svelte` |
37
- | DX | `@tailwind-styled/testing`, `@tailwind-styled/storybook-addon` |
38
-
39
- ### 🦀 Rust Native Engine
40
-
41
- - **92 NAPI functions** tersedia via `napi-rs` — scan, cache, parse, normalize, diff, analyze, minify, lint
42
- - **137 Rust `pub fn`** di `native/src/` — termasuk internal helpers
43
- - **LightningCSS** sebagai post-processor: minify, vendor prefix, dead-code strip
44
- - Pipeline: `Tailwind JS compile()` → `Rust processTailwindCssLightning()` → final CSS
45
- - Persistent DashMap cache — cold start scan `<10ms`, incremental `~0ms`
46
- - `callOptional` pattern — native-first, JS fallback jika binary tidak tersedia
47
-
48
- ### 🧪 Testing
49
-
50
- - **52 test files**, **675+ test cases** total
51
- - Coverage: core, compiler, engine, scanner, analyzer, adapter Next/Vite/Rspack, Vue, Svelte, testing utils, storybook-addon, theme, animate, plugin-registry, CLI, devtools, dashboard
52
- - `packages/domain/testing/` — custom matchers: `expectClasses()`, `expectEngineMetrics()`, `toHaveEngineMetrics()`, `expandVariantMatrix()`
53
- - Test pipeline: Vitest + `.mjs` integration tests
54
-
55
- ### ✅ Resolved (vs styled-components)
56
-
57
- | Kekurangan styled-components | Status |
58
- |---|---|
59
- | Runtime overhead ~15KB | ✅ ~4.5KB runtime, CSS di-extract build time |
60
- | SSR complexity (`ServerStyleSheet`) | ✅ Tidak diperlukan — RSC entries dikecualikan dari loader otomatis |
61
- | Class name tidak deterministik | ✅ Pakai Tailwind class asli langsung, zero hash |
62
- | RSC tidak support | ✅ `tw.server.*` namespace + auto RSC boundary detection di loader |
63
- | TypeScript verbose (`$prop`) | ✅ Variants API di config object, generics otomatis |
64
- | Tidak tree-shakeable | ✅ DSE (Dead Style Eliminator) terintegrasi di pipeline |
65
-
66
- ### ⚠️ Catatan
67
-
68
- - `stateEngine.ts` menggunakan runtime `<style>` injection di dev mode / fallback — tidak aktif di production build
69
- - `TW_MAP` di `stateEngine.ts` hanya dipakai saat compiler tidak tersedia (`TWS_NO_NATIVE=1`) — tidak relevan di production
70
- - E2E tests belum ada — 52 test files semuanya unit/integration level
71
- - HMR belum ada di adapter Next.js (sudah ada di Vite)
72
-
73
- ---
74
-
75
- ## [4.5.0-alpha.1] — 2026-04-18
76
-
77
- ### 🚀 Performance (Rust Native)
78
-
79
- - **10x** variant resolution via `resolve_variants` di Rust
80
- - **23x** class deduplication via `normalizeAndDedupClasses` di Rust
81
- - **30x** class parsing via `parseClasses` di Rust
82
-
83
- ### 🛡️ Reliability
84
-
85
- - Health check monitoring untuk native bridge
86
- - Auto-fallback dengan exponential backoff
87
- - Telemetry: Prometheus / JSON / Console exporters
88
- - Error message jelas jika native binary tidak ditemukan
89
-
90
- ### 🧪 Testing & Quality
91
-
92
- - Integration tests untuk semua core functions
93
- - Unit tests untuk health check & telemetry
94
- - Benchmark suite untuk performance regression
95
-
96
- ### ⚠️ Breaking
97
-
98
- - JS fallbacks dihapus — native binary sekarang required
99
- - Jalankan `npx tw setup` setelah install
100
-
101
- ### 📊 Benchmark
102
-
103
- | Operasi | v4.4 (JS) | v4.5 (Rust) | Peningkatan |
104
- |---|---|---|---|
105
- | Variant resolution | 0.52ms | 0.048ms | **10.8×** |
106
- | Class deduplication | 2.1ms | 0.09ms | **23.3×** |
107
- | Class parsing | 3.0ms | 0.10ms | **30×** |
108
-
109
- ---
110
-
111
- ## [4.5.0] — Sprint 6–10 Platform Overhaul — 2026-03-21
112
-
113
- ### Sprint 6 — Error Handling & Logging
114
-
115
- - `cache_read` dan `scan_workspace` sekarang return `napi::Result` — error dipropagasi ke JS dengan pesan deskriptif
116
- - Scanner logging terpusat via `createLogger("scanner")` dari `@tailwind-styled/shared`
117
- - Cache HIT/MISS/write-fail dikontrol via `TWS_LOG_LEVEL`
118
- - Plugin `onError` hook dipanggil sebelum error propagasi — plugin tidak bisa crash engine
119
- - `watch()` emit `{ type: "error" }` saat watcher atau transform gagal
120
- - `TWS_LOG_LEVEL=debug|info|warn|error|silent` + `TWS_DEBUG_SCANNER=1`
121
-
122
- ### Sprint 7 — Platform Adapters
123
-
124
- - Next.js, Vite, Rspack: compiler di-bundle inline — tidak perlu install `@tailwind-styled/compiler` terpisah
125
- - `preserveImports: true` di semua loaders — `cv`, `cx`, `cn` dijamin tidak distrip
126
- - Rspack `tsup.config.ts` dibuat dari scratch
127
- - RSC Auto-inject: `detectRSCBoundary()` dan `autoInjectClientBoundary()` sebagai public API
128
- - `webpackLoader.ts` dan `turbopackLoader.ts` auto-inject `"use client"` berdasarkan `analyzeFile()`
129
-
130
- ### Sprint 8 — Developer Tooling
131
-
132
- - CLI: `tw analyze --json` dan `tw stats --json` output clean parseable (suppress `console.log`)
133
- - DevTools: hapus "Run Rust Workspace Scan" — ganti panel **Engine Metrics** dari `localhost:3000/metrics`
134
- - VSCode: `startLspServer` cek `dist/lsp.mjs` bundled dulu, `postbuild.cjs` otomatis copy
135
- - Tambah keybindings (`Ctrl+Shift+T/N/S`), `configuration` settings, `menus` context
136
-
137
- ### Sprint 9 — Studio Desktop (Electron)
138
-
139
- - Engine IPC handlers: `engine-scan`, `engine-build`, `engine-watch-start`, `engine-watch-stop`, `engine-reset`
140
- - `createEngine` lazy-load per project, reset otomatis saat `change-project`
141
- - Engine events di-forward ke renderer via `mainWindow.webContents.send("engine-event")`
142
- - `contextBridge` ekspos: `engineScan`, `engineBuild`, `engineWatchStart`, `engineWatchStop`, `onEngineEvent`
143
- - Studio Desktop: `loading-error.html` fallback dengan auto-retry
144
- - Auto-updater via `electron-updater` — check 10 detik setelah startup, manual via Tools menu
145
- - Tray icon: toggle window, double-click focus, context menu (Open, Browser, Quit)
146
-
147
- ### Sprint 10 — Testing & Documentation
148
-
149
- - `EngineMetricsSnapshot` interface + `expectEngineMetrics()` + `toHaveEngineMetrics()` + `tailwindMatchersWithMetrics`
150
- - `sprint9-platform.test.mjs` — 23 tests: adapter configs, preserveImports, studio IPC
151
- - `sprint10-integration.test.mjs` — 28 tests: error handling, logging, DevTools safety, VSCode LSP, metrics
152
- - **84/86 tests pass** — 2 failing pre-existing (unrelated `twMerge/cn`)
153
-
154
- ---
155
-
156
- ## [4.3.0–4.5.0] — 2026-03-16
157
-
158
- ### Fitur Baru
159
-
160
- - **`tw ai`** — Anthropic API untuk component generation, multi-provider (`anthropic|openai|ollama`), fallback ke static templates
161
- - **`tw studio`** — Web-based component studio: scan project, search, AI generator endpoint
162
- - **`tw cluster`** — `worker_threads` pool: distribusi scan ke CPU cores
163
- - **`tw registry`** — Local/team HTTP registry, npm-compatible packument protocol, tarball publish/install
164
- - **`tw sync`** — W3C DTCG design token sync: pull/push HTTP/HTTPS, S3 protocol, Figma multi-mode
165
- - **`tw preflight`** — 8 checks: Node version, bundler, Tailwind config, deprecated patterns, TypeScript, auto-fix
166
- - **`tw audit`** — Deprecated class scanner, a11y checks, npm audit security, `--scope` dan `--json`
167
- - **`@tailwind-styled/shared`** — Package baru: `LRUCache` (TTL), `createLogger`, `hashContent/File`, `debounce/throttle`, `parseVersion`
168
-
169
- ### tw parse — Multi-format
170
-
171
- - `.vue/.svelte/.mdx/.html` — regex-direct strategy, skip Babel (lebih cepat)
172
- - `.js/.jsx/.ts/.tsx` — Oxc-first → Babel → regex
173
- - Native Rust Tier 0: coba `native/index.mjs` (.node binding) sebelum Oxc
174
- - Parse chain: **native → oxc → babel → regex**
175
-
176
- ### Next.js Route CSS
177
-
178
- - `routeCssMiddleware.ts` — `getRouteCssLinks()`, `injectRouteCssIntoHtml()`
179
- - `withTailwindStyled` write `css-manifest.json` ke `.next/static/css/tw/`
180
- - Dynamic route CSS: `[id]`, `[...slug]` dengan cache per params kombinasi
181
-
182
- ### Tests
183
-
184
- - `v43-v45.test.mjs` — 28 tests: shared package, audit, AI provider, preflight
185
- - `sprint7.test.mjs` — 30 tests, semua pass
186
-
187
- ---
188
-
189
- ## [4.2.0] — Sprint 1 & 2 — 2026-03-15
190
-
191
- ### Packages Baru
192
-
193
- - **`@tailwind-styled/vue`** — Vue 3: `tw()`, `cv()`, `extend()`, `TailwindStyledPlugin`
194
- - **`@tailwind-styled/svelte`** — Svelte 4/5: `cv()`, `tw()`, `use:styled`, `createVariants()` (Svelte 5 runes)
195
- - **`@tailwind-styled/testing`** — `expectClasses()`, `expandVariantMatrix()`, `testAllVariants()`, Jest/Vitest matchers
196
- - **`@tailwind-styled/storybook-addon`** — `generateArgTypes()`, `withTailwindStyled()` decorator
197
- - **`@tailwind-styled/dashboard`** — Live metrics server, file-watch IPC, HTML UI dengan build history chart
198
- - **`@tailwind-styled/plugin-registry`** — `tw-plugin search/install/list` CLI, 4 official + 2 community plugins
199
-
200
- ### Fitur Compiler
201
-
202
- - `tw parse <file>` — 3-tier AST: `oxc-parser` → `@babel/parser` → regex. Extract dari JSX, template literal, `twMerge()`, `cn()`, `clsx()`
203
- - `tw shake <css>` — Real tree shaking berbasis CSS selector analysis, support `@layer`, `@media`
204
- - `tw optimize <file>` — Constant folding, class deduplication, `twMerge` literal pre-computation
205
- - LSP server (`tw lsp`) — hover, completion (Tailwind autocomplete), diagnostics via `vscode-languageserver`
206
- - `tw cluster build` — `worker_threads` pool, throughput report (files/sec)
207
-
208
- ### Tests
209
-
210
- - 6 test suites baru, 78 unit tests + 9 integration tests
211
- - `scripts/benchmark/sprint2-bench.mjs` — parse/shake/cluster metrics ke `docs/benchmark/sprint2-results.json`
212
-
213
- ---
214
-
215
- ## [4.5.0] — Implementation Session — 2026-04
216
-
217
- ### Bug Fixes
218
-
219
- - VSCode Extension: `extension.ts` pakai `completionProvider.ts` dan `hoverProvider.ts` yang benar (sebelumnya inline hardcoded)
220
- - CLI scan: flag `--save` menulis `.tailwind-styled/scan-cache.json` format lengkap untuk VSCode EngineService
221
- - `TWS_DISABLE_NATIVE` env var dikenali di `nativeBridge.ts` dan `nativeBinding.ts`
222
- - `TwError` upgrade: `fromZod()`, `source`, `originalCause`, `toJSON()`, `toCliMessage()`
223
- - `ReverseLookup`: `clearCache()`, `pruneCache()`, `MAX_CACHE_BYTES` untuk mencegah memory leak
224
- - `cssToIr`: `createIdGenerator()` factory — eliminasi race condition
225
- - DSE: `runDeadStyleElimination()` sekarang memanggil `eliminateDeadCss` + `optimizeCss`
226
- - `CvFn/TwComponentFactory`: eliminasi `any`, proper generics dengan `InferVariantProps<C>`
227
- - `extend()`: overload baru support `extend({ classes, variants })` dalam satu call
228
- - `astTransform`: `mode` option dihapus dari destructuring
229
-
230
- ### Added
231
-
232
- - Zod schemas untuk semua native binding responses (`native-schemas.ts`)
233
- - Engine facade: `scanWorkspace()`, `analyzeWorkspace()`, `generateSafelist()`, `build()`
234
- - `CONTRIBUTING.md`: section "Berkontribusi tanpa Rust"
235
- - `docs/api/engine.md`, `analyzer.md`, `cli.md`
236
- - `.github/workflows/plugin-registry-test.yml` matrix CI
237
- - `tsconfig.build.json` + `tsconfig.dev.json` — separation of concerns
238
-
239
- ### Tests Ditambah
240
-
241
- - **39 test files baru**, **318 test cases** baru
242
- - Coverage: semua domain packages, semua adapters, Vue, Svelte, CLI, infrastructure
243
-
244
- ---
245
-
246
- ## [2.0.0] — Major Upgrade (Compiler-Driven)
247
-
248
- ### Breaking Changes
249
-
250
- - Hapus dependency `styled-components`
251
- - Hapus `styledFactory`, `shouldForwardProp`, `blockProp`, `allowProp`
252
- - Hapus `propEngine`, `responsiveEngine` — dipindahkan ke compiler
253
- - Hapus `ThemeContext`
254
-
255
- ### Features
256
-
257
- - **Zero-runtime output** — `tw.div\`...\`` dikompilasi ke pure `React.forwardRef`
258
- - **Compiler-driven variants** — dikompilasi ke static lookup table
259
- - **RSC-aware** — auto detect server vs client components
260
- - **`withTailwindStyled()`** — Next.js plugin dengan Turbopack + Webpack support
261
- - **`tailwindStyledPlugin()`** — Vite 5+ support
262
-
263
- ---
264
-
265
- ## Roadmap
266
-
267
- ### v5 (target: ~8 minggu)
268
-
269
- Berdasarkan `compiler-v5-upgrade-plan.md`:
270
-
271
- - [ ] Hapus semua JS fallback — Rust native only wajib
272
- - [ ] Pangkas 120+ exports compiler → ~20 public API
273
- - [ ] Hapus `mode` option — zero-runtime only
274
- - [ ] Hapus Tailwind v3 support — v4 only
275
- - [ ] Integrasikan DSE ke pipeline utama (sekarang masih standalone)
276
- - [ ] Pisahkan atomic CSS ke `@tailwind-styled/atomic` (sudah ada packagenya)
277
- - [ ] E2E + integration tests
278
-
279
- ### v6 (setelah v5 stabil)
280
-
281
- - [ ] Docs website
282
- - [ ] HMR di adapter Next.js (sudah ada di Vite)
283
- - [ ] macOS & Windows binary publish ke npm (CI matrix sudah ready)
284
- - [ ] Plugin starter/codegen
285
- - [ ] devtools traces lintas tooling