@nx/vite 19.0.0-beta.7 → 19.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +0 -64
- package/package.json +4 -4
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.d.ts +0 -3
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js +0 -67
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js.map +0 -1
- package/src/migrations/update-15-3-4/set-mode-in-configuration.d.ts +0 -3
- package/src/migrations/update-15-3-4/set-mode-in-configuration.js +0 -37
- package/src/migrations/update-15-3-4/set-mode-in-configuration.js.map +0 -1
- package/src/migrations/update-15-4-3/update-report-directory.d.ts +0 -3
- package/src/migrations/update-15-4-3/update-report-directory.js +0 -39
- package/src/migrations/update-15-4-3/update-report-directory.js.map +0 -1
package/migrations.json
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {
|
|
3
|
-
"update-vite-tsconfig-paths": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "15.3.1-beta.0",
|
|
6
|
-
"description": "Remove projects property from vite-tsconfig-paths plugin in vite.config.ts files.",
|
|
7
|
-
"factory": "./src/migrations/update-15-3-1/update-vite-tsconfig-paths"
|
|
8
|
-
},
|
|
9
|
-
"set-mode-in-configurations": {
|
|
10
|
-
"cli": "nx",
|
|
11
|
-
"version": "15.3.4-beta.0",
|
|
12
|
-
"description": "Set the mode in configurations to match the configurationName.",
|
|
13
|
-
"factory": "./src/migrations/update-15-3-4/set-mode-in-configuration"
|
|
14
|
-
},
|
|
15
|
-
"update-test-path-placeholder-vars": {
|
|
16
|
-
"cli": "nx",
|
|
17
|
-
"version": "15.4.3-beta.0",
|
|
18
|
-
"description": "Update @nrwl/vite:test reportsDirectory and outputs properties to point to correct paths.",
|
|
19
|
-
"factory": "./src/migrations/update-15-4-3/update-report-directory"
|
|
20
|
-
},
|
|
21
3
|
"update-16-0-0-add-nx-packages": {
|
|
22
4
|
"cli": "nx",
|
|
23
5
|
"version": "16.0.0-beta.1",
|
|
@@ -202,52 +184,6 @@
|
|
|
202
184
|
"alwaysAddToPackageJson": false
|
|
203
185
|
}
|
|
204
186
|
}
|
|
205
|
-
},
|
|
206
|
-
"15.3.1-beta.0": {
|
|
207
|
-
"version": "15.3.1-beta.0",
|
|
208
|
-
"packages": {
|
|
209
|
-
"vite-tsconfig-paths": {
|
|
210
|
-
"version": "4.0.0",
|
|
211
|
-
"alwaysAddToPackageJson": false
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
"15.3.4-beta.0": {
|
|
216
|
-
"version": "15.3.4-beta.0",
|
|
217
|
-
"packages": {
|
|
218
|
-
"vite": {
|
|
219
|
-
"version": "^4.0.1",
|
|
220
|
-
"alwaysAddToPackageJson": false
|
|
221
|
-
},
|
|
222
|
-
"vite-tsconfig-paths": {
|
|
223
|
-
"version": "^4.0.2",
|
|
224
|
-
"alwaysAddToPackageJson": false
|
|
225
|
-
},
|
|
226
|
-
"vitest": {
|
|
227
|
-
"version": "^0.25.8",
|
|
228
|
-
"alwaysAddToPackageJson": false
|
|
229
|
-
},
|
|
230
|
-
"vite-plugin-dts": {
|
|
231
|
-
"version": "~1.7.1",
|
|
232
|
-
"alwaysAddToPackageJson": false
|
|
233
|
-
},
|
|
234
|
-
"@vitejs/plugin-react": {
|
|
235
|
-
"version": "^3.0.0",
|
|
236
|
-
"alwaysAddToPackageJson": false
|
|
237
|
-
},
|
|
238
|
-
"@vitest/coverage-c8": {
|
|
239
|
-
"version": "^0.25.8",
|
|
240
|
-
"alwaysAddToPackageJson": false
|
|
241
|
-
},
|
|
242
|
-
"@vitest/ui": {
|
|
243
|
-
"version": "^0.25.8",
|
|
244
|
-
"alwaysAddToPackageJson": false
|
|
245
|
-
},
|
|
246
|
-
"@vitest/coverage-istanbul": {
|
|
247
|
-
"version": "^0.25.8",
|
|
248
|
-
"alwaysAddToPackageJson": false
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
187
|
}
|
|
252
188
|
}
|
|
253
189
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "19.0.0-beta.
|
|
3
|
+
"version": "19.0.0-beta.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"migrations": "./migrations.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@nx/devkit": "19.0.0-beta.
|
|
32
|
+
"@nx/devkit": "19.0.0-beta.9",
|
|
33
33
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
34
34
|
"@swc/helpers": "~0.5.0",
|
|
35
35
|
"enquirer": "~2.3.6",
|
|
36
|
-
"@nx/js": "19.0.0-beta.
|
|
36
|
+
"@nx/js": "19.0.0-beta.9",
|
|
37
37
|
"tsconfig-paths": "^4.1.2",
|
|
38
|
-
"@nrwl/vite": "19.0.0-beta.
|
|
38
|
+
"@nrwl/vite": "19.0.0-beta.9"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"vite": "^5.0.0",
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function _export(target, all) {
|
|
3
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
4
|
-
enumerable: true,
|
|
5
|
-
get: all[name]
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
_export(exports, {
|
|
9
|
-
removeProjectsFromViteTsConfigPaths: function() {
|
|
10
|
-
return removeProjectsFromViteTsConfigPaths;
|
|
11
|
-
},
|
|
12
|
-
default: function() {
|
|
13
|
-
return _default;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const _devkit = require("@nx/devkit");
|
|
17
|
-
const _executoroptionsutils = require("@nx/devkit/src/generators/executor-options-utils");
|
|
18
|
-
const _tsquery = require("@phenomnomnominal/tsquery");
|
|
19
|
-
const _js = require("@nx/js");
|
|
20
|
-
const _generatorutils = require("../../utils/generator-utils");
|
|
21
|
-
const ts = require("typescript");
|
|
22
|
-
async function removeProjectsFromViteTsConfigPaths(tree) {
|
|
23
|
-
findAllProjectsWithViteConfig(tree);
|
|
24
|
-
await (0, _devkit.formatFiles)(tree);
|
|
25
|
-
}
|
|
26
|
-
const _default = removeProjectsFromViteTsConfigPaths;
|
|
27
|
-
function findAllProjectsWithViteConfig(tree) {
|
|
28
|
-
(0, _executoroptionsutils.forEachExecutorOptions)(tree, '@nrwl/vite:build', (options, project)=>{
|
|
29
|
-
const projectConfiguration = (0, _devkit.readProjectConfiguration)(tree, project);
|
|
30
|
-
const viteConfig = (0, _generatorutils.normalizeViteConfigFilePathWithTree)(tree, projectConfiguration.root, options == null ? void 0 : options['configFile']);
|
|
31
|
-
if (viteConfig) {
|
|
32
|
-
var _defineConfig_;
|
|
33
|
-
const appFileContent = tree.read(viteConfig, 'utf-8');
|
|
34
|
-
const file = _tsquery.tsquery.ast(appFileContent);
|
|
35
|
-
let newContents = appFileContent;
|
|
36
|
-
const defineConfig = _tsquery.tsquery.query(file, 'CallExpression:has(Identifier[name="defineConfig"])');
|
|
37
|
-
let startOfProjects, endOfProjects;
|
|
38
|
-
defineConfig == null ? void 0 : (_defineConfig_ = defineConfig[0]) == null ? void 0 : _defineConfig_.getChildren().forEach((defineConfigContentNode)=>{
|
|
39
|
-
// Make sure it's the one we are looking for
|
|
40
|
-
// We cannot assume that it's called tsConfigPaths
|
|
41
|
-
// So make sure it includes `projects` and `root`
|
|
42
|
-
if (defineConfigContentNode.getText().includes('projects') && defineConfigContentNode.getText().includes('root')) {
|
|
43
|
-
(0, _js.findNodes)(defineConfigContentNode, [
|
|
44
|
-
ts.SyntaxKind.PropertyAssignment
|
|
45
|
-
]).forEach((nodePA)=>{
|
|
46
|
-
if (nodePA.getText().startsWith('projects')) {
|
|
47
|
-
startOfProjects = nodePA.getStart();
|
|
48
|
-
endOfProjects = nodePA.getEnd();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
if (startOfProjects && endOfProjects) {
|
|
54
|
-
newContents = (0, _devkit.applyChangesToString)(newContents, [
|
|
55
|
-
{
|
|
56
|
-
type: _devkit.ChangeType.Delete,
|
|
57
|
-
start: startOfProjects,
|
|
58
|
-
length: endOfProjects - startOfProjects + 1
|
|
59
|
-
}
|
|
60
|
-
]);
|
|
61
|
-
tree.write(viteConfig, newContents);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=update-vite-tsconfig-paths.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/migrations/update-15-3-1/update-vite-tsconfig-paths.ts"],"sourcesContent":["import {\n applyChangesToString,\n ChangeType,\n formatFiles,\n readProjectConfiguration,\n Tree,\n} from '@nx/devkit';\nimport { forEachExecutorOptions } from '@nx/devkit/src/generators/executor-options-utils';\nimport { tsquery } from '@phenomnomnominal/tsquery';\nimport { findNodes } from '@nx/js';\nimport { normalizeViteConfigFilePathWithTree } from '../../utils/generator-utils';\nimport ts = require('typescript');\n\nexport async function removeProjectsFromViteTsConfigPaths(tree: Tree) {\n findAllProjectsWithViteConfig(tree);\n await formatFiles(tree);\n}\n\nexport default removeProjectsFromViteTsConfigPaths;\n\nfunction findAllProjectsWithViteConfig(tree: Tree): void {\n forEachExecutorOptions(tree, '@nrwl/vite:build', (options, project) => {\n const projectConfiguration = readProjectConfiguration(tree, project);\n const viteConfig = normalizeViteConfigFilePathWithTree(\n tree,\n projectConfiguration.root,\n options?.['configFile']\n );\n if (viteConfig) {\n const appFileContent = tree.read(viteConfig, 'utf-8');\n const file = tsquery.ast(appFileContent);\n let newContents = appFileContent;\n const defineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n let startOfProjects, endOfProjects;\n\n defineConfig?.[0]\n ?.getChildren()\n .forEach((defineConfigContentNode: any) => {\n // Make sure it's the one we are looking for\n // We cannot assume that it's called tsConfigPaths\n // So make sure it includes `projects` and `root`\n if (\n defineConfigContentNode.getText().includes('projects') &&\n defineConfigContentNode.getText().includes('root')\n ) {\n findNodes(defineConfigContentNode, [\n ts.SyntaxKind.PropertyAssignment,\n ]).forEach((nodePA) => {\n if (nodePA.getText().startsWith('projects')) {\n startOfProjects = nodePA.getStart();\n endOfProjects = nodePA.getEnd();\n }\n });\n }\n });\n\n if (startOfProjects && endOfProjects) {\n newContents = applyChangesToString(newContents, [\n {\n type: ChangeType.Delete,\n start: startOfProjects,\n length: endOfProjects - startOfProjects + 1,\n },\n ]);\n tree.write(viteConfig, newContents);\n }\n }\n });\n}\n"],"names":["removeProjectsFromViteTsConfigPaths","ts","tree","findAllProjectsWithViteConfig","formatFiles","forEachExecutorOptions","options","project","projectConfiguration","readProjectConfiguration","viteConfig","normalizeViteConfigFilePathWithTree","root","defineConfig","appFileContent","read","file","tsquery","ast","newContents","query","startOfProjects","endOfProjects","getChildren","forEach","defineConfigContentNode","getText","includes","findNodes","SyntaxKind","PropertyAssignment","nodePA","startsWith","getStart","getEnd","applyChangesToString","type","ChangeType","Delete","start","length","write"],"mappings":";;;;;;;;IAasBA,mCAAmC;eAAnCA;;IAKtB,OAAmD;eAAnD;;;wBAZO;sCACgC;yBACf;oBACE;gCAC0B;AACpD,MAAOC,aAAa;AAEb,eAAeD,oCAAoCE,IAAU;IAClEC,8BAA8BD;IAC9B,MAAME,IAAAA,mBAAW,EAACF;AACpB;MAEA,WAAeF;AAEf,SAASG,8BAA8BD,IAAU;IAC/CG,IAAAA,4CAAsB,EAACH,MAAM,oBAAoB,CAACI,SAASC;QACzD,MAAMC,uBAAuBC,IAAAA,gCAAwB,EAACP,MAAMK;QAC5D,MAAMG,aAAaC,IAAAA,mDAAmC,EACpDT,MACAM,qBAAqBI,IAAI,EACzBN,2BAAAA,OAAS,CAAC,aAAa;QAEzB,IAAII,YAAY;gBAUdG;YATA,MAAMC,iBAAiBZ,KAAKa,IAAI,CAACL,YAAY;YAC7C,MAAMM,OAAOC,gBAAO,CAACC,GAAG,CAACJ;YACzB,IAAIK,cAAcL;YAClB,MAAMD,eAAeI,gBAAO,CAACG,KAAK,CAChCJ,MACA;YAEF,IAAIK,iBAAiBC;YAErBT,iCAAAA,iBAAAA,YAAc,CAAC,EAAE,qBAAjBA,eACIU,WAAW,GACZC,OAAO,CAAC,CAACC;gBACR,4CAA4C;gBAC5C,kDAAkD;gBAClD,iDAAiD;gBACjD,IACEA,wBAAwBC,OAAO,GAAGC,QAAQ,CAAC,eAC3CF,wBAAwBC,OAAO,GAAGC,QAAQ,CAAC,SAC3C;oBACAC,IAAAA,aAAS,EAACH,yBAAyB;wBACjCxB,GAAG4B,UAAU,CAACC,kBAAkB;qBACjC,EAAEN,OAAO,CAAC,CAACO;wBACV,IAAIA,OAAOL,OAAO,GAAGM,UAAU,CAAC,aAAa;4BAC3CX,kBAAkBU,OAAOE,QAAQ;4BACjCX,gBAAgBS,OAAOG,MAAM;wBAC/B;oBACF;gBACF;YACF;YAEF,IAAIb,mBAAmBC,eAAe;gBACpCH,cAAcgB,IAAAA,4BAAoB,EAAChB,aAAa;oBAC9C;wBACEiB,MAAMC,kBAAU,CAACC,MAAM;wBACvBC,OAAOlB;wBACPmB,QAAQlB,gBAAgBD,kBAAkB;oBAC5C;iBACD;gBACDnB,KAAKuC,KAAK,CAAC/B,YAAYS;YACzB;QACF;IACF;AACF"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function _export(target, all) {
|
|
3
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
4
|
-
enumerable: true,
|
|
5
|
-
get: all[name]
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
_export(exports, {
|
|
9
|
-
setModeInConfiguration: function() {
|
|
10
|
-
return setModeInConfiguration;
|
|
11
|
-
},
|
|
12
|
-
default: function() {
|
|
13
|
-
return _default;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const _extends = require("@swc/helpers/_/_extends");
|
|
17
|
-
const _devkit = require("@nx/devkit");
|
|
18
|
-
const _executoroptionsutils = require("@nx/devkit/src/generators/executor-options-utils");
|
|
19
|
-
async function setModeInConfiguration(tree) {
|
|
20
|
-
forAllProjectsUsingViteAddMode(tree);
|
|
21
|
-
await (0, _devkit.formatFiles)(tree);
|
|
22
|
-
}
|
|
23
|
-
const _default = setModeInConfiguration;
|
|
24
|
-
function forAllProjectsUsingViteAddMode(tree) {
|
|
25
|
-
(0, _executoroptionsutils.forEachExecutorOptions)(tree, '@nrwl/vite:build', (_options, projectName, targetName, configuration)=>{
|
|
26
|
-
var _projectConfiguration_targets_targetName_configurations_configuration;
|
|
27
|
-
if (!configuration) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const projectConfiguration = (0, _devkit.readProjectConfiguration)(tree, projectName);
|
|
31
|
-
var _mode;
|
|
32
|
-
(_mode = (_projectConfiguration_targets_targetName_configurations_configuration = projectConfiguration.targets[targetName].configurations[configuration]).mode) != null ? _mode : _projectConfiguration_targets_targetName_configurations_configuration.mode = configuration;
|
|
33
|
-
(0, _devkit.updateProjectConfiguration)(tree, projectName, _extends._({}, projectConfiguration));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=set-mode-in-configuration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/migrations/update-15-3-4/set-mode-in-configuration.ts"],"sourcesContent":["import {\n formatFiles,\n readProjectConfiguration,\n Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { forEachExecutorOptions } from '@nx/devkit/src/generators/executor-options-utils';\n\nexport async function setModeInConfiguration(tree: Tree) {\n forAllProjectsUsingViteAddMode(tree);\n await formatFiles(tree);\n}\n\nexport default setModeInConfiguration;\n\nfunction forAllProjectsUsingViteAddMode(tree: Tree): void {\n forEachExecutorOptions(\n tree,\n '@nrwl/vite:build',\n (_options, projectName, targetName, configuration) => {\n if (!configuration) {\n return;\n }\n\n const projectConfiguration = readProjectConfiguration(tree, projectName);\n projectConfiguration.targets[targetName].configurations[\n configuration\n ].mode ??= configuration;\n\n updateProjectConfiguration(tree, projectName, {\n ...projectConfiguration,\n });\n }\n );\n}\n"],"names":["setModeInConfiguration","tree","forAllProjectsUsingViteAddMode","formatFiles","forEachExecutorOptions","_options","projectName","targetName","configuration","projectConfiguration","readProjectConfiguration","targets","configurations","mode","updateProjectConfiguration"],"mappings":";;;;;;;;IAQsBA,sBAAsB;eAAtBA;;IAKtB,OAAsC;eAAtC;;;;wBARO;sCACgC;AAEhC,eAAeA,uBAAuBC,IAAU;IACrDC,+BAA+BD;IAC/B,MAAME,IAAAA,mBAAW,EAACF;AACpB;MAEA,WAAeD;AAEf,SAASE,+BAA+BD,IAAU;IAChDG,IAAAA,4CAAsB,EACpBH,MACA,oBACA,CAACI,UAAUC,aAAaC,YAAYC;YAMlCC;QALA,IAAI,CAACD,eAAe;YAClB;QACF;QAEA,MAAMC,uBAAuBC,IAAAA,gCAAwB,EAACT,MAAMK;;QAC5DG,UAAAA,wEAAAA,qBAAqBE,OAAO,CAACJ,WAAW,CAACK,cAAc,CACrDJ,cACD,EAACK,wBAFFJ,sEAEEI,OAASL;QAEXM,IAAAA,kCAA0B,EAACb,MAAMK,aAAa,eACzCG;IAEP;AAEJ"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function _export(target, all) {
|
|
3
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
4
|
-
enumerable: true,
|
|
5
|
-
get: all[name]
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
_export(exports, {
|
|
9
|
-
updateReportDirectoryPlaceholders: function() {
|
|
10
|
-
return updateReportDirectoryPlaceholders;
|
|
11
|
-
},
|
|
12
|
-
default: function() {
|
|
13
|
-
return _default;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const _devkit = require("@nx/devkit");
|
|
17
|
-
const _executoroptionsutils = require("@nx/devkit/src/generators/executor-options-utils");
|
|
18
|
-
function updateReportDirectoryPlaceholders(tree) {
|
|
19
|
-
const projects = (0, _devkit.getProjects)(tree);
|
|
20
|
-
(0, _executoroptionsutils.forEachExecutorOptions)(tree, '@nrwl/vite:test', (options, projectName, targetName, configName)=>{
|
|
21
|
-
const projectConfig = projects.get(projectName);
|
|
22
|
-
const coverageOutput = projectConfig.root === '.' ? projectName : projectConfig.root;
|
|
23
|
-
if (options.reportsDirectory) {
|
|
24
|
-
options.reportsDirectory = options.reportsDirectory.replace('{workspaceRoot}/', projectConfig.root === '.' ? '' : (0, _devkit.offsetFromRoot)(projectConfig.root)).replace('{projectRoot}', coverageOutput);
|
|
25
|
-
if (configName) {
|
|
26
|
-
projectConfig.targets[targetName].configurations[configName] = options;
|
|
27
|
-
} else {
|
|
28
|
-
projectConfig.targets[targetName].options = options;
|
|
29
|
-
}
|
|
30
|
-
if (projectConfig.targets[targetName].outputs) {
|
|
31
|
-
projectConfig.targets[targetName].outputs = projectConfig.targets[targetName].outputs.map((output)=>output.replace('{projectRoot}/coverage', `coverage/${coverageOutput}`));
|
|
32
|
-
}
|
|
33
|
-
(0, _devkit.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const _default = updateReportDirectoryPlaceholders;
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=update-report-directory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/migrations/update-15-4-3/update-report-directory.ts"],"sourcesContent":["import {\n getProjects,\n offsetFromRoot,\n Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { forEachExecutorOptions } from '@nx/devkit/src/generators/executor-options-utils';\nimport { VitestExecutorOptions } from '../../executors/test/schema';\n\nexport function updateReportDirectoryPlaceholders(tree: Tree) {\n const projects = getProjects(tree);\n forEachExecutorOptions<VitestExecutorOptions>(\n tree,\n '@nrwl/vite:test',\n (options, projectName, targetName, configName) => {\n const projectConfig = projects.get(projectName);\n const coverageOutput =\n projectConfig.root === '.' ? projectName : projectConfig.root;\n\n if (options.reportsDirectory) {\n options.reportsDirectory = options.reportsDirectory\n .replace(\n '{workspaceRoot}/',\n projectConfig.root === '.' ? '' : offsetFromRoot(projectConfig.root)\n )\n .replace('{projectRoot}', coverageOutput);\n if (configName) {\n projectConfig.targets[targetName].configurations[configName] =\n options;\n } else {\n projectConfig.targets[targetName].options = options;\n }\n if (projectConfig.targets[targetName].outputs) {\n projectConfig.targets[targetName].outputs = projectConfig.targets[\n targetName\n ].outputs.map((output) =>\n output.replace(\n '{projectRoot}/coverage',\n `coverage/${coverageOutput}`\n )\n );\n }\n updateProjectConfiguration(tree, projectName, projectConfig);\n }\n }\n );\n}\n\nexport default updateReportDirectoryPlaceholders;\n"],"names":["updateReportDirectoryPlaceholders","tree","projects","getProjects","forEachExecutorOptions","options","projectName","targetName","configName","projectConfig","get","coverageOutput","root","reportsDirectory","replace","offsetFromRoot","targets","configurations","outputs","map","output","updateProjectConfiguration"],"mappings":";;;;;;;;IASgBA,iCAAiC;eAAjCA;;IAuChB,OAAiD;eAAjD;;;wBA3CO;sCACgC;AAGhC,SAASA,kCAAkCC,IAAU;IAC1D,MAAMC,WAAWC,IAAAA,mBAAW,EAACF;IAC7BG,IAAAA,4CAAsB,EACpBH,MACA,mBACA,CAACI,SAASC,aAAaC,YAAYC;QACjC,MAAMC,gBAAgBP,SAASQ,GAAG,CAACJ;QACnC,MAAMK,iBACJF,cAAcG,IAAI,KAAK,MAAMN,cAAcG,cAAcG,IAAI;QAE/D,IAAIP,QAAQQ,gBAAgB,EAAE;YAC5BR,QAAQQ,gBAAgB,GAAGR,QAAQQ,gBAAgB,CAChDC,OAAO,CACN,oBACAL,cAAcG,IAAI,KAAK,MAAM,KAAKG,IAAAA,sBAAc,EAACN,cAAcG,IAAI,GAEpEE,OAAO,CAAC,iBAAiBH;YAC5B,IAAIH,YAAY;gBACdC,cAAcO,OAAO,CAACT,WAAW,CAACU,cAAc,CAACT,WAAW,GAC1DH;YACJ,OAAO;gBACLI,cAAcO,OAAO,CAACT,WAAW,CAACF,OAAO,GAAGA;YAC9C;YACA,IAAII,cAAcO,OAAO,CAACT,WAAW,CAACW,OAAO,EAAE;gBAC7CT,cAAcO,OAAO,CAACT,WAAW,CAACW,OAAO,GAAGT,cAAcO,OAAO,CAC/DT,WACD,CAACW,OAAO,CAACC,GAAG,CAAC,CAACC,SACbA,OAAON,OAAO,CACZ,0BACA,CAAC,SAAS,EAAEH,eAAe,CAAC;YAGlC;YACAU,IAAAA,kCAA0B,EAACpB,MAAMK,aAAaG;QAChD;IACF;AAEJ;MAEA,WAAeT"}
|