Skip to content

Commit

Permalink
Merge pull request #442 from ef4/analyzer-fix
Browse files Browse the repository at this point in the history
mixing of old and new analyzer patterns
  • Loading branch information
ef4 authored Aug 31, 2021
2 parents 27c6113 + a649b0a commit fe4e1fe
Show file tree
Hide file tree
Showing 10 changed files with 562 additions and 123 deletions.
348 changes: 348 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion packages/ember-auto-import/ts/analyzer-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { ImportSyntax, serialize } from './analyzer-syntax';
interface State {
imports: ImportSyntax[];
handled: WeakSet<t.CallExpression>;
opts: {
imports?: ImportSyntax[];
};
}

// Ignores type-only imports & exports, which are erased from the final build
Expand All @@ -23,7 +26,7 @@ function analyzerPlugin(babel: typeof Babel) {
visitor: {
Program: {
enter(_path: NodePath<t.Program>, state: State) {
state.imports = [];
state.imports = state.opts.imports || [];
state.handled = new WeakSet();
},
exit(path: NodePath<t.Program>, state: State) {
Expand Down
Loading

0 comments on commit fe4e1fe

Please sign in to comment.