Comparing version 0.3.0 to 0.4.0
@@ -0,3 +1,8 @@ | ||
## v0.4 2013-07-10 | ||
* defs became self aware | ||
* NPM package includes (and defaults to) the self-transpiled version | ||
* Bugfix renaming of index-expressions such as arr[i] (issue #10) | ||
## v0.3 2013-07-05 | ||
* defs used as a library returns errors collected to ret.errors instead | ||
of writing to stderr. This also deprecates ret.exitcode. |
@@ -51,11 +51,12 @@ "use strict"; | ||
function isReference(node) { | ||
const parent = node.$parent; | ||
return node.$refToScope || | ||
node.type === "Identifier" && | ||
!(node.$parent.type === "VariableDeclarator" && node.$parent.id === node) && // var|let|const $ | ||
!(node.$parent.type === "MemberExpression" && node.$parent.property === node) && // obj.$ | ||
!(node.$parent.type === "Property" && node.$parent.key === node) && // {$: ...} | ||
!(node.$parent.type === "LabeledStatement" && node.$parent.label === node) && // $: ... | ||
!(node.$parent.type === "CatchClause" && node.$parent.param === node) && // catch($) | ||
!(isFunction(node.$parent) && node.$parent.id === node) && // function $(.. | ||
!(isFunction(node.$parent) && is.someof(node, node.$parent.params)) && // function f($).. | ||
!(parent.type === "VariableDeclarator" && parent.id === node) && // var|let|const $ | ||
!(parent.type === "MemberExpression" && parent.computed === false && parent.property === node) && // obj.$ | ||
!(parent.type === "Property" && parent.key === node) && // {$: ...} | ||
!(parent.type === "LabeledStatement" && parent.label === node) && // $: ... | ||
!(parent.type === "CatchClause" && parent.param === node) && // catch($) | ||
!(isFunction(parent) && parent.id === node) && // function $(.. | ||
!(isFunction(parent) && is.someof(node, parent.params)) && // function f($).. | ||
true; | ||
@@ -62,0 +63,0 @@ } |
{ | ||
"name": "defs", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Static scope analysis and transpilation of ES6 block scoped const and let variables, to ES3.", | ||
"main": "defs-main.js", | ||
"main": "build/es5/defs-main.js", | ||
"repository": { | ||
@@ -36,5 +36,5 @@ "type": "git", | ||
}, | ||
"bin": "./defs", | ||
"bin": "./build/es5/defs", | ||
"author": "Olov Lassus <olov.lassus@gmail.com>", | ||
"license": "MIT" | ||
} |
@@ -26,3 +26,6 @@ # defs.js | ||
There's also a [Grunt](http://gruntjs.com/) plugin, see [grunt-defs](https://npmjs.org/package/grunt-defs). | ||
See [BUILD.md](BUILD.md) for a description of the self-build and the browser bundle. | ||
## License | ||
@@ -121,2 +124,3 @@ `MIT`, see [LICENSE](LICENSE) file. | ||
res object: | ||
{ | ||
@@ -123,0 +127,0 @@ src: string // on success |
@@ -9,3 +9,5 @@ const fs = require("fs"); | ||
const tests = fs.readdirSync("tests").filter(function(filename) { | ||
const pathToTests = (fs.existsSync("tests") ? "tests" : "../../tests"); | ||
const tests = fs.readdirSync(pathToTests).filter(function(filename) { | ||
return !/-out\.js$/.test(filename) && !/-stderr$/.test(filename); | ||
@@ -16,7 +18,7 @@ }); | ||
const noSuffix = test.slice(0, -3); | ||
exec(fmt("node --harmony defs-wrapper tests/{0}", test), function(error, stdout, stderr) { | ||
exec(fmt("{0} {1} defs-wrapper {2}/{3}", NODE, FLAG, pathToTests, test), function(error, stdout, stderr) { | ||
stderr = stderr || ""; | ||
stdout = stdout || ""; | ||
const expectedStderr = slurp(fmt("tests/{0}-stderr", noSuffix)); | ||
const expectedStdout = slurp(fmt("tests/{0}-out.js", noSuffix)); | ||
const expectedStderr = slurp(fmt("{0}/{1}-stderr", pathToTests, noSuffix)); | ||
const expectedStdout = slurp(fmt("{0}/{1}-out.js", pathToTests, noSuffix)); | ||
@@ -41,2 +43,4 @@ if (stderr !== expectedStderr) { | ||
const NODE = process.argv[0]; | ||
const FLAG = (process.argv[2] === "es5" ? "" : "--harmony"); | ||
tests.forEach(run); |
97580
75
2640
191
4
2