broccoli-sourcemap-concat
Advanced tools
Comparing version 0.2.7 to 0.3.0
@@ -23,3 +23,13 @@ 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({ | ||
@@ -29,3 +39,5 @@ outputFile: path.join(outDir, this.outputFile), | ||
baseDir: inDir, | ||
cache: this.encoderCache | ||
cache: this.encoderCache, | ||
mapFile: mapFile, | ||
mapURL: mapURL | ||
}); | ||
@@ -32,0 +44,0 @@ |
var SourceMapAwareConcat = require('./concat-with-maps'); | ||
var SimpleConcat = require('./simple-concat'); | ||
var helpers = require('broccoli-kitchen-sink-helpers'); | ||
@@ -10,7 +9,2 @@ module.exports = function(inputTree, options) { | ||
// This is here because broccoli-concat does the same thing, and we | ||
// don't want to surprise people by breaking only when they suddenly | ||
// disable sourcemaps. | ||
helpers.assertAbsolutePaths([options.outputFile]); | ||
var extensions = (options.sourceMapsForExtensions || ['js']); | ||
@@ -17,0 +11,0 @@ for (var i=0; i<extensions.length; i++) { |
{ | ||
"name": "broccoli-sourcemap-concat", | ||
"version": "0.2.7", | ||
"version": "0.3.0", | ||
"description": "Fast, good-enough concatenation with source maps.", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
"combined-stream": "0.0.7", | ||
"fast-sourcemap-concat": " ^0.1.5", | ||
"fast-sourcemap-concat": " ^0.2.0", | ||
"lodash-node": "^2.4.1", | ||
@@ -26,0 +26,0 @@ "mkdirp": "^0.5.0", |
@@ -156,2 +156,15 @@ /* global describe, afterEach, it, expect */ | ||
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() { | ||
@@ -168,4 +181,7 @@ if (builder) { | ||
return { | ||
in: function(result) { | ||
var actualContent = fs.readFileSync(path.join(result.directory, filename), 'utf-8'); | ||
in: function(result, subdir) { | ||
if (!subdir) { | ||
subdir = '.'; | ||
} | ||
var actualContent = fs.readFileSync(path.join(result.directory, subdir, filename), 'utf-8'); | ||
fs.writeFileSync(path.join(__dirname, 'actual', filename), actualContent); | ||
@@ -199,3 +215,3 @@ | ||
if (/\.map$/.test(filename)) { | ||
expect(JSON.parse(actualContent)).to.deep.equal(JSON.parse(expectedContent), 'discrepancy in ' + filename); | ||
expect(JSON.parse(actualContent)).to.deep.equal(expectedContent ? JSON.parse(expectedContent) : undefined, 'discrepancy in ' + filename); | ||
} else { | ||
@@ -202,0 +218,0 @@ expect(actualContent).to.equal(expectedContent, 'discrepancy in ' + filename); |
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
21392
33
517
+ Addedansi-regex@0.2.1(transitive)
+ Addedansi-styles@1.1.0(transitive)
+ Addedchalk@0.5.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfast-sourcemap-concat@0.2.7(transitive)
+ Addedhas-ansi@0.1.0(transitive)
+ Addedms@2.0.0(transitive)
+ Addedsource-map@0.4.4(transitive)
+ Addedstrip-ansi@0.3.0(transitive)
+ Addedsupports-color@0.2.0(transitive)
- Removedfast-sourcemap-concat@0.1.5(transitive)
- Removedsource-map@0.1.43(transitive)