-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pandino): Add support for ActivatorResolvers
ActivatorResolvers can be defined for different bundle types e.g.: EMS, UMD, etc. Pandino comes with support for ESM by default, while an optional UMD resolver is published as well.
- Loading branch information
Showing
15 changed files
with
526 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { BundleActivator, BundleManifestHeaders } from './bundle'; | ||
|
||
export interface ActivatorResolver { | ||
/** | ||
* ActivatorResolvers are responsible to return a {@code BundleActivator} for a given {@code BundleType}. E.g.: | ||
* Resolving UMD modules are different compared to plain ESM. | ||
* | ||
* Resolvers can be added to Pandino's PANDINO_ACTIVATOR_RESOLVERS ConfigMap entry. | ||
* | ||
* @param module Any reference to a particular module. | ||
* @param bundleHeaders Headers for the Bundle we would like to activate | ||
*/ | ||
resolve(module: any, bundleHeaders: BundleManifestHeaders): BundleActivator; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type BundleType = 'esm' | 'umd'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/@pandino/pandino/src/lib/framework/esm-activator-resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { ActivatorResolver, BundleActivator, BundleManifestHeaders } from '@pandino/pandino-api'; | ||
|
||
export class EsmActivatorResolver implements ActivatorResolver { | ||
resolve(module: any, bundleHeaders: BundleManifestHeaders): BundleActivator { | ||
return module.default; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.