Comparing version 8.2.13 to 8.2.14
@@ -5,2 +5,3 @@ 'use strict' | ||
let { resolve, isAbsolute } = require('path') | ||
let { SourceMapConsumer, SourceMapGenerator } = require('source-map') | ||
let { nanoid } = require('nanoid/non-secure') | ||
@@ -14,2 +15,3 @@ | ||
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) | ||
let pathAvailable = Boolean(resolve && isAbsolute) | ||
@@ -48,3 +50,3 @@ | ||
if (pathAvailable) { | ||
if (pathAvailable && sourceMapAvailable) { | ||
let map = new PreviousMap(this.css, opts) | ||
@@ -174,3 +176,3 @@ if (map.text) { | ||
// istanbul ignore next | ||
throw new Error(`file: protocol is not available in this PostCSS build`); | ||
throw new Error(`file: protocol is not available in this PostCSS build`) | ||
} | ||
@@ -177,0 +179,0 @@ } |
@@ -5,4 +5,5 @@ 'use strict' | ||
let { pathToFileURL } = require('url') | ||
let mozilla = require('source-map') | ||
let { SourceMapConsumer, SourceMapGenerator } = require('source-map') | ||
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) | ||
let pathAvailable = Boolean(dirname && resolve && relative && sep) | ||
@@ -103,3 +104,3 @@ | ||
if (this.mapOpts.sourcesContent === false) { | ||
map = new mozilla.SourceMapConsumer(prev.text) | ||
map = new SourceMapConsumer(prev.text) | ||
if (map.sourcesContent) { | ||
@@ -211,3 +212,5 @@ map.sourcesContent = map.sourcesContent.map(() => null) | ||
// istanbul ignore next | ||
throw new Error('`map.absolute` option is not available in this PostCSS build') | ||
throw new Error( | ||
'`map.absolute` option is not available in this PostCSS build' | ||
) | ||
} | ||
@@ -221,3 +224,3 @@ } else { | ||
this.css = '' | ||
this.map = new mozilla.SourceMapGenerator({ file: this.outputFile() }) | ||
this.map = new SourceMapGenerator({ file: this.outputFile() }) | ||
@@ -289,3 +292,3 @@ let line = 1 | ||
if (pathAvailable && this.isMap()) { | ||
if (pathAvailable && sourceMapAvailable && this.isMap()) { | ||
return this.generateMap() | ||
@@ -292,0 +295,0 @@ } |
@@ -5,3 +5,3 @@ 'use strict' | ||
let { dirname, join } = require('path') | ||
let mozilla = require('source-map') | ||
let { SourceMapConsumer, SourceMapGenerator } = require('source-map') | ||
@@ -34,3 +34,3 @@ function fromBase64(str) { | ||
if (!this.consumerCache) { | ||
this.consumerCache = new mozilla.SourceMapConsumer(this.text) | ||
this.consumerCache = new SourceMapConsumer(this.text) | ||
} | ||
@@ -53,7 +53,11 @@ return this.consumerCache | ||
getAnnotationURL(sourceMapString) { | ||
return sourceMapString.match(/\/\*\s*# sourceMappingURL=((?:(?!sourceMappingURL=).)*)\*\//)[1].trim() | ||
return sourceMapString | ||
.match(/\/\*\s*# sourceMappingURL=((?:(?!sourceMappingURL=).)*)\*\//)[1] | ||
.trim() | ||
} | ||
loadAnnotation(css) { | ||
let annotations = css.match(/\/\*\s*# sourceMappingURL=(?:(?!sourceMappingURL=).)*\*\//gm) | ||
let annotations = css.match( | ||
/\/\*\s*# sourceMappingURL=(?:(?!sourceMappingURL=).)*\*\//gm | ||
) | ||
@@ -113,5 +117,5 @@ if (annotations && annotations.length > 0) { | ||
} | ||
} else if (prev instanceof mozilla.SourceMapConsumer) { | ||
return mozilla.SourceMapGenerator.fromSourceMap(prev).toString() | ||
} else if (prev instanceof mozilla.SourceMapGenerator) { | ||
} else if (prev instanceof SourceMapConsumer) { | ||
return SourceMapGenerator.fromSourceMap(prev).toString() | ||
} else if (prev instanceof SourceMapGenerator) { | ||
return prev.toString() | ||
@@ -118,0 +122,0 @@ } else if (this.isMap(prev)) { |
@@ -8,3 +8,3 @@ 'use strict' | ||
constructor(plugins = []) { | ||
this.version = '8.2.13' | ||
this.version = '8.2.14' | ||
this.plugins = this.normalize(plugins) | ||
@@ -11,0 +11,0 @@ } |
{ | ||
"name": "postcss", | ||
"version": "8.2.13", | ||
"version": "8.2.14", | ||
"description": "Tool for transforming styles with JS plugins", | ||
@@ -73,4 +73,5 @@ "engines": { | ||
"path": false, | ||
"url": false | ||
"url": false, | ||
"source-map": false | ||
} | ||
} |
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
181321
5806