gulp-sourcemaps
Advanced tools
Comparing version 2.0.0 to 2.0.1
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(() => {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(() => { 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(() => { return ast;}); | ||
var registerTokens = function(ast) { | ||
@@ -158,7 +165,15 @@ if (ast.position) { | ||
} | ||
function logAst(key, ast) { | ||
debug(() => { return 'key: ' + key;}); | ||
debug(() => { 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(() => { 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(()=> {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": "2.0.0", | ||
"version": "2.0.1", | ||
"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": [ |
@@ -267,3 +267,3 @@ ## gulp-sourcemaps [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] | ||
// source map files are named *.map instead of *.js.map | ||
return mapFile.replace('.js.map', '.map'); | ||
return mapFilePath.replace('.js.map', '.map'); | ||
} | ||
@@ -270,0 +270,0 @@ })) |
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
26726
335
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)