From c27d60bdc31e6ae8e8f311e19c082f46afca284a Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Thu, 3 Jul 2025 22:35:45 +0900 Subject: [PATCH 1/3] Fix define issue, Support source map --- .changeset/big-plants-camp.md | 9 ++ .changeset/forty-games-return.md | 5 ++ bindings/devup-ui-wasm/src/lib.rs | 7 ++ libs/extractor/src/lib.rs | 20 +++-- package.json | 5 +- .../components/__tests__/Box.browser.test.tsx | 9 ++ packages/react/tsconfig.json | 9 +- .../src/__tests__/plugin.test.ts | 10 ++- packages/rsbuild-plugin/src/plugin.ts | 16 ++-- .../vite-plugin/src/__tests__/plugin.test.ts | 24 ++++++ packages/vite-plugin/src/plugin.ts | 22 ++--- .../src/__tests__/loader.test.ts | 7 +- packages/webpack-plugin/src/loader.ts | 6 +- pnpm-lock.yaml | 86 +++++++++++++++++++ vitest.config.ts | 4 + 15 files changed, 207 insertions(+), 32 deletions(-) create mode 100644 .changeset/big-plants-camp.md create mode 100644 .changeset/forty-games-return.md create mode 100644 packages/react/src/components/__tests__/Box.browser.test.tsx diff --git a/.changeset/big-plants-camp.md b/.changeset/big-plants-camp.md new file mode 100644 index 00000000..d28d3829 --- /dev/null +++ b/.changeset/big-plants-camp.md @@ -0,0 +1,9 @@ +--- +"@devup-ui/rsbuild-plugin": patch +"@devup-ui/webpack-plugin": patch +"@devup-ui/wasm": patch +"@devup-ui/vite-plugin": patch +"@devup-ui/react": patch +--- + +Support source map diff --git a/.changeset/forty-games-return.md b/.changeset/forty-games-return.md new file mode 100644 index 00000000..530cc9f2 --- /dev/null +++ b/.changeset/forty-games-return.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/vite-plugin": patch +--- + +Fix define issue diff --git a/bindings/devup-ui-wasm/src/lib.rs b/bindings/devup-ui-wasm/src/lib.rs index 50442fb7..16e60098 100644 --- a/bindings/devup-ui-wasm/src/lib.rs +++ b/bindings/devup-ui-wasm/src/lib.rs @@ -14,6 +14,7 @@ static GLOBAL_STYLE_SHEET: Lazy> = pub struct Output { code: String, styles: HashSet, + map: Option, } #[wasm_bindgen] extern "C" { @@ -31,6 +32,11 @@ impl Output { self.code.clone() } + #[wasm_bindgen(getter)] + pub fn map(&self) -> Option { + self.map.clone() + } + /// Get the css #[wasm_bindgen(getter)] pub fn css(&self) -> Option { @@ -141,6 +147,7 @@ pub fn code_extract( Ok(output) => Ok(Output { code: output.code, styles: output.styles, + map: output.map, }), Err(error) => Err(JsValue::from_str(error.to_string().as_str())), } diff --git a/libs/extractor/src/lib.rs b/libs/extractor/src/lib.rs index 7218f442..926a1d90 100644 --- a/libs/extractor/src/lib.rs +++ b/libs/extractor/src/lib.rs @@ -11,11 +11,12 @@ use crate::visit::DevupVisitor; use oxc_allocator::Allocator; use oxc_ast::ast::Expression; use oxc_ast_visit::VisitMut; -use oxc_codegen::Codegen; +use oxc_codegen::{Codegen, CodegenOptions}; use oxc_parser::{Parser, ParserReturn}; use oxc_span::SourceType; use std::collections::{BTreeMap, HashSet}; use std::error::Error; +use std::path::PathBuf; #[derive(Debug)] pub enum ExtractStyleProp<'a> { Static(ExtractStyleValue), @@ -80,6 +81,8 @@ pub struct ExtractOutput { // output source pub code: String, + + pub map: Option, } pub struct ExtractOption { @@ -98,6 +101,7 @@ pub fn extract( return Ok(ExtractOutput { styles: HashSet::new(), code: code.to_string(), + map: None, }); } let allocator = Allocator::default(); @@ -113,16 +117,22 @@ pub fn extract( let mut visitor = DevupVisitor::new( &allocator, &option.package, - option + &option .css_file - .unwrap_or(format!("{}/devup-ui.css", option.package)) - .as_str(), + .unwrap_or(format!("{}/devup-ui.css", option.package)), ); visitor.visit_program(&mut program); + let result = Codegen::new() + .with_options(CodegenOptions { + source_map_path: Some(PathBuf::from(filename)), + ..Default::default() + }) + .build(&program); Ok(ExtractOutput { styles: visitor.styles, - code: Codegen::new().build(&program).code, + code: result.code, + map: result.map.map(|m| m.to_json_string()), }) } diff --git a/package.json b/package.json index c226d19f..9bbde6fc 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "type": "module", "scripts": { "lint": "pnpm -F @devup-ui/* lint", + "pretest": "pnpm -F @devup-ui/vite-plugin build", "test": "cargo tarpaulin --out xml --out stdout --out html && vitest test --coverage --run && pnpm -r test", "build": "pnpm -F @devup-ui/* build", "dev": "pnpm -r dev", @@ -19,7 +20,9 @@ "@changesets/cli": "^2.29.5", "@types/node": "^24.0.7", "happy-dom": "^18.0.1", - "@testing-library/react": "^16.3.0" + "@testing-library/react": "^16.3.0", + "@testing-library/jest-dom": "^6.6.3", + "@devup-ui/vite-plugin": "workspace:*" }, "author": "devfive", "packageManager": "pnpm@10.12.4", diff --git a/packages/react/src/components/__tests__/Box.browser.test.tsx b/packages/react/src/components/__tests__/Box.browser.test.tsx new file mode 100644 index 00000000..32a87125 --- /dev/null +++ b/packages/react/src/components/__tests__/Box.browser.test.tsx @@ -0,0 +1,9 @@ +import { Box } from '@devup-ui/react' +import { render } from '@testing-library/react' + +describe('Box', () => { + it('should render', () => { + const { container } = render() + expect(container.children[0]).toHaveStyle('background-color: blue') + }) +}) diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 4c6e75be..eada434c 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -1,6 +1,11 @@ { "compilerOptions": { - "types": ["vite/client", "vitest/importMeta", "vitest/globals"], + "types": [ + "vite/client", + "vitest/importMeta", + "vitest/globals", + "@testing-library/jest-dom" + ], "strict": true, "target": "ESNext", "declaration": true, @@ -23,4 +28,4 @@ "baseUrl": ".", "jsx": "react-jsx" } -} +} \ No newline at end of file diff --git a/packages/rsbuild-plugin/src/__tests__/plugin.test.ts b/packages/rsbuild-plugin/src/__tests__/plugin.test.ts index fa080ff5..07aa51ca 100644 --- a/packages/rsbuild-plugin/src/__tests__/plugin.test.ts +++ b/packages/rsbuild-plugin/src/__tests__/plugin.test.ts @@ -129,7 +129,10 @@ describe('DevupUIRsbuildPlugin', () => { const App = () => `, resourcePath: 'src/App.tsx', }), - ).resolves.toBe('
') + ).resolves.toEqual({ + code: '
', + map: undefined, + }) }) it('should transform with include', async () => { const plugin = DevupUIRsbuildPlugin({ @@ -157,7 +160,10 @@ const App = () => `, const App = () => `, resourcePath: 'src/App.tsx', }) - expect(ret).toBe('
') + expect(ret).toEqual({ + code: '
', + map: undefined, + }) expect(writeFile).toHaveBeenCalledWith( resolve('.df', 'devup-ui.css'), expect.stringMatching(/\/\* src\/App\.tsx \d+ \*\//), diff --git a/packages/rsbuild-plugin/src/plugin.ts b/packages/rsbuild-plugin/src/plugin.ts index c3b9bf15..31e739e5 100644 --- a/packages/rsbuild-plugin/src/plugin.ts +++ b/packages/rsbuild-plugin/src/plugin.ts @@ -53,12 +53,11 @@ export const DevupUIRsbuildPlugin = ({ : resourcePath.includes('node_modules') ) return code - const { code: retCode, css } = codeExtract( - resourcePath, - code, - libPackage, - cssFile, - ) + const { + code: retCode, + css, + map, + } = codeExtract(resourcePath, code, libPackage, cssFile) if (css && globalCss.length < css.length) { globalCss = css @@ -66,7 +65,10 @@ export const DevupUIRsbuildPlugin = ({ encoding: 'utf-8', }) } - return retCode + return { + code: retCode, + map, + } }, ) }, diff --git a/packages/vite-plugin/src/__tests__/plugin.test.ts b/packages/vite-plugin/src/__tests__/plugin.test.ts index 6f89c553..0762489d 100644 --- a/packages/vite-plugin/src/__tests__/plugin.test.ts +++ b/packages/vite-plugin/src/__tests__/plugin.test.ts @@ -437,5 +437,29 @@ describe('devupUIPlugin', () => { ;(plugin as any).generateBundle({}, bundle) expect(bundle['devup-ui.css'].source).toBe('no') }) + + it('should define process.env.DEVUP_UI_DEFAULT_THEME', () => { + vi.mocked(getDefaultTheme).mockReturnValue('defaultTheme') + const plugin = DevupUI({ + package: libPackage, + cssFile, + devupPath, + interfacePath, + }) + expect((plugin as any).config().define).toEqual({ + 'process.env.DEVUP_UI_DEFAULT_THEME': '"defaultTheme"', + }) + }) + + it('should undefine process.env.DEVUP_UI_DEFAULT_THEME', () => { + vi.mocked(getDefaultTheme).mockReturnValue(undefined) + const plugin = DevupUI({ + package: libPackage, + cssFile, + devupPath, + interfacePath, + }) + expect((plugin as any).config().define).toStrictEqual({}) + }) }) }) diff --git a/packages/vite-plugin/src/plugin.ts b/packages/vite-plugin/src/plugin.ts index 7c26e7fd..53a37f3c 100644 --- a/packages/vite-plugin/src/plugin.ts +++ b/packages/vite-plugin/src/plugin.ts @@ -70,6 +70,11 @@ export function DevupUI({ } catch (error) { console.error(error) } + const theme = getDefaultTheme() + const define: Record = {} + if (theme) { + define['process.env.DEVUP_UI_DEFAULT_THEME'] = JSON.stringify(theme) + } return { name: 'devup-ui', config() { @@ -79,10 +84,7 @@ export function DevupUI({ ignored: [`!${devupPath}`], }, }, - define: { - 'process.env.DEVUP_UI_DEFAULT_THEME': - JSON.stringify(getDefaultTheme()), - }, + define, optimizeDeps: { exclude: include, }, @@ -149,12 +151,11 @@ export function DevupUI({ } if (!/\.(tsx|ts|js|mjs|jsx)$/i.test(fileName)) return - const { code: retCode, css } = codeExtract( - fileName, - code, - libPackage, - cssFile, - ) + const { + code: retCode, + css, + map, + } = codeExtract(fileName, code, libPackage, cssFile) if (css && globalCss.length < css.length) { globalCss = css @@ -164,6 +165,7 @@ export function DevupUI({ } return { code: retCode, + map, } }, async generateBundle(_options, bundle) { diff --git a/packages/webpack-plugin/src/__tests__/loader.test.ts b/packages/webpack-plugin/src/__tests__/loader.test.ts index 04748ae1..cee49dad 100644 --- a/packages/webpack-plugin/src/__tests__/loader.test.ts +++ b/packages/webpack-plugin/src/__tests__/loader.test.ts @@ -37,6 +37,7 @@ describe('devupUILoader', () => { code: 'code', css: 'css', free: vi.fn(), + map: undefined, }) devupUILoader.bind(t as any)(Buffer.from('code'), 'index.tsx') @@ -48,7 +49,7 @@ describe('devupUILoader', () => { 'cssFile', ) await vi.waitFor(() => { - expect(t.async()).toHaveBeenCalledWith(null, 'code') + expect(t.async()).toHaveBeenCalledWith(null, 'code', undefined) }) expect(writeFile).toHaveBeenCalledWith('cssFile', '/* index.tsx 0 */') expect(writeFile).toHaveBeenCalledWith('sheetFile', 'sheet') @@ -72,6 +73,7 @@ describe('devupUILoader', () => { code: 'code', css: undefined, free: vi.fn(), + map: undefined, }) devupUILoader.bind(t as any)(Buffer.from('code'), 'index.tsx') @@ -82,7 +84,7 @@ describe('devupUILoader', () => { 'package', 'cssFile', ) - expect(t.async()).toHaveBeenCalledWith(null, 'code') + expect(t.async()).toHaveBeenCalledWith(null, 'code', undefined) expect(writeFile).not.toHaveBeenCalledWith('cssFile', 'css', { encoding: 'utf-8', }) @@ -123,6 +125,7 @@ describe('devupUILoader', () => { code: 'code', css: 'css', free: vi.fn(), + map: undefined, }) devupUILoader.bind(t as any)(Buffer.from('code'), 'index.tsx') diff --git a/packages/webpack-plugin/src/loader.ts b/packages/webpack-plugin/src/loader.ts index 3761c9ac..19d37cc6 100644 --- a/packages/webpack-plugin/src/loader.ts +++ b/packages/webpack-plugin/src/loader.ts @@ -25,7 +25,7 @@ const devupUILoader: RawLoaderDefinitionFunction = const id = this.resourcePath try { - const { code, css } = codeExtract( + const { code, css, map } = codeExtract( id, source.toString(), libPackage, @@ -41,10 +41,10 @@ const devupUILoader: RawLoaderDefinitionFunction = writeFile(classMapFile, exportClassMap()), ]) .catch(console.error) - .finally(() => callback(null, code)) + .finally(() => callback(null, code, map)) return } - callback(null, code) + callback(null, code, map) } catch (error) { callback(error as Error) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6be91a41..70b61191 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,18 @@ importers: '@changesets/cli': specifier: ^2.29.5 version: 2.29.5 + '@devup-ui/vite-plugin': + specifier: workspace:* + version: link:packages/vite-plugin + '@testing-library/jest-dom': + specifier: ^6.6.3 + version: 6.6.3 '@testing-library/react': specifier: ^16.3.0 version: 16.3.0(@testing-library/dom@10.4.0)(@types/react-dom@19.1.6(@types/react@19.1.8))(@types/react@19.1.8)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + '@testing-library/user-event': + specifier: ^14.6.1 + version: 14.6.1(@testing-library/dom@10.4.0) '@types/node': specifier: ^24.0.7 version: 24.0.7 @@ -434,6 +443,9 @@ importers: packages: + '@adobe/css-tools@4.4.3': + resolution: {integrity: sha512-VQKMkwriZbaOgVCby1UDY/LDk5fIjhQicCvVPFqfe+69fWaPWydbWJ3wRt59/YzIwda1I81loas3oCoHxnqvdA==} + '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} @@ -2051,6 +2063,10 @@ packages: resolution: {integrity: sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==} engines: {node: '>=18'} + '@testing-library/jest-dom@6.6.3': + resolution: {integrity: sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==} + engines: {node: '>=14', npm: '>=6', yarn: '>=1'} + '@testing-library/react@16.3.0': resolution: {integrity: sha512-kFSyxiEDwv1WLl2fgsq6pPBbw5aWKrsY2/noi1Id0TK0UParSF62oFQFGHXIyaG4pp2tEub/Zlel+fjjZILDsw==} engines: {node: '>=18'} @@ -2066,6 +2082,12 @@ packages: '@types/react-dom': optional: true + '@testing-library/user-event@14.6.1': + resolution: {integrity: sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==} + engines: {node: '>=12', npm: '>=6'} + peerDependencies: + '@testing-library/dom': '>=7.21.4' + '@ts-morph/common@0.20.0': resolution: {integrity: sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q==} @@ -2803,6 +2825,10 @@ packages: resolution: {integrity: sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==} engines: {node: '>=12'} + chalk@3.0.0: + resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==} + engines: {node: '>=8'} + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -2910,6 +2936,9 @@ packages: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} + css.escape@1.5.1: + resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} + csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} @@ -2981,6 +3010,9 @@ packages: dom-accessibility-api@0.5.16: resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} + dom-accessibility-api@0.6.3: + resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==} + dunder-proto@1.0.1: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} @@ -3493,6 +3525,10 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} + indent-string@4.0.0: + resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} + engines: {node: '>=8'} + inline-style-parser@0.2.4: resolution: {integrity: sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==} @@ -3968,6 +4004,10 @@ packages: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} + min-indent@1.0.1: + resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} + engines: {node: '>=4'} + minimatch@10.0.3: resolution: {integrity: sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==} engines: {node: 20 || >=22} @@ -4328,6 +4368,10 @@ packages: recma-stringify@1.0.0: resolution: {integrity: sha512-cjwII1MdIIVloKvC9ErQ+OgAtwHBmcZ0Bg4ciz78FtbT8In39aAYbaA7zvxQ61xVMSPE8WxhLwLbhif4Js2C+g==} + redent@3.0.0: + resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} + engines: {node: '>=8'} + reflect.getprototypeof@1.0.10: resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==} engines: {node: '>= 0.4'} @@ -4609,6 +4653,10 @@ packages: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} + strip-indent@3.0.0: + resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} + engines: {node: '>=8'} + strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -5023,6 +5071,8 @@ packages: snapshots: + '@adobe/css-tools@4.4.3': {} + '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.8 @@ -6923,6 +6973,16 @@ snapshots: lz-string: 1.5.0 pretty-format: 27.5.1 + '@testing-library/jest-dom@6.6.3': + dependencies: + '@adobe/css-tools': 4.4.3 + aria-query: 5.3.0 + chalk: 3.0.0 + css.escape: 1.5.1 + dom-accessibility-api: 0.6.3 + lodash: 4.17.21 + redent: 3.0.0 + '@testing-library/react@16.3.0(@testing-library/dom@10.4.0)(@types/react-dom@19.1.6(@types/react@19.1.8))(@types/react@19.1.8)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': dependencies: '@babel/runtime': 7.27.6 @@ -6933,6 +6993,10 @@ snapshots: '@types/react': 19.1.8 '@types/react-dom': 19.1.6(@types/react@19.1.8) + '@testing-library/user-event@14.6.1(@testing-library/dom@10.4.0)': + dependencies: + '@testing-library/dom': 10.4.0 + '@ts-morph/common@0.20.0': dependencies: fast-glob: 3.3.3 @@ -8119,6 +8183,11 @@ snapshots: loupe: 3.1.4 pathval: 2.0.0 + chalk@3.0.0: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -8210,6 +8279,8 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 + css.escape@1.5.1: {} + csstype@3.1.3: {} data-view-buffer@1.0.2: @@ -8277,6 +8348,8 @@ snapshots: dom-accessibility-api@0.5.16: {} + dom-accessibility-api@0.6.3: {} + dunder-proto@1.0.1: dependencies: call-bind-apply-helpers: 1.0.2 @@ -8996,6 +9069,8 @@ snapshots: imurmurhash@0.1.4: {} + indent-string@4.0.0: {} + inline-style-parser@0.2.4: {} internal-slot@1.1.0: @@ -9654,6 +9729,8 @@ snapshots: dependencies: mime-db: 1.52.0 + min-indent@1.0.1: {} + minimatch@10.0.3: dependencies: '@isaacs/brace-expansion': 5.0.0 @@ -10030,6 +10107,11 @@ snapshots: unified: 11.0.5 vfile: 6.0.3 + redent@3.0.0: + dependencies: + indent-string: 4.0.0 + strip-indent: 3.0.0 + reflect.getprototypeof@1.0.10: dependencies: call-bind: 1.0.8 @@ -10434,6 +10516,10 @@ snapshots: strip-bom@3.0.0: {} + strip-indent@3.0.0: + dependencies: + min-indent: 1.0.1 + strip-json-comments@3.1.1: {} strip-literal@3.0.0: diff --git a/vitest.config.ts b/vitest.config.ts index 8b4dc307..144f82d5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,3 +1,4 @@ +import { DevupUI } from '@devup-ui/vite-plugin' import { defineConfig } from 'vitest/config' export default defineConfig({ @@ -22,7 +23,10 @@ export default defineConfig({ name: 'happy-dom', environment: 'happy-dom', globals: true, + css: true, + setupFiles: ['@testing-library/jest-dom/vitest'], }, + plugins: [DevupUI()], }, ], }, From e0cd858b0982fb4db92e6150f87a8b874c62ff67 Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Thu, 3 Jul 2025 22:38:16 +0900 Subject: [PATCH 2/3] Fix lock file --- pnpm-lock.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70b61191..1cab1255 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,9 +23,6 @@ importers: '@testing-library/react': specifier: ^16.3.0 version: 16.3.0(@testing-library/dom@10.4.0)(@types/react-dom@19.1.6(@types/react@19.1.8))(@types/react@19.1.8)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) - '@testing-library/user-event': - specifier: ^14.6.1 - version: 14.6.1(@testing-library/dom@10.4.0) '@types/node': specifier: ^24.0.7 version: 24.0.7 @@ -2082,12 +2079,6 @@ packages: '@types/react-dom': optional: true - '@testing-library/user-event@14.6.1': - resolution: {integrity: sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==} - engines: {node: '>=12', npm: '>=6'} - peerDependencies: - '@testing-library/dom': '>=7.21.4' - '@ts-morph/common@0.20.0': resolution: {integrity: sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q==} @@ -6993,10 +6984,6 @@ snapshots: '@types/react': 19.1.8 '@types/react-dom': 19.1.6(@types/react@19.1.8) - '@testing-library/user-event@14.6.1(@testing-library/dom@10.4.0)': - dependencies: - '@testing-library/dom': 10.4.0 - '@ts-morph/common@0.20.0': dependencies: fast-glob: 3.3.3 From c970619a1fdd684be2e9d5d7ab4396e4573beb37 Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Thu, 3 Jul 2025 23:10:57 +0900 Subject: [PATCH 3/3] Add nocheck --- packages/react/src/components/__tests__/Box.browser.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react/src/components/__tests__/Box.browser.test.tsx b/packages/react/src/components/__tests__/Box.browser.test.tsx index 32a87125..d7762f52 100644 --- a/packages/react/src/components/__tests__/Box.browser.test.tsx +++ b/packages/react/src/components/__tests__/Box.browser.test.tsx @@ -1,3 +1,4 @@ +// @ts-nocheck import { Box } from '@devup-ui/react' import { render } from '@testing-library/react'