diff --git a/codec/absolute.js b/codec/absolute.js index 4d27d2e..7c96a69 100644 --- a/codec/absolute.js +++ b/codec/absolute.js @@ -40,4 +40,4 @@ function encode(absolute) { * @returns {string|undefined} The source-map root applicable to any encoded uri */ function root() { -} \ No newline at end of file +} diff --git a/codec/bower-component.js b/codec/bower-component.js index bca25b9..9347e96 100644 --- a/codec/bower-component.js +++ b/codec/bower-component.js @@ -5,7 +5,7 @@ * @type {{name:string, decode:function, abstract:boolean}} */ module.exports = { - name : 'bower-component', + name : 'bowerComponent', decode : decode, abstract: true }; @@ -18,4 +18,4 @@ module.exports = { */ function decode(uri) { return /^\/?([\w-]+)\s+\(bower component\)$/.test(uri); -} \ No newline at end of file +} diff --git a/codec/npm-module.js b/codec/npm-module.js index 8d1bd35..00bbef5 100644 --- a/codec/npm-module.js +++ b/codec/npm-module.js @@ -12,7 +12,7 @@ var getContextDirectory = require('./utility/get-context-directory'); * @type {{name:string, decode: function}} */ module.exports = { - name : 'npm-module', + name : 'npmModule', decode: decode }; @@ -32,4 +32,4 @@ function decode(uri) { isValid = !!absFile && fs.existsSync(absFile) && fs.statSync(absFile).isFile(); return isValid && absFile; } -} \ No newline at end of file +} diff --git a/codec/output-relative.js b/codec/output-relative.js index 0c9babb..0c3df4b 100644 --- a/codec/output-relative.js +++ b/codec/output-relative.js @@ -10,7 +10,7 @@ var getOutputDirectory = require('./utility/get-output-directory'); * @type {{name:string, decode: function, encode: function, root: function}} */ module.exports = { - name : 'output-relative', + name : 'outputRelative', decode: decode, encode: encode, root : getOutputDirectory @@ -46,4 +46,4 @@ function encode(absolute) { else { return path.relative(base, absolute); } -} \ No newline at end of file +} diff --git a/codec/project-relative.js b/codec/project-relative.js index 48dfb8c..97c2e3a 100644 --- a/codec/project-relative.js +++ b/codec/project-relative.js @@ -11,7 +11,7 @@ var getContextDirectory = require('./utility/get-context-directory'), * @type {{name:string, decode: function, encode: function, root: function}} */ module.exports = { - name : 'project-relative', + name : 'projectRelative', decode: decode, encode: encode, root : getContextDirectory @@ -47,4 +47,4 @@ function encode(absolute) { else { return '/' + enhancedRelative(base, absolute); } -} \ No newline at end of file +} diff --git a/codec/source-relative.js b/codec/source-relative.js index eb0d226..4d366af 100644 --- a/codec/source-relative.js +++ b/codec/source-relative.js @@ -8,7 +8,7 @@ var path = require('path'), * @type {{name:string, decode: function, encode: function, root: function}} */ module.exports = { - name : 'source-relative', + name : 'sourceRelative', decode: decode, encode: encode, root : root @@ -49,4 +49,4 @@ function encode(absolute) { function root() { /* jshint validthis:true */ return this.context; -} \ No newline at end of file +} diff --git a/codec/webpack-bootstrap.js b/codec/webpack-bootstrap.js index 0eaa085..4712423 100644 --- a/codec/webpack-bootstrap.js +++ b/codec/webpack-bootstrap.js @@ -5,7 +5,7 @@ * @type {{name:string, decode:function, abstract:boolean}} */ module.exports = { - name : 'webpack-bootstrap', + name : 'webpackBootstrap', decode : decode, abstract: true }; @@ -18,4 +18,4 @@ module.exports = { */ function decode(uri) { return /^webpack\/bootstrap\s+\w{20}$/.test(uri); -} \ No newline at end of file +} diff --git a/codec/webpack-protocol.js b/codec/webpack-protocol.js index a89460f..941ca4f 100644 --- a/codec/webpack-protocol.js +++ b/codec/webpack-protocol.js @@ -7,7 +7,7 @@ var projectRelative = require('./project-relative'); * @type {{name:string, decode: function, encode: function, root: function}} */ module.exports = { - name : 'webpack-protocol', + name : 'webpackProtocol', decode: decode, encode: encode, root : root @@ -42,4 +42,4 @@ function encode(absolute) { * @returns {string|undefined} The source-map root applicable to any encoded uri */ function root() { -} \ No newline at end of file +} diff --git a/lib/loader.js b/lib/loader.js index 150faa2..9f445dc 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -2,10 +2,7 @@ var path = require('path'); -var loaderUtils = require('loader-utils'), - camelcase = require('camelcase'); - -var PACKAGE_NAME = require('../package.json').name; +var loaderUtils = require('loader-utils'); var process = require('./process'); @@ -28,7 +25,7 @@ function loader(content, sourceMap) { // webpack 4: loader.options no longer defined var options = Object.assign( {}, - this.options && this.options[camelcase(PACKAGE_NAME)], + this.options && this.options.adjustSourcemapLoader, loaderUtils.getOptions(this), {sep: path.sep} ); @@ -40,4 +37,4 @@ function loader(content, sourceMap) { this.callback(null, content, outputMap); } -module.exports = loader; \ No newline at end of file +module.exports = loader; diff --git a/lib/process/index.js b/lib/process/index.js index d947add..8253bf6 100644 --- a/lib/process/index.js +++ b/lib/process/index.js @@ -1,7 +1,5 @@ 'use strict'; -var camelcase = require('camelcase'); - var debugMessage = require('./debug-message'), toRegExp = require('./to-reg-exp'), throwErrors = require('./throw-errors'), @@ -104,7 +102,7 @@ function process(context, opt, sourceMapOrSource) { return inputMap ? outputMap : outputSources ? outputSources[0] : undefined; function testNamedCodec(value) { - return (camelcase(value.name) === options.format); + return (value.name === options.format); } function insertAbstractSources(value, i) { @@ -116,4 +114,4 @@ function process(context, opt, sourceMapOrSource) { } } -module.exports = process; \ No newline at end of file +module.exports = process; diff --git a/package-lock.json b/package-lock.json index 7fc9d4d..7b095e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,14 +4,6 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "assert": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", - "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", - "requires": { - "util": "0.10.3" - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -33,11 +25,6 @@ "concat-map": "0.0.1" } }, - "camelcase": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", - "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==" - }, "cli": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", @@ -187,7 +174,8 @@ "inherits": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true }, "isarray": { "version": "0.0.1", @@ -304,14 +292,6 @@ "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", "dev": true }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "requires": { - "inherits": "2.0.1" - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index bc8c214..a2a3a53 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ }, "homepage": "https://github.com/bholloway/adjust-sourcemap-loader", "dependencies": { - "camelcase": "5.0.0", "loader-utils": "1.2.3", "object-path": "0.11.4", "regex-parser": "2.2.10" diff --git a/readme.md b/readme.md index 728cf70..a418263 100644 --- a/readme.md +++ b/readme.md @@ -76,7 +76,7 @@ Where `...` is a hash of any of the following options. * **`fail`** : `boolean` Implies an **Error** if a source-map source cannot be decoded. -* **`format`** : `string` Optional output format for source-map `sources`. Must be the camel-case name of one of the available `codecs`. Omitting the format will result in **no change** and the outgoing source-map will match the incomming one. +* **`format`** : `string` Optional output format for source-map `sources`. Must be the name of one of the available `codecs`. Omitting the format will result in **no change** and the outgoing source-map will match the incomming one. * **`root`** : `boolean` A boolean flag that indices that a `sourceRoot` path sould be included in the output map. This is contingent on a `format` being specified.