Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-sourcemap-concat

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-sourcemap-concat - npm Package Compare versions

Comparing version 0.2.7 to 0.3.0

test/expected/mapped.js

14

concat-with-maps.js

@@ -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 @@

6

index.js
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);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc