Skip to content

Commit cd45499

Browse files
authored
Merge pull request #235 from salsify/postcss-8
2 parents 31651a5 + dd4df03 commit cd45499

File tree

13 files changed

+250
-118
lines changed

13 files changed

+250
-118
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## Unreleased
2+
### Added
3+
- We now support a wider range of dependencies that includes PostCSS 8 out of the box. Depending on your package manager, you'll likely see this upgrade take effect automatically when you update ECM, and you may see deprecation warnings for any older PostCSS plugins you're using.
4+
5+
### Upgrade Notes
6+
If you're using older PostCSS plugins or an older Node version and wish to continue using PostCSS 7, the appropriate dependency versions are still in range for ECM, and we still run tests against them. The easiest way to lock to those versions locally is likely with `resolutions` entries, which you can see [an example of](test-packages/old-app/package.json) in `test-package/old-app`.
7+
8+
```json
9+
"resolutions": {
10+
"ember-css-modules/broccoli-css-modules": "^0.7.0",
11+
"ember-css-modules/broccoli-postcss": "^4.0.3",
12+
"ember-css-modules/postcss": "^7.0.35"
13+
},
14+
```
15+
116
## 1.3.4 (February 2, 2021)
217
### Fixed
318
- Ensure styles from addons that define a custom `moduleName` use correct import paths ([#220](https://github.com/salsify/ember-css-modules/pull/220); thank you [@timlindvall](https://github.com/timlindvall)!)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const semver = require('semver');
2+
const postcssVersion = require('postcss/package.json').version;
3+
4+
if (semver.lt(postcssVersion, '8.0.0')) {
5+
module.exports = require('postcss').plugin;
6+
} else {
7+
module.exports = function(name, callback) {
8+
let plugin = (options = {}) => {
9+
let handler = callback(options);
10+
return {
11+
postcssPlugin: name,
12+
Once: handler
13+
};
14+
};
15+
plugin.postcss = true;
16+
return plugin;
17+
};
18+
}

packages/ember-css-modules/lib/modules-preprocessor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ module.exports = class ModulesPreprocessor {
194194
}
195195

196196
rootPathPlugin() {
197-
return require('postcss').plugin('root-path-tag', () => (css) => {
197+
return require('./make-postcss-plugin')('root-path-tag', () => (css) => {
198198
css.source.input.rootPath = this._modulesTree.inputPaths[0];
199199
});
200200
}

packages/ember-css-modules/lib/output-styles-preprocessor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ module.exports = class OutputStylesPreprocessor {
3131
debug('running postprocess plugins: %o', postprocessPlugins);
3232

3333
concat = new PostCSS(concat, {
34-
plugins: postprocessPlugins
34+
plugins: postprocessPlugins,
35+
exclude: ['**/*.map']
3536
});
3637
}
3738

packages/ember-css-modules/lib/postcss-module-order-directive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict';
22

3-
const postcss = require('postcss');
43
const ensurePosixPath = require('ensure-posix-path');
4+
const makePostCSSPlugin = require('./make-postcss-plugin');
55

66
// Report all discovered @after-module rules in a module and strip them out of the source
7-
module.exports = postcss.plugin('ember-css-modules-ordering', (options) => {
7+
module.exports = makePostCSSPlugin('ember-css-modules-ordering', (options) => {
88
return (css) => {
99
let dependencies = [];
1010
let input = css.source.input;

packages/ember-css-modules/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"eslint-plugin-ember": "^5.2.0",
5252
"eslint-plugin-node": "^7.0.1",
5353
"loader.js": "^4.7.0",
54-
"postcss-color-rebeccapurple": "^3.0.0",
54+
"postcss-color-rebeccapurple": "^6.0.0",
5555
"qunit-dom": "^0.7.1",
5656
"qunitjs": "^2.4.1",
5757
"sinon": "^4.3.0",
@@ -71,10 +71,10 @@
7171
"dependencies": {
7272
"broccoli-bridge": "^1.0.0",
7373
"broccoli-concat": "^3.2.2",
74-
"broccoli-css-modules": "^0.7.0",
74+
"broccoli-css-modules": "^0.7.0 || ^0.8.0",
7575
"broccoli-funnel": "^2.0.1",
7676
"broccoli-merge-trees": "^2.0.0",
77-
"broccoli-postcss": "^4.0.1",
77+
"broccoli-postcss": "^4.0.1 || ^5.0.0 || ^6.0.0",
7878
"calculate-cache-key-for-tree": "^1.1.0",
7979
"debug": "^3.1.0",
8080
"ember-cli-babel": "^7.7.3",
@@ -83,7 +83,7 @@
8383
"ensure-posix-path": "^1.0.2",
8484
"hash-string": "^1.0.0",
8585
"lodash.merge": "^4.6.1",
86-
"postcss": "^6.0.19",
86+
"postcss": "^7.0.35 || ^8.0.0",
8787
"semver": "^5.5.0",
8888
"toposort": "^1.0.6"
8989
},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@value z from './z';
2-
@value x: 'x';
1+
@value zValue from './z';
2+
@value xValue: 'x';
33

44
.x {}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@value x from './x';
2-
@value z from './z';
1+
@value xValue from './x';
2+
@value zValue from './z';
33

44
.y {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
@value z: 'z';
1+
@value zValue: 'z';
22

33
.z {}

test-packages/old-app/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ This test package contains an app set up with the oldest ecosystem components we
55
- `ember-cli-babel@6`
66
77
- `@ember-decorators/babel-transforms@2`
8+
9+
- `broccoli-postcss@4`
10+
- `postcss@7`
811

912
Additionally, the test suite for this app is run under Node 6, as that's the oldest Node version we currently support.
1013
Because of that, it's not part of the yarn workspaces setup at the root of this repo, as many other transitive (development) dependencies have dropped support for older Node versions.

0 commit comments

Comments
 (0)