@stylexjs/babel-plugin 0.10.0 → 0.10.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.
|
@@ -236,7 +236,7 @@ declare export class Binding {
|
|
|
236
236
|
type _VisitorNodeKeys<S: object> = {
|
|
237
237
|
+[K in keyof t._NodeMap]: ?VisitNode<S, t._NodeMap[K]>,
|
|
238
238
|
};
|
|
239
|
-
type
|
|
239
|
+
type _VisitorAliases<S: object> = {
|
|
240
240
|
+[K in keyof t.Aliases]: ?VisitNode<S, t.Aliases[K]>,
|
|
241
241
|
};
|
|
242
242
|
|
|
@@ -244,7 +244,7 @@ export type Visitor<S: object = object> = $ReadOnly<
|
|
|
244
244
|
Partial<{
|
|
245
245
|
...VisitNodeObject<S, Node>,
|
|
246
246
|
..._VisitorNodeKeys<S>,
|
|
247
|
-
...
|
|
247
|
+
..._VisitorAliases<S>,
|
|
248
248
|
}>,
|
|
249
249
|
>;
|
|
250
250
|
|
package/lib/index.js
CHANGED
|
@@ -1130,12 +1130,17 @@ function possibleAliasedPaths(importPath, aliases) {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
return result;
|
|
1132
1132
|
}
|
|
1133
|
+
const getPossibleFilePaths = filePath => {
|
|
1134
|
+
const extension = path.extname(filePath);
|
|
1135
|
+
const filePathHasCodeExtension = EXTENSIONS.includes(extension);
|
|
1136
|
+
const filePathNoCodeExtension = filePathHasCodeExtension ? filePath.slice(0, -extension.length) : filePath;
|
|
1137
|
+
return [filePath, ...EXTENSIONS.map(ext => filePathNoCodeExtension + ext)];
|
|
1138
|
+
};
|
|
1133
1139
|
const filePathResolver = (relativeFilePath, sourceFilePath, aliases) => {
|
|
1134
|
-
for (const
|
|
1135
|
-
const importPathStr = relativeFilePath + ext;
|
|
1140
|
+
for (const importPathStr of getPossibleFilePaths(relativeFilePath)) {
|
|
1136
1141
|
if (importPathStr.startsWith('.')) {
|
|
1137
1142
|
try {
|
|
1138
|
-
return importMetaResolve.moduleResolve(importPathStr, url.pathToFileURL(sourceFilePath))
|
|
1143
|
+
return url.fileURLToPath(importMetaResolve.moduleResolve(importPathStr, url.pathToFileURL(sourceFilePath)));
|
|
1139
1144
|
} catch {
|
|
1140
1145
|
continue;
|
|
1141
1146
|
}
|
|
@@ -1143,7 +1148,7 @@ const filePathResolver = (relativeFilePath, sourceFilePath, aliases) => {
|
|
|
1143
1148
|
const allAliases = possibleAliasedPaths(importPathStr, aliases);
|
|
1144
1149
|
for (const possiblePath of allAliases) {
|
|
1145
1150
|
try {
|
|
1146
|
-
return importMetaResolve.moduleResolve(possiblePath, url.pathToFileURL(sourceFilePath))
|
|
1151
|
+
return url.fileURLToPath(importMetaResolve.moduleResolve(possiblePath, url.pathToFileURL(sourceFilePath)));
|
|
1147
1152
|
} catch {
|
|
1148
1153
|
continue;
|
|
1149
1154
|
}
|
|
@@ -1159,7 +1164,7 @@ const addFileExtension = (importedFilePath, sourceFile) => {
|
|
|
1159
1164
|
const fileExtension = path.extname(sourceFile);
|
|
1160
1165
|
return importedFilePath + fileExtension;
|
|
1161
1166
|
};
|
|
1162
|
-
const matchesFileSuffix = allowedSuffix => filename =>
|
|
1167
|
+
const matchesFileSuffix = allowedSuffix => filename => ['', ...EXTENSIONS].some(extension => filename.endsWith(`${allowedSuffix}${extension}`));
|
|
1163
1168
|
const getProgramPath = path => {
|
|
1164
1169
|
let programPath = path;
|
|
1165
1170
|
while (programPath != null && !isProgram(programPath)) {
|
|
@@ -3800,7 +3805,7 @@ function transformStyleXCreate(path, state) {
|
|
|
3800
3805
|
dynamicFnsNames.forEach(fnsName => {
|
|
3801
3806
|
injectedInheritStyles[fnsName] = {
|
|
3802
3807
|
priority: 0,
|
|
3803
|
-
ltr: `@property ${fnsName} { syntax: "*"; inherits: false;
|
|
3808
|
+
ltr: `@property ${fnsName} { syntax: "*"; inherits: false;}`,
|
|
3804
3809
|
rtl: null
|
|
3805
3810
|
};
|
|
3806
3811
|
});
|
|
@@ -11,7 +11,7 @@ import * as t from '../../flow_modules/@babel/types';
|
|
|
11
11
|
import type { NodePath } from '../../flow_modules/@babel/traverse';
|
|
12
12
|
import StateManager from '../utils/state-manager';
|
|
13
13
|
|
|
14
|
-
// Read imports of react and remember the name of the local
|
|
14
|
+
// Read imports of react and remember the name of the local variables for later
|
|
15
15
|
declare export function readImportDeclarations(
|
|
16
16
|
path: NodePath<t.ImportDeclaration>,
|
|
17
17
|
state: StateManager,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/babel-plugin",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.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.10.
|
|
18
|
-
"@stylexjs/stylex": "0.10.
|
|
17
|
+
"@stylexjs/shared": "0.10.1",
|
|
18
|
+
"@stylexjs/stylex": "0.10.1",
|
|
19
19
|
"@babel/core": "^7.25.8",
|
|
20
20
|
"@babel/traverse": "^7.25.7",
|
|
21
21
|
"@babel/types": "^7.25.8",
|