Skip to content

Commit

Permalink
Merge branch 'master' into chore/deps/scgo
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Mar 13, 2023
2 parents c723695 + 1620757 commit a3ccd12
Show file tree
Hide file tree
Showing 23 changed files with 515 additions and 1,134 deletions.
10 changes: 10 additions & 0 deletions packages/cssnano-preset-advanced/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 5.3.10

### Patch Changes

- fix(postcsss-reduce-initial): fix mask-repeat conversion
fix(postcss-colormin): don't minify colors in src declarations
fix(postcss-merge-rules): do not merge conflicting flex and border properties
- Updated dependencies
- cssnano-preset-default@5.2.14

## 5.3.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cssnano-preset-advanced/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cssnano-preset-advanced",
"version": "5.3.9",
"version": "5.3.10",
"main": "src/index.js",
"types": "types/index.d.ts",
"description": "Advanced optimisations for cssnano; may or may not break your CSS!",
Expand Down

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions packages/cssnano-preset-default/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log

## 5.2.14

### Patch Changes

- fix(postcsss-reduce-initial): fix mask-repeat conversion
fix(postcss-colormin): don't minify colors in src declarations
fix(postcss-merge-rules): do not merge conflicting flex and border properties
- Updated dependencies
- postcss-colormin@5.3.1
- postcss-merge-rules@5.1.4
- postcss-reduce-initial@5.1.2

## 5.2.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cssnano-preset-default/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cssnano-preset-default",
"version": "5.2.13",
"version": "5.2.14",
"main": "src/index.js",
"types": "types/index.d.ts",
"description": "Safe defaults for cssnano which require minimal configuration.",
Expand Down

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions packages/cssnano/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 5.1.15

### Patch Changes

- fix(postcsss-reduce-initial): fix mask-repeat conversion
fix(postcss-colormin): don't minify colors in src declarations
fix(postcss-merge-rules): do not merge conflicting flex and border properties
- Updated dependencies
- cssnano-preset-default@5.2.14

## 5.1.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cssnano/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cssnano",
"version": "5.1.14",
"version": "5.1.15",
"description": "A modular minifier, built on top of the PostCSS ecosystem.",
"main": "src/index.js",
"types": "types/index.d.ts",
Expand Down
6 changes: 6 additions & 0 deletions packages/postcss-colormin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 5.3.1

### Patch Changes

- fix(postcss-colormin): don't minify colors in src declarations

