@stylexjs/unplugin 0.17.2 → 0.17.4
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/es/index.mjs +7 -4
- package/lib/index.js +7 -4
- package/package.json +2 -2
package/lib/es/index.mjs
CHANGED
|
@@ -182,12 +182,12 @@ const unpluginInstance = createUnplugin((userOptions = {}, metaOptions) => {
|
|
|
182
182
|
const NEAREST_NODE_MODULES = findNearestNodeModules(process.cwd());
|
|
183
183
|
const DISK_RULES_DIR = NEAREST_NODE_MODULES ? path.join(NEAREST_NODE_MODULES, '.stylex') : path.join(process.cwd(), 'node_modules', '.stylex');
|
|
184
184
|
const DISK_RULES_PATH = path.join(DISK_RULES_DIR, 'rules.json');
|
|
185
|
-
async function runBabelTransform(inputCode,
|
|
185
|
+
async function runBabelTransform(inputCode, filename, callerName) {
|
|
186
186
|
const result = await transformAsync(inputCode, {
|
|
187
187
|
babelrc: false,
|
|
188
|
-
filename
|
|
188
|
+
filename,
|
|
189
189
|
presets,
|
|
190
|
-
plugins: [...plugins, /\.jsx?/.test(path.extname(
|
|
190
|
+
plugins: [...plugins, /\.jsx?/.test(path.extname(filename)) ? flowSyntaxPlugin : [typescriptSyntaxPlugin, {
|
|
191
191
|
isTSX: true
|
|
192
192
|
}], jsxSyntaxPlugin, stylexBabelPlugin.withOptions({
|
|
193
193
|
...stylexOptions,
|
|
@@ -291,7 +291,10 @@ const unpluginInstance = createUnplugin((userOptions = {}, metaOptions) => {
|
|
|
291
291
|
const JS_LIKE_RE = /\.[cm]?[jt]sx?(\?|$)/;
|
|
292
292
|
if (!JS_LIKE_RE.test(id)) return null;
|
|
293
293
|
if (!shouldHandle(code)) return null;
|
|
294
|
-
const
|
|
294
|
+
const dir = path.dirname(id);
|
|
295
|
+
const basename = path.basename(id);
|
|
296
|
+
const file = path.join(dir, basename.split('?')[0] || basename);
|
|
297
|
+
const result = await runBabelTransform(code, file, '@stylexjs/unplugin');
|
|
295
298
|
const {
|
|
296
299
|
metadata
|
|
297
300
|
} = result;
|
package/lib/index.js
CHANGED
|
@@ -188,12 +188,12 @@ const unpluginInstance = (0, _unplugin.createUnplugin)((userOptions = {}, metaOp
|
|
|
188
188
|
const NEAREST_NODE_MODULES = findNearestNodeModules(process.cwd());
|
|
189
189
|
const DISK_RULES_DIR = NEAREST_NODE_MODULES ? _nodePath.default.join(NEAREST_NODE_MODULES, '.stylex') : _nodePath.default.join(process.cwd(), 'node_modules', '.stylex');
|
|
190
190
|
const DISK_RULES_PATH = _nodePath.default.join(DISK_RULES_DIR, 'rules.json');
|
|
191
|
-
async function runBabelTransform(inputCode,
|
|
191
|
+
async function runBabelTransform(inputCode, filename, callerName) {
|
|
192
192
|
const result = await (0, _core.transformAsync)(inputCode, {
|
|
193
193
|
babelrc: false,
|
|
194
|
-
filename
|
|
194
|
+
filename,
|
|
195
195
|
presets,
|
|
196
|
-
plugins: [...plugins, /\.jsx?/.test(_nodePath.default.extname(
|
|
196
|
+
plugins: [...plugins, /\.jsx?/.test(_nodePath.default.extname(filename)) ? _pluginSyntaxFlow.default : [_pluginSyntaxTypescript.default, {
|
|
197
197
|
isTSX: true
|
|
198
198
|
}], _pluginSyntaxJsx.default, _babelPlugin.default.withOptions({
|
|
199
199
|
...stylexOptions,
|
|
@@ -297,7 +297,10 @@ const unpluginInstance = (0, _unplugin.createUnplugin)((userOptions = {}, metaOp
|
|
|
297
297
|
const JS_LIKE_RE = /\.[cm]?[jt]sx?(\?|$)/;
|
|
298
298
|
if (!JS_LIKE_RE.test(id)) return null;
|
|
299
299
|
if (!shouldHandle(code)) return null;
|
|
300
|
-
const
|
|
300
|
+
const dir = _nodePath.default.dirname(id);
|
|
301
|
+
const basename = _nodePath.default.basename(id);
|
|
302
|
+
const file = _nodePath.default.join(dir, basename.split('?')[0] || basename);
|
|
303
|
+
const result = await runBabelTransform(code, file, '@stylexjs/unplugin');
|
|
301
304
|
const {
|
|
302
305
|
metadata
|
|
303
306
|
} = result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/unplugin",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Universal bundler plugin for StyleX using unplugin",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@babel/plugin-syntax-flow": "^7.26.0",
|
|
36
36
|
"@babel/plugin-syntax-jsx": "^7.25.9",
|
|
37
37
|
"@babel/plugin-syntax-typescript": "^7.25.9",
|
|
38
|
-
"@stylexjs/babel-plugin": "0.17.
|
|
38
|
+
"@stylexjs/babel-plugin": "0.17.4",
|
|
39
39
|
"browserslist": "^4.24.0",
|
|
40
40
|
"lightningcss": "^1.29.1"
|
|
41
41
|
},
|