@stylexjs/babel-plugin 0.11.0 → 0.11.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 +23 -21
- package/package.json +13 -4
package/lib/index.js
CHANGED
|
@@ -1239,29 +1239,31 @@ function addSourceMapData(obj, babelPath, state) {
|
|
|
1239
1239
|
for (const [key, value] of Object.entries(obj)) {
|
|
1240
1240
|
const currentFile = babelPath.hub.file;
|
|
1241
1241
|
const sourceMap = currentFile.codeMap;
|
|
1242
|
-
const styleNodePath = babelPath.get('arguments.0.properties').find(prop =>
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1242
|
+
const styleNodePath = babelPath.get('arguments.0.properties').find(prop => {
|
|
1243
|
+
return prop.node.key.name === key || String(prop.node.key.value) === key;
|
|
1244
|
+
});
|
|
1245
|
+
if (styleNodePath) {
|
|
1246
|
+
const generatedLineNumber = styleNodePath.node.loc?.start.line;
|
|
1247
|
+
let originalLineNumber = generatedLineNumber;
|
|
1248
|
+
if (sourceMap && originalLineNumber) {
|
|
1249
|
+
const originalPosition = sourceMap.originalPositionFor({
|
|
1250
|
+
line: generatedLineNumber,
|
|
1251
|
+
column: styleNodePath.node.loc?.start.column
|
|
1252
|
+
});
|
|
1253
|
+
if (originalPosition && originalPosition.line !== null) {
|
|
1254
|
+
originalLineNumber = originalPosition.line;
|
|
1255
|
+
} else {
|
|
1256
|
+
console.warn(`Could not determine original line number for key: ${key}`);
|
|
1257
|
+
}
|
|
1258
1258
|
}
|
|
1259
|
+
const shortFilename = createShortFilename(currentFile.opts.filename || '', state);
|
|
1260
|
+
result[key] = {
|
|
1261
|
+
...value,
|
|
1262
|
+
$$css: shortFilename !== '' && originalLineNumber ? `${shortFilename}:${originalLineNumber}` : true
|
|
1263
|
+
};
|
|
1264
|
+
} else {
|
|
1265
|
+
result[key] = value;
|
|
1259
1266
|
}
|
|
1260
|
-
const shortFilename = createShortFilename(currentFile.opts.filename || '', state);
|
|
1261
|
-
result[key] = {
|
|
1262
|
-
...value,
|
|
1263
|
-
$$css: shortFilename !== '' && originalLineNumber ? `${shortFilename}:${originalLineNumber}` : true
|
|
1264
|
-
};
|
|
1265
1267
|
}
|
|
1266
1268
|
return result;
|
|
1267
1269
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/babel-plugin",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "StyleX babel plugin.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": "https://github.com/facebook/stylex",
|
|
@@ -14,12 +14,21 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/helper-module-imports": "^7.25.9",
|
|
17
|
-
"@stylexjs/shared": "0.11.0",
|
|
18
|
-
"@stylexjs/stylex": "0.11.0",
|
|
19
17
|
"@babel/core": "^7.26.8",
|
|
20
18
|
"@babel/traverse": "^7.26.8",
|
|
21
19
|
"@babel/types": "^7.26.8",
|
|
22
|
-
"@dual-bundle/import-meta-resolve": "^4.1.0"
|
|
20
|
+
"@dual-bundle/import-meta-resolve": "^4.1.0",
|
|
21
|
+
"@stylexjs/shared": "0.11.1",
|
|
22
|
+
"@stylexjs/stylex": "0.11.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
26
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
27
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
28
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
29
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
30
|
+
"@rollup/plugin-replace": "^6.0.1",
|
|
31
|
+
"rollup": "^4.24.0"
|
|
23
32
|
},
|
|
24
33
|
"jest": {
|
|
25
34
|
"verbose": true,
|