## 5.3.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-colormin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-colormin",
"version": "5.3.0",
"version": "5.3.1",
"description": "Minify colors in your CSS files with PostCSS.",
"main": "src/index.js",
"types": "types/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-colormin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function pluginCreator(config = {}) {
OnceExit(css) {
css.walkDecls((decl) => {
if (
/^(composes|font|filter|-webkit-tap-highlight-color)/i.test(
/^(composes|font|src$|filter|-webkit-tap-highlight-color)/i.test(
decl.prop
)
) {
Expand Down
6 changes: 6 additions & 0 deletions packages/postcss-colormin/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,10 @@ test(
env: 'chrome62',
})
);

test(
'should not attempt to convert font names',
passthroughCSS('@font-face{src:local(Noto Sans Black)}')
);

test.run();
6 changes: 6 additions & 0 deletions packages/postcss-merge-rules/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 5.1.4

### Patch Changes

- fix(postcss-merge-rules): do not merge conflicting flex and border properties

## 5.1.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-merge-rules/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-merge-rules",
"version": "5.1.3",
"version": "5.1.4",
"description": "Merge CSS rules with PostCSS.",
"types": "types/index.d.ts",
"main": "src/index.js",
Expand Down
31 changes: 21 additions & 10 deletions packages/postcss-merge-rules/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function splitProp(prop) {
/**
* @param {string} propA
* @param {string} propB
* @return {boolean}
*/
function isConflictingProp(propA, propB) {
if (propA === propB) {
Expand All @@ -162,15 +163,29 @@ function isConflictingProp(propA, propB) {
if (!a.base && !b.base) {
return true;
}
// Different base;
if (a.base !== b.base) {

// Different base and none is `place`;
if (a.base !== b.base && a.base !== 'place' && b.base !== 'place') {
return false;
}

// Conflict if rest-count mismatches
if (a.rest.length !== b.rest.length) {
return true;
}

/* Do not merge conflicting border properties */
if (a.base === 'border') {
const allRestProps = new Set([...a.rest, ...b.rest]);
if (
allRestProps.has('image') ||
allRestProps.has('width') ||
allRestProps.has('color') ||
allRestProps.has('style')
) {
return true;
}
}
// Conflict if rest parameters are equal (same but unprefixed)
return a.rest.every((s, index) => b.rest[index] === s);
}
Expand Down Expand Up @@ -205,7 +220,7 @@ function mergeParents(first, second) {
*/
function partialMerge(first, second) {
let intersection = intersect(getDecls(first), getDecls(second));
if (!intersection.length) {
if (intersection.length === 0) {
return second;
}
let nextRule = second.next();
Expand All @@ -229,22 +244,18 @@ function partialMerge(first, second) {
}

const firstDecls = getDecls(first);

// Filter out intersections with later conflicts in First
intersection = intersection.filter((decl, intersectIndex) => {
const indexOfDecl = indexOfDeclaration(firstDecls, decl);
const nextConflictInFirst = firstDecls
.slice(indexOfDecl + 1)
.filter((d) => isConflictingProp(d.prop, decl.prop));
if (!nextConflictInFirst.length) {
if (nextConflictInFirst.length === 0) {
return true;
}
const nextConflictInIntersection = intersection
.slice(intersectIndex + 1)
.filter((d) => isConflictingProp(d.prop, decl.prop));
if (!nextConflictInIntersection.length) {
return false;
}
if (nextConflictInFirst.length !== nextConflictInIntersection.length) {
return false;
}
Expand Down Expand Up @@ -278,7 +289,7 @@ function partialMerge(first, second) {
return true;
});

if (!intersection.length) {
if (intersection.length === 0) {
// Nothing to merge
return second;
}
Expand Down Expand Up @@ -319,7 +330,7 @@ function partialMerge(first, second) {
first.replaceWith(firstClone);
second.replaceWith(secondClone);
[firstClone, receivingBlock, secondClone].forEach((r) => {
if (!r.nodes.length) {
if (r.nodes.length === 0) {
r.remove();
}
});
Expand Down
15 changes: 15 additions & 0 deletions packages/postcss-merge-rules/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,21 @@ test(
passthroughCSS('h2{margin:0}h1{margin-top:20px;margin:0}')
);

test(
'should not incorrectly extract border properties',
passthroughCSS(
'.a{border-top: 10px solid blue; border-width: 1px;} .b {border-left: 10px solid blue; border-width: 1px;}'
)
);

test(
'should not incorrectly extract flex properties',
processCSS(
'.a { place-content: center; justify-content: start; } .b { justify-content: start; place-content: center; }',
'.a { place-content: center; } .a,.b { justify-content: start; } .b { place-content: center; }'
)
);

test(
'should not incorrectly extract display properties',
passthroughCSS(
Expand Down
6 changes: 6 additions & 0 deletions packages/postcss-reduce-initial/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 5.1.2

### Patch Changes

- fix(postcsss-reduce-initial): fix mask-repeat conversion

## 5.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-reduce-initial/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ h1 {

```css
h1 {
min-width: 0;
min-width: auto;
}
```

Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-reduce-initial/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-reduce-initial",
"version": "5.1.1",
"version": "5.1.2",
"description": "Reduce initial definitions to the actual initial value, where possible.",
"main": "src/index.js",
"types": "types/index.d.ts",
Expand Down
3 changes: 0 additions & 3 deletions site/.eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ const cssnanoVersion = require('../packages/cssnano/package.json').version;

const processor = postcss([cssnano]);
module.exports = (config) => {
config.setBrowserSyncConfig({
snippet: false,
});
// tabindex makes scrollable code samples accesible
config.addPlugin(syntaxHighlight, { preAttributes: { tabindex: 0 } });
config.addPlugin(EleventyRenderPlugin);
Expand Down
22 changes: 11 additions & 11 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
"build": "eleventy --input src/"
},
"dependencies": {
"@codemirror/autocomplete": "^6.3.0",
"@codemirror/commands": "^6.1.2",
"@codemirror/lang-css": "^6.0.1",
"@codemirror/autocomplete": "^6.4.1",
"@codemirror/commands": "^6.2.1",
"@codemirror/lang-css": "^6.0.2",
"@codemirror/language": "^6.3.0",
"@codemirror/state": "^6.1.2",
"@codemirror/view": "^6.4.0",
"@codemirror/state": "^6.2.0",
"@codemirror/view": "^6.9.0",
"cssnano-preset-advanced": "../packages/cssnano-preset-advanced",
"cssnano-preset-default": "../packages/cssnano-preset-default",
"cssnano-preset-lite": "../packages/cssnano-preset-lite",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
"postcss": "^8.4.18"
"postcss": "^8.4.21"
},
"devDependencies": {
"@11ty/eleventy": "^1.0.2",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.1.0",
"@11ty/eleventy": "^2.0.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0",
"@iarna/toml": "^2.2.5",
"cssnano": "../packages/cssnano/",
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.5",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"markdown-it-anchor": "^8.6.6",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
}
}
Loading

0 comments on commit a3ccd12

Please sign in to comment.