@stylexjs/rollup-plugin 0.2.0-beta.21 → 0.2.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,17 +56,27 @@ describe('rollup-plugin-stylex', () => {
56
56
  const { css, js } = await runStylex({ fileName: 'stylex.css' });
57
57
 
58
58
  expect(css).toMatchInlineSnapshot(`
59
- "@keyframes x11gtny7-B{0%{opacity:.25;}100%{opacity:1;}}
59
+ "
60
+ @layer priority1, priority2, priority3, priority4;
61
+ @layer priority1{
62
+ @keyframes x11gtny7-B{0%{opacity:.25;}100%{opacity:1;}}
63
+ }
64
+ @layer priority2{
65
+ .x1kflwvg:hover{background:red}
66
+ }
67
+ @layer priority3{
60
68
  .x1nrqb13{animation-name:x11gtny7-B}
61
69
  .xntgbld{display:block}
62
70
  .x1c4r43l{display:flex}
63
71
  .x1wdx05y{display:inline}
64
- .x1je5kxa{height:500px}
65
72
  .xo3gju4{margin-inline-start:10px}
73
+ }
74
+ @layer priority4{
75
+ .x1je5kxa{height:500px}
66
76
  .x1h9ru99{margin-top:99px}
67
77
  .x6mlivy{width:100%}
68
78
  .x1u78jha{width:50%}
69
- .x1kflwvg:hover{background:red}"
79
+ }"
70
80
  `);
71
81
 
72
82
  expect(js).toMatchInlineSnapshot(`
@@ -111,6 +121,8 @@ describe('rollup-plugin-stylex', () => {
111
121
  ":hover_backgroundImage": null,
112
122
  ":hover_backgroundOrigin": null,
113
123
  ":hover_backgroundPosition": null,
124
+ ":hover_backgroundPositionX": null,
125
+ ":hover_backgroundPositionY": null,
114
126
  ":hover_backgroundRepeat": null,
115
127
  ":hover_backgroundSize": null,
116
128
  $$css: true
@@ -139,8 +151,8 @@ describe('rollup-plugin-stylex', () => {
139
151
 
140
152
  // otherStyles.js
141
153
 
142
- stylex.inject(".xntgbld{display:block}", 4);
143
- stylex.inject(".x6mlivy{width:100%}", 4);
154
+ stylex.inject(".xntgbld{display:block}", 3000);
155
+ stylex.inject(".x6mlivy{width:100%}", 4000);
144
156
  var styles$2 = {
145
157
  bar: {
146
158
  "otherStyles__styles.bar": "otherStyles__styles.bar",
@@ -152,9 +164,9 @@ describe('rollup-plugin-stylex', () => {
152
164
 
153
165
  // npmStyles.js
154
166
 
155
- stylex.inject(".x1wdx05y{display:inline}", 4);
156
- stylex.inject(".x1je5kxa{height:500px}", 4);
157
- stylex.inject(".x1u78jha{width:50%}", 4);
167
+ stylex.inject(".x1wdx05y{display:inline}", 3000);
168
+ stylex.inject(".x1je5kxa{height:500px}", 4000);
169
+ stylex.inject(".x1u78jha{width:50%}", 4000);
158
170
  const styles$1 = {
159
171
  baz: {
160
172
  "npmStyles__styles.baz": "npmStyles__styles.baz",
@@ -168,12 +180,12 @@ describe('rollup-plugin-stylex', () => {
168
180
  // index.js
169
181
 
170
182
  stylex.inject("@keyframes x11gtny7-B{0%{opacity:.25;}100%{opacity:1;}}", 1);
171
- stylex.inject(".x1nrqb13{animation-name:x11gtny7-B}", 4);
172
- stylex.inject(".x1c4r43l{display:flex}", 4);
173
- stylex.inject(".xo3gju4{margin-inline-start:10px}", 4);
174
- stylex.inject(".x1h9ru99{margin-top:99px}", 4);
175
- stylex.inject(".x1je5kxa{height:500px}", 4);
176
- stylex.inject(".x1kflwvg:hover{background:red}", 16);
183
+ stylex.inject(".x1nrqb13{animation-name:x11gtny7-B}", 3000);
184
+ stylex.inject(".x1c4r43l{display:flex}", 3000);
185
+ stylex.inject(".xo3gju4{margin-inline-start:10px}", 3000);
186
+ stylex.inject(".x1h9ru99{margin-top:99px}", 4000);
187
+ stylex.inject(".x1je5kxa{height:500px}", 4000);
188
+ stylex.inject(".x1kflwvg:hover{background:red}", 1130);
177
189
  var styles = {
178
190
  foo: {
179
191
  "index__styles.foo": "index__styles.foo",
@@ -191,6 +203,8 @@ describe('rollup-plugin-stylex', () => {
191
203
  ":hover_backgroundImage": null,
192
204
  ":hover_backgroundOrigin": null,
193
205
  ":hover_backgroundPosition": null,
206
+ ":hover_backgroundPositionX": null,
207
+ ":hover_backgroundPositionY": null,
194
208
  ":hover_backgroundRepeat": null,
195
209
  ":hover_backgroundSize": null,
196
210
  $$css: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/rollup-plugin",
3
- "version": "0.2.0-beta.21",
3
+ "version": "0.2.0-beta.22",
4
4
  "description": "Rollup plugin for StyleX",
5
5
  "main": "src/index.js",
6
6
  "repository": "https://www.github.com/facebook/stylex",
@@ -14,18 +14,19 @@
14
14
  "__builds__",
15
15
  "/__fixtures__/"
16
16
  ],
17
- "testEnvironment": "node"
17
+ "testEnvironment": "node",
18
+ "prettierPath": null
18
19
  },
19
20
  "dependencies": {
20
21
  "@babel/core": "^7.16.0",
21
- "@stylexjs/babel-plugin": "0.2.0-beta.21"
22
+ "@stylexjs/babel-plugin": "0.2.0-beta.22"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@babel/preset-env": "^7.16.8",
25
26
  "@rollup/plugin-babel": "^6.0.0",
26
27
  "@rollup/plugin-commonjs": "^25.0.3",
27
28
  "@rollup/plugin-node-resolve": "^15.0.0",
28
- "rollup": "^3.26.3",
29
- "@stylexjs/stylex": "0.2.0-beta.21"
29
+ "rollup": "^3.26.3 || ^4.0.2",
30
+ "@stylexjs/stylex": "0.2.0-beta.22"
30
31
  }
31
32
  }
package/src/index.js CHANGED
@@ -20,6 +20,7 @@ module.exports = function stylexPlugin({
20
20
  dev = IS_DEV_ENV,
21
21
  fileName = 'stylex.css',
22
22
  babelConfig: { plugins = [], presets = [] } = {},
23
+ ...options
23
24
  } = {}) {
24
25
  let stylexRules = {};
25
26
 
@@ -31,7 +32,7 @@ module.exports = function stylexPlugin({
31
32
  generateBundle() {
32
33
  const rules = Object.values(stylexRules).flat();
33
34
  if (rules.length > 0) {
34
- const collectedCSS = stylexBabelPlugin.processStylexRules(rules);
35
+ const collectedCSS = stylexBabelPlugin.processStylexRules(rules, true);
35
36
 
36
37
  this.emitFile({
37
38
  fileName,
@@ -55,7 +56,7 @@ module.exports = function stylexPlugin({
55
56
  ? flowSyntaxPlugin
56
57
  : typescriptSyntaxPlugin,
57
58
  jsxSyntaxPlugin,
58
- [stylexBabelPlugin, { dev, stylexSheetName: fileName }],
59
+ [stylexBabelPlugin, { dev, stylexSheetName: fileName, ...options }],
59
60
  ],
60
61
  });
61
62