Skip to content

Commit 9e9557b

Browse files
authored
flip enableClientSidePolyfills (#528)
1 parent 724cb41 commit 9e9557b

28 files changed

+8
-405
lines changed

plugin-packs/postcss-preset-env/.tape.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ postcssTape(plugin)({
238238
}
239239
}
240240
},
241-
'disable-client-side-polyfills': {
241+
'enable-client-side-polyfills': {
242242
message: 'supports { enableClientSidePolyfills: false } usage',
243243
options: {
244244
enableClientSidePolyfills: false,
245245
stage: 0,
246246
}
247247
},
248-
'disable-client-side-polyfills:disabled': {
248+
'enable-client-side-polyfills:enabled': {
249249
message: 'supports { enableClientSidePolyfills: true } usage (default)',
250250
options: {
251251
enableClientSidePolyfills: true,

plugin-packs/postcss-preset-env/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ The `debug` option enables debugging messages to stdout which should be useful t
460460

461461
### enableClientSidePolyfills
462462

463-
The `enableClientSidePolyfills` enables any feature that would need an extra browser library to be loaded into the page for it to work. Defaults to `true`.
463+
The `enableClientSidePolyfills` enables any feature that would need an extra browser library to be loaded into the page for it to work. Defaults to `false`.
464464

465465
Note that manually enabling/disabling features via the "feature" option overrides this flag.
466466

plugin-packs/postcss-preset-env/src/lib/list-features.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { insertAfterKey, insertBeforeKey } from '../own-keys/keys.mjs';
1111
export function listFeatures(cssdbList, options, sharedOptions, logger) {
1212
// initialize options
1313
const features = Object(options.features);
14-
const enableClientSidePolyfills = 'enableClientSidePolyfills' in options ? options.enableClientSidePolyfills : true;
14+
const enableClientSidePolyfills = 'enableClientSidePolyfills' in options ? options.enableClientSidePolyfills : false;
1515
const insertBefore = Object(options.insertBefore);
1616
const insertAfter = Object(options.insertAfter);
1717
const browsers = options.browsers;

plugin-packs/postcss-preset-env/src/test/lib/list-features/preserve.mjs

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,6 @@ assert.deepStrictEqual(
2929
},
3030
id: 'any-link-pseudo-class',
3131
},
32-
{
33-
browsers: [
34-
'and_chr >= 1', 'and_ff >= 1',
35-
'and_qq >= 1', 'and_uc >= 1',
36-
'android >= 1', 'baidu >= 1',
37-
'chrome >= 1', 'edge >= 1',
38-
'firefox >= 1', 'ie >= 1',
39-
'ie_mob >= 1', 'ios_saf >= 1',
40-
'kaios >= 1', 'op_mini all',
41-
'op_mob >= 1', 'opera >= 1',
42-
'safari >= 1', 'samsung >= 1',
43-
],
44-
vendors_implementations: 0,
45-
pluginOptions: { preserve: true, enableProgressiveCustomProperties: false },
46-
id: 'blank-pseudo-class',
47-
},
4832
],
4933
);
5034

@@ -53,6 +37,7 @@ assert.deepStrictEqual(
5337
testLogger.getLogs(),
5438
[
5539
'Using features from Stage 0',
40+
' blank-pseudo-class has been disabled by "enableClientSidePolyfills: false".',
5641
'Adding area[href] fallbacks for ":any-link" support in Edge and IE.',
5742
],
5843
);
@@ -82,22 +67,6 @@ assert.deepStrictEqual(
8267
},
8368
id: 'any-link-pseudo-class',
8469
},
85-
{
86-
browsers: [
87-
'and_chr >= 1', 'and_ff >= 1',
88-
'and_qq >= 1', 'and_uc >= 1',
89-
'android >= 1', 'baidu >= 1',
90-
'chrome >= 1', 'edge >= 1',
91-
'firefox >= 1', 'ie >= 1',
92-
'ie_mob >= 1', 'ios_saf >= 1',
93-
'kaios >= 1', 'op_mini all',
94-
'op_mob >= 1', 'opera >= 1',
95-
'safari >= 1', 'samsung >= 1',
96-
],
97-
vendors_implementations: 0,
98-
pluginOptions: { preserve: false, enableProgressiveCustomProperties: false },
99-
id: 'blank-pseudo-class',
100-
},
10170
],
10271
);
10372

