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

minifyify

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minifyify - npm Package Compare versions

Comparing version 7.0.1 to 7.0.2

18

lib/minifier.js

@@ -117,3 +117,3 @@ var Minifier

//Normalize the path separators to match what Browserify stores in the original Source Map
file = path.relative(basedir, file)
file = this.normalizePath(file);

@@ -309,4 +309,5 @@ write = function (data) {

bundleMap.eachMapping(function (mapping) {
if(self.fileExists(mapping.source)) {
mapSourceToLine(mapping.source, mapping.generatedLine);
var source = self.normalizePath(mapping.source);
if(self.fileExists(source)) {
mapSourceToLine(source, mapping.generatedLine);
}

@@ -439,2 +440,13 @@ // Not a known source, pass thru the mapping

Minifier.prototype.normalizePath = function (file) {
// Is file a relative path?
if (!/^\w:|^\//.test(file)) {
return file.replace(/\\/g, '/');
}
// Resolve absolute paths relative to basedir
// Force '/' as path separator
var basedir = this.opts.basedir || process.cwd();
return path.relative(basedir, file).replace(/\\/g, '/');
}
module.exports = Minifier;

2

package.json

@@ -21,3 +21,3 @@ {

],
"version": "7.0.1",
"version": "7.0.2",
"repository": {

@@ -24,0 +24,0 @@ "type": "git",

@@ -157,3 +157,3 @@ Minifyify

* Wait.. Why did the total size (souce code + map) get BIGGER??
* Wait.. Why did the total size (source code + map) get BIGGER??

@@ -160,0 +160,0 @@ It's not immediately obvious, but the more you minify code, the bigger the sourcemap gets. Browserify can get away with merely mapping lines to lines because it is going from uncompressed code to uncompressed code. Minifyify squishes multiple lines together, so the sourcemap has to carry more information.

@@ -82,2 +82,4 @@ /* globals jake */

validate(src, map)
// Check if sourcesContent matches the original files
validateSourcesContent(map, 'simple file');
}, 'The bundle should have a valid sourcemap');

@@ -104,2 +106,4 @@ next();

validate(src, fs.readFileSync(outMapFile).toString());
// Check if sourcesContent matches the original files
validateSourcesContent(map, 'simple file');

@@ -127,2 +131,4 @@ }, 'The bundle should have a valid sourcemap');

validate(src, fs.readFileSync(outMapFile).toString());
// Check if sourcesContent matches the original files
validateSourcesContent(map, 'simple file');

@@ -200,2 +206,4 @@ }, 'The bundle should have a valid sourcemap');

validate(src, map)
// Check if sourcesContent matches the original files
validateSourcesContent(map, 'simple file');
}, 'The bundle should have a valid sourcemap');

@@ -207,2 +215,4 @@

validate(src, map)
// Check if sourcesContent matches the original files
validateSourcesContent(map, 'simple file');
}, 'The bundle should have a valid sourcemap');

@@ -214,2 +224,24 @@ next();

function validateSourcesContent(map, entryScript) {
var mapData = JSON.parse(map);
var dir = path.dirname(fixtures.entryScript(entryScript))
// Find source entry in map
// Start from 1 to skip browserify prelude-file
for(var i = 1; i < mapData.sources.length; i++) {
var originalSource
// Try to resolve filename from entry-file folder
try {
originalSource = fs.readFileSync(path.resolve(dir, mapData.sources[i])).toString();
} catch(err) {
// If that fails, resolve from cwd
try {
originalSource = fs.readFileSync(path.resolve(process.cwd(), mapData.sources[i])).toString();
} catch(err) {
throw new Error('Could not find sourcefile ' + mapData.sources[i] + ' to verify.');
}
}
assert.equal(mapData.sourcesContent[i], originalSource, 'sourcesContent and original source file should be identical.' + mapData.sources[i]);
}
}
module.exports = tests;
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