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

static-module

Package Overview
Dependencies
Maintainers
39
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

static-module - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

20

index.js

@@ -36,2 +36,16 @@ var fs = require('fs');

body = buf.toString('utf8').replace(/^#!/, '//#!');
var matches = false;
for (var key in modules) {
if (body.indexOf(key) !== -1) {
matches = true;
break;
}
}
if (!matches) {
// just pass it through
output.end(buf);
return;
}
if (opts.sourceMap) {

@@ -44,7 +58,3 @@ inputMap = convertSourceMap.fromSource(body);

for (var key in modules) {
if (body.indexOf(key) === -1) continue;
falafel(body, parserOpts, walk);
break;
}
falafel(body, parserOpts, walk);
}

@@ -51,0 +61,0 @@ catch (err) { return error(err) }

{
"name": "static-module",
"version": "2.2.2",
"version": "2.2.3",
"description": "convert module usage to inline expressions",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -89,1 +89,39 @@ var test = require('tape');

});
test('retain input source map when file has no static-module use', function (t) {
t.plan(4);
var content = fs.readFileSync(__dirname + '/sourcemap/main.js', 'utf8');
var minified = uglify.minify({ 'main.js': content }, {
output: { beautify: true },
sourceMap: {
url: 'inline',
includeSources: true
}
});
var transform = staticModule({
not_sheetify: function () { return 'whatever'; }
}, { sourceMap: true, inputFilename: 'main.js' });
transform.pipe(concat({ encoding: 'string' }, function (res) {
var consumer = new SourceMapConsumer(convertSourceMap.fromSource(res).toObject());
var mapped = consumer.originalPositionFor({
line: 7,
column: 0
});
t.equal(mapped.line, 8);
t.equal(mapped.column, 0);
mapped = consumer.originalPositionFor({
line: 7,
column: 21
});
t.equal(mapped.line, 10);
t.equal(mapped.column, 0);
}));
transform.end(minified.code);
});
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