@@ -106,6 +75,7 @@ assert.deepStrictEqual(
10675
testLogger.getLogs(),
10776
[
10877
'Using features from Stage 0',
78+
' blank-pseudo-class has been disabled by "enableClientSidePolyfills: false".',
10979
'Adding area[href] fallbacks for ":any-link" support in Edge and IE.',
11080
],
11181
);

plugin-packs/postcss-preset-env/src/test/lib/list-features/stage-0.mjs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,6 @@ assert.deepStrictEqual(
2828
},
2929
id: 'any-link-pseudo-class',
3030
},
31-
{
32-
browsers: [
33-
'and_chr >= 1', 'and_ff >= 1',
34-
'and_qq >= 1', 'and_uc >= 1',
35-
'android >= 1', 'baidu >= 1',
36-
'chrome >= 1', 'edge >= 1',
37-
'firefox >= 1', 'ie >= 1',
38-
'ie_mob >= 1', 'ios_saf >= 1',
39-
'kaios >= 1', 'op_mini all',
40-
'op_mob >= 1', 'opera >= 1',
41-
'safari >= 1', 'samsung >= 1',
42-
],
43-
vendors_implementations: 0,
44-
pluginOptions: { enableProgressiveCustomProperties: false },
45-
id: 'blank-pseudo-class',
46-
},
4731
],
4832
);
4933

@@ -52,6 +36,7 @@ assert.deepStrictEqual(
5236
testLogger.getLogs(),
5337
[
5438
'Using features from Stage 0',
39+
' blank-pseudo-class has been disabled by "enableClientSidePolyfills: false".',
5540
'Adding area[href] fallbacks for ":any-link" support in Edge and IE.',
5641
],
5742
);

plugin-packs/postcss-preset-env/src/test/lib/list-features/vendor-implementations.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ assert.deepStrictEqual(
154154
'Using features with 2 or more vendor implementations',
155155
'Using features from Stage 0',
156156
' blank-pseudo-class does not meet the required vendor implementations but has been enabled by options',
157+
' blank-pseudo-class has been disabled by "enableClientSidePolyfills: false".',
157158
'Adding area[href] fallbacks for ":any-link" support in Edge and IE.',
158159
],
159160
);

plugin-packs/postcss-preset-env/test/basic.autoprefixer.expect.css

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@
7777
}
7878
}
7979

80-
@media (color: 48842621) {
81-
body {
82-
background-color: black;
83-
color: white;
84-
}
85-
}
86-
8780
@media (prefers-color-scheme: dark) {
8881
body {
8982
background-color: black;
@@ -248,10 +241,6 @@
248241
word-wrap: break-word;
249242
}
250243

251-
.test-focus-visible-pseudo-class.focus-visible.js-focus-visible, .js-focus-visible .test-focus-visible-pseudo-class.focus-visible {
252-
order: 26;
253-
}
254-
255244
.test-focus-visible-pseudo-class:focus-visible {
256245
order: 26;
257246
}
@@ -261,18 +250,10 @@
261250
background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
262251
}
263252

264-
.test-blank-pseudo-class[blank].js-blank-pseudo, .js-blank-pseudo .test-blank-pseudo-class[blank] {
265-
background-color: yellow;
266-
}
267-
268253
.test-blank-pseudo-class:blank {
269254
background-color: yellow;
270255
}
271256

272-
.js-has-pseudo [csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
273-
background-color: yellow;
274-
}
275-
276257
.test-has-pseudo-class:has(.inner-class) {
277258
background-color: yellow;
278259
}

plugin-packs/postcss-preset-env/test/basic.autoprefixer.false.expect.css

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@
7777
}
7878
}
7979

