-
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.
feat(core): add NX_PLUGIN_ISOLATION flag to enable workers
- Loading branch information
1 parent
2c9796e
commit 0e7232d
Showing
29 changed files
with
464 additions
and
359 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
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
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,18 @@ | ||
/** | ||
* This marks that a target provides information which should modify a target already registered | ||
* on the project via other plugins. If the target has not already been registered, and this symbol is true, | ||
* the information provided by it will be discarded. | ||
* | ||
* NOTE: This cannot be a symbol, as they are not serialized in JSON the communication | ||
* between the plugin-worker and the main process. | ||
*/ | ||
export const ONLY_MODIFIES_EXISTING_TARGET = 'NX_ONLY_MODIFIES_EXISTING_TARGET'; | ||
|
||
/** | ||
* This is used to override the source file for the target defaults plugin. | ||
* This allows the plugin to use the project files as the context, but point to nx.json as the source file. | ||
* | ||
* NOTE: This cannot be a symbol, as they are not serialized in JSON the communication | ||
* between the plugin-worker and the main process. | ||
*/ | ||
export const OVERRIDE_SOURCE_FILE = 'NX_OVERRIDE_SOURCE_FILE'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { CreateNodesResultWithContext } from './plugins/internal-api'; | ||
import { ConfigurationResult } from './utils/project-configuration-utils'; | ||
|
||
export class ProjectConfigurationsError extends Error { | ||
constructor( | ||
public readonly errors: Array<MergeNodesError | CreateNodesError>, | ||
public readonly partialProjectConfigurationsResult: ConfigurationResult | ||
) { | ||
super('Failed to create project configurations'); | ||
this.name = this.constructor.name; | ||
} | ||
} | ||
|
||
export class CreateNodesError extends Error { | ||
file: string; | ||
pluginName: string; | ||
|
||
constructor({ | ||
file, | ||
pluginName, | ||
error, | ||
}: { | ||
file: string; | ||
pluginName: string; | ||
error: Error; | ||
}) { | ||
const msg = `The "${pluginName}" plugin threw an error while creating nodes from ${file}:`; | ||
|
||
super(msg, { cause: error }); | ||
this.name = this.constructor.name; | ||
this.file = file; | ||
this.pluginName = pluginName; | ||
this.stack = `${this.message}\n ${error.stack.split('\n').join('\n ')}`; | ||
} | ||
} | ||
|
||
export class AggregateCreateNodesError extends Error { | ||
constructor( | ||
public readonly pluginName: string, | ||
public readonly errors: Array<CreateNodesError>, | ||
public readonly partialResults: Array<CreateNodesResultWithContext> | ||
) { | ||
super('Failed to create nodes'); | ||
this.name = this.constructor.name; | ||
} | ||
} | ||
|
||
export class MergeNodesError extends Error { | ||
file: string; | ||
pluginName: string; | ||
|
||
constructor({ | ||
file, | ||
pluginName, | ||
error, | ||
}: { | ||
file: string; | ||
pluginName: string; | ||
error: Error; | ||
}) { | ||
const msg = `The nodes created from ${file} by the "${pluginName}" could not be merged into the project graph:`; | ||
|
||
super(msg, { cause: error }); | ||
this.name = this.constructor.name; | ||
this.file = file; | ||
this.pluginName = pluginName; | ||
this.stack = `${this.message}\n ${error.stack.split('\n').join('\n ')}`; | ||
} | ||
} | ||
|
||
export function isCreateNodesError(e: unknown): e is CreateNodesError { | ||
return ( | ||
e instanceof CreateNodesError || | ||
(typeof e === 'object' && | ||
'name' in e && | ||
e?.name === CreateNodesError.prototype.name) | ||
); | ||
} | ||
|
||
export function isAggregateCreateNodesError( | ||
e: unknown | ||
): e is AggregateCreateNodesError { | ||
return ( | ||
e instanceof AggregateCreateNodesError || | ||
(typeof e === 'object' && | ||
'name' in e && | ||
e?.name === AggregateCreateNodesError.prototype.name) | ||
); | ||
} | ||
|
||
export function isMergeNodesError(e: unknown): e is MergeNodesError { | ||
return ( | ||
e instanceof MergeNodesError || | ||
(typeof e === 'object' && | ||
'name' in e && | ||
e?.name === MergeNodesError.prototype.name) | ||
); | ||
} |
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
Oops, something went wrong.