@parcel/transformer-css 2.13.3 → 2.14.1
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 +21 -6
- package/package.json +6 -6
- package/src/CSSTransformer.js +22 -2
package/lib/CSSTransformer.js
CHANGED
|
@@ -98,9 +98,20 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
98
98
|
}) {
|
|
99
99
|
// Normalize the asset's environment so that properties that only affect JS don't cause CSS to be duplicated.
|
|
100
100
|
// For example, with ESModule and CommonJS targets, only a single shared CSS bundle should be produced.
|
|
101
|
-
let env =
|
|
101
|
+
let env = {
|
|
102
|
+
context: asset.env.context,
|
|
103
|
+
outputFormat: asset.env.outputFormat,
|
|
104
|
+
engines: asset.env.engines,
|
|
105
|
+
includeNodeModules: asset.env.includeNodeModules,
|
|
106
|
+
sourceType: asset.env.sourceType,
|
|
107
|
+
isLibrary: asset.env.isLibrary,
|
|
108
|
+
shouldOptimize: asset.env.shouldOptimize,
|
|
109
|
+
shouldScopeHoist: asset.env.shouldScopeHoist,
|
|
110
|
+
sourceMap: asset.env.sourceMap,
|
|
111
|
+
loc: asset.env.loc
|
|
112
|
+
};
|
|
102
113
|
asset.setEnvironment({
|
|
103
|
-
context: 'browser',
|
|
114
|
+
context: asset.env.context === 'react-server' || asset.env.context === 'react-client' ? 'react-client' : 'browser',
|
|
104
115
|
engines: {
|
|
105
116
|
browsers: asset.env.engines.browsers
|
|
106
117
|
},
|
|
@@ -271,7 +282,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
271
282
|
local: ref.name,
|
|
272
283
|
isWeak: false,
|
|
273
284
|
loc: null
|
|
274
|
-
}]])
|
|
285
|
+
}]]),
|
|
286
|
+
env
|
|
275
287
|
});
|
|
276
288
|
} else if (ref.type === 'global') {
|
|
277
289
|
s += ref.name;
|
|
@@ -285,7 +297,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
285
297
|
asset.addDependency({
|
|
286
298
|
specifier: ref.specifier,
|
|
287
299
|
specifierType: 'esm',
|
|
288
|
-
packageConditions: ['style']
|
|
300
|
+
packageConditions: ['style'],
|
|
301
|
+
env
|
|
289
302
|
});
|
|
290
303
|
}
|
|
291
304
|
s += '${' + `${d}[${JSON.stringify(ref.name)}]` + '}';
|
|
@@ -304,7 +317,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
304
317
|
local: exports[key].name,
|
|
305
318
|
isWeak: false,
|
|
306
319
|
loc: null
|
|
307
|
-
}]])
|
|
320
|
+
}]]),
|
|
321
|
+
env
|
|
308
322
|
});
|
|
309
323
|
}
|
|
310
324
|
js += s;
|
|
@@ -339,7 +353,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
339
353
|
local: symbol,
|
|
340
354
|
isWeak: false,
|
|
341
355
|
loc: null
|
|
342
|
-
}]])
|
|
356
|
+
}]]),
|
|
357
|
+
env
|
|
343
358
|
});
|
|
344
359
|
asset.meta.hasReferences = true;
|
|
345
360
|
cssImports += `@import "${reference.specifier}";\n`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/transformer-css",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"source": "src/CSSTransformer.js",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 16.0.0",
|
|
20
|
-
"parcel": "^2.
|
|
20
|
+
"parcel": "^2.14.1"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/diagnostic": "2.
|
|
24
|
-
"@parcel/plugin": "2.
|
|
23
|
+
"@parcel/diagnostic": "2.14.1",
|
|
24
|
+
"@parcel/plugin": "2.14.1",
|
|
25
25
|
"@parcel/source-map": "^2.1.1",
|
|
26
|
-
"@parcel/utils": "2.
|
|
26
|
+
"@parcel/utils": "2.14.1",
|
|
27
27
|
"browserslist": "^4.6.6",
|
|
28
28
|
"lightningcss": "^1.22.1",
|
|
29
29
|
"nullthrows": "^1.1.1"
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"browser": {
|
|
35
35
|
"lightningcss": "lightningcss-wasm"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "86bddb4031136f4b1b76e1a9a4c8a53ff4280b42"
|
|
38
38
|
}
|
package/src/CSSTransformer.js
CHANGED
|
@@ -44,9 +44,25 @@ export default (new Transformer({
|
|
|
44
44
|
async transform({asset, config, options, logger}) {
|
|
45
45
|
// Normalize the asset's environment so that properties that only affect JS don't cause CSS to be duplicated.
|
|
46
46
|
// For example, with ESModule and CommonJS targets, only a single shared CSS bundle should be produced.
|
|
47
|
-
let env =
|
|
47
|
+
let env = {
|
|
48
|
+
context: asset.env.context,
|
|
49
|
+
outputFormat: asset.env.outputFormat,
|
|
50
|
+
engines: asset.env.engines,
|
|
51
|
+
includeNodeModules: asset.env.includeNodeModules,
|
|
52
|
+
sourceType: asset.env.sourceType,
|
|
53
|
+
isLibrary: asset.env.isLibrary,
|
|
54
|
+
shouldOptimize: asset.env.shouldOptimize,
|
|
55
|
+
shouldScopeHoist: asset.env.shouldScopeHoist,
|
|
56
|
+
sourceMap: asset.env.sourceMap,
|
|
57
|
+
loc: asset.env.loc,
|
|
58
|
+
};
|
|
59
|
+
|
|
48
60
|
asset.setEnvironment({
|
|
49
|
-
context:
|
|
61
|
+
context:
|
|
62
|
+
asset.env.context === 'react-server' ||
|
|
63
|
+
asset.env.context === 'react-client'
|
|
64
|
+
? 'react-client'
|
|
65
|
+
: 'browser',
|
|
50
66
|
engines: {
|
|
51
67
|
browsers: asset.env.engines.browsers,
|
|
52
68
|
},
|
|
@@ -268,6 +284,7 @@ export default (new Transformer({
|
|
|
268
284
|
symbols: new Map([
|
|
269
285
|
[exported, {local: ref.name, isWeak: false, loc: null}],
|
|
270
286
|
]),
|
|
287
|
+
env,
|
|
271
288
|
});
|
|
272
289
|
} else if (ref.type === 'global') {
|
|
273
290
|
s += ref.name;
|
|
@@ -284,6 +301,7 @@ export default (new Transformer({
|
|
|
284
301
|
specifier: ref.specifier,
|
|
285
302
|
specifierType: 'esm',
|
|
286
303
|
packageConditions: ['style'],
|
|
304
|
+
env,
|
|
287
305
|
});
|
|
288
306
|
}
|
|
289
307
|
s += '${' + `${d}[${JSON.stringify(ref.name)}]` + '}';
|
|
@@ -302,6 +320,7 @@ export default (new Transformer({
|
|
|
302
320
|
symbols: new Map([
|
|
303
321
|
[key, {local: exports[key].name, isWeak: false, loc: null}],
|
|
304
322
|
]),
|
|
323
|
+
env,
|
|
305
324
|
});
|
|
306
325
|
}
|
|
307
326
|
|
|
@@ -338,6 +357,7 @@ export default (new Transformer({
|
|
|
338
357
|
symbols: new Map([
|
|
339
358
|
[reference.name, {local: symbol, isWeak: false, loc: null}],
|
|
340
359
|
]),
|
|
360
|
+
env,
|
|
341
361
|
});
|
|
342
362
|
|
|
343
363
|
asset.meta.hasReferences = true;
|