-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): move resolving plugins back to main thread
- Loading branch information
1 parent
75b2080
commit d3c6c29
Showing
6 changed files
with
104 additions
and
50 deletions.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
packages/nx/src/project-graph/plugins/load-resolved-plugin.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,26 @@ | ||
import type { PluginConfiguration } from '../../config/nx-json'; | ||
import { LoadedNxPlugin } from './internal-api'; | ||
import { NxPlugin } from './public-api'; | ||
|
||
export async function loadResolvedNxPluginAsync( | ||
pluginConfiguration: PluginConfiguration, | ||
pluginPath: string, | ||
name: string | ||
) { | ||
const plugin = await importPluginModule(pluginPath); | ||
plugin.name ??= name; | ||
return new LoadedNxPlugin(plugin, pluginConfiguration); | ||
} | ||
|
||
async function importPluginModule(pluginPath: string): Promise<NxPlugin> { | ||
const m = await import(pluginPath); | ||
if ( | ||
m.default && | ||
('createNodes' in m.default || | ||
'createNodesV2' in m.default || | ||
'createDependencies' in m.default) | ||
) { | ||
return m.default; | ||
} | ||
return m; | ||
} |
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