@stylexjs/babel-plugin 0.5.0 → 0.5.1
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.
- package/lib/index.js +14 -8
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -398,17 +398,20 @@ class StateManager {
|
|
|
398
398
|
return identifier;
|
|
399
399
|
}
|
|
400
400
|
const bodyPath = programPath.get('body');
|
|
401
|
-
let
|
|
401
|
+
let targetImportIndex = -1;
|
|
402
402
|
for (let i = 0; i < bodyPath.length; i++) {
|
|
403
403
|
const statement = bodyPath[i];
|
|
404
404
|
if (isImportDeclaration(statement)) {
|
|
405
|
-
|
|
405
|
+
targetImportIndex = i;
|
|
406
|
+
if (statement.node.specifiers.find(s => s.type === 'ImportSpecifier' && s.local.type === 'Identifier' && s.local.name === identifier.name)) {
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
406
409
|
}
|
|
407
410
|
}
|
|
408
|
-
if (
|
|
411
|
+
if (targetImportIndex === -1) {
|
|
409
412
|
return identifier;
|
|
410
413
|
}
|
|
411
|
-
const lastImport = bodyPath[
|
|
414
|
+
const lastImport = bodyPath[targetImportIndex];
|
|
412
415
|
if (lastImport == null) {
|
|
413
416
|
return identifier;
|
|
414
417
|
}
|
|
@@ -423,17 +426,20 @@ class StateManager {
|
|
|
423
426
|
return identifier;
|
|
424
427
|
}
|
|
425
428
|
const bodyPath = programPath.get('body');
|
|
426
|
-
let
|
|
429
|
+
let targetImportIndex = -1;
|
|
427
430
|
for (let i = 0; i < bodyPath.length; i++) {
|
|
428
431
|
const statement = bodyPath[i];
|
|
429
432
|
if (isImportDeclaration(statement)) {
|
|
430
|
-
|
|
433
|
+
targetImportIndex = i;
|
|
434
|
+
if (statement.node.specifiers.find(s => s.type === 'ImportDefaultSpecifier' && s.local.type === 'Identifier' && s.local.name === identifier.name)) {
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
431
437
|
}
|
|
432
438
|
}
|
|
433
|
-
if (
|
|
439
|
+
if (targetImportIndex === -1) {
|
|
434
440
|
return identifier;
|
|
435
441
|
}
|
|
436
|
-
const lastImport = bodyPath[
|
|
442
|
+
const lastImport = bodyPath[targetImportIndex];
|
|
437
443
|
if (lastImport == null) {
|
|
438
444
|
return identifier;
|
|
439
445
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/babel-plugin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "StyleX babel plugin.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": "https://github.com/facebook/stylex",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/helper-module-imports": "^7.22.15",
|
|
17
|
-
"@stylexjs/shared": "0.5.
|
|
18
|
-
"@stylexjs/stylex": "0.5.
|
|
17
|
+
"@stylexjs/shared": "0.5.1",
|
|
18
|
+
"@stylexjs/stylex": "0.5.1",
|
|
19
19
|
"@babel/core": "^7.23.6",
|
|
20
20
|
"@babel/traverse": "^7.23.6",
|
|
21
21
|
"@babel/types": "^7.23.6"
|