@stylexjs/babel-plugin 0.2.0-beta.23 → 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 +3 -3
  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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.2.0-beta.23",
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.23"
15
+ "@stylexjs/shared": "0.2.0-beta.24"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@babel/core": "^7.19.6",