-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(tegg): declarative module plugin mechanism #6021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
fe0d3d4
feat(core): add module plugin core mechanism
gxkl 90fe823
feat(standalone): two-phase StandaloneApp with module plugin support
gxkl bad4f25
feat(tegg-plugin): instantiate InnerObjectLoadUnit in app mode
gxkl a1ad0eb
feat(tegg): convert built-in framework hooks to module plugins
gxkl d941ee4
docs(wiki): record tegg module plugin architecture
gxkl bb28f2f
refactor(tegg): address module-plugin review - dedupe hook, untangle …
gxkl a97ca3e
refactor(tegg): built-in framework hooks load through the module scan
gxkl 97851ed
refactor(tegg): decentralize module plugins - enabling the plugin IS …
gxkl 8d902f9
refactor(tegg): the aop PLUGIN is the aop module; provided objects jo…
gxkl 2afbd54
refactor(runtime): provided inner objects are ordinary protos end to end
gxkl f63b0a8
chore(aop-runtime): drop leftover InnerObjects re-export
gxkl bb0e787
refactor(tegg): discovery stays deps/module.json-declared; drop enabl…
gxkl 5d1d9af
refactor(runtime): name the provided-instance factory for what it is
gxkl 8c80e59
docs(aop): explain why AopContextHook stays imperatively registered
gxkl 52bed86
docs(tegg): explain why inner objects use provided instances, not egg…
gxkl e1afbef
docs(tegg): state why ConfigSourceLoadUnitHook is a host built-in
gxkl 541a032
refactor(tegg): ConfigSourceLoadUnitHook lives in @eggjs/tegg-config,…
gxkl 14b9ad6
fix(tegg): gate optional modules' hooks; fix the enabled-promotion match
gxkl 6f51f31
revert(tegg-config): framework discovery reads package.json only
gxkl b2d71ce
refactor(standalone): defer module scan out of the StandaloneApp cons…
gxkl 7712d67
refactor(standalone): drop deprecated StandaloneAppOptions.innerObjects
gxkl 86ed7f6
refactor(standalone): keep innerObjects assembly in the constructor, …
gxkl 7c95e76
refactor(standalone): make runtimeConfig a placeholder filled at init
gxkl a219f1d
feat(standalone): accept a logger via StandaloneAppOptions
gxkl 930826f
refactor(standalone): make StandaloneApp.init idempotent
gxkl 8140576
fix(standalone): keep host moduleConfig handler override semantics
gxkl 7be195f
refactor(standalone): build framework base inner objects at the point…
gxkl 4e7dcbb
refactor(standalone): align StandaloneApp API with tegg#325
gxkl 8034122
refactor(standalone): discover builtin framework plugins via own pack…
gxkl 044e7d9
refactor(standalone): move dal manager cleanup into the dal module it…
gxkl 4bdda2c
feat(dal): declare the mysqlDataSourceManager injection surface in th…
gxkl c5f56ce
fix(dal): declare manager cleanup via @LifecycleDestroy
gxkl eddaf9c
refactor(dal): type MysqlDataSourceManagerObject via declaration merging
gxkl 8096f55
fix(standalone): allowlist scan-declaration deps for unplugin-unused
gxkl 060167d
fix(core-decorator): explicit return types for isolatedDeclarations
gxkl f38bfad
fix(config): default the framework module scan to egg
gxkl 4a47fa7
refactor(config): resolve the framework dir with getFrameworkPath
gxkl 1159258
fix(config): tolerate non-materialized module dirs from bundle manifests
gxkl 1e4ffba
fix(tegg): JSON-safe descriptor dump and bundle-tolerant module confi…
gxkl 9d904d5
test(tegg): explicit boot-hook timeouts for slow Windows runners
gxkl cd2a241
test(tegg): align boot-hook timeouts with the root config values
gxkl 555cfcb
fix(loader): remove redundant test glob excludes
gxkl 04365fd
chore(tegg-config): debug framework resolution failures
gxkl a759f50
chore(tegg): remove empty plugin boot hooks
gxkl 7f0debe
fix(metadata): emit valid module descriptor JSON
gxkl 7a44edc
fix(standalone): pass framework deps during preload
gxkl 73204be
fix(standalone): await app destroy on success
gxkl 20cc7fd
fix(standalone): reject removed innerObjects option
gxkl c4d249b
docs(tegg): correct module plugin feeding rules
gxkl 5f9de5b
fix(standalone): reuse manifest module references
gxkl e58bbfb
fix(standalone): let provided inner objects override defaults
gxkl f86cb73
fix(tegg): narrow lifecycle proto types
gxkl da6f2cb
fix(tegg): clean partial module init failures
gxkl ee6212e
refactor(tegg): share tolerant module config resolution
gxkl 695f15a
test(tegg): cover inner object multi-app isolation
gxkl 7f8cfad
fix(tegg): match module plugins by package
gxkl ee85741
refactor(tegg): share manifest data builder
gxkl bd79a6c
fix(tegg-config): scan parent framework modules
gxkl 847f8b8
fix(tegg): qualify inner objects by defining module
gxkl 6afd983
refactor(aop): register context hook as inner object
gxkl 525a91f
refactor(dal): inject mysql data source manager
gxkl 6c84283
refactor(metadata): reuse prototype builder for inner objects
gxkl 2fcc7e7
test(standalone): expect destroy lifecycle after main
gxkl 1ad38c0
fix(tegg-config): keep nearest duplicate framework modules
gxkl 7bed7a7
fix(tegg-config): stop at boolean framework roots
gxkl ba38856
fix(standalone): clarify inner object override warnings
gxkl d132713
test(tegg-config): cover framework module dedupe edges
gxkl b3edc3f
refactor(dal): inject table and sql map managers
gxkl fad5597
fix(tegg-config): resolve framework module json packages locally
gxkl ec775a3
docs(standalone): update inner object handler option
gxkl bcc790a
fix(tegg): address review follow-ups
gxkl e9b69ea
fix(standalone): do not await ctx.destroy on the request path
gxkl a31d579
fix(tegg-config): compare realpaths when detecting duplicate modules
gxkl b7a6718
fix(tegg): address module plugin review feedback
gxkl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,27 @@ | ||
| import { InnerObjectProto } from '@eggjs/core-decorator'; | ||
| import { ObjectInitType } from '@eggjs/tegg-types'; | ||
| import type { EggPrototype } from '@eggjs/tegg-types'; | ||
|
|
||
| export interface ProtoToCreate { | ||
| name: string; | ||
| proto: EggPrototype; | ||
| } | ||
|
|
||
| @InnerObjectProto() | ||
| export class AopContextAdviceRegistry { | ||
| readonly #requestProtoList: ProtoToCreate[] = []; | ||
|
|
||
| addAdvice(name: string, proto: EggPrototype): void { | ||
| if (proto.initType !== ObjectInitType.CONTEXT) { | ||
| return; | ||
| } | ||
| if (this.#requestProtoList.some((t) => t.name === name && t.proto === proto)) { | ||
| return; | ||
| } | ||
| this.#requestProtoList.push({ name, proto }); | ||
| } | ||
|
|
||
| getRequestProtos(): readonly ProtoToCreate[] { | ||
| return this.#requestProtoList; | ||
| } | ||
| } | ||
This file contains hidden or 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,27 @@ | ||
| import { InnerObjectProto } from '@eggjs/core-decorator'; | ||
| import { LifecyclePostInject } from '@eggjs/lifecycle'; | ||
| import { GlobalGraph } from '@eggjs/metadata'; | ||
|
|
||
| import { crossCutGraphHook } from './CrossCutGraphHook.js'; | ||
| import { pointCutGraphHook } from './PointCutGraphHook.js'; | ||
|
gxkl marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * Registers the AOP graph build hooks declaratively. Instantiated with the | ||
| * InnerObjectLoadUnit, which both hosts run AFTER the business GlobalGraph is | ||
| * created and BEFORE build() consumes the hooks — the only valid window. | ||
| */ | ||
| @InnerObjectProto() | ||
| export class AopGraphHookRegistrar { | ||
| @LifecyclePostInject() | ||
| protected registerGraphHooks(): void { | ||
| const globalGraph = GlobalGraph.instance; | ||
| if (!globalGraph) { | ||
| throw new Error( | ||
| '[aop-runtime] GlobalGraph must be created before AopGraphHookRegistrar is instantiated, ' + | ||
| 'cross-loadUnit crosscut/pointcut weaving would silently never happen', | ||
| ); | ||
| } | ||
| globalGraph.registerBuildHook(crossCutGraphHook); | ||
| globalGraph.registerBuildHook(pointCutGraphHook); | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| export * from './AopContextAdviceRegistry.js'; | ||
| export * from './AspectExecutor.js'; | ||
| export * from './CrossCutGraphHook.js'; | ||
| export * from './EggObjectAopHook.js'; | ||
| export * from './EggPrototypeCrossCutHook.js'; | ||
| export * from './LoadUnitAopHook.js'; | ||
| export * from './PointCutGraphHook.js'; | ||
| export * from './AopGraphHookRegistrar.js'; |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.