broccoli-sourcemap-concat
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -23,13 +23,3 @@ var helpers = require('broccoli-kitchen-sink-helpers'); | ||
var firstSection = true; | ||
var mapFile, mapURL; | ||
if (this.mapDir) { | ||
mapFile = path.join( | ||
outDir, | ||
this.mapDir, | ||
path.basename(this.outputFile).replace(/\.\w+$/, '') + '.map' | ||
); | ||
mapURL = '/' + this.mapDir + '/' + path.basename(mapFile); | ||
} | ||
var concat = this.concat = new ConcatWithSourcemap({ | ||
@@ -39,5 +29,3 @@ outputFile: path.join(outDir, this.outputFile), | ||
baseDir: inDir, | ||
cache: this.encoderCache, | ||
mapFile: mapFile, | ||
mapURL: mapURL | ||
cache: this.encoderCache | ||
}); | ||
@@ -44,0 +32,0 @@ |
14
index.js
var SourceMapAwareConcat = require('./concat-with-maps'); | ||
var SimpleConcat = require('./simple-concat'); | ||
var merge = require('lodash-node/modern/objects/merge'); | ||
@@ -9,7 +10,10 @@ module.exports = function(inputTree, options) { | ||
var extensions = (options.sourceMapsForExtensions || ['js']); | ||
for (var i=0; i<extensions.length; i++) { | ||
var ext = '.' + extensions[i].replace(/^\./,''); | ||
if (options.outputFile.slice(-1 * ext.length) === ext) { | ||
return new SourceMapAwareConcat(inputTree, options); | ||
var config = merge({ enabled: true}, options.sourceMapConfig); | ||
if (config.enabled) { | ||
var extensions = (config.extensions || ['js']); | ||
for (var i=0; i<extensions.length; i++) { | ||
var ext = '.' + extensions[i].replace(/^\./,''); | ||
if (options.outputFile.slice(-1 * ext.length) === ext) { | ||
return new SourceMapAwareConcat(inputTree, options); | ||
} | ||
} | ||
@@ -16,0 +20,0 @@ } |
{ | ||
"name": "broccoli-sourcemap-concat", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Fast, good-enough concatenation with source maps.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -58,3 +58,3 @@ /* global describe, afterEach, it, expect */ | ||
header: "/* This is my header. */", | ||
sourceMapsForExtensions: [] | ||
sourceMapConfig: { enabled: false } | ||
}); | ||
@@ -73,3 +73,3 @@ builder = new broccoli.Builder(tree); | ||
header: "/* This is my header. */", | ||
sourceMapsForExtensions: [] | ||
sourceMapConfig: { extensions: [] } | ||
}); | ||
@@ -124,3 +124,3 @@ builder = new broccoli.Builder(tree); | ||
footerFiles: ['other/third.js', 'other/fourth.js'], | ||
sourceMapsForExtensions: [] | ||
sourceMapConfig: { extensions: [] } | ||
}); | ||
@@ -159,15 +159,2 @@ builder = new broccoli.Builder(tree); | ||
it('can use mapDir', function(){ | ||
var tree = concat(fixtures, { | ||
outputFile: '/assets/mapped.js', | ||
inputFiles: ['inner/*.js'], | ||
mapDir: 'maps' | ||
}); | ||
builder = new broccoli.Builder(tree); | ||
return builder.build().then(function(result) { | ||
expectFile('mapped.js').in(result, 'assets'); | ||
expectFile('mapped.map').in(result, 'maps'); | ||
}); | ||
}); | ||
afterEach(function() { | ||
@@ -174,0 +161,0 @@ if (builder) { |
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
20313
31
489