in src/Dgeni.ts [40:63]
package(pkg: PackageRef, dependencies: PackageRef[] = []) {
if ( this.injector) { throw new Error('injector already configured - you cannot add a new package'); }
if ( typeof pkg === 'string' ) { pkg = new Package(pkg, dependencies); }
if ( !(Package.isPackage(pkg)) ) { throw new Error('package must be an instance of Package'); }
if ( this.packages[pkg.name] ) {
throw new Error('The "' + pkg.name + '" package has already been loaded');
}
this.packages[pkg.name] = pkg;
// Extract all inline packages and load them into dgeni;
pkg.namedDependencies = pkg.dependencies.map((dependency) => {
if ( Package.isPackage(dependency) ) {
// Only load dependent package if not already loaded
if ( !this.packages[dependency.name] ) { this.package(dependency); }
return dependency.name;
}
return dependency;
});
// Return the package to allow chaining
return pkg;
}