@stylexjs/babel-plugin 0.2.0-beta.22 → 0.2.0-beta.24

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.
Files changed (2) hide show
  1. package/lib/index.js +12 -8
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -5,7 +5,6 @@ var path = require('path');
5
5
  var require$$0 = require('postcss-value-parser');
6
6
  var core = require('@babel/core');
7
7
  var traverse = require('@babel/traverse');
8
- var fs = require('fs');
9
8
  var require$$0$1 = require('invariant');
10
9
  var require$$1 = require('styleq');
11
10
 
@@ -150,7 +149,7 @@ const filePathResolver = (relativeFilePath, sourceFilePath) => {
150
149
  const fileToLookFor = relativeFilePath;
151
150
  if (EXTENSIONS.some(ext => fileToLookFor.endsWith(ext))) {
152
151
  try {
153
- const resolvedFilePath = require.resolve(fileToLookFor, {
152
+ const resolvedFilePath = fileToLookFor.startsWith('./') || fileToLookFor.startsWith('../') ? path.join(path.dirname(sourceFilePath), fileToLookFor) : require.resolve(fileToLookFor, {
154
153
  paths: [path.dirname(sourceFilePath)]
155
154
  });
156
155
  return resolvedFilePath;
@@ -158,7 +157,7 @@ const filePathResolver = (relativeFilePath, sourceFilePath) => {
158
157
  }
159
158
  for (const ext of EXTENSIONS) {
160
159
  try {
161
- const resolvedFilePath = require.resolve(fileToLookFor + ext, {
160
+ const resolvedFilePath = fileToLookFor.startsWith('./') || fileToLookFor.startsWith('../') ? path.join(path.dirname(sourceFilePath), fileToLookFor + ext) : require.resolve(fileToLookFor + ext, {
162
161
  paths: [path.dirname(sourceFilePath)]
163
162
  });
164
163
  return resolvedFilePath;
@@ -3181,6 +3180,7 @@ function deopt(path, state) {
3181
3180
  state.confident = false;
3182
3181
  }
3183
3182
  function evaluateImportedFile(filePath, namedExport, state) {
3183
+ const fs = require('fs');
3184
3184
  const fileContents = fs.readFileSync(filePath, 'utf8');
3185
3185
  const ast = core.parseSync(fileContents, {
3186
3186
  babelrc: true
@@ -4437,9 +4437,13 @@ stylex.types = stylex.stylex = void 0;
4437
4437
  var _stylexInject = _interopRequireDefault(stylexInject);
4438
4438
  var _styleq = require$$1;
4439
4439
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4440
- function props(styles, _options) {
4440
+ function props() {
4441
+ const options = this;
4442
+ for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
4443
+ styles[_key] = arguments[_key];
4444
+ }
4441
4445
  if (__implementations.props) {
4442
- return __implementations.props(styles, _options);
4446
+ return __implementations.props.call(options, styles);
4443
4447
  }
4444
4448
  const [className, style] = (0, _styleq.styleq)(styles);
4445
4449
  const result = {};
@@ -4538,8 +4542,8 @@ const firstThatWorks = function () {
4538
4542
  stylex.firstThatWorks = firstThatWorks;
4539
4543
  const inject = stylex.inject = _stylexInject.default;
4540
4544
  function _stylex() {
4541
- for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
4542
- styles[_key] = arguments[_key];
4545
+ for (var _len2 = arguments.length, styles = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
4546
+ styles[_key2] = arguments[_key2];
4543
4547
  }
4544
4548
  const [className] = (0, _styleq.styleq)(styles);
4545
4549
  return className;
@@ -4762,7 +4766,7 @@ function transformStylexProps(path, state) {
4762
4766
  }
4763
4767
  let bailOut = false;
4764
4768
  let conditional = 0;
4765
- const args = node.arguments[0]?.type === 'ArrayExpression' ? node.arguments[0].elements : node.arguments.slice(0, 1);
4769
+ const args = node.arguments.flatMap(arg => arg.type === 'ArrayExpression' ? arg.elements : [arg]);
4766
4770
  const resolvedArgs = [];
4767
4771
  for (const arg of args) {
4768
4772
  switch (arg.type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.2.0-beta.22",
3
+ "version": "0.2.0-beta.24",
4
4
  "description": "StyleX babel plugin.",
5
5
  "main": "lib/index.js",
6
6
  "repository": "https://github.com/facebook/stylex",
@@ -12,7 +12,7 @@
12
12
  "test": "jest"
13
13
  },
14
14
  "dependencies": {
15
- "@stylexjs/shared": "0.2.0-beta.22"
15
+ "@stylexjs/shared": "0.2.0-beta.24"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@babel/core": "^7.19.6",