amdextract
Advanced tools
Comparing version 0.1.1 to 0.1.2
21
index.js
@@ -77,3 +77,4 @@ /* | ||
var text = content.substr(offset + match.length - 1), // Unprocessed | ||
paths, dependencies, commentlessPathsStr, commentlessDependenciesStr, | ||
paths, dependencies, | ||
commentlessPathsStr, commentlessDependenciesStr, | ||
unusedDependencies = [], | ||
@@ -94,6 +95,12 @@ unusedPaths = [], | ||
paths = commentlessPathsStr ? commentlessPathsStr.split(commaRegExp).map(function (p) { return p.substr(1, p.length - 2); }) : []; | ||
paths = commentlessPathsStr ? commentlessPathsStr.split(commaRegExp).map(function (p) { | ||
return { | ||
path: p.substr(1, p.length - 2), | ||
quote: p[0] | ||
}; | ||
}) : []; | ||
dependencies = commentlessDependenciesStr ? commentlessDependenciesStr.split(commaRegExp) : []; | ||
if (paths && dependencies && text) { | ||
if (text) { | ||
body = getModuleBody(text); | ||
@@ -110,3 +117,3 @@ | ||
return !isException(excepts, dependency) && | ||
!isException(exceptsPaths, paths[dependencies.indexOf(dependency)]) && | ||
!isException(exceptsPaths, paths[dependencies.indexOf(dependency)].path) && | ||
!findUseage(dependency, source); | ||
@@ -121,5 +128,5 @@ }); | ||
moduleId: moduleId, | ||
paths: paths, | ||
paths: paths.map(function (p) { return p.path; }), | ||
unusedPaths: unusedPaths.map(function (p) { return p.path; }), | ||
dependencies: dependencies, | ||
unusedPaths: unusedPaths, | ||
unusedDependencies: unusedDependencies, | ||
@@ -143,3 +150,3 @@ bodyWithComments: body, | ||
match = match.replace(pathsStr, usedPaths.map(function (p) { return '"' + p + '"'; }).join(', ')) | ||
match = match.replace(pathsStr, usedPaths.map(function (p) { return p.quote + p.path + p.quote; }).join(', ')) | ||
.replace(dependenciesStr, usedDependencies.join(', ')); | ||
@@ -146,0 +153,0 @@ } |
{ | ||
"name": "amdextract", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Extracts AMD modules and their parts.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -115,4 +115,5 @@ # amdextract | ||
## Release History | ||
* 2014-03-06 v0.1.2 Dependency quotes in `optimizedContent` will be same as the original source. | ||
* 2014-01-20 v0.1.1 `exceptsPaths` can also be defined before each module definition. | ||
* 2014-01-13 v0.1.0 Works on files with multiple modules. Can detect module id if provided. Can remove unused dependencies. Add the new `exceptsPaths` option. Options `excepts` and `exceptsPaths` can take RegExps. | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9501
133
118