Socket
Socket
Sign inDemoInstall

traceur

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

traceur - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

src/node/module-load-override.js

7

package.json
{
"name": "traceur",
"version": "0.0.3",
"version": "0.0.4",
"description": "Experimental ES6 to ES5 compiler",

@@ -38,5 +38,6 @@ "keywords": [

"devDependencies": {
"closure-library": ">=1.0",
"source-map": "0.1.16"
"source-map": "0.1.16",
"mocha": ">=1.9",
"chai": ">=1.5"
}
}

@@ -34,3 +34,6 @@ [![Build Status](https://travis-ci.org/google/traceur-compiler.png)](https://travis-ci.org/google/traceur-compiler)

We also presented Traceur at NodeConf 2011. The video is
available on [YouTube](http://www.youtube.com/watch?feature=player_detailpage&v=ntDZa7ekFEA).
Questions, suggestions, and comments can be directed to the
[discussion group](http://groups.google.com/group/traceur-compiler-discuss).

@@ -47,4 +47,4 @@ // Copyright 2013 Traceur Authors.

console.log('');
console.log(' $ %s a.js', cmdName);
console.log(' $ %s b.js c.js --out compiled.js', cmdName);
console.log(' $ %s a.js [args]', cmdName);
console.log(' $ %s --out compiled.js b.js c.js', cmdName);
console.log('');

@@ -116,2 +116,6 @@ });

}
} else if (arg === '-h' || arg === '--help') {
// HACK: Special case for the implicit help flags, which can't have
// their own option, as --help would set flags.help to true, shadowing
// the flags.help() method.
} else if (arg[0] === '-') {

@@ -125,2 +129,4 @@ // HACK: Because commander.js has a flexible policy, this is the only

// Add a hint to stop commander.js from parsing following arguments.
// Note that this means that --out must come before any unknown flag as
// well as before any filename for it to be used as the out flag.
argv.splice(i, 0, '--');

@@ -161,2 +167,2 @@ // Save traceur flags for interpret.js.

interpret(includes[0], includes.slice(1), argv.flags);
}
}

@@ -96,3 +96,3 @@ // Copyright 2013 Traceur Authors.

var outputFile = path.join(outputDir, includes[current]);
var sourceRoot = path.relative(path.dirname(outputFile));
var sourceRoot = path.relative(path.dirname(outputFile), '.');
writeTreeToFile(tree, outputFile, useSourceMaps, sourceRoot);

@@ -99,0 +99,0 @@ current++;

@@ -75,5 +75,5 @@ // Copyright 2013 Traceur Authors.

