gulp-sourcemaps
Advanced tools
Comparing version 1.7.1 to 1.7.3
30
index.js
@@ -20,2 +20,4 @@ 'use strict'; | ||
module.exports.init = function init(options) { | ||
var debug = require('debug-fabulous')()(PLUGIN_NAME + ':init'); | ||
function sourceMapInit(file, encoding, callback) { | ||
@@ -37,2 +39,3 @@ /*jshint validthis:true */ | ||
} | ||
debug(function () {return options;}); | ||
@@ -43,2 +46,3 @@ var fileContent = file.contents.toString(); | ||
if (options.loadMaps) { | ||
debug('loadMaps'); | ||
var sourcePath = ''; //root path for the sources in the map | ||
@@ -105,7 +109,7 @@ | ||
if (options.debug) | ||
console.log(PLUGIN_NAME + '-init: No source content for "' + source + '". Loading from file.'); | ||
debug('No source content for "' + source + '". Loading from file.'); | ||
sourceContent = stripBom(fs.readFileSync(absPath, 'utf8')); | ||
} catch (e) { | ||
if (options.debug) | ||
console.warn(PLUGIN_NAME + '-init: source file not found: ' + absPath); | ||
debug('warn: source file not found: ' + absPath); | ||
} | ||
@@ -123,2 +127,3 @@ } | ||
if (!sourceMap && options.identityMap) { | ||
debug(function () { return 'identityMap'; }); | ||
var fileType = path.extname(file.path); | ||
@@ -148,3 +153,5 @@ var source = unixStylePath(file.relative); | ||
} else if (fileType === '.css') { | ||
debug('css'); | ||
var ast = css.parse(fileContent, {silent: true}); | ||
debug(function () { return ast;}); | ||
var registerTokens = function(ast) { | ||
@@ -158,7 +165,15 @@ if (ast.position) { | ||
} | ||
function logAst(key, ast) { | ||
debug(function () { return 'key: ' + key;}); | ||
debug(function () { return ast[key];}); | ||
} | ||
for (var key in ast) { | ||
logAst(key, ast); | ||
if (key !== "position") { | ||
if (Object.prototype.toString.call(ast[key]) === '[object Object]') { | ||
registerTokens(ast[key]); | ||
} else if (ast[key].constructor === Array) { | ||
} else if (Array.isArray(ast[key])) { | ||
debug(function () { return "@@@@ ast[key] isArray @@@@";}); | ||
for (var i = 0; i < ast[key].length; i++) { | ||
@@ -205,2 +220,4 @@ registerTokens(ast[key][i]); | ||
module.exports.write = function write(destPath, options) { | ||
var debug = require('debug-fabulous')()(PLUGIN_NAME + ':write'); | ||
if (options === undefined && Object.prototype.toString.call(destPath) === '[object Object]') { | ||
@@ -220,2 +237,3 @@ options = destPath; | ||
debug(function() {return options;}); | ||
function sourceMapWrite(file, encoding, callback) { | ||
@@ -265,7 +283,7 @@ /*jshint validthis:true */ | ||
if (options.debug) | ||
console.log(PLUGIN_NAME + '-write: No source content for "' + sourceMap.sources[i] + '". Loading from file.'); | ||
debug('No source content for "' + sourceMap.sources[i] + '". Loading from file.'); | ||
sourceMap.sourcesContent[i] = stripBom(fs.readFileSync(sourcePath, 'utf8')); | ||
} catch (e) { | ||
if (options.debug) | ||
console.warn(PLUGIN_NAME + '-write: source file not found: ' + sourcePath); | ||
debug('source file not found: ' + sourcePath); | ||
} | ||
@@ -279,3 +297,3 @@ } | ||
var extension = file.relative.split('.').pop(); | ||
var newline = detectNewline(file.contents.toString()); | ||
var newline = detectNewline.graceful(file.contents.toString()); | ||
var commentFormatter; | ||
@@ -282,0 +300,0 @@ |
{ | ||
"name": "gulp-sourcemaps", | ||
"version": "1.7.1", | ||
"version": "1.7.3", | ||
"description": "Source map support for Gulp.js", | ||
@@ -26,2 +26,3 @@ "homepage": "http://github.com/floridoo/gulp-sourcemaps", | ||
"css": "2.X", | ||
"debug-fabulous": "0.0.X", | ||
"detect-newline": "2.X", | ||
@@ -35,7 +36,8 @@ "graceful-fs": "4.X", | ||
"devDependencies": { | ||
"coveralls": "2.X", | ||
"faucet": "0.0.X", | ||
"hook-std": "0.2.X", | ||
"istanbul": "0.X", | ||
"jshint": "2.X", | ||
"tape": "4.X", | ||
"istanbul": "0.X", | ||
"faucet": "0.0.X", | ||
"coveralls": "2.X" | ||
"tape": "4.X" | ||
}, | ||
@@ -42,0 +44,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
26764
335
0
10
6
+ Addeddebug-fabulous@0.0.X
+ Addeddebug@2.6.9(transitive)
+ Addeddebug-fabulous@0.0.4(transitive)
+ Addedlazy-debug-legacy@0.0.1(transitive)
+ Addedms@2.0.0(transitive)
+ Addedobject-assign@4.1.0(transitive)