Skip to content

Commit 3c770b6

Browse files
authored
Upgrade to postcss 8, update dependencies (#15)
* Upgrade to postcss 8 * remove prettier related code
1 parent 2a77465 commit 3c770b6

File tree

6 files changed

+170
-184
lines changed

6 files changed

+170
-184
lines changed

.rollup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import babel from 'rollup-plugin-babel';
33
export default {
44
input: 'src/index.js',
55
output: [
6-
{ file: 'index.js', format: 'cjs', sourcemap: true, strict: false },
7-
{ file: 'index.mjs', format: 'esm', sourcemap: true, strict: false }
6+
{ file: 'index.js', format: 'cjs', sourcemap: true, strict: false, exports: 'auto' },
7+
{ file: 'index.mjs', format: 'esm', sourcemap: true, strict: false, exports: 'auto' }
88
],
99
plugins: [
1010
babel({
1111
presets: [
12-
['@babel/env', { modules: false, targets: { node: 8 } }]
12+
['@babel/env', { modules: false, targets: { node: 12 } }]
1313
]
1414
})
1515
]

.tape.js

Lines changed: 70 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -3,104 +3,80 @@ const postcssNesting = require('postcss-nesting');
33
const postcssExtends = require('.');
44

55
module.exports = {
6-
'basic': {
7-
message: 'supports @extend usage'
6+
'basic': {
7+
message: 'supports @extend usage'
8+
},
9+
'basic:name': {
10+
message: 'ignores @extend usage when { name: "postcss-extend" }',
11+
options: {
12+
name: 'postcss-extend'
813
},
9-
'basic:name': {
10-
message: 'ignores @extend usage when { name: "postcss-extend" }',
11-
options: {
12-
name: 'postcss-extend'
13-
},
14-
expect: 'basic.css'
14+
expect: 'basic.css'
15+
},
16+
'basic-postcss-name': {
17+
message: 'supports @postcss-extend when { name: "postcss-extend" }',
18+
options: {
19+
name: 'postcss-extend'
1520
},
16-
'basic-postcss-name': {
17-
message: 'supports @postcss-extend when { name: "postcss-extend" }',
18-
options: {
19-
name: 'postcss-extend'
20-
},
21-
expect: 'basic.expect.css'
22-
},
23-
'basic.button': {
24-
message: 'supports @extend usage with same tag name and class name',
25-
expect: 'basic.button.expect.css'
26-
},
27-
'advanced': {
28-
message: 'supports mixed usage (with postcss-nesting)',
29-
plugin: postcss.plugin('postcss-extend-rule', () => {
30-
const extendsTransformer = postcssExtends();
31-
const nestingTransformer = postcssNesting();
32-
33-
return (...args) => {
34-
nestingTransformer(...args);
35-
extendsTransformer(...args);
36-
};
37-
})
38-
},
39-
'nested-media': {
40-
'message': 'supports nested @media usage'
41-
},
42-
'nested-media:nesting-first': {
43-
'message': 'supports nested @media usage when postcss-nesting runs first',
44-
plugin: postcss.plugin('postcss-extend-rule', () => {
45-
const extendsTransformer = postcssExtends();
46-
const nestingTransformer = postcssNesting();
47-
48-
return (...args) => {
49-
nestingTransformer(...args);
50-
extendsTransformer(...args);
51-
};
52-
})
53-
},
54-
'nested-media:nesting-second': {
55-
'message': 'supports nested @medi usage when postcss-nesting runs second',
56-
plugin: postcss.plugin('postcss-extend-rule', () => {
57-
const extendsTransformer = postcssExtends();
58-
const nestingTransformer = postcssNesting();
59-
60-
return (...args) => {
61-
extendsTransformer(...args);
62-
nestingTransformer(...args);
63-
};
64-
})
65-
},
66-
'error': {
67-
message: 'manages error-ridden usage'
68-
},
69-
'error:ignore': {
70-
message: 'manages error-ridden usage with { onFunctionalSelector: "ignore", onRecursiveExtend: "ignore", onUnusedExtend: "ignore" } options',
71-
options: {
72-
onFunctionalSelector: 'ignore',
73-
onRecursiveExtend: 'ignore',
74-
onUnusedExtend: 'ignore'
75-
}
21+
expect: 'basic.expect.css'
22+
},
23+
'basic.button': {
24+
message: 'supports @extend usage with same tag name and class name',
25+
expect: 'basic.button.expect.css'
26+
},
27+
'advanced': {
28+
message: 'supports mixed usage (with postcss-nesting)',
29+
plugin: postcss(postcssNesting, postcssExtends)
30+
},
31+
'nested-media': {
32+
'message': 'supports nested @media usage'
33+
},
34+
'nested-media:nesting-first': {
35+
'message': 'supports nested @media usage when postcss-nesting runs first',
36+
plugin: postcss(postcssNesting, postcssExtends)
37+
},
38+
'nested-media:nesting-second': {
39+
'message': 'supports nested @media usage when postcss-nesting runs second',
40+
plugin: postcss(postcssExtends, postcssNesting)
41+
},
42+
'error': {
43+
message: 'manages error-ridden usage'
44+
},
45+
'error:ignore': {
46+
message: 'manages error-ridden usage with { onFunctionalSelector: "ignore", onRecursiveExtend: "ignore", onUnusedExtend: "ignore" } options',
47+
options: {
48+
onFunctionalSelector: 'ignore',
49+
onRecursiveExtend: 'ignore',
50+
onUnusedExtend: 'ignore'
51+
}
52+
},
53+
'error:warn': {
54+
message: 'manages error-ridden usage with { onFunctionalSelector: "warn", onRecursiveExtend: "warn", onUnusedExtend: "warn" } options',
55+
options: {
56+
onFunctionalSelector: 'warn',
57+
onRecursiveExtend: 'warn',
58+
onUnusedExtend: 'warn'
7659
},
77-
'error:warn': {
78-
message: 'manages error-ridden usage with { onFunctionalSelector: "warn", onRecursiveExtend: "warn", onUnusedExtend: "warn" } options',
79-
options: {
80-
onFunctionalSelector: 'warn',
81-
onRecursiveExtend: 'warn',
82-
onUnusedExtend: 'warn'
83-
},
84-
warnings: 2
60+
warnings: 2
61+
},
62+
'error:throw': {
63+
message: 'manages error-ridden usage with { onFunctionalSelector: "throw", onRecursiveExtend: "throw", onUnusedExtend: "throw" } options',
64+
options: {
65+
onFunctionalSelector: 'throw',
66+
onRecursiveExtend: 'throw',
67+
onUnusedExtend: 'throw'
8568
},
86-
'error:throw': {
87-
message: 'manages error-ridden usage with { onFunctionalSelector: "throw", onRecursiveExtend: "throw", onUnusedExtend: "throw" } options',
88-
options: {
89-
onFunctionalSelector: 'throw',
90-
onRecursiveExtend: 'throw',
91-
onUnusedExtend: 'throw'
92-
},
93-
error: {
94-
reason: 'Unused extend at-rule "some-non-existent-selector"'
95-
}
69+
error: {
70+
reason: 'Unused extend at-rule "some-non-existent-selector"'
71+
}
72+
},
73+
'error:throw-on-functional-selectors': {
74+
message: 'manages error-ridden usage with { onFunctionalSelector: "throw" } options',
75+
options: {
76+
onFunctionalSelector: 'throw'
9677
},
97-
'error:throw-on-functional-selectors': {
98-
message: 'manages error-ridden usage with { onFunctionalSelector: "throw" } options',
99-
options: {
100-
onFunctionalSelector: 'throw'
101-
},
102-
error: {
103-
reason: 'Encountered functional selector "%test-placeholder"'
104-
}
78+
error: {
79+
reason: 'Encountered functional selector "%test-placeholder"'
10580
}
81+
}
10682
};

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
language: node_js
44

55
node_js:
6-
- 8
6+
- 12
77

88
install:
99
- npm install --ignore-scripts

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
Add [PostCSS Extend Rule] to your project:
6161

6262
```bash
63-
npm install postcss-extend-rule --save-dev
63+
npm install postcss postcss-extend-rule --save-dev
6464
```
6565

6666
Use **PostCSS Extend Rule** to process your CSS:

package.json

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,27 @@
2424
"test:tape": "postcss-tape"
2525
},
2626
"engines": {
27-
"node": ">=8.0.0"
27+
"node": "^12 || ^14 || >=16"
2828
},
2929
"dependencies": {
30-
"postcss": "^7.0.17",
31-
"postcss-nesting": "^7.0.1",
32-
"postcss-tape": "^5.0.2"
30+
"postcss-nesting": "^10.1.2",
31+
"postcss-tape": "^6.0.1"
3332
},
3433
"devDependencies": {
35-
"@babel/core": "^7.5.5",
36-
"@babel/preset-env": "^7.5.5",
37-
"babel-eslint": "^10.0.2",
38-
"eslint": "^6.1.0",
34+
"@babel/core": "^7.16.12",
35+
"@babel/preset-env": "^7.16.11",
36+
"@babel/eslint-parser": "^7.16.5",
37+
"eslint": "^8.8.0",
38+
"postcss": "^8.4.5",
3939
"pre-commit": "^1.2.2",
40-
"rollup": "^1.17.0",
41-
"rollup-plugin-babel": "^4.3.3"
40+
"rollup": "^2.66.1",
41+
"rollup-plugin-babel": "^4.4.0"
42+
},
43+
"peerDependencies": {
44+
"postcss": "^8.4.5"
45+
},
46+
"postcssConfig": {
47+
"config": ".tape.js"
4248
},
4349
"eslintConfig": {
4450
"env": {
@@ -47,11 +53,12 @@
4753
"node": true
4854
},
4955
"extends": "eslint:recommended",
50-
"parser": "babel-eslint",
56+
"parser": "@babel/eslint-parser",
5157
"parserOptions": {
5258
"ecmaVersion": 2018,
5359
"impliedStrict": true,
54-
"sourceType": "module"
60+
"sourceType": "module",
61+
"requireConfigFile": false
5562
},
5663
"root": true
5764
},

0 commit comments

Comments
 (0)