MDL-75476 scssphp: Updated from 1.10.0 to 1.11.0

This commit is contained in:
David Woloszyn
2022-09-19 10:50:02 +10:00
parent c6211a68b4
commit 5247ff3da0
13 changed files with 301 additions and 129 deletions
+13 -4
View File
@@ -107,7 +107,7 @@ class SourceMapGenerator
*/
public function __construct(array $options = [])
{
$this->options = array_merge($this->defaultOptions, $options);
$this->options = array_replace($this->defaultOptions, $options);
$this->encoder = new Base64VLQ();
}
@@ -140,7 +140,7 @@ class SourceMapGenerator
*
* @param string $content The content to write
*
* @return string
* @return string|null
*
* @throws \ScssPhp\ScssPhp\Exception\CompilerException If the file could not be saved
* @deprecated
@@ -148,6 +148,7 @@ class SourceMapGenerator
public function saveMap($content)
{
$file = $this->options['sourceMapWriteTo'];
assert($file !== null);
$dir = \dirname($file);
// directory does not exist
@@ -201,7 +202,7 @@ class SourceMapGenerator
// A list of original sources used by the 'mappings' entry.
$sourceMap['sources'] = [];
foreach ($this->sources as $sourceUri => $sourceFilename) {
foreach ($this->sources as $sourceFilename) {
$sourceMap['sources'][] = $this->normalizeFilename($sourceFilename);
}
@@ -223,7 +224,15 @@ class SourceMapGenerator
unset($sourceMap['sourceRoot']);
}
return json_encode($sourceMap, JSON_UNESCAPED_SLASHES);
$jsonSourceMap = json_encode($sourceMap, JSON_UNESCAPED_SLASHES);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException(json_last_error_msg());
}
assert($jsonSourceMap !== false);
return $jsonSourceMap;
}
/**