Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"types/index.d.ts"
],
"scripts": {
"test": "npm run lint && jest",
"test:cov": "npm run lint && jest --coverage",
"test": "npm run lint && npm run test:jest",
"test:cov": "npm run lint && npm run test:jest --coverage",
"test:jest": "NODE_OPTIONS=--experimental-vm-modules jest",
"build": "bili",
"lint": "xo",
"prepublishOnly": "npm run build"
Expand All @@ -28,7 +29,7 @@
"url": "https://github.com/egoist/rollup-plugin-postcss/issues"
},
"engines": {
"node": ">=10"
"node": ">=18"
},
"types": "./types/index.d.ts",
"homepage": "https://github.com/egoist/rollup-plugin-postcss#readme",
Expand All @@ -37,13 +38,13 @@
"@babel/preset-env": "^7.12.7",
"autoprefixer": "^10.0.4",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^26.6.3",
"babel-jest": "^27.5.1",
"bili": "^5.0.5",
"eslint-config-rem": "^4.0.0",
"fs-extra": "^9.0.1",
"jest": "^26.6.3",
"jest": "^27.5.1",
"less": "^3.12.2",
"node-sass": "^5.0.0",
"node-sass": "^9.0.0",
"postcss": "^8.2.7",
"rollup": "^2.34.2",
"stylus": "^0.54.8",
Expand All @@ -57,7 +58,7 @@
"import-cwd": "^3.0.0",
"p-queue": "^6.6.2",
"pify": "^5.0.0",
"postcss-load-config": "^3.0.0",
"postcss-load-config": "^5.0.3",
"postcss-modules": "^4.0.0",
"promise.series": "^0.2.0",
"resolve": "^1.19.0",
Expand Down
35 changes: 35 additions & 0 deletions test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,41 @@ styleInject(css_248z);
"
`;

exports[`basic postcss-config-mjs: js code 1`] = `
"'use strict';

function styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;

if (!css || typeof document === 'undefined') { return; }

var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';

if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}

if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}

var css_248z = \\"a {\\\\n color: blue\\\\n}\\\\n\\\\n.multiline,\\\\n.selector {\\\\n box-shadow: 1px 0 9px rgba(0, 0, 0, .4),\\\\n 1px 0 3px rgba(0, 0, 0, .6)\\\\n}\\\\n\\";
styleInject(css_248z);
"
`;

exports[`basic postcss-options: js code 1`] = `
"'use strict';

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/postcss-config-mjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './style.sss'
3 changes: 3 additions & 0 deletions test/fixtures/postcss-config-mjs/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
parser: 'sugarss'
}
7 changes: 7 additions & 0 deletions test/fixtures/postcss-config-mjs/style.sss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a
color: blue

.multiline,
.selector
box-shadow: 1px 0 9px rgba(0, 0, 0, .4),
1px 0 3px rgba(0, 0, 0, .6)
4 changes: 4 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ snapshotMany('basic', [
title: 'postcss-config',
input: 'postcss-config/index.js'
},
{
title: 'postcss-config-mjs',
input: 'postcss-config-mjs/index.js'
},
{
title: 'skip-loader',
input: 'skip-loader/index.js',
Expand Down
Loading