postcss-custom-media
Advanced tools
Comparing version 7.0.0 to 7.0.1
# Changes to PostCSS Custom Media | ||
### 7.0.0 (September 12, 2018) | ||
### 7.0.1 (September 14, 2018) | ||
- Fixed: An issue with how opposing queries are resolved. | ||
### 7.0.0 (September 14, 2018) | ||
- Added: New `preserve` option to preserve custom media and atrules using them | ||
@@ -6,0 +10,0 @@ - Added: New `exportTo` function to specify where to export custom media |
@@ -353,4 +353,9 @@ 'use strict'; | ||
const replacementMedia = _step.value; | ||
// use the first available modifier unless they cancel each other out | ||
const modifier = media.modifier !== replacementMedia.modifier ? media.modifier || replacementMedia.modifier : ''; | ||
const mediaClone = media.clone({ | ||
modifier: replacementMedia.modifier === media.modifier && modifierRegExp.test(media.modifier) ? '' : replacementMedia.modifier | ||
modifier, | ||
// conditionally use the raws from the first available modifier | ||
raws: !modifier || media.modifier ? _objectSpread({}, media.raws) : _objectSpread({}, replacementMedia.raws), | ||
type: media.type || replacementMedia.type | ||
}); | ||
@@ -361,5 +366,7 @@ mediaClone.nodes.splice(index, 1, ...replacementMedia.clone().nodes.map(node => { | ||
return node; | ||
})); | ||
const retranspiledMedias = String(mediaClone) === String(customMedias[key]) ? [] : transformMedia(mediaClone, customMedias); | ||
})); // remove the currently transformed key to prevent recursion | ||
const nextCustomMedia = getCustomMediasWithoutKey(customMedias, key); | ||
const retranspiledMedias = transformMedia(mediaClone, nextCustomMedia); | ||
if (retranspiledMedias.length) { | ||
@@ -395,5 +402,10 @@ transpiledMedias.push(...retranspiledMedias); | ||
const modifierRegExp = /^not$/i; | ||
const customPseudoRegExp = /\((--[A-z][\w-]*)\)/; | ||
const getCustomMediasWithoutKey = (customMedias, key) => { | ||
const nextCustomMedias = Object.assign({}, customMedias); | ||
delete nextCustomMedias[key]; | ||
return nextCustomMedias; | ||
}; | ||
var transformAtrules = ((root, customMedia, opts) => { | ||
@@ -422,3 +434,5 @@ root.walkAtRules(mediaAtRuleRegExp, atrule => { | ||
function importCustomMediaFromCSSAST(root) { | ||
return getCustomMedia(root); | ||
return getCustomMedia(root, { | ||
preserve: true | ||
}); | ||
} | ||
@@ -425,0 +439,0 @@ /* Import Custom Media from CSS File |
{ | ||
"name": "postcss-custom-media", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "Use Custom Media Queries in CSS", | ||
@@ -33,3 +33,3 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0", | ||
"@babel/core": "^7.0.1", | ||
"@babel/plugin-syntax-dynamic-import": "^7.0.0", | ||
@@ -36,0 +36,0 @@ "@babel/preset-env": "^7.0.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
54962
1258
0