Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions rslib/react-compiler/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
*.local
*.log*

# Dist
node_modules
dist/
storybook-static

# IDE
.vscode/*
!.vscode/extensions.json
.idea
23 changes: 23 additions & 0 deletions rslib/react-compiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Rslib project

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get started

Build the library:

```bash
pnpm build
```

Build the library in watch mode:

```bash
pnpm dev
```
32 changes: 32 additions & 0 deletions rslib/react-compiler/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@rslib-example/react-compiler",
"version": "0.0.0",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "rslib",
"dev": "rslib -w"
},
"devDependencies": {
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-react": "^2.0.0",
"@rslib/core": "^0.21.3",
"@types/react": "^19.2.14",
"babel-plugin-react-compiler": "^1.0.0",
"react": "^19.2.5",
"typescript": "^5.9.3"
},
"peerDependencies": {
"react": ">=19.0.0",
"react-dom": ">=19.0.0"
}
}
25 changes: 25 additions & 0 deletions rslib/react-compiler/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { pluginBabel } from '@rsbuild/plugin-babel';
import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
bundle: false,
dts: true,
format: 'esm',
},
],
output: {
target: 'web',
},
plugins: [
pluginReact(),
pluginBabel({
include: /\.(?:jsx|tsx)$/,
babelLoaderOptions(opts) {
opts.plugins?.unshift('babel-plugin-react-compiler');
},
}),
],
});
14 changes: 14 additions & 0 deletions rslib/react-compiler/src/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import './button.css';

interface ButtonProps {
label: string;
primary?: boolean;
}

export const Button = ({ label, primary = false }: ButtonProps) => {
return (
<button type="button" className={primary ? 'demo-button demo-button--primary' : 'demo-button'}>
{label}
</button>
);
};
15 changes: 15 additions & 0 deletions rslib/react-compiler/src/button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.demo-button {
font-family: inherit;
font-weight: 700;
border: 0;
border-radius: 999px;
cursor: pointer;
display: inline-block;
line-height: 1;
padding: 12px 24px;
}

.demo-button--primary {
color: white;
background-color: #1ea7fd;
}
1 change: 1 addition & 0 deletions rslib/react-compiler/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Button } from './Button';
14 changes: 14 additions & 0 deletions rslib/react-compiler/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"lib": ["DOM", "ES2022"],
"module": "ESNext",
"jsx": "react-jsx",
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"useDefineForClassFields": true
},
"include": ["src"]
}
Loading