@parcel/transformer-postcss 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/PostCSSTransformer.js +4 -0
- package/lib/loadConfig.js +4 -2
- package/package.json +7 -7
- package/src/PostCSSTransformer.js +3 -0
- package/src/loadConfig.js +4 -2
|
@@ -190,6 +190,10 @@ var _default = new (_plugin().Transformer)({
|
|
|
190
190
|
hint = (0, _diagnostic().md)`Remove the "postcss-modules" plugin from __${filename}__`;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
if (filename === 'package.json') {
|
|
194
|
+
configKey = `/postcss${configKey}`;
|
|
195
|
+
}
|
|
196
|
+
|
|
193
197
|
let hints = ['Enable the "cssModules" option for "@parcel/transformer-css" in your package.json'];
|
|
194
198
|
|
|
195
199
|
if (plugins.length === 0) {
|
package/lib/loadConfig.js
CHANGED
|
@@ -100,10 +100,11 @@ async function configHydrator(configFile, config, resolveFrom, options, logger)
|
|
|
100
100
|
if (redundantPlugins.length > 0) {
|
|
101
101
|
let filename = _path().default.basename(resolveFrom);
|
|
102
102
|
|
|
103
|
+
let isPackageJson = filename === 'package.json';
|
|
103
104
|
let message;
|
|
104
105
|
let hints = [];
|
|
105
106
|
|
|
106
|
-
if (redundantPlugins.length === pluginArray.length) {
|
|
107
|
+
if (!isPackageJson && redundantPlugins.length === pluginArray.length) {
|
|
107
108
|
message = (0, _diagnostic().md)`Parcel includes CSS transpilation and vendor prefixing by default. PostCSS config __${filename}__ contains only redundant plugins. Deleting it may significantly improve build performance.`;
|
|
108
109
|
hints.push((0, _diagnostic().md)`Delete __${filename}__`);
|
|
109
110
|
} else {
|
|
@@ -115,12 +116,13 @@ async function configHydrator(configFile, config, resolveFrom, options, logger)
|
|
|
115
116
|
|
|
116
117
|
if (_path().default.extname(filename) !== '.js') {
|
|
117
118
|
let contents = await options.inputFS.readFile(resolveFrom, 'utf8');
|
|
119
|
+
let prefix = isPackageJson ? '/postcss' : '';
|
|
118
120
|
codeFrames = [{
|
|
119
121
|
language: 'json',
|
|
120
122
|
filePath: resolveFrom,
|
|
121
123
|
code: contents,
|
|
122
124
|
codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(contents, redundantPlugins.map(plugin => ({
|
|
123
|
-
key:
|
|
125
|
+
key: `${prefix}/plugins/${plugin}`,
|
|
124
126
|
type: 'key'
|
|
125
127
|
})))
|
|
126
128
|
}];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/transformer-postcss",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"source": "src/PostCSSTransformer.js",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 12.0.0",
|
|
20
|
-
"parcel": "^2.
|
|
20
|
+
"parcel": "^2.6.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/diagnostic": "2.
|
|
24
|
-
"@parcel/hash": "2.
|
|
25
|
-
"@parcel/plugin": "2.
|
|
26
|
-
"@parcel/utils": "2.
|
|
23
|
+
"@parcel/diagnostic": "2.6.0",
|
|
24
|
+
"@parcel/hash": "2.6.0",
|
|
25
|
+
"@parcel/plugin": "2.6.0",
|
|
26
|
+
"@parcel/utils": "2.6.0",
|
|
27
27
|
"clone": "^2.1.1",
|
|
28
28
|
"nullthrows": "^1.1.1",
|
|
29
29
|
"postcss-value-parser": "^4.2.0",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"postcss": "^8.4.5",
|
|
34
34
|
"postcss-modules": "^4.3.1"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "f2d0a3a27d6e493b23ddc2edbc8a4c0053ff34ab"
|
|
37
37
|
}
|
|
@@ -101,6 +101,9 @@ export default (new Transformer({
|
|
|
101
101
|
configKey = '/plugins/postcss-modules';
|
|
102
102
|
hint = md`Remove the "postcss-modules" plugin from __${filename}__`;
|
|
103
103
|
}
|
|
104
|
+
if (filename === 'package.json') {
|
|
105
|
+
configKey = `/postcss${configKey}`;
|
|
106
|
+
}
|
|
104
107
|
|
|
105
108
|
let hints = [
|
|
106
109
|
'Enable the "cssModules" option for "@parcel/transformer-css" in your package.json',
|
package/src/loadConfig.js
CHANGED
|
@@ -79,9 +79,10 @@ async function configHydrator(
|
|
|
79
79
|
);
|
|
80
80
|
if (redundantPlugins.length > 0) {
|
|
81
81
|
let filename = path.basename(resolveFrom);
|
|
82
|
+
let isPackageJson = filename === 'package.json';
|
|
82
83
|
let message;
|
|
83
84
|
let hints = [];
|
|
84
|
-
if (redundantPlugins.length === pluginArray.length) {
|
|
85
|
+
if (!isPackageJson && redundantPlugins.length === pluginArray.length) {
|
|
85
86
|
message = md`Parcel includes CSS transpilation and vendor prefixing by default. PostCSS config __${filename}__ contains only redundant plugins. Deleting it may significantly improve build performance.`;
|
|
86
87
|
hints.push(md`Delete __${filename}__`);
|
|
87
88
|
} else {
|
|
@@ -96,6 +97,7 @@ async function configHydrator(
|
|
|
96
97
|
let codeFrames;
|
|
97
98
|
if (path.extname(filename) !== '.js') {
|
|
98
99
|
let contents = await options.inputFS.readFile(resolveFrom, 'utf8');
|
|
100
|
+
let prefix = isPackageJson ? '/postcss' : '';
|
|
99
101
|
codeFrames = [
|
|
100
102
|
{
|
|
101
103
|
language: 'json',
|
|
@@ -104,7 +106,7 @@ async function configHydrator(
|
|
|
104
106
|
codeHighlights: generateJSONCodeHighlights(
|
|
105
107
|
contents,
|
|
106
108
|
redundantPlugins.map(plugin => ({
|
|
107
|
-
key:
|
|
109
|
+
key: `${prefix}/plugins/${plugin}`,
|
|
108
110
|
type: 'key',
|
|
109
111
|
})),
|
|
110
112
|
),
|