Skip to content

Commit

Permalink
Merge 30eff7d into ce2948c
Browse files Browse the repository at this point in the history
  • Loading branch information
teppeis committed Jun 4, 2019
2 parents ce2948c + 30eff7d commit e357e86
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
12 changes: 7 additions & 5 deletions lib/cli.js
Expand Up @@ -53,7 +53,7 @@ function setCommandOptions(command) {
false
)
.option('--config <file>', '.fixclosurerc file path.')
.option('--depsJs <file>', 'deps.js file path.')
.option('--depsJs <files>', 'deps.js file paths separated by comma.', list)
.option('--showSuccess', 'Show success ouput.', false)
.option('--no-color', 'Disable color highlight.');
}
Expand Down Expand Up @@ -133,11 +133,13 @@ async function main(argv, stdout, stderr, exit) {
exit(1);
}

/** @type {string[]} */
let symbols = [];
if (program.depsJs) {
const {dependencies} = await depsJsParser.parseFileAsync(program.depsJs);
/** @type {string[]} */
symbols = flat(dependencies.map(dep => dep.closureSymbols));
if (Array.isArray(program.depsJs) && program.depsJs.length > 0) {
const results = await Promise.all(
program.depsJs.map(file => depsJsParser.parseFileAsync(file))
);
symbols = flat(results.map(result => result.dependencies.map(dep => dep.closureSymbols)), 2);
}

let ok = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/cli/deps.js
@@ -1,2 +1,2 @@
goog.addDependency('foo/namespacemethod1.js', ['goog.foo.namespacemethod1'], ['goog.Disposable', 'goog.Timer'], {});
goog.addDependency('foo/namespacemethod2.js', ['goog.foo.namespacemethod2'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('foo/namespacemethod2.js', ['goog.foo.namespacemethod2', 'goog.foo.namespacemethod3'], [], {'lang': 'es6', 'module': 'goog'});
File renamed without changes.
3 changes: 3 additions & 0 deletions test/fixtures/parse/namespace_method_expression.js
@@ -0,0 +1,3 @@
foo(goog.ui.decorate);

// toRequire: goog.ui.decorate

0 comments on commit e357e86

Please sign in to comment.