mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
This updates Rollup, SVGO and clean-css. Only clean-css had reported breaking changes, but we are not affected (Node compatibility removals and changes to features we don't use). R=jacktfranklin@chromium.org Bug: none Change-Id: I94c293e128d1ddb81f12036421a715da210e7633 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3060704 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Paul Lewis <aerotwist@chromium.org>
26 lines
675 B
JavaScript
26 lines
675 B
JavaScript
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
|
|
|
var LOCAL_PREFIX_PATTERN = /^local\(/i;
|
|
var QUOTED_PATTERN = /^('.*'|".*")$/;
|
|
var QUOTED_BUT_SAFE_PATTERN = /^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/;
|
|
|
|
var plugin = {
|
|
level1: {
|
|
value: function textQuotes(_name, value, options) {
|
|
if (!options.level[OptimizationLevel.One].removeQuotes) {
|
|
return value;
|
|
}
|
|
|
|
if (!QUOTED_PATTERN.test(value) && !LOCAL_PREFIX_PATTERN.test(value)) {
|
|
return value;
|
|
}
|
|
|
|
return QUOTED_BUT_SAFE_PATTERN.test(value) ?
|
|
value.substring(1, value.length - 1) :
|
|
value;
|
|
}
|
|
}
|
|
};
|
|
|
|
module.exports = plugin;
|