Updated SCSS compiler to v1.8

This commit is contained in:
Matias Griese
2021-09-20 10:17:49 +03:00
parent 092e26c2c6
commit 25f2028a9d
10 changed files with 103 additions and 37 deletions

View File

@@ -1,3 +1,9 @@
# v1.10.23
## mm/dd/2021
1. [](#new)
* Updated SCSS compiler to v1.8
# v1.10.22 # v1.10.22
## 09/16/2021 ## 09/16/2021

28
composer.lock generated
View File

@@ -188,16 +188,16 @@
}, },
{ {
"name": "scssphp/scssphp", "name": "scssphp/scssphp",
"version": "v1.7.0", "version": "v1.8.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/scssphp/scssphp.git", "url": "https://github.com/scssphp/scssphp.git",
"reference": "797f76527c72bc4fe4ee32a94c4732e8d94517ae" "reference": "5e37759a63caf54392a4b709358a39ac7425a69f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/797f76527c72bc4fe4ee32a94c4732e8d94517ae", "url": "https://api.github.com/repos/scssphp/scssphp/zipball/5e37759a63caf54392a4b709358a39ac7425a69f",
"reference": "797f76527c72bc4fe4ee32a94c4732e8d94517ae", "reference": "5e37759a63caf54392a4b709358a39ac7425a69f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -211,6 +211,7 @@
"sass/sass-spec": "*", "sass/sass-spec": "*",
"squizlabs/php_codesniffer": "~3.5", "squizlabs/php_codesniffer": "~3.5",
"symfony/phpunit-bridge": "^5.1", "symfony/phpunit-bridge": "^5.1",
"thoughtbot/bourbon": "^7.0",
"twbs/bootstrap": "~5.0", "twbs/bootstrap": "~5.0",
"twbs/bootstrap4": "4.6.0", "twbs/bootstrap4": "4.6.0",
"zurb/foundation": "~6.5" "zurb/foundation": "~6.5"
@@ -255,9 +256,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/scssphp/scssphp/issues", "issues": "https://github.com/scssphp/scssphp/issues",
"source": "https://github.com/scssphp/scssphp/tree/v1.7.0" "source": "https://github.com/scssphp/scssphp/tree/v1.8.1"
}, },
"time": "2021-09-15T21:57:30+00:00" "time": "2021-09-18T21:20:53+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@@ -1172,16 +1173,16 @@
}, },
{ {
"name": "phpdocumentor/type-resolver", "name": "phpdocumentor/type-resolver",
"version": "1.4.0", "version": "1.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git", "url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1189,7 +1190,8 @@
"phpdocumentor/reflection-common": "^2.0" "phpdocumentor/reflection-common": "^2.0"
}, },
"require-dev": { "require-dev": {
"ext-tokenizer": "*" "ext-tokenizer": "*",
"psalm/phar": "^4.8"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -1215,9 +1217,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": { "support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues", "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0"
}, },
"time": "2020-09-17T18:55:26+00:00" "time": "2021-09-17T15:28:14+00:00"
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",

View File

@@ -29,7 +29,7 @@ private static $installed = array (
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '879819123303cf642c0552339cc2e1b46e94aab1', 'reference' => '092e26c2c6643e0e5a655fd77f7da8baaec48186',
'name' => 'getgrav/grav-plugin-admin', 'name' => 'getgrav/grav-plugin-admin',
), ),
'versions' => 'versions' =>
@@ -41,7 +41,7 @@ private static $installed = array (
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '879819123303cf642c0552339cc2e1b46e94aab1', 'reference' => '092e26c2c6643e0e5a655fd77f7da8baaec48186',
), ),
'laminas/laminas-xml' => 'laminas/laminas-xml' =>
array ( array (
@@ -79,12 +79,12 @@ private static $installed = array (
), ),
'scssphp/scssphp' => 'scssphp/scssphp' =>
array ( array (
'pretty_version' => 'v1.7.0', 'pretty_version' => 'v1.8.1',
'version' => '1.7.0.0', 'version' => '1.8.1.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '797f76527c72bc4fe4ee32a94c4732e8d94517ae', 'reference' => '5e37759a63caf54392a4b709358a39ac7425a69f',
), ),
'symfony/polyfill-php72' => 'symfony/polyfill-php72' =>
array ( array (

View File

@@ -191,17 +191,17 @@
}, },
{ {
"name": "scssphp/scssphp", "name": "scssphp/scssphp",
"version": "v1.7.0", "version": "v1.8.1",
"version_normalized": "1.7.0.0", "version_normalized": "1.8.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/scssphp/scssphp.git", "url": "https://github.com/scssphp/scssphp.git",
"reference": "797f76527c72bc4fe4ee32a94c4732e8d94517ae" "reference": "5e37759a63caf54392a4b709358a39ac7425a69f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/797f76527c72bc4fe4ee32a94c4732e8d94517ae", "url": "https://api.github.com/repos/scssphp/scssphp/zipball/5e37759a63caf54392a4b709358a39ac7425a69f",
"reference": "797f76527c72bc4fe4ee32a94c4732e8d94517ae", "reference": "5e37759a63caf54392a4b709358a39ac7425a69f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -215,6 +215,7 @@
"sass/sass-spec": "*", "sass/sass-spec": "*",
"squizlabs/php_codesniffer": "~3.5", "squizlabs/php_codesniffer": "~3.5",
"symfony/phpunit-bridge": "^5.1", "symfony/phpunit-bridge": "^5.1",
"thoughtbot/bourbon": "^7.0",
"twbs/bootstrap": "~5.0", "twbs/bootstrap": "~5.0",
"twbs/bootstrap4": "4.6.0", "twbs/bootstrap4": "4.6.0",
"zurb/foundation": "~6.5" "zurb/foundation": "~6.5"
@@ -223,7 +224,7 @@
"ext-iconv": "Can be used as fallback when ext-mbstring is not available", "ext-iconv": "Can be used as fallback when ext-mbstring is not available",
"ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv" "ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv"
}, },
"time": "2021-09-15T21:57:30+00:00", "time": "2021-09-18T21:20:53+00:00",
"bin": [ "bin": [
"bin/pscss" "bin/pscss"
], ],
@@ -261,7 +262,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/scssphp/scssphp/issues", "issues": "https://github.com/scssphp/scssphp/issues",
"source": "https://github.com/scssphp/scssphp/tree/v1.7.0" "source": "https://github.com/scssphp/scssphp/tree/v1.8.1"
}, },
"install-path": "../scssphp/scssphp" "install-path": "../scssphp/scssphp"
} }

