Skip to content

Commit

Permalink
fix: type bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eryue0220 committed May 10, 2024
1 parent 24dd703 commit 80a68a0
Show file tree
Hide file tree
Showing 11 changed files with 945 additions and 160 deletions.
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
.pnp
.pnp.js
.idea
.eslintignore
.eslintrc.json
.eslintcache
.github

typos.toml
vitest.config.ts

/examples
/node_modules
/src
/test
/coverage
23 changes: 23 additions & 0 deletions examples/rsbuild-example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "rsbuild-example",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "rsbuild dev",
"build": "rsbuild build"
},
"dependencies": {
"@stylexjs/open-props": "^0.6.0",
"@stylexjs/stylex": "^0.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@rsbuild/core": "^0.6.13",
"@rsbuild/plugin-react": "^0.6.13",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"html-webpack-plugin": "^5.6.0",
"unplugin-stylex": "workspace:*"
}
}
23 changes: 23 additions & 0 deletions examples/rsbuild-example/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>StyleX with Rsbuild</title>
<style>
body {
box-sizing: border-box;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="stylex.css">
</head>

<body>
<div id="root"></div>
</body>

</html>
26 changes: 26 additions & 0 deletions examples/rsbuild-example/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
import stylexPlugin from 'unplugin-stylex/rspack';

export default defineConfig({
plugins: [
pluginReact(),
],
html: {
template: './public/index.html',
},
tools: {
rspack: {
plugins: [
stylexPlugin({
dev: true,
stylex: {
useCSSLayers: true,
genConditionalClasses: true,
treeshakeCompensation: true,
},
}),
],
},
},
});
39 changes: 39 additions & 0 deletions examples/rsbuild-example/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import { createRoot } from 'react-dom/client'
import * as stylex from '@stylexjs/stylex'
import { colors } from '@stylexjs/open-props/lib/colors.stylex'
import { sizes } from '@stylexjs/open-props/lib/sizes.stylex'
import { fonts } from '@stylexjs/open-props/lib/fonts.stylex'

const styles = stylex.create({
main: {
width: '100vw',
height: '100vh',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: colors.pink7,
},
card: {
backgroundColor: colors.blue9,
padding: sizes.spacing5,
borderRadius: sizes.spacing2,
justifyContent: 'center',
display: 'flex',
alignItems: 'center',
color: colors.gray0,
fontFamily: fonts.mono,
},
})

function App() {
return (
<div {...stylex.props(styles.main)}>
<div {...stylex.props(styles.card)}>
<span>Blue rounded rectangle</span>
</div>
</div>
)
}

createRoot(document.getElementById('root')!).render(<App />)
15 changes: 15 additions & 0 deletions examples/rsbuild-example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["DOM", "ES2020"],
"module": "ESNext",
"jsx": "react-jsx",
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"useDefineForClassFields": true
},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eryue0220/unplugin-stylex",
"version": "0.3.0",
"version": "0.3.1",
"exports": {
"./index": "./src/index.ts",
"./esbuild": "./src/esbuild.ts",
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unplugin-stylex",
"version": "0.3.0",
"version": "0.3.1",
"packageManager": "pnpm@8.11.0",
"description": "Unplugin for stylex",
"repository": "https://github.com/eryue0220/unplugin-stylex",
Expand Down Expand Up @@ -74,7 +74,7 @@
"@stylexjs/stylex": "^0.5.1"
},
"dependencies": {
"@babel/core": "^7.24.4",
"@babel/core": "^7.24.5",
"@babel/plugin-syntax-flow": "^7.24.1",
"@babel/plugin-syntax-jsx": "^7.24.1",
"@babel/plugin-syntax-typescript": "^7.24.1",
Expand All @@ -83,16 +83,16 @@
"unplugin": "^1.10.1"
},
"devDependencies": {
"@stylistic/eslint-plugin-ts": "^1.7.2",
"@types/node": "^20.12.7",
"@stylistic/eslint-plugin-ts": "^1.8.1",
"@types/node": "^20.12.11",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitest/coverage-v8": "^1.5.0",
"@vitest/coverage-v8": "^1.6.0",
"babel-plugin-syntax-hermes-parser": "^0.19.2",
"eslint": "^8.57.0",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
"vite": "^5.2.9",
"vitest": "^1.5.0"
"vite": "^5.2.11",
"vitest": "^1.6.0"
}
}
Loading

0 comments on commit 80a68a0

Please sign in to comment.