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

gluejs

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gluejs - npm Package Compare versions

Comparing version 3.0.0-rc3 to 3.0.0-rc4

32

bin/get.js
#!/usr/bin/env node
var fs = require('fs'),
path = require('path'),
Minilog = require('minilog'),

@@ -11,7 +12,17 @@ Packer = require('../lib/amd/api.js');

'cache': { default: true },
'cache-method': { },
'cache-path': { },
'command': { },
'config': { },
'include': { },
'list-files': { },
'log': { default: 'warn' },
'main': { },
'log': { default: 'warn' }
'out': { },
'vendor': { },
'vendor-base': { }
})
.boolean('amd'),
.boolean('amd')
.boolean('cache')
.boolean('ls-config'),
argv = yargs.parse(process.argv);

@@ -31,2 +42,19 @@

if (argv['cache-path']) {
argv['cache-path'] = path.resolve(process.cwd(), argv['cache-path']);
}
if (argv['ls-config']) {
var sorted = {};
Object.keys(argv).sort().forEach(function(key) {
sorted[key] = argv[key];
});
if (argv['ls-config']) {
console.error('\nOptions:');
Object.keys(sorted).forEach(function(key) {
console.error(' --' + key + ' ' + require('util').inspect(sorted[key], null, 20, process.stderr.isTTY));
});
}
}
var p = new Packer();

@@ -33,0 +61,0 @@

@@ -45,2 +45,13 @@ var fs = require('fs'),

// handle duplicate files
var byContent = {},
canonicalName = {};
files.forEach(function(file) {
if (!byContent[file.content]) {
byContent[file.content] = [file];
} else {
byContent[file.content].push(file);
}
});
var ignoredIds = [],

@@ -87,5 +98,28 @@ notFound = {};

var source = (path.extname(file.filename) == '.json' ? 'module.exports = ' : '') +
fs.readFileSync(file.content).toString();
var source,
isDuplicate = byContent[file.content].length > 1,
isMainFile = false;
if (isDuplicate) {
// prefer the shortest name
if (!canonicalName[file.content]) {
canonicalName[file.content] = byContent[file.content].map(function(file) {
// not file.content
return file.filename;
}).sort(function(a, b) { return a.length - b.length; })[0];
}
isMainFile = (canonicalName[file.content] != file.filename);
}
// for duplicates which are not the main file
if (isDuplicate && isMainFile) {
source = 'module.exports=require(\'' + idLookup[canonicalName[file.content]] + '\');';
if (!idLookup[canonicalName[file.content]]) {
throw new Error('Could not resolve file: ' + file.filename +
'. Please empty the gluejs cache folder and retry.');
}
// console.log('dup replaced with redirect', file.filename, '=>',
// canonicalName[file.content], 'id:', idLookup[canonicalName[file.content]]);
} else {
source = (path.extname(file.filename) == '.json' ? 'module.exports = ' : '') +
fs.readFileSync(file.content).toString();
}
var dep = {

@@ -96,3 +130,3 @@ id: idLookup[file.filename],

};
if (sourceMapEnabled) {
if (sourceMapEnabled && !isDuplicate || (isDuplicate && isMainFile)) {
dep.sourceFile = file.filename;

@@ -99,0 +133,0 @@ }

4

package.json
{
"name": "gluejs",
"description": "Build CommonJS modules for the browser via a chainable API",
"version": "3.0.0-rc3",
"version": "3.0.0-rc4",
"author": {

@@ -42,3 +42,3 @@ "name": "Mikito Takada",

"resolve": "~0.7.1",
"transform-runner": "~0.1.3",
"transform-runner": "~0.1.5",
"umd": "~2.1.0",

@@ -45,0 +45,0 @@ "yargs": "~1.2.6"

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