fix(core): repair sourcemaps that had file & plugin swapped (#26628)

This commit is contained in:
MaxKless 2024-06-24 09:19:00 +02:00 committed by GitHub
parent 963f753ae8
commit 8efe26c99a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 55 additions and 1 deletions

View File

@ -1772,6 +1772,60 @@ describe('project-configuration-utils', () => {
`);
}
});
it('should correctly set source maps', async () => {
const { sourceMaps } = await createProjectConfigurations(
undefined,
{},
['libs/a/project.json'],
[
new LoadedNxPlugin(fakeTargetsPlugin, 'fake-targets-plugin'),
new LoadedNxPlugin(fakeTagPlugin, 'fake-tag-plugin'),
]
);
expect(sourceMaps).toMatchInlineSnapshot(`
{
"libs/a": {
"name": [
"libs/a/project.json",
"fake-tag-plugin",
],
"root": [
"libs/a/project.json",
"fake-tag-plugin",
],
"tags": [
"libs/a/project.json",
"fake-tag-plugin",
],
"tags.fake-lib": [
"libs/a/project.json",
"fake-tag-plugin",
],
"targets": [
"libs/a/project.json",
"fake-targets-plugin",
],
"targets.build": [
"libs/a/project.json",
"fake-targets-plugin",
],
"targets.build.executor": [
"libs/a/project.json",
"fake-targets-plugin",
],
"targets.build.options": [
"libs/a/project.json",
"fake-targets-plugin",
],
"targets.build.options.command": [
"libs/a/project.json",
"fake-targets-plugin",
],
},
}
`);
});
});
});

View File

@ -459,7 +459,7 @@ function mergeCreateNodesResults(
> = {};
for (const result of results.flat()) {
const [file, pluginName, nodes] = result;
const [pluginName, file, nodes] = result;
const { projects: projectNodes, externalNodes: pluginExternalNodes } =
nodes;