this.optarg = arg.slice(++this.nextchar) || null;
} else if (m = arg.match(/^--([\w\-]+)(?:=(.*))?$/)) {
} else if (m = arg.match(/^--([^=]+)(?:=(.*))?$|^--(.+)$/)) {
// long opt
this.opt = m[1];
this.opt = m[1] || m[3];
this.optarg = m[2] === undefined ? null : m[2];

@@ -125,6 +125,3 @@ } else {

if (this.nextchar && this.nextchar >= arg.length) {
this.nextchar = 0;
}
this.optind += !this.nextchar;
this.optind += !(this.nextchar %= arg.length);

@@ -131,0 +128,0 @@ return true;

@@ -17,2 +17,3 @@ // Copyright 2012 Traceur Authors.

var path = require('path');
var NodeLoader = require('./NodeLoader.js');

@@ -102,3 +103,3 @@ var generateNameForUrl = traceur.generateNameForUrl;

function InlineCodeLoader(reporter, project, elements, depTarget) {
InternalLoader.call(this, reporter, project);
InternalLoader.call(this, reporter, project, new NodeLoader);
this.elements = elements;

@@ -128,29 +129,2 @@ this.dirname = project.url;

return wrapProgram(tree, codeUnit.url, this.dirname);
},
loadTextFile: function(filename, callback, errback) {
var text;
fs.readFile(path.resolve(this.dirname, filename), 'utf8',
function(err, data) {
if (err) {
errback(err);
} else {
// Ignore shebang lines
if (/^#!/.test(data))
data = '//' + data;
text = data;
callback(data);
}
});
return {
get responseText() {
return text;
},
abort: function() {}
};
},
loadTextFileSync: function(url) {
return fs.readFileSync(url, 'utf8');
}

@@ -157,0 +131,0 @@ };

@@ -51,6 +51,27 @@ // Copyright 2013 Traceur Authors.

traceurRequire.makeDefault = function() {
var filters = [];
var originalRequireJs = Module._extensions['.js'];
function shouldCompile(filename) {
if (filters.length === 0)
return true;
for (var i = 0; i < filters.length; i++) {
if (filters[i].call(null, filename))
return true;
}
return false;
}
traceurRequire.makeDefault = function(filter) {
if (!filter)
filters = [];
else
filters.push(filter);
Module._extensions['.js'] = function(module, filename) {
var source = compile(filename)
return module._compile(source, filename);
if (shouldCompile(filename)) {
var source = compile(filename)
return module._compile(source, filename);
}
return originalRequireJs(module, filename);
};

@@ -57,0 +78,0 @@ };

@@ -310,3 +310,2 @@ // Copyright 2012 Traceur Authors.

},
isStopIteration: isStopIteration
// TODO: Implement the rest of @iter and move it to a different file that

@@ -338,5 +337,5 @@ // gets compiled.

if (index < array.length) {
return array[index++];
return {value: array[index++], done: false};
}
throw StopIterationLocal;
return {value: undefined, done: true};
}

@@ -347,62 +346,2 @@ };

// Generators: GeneratorReturn
var GeneratorReturnLocal;
function setGeneratorReturn(GeneratorReturn, global) {
switch (typeof GeneratorReturn) {
case 'function':
// StopIterationLocal instanceof GeneratorReturnLocal means we probably
// want to maintain that invariant when we change GeneratorReturnLocal.
if (typeof GeneratorReturnLocal === 'function' &&
StopIterationLocal instanceof GeneratorReturnLocal) {
GeneratorReturnLocal = GeneratorReturn;
setStopIteration(undefined, global);
return;
}
GeneratorReturnLocal = GeneratorReturn;
return;
case 'undefined':
GeneratorReturnLocal = function(v) {
this.value = v;
};
GeneratorReturnLocal.prototype = {
toString: function() {
return '[object GeneratorReturn ' + this.value + ']';
}
};
return;
default:
throw new TypeError('constructor function required');
}
}
setGeneratorReturn();
// Generators: StopIteration
var StopIterationLocal;
function isStopIteration(x) {
return x === StopIterationLocal || x instanceof GeneratorReturnLocal;
}
function setStopIteration(StopIteration, global) {
switch (typeof StopIteration) {
case 'object':
StopIterationLocal = StopIteration;
break;
case 'undefined':
StopIterationLocal = new GeneratorReturnLocal();
StopIterationLocal.toString = function() {
return '[object StopIteration]';
};
break;
default:
throw new TypeError('invalid StopIteration type.');
}
if (global)
global.StopIteration = StopIterationLocal;
}
setStopIteration(global.StopIteration, global);
/**

@@ -448,2 +387,4 @@ * @param {Function} canceller

Deferred.prototype = {
constructor: Deferred,
fired_: false,

@@ -517,11 +458,2 @@ result_: undefined,

Deferred: Deferred,
get GeneratorReturn() {
return GeneratorReturnLocal;
},
setGeneratorReturn: setGeneratorReturn,
get StopIteration() {
return StopIterationLocal;
},
setStopIteration: setStopIteration,
isStopIteration: isStopIteration,
addIterator: addIterator,

@@ -528,0 +460,0 @@ assertName: assertName,

Sorry, the diff of this file is too big to display

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