@adea-ai/ui 0.147.12 → 0.148.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/ui",
3
- "version": "0.147.12",
3
+ "version": "0.148.0",
4
4
  "description": "The Adea design system: Kobalte-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
5
5
  "keywords": [
6
6
  "adea",
@@ -66,6 +66,7 @@
66
66
  "types": "./dist/lint/index.d.ts",
67
67
  "default": "./dist/lint.js"
68
68
  },
69
+ "./testing/solid-transform": "./src/testing/solid-transform.ts",
69
70
  "./globals.css": "./src/styles/globals.css",
70
71
  "./theme.css": "./src/styles/theme.css",
71
72
  "./theme-variants.css": "./src/styles/theme-variants.css",
@@ -115,7 +116,7 @@
115
116
  "build": "bun run cn:build && vite build && tsc -p tsconfig.json --emitDeclarationOnly",
116
117
  "dev": "bun run cn:build && vite build --watch",
117
118
  "lint": "oxlint",
118
- "test": "bun run cn:check && bun test --conditions=browser --preload ./tests/helpers/solid-transform.ts tests",
119
+ "test": "bun run cn:check && bun test --conditions=browser --preload ./src/testing/solid-transform.ts tests",
119
120
  "typecheck": "bun check -p tsconfig.check.json",
120
121
  "cn:build": "bun scripts/build-cn-tables.ts",
121
122
  "cn:check": "bun scripts/check-cn-tables.ts",
@@ -179,6 +180,9 @@
179
180
  "vite-plugin-solid": "^2.11.14"
180
181
  },
181
182
  "peerDependencies": {
183
+ "@babel/core": "^8.0.6",
184
+ "@babel/preset-typescript": "^8.0.1",
185
+ "babel-preset-solid": "^1.9.15",
182
186
  "chart.js": "^4.5.1",
183
187
  "embla-carousel": "^8.6.0",
184
188
  "embla-carousel-solid": "^8.6.0",
@@ -186,6 +190,15 @@
186
190
  "solid-js": "^1.9.0"
187
191
  },
188
192
  "peerDependenciesMeta": {
193
+ "@babel/core": {
194
+ "optional": true
195
+ },
196
+ "@babel/preset-typescript": {
197
+ "optional": true
198
+ },
199
+ "babel-preset-solid": {
200
+ "optional": true
201
+ },
189
202
  "chart.js": {
190
203
  "optional": true
191
204
  },
@@ -0,0 +1,48 @@
1
+ import { plugin } from 'bun'
2
+ import { readFileSync } from 'node:fs'
3
+
4
+ import { transformSync } from '@babel/core'
5
+ import presetTypescript from '@babel/preset-typescript'
6
+ import presetSolid from 'babel-preset-solid'
7
+
8
+ // Bun's native test runner does not load vite-plugin-solid, so a test that imports
9
+ // a `.tsx` module gets the same DOM transform the build uses: babel-preset-solid
10
+ // compiles JSX to solid-js/web calls and preset-typescript strips types, leaving
11
+ // plain JavaScript for Bun's module loader. Without it Bun compiles the JSX as
12
+ // automatic dev JSX (`solid-js/jsx-dev-runtime`, which exports no `jsxDEV`) and
13
+ // the module fails to link.
14
+ plugin({
15
+ name: 'solid-jsx',
16
+ setup(build) {
17
+ build.onLoad({ filter: /\.tsx$/ }, ({ path }) => {
18
+ const source = readFileSync(path, 'utf8')
19
+ // Babel installs an `Error.prepareStackTrace` rewriter on its first call and
20
+ // raises `Error.stackTraceLimit`. With a custom `prepareStackTrace` set, Bun's
21
+ // `Error.captureStackTrace` throws for any object that is not an Error, which
22
+ // breaks `vite` (follow-redirects builds error types that way) in every later
23
+ // test file of the same process. Restore both once Babel is done. The transform is
24
+ // synchronous on purpose: `transformAsync` changes the globals before it returns its
25
+ // promise, so overlapping `onLoad` callbacks would save each other's changed values
26
+ // and restore them last.
27
+ const { prepareStackTrace, stackTraceLimit } = Error
28
+ try {
29
+ const result = transformSync(source, {
30
+ filename: path,
31
+ babelrc: false,
32
+ configFile: false,
33
+ sourceMaps: 'inline',
34
+ presets: [
35
+ // preset-typescript 8 dropped .isTSX/.allExtensions: JSX detection
36
+ // is filename-based, and the onLoad filter only sees .tsx paths.
37
+ presetTypescript,
38
+ [presetSolid, { generate: 'dom', hydratable: false }],
39
+ ],
40
+ })
41
+ return { contents: result?.code ?? source, loader: 'js' }
42
+ } finally {
43
+ Error.prepareStackTrace = prepareStackTrace
44
+ Error.stackTraceLimit = stackTraceLimit
45
+ }
46
+ })
47
+ },
48
+ })