80-
@media (color: 48842621) {
81-
body {
82-
background-color: black;
83-
color: white;
84-
}
85-
}
86-
8780
@media (prefers-color-scheme: dark) {
8881
body {
8982
background-color: black;
@@ -248,10 +241,6 @@
248241
word-wrap: break-word;
249242
}
250243

251-
.test-focus-visible-pseudo-class.focus-visible.js-focus-visible, .js-focus-visible .test-focus-visible-pseudo-class.focus-visible {
252-
order: 26;
253-
}
254-
255244
.test-focus-visible-pseudo-class:focus-visible {
256245
order: 26;
257246
}
@@ -261,18 +250,10 @@
261250
background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
262251
}
263252

264-
.test-blank-pseudo-class[blank].js-blank-pseudo, .js-blank-pseudo .test-blank-pseudo-class[blank] {
265-
background-color: yellow;
266-
}
267-
268253
.test-blank-pseudo-class:blank {
269254
background-color: yellow;
270255
}
271256

272-
.js-has-pseudo [csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
273-
background-color: yellow;
274-
}
275-
276257
.test-has-pseudo-class:has(.inner-class) {
277258
background-color: yellow;
278259
}

plugin-packs/postcss-preset-env/test/basic.ch38.expect.css

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@
7878
}
7979
}
8080

81-
@media (color: 48842621) {
82-
body {
83-
background-color: black;
84-
color: white;
85-
}
86-
}
87-
8881
@media (prefers-color-scheme: dark) {
8982
body {
9083
background-color: black;
@@ -168,10 +161,6 @@
168161
overflow-wrap: break-word;
169162
}
170163

171-
.test-focus-visible-pseudo-class.focus-visible.js-focus-visible, .js-focus-visible .test-focus-visible-pseudo-class.focus-visible {
172-
order: 26;
173-
}
174-
175164
.test-focus-visible-pseudo-class:focus-visible {
176165
order: 26;
177166
}
@@ -181,18 +170,10 @@
181170
background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
182171
}
183172

184-
.test-blank-pseudo-class[blank].js-blank-pseudo, .js-blank-pseudo .test-blank-pseudo-class[blank] {
185-
background-color: yellow;
186-
}
187-
188173
.test-blank-pseudo-class:blank {
189174
background-color: yellow;
190175
}
191176

192-
.js-has-pseudo [csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
193-
background-color: yellow;
194-
}
195-
196177
.test-has-pseudo-class:has(.inner-class) {
197178
background-color: yellow;
198179
}

plugin-packs/postcss-preset-env/test/basic.ch88-ff78-saf10.expect.css

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,6 @@
8484
}
8585
}
8686

87-
@media (color: 48842621) {
88-
body {
89-
background-color: black;
90-
color: white;
91-
}
92-
}
93-
9487
@media (prefers-color-scheme: dark) {
9588
body {
9689
background-color: black;
@@ -167,10 +160,6 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
167160
overflow-wrap: break-word;
168161
}
169162

170-
.test-focus-visible-pseudo-class.focus-visible.js-focus-visible, .js-focus-visible .test-focus-visible-pseudo-class.focus-visible {
171-
order: 26;
172-
}
173-
174163
.test-focus-visible-pseudo-class:focus-visible {
175164
order: 26;
176165
}
@@ -180,18 +169,10 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
180169
background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
181170
}
182171

183-
.test-blank-pseudo-class[blank].js-blank-pseudo, .js-blank-pseudo .test-blank-pseudo-class[blank] {
184-
background-color: yellow;
185-
}
186-
187172
.test-blank-pseudo-class:blank {
188173
background-color: yellow;
189174
}
190175

191-
.js-has-pseudo [csstools-has-1a-38-2t-37-38-19-2w-2p-37-19-34-37-2t-39-2s-33-19-2r-30-2p-37-37-1m-2w-2p-37-14-1a-2x-32-32-2t-36-19-2r-30-2p-37-37-15]:not(.does-not-exist) {
192-
background-color: yellow;
193-
}
194-
195176
.test-has-pseudo-class:has(.inner-class) {
196177
background-color: yellow;
197178
}

0 commit comments

Comments
 (0)