@ladifire-opensource/stylex-nextjs-plugin
Advanced tools
Comparing version 0.0.1-beta.0 to 0.0.1-beta.1.0
{ | ||
"name": "@ladifire-opensource/stylex-nextjs-plugin", | ||
"version": "0.0.1-beta.0", | ||
"version": "0.0.1-beta.1.0", | ||
"description": "Transform Stylex code", | ||
@@ -14,3 +14,4 @@ "license": "MIT", | ||
"dist", | ||
"src" | ||
"src", | ||
"index.js" | ||
], | ||
@@ -22,5 +23,5 @@ "repository": { | ||
"dependencies": { | ||
"@ladifire-opensource/stylex-webpack-plugin": "0.0.1-beta.0" | ||
"@ladifire-opensource/stylex-webpack-plugin": "0.0.1-beta.1.0" | ||
}, | ||
"gitHead": "c9a6a6486bda2d68e05ac48b9860e7702ca8e84c" | ||
"gitHead": "4724bf02422b39e9eede98cfff8d7b624d100dee" | ||
} |
// license by johanholmerin | ||
const StylexPlugin = require('@ladifire-opensource/stylex-webpack-plugin'); | ||
const StylexPlugin = require("@ladifire-opensource/stylex-webpack-plugin"); | ||
const { | ||
getClientStyleLoader | ||
} = require('next/dist/build/webpack/config/blocks/css/loaders/client'); | ||
const {stringifyCssRequest} = require('./utils'); | ||
} = require("next/dist/build/webpack/config/blocks/css/loaders/client"); | ||
const {stringifyCssRequest} = require("./utils"); | ||
function getInlineLoader(options) { | ||
const outputLoaders = [ | ||
{ loader: 'css-loader' } | ||
{loader: "css-loader"} | ||
]; | ||
@@ -26,33 +26,31 @@ | ||
module.exports = (pluginOptions = {}) => (nextConfig = {}) => { | ||
return { | ||
...nextConfig, | ||
webpack(config, options) { | ||
const outputCSS = !options.isServer; | ||
module.exports = (pluginOptions = {}) => (nextConfig = {}) => ({ | ||
...nextConfig, | ||
webpack(config, options) { | ||
const outputCSS = !options.isServer; | ||
config.module.rules.unshift({ | ||
test: /\.(tsx|ts|js|mjs|jsx)$/, | ||
use: [ | ||
{ | ||
loader: StylexPlugin.loader, | ||
options: { | ||
inlineLoader: getInlineLoader(options), | ||
outputCSS, | ||
...pluginOptions | ||
} | ||
config.module.rules.unshift({ | ||
test: /\.(tsx|ts|js|mjs|jsx)$/, | ||
use: [ | ||
{ | ||
loader: StylexPlugin.loader, | ||
options: { | ||
inlineLoader: getInlineLoader(options), | ||
outputCSS, | ||
...pluginOptions | ||
} | ||
] | ||
}); | ||
} | ||
] | ||
}); | ||
if (outputCSS) { | ||
config.plugins.push(new StylexPlugin()); | ||
} | ||
if (outputCSS) { | ||
config.plugins.push(new StylexPlugin()); | ||
} | ||
if (typeof nextConfig.webpack === 'function') { | ||
return nextConfig.webpack(config, options); | ||
} | ||
if (typeof nextConfig.webpack === "function") { | ||
return nextConfig.webpack(config, options); | ||
} | ||
return config; | ||
} | ||
}; | ||
}; | ||
return config; | ||
} | ||
}); |
function stringifyCssRequest(outputLoaders) { | ||
const cssLoaders = outputLoaders.map(stringifyLoaderRequest).join('!'); | ||
const cssLoaders = outputLoaders.map(stringifyLoaderRequest).join("!"); | ||
@@ -7,6 +7,6 @@ return `!${cssLoaders}!`; | ||
function stringifyLoaderRequest({ loader, options = {} }) { | ||
function stringifyLoaderRequest({loader, options = {}}) { | ||
return `${loader}?${JSON.stringify(options)}`; | ||
} | ||
module.exports = { stringifyCssRequest, stringifyLoaderRequest }; | ||
module.exports = {stringifyCssRequest, stringifyLoaderRequest}; |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
3685
6
62
1
3
+ Added@ladifire-opensource/babel-plugin-transform-stylex@0.0.1-beta.1.0(transitive)
+ Added@ladifire-opensource/stylex-webpack-plugin@0.0.1-beta.1.0(transitive)
- Removed@ladifire-opensource/babel-plugin-transform-stylex@0.0.1-beta.0(transitive)
- Removed@ladifire-opensource/stylex-webpack-plugin@0.0.1-beta.0(transitive)
Updated@ladifire-opensource/stylex-webpack-plugin@0.0.1-beta.1.0