@parcel/transformer-css 2.6.2 → 2.7.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/CSSTransformer.js +25 -1
- package/package.json +7 -7
- package/src/CSSTransformer.js +28 -1
package/lib/CSSTransformer.js
CHANGED
|
@@ -105,7 +105,8 @@ var _default = new (_plugin().Transformer)({
|
|
|
105
105
|
async transform({
|
|
106
106
|
asset,
|
|
107
107
|
config,
|
|
108
|
-
options
|
|
108
|
+
options,
|
|
109
|
+
logger
|
|
109
110
|
}) {
|
|
110
111
|
// Normalize the asset's environment so that properties that only affect JS don't cause CSS to be duplicated.
|
|
111
112
|
// For example, with ESModule and CommonJS targets, only a single shared CSS bundle should be produced.
|
|
@@ -128,6 +129,7 @@ var _default = new (_plugin().Transformer)({
|
|
|
128
129
|
res = (0, _css().transformStyleAttribute)({
|
|
129
130
|
code,
|
|
130
131
|
analyzeDependencies: true,
|
|
132
|
+
errorRecovery: (config === null || config === void 0 ? void 0 : config.errorRecovery) || false,
|
|
131
133
|
targets
|
|
132
134
|
});
|
|
133
135
|
} else {
|
|
@@ -153,6 +155,7 @@ var _default = new (_plugin().Transformer)({
|
|
|
153
155
|
sourceMap: !!asset.env.sourceMap,
|
|
154
156
|
drafts: config === null || config === void 0 ? void 0 : config.drafts,
|
|
155
157
|
pseudoClasses: config === null || config === void 0 ? void 0 : config.pseudoClasses,
|
|
158
|
+
errorRecovery: (config === null || config === void 0 ? void 0 : config.errorRecovery) || false,
|
|
156
159
|
targets
|
|
157
160
|
});
|
|
158
161
|
}
|
|
@@ -175,6 +178,27 @@ var _default = new (_plugin().Transformer)({
|
|
|
175
178
|
});
|
|
176
179
|
}
|
|
177
180
|
|
|
181
|
+
if (res.warnings) {
|
|
182
|
+
for (let warning of res.warnings) {
|
|
183
|
+
logger.warn({
|
|
184
|
+
message: warning.message,
|
|
185
|
+
codeFrames: [{
|
|
186
|
+
filePath: asset.filePath,
|
|
187
|
+
codeHighlights: [{
|
|
188
|
+
start: {
|
|
189
|
+
line: warning.loc.line,
|
|
190
|
+
column: warning.loc.column
|
|
191
|
+
},
|
|
192
|
+
end: {
|
|
193
|
+
line: warning.loc.line,
|
|
194
|
+
column: warning.loc.column
|
|
195
|
+
}
|
|
196
|
+
}]
|
|
197
|
+
}]
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
178
202
|
asset.setBuffer(res.code);
|
|
179
203
|
|
|
180
204
|
if (res.map != null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/transformer-css",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"source": "src/CSSTransformer.js",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 12.0.0",
|
|
20
|
-
"parcel": "^2.
|
|
20
|
+
"parcel": "^2.7.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/css": "^1.
|
|
24
|
-
"@parcel/diagnostic": "2.
|
|
25
|
-
"@parcel/plugin": "2.
|
|
23
|
+
"@parcel/css": "^1.12.2",
|
|
24
|
+
"@parcel/diagnostic": "2.7.0",
|
|
25
|
+
"@parcel/plugin": "2.7.0",
|
|
26
26
|
"@parcel/source-map": "^2.0.0",
|
|
27
|
-
"@parcel/utils": "2.
|
|
27
|
+
"@parcel/utils": "2.7.0",
|
|
28
28
|
"browserslist": "^4.6.6",
|
|
29
29
|
"nullthrows": "^1.1.1"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "9e5d05586577e89991ccf90400f2c741dca11aa3"
|
|
32
32
|
}
|
package/src/CSSTransformer.js
CHANGED
|
@@ -20,7 +20,7 @@ export default (new Transformer({
|
|
|
20
20
|
});
|
|
21
21
|
return conf?.contents;
|
|
22
22
|
},
|
|
23
|
-
async transform({asset, config, options}) {
|
|
23
|
+
async transform({asset, config, options, logger}) {
|
|
24
24
|
// Normalize the asset's environment so that properties that only affect JS don't cause CSS to be duplicated.
|
|
25
25
|
// For example, with ESModule and CommonJS targets, only a single shared CSS bundle should be produced.
|
|
26
26
|
let env = asset.env;
|
|
@@ -46,6 +46,7 @@ export default (new Transformer({
|
|
|
46
46
|
res = transformStyleAttribute({
|
|
47
47
|
code,
|
|
48
48
|
analyzeDependencies: true,
|
|
49
|
+
errorRecovery: config?.errorRecovery || false,
|
|
49
50
|
targets,
|
|
50
51
|
});
|
|
51
52
|
} else {
|
|
@@ -77,6 +78,7 @@ export default (new Transformer({
|
|
|
77
78
|
sourceMap: !!asset.env.sourceMap,
|
|
78
79
|
drafts: config?.drafts,
|
|
79
80
|
pseudoClasses: config?.pseudoClasses,
|
|
81
|
+
errorRecovery: config?.errorRecovery || false,
|
|
80
82
|
targets,
|
|
81
83
|
});
|
|
82
84
|
}
|
|
@@ -103,6 +105,31 @@ export default (new Transformer({
|
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
if (res.warnings) {
|
|
109
|
+
for (let warning of res.warnings) {
|
|
110
|
+
logger.warn({
|
|
111
|
+
message: warning.message,
|
|
112
|
+
codeFrames: [
|
|
113
|
+
{
|
|
114
|
+
filePath: asset.filePath,
|
|
115
|
+
codeHighlights: [
|
|
116
|
+
{
|
|
117
|
+
start: {
|
|
118
|
+
line: warning.loc.line,
|
|
119
|
+
column: warning.loc.column,
|
|
120
|
+
},
|
|
121
|
+
end: {
|
|
122
|
+
line: warning.loc.line,
|
|
123
|
+
column: warning.loc.column,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
106
133
|
asset.setBuffer(res.code);
|
|
107
134
|
|
|
108
135
|
if (res.map != null) {
|