-
Notifications
You must be signed in to change notification settings - Fork 46
feat: support css in bundless mode #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c108760
chore: update the test suite name
SoonIter 0f56dbe
chore: reabse
SoonIter f22f9fd
chore: add new bench suite
SoonIter 3232aa6
test: add e2e test
SoonIter a4384ac
chore: polish
SoonIter aad6617
chore: adopt suggestions
SoonIter b281570
chore: add css-modules and less test cases
SoonIter 2dbd9b6
chore: update lock
SoonIter cbeff88
chore: use require shim
SoonIter 63d4038
chore: adopt suggestions
SoonIter 2d13902
chore: add resourceQuery
SoonIter 773e52c
chore: rename LibCssExtractLoader -> libCssExtractLoader
SoonIter ba75641
chore: rename LibCssExtractLoader -> libCssExtractLoader
SoonIter d80ec52
chore: rename RSLIB_CSS_ENTRY_FLAG
SoonIter 890c6fa
chore: remove banner
SoonIter ee0ecf6
test: add tailwind postcss lightningcss
SoonIter 50440a0
test: add redirect-style-false style-inject
SoonIter caf7768
chore(infra): vscode settings for prettier
SoonIter 2670c54
test: small fix
SoonIter 8ce1cea
Merge branch 'main' into css-support
SoonIter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,7 @@ doc_build | |
**/*.js | ||
**/*.ts | ||
**/*.jsx | ||
**/*.tsx | ||
**/*.tsx | ||
|
||
# ignore pnpm-lock | ||
pnpm-lock.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@examples/react-component-bundle-false", | ||
"private": true, | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.mjs", | ||
"types": "./dist/cjs/index.d.ts", | ||
"scripts": { | ||
"build": "rslib build" | ||
}, | ||
"devDependencies": { | ||
"@rsbuild/plugin-react": "^1.0.2", | ||
"@rsbuild/plugin-sass": "^1.0.1", | ||
"@rslib/core": "workspace:*", | ||
"@types/react": "^18.3.5", | ||
"react": "^18.3.1" | ||
}, | ||
"peerDependencies": { | ||
"react": "*" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { pluginReact } from '@rsbuild/plugin-react'; | ||
import { pluginSass } from '@rsbuild/plugin-sass'; | ||
import { type LibConfig, defineConfig } from '@rslib/core'; | ||
|
||
const shared: LibConfig = { | ||
bundle: false, | ||
dts: { | ||
bundle: false, | ||
}, | ||
}; | ||
|
||
export default defineConfig({ | ||
source: { | ||
entry: { | ||
index: ['./src/**', '!./src/env.d.ts'], | ||
}, | ||
}, | ||
lib: [ | ||
{ | ||
...shared, | ||
format: 'esm', | ||
output: { | ||
distPath: { | ||
root: './dist/esm', | ||
}, | ||
}, | ||
}, | ||
{ | ||
...shared, | ||
format: 'cjs', | ||
output: { | ||
distPath: { | ||
root: './dist/cjs', | ||
}, | ||
}, | ||
}, | ||
], | ||
plugins: [pluginReact(), pluginSass()], | ||
}); |
3 changes: 3 additions & 0 deletions
3
examples/react-component-bundle-false/src/components/CounterButton/index.module.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.button { | ||
background: yellow; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.module.scss' { | ||
const classes: { [key: string]: string }; | ||
export default classes; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.counter-text { | ||
font-size: 50px; | ||
} |
5 changes: 3 additions & 2 deletions
5
examples/react-component/src/index.tsx → ...eact-component-bundle-false/src/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"baseUrl": ".", | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true, | ||
"jsx": "react-jsx", | ||
"lib": ["DOM", "ESNext"], | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"rootDir": "src", | ||
"skipLibCheck": true, | ||
"strict": true | ||
}, | ||
"exclude": ["**/node_modules"], | ||
"include": ["src"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @examples/react-component | ||
|
||
This example demonstrates how to use Rslib to build a simple React component. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
examples/react-component-bundle/src/components/CounterButton/index.module.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.button { | ||
background: yellow; | ||
} |
14 changes: 14 additions & 0 deletions
14
examples/react-component-bundle/src/components/CounterButton/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styles from './index.module.scss'; | ||
interface CounterButtonProps { | ||
onClick: () => void; | ||
label: string; | ||
} | ||
|
||
export const CounterButton: React.FC<CounterButtonProps> = ({ | ||
onClick, | ||
label, | ||
}) => ( | ||
<button type="button" className={styles.button} onClick={onClick}> | ||
{label} | ||
</button> | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.module.scss' { | ||
const classes: { [key: string]: string }; | ||
export default classes; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.counter-text { | ||
font-size: 50px; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { CounterButton } from './components/CounterButton/index'; | ||
import { useCounter } from './useCounter'; | ||
import './index.scss'; | ||
|
||
export const Counter: React.FC = () => { | ||
const { count, increment, decrement } = useCounter(); | ||
|
||
return ( | ||
<div> | ||
<h2 className="counter-text">Counter: {count}</h2> | ||
<CounterButton onClick={decrement} label="-" /> | ||
<CounterButton onClick={increment} label="+" /> | ||
</div> | ||
); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useState } from 'react'; | ||
|
||
export const useCounter = (initialValue = 0) => { | ||
const [count, setCount] = useState(initialValue); | ||
|
||
const increment = () => setCount((prev) => prev + 1); | ||
const decrement = () => setCount((prev) => prev - 1); | ||
|
||
return { count, increment, decrement }; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"baseUrl": ".", | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true, | ||
"jsx": "react-jsx", | ||
"lib": ["DOM", "ESNext"], | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"rootDir": "src", | ||
"skipLibCheck": true, | ||
"strict": true | ||
}, | ||
"exclude": ["**/node_modules"], | ||
"include": ["src"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.