Socket
Socket
Sign inDemoInstall

source-map-loader

Package Overview
Dependencies
Maintainers
6
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

source-map-loader - npm Package Compare versions

Comparing version 0.1.6 to 0.2.0

.gitattributes

5

index.js

@@ -11,3 +11,4 @@ /*

var baseRegex = "\\s*[@#]\\s*sourceMappingURL\\s*=\\s*([^\\s]*)",
// Matches only the last occurrence of sourceMappingURL
var baseRegex = "\\s*[@#]\\s*sourceMappingURL\\s*=\\s*([^\\s]*)(?![\S\s]*sourceMappingURL)",
// Matches /* ... */ comments

@@ -18,3 +19,3 @@ regex1 = new RegExp("/\\*"+baseRegex+"\\s*\\*/"),

// Matches DataUrls
regexDataUrl = /data:[^;\n]+;base64,(.*)/;
regexDataUrl = /data:[^;\n]+(?:;charset=[^;\n]+)?;base64,(.*)/;

@@ -21,0 +22,0 @@ module.exports = function(input, inputMap) {

13

package.json
{
"name": "source-map-loader",
"version": "0.1.6",
"version": "0.2.0",
"author": "Tobias Koppers @sokra",
"description": "extracts inlined source map and offers it to webpack",
"scripts": {
"test": "mocha -R spec"
"test": "mocha -R spec",
"travis:test": "mocha -R spec",
"release": "yarn run standard-version"
},
"devDependencies": {
"mocha": "^1.18.2",
"should": "^3.3.1",
"mocha": "^1.18.2"
"standard-version": "^4.0.0"
},

@@ -24,6 +27,6 @@ "repository": {

"dependencies": {
"async": "^0.9.0",
"loader-utils": "~0.2.2",
"source-map": "~0.1.33",
"async": "^0.9.0"
"source-map": "~0.1.33"
}
}

@@ -1,7 +0,23 @@

# source map loader for webpack
[![npm][npm]][npm-url]
[![deps][deps]][deps-url]
[![chat][chat]][chat-url]
Extracts SourceMaps for source files that as added as `sourceMappingURL` comment.
<div align="center">
<!-- replace with accurate logo e.g from https://worldvectorlogo.com/ -->
<a href="https://github.com/webpack/webpack">
<img width="200" height="200" vspace="" hspace="25"
src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
</a>
<h1>Sourcemap Loader</h1>
<p>Extracts SourceMaps for source files that as added as `sourceMappingURL` comment.<p>
</div>
## Usage
<h2 align="center">Install</h2>
```bash
npm i -D source-map-loader
```
<h2 align="center">Usage</h2>
[Documentation: Using loaders](https://webpack.js.org/concepts/#loaders)

@@ -26,6 +42,45 @@

This extracts all SourceMaps from all files. That's not so performance-wise so you may only want to apply the loader to relevant files.
This extracts SourceMaps from all js files (including node_modules). This is not very performant, so you may want to only apply the loader to relevant files.
## License
<h2 align="center">Maintainers</h2>
MIT (http://www.opensource.org/licenses/mit-license.php)
<table>
<tbody>
<tr>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/166921?v=3&s=150">
</br>
<a href="https://github.com/bebraw">Juho Vepsäläinen</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars2.githubusercontent.com/u/8420490?v=3&s=150">
</br>
<a href="https://github.com/d3viant0ne">Joshua Wiens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/533616?v=3&s=150">
</br>
<a href="https://github.com/SpaceK33z">Kees Kluskens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/3408176?v=3&s=150">
</br>
<a href="https://github.com/TheLarkInn">Sean Larkin</a>
</td>
</tr>
<tbody>
</table>
[npm]: https://img.shields.io/npm/v/source-map-loader.svg
[npm-url]: https://npmjs.com/package/source-map-loader
[deps]: https://david-dm.org/webpack-contrib/source-map-loader.svg
[deps-url]: https://david-dm.org/webpack-contrib/source-map-loader
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
[chat-url]: https://gitter.im/webpack/webpack
with SourceMap
//#sourceMappingURL=external-source-map.map
// comment
with SourceMap
//#sourceMappingURL=data/external-source-map2.map
// comment
with SourceMap
// @ sourceMappingURL = data:application/source-map;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lLXNvdXJjZS1tYXAuanMiLCJzb3VyY2VzIjpbImlubGluZS1zb3VyY2UtbWFwLnR4dCJdLCJzb3VyY2VzQ29udGVudCI6WyJ3aXRoIFNvdXJjZU1hcCJdLCJtYXBwaW5ncyI6IkFBQUEifQ==
// comment
with SourceMap
//#sourceMappingURL=missing-source-map.map
// comment
with SourceMap
//#sourceMappingURL=missing-source-map2.map
// comment

@@ -36,3 +36,5 @@ var path = require("path");

};
var res = loader.call(context, fs.readFileSync(filename, "utf-8"));
// Remove CRs to make test line ending invariant
var fixtureContent = fs.readFileSync(filename, "utf-8").replace(/\r/g, '');
var res = loader.call(context, fixtureContent);
if(!async) return callback(null, res, null, deps, warns);

@@ -56,3 +58,3 @@ }

warns.should.be.eql([]);
should.equal(res, "with SourceMap\n\n// comment"),
should.equal(res, "with SourceMap\n// comment"),
map.should.be.eql({

@@ -75,3 +77,3 @@ "version":3,

warns.should.be.eql([]);
should.equal(res, "with SourceMap\n\n// comment"),
should.equal(res, "with SourceMap\n// comment"),
map.should.be.eql({

@@ -96,3 +98,3 @@ "version":3,

warns.should.be.eql([]);
should.equal(res, "with SourceMap\n\n// comment"),
should.equal(res, "with SourceMap\n// comment"),
map.should.be.eql({

@@ -114,2 +116,20 @@ "version":3,

});
it("should use last SourceMap directive", function (done) {
execLoader(path.join(__dirname, "fixtures", "multi-source-map.js"), function (err, res, map, deps, warns) {
should.equal(err, null);
warns.should.be.eql([]);
should.equal(res, "with SourceMap\nanInvalidDirective = \"\\n/*# sourceMappingURL=data:application/json;base64,\" + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + \" */\";\n// comment"),
map.should.be.eql({
"version": 3,
"file": "inline-source-map.js",
"sources": [
"inline-source-map.txt"
],
"sourcesContent": ["with SourceMap"],
"mappings": "AAAA"
});
deps.should.be.eql([]);
done();
});
});
it("should warn on missing SourceMap", function(done) {

@@ -133,3 +153,3 @@ execLoader(path.join(__dirname, "fixtures", "missing-source-map.js"), function(err, res, map, deps, warns) {

]);
should.equal(res, "with SourceMap\n\n// comment"),
should.equal(res, "with SourceMap\n// comment"),
map.should.be.eql({

@@ -150,2 +170,21 @@ "version":3,

});
it("should process inlined SourceMaps with charset", function(done) {
execLoader(path.join(__dirname, "fixtures", "charset-inline-source-map.js"), function(err, res, map, deps, warns) {
should.equal(err, null);
warns.should.be.eql([]);
should.equal(res, "with SourceMap\n// comment"),
map.should.be.eql({
"version":3,
"file":"charset-inline-source-map.js",
"sources":[
"charset-inline-source-map.txt"
],
"sourcesContent":["with SourceMap"],
"mappings":"AAAA"
});
deps.should.be.eql([]);
done();
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc