adjust-sourcemap-loader
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -8,5 +8,8 @@ module.exports = [ | ||
require('./output-relative'), | ||
require('./output-root-relative'), | ||
require('./project-relative'), | ||
require('./project-root-relative'), | ||
require('./source-relative'), | ||
require('./source-root-relative'), | ||
require('./absolute') | ||
]; | ||
]; |
@@ -21,3 +21,3 @@ 'use strict'; | ||
* Decode the given uri. | ||
* Any path with or without leading slash is tested against context directory. | ||
* Any path with without leading slash is tested against output directory. | ||
* @this {{options: object}} A loader or compilation | ||
@@ -29,3 +29,3 @@ * @param {string} uri A source uri to decode | ||
/* jshint validthis:true */ | ||
var base = getOutputDirectory.call(this), | ||
var base = !uri.startsWith('/') && getOutputDirectory.call(this), | ||
absFile = !!base && path.normalize(path.join(base, uri)), | ||
@@ -40,3 +40,3 @@ isValid = !!absFile && fs.existsSync(absFile) && fs.statSync(absFile).isFile(); | ||
* @param {string} absolute An absolute file path to encode | ||
* @returns {string} A uri | ||
* @returns {string} A uri without leading slash | ||
*/ | ||
@@ -43,0 +43,0 @@ function encode(absolute) { |
@@ -10,3 +10,3 @@ 'use strict'; | ||
/** | ||
* Codec for relative paths with respect to the context directory. | ||
* Codec for relative paths with respect to the project directory. | ||
* @type {{name:string, decode: function, encode: function, root: function}} | ||
@@ -23,3 +23,3 @@ */ | ||
* Decode the given uri. | ||
* Any path with or without leading slash is tested against context directory. | ||
* Any path with without leading slash is tested against project directory. | ||
* @this {{options: object}} A loader or compilation | ||
@@ -31,4 +31,4 @@ * @param {string} uri A source uri to decode | ||
/* jshint validthis:true */ | ||
var base = getContextDirectory.call(this), | ||
absFile = path.normalize(path.join(base, uri)), | ||
var base = !uri.startsWith('/') && getContextDirectory.call(this), | ||
absFile = !!base && path.normalize(path.join(base, uri)), | ||
isValid = !!absFile && fs.existsSync(absFile) && fs.statSync(absFile).isFile(); | ||
@@ -42,3 +42,3 @@ return isValid && absFile; | ||
* @param {string} absolute An absolute file path to encode | ||
* @returns {string} A uri | ||
* @returns {string} A uri without leading slash | ||
*/ | ||
@@ -52,4 +52,4 @@ function encode(absolute) { | ||
else { | ||
return '/' + enhancedRelative(base, absolute); | ||
return enhancedRelative(base, absolute); | ||
} | ||
} |
@@ -7,3 +7,3 @@ 'use strict'; | ||
/** | ||
* Codec for relative paths with respect to the context of the file being compiled. | ||
* Codec for relative paths with respect to the source directory. | ||
* @type {{name:string, decode: function, encode: function, root: function}} | ||
@@ -20,4 +20,3 @@ */ | ||
* Decode the given uri. | ||
* Any path with or without leading slash is tested against context directory. | ||
* Exclude module paths containing `~`. | ||
* Any path without leading slash is tested against source directory. | ||
* @this {{options: object}} A loader or compilation | ||
@@ -29,3 +28,3 @@ * @param {string} uri A source uri to decode | ||
/* jshint validthis:true */ | ||
var base = this.context, | ||
var base = !uri.startsWith('/') && this.context, | ||
absFile = !!base && path.normalize(path.join(base, uri)), | ||
@@ -40,3 +39,3 @@ isValid = !!absFile && fs.existsSync(absFile) && fs.statSync(absFile).isFile(); | ||
* @param {string} absolute An absolute file path to encode | ||
* @returns {string} A uri | ||
* @returns {string} A uri without leading slash | ||
*/ | ||
@@ -43,0 +42,0 @@ function encode(absolute) { |
{ | ||
"name": "adjust-sourcemap-loader", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Webpack loader that adjusts source maps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
41996
33
951