Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Assume ES module (#131)
Browse files Browse the repository at this point in the history
* assume es module even if it does not provide symbol

* 0.6.1-prerelease.0
  • Loading branch information
binarybro authored Jul 22, 2024
1 parent 7015c58 commit b588c31
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export function importNgModule(
}



const ngModuleRef = createNgModule(ngModuleConstructor, item.injector);

const componentConstructors = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import { ESModule, isESModule } from './module';

export type Constructor = Type<unknown>;

export function isAssumedESModuleContainingAngularComponentsOrModules(type: any) {
return typeof type === 'object' && Object.keys(type).some(key => key.includes('Module') || key.includes('Component'));
}

export function resolveConstructorsFromESModule(
esm: ESModule | Constructor
): Constructor[] {
if (isESModule(esm)) {
if (isESModule(esm) || isAssumedESModuleContainingAngularComponentsOrModules(esm)) {
const constructors = Object.values<Constructor>(
esm as unknown as { [index: string]: Constructor }
).filter((v) => typeof v === 'function');
Expand All @@ -20,3 +24,4 @@ export function resolveConstructorsFromESModule(

return [esm];
}

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"prepare": "husky install",
"prepare-imports-orchestrator-example": "nx run imports-orchestrator-example:prepare"
},
"version": "0.6.0",
"version": "0.6.1-prerelease.0",
"volta": {
"node": "20.15.0",
"yarn": "1.22.21"
Expand Down

0 comments on commit b588c31

Please sign in to comment.