amdextract
Advanced tools
Comparing version 2.1.6 to 2.1.8
{ | ||
"name": "amdextract", | ||
"version": "2.1.6", | ||
"description": "Uses AST to extract AMD modules, their parts and an optimized output without unused dependencies.", | ||
"version": "2.1.8", | ||
"description": "Uses AST to extract AMD modules, their parts and an optimized output without unused dependencies while keeping the original format.", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
# amdextract [![Build Status](https://travis-ci.org/mehdishojaei/amdextract.png)](https://travis-ci.org/mehdishojaei/amdextract) | ||
Uses AST to extract AMD modules, their parts and an optimized output without unused dependencies. | ||
Uses AST to extract AMD modules, their parts and an optimized output without unused dependencies while keeping the original format. | ||
@@ -10,3 +10,8 @@ ## example | ||
define('module1', ['p1', 'p2'], function (a, b) { | ||
return a; | ||
/** | ||
* b is not used in this scope. | ||
*/ | ||
return (function(b) { | ||
return b; | ||
})(a); | ||
}); | ||
@@ -46,3 +51,8 @@ | ||
define('module1', ['p1'], function (a) { | ||
return a; | ||
/** | ||
* b is not used in this scope. | ||
*/ | ||
return (function(b) { | ||
return b; | ||
})(a); | ||
}); | ||
@@ -122,2 +132,3 @@ | ||
## Release History | ||
* 2015-04-15 v2.1.8 Update README. | ||
* 2014-08-22 v2.1.6 Fix a bug when there are comments between paths and dependencies. | ||
@@ -124,0 +135,0 @@ * 2014-08-16 v2.1.0 Entirely uses AST. |
@@ -54,1 +54,13 @@ // General test for all cases. | ||
}); | ||
define('secondmodule', [ | ||
'p1', | ||
// Third path | ||
/** | ||
* Third comment | ||
*/ | ||
'p3' | ||
], function(a, c) { | ||
return a.concat(c); | ||
}); |
@@ -56,1 +56,19 @@ // General test for all cases. | ||
}); | ||
define('secondmodule', [ | ||
'p1', | ||
// Second path | ||
/** | ||
* Second comment | ||
*/ | ||
'p2', | ||
// Third path | ||
/** | ||
* Third comment | ||
*/ | ||
'p3' | ||
], function(a, /* This dependency is not used. */ b, c) { | ||
return a.concat(c); | ||
}); |
@@ -15,2 +15,9 @@ var amdextract = require('..'); | ||
describe('#parse()', function() { | ||
describe('no module', function() { | ||
var source = "var a = 0;"; | ||
var output = amdextract.parse(source, { removeUnusedDependencies: true }); | ||
it('.results', function() { should(output.results).be.an.Array.and.empty; }); | ||
it('.optimizedContent', function() { should(output.optimizedContent).be.equal(source); }); | ||
}); | ||
describe('unnamed module', function() { | ||
@@ -17,0 +24,0 @@ describe('without paths', function() { |
26224
501
140