Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let seenSpecifiers = new Set();
let dependencies: Map = new Map();
for (let dep of this.pkg.dependencies) {
dependencies.set(dep.name, dep);
}
for (let imp of imports) {
// handle each specifier only once
if (seenSpecifiers.has(imp.specifier)) {
continue;
}
seenSpecifiers.add(imp.specifier);
let name = absolutePackageName(imp.specifier);
if (!name) {
// must have been relative, we only care about absolute imports here
continue;
}
if (name === this.pkg.name) {
// Our own name is allowed in the appJS (because that is going to get
// moved into the app, where our name will be resolvable). It would be
// a problem in our Own JS, but that gets patched up by our
// babel-plugin.
continue;
}
let dep = dependencies.get(name);
if (dep && (dep.isEmberPackage || dependencies.has('ember-auto-import'))) {
// this is a valid inter-package specifier, either because it's an ember