Skip to content

Commit e1b82fe

Browse files
authored
fix: PostCSS 8 plugin loading
1 parent 4b44e01 commit e1b82fe

File tree

5 files changed

+23
-34
lines changed

5 files changed

+23
-34
lines changed

package-lock.json

+15-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
"memfs": "^3.2.0",
7373
"midas": "^2.0.3",
7474
"npm-run-all": "^4.1.5",
75-
"postcss": "^8.0.1",
75+
"postcss": "^8.1.1",
7676
"postcss-dark-theme-class": "^0.4.0",
7777
"postcss-import": "^12.0.1",
7878
"postcss-js": "^2.0.0",
79-
"postcss-nested": "^4.2.3",
79+
"postcss-nested": "^5.0.1",
8080
"postcss-short": "^5.0.0",
8181
"prettier": "^2.1.1",
8282
"sass": "^1.26.10",

src/utils.js

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ function pluginFactory() {
127127
const [name, options] = plugin;
128128

129129
listOfPlugins.set(name, options);
130+
} else if (plugin && typeof plugin === 'function') {
131+
listOfPlugins.set(plugin);
130132
} else if (
131133
plugin &&
132134
Object.keys(plugin).length === 1 &&

test/config-autoload.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('autoload config', () => {
7575
expect(loadedConfig.config.to).toEqual(
7676
'./test/fixtures/config-autoload/js/object/expect/index.css'
7777
);
78-
expect(Object.keys(loadedConfig.config.plugins).length).toEqual(2);
78+
expect(Object.keys(loadedConfig.config.plugins).length).toEqual(4);
7979
expect(loadedConfig.filepath).toEqual(
8080
path.resolve(testDirectory, 'js/array', 'postcss.config.js')
8181
);

test/fixtures/config-autoload/js/array/postcss.config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ module.exports = function (api) {
1212
{
1313
// Options
1414
}
15-
]
15+
],
16+
require('postcss-nested'),
17+
require('postcss-nested')({ /* Options */ }),
1618
]
1719
}
1820
};

0 commit comments

Comments
 (0)