diff --git a/index.js b/index.js index 25713fa..74ef090 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,6 @@ MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ -var SourceMap = require("source-map"); var fs = require("fs"); var path = require("path"); var async = require("async"); diff --git a/package.json b/package.json index dd76bc7..8ecf87f 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ ], "dependencies": { "async": "^0.9.0", - "loader-utils": "~0.2.2", - "source-map": "~0.1.33" + "loader-utils": "~0.2.2" } } diff --git a/test/fixtures/charset-inline-source-map.js b/test/fixtures/charset-inline-source-map.js index f096e98..95e621e 100644 --- a/test/fixtures/charset-inline-source-map.js +++ b/test/fixtures/charset-inline-source-map.js @@ -1,3 +1,2 @@ -with SourceMap // @ sourceMappingURL = data:application/source-map;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhcnNldC1pbmxpbmUtc291cmNlLW1hcC5qcyIsInNvdXJjZXMiOlsiY2hhcnNldC1pbmxpbmUtc291cmNlLW1hcC50eHQiXSwic291cmNlc0NvbnRlbnQiOlsid2l0aCBTb3VyY2VNYXAiXSwibWFwcGluZ3MiOiJBQUFBIn0= // comment \ No newline at end of file diff --git a/test/fixtures/external-source-map.js b/test/fixtures/external-source-map.js index 64dbc54..950eefe 100644 --- a/test/fixtures/external-source-map.js +++ b/test/fixtures/external-source-map.js @@ -1,3 +1,3 @@ with SourceMap //#sourceMappingURL=external-source-map.map -// comment \ No newline at end of file +// comment diff --git a/test/fixtures/external-source-map2.js b/test/fixtures/external-source-map2.js index 844e38d..ec0af23 100644 --- a/test/fixtures/external-source-map2.js +++ b/test/fixtures/external-source-map2.js @@ -1,3 +1,3 @@ with SourceMap //#sourceMappingURL=data/external-source-map2.map -// comment \ No newline at end of file +// comment diff --git a/test/fixtures/inline-source-map.js b/test/fixtures/inline-source-map.js index 6fc86a8..f6d8765 100644 --- a/test/fixtures/inline-source-map.js +++ b/test/fixtures/inline-source-map.js @@ -1,3 +1,2 @@ -with SourceMap // @ sourceMappingURL = data:application/source-map;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lLXNvdXJjZS1tYXAuanMiLCJzb3VyY2VzIjpbImlubGluZS1zb3VyY2UtbWFwLnR4dCJdLCJzb3VyY2VzQ29udGVudCI6WyJ3aXRoIFNvdXJjZU1hcCJdLCJtYXBwaW5ncyI6IkFBQUEifQ== // comment \ No newline at end of file diff --git a/test/fixtures/missing-source-map.js b/test/fixtures/missing-source-map.js index f2bf71c..74e4038 100644 --- a/test/fixtures/missing-source-map.js +++ b/test/fixtures/missing-source-map.js @@ -1,3 +1,3 @@ with SourceMap //#sourceMappingURL=missing-source-map.map -// comment \ No newline at end of file +// comment diff --git a/test/fixtures/missing-source-map2.js b/test/fixtures/missing-source-map2.js index 6257266..90ad43b 100644 --- a/test/fixtures/missing-source-map2.js +++ b/test/fixtures/missing-source-map2.js @@ -1,3 +1,3 @@ with SourceMap //#sourceMappingURL=missing-source-map2.map -// comment \ No newline at end of file +// comment diff --git a/test/fixtures/multi-source-map.js b/test/fixtures/multi-source-map.js index f844435..266acb6 100644 --- a/test/fixtures/multi-source-map.js +++ b/test/fixtures/multi-source-map.js @@ -1,4 +1,3 @@ -with SourceMap anInvalidDirective = "\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"; // @ sourceMappingURL = data:application/source-map;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lLXNvdXJjZS1tYXAuanMiLCJzb3VyY2VzIjpbImlubGluZS1zb3VyY2UtbWFwLnR4dCJdLCJzb3VyY2VzQ29udGVudCI6WyJ3aXRoIFNvdXJjZU1hcCJdLCJtYXBwaW5ncyI6IkFBQUEifQ== // comment \ No newline at end of file diff --git a/test/fixtures/normal-file.js b/test/fixtures/normal-file.js index 85c95f0..e69de29 100644 --- a/test/fixtures/normal-file.js +++ b/test/fixtures/normal-file.js @@ -1 +0,0 @@ -without SourceMap \ No newline at end of file diff --git a/test/index.test.js b/test/index.test.js index ed0543b..e6f9c73 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -44,7 +44,7 @@ describe("source-map-loader", function() { execLoader(path.join(__dirname, "fixtures", "normal-file.js"), function(err, res, map, deps, warns) { should.equal(err, null); warns.should.be.eql([]); - should.equal(res, "without SourceMap"), + should.equal(res, ""), should.equal(map, null); deps.should.be.eql([]); done(); @@ -54,7 +54,7 @@ describe("source-map-loader", function() { execLoader(path.join(__dirname, "fixtures", "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"), + should.equal(res, "// comment"), map.should.be.eql({ "version":3, "file":"inline-source-map.js", @@ -72,7 +72,7 @@ describe("source-map-loader", function() { execLoader(path.join(__dirname, "fixtures", "external-source-map.js"), function(err, res, map, deps, warns) { should.equal(err, null); warns.should.be.eql([]); - should.equal(res, "with SourceMap\n// comment"), + should.equal(res, "with SourceMap\n// comment\n"), map.should.be.eql({ "version":3, "file":"external-source-map.js", @@ -92,7 +92,7 @@ describe("source-map-loader", function() { execLoader(path.join(__dirname, "fixtures", "external-source-map2.js"), function(err, res, map, deps, warns) { should.equal(err, null); warns.should.be.eql([]); - should.equal(res, "with SourceMap\n// comment"), + should.equal(res, "with SourceMap\n// comment\n"), map.should.be.eql({ "version":3, "file":"external-source-map2.js", @@ -113,7 +113,7 @@ describe("source-map-loader", function() { 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"), + should.equal(res, "anInvalidDirective = \"\\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", @@ -133,7 +133,7 @@ describe("source-map-loader", function() { warns.should.be.eql([ "Cannot find SourceMap 'missing-source-map.map': Error: File not found" ]); - should.equal(res, "with SourceMap\n//#sourceMappingURL=missing-source-map.map\n// comment"), + should.equal(res, "with SourceMap\n//#sourceMappingURL=missing-source-map.map\n// comment\n"), should.equal(map, null); deps.should.be.eql([]); done(); @@ -145,7 +145,7 @@ describe("source-map-loader", function() { warns.should.be.eql([ "Cannot find source file 'missing-source-map2.txt': Error: File not found" ]); - should.equal(res, "with SourceMap\n// comment"), + should.equal(res, "with SourceMap\n// comment\n"), map.should.be.eql({ "version":3, "file":"missing-source-map2.js", @@ -166,7 +166,7 @@ describe("source-map-loader", function() { 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"), + should.equal(res, "// comment"), map.should.be.eql({ "version":3, "file":"charset-inline-source-map.js", @@ -180,4 +180,4 @@ describe("source-map-loader", function() { done(); }); }); -}); \ No newline at end of file +});