Socket
Socket
Sign inDemoInstall

postcss

Package Overview
Dependencies
3
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.1 to 0.3.2

3

ChangeLog.md

@@ -0,1 +1,4 @@

## 0.3.2
* Add URI encoding support for inline source maps.
## 0.3.1

@@ -2,0 +5,0 @@ * Fix relative paths from previous source map.

47

lib/map-generator.js
(function() {
var MapGenerator, Result, base64, fs, lazy, mozilla, path;
var MapGenerator, Result, base64js, fs, lazy, mozilla, path;
base64js = require('base64-js');
mozilla = require('source-map');
base64 = require('base64-js');
Result = require('./result');

@@ -50,3 +50,3 @@

lazy(MapGenerator, 'prevMap', function() {
var byte, bytes, file, map, start, text;
var file, map;
if (this.opts.map && typeof this.opts.map !== 'boolean') {

@@ -56,15 +56,3 @@ return this.opts.map;

if (this.isPrevInline()) {
start = '# sourceMappingURL=data:application/json;base64,';
text = this.prevAnnotation().text;
text = text.slice(start.length);
bytes = base64.toByteArray(text);
return ((function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = bytes.length; _i < _len; _i++) {
byte = bytes[_i];
_results.push(String.fromCharCode(byte));
}
return _results;
})()).join('');
return this.encodeInline(this.prevAnnotation().text);
} else if (this.opts.from) {

@@ -97,2 +85,25 @@ map = this.opts.from + '.map';

MapGenerator.prototype.encodeInline = function(text) {
var base64, byte, bytes, uri;
uri = '# sourceMappingURL=data:application/json,';
base64 = '# sourceMappingURL=data:application/json;base64,';
if (this.startWith(text, uri)) {
return decodeURIComponent(text.slice(uri.length));
} else if (this.startWith(text, base64)) {
text = text.slice(base64.length);
bytes = base64js.toByteArray(text);
return ((function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = bytes.length; _i < _len; _i++) {
byte = bytes[_i];
_results.push(String.fromCharCode(byte));
}
return _results;
})()).join('');
} else {
throw new Error('Unknown source map encoding');
}
};
MapGenerator.prototype.clearAnnotation = function() {

@@ -141,3 +152,3 @@ var _ref;

return _results;
}).call(this), "data:application/json;base64," + base64.fromByteArray(bytes)) : this.outputFile() + '.map';
}).call(this), "data:application/json;base64," + base64js.fromByteArray(bytes)) : this.outputFile() + '.map';
return this.css += "\n/*# sourceMappingURL=" + content + " */";

@@ -144,0 +155,0 @@ };

{
"name": "postcss",
"version": "0.3.1",
"version": "0.3.2",
"description": "Framework for CSS postprocessors",

@@ -5,0 +5,0 @@ "keywords": ["css", "parser", "postproccessor"],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc