diff --git a/package.json b/package.json index 6a8f312..93f2f0a 100644 --- a/package.json +++ b/package.json @@ -26,14 +26,15 @@ "rollup-plugin-json": "^4.0.0", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-postcss": "^4.0.1", "sinon": "^11.1.1", - "subfont": "^6.2.0", + "subfont": "^6.3.1", "unexpected": "^12.0.0", "unexpected-dom": "^5.0.0", "unexpected-resemble": "^5.0.0", "unexpected-sinon": "^11.0.0", "urltools": "^0.4.1", - "webpack": "^4.43.0" + "webpack": "^5.59.1" }, "files": [ "dist", diff --git a/rollup-plugin-postcss.js b/rollup-plugin-postcss.js deleted file mode 100644 index 5ab5f70..0000000 --- a/rollup-plugin-postcss.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; - -const path = require('path'); - -const webpack = require('webpack'); -const MemoryFS = require('memory-fs'); - -const postcss = require.resolve('postcss'); - -module.exports = () => ({ - name: 'rollup-plugin-postcss', - - load(id) { - if (id !== postcss) { - return null; - } - - const memfs = new MemoryFS(); - const compiler = webpack({ - entry: 'postcss', - - output: { - path: __dirname, - filename: 'postcss.js', - library: 'postcss', - libraryTarget: 'commonjs2', - }, - }); - - // Write files to memory, not disk - compiler.outputFileSystem = memfs; - - return new Promise((resolve, reject) => { - compiler.run((err, stats) => { - if (err || stats.hasErrors()) { - if (err) { - return reject(err); - } - - const info = stats.toJson(); - - return reject(info.errors); - } - - return resolve({ - code: memfs.readFileSync( - path.join(__dirname, './postcss.js'), - 'utf8' - ), - - // TODO: figure out source map - }); - }); - }); - }, -}); diff --git a/rollup.config.js b/rollup.config.js index 8045174..8d2dad5 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -8,6 +8,6 @@ module.exports = { }), require('rollup-plugin-node-globals')(), // https://gist.github.com/tivac/d3dd0142e7c52d0d0a5a05b6686340e3 - require('./rollup-plugin-postcss')(), + require('rollup-plugin-postcss')(), ], };