View File

@@ -6,7 +6,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '879819123303cf642c0552339cc2e1b46e94aab1', 'reference' => '092e26c2c6643e0e5a655fd77f7da8baaec48186',
'name' => 'getgrav/grav-plugin-admin', 'name' => 'getgrav/grav-plugin-admin',
), ),
'versions' => 'versions' =>
@@ -18,7 +18,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '879819123303cf642c0552339cc2e1b46e94aab1', 'reference' => '092e26c2c6643e0e5a655fd77f7da8baaec48186',
), ),
'laminas/laminas-xml' => 'laminas/laminas-xml' =>
array ( array (
@@ -56,12 +56,12 @@
), ),
'scssphp/scssphp' => 'scssphp/scssphp' =>
array ( array (
'pretty_version' => 'v1.7.0', 'pretty_version' => 'v1.8.1',
'version' => '1.7.0.0', 'version' => '1.8.1.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '797f76527c72bc4fe4ee32a94c4732e8d94517ae', 'reference' => '5e37759a63caf54392a4b709358a39ac7425a69f',
), ),
'symfony/polyfill-php72' => 'symfony/polyfill-php72' =>
array ( array (

View File

@@ -26,7 +26,7 @@ use ScssPhp\ScssPhp\Parser;
use ScssPhp\ScssPhp\Version; use ScssPhp\ScssPhp\Version;
$style = null; $style = null;
$loadPaths = null; $loadPaths = [];
$dumpTree = false; $dumpTree = false;
$inputFile = null; $inputFile = null;
$changeDir = false; $changeDir = false;
@@ -148,7 +148,7 @@ EOT;
$value = parseArgument($i, array('-I', '--load-path')); $value = parseArgument($i, array('-I', '--load-path'));
if (isset($value)) { if (isset($value)) {
$loadPaths = $value; $loadPaths[] = $value;
continue; continue;
} }
@@ -188,7 +188,7 @@ if ($dumpTree) {
$scss = new Compiler(); $scss = new Compiler();
if ($loadPaths) { if ($loadPaths) {
$scss->setImportPaths(explode(PATH_SEPARATOR, $loadPaths)); $scss->setImportPaths($loadPaths);
} }
if ($style) { if ($style) {

View File

@@ -40,6 +40,7 @@
"sass/sass-spec": "*", "sass/sass-spec": "*",
"squizlabs/php_codesniffer": "~3.5", "squizlabs/php_codesniffer": "~3.5",
"symfony/phpunit-bridge": "^5.1", "symfony/phpunit-bridge": "^5.1",
"thoughtbot/bourbon": "^7.0",
"twbs/bootstrap": "~5.0", "twbs/bootstrap": "~5.0",
"twbs/bootstrap4": "4.6.0", "twbs/bootstrap4": "4.6.0",
"zurb/foundation": "~6.5" "zurb/foundation": "~6.5"
@@ -63,6 +64,24 @@
} }
} }
}, },
{
"type": "package",
"package": {
"name": "thoughtbot/bourbon",
"version": "v7.0.0",
"source": {
"type": "git",
"url": "https://github.com/thoughtbot/bourbon.git",
"reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thoughtbot/bourbon/zipball/fbe338ee6807e7f7aa996d82c8a16f248bb149b3",
"reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3",
"shasum": ""
}
}
},
{ {
"type": "package", "type": "package",
"package": { "package": {

View File

@@ -3827,7 +3827,6 @@ EOL;
// try to find a native lib function // try to find a native lib function
$normalizedName = $this->normalizeName($name); $normalizedName = $this->normalizeName($name);
$libName = null;
if (isset($this->userFunctions[$normalizedName])) { if (isset($this->userFunctions[$normalizedName])) {
// see if we can find a user function // see if we can find a user function
@@ -3836,10 +3835,45 @@ EOL;
return [Type::T_FUNCTION_REFERENCE, 'user', $name, $f, $prototype]; return [Type::T_FUNCTION_REFERENCE, 'user', $name, $f, $prototype];
} }
$lowercasedName = strtolower($normalizedName);
// Special functions overriding a CSS function are case-insensitive. We normalize them as lowercase
// to avoid the deprecation warning about the wrong case being used.
if ($lowercasedName === 'min' || $lowercasedName === 'max') {
$normalizedName = $lowercasedName;
}
if (($f = $this->getBuiltinFunction($normalizedName)) && \is_callable($f)) { if (($f = $this->getBuiltinFunction($normalizedName)) && \is_callable($f)) {
$libName = $f[1]; $libName = $f[1];
$prototype = isset(static::$$libName) ? static::$$libName : null; $prototype = isset(static::$$libName) ? static::$$libName : null;
// All core functions have a prototype defined. Not finding the
// prototype can mean 2 things:
// - the function comes from a child class (deprecated just after)
// - the function was found with a different case, which relates to calling the
// wrong Sass function due to our camelCase usage (`fade-in()` vs `fadein()`),
// because PHP method names are case-insensitive while property names are
// case-sensitive.
if ($prototype === null || strtolower($normalizedName) !== $normalizedName) {
$r = new \ReflectionMethod($this, $libName);
$actualLibName = $r->name;
if ($actualLibName !== $libName || strtolower($normalizedName) !== $normalizedName) {
$kebabCaseName = preg_replace('~(?<=\\w)([A-Z])~', '-$1', substr($actualLibName, 3));
assert($kebabCaseName !== null);
$originalName = strtolower($kebabCaseName);
$warning = "Calling built-in functions with a non-standard name is deprecated since Scssphp 1.8.0 and will not work anymore in 2.0 (they will be treated as CSS function calls instead).\nUse \"$originalName\" instead of \"$name\".";
@trigger_error($warning, E_USER_DEPRECATED);
$fname = $this->getPrettyPath($this->sourceNames[$this->sourceIndex]);
$line = $this->sourceLine;
Warn::deprecation("$warning\n on line $line of $fname");
// Use the actual function definition
$prototype = isset(static::$$actualLibName) ? static::$$actualLibName : null;
$f[1] = $libName = $actualLibName;
}
}
if (\get_class($this) !== __CLASS__ && !isset($this->warnedChildFunctions[$libName])) { if (\get_class($this) !== __CLASS__ && !isset($this->warnedChildFunctions[$libName])) {
$r = new \ReflectionMethod($this, $libName); $r = new \ReflectionMethod($this, $libName);
$declaringClass = $r->getDeclaringClass()->name; $declaringClass = $r->getDeclaringClass()->name;
@@ -7461,7 +7495,7 @@ EOL;
} }
} }
return [Type::T_HSL, fmod($h, 360), $s * 100, $l / 5.1]; return [Type::T_HSL, fmod($h + 360, 360), $s * 100, $l / 5.1];
} }
/** /**
@@ -8148,7 +8182,7 @@ EOL;
} }
} }
$hueValue = $hue->getDimension() % 360; $hueValue = fmod($hue->getDimension(), 360);
while ($hueValue < 0) { while ($hueValue < 0) {
$hueValue += 360; $hueValue += 360;

View File

@@ -149,6 +149,7 @@ class Number extends Node implements \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
#[\ReturnTypeWillChange]
public function offsetExists($offset) public function offsetExists($offset)
{ {
if ($offset === -3) { if ($offset === -3) {
@@ -174,6 +175,7 @@ class Number extends Node implements \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
#[\ReturnTypeWillChange]
public function offsetGet($offset) public function offsetGet($offset)
{ {
switch ($offset) { switch ($offset) {
@@ -200,6 +202,7 @@ class Number extends Node implements \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) public function offsetSet($offset, $value)
{ {
throw new \BadMethodCallException('Number is immutable'); throw new \BadMethodCallException('Number is immutable');
@@ -208,6 +211,7 @@ class Number extends Node implements \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
#[\ReturnTypeWillChange]
public function offsetUnset($offset) public function offsetUnset($offset)
{ {
throw new \BadMethodCallException('Number is immutable'); throw new \BadMethodCallException('Number is immutable');

View File

@@ -19,5 +19,5 @@ namespace ScssPhp\ScssPhp;
*/ */
class Version class Version
{ {
const VERSION = '1.7.0'; const VERSION = '1.8.1';
} }