Skip to content
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

StyleX 0.10.1 release features and fixes #203

Merged
merged 2 commits into from
Jan 18, 2025
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
4 changes: 2 additions & 2 deletions apps/esbuild-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
4 changes: 2 additions & 2 deletions apps/farm-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
6 changes: 3 additions & 3 deletions apps/nextjs-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"dependencies": {
"@stylexswc/jest": "0.6.2-rc.4",
"@stylexswc/nextjs-plugin": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"next": "15.1.2",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand All @@ -32,7 +32,7 @@
"@types/jest": "^29.5.14",
"jest": "^29.7.0",
"jest-environment-jsdom": "29.7.0",
"@stylexjs/eslint-plugin": "^0.10.0",
"@stylexjs/eslint-plugin": "^0.10.1",
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@types/node": "^22.5.1",
"@types/react": "^19.0.1",
Expand Down
6 changes: 3 additions & 3 deletions apps/nextjs-postcss-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
"next:lint": "next lint"
},
"dependencies": {
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"next": "15.1.2",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"autoprefixer": "^10.4.20",
"@stylexswc/postcss-plugin": "0.6.2-rc.4",
"@stylexjs/eslint-plugin": "^0.10.0",
"@stylexjs/eslint-plugin": "^0.10.1",
"@types/node": "^22.5.1",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
Expand Down
6 changes: 3 additions & 3 deletions apps/nextjs-swc-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"next:lint": "next lint"
},
"dependencies": {
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"next": "15.1.2",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@stylexjs/eslint-plugin": "^0.10.0",
"@stylexjs/eslint-plugin": "^0.10.1",
"@stylexswc/nextjs-swc-plugin": "0.6.2-rc.4",
"@stylexswc/swc-plugin": "0.6.2-rc.4",
"@types/node": "^22.5.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/rollup-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"license": "MIT",
"dependencies": {
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/rollup-plugin": "0.6.2-rc.4"
}
}
4 changes: 2 additions & 2 deletions apps/rollup-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
4 changes: 2 additions & 2 deletions apps/rsbuild-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
4 changes: 2 additions & 2 deletions apps/rspack-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
4 changes: 2 additions & 2 deletions apps/solid-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
4 changes: 2 additions & 2 deletions apps/vite-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
4 changes: 2 additions & 2 deletions apps/vue-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"vue": "^3.5.12"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/webpack-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"license": "MIT",
"dependencies": {
"@stylexjs/stylex": "^0.10.0"
"@stylexjs/stylex": "^0.10.1"
},
"devDependencies": {
"@stylexswc/webpack-plugin": "0.6.2-rc.4",
Expand Down
4 changes: 2 additions & 2 deletions apps/webpack-unplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"license": "MIT",
"dependencies": {
"@stylexswc/rs-compiler": "0.6.2-rc.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@stylexswc/unplugin": "0.6.2-rc.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dependencies": {
"@stylex/theme-lib-main-dist": "workspace:^",
"@stylex/theme-lib": "workspace:^",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"stylex-lib": "workspace:^"
}
}
4 changes: 2 additions & 2 deletions crates/stylex-rs-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"devDependencies": {
"@napi-rs/cli": "^2.18.4",
"@stylexjs/open-props": "^0.10.0",
"@stylexjs/stylex": "^0.10.0",
"@stylexjs/open-props": "^0.10.1",
"@stylexjs/stylex": "^0.10.1",
"@swc-node/register": "^1.10.6",
"@swc/core": "^1.6.13",
"@taplo/cli": "^0.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ where
Rc::new(InjectableStyle {
priority: Some(0f64),
ltr: format!(
"@property {} {{ syntax: \"*\"; inherits: false; initial-value: \"*\"; }}",
"@property {} {{ syntax: \"*\"; inherits: false; }}",
fns_name
),
rtl: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var _inject2 = _inject;
import stylex from 'stylex';
_inject2(".xrkmrrc{background-color:red}", 3000);
_inject2(".x1bl4301{width:var(--width)}", 4000);
_inject2('@property --width { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --width { syntax: "*"; inherits: false; }', 0);
export const styles = {
default: (width)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _inject2(".xrkmrrc{background-color:red}", 3000);
_inject2(".x1n25116{color:var(--4xs81a)}", 3000);
_inject2("@media (min-width: 1000px){.xtljkjt.xtljkjt:hover{color:green}}", 3330);
_inject2(".x17z2mba:hover{color:blue}", 3130);
_inject2('@property --4xs81a { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --4xs81a { syntax: "*"; inherits: false; }', 0);
export const styles = {
default: (color)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ _inject2(".xrkmrrc{background-color:red}", 3000);
_inject2(".x1n25116{color:var(--4xs81a)}", 3000);
_inject2("@media (min-width: 1000px){.xtljkjt.xtljkjt:hover{color:green}}", 3330);
_inject2(".x1d4gdy3:hover{color:var(--w5m4kq)}", 3130);
_inject2('@property --4xs81a { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --w5m4kq { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --4xs81a { syntax: "*"; inherits: false; }', 0);
_inject2('@property --w5m4kq { syntax: "*"; inherits: false; }', 0);
export const styles = {
default: (color)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var _inject2 = _inject;
import stylex from 'stylex';
_inject2(".x1gykpug:hover{background-color:red}", 3130);
_inject2(".xtyu0qe:hover{color:var(--1ijzsae)}", 3130);
_inject2('@property --1ijzsae { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --1ijzsae { syntax: "*"; inherits: false; }', 0);
export const styles = {
default: (color)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import stylex from 'stylex';
_inject2(".xrkmrrc{background-color:red}", 3000);
_inject2(".xfx01vb{color:var(--color)}", 3000);
_inject2(".x1mqxbix{color:black}", 3000);
_inject2('@property --color { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --color { syntax: "*"; inherits: false; }', 0);
export const styles = {
default: (color)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ _inject2(".x3skgmg:hover{margin-bottom:var(--yepcm9)}", 4130);
_inject2(".x1k44ad6{margin-left:var(--14mfytm)}", 3000, ".x1k44ad6{margin-right:var(--14mfytm)}");
_inject2(".x10ktymb:hover{margin-left:var(--yepcm9)}", 3130, ".x10ktymb:hover{margin-right:var(--yepcm9)}");
_inject2(".x17zef60{margin-top:var(--marginTop)}", 4000);
_inject2('@property --14mfytm { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --yepcm9 { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --marginTop { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --14mfytm { syntax: "*"; inherits: false; }', 0);
_inject2('@property --yepcm9 { syntax: "*"; inherits: false; }', 0);
_inject2('@property --marginTop { syntax: "*"; inherits: false; }', 0);
export const styles = {
default: (margin)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var _inject2 = _inject;
import stylex from 'stylex';
_inject2(".xrkmrrc{background-color:red}", 3000);
_inject2(".xfx01vb{color:var(--color)}", 3000);
_inject2('@property --color { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --color { syntax: "*"; inherits: false; }', 0);
export const styles = {
default: (color)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _inject from "@stylexjs/stylex/lib/stylex-inject";
var _inject2 = _inject;
import stylex from 'stylex';
_inject2(".x15mgraa{--background-color:var(----background-color)}", 1);
_inject2('@property ----background-color { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property ----background-color { syntax: "*"; inherits: false; }', 0);
export const styles = {
default: (bgColor)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _inject from "@stylexjs/stylex/lib/stylex-inject";
var _inject2 = _inject;
import stylex from "@stylexjs/stylex";
_inject2(".xr5ldyu{background-color:var(--backgroundColor)}", 3000);
_inject2('@property --backgroundColor { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --backgroundColor { syntax: "*"; inherits: false; }', 0);
export const styles = {
dynamic: (backgroundColor)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import stylex from "@stylexjs/stylex";
_inject2(".x6zurak{font-size:var(--fontSize)}", 3000);
_inject2(".x3stwaq{font-weight:100}", 3000);
_inject2(".xngnso2{font-size:1.5rem}", 3000);
_inject2('@property --fontSize { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --fontSize { syntax: "*"; inherits: false; }', 0);
const styles = {
size: (size: number)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _inject from "@stylexjs/stylex/lib/stylex-inject";
var _inject2 = _inject;
import stylex from "@stylexjs/stylex";
_inject2(".x6zurak{font-size:var(--fontSize)}", 3000);
_inject2('@property --fontSize { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --fontSize { syntax: "*"; inherits: false; }', 0);
const styles = {
fontSizeFallback: (size: number)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _inject from "@stylexjs/stylex/lib/stylex-inject";
var _inject2 = _inject;
import stylex from "@stylexjs/stylex";
_inject2(".x6zurak{font-size:var(--fontSize)}", 3000);
_inject2('@property --fontSize { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --fontSize { syntax: "*"; inherits: false; }', 0);
const styles = {
fontSizeTernary: (size: number)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "otherFile.stylex";
import stylex from 'stylex';
import { MyTheme } from 'otherFile.stylex';
_inject2(".__hashed_var__b69i2g{--__hashed_var__1jqb1tb:var(----__hashed_var__1jqb1tb)}", 1);
_inject2('@property ----__hashed_var__1jqb1tb { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property ----__hashed_var__1jqb1tb { syntax: "*"; inherits: false; }', 0);
export const styles = {
color: (color)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ _inject2(".minWidth-x1843ork{min-width:6rem}", 4000);
_inject2(".textAlign-x2b8uid{text-align:center}", 3000);
_inject2(".fontFamily-xovafh8{font-family:var(--fontMono-xur0yta)}", 3000);
_inject2(".fontSize-x1c27omx{font-size:var(--h3-x1yfd0fu)}", 3000);
_inject2('@property --fontSize { syntax: "*"; inherits: false; initial-value: "*"; }', 0);
_inject2('@property --fontSize { syntax: "*"; inherits: false; }', 0);
const styles = {
size: (size)=>[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ describe('Evaluation of imported values works based on configuration', ()=>{
import 'otherFile.stylex';
import { MyTheme } from 'otherFile.stylex';
_inject2(".__hashed_var__b69i2g{--__hashed_var__1jqb1tb:var(----__hashed_var__1jqb1tb)}", 1);
_inject2("@property ----__hashed_var__1jqb1tb { syntax: \\"*\\"; inherits: false; initial-value: \\"*\\";}", 0);
_inject2("@property ----__hashed_var__1jqb1tb { syntax: \\"*\\"; inherits: false;}", 0);
const styles = {
color: color => [{
"--__hashed_var__1jqb1tb": color == null ? null : "__hashed_var__b69i2g",
Expand All @@ -346,7 +346,7 @@ describe('Evaluation of imported values works based on configuration', ()=>{
[
"----__hashed_var__1jqb1tb",
{
"ltr": "@property ----__hashed_var__1jqb1tb { syntax: "*"; inherits: false; initial-value: "*";}",
"ltr": "@property ----__hashed_var__1jqb1tb { syntax: "*"; inherits: false;}",
"rtl": null,
},
0,
Expand All @@ -355,4 +355,40 @@ describe('Evaluation of imported values works based on configuration', ()=>{
`);
});
});
describe('Module resolution commonJS', ()=>{
afterEach(()=>{
moduleResolve.mockReset();
});
test('Recognizes .ts stylex imports when resolving .js relative imports', ()=>{
moduleResolve.mockImplementation((value)=>{
if (!value.endsWith('/otherFile.stylex.ts')) {
throw new Error('File not found');
}
return new URL('file:///project/otherFile.stylex.ts');
});
const transformation = transform(`
import stylex from 'stylex';
import { MyTheme } from './otherFile.stylex.js';
const styles = stylex.create({
red: {
color: MyTheme.__themeName__,
}
});
stylex(styles.red);
`, {
unstable_moduleResolution: {
type: 'commonJS'
}
});
expect(transformation.code).toMatchInlineSnapshot(`
"import _inject from "@stylexjs/stylex/lib/stylex-inject";
var _inject2 = _inject;
import stylex from 'stylex';
import './otherFile.stylex.js';
import { MyTheme } from './otherFile.stylex.js';
_inject2(".xoh8dld{color:xb897f7}", 3000);
"xoh8dld";"
`);
});
});
});
Loading
Loading