From 4b6822738c7c1bee9652fcc403c7f1e3e7e85842 Mon Sep 17 00:00:00 2001 From: Diego Faria Date: Fri, 26 May 2017 16:04:48 +0200 Subject: [PATCH 1/3] dependency not used --- index.js | 1 - 1 file changed, 1 deletion(-) 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"); From 15bd58ab39981efb6f647941cc03e32922b3566c Mon Sep 17 00:00:00 2001 From: diegofaria Date: Sun, 28 May 2017 13:05:28 +0200 Subject: [PATCH 2/3] removed dependency and fixed tests --- package.json | 3 +-- test/fixtures/charset-inline-source-map.js | 1 - test/fixtures/external-source-map.js | 1 - test/fixtures/external-source-map2.js | 1 - test/fixtures/inline-source-map.js | 1 - test/fixtures/missing-source-map.js | 1 - test/fixtures/missing-source-map2.js | 1 - test/fixtures/multi-source-map.js | 1 - test/fixtures/normal-file.js | 1 - test/index.test.js | 16 ++++++++-------- 10 files changed, 9 insertions(+), 18 deletions(-) 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..d0512e4 100644 --- a/test/fixtures/external-source-map.js +++ b/test/fixtures/external-source-map.js @@ -1,3 +1,2 @@ -with SourceMap //#sourceMappingURL=external-source-map.map // comment \ No newline at end of file diff --git a/test/fixtures/external-source-map2.js b/test/fixtures/external-source-map2.js index 844e38d..e53e52c 100644 --- a/test/fixtures/external-source-map2.js +++ b/test/fixtures/external-source-map2.js @@ -1,3 +1,2 @@ -with SourceMap //#sourceMappingURL=data/external-source-map2.map // comment \ No newline at end of file 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..70d3b07 100644 --- a/test/fixtures/missing-source-map.js +++ b/test/fixtures/missing-source-map.js @@ -1,3 +1,2 @@ -with SourceMap //#sourceMappingURL=missing-source-map.map // comment \ No newline at end of file diff --git a/test/fixtures/missing-source-map2.js b/test/fixtures/missing-source-map2.js index 6257266..bdb5b7b 100644 --- a/test/fixtures/missing-source-map2.js +++ b/test/fixtures/missing-source-map2.js @@ -1,3 +1,2 @@ -with SourceMap //#sourceMappingURL=missing-source-map2.map // comment \ No newline at end of file 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..e8ee332 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, "// comment"), 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, "// comment"), 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, "//#sourceMappingURL=missing-source-map.map\n// comment"), 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, "// comment"), 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", From bf2c2eb8ee892999abdf4b47d827eb7434c5e3b8 Mon Sep 17 00:00:00 2001 From: diegofaria Date: Thu, 24 Aug 2017 21:14:02 +0200 Subject: [PATCH 3/3] fixed tests --- test/fixtures/external-source-map.js | 3 ++- test/fixtures/external-source-map2.js | 3 ++- test/fixtures/missing-source-map.js | 3 ++- test/fixtures/missing-source-map2.js | 3 ++- test/index.test.js | 10 +++++----- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/test/fixtures/external-source-map.js b/test/fixtures/external-source-map.js index d0512e4..950eefe 100644 --- a/test/fixtures/external-source-map.js +++ b/test/fixtures/external-source-map.js @@ -1,2 +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 e53e52c..ec0af23 100644 --- a/test/fixtures/external-source-map2.js +++ b/test/fixtures/external-source-map2.js @@ -1,2 +1,3 @@ +with SourceMap //#sourceMappingURL=data/external-source-map2.map -// comment \ No newline at end of file +// comment diff --git a/test/fixtures/missing-source-map.js b/test/fixtures/missing-source-map.js index 70d3b07..74e4038 100644 --- a/test/fixtures/missing-source-map.js +++ b/test/fixtures/missing-source-map.js @@ -1,2 +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 bdb5b7b..90ad43b 100644 --- a/test/fixtures/missing-source-map2.js +++ b/test/fixtures/missing-source-map2.js @@ -1,2 +1,3 @@ +with SourceMap //#sourceMappingURL=missing-source-map2.map -// comment \ No newline at end of file +// comment diff --git a/test/index.test.js b/test/index.test.js index e8ee332..e6f9c73 100644 --- a/test/index.test.js +++ b/test/index.test.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, "// 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, "// comment"), + should.equal(res, "with SourceMap\n// comment\n"), map.should.be.eql({ "version":3, "file":"external-source-map2.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, "//#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, "// comment"), + should.equal(res, "with SourceMap\n// comment\n"), map.should.be.eql({ "version":3, "file":"missing-source-map2.js", @@ -180,4 +180,4 @@ describe("source-map-loader", function() { done(); }); }); -}); \ No newline at end of file +});