racer-bundle
Advanced tools
Comparing version 0.2.4 to 0.2.5
37
index.js
@@ -0,5 +1,7 @@ | ||
var fs = require('fs'); | ||
var browserify = require('browserify'); | ||
var watchify = require('watchify'); | ||
var uglify = require('uglify-js'); | ||
var watchify = require('watchify'); | ||
var convertSourceMap = require('convert-source-map'); | ||
var anymatch = require('anymatch'); | ||
@@ -33,4 +35,2 @@ var util; | ||
delay: 100, | ||
// Ignore derby views since they are updated seperately | ||
ignoreWatch: '**/derby/lib/*_views.js' | ||
}); | ||
@@ -42,5 +42,17 @@ | ||
// This gets fired everytime a dependent file is changed | ||
var ignore = (options.ignore == null) ? [] : options.ignore | ||
// Chokidar/watchify provide the realpath's of files as their ids, so we | ||
// add any realpath values that don't match the provided filepath's. | ||
ignore.forEach(function(filepath) { | ||
var realpath = fs.realpathSync(filepath); | ||
if (realpath !== filepath) ignore.push(realpath); | ||
}); | ||
var matchIgnorePaths = anymatch(ignore) | ||
// This gets fired every time a dependent file is changed | ||
w.on('update', function(ids) { | ||
console.log('Files changed:', ids.toString()); | ||
// If all the changed files are ignoreable, return before bundling | ||
if (ids.every(matchIgnorePaths)) { | ||
return console.log('Ignoring update') | ||
} | ||
callBundle(this, minify, options.onRebundle); | ||
@@ -70,8 +82,15 @@ }); | ||
outSourceMap: 'map', | ||
inSourceMap: inSourceMap | ||
inSourceMap: inSourceMap, | ||
compress: false | ||
}); | ||
var mapObject = JSON.parse(result.map); | ||
// Uglify doesn't include the source content in the map, so copy over from | ||
// the map that browserify generates | ||
var mapObject = JSON.parse(result.map); | ||
mapObject.sourcesContent = inSourceMap.sourcesContent; | ||
// the map that browserify generates. However, before doing this, we must | ||
// first remove any empty sourceContent items since UglifyJS ignores those | ||
// files when populating the outSourceMap.sources array. | ||
mapObject.sourcesContent = inSourceMap.sourcesContent.filter(isNotEmptyString) | ||
if (mapObject.sources.length != mapObject.sourcesContent.length) { | ||
console.error('Invalid sourcemap detected. sources.length does not match sourcesContent.length') | ||
} | ||
var map = JSON.stringify(mapObject); | ||
@@ -81,1 +100,3 @@ cb(null, result.code, map); | ||
} | ||
function isNotEmptyString(str) { return str !== '' } |
{ | ||
"name": "racer-bundle", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Create Browserify package for a Racer or Derby app", | ||
@@ -19,3 +19,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"browserify": "^12.0.1", | ||
"anymatch": "^1.3.0", | ||
"browserify": "^13.0.1", | ||
"convert-source-map": "^1.1.1", | ||
@@ -22,0 +23,0 @@ "uglify-js": "^2.4.24", |
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6353
98
5
1
1
+ Addedanymatch@^1.3.0
+ Addedanymatch@1.3.2(transitive)
+ Addedarr-diff@2.0.0(transitive)
+ Addedarray-unique@0.2.1(transitive)
+ Addedbraces@1.8.5(transitive)
+ Addedbrowserify@13.3.0(transitive)
+ Addedbuffer@4.9.2(transitive)
+ Addedexpand-brackets@0.1.5(transitive)
+ Addedexpand-range@1.8.2(transitive)
+ Addedextglob@0.3.2(transitive)
+ Addedfilename-regex@2.0.1(transitive)
+ Addedfill-range@2.2.4(transitive)
+ Addedfor-own@0.1.5(transitive)
+ Addedglob-base@0.3.0(transitive)
+ Addedglob-parent@2.0.0(transitive)
+ Addedis-dotfile@1.0.3(transitive)
+ Addedis-equal-shallow@0.1.3(transitive)
+ Addedis-extglob@1.0.0(transitive)
+ Addedis-glob@2.0.1(transitive)
+ Addedis-number@2.1.04.0.0(transitive)
+ Addedis-posix-bracket@0.1.1(transitive)
+ Addedis-primitive@2.0.0(transitive)
+ Addedmath-random@1.0.4(transitive)
+ Addedmicromatch@2.3.11(transitive)
+ Addedobject.omit@2.0.1(transitive)
+ Addedparse-glob@3.0.4(transitive)
+ Addedpreserve@0.2.0(transitive)
+ Addedrandomatic@3.1.1(transitive)
+ Addedregex-cache@0.4.4(transitive)
- Removedassert@1.3.0(transitive)
- Removedbase64-js@0.0.8(transitive)
- Removedbrowserify@12.0.2(transitive)
- Removedbuffer@3.6.2(transitive)
- Removedglob@5.0.15(transitive)
- Removedinherits@2.0.1(transitive)
- Removedisarray@0.0.1(transitive)
- Removedutil@0.10.3(transitive)
Updatedbrowserify@^13.0.1