@nx/vite 16.0.0-beta.1 → 16.0.0-beta.3
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/executors.js +16 -8
- package/executors.js.map +1 -1
- package/index.js +13 -7
- package/index.js.map +1 -1
- package/package.json +6 -6
- package/plugins/rollup-replace-files.plugin.js +7 -5
- package/plugins/rollup-replace-files.plugin.js.map +1 -1
- package/src/executors/build/build.impl.js +19 -15
- package/src/executors/build/build.impl.js.map +1 -1
- package/src/executors/build/compat.js +5 -3
- package/src/executors/build/compat.js.map +1 -1
- package/src/executors/build/schema.d.js +0 -2
- package/src/executors/dev-server/compat.js +5 -3
- package/src/executors/dev-server/compat.js.map +1 -1
- package/src/executors/dev-server/dev-server.impl.js +17 -13
- package/src/executors/dev-server/dev-server.impl.js.map +1 -1
- package/src/executors/dev-server/schema.d.js +0 -2
- package/src/executors/preview-server/compat.js +5 -3
- package/src/executors/preview-server/compat.js.map +1 -1
- package/src/executors/preview-server/preview-server.impl.js +20 -16
- package/src/executors/preview-server/preview-server.impl.js.map +1 -1
- package/src/executors/preview-server/schema.d.js +0 -2
- package/src/executors/test/compat.js +5 -3
- package/src/executors/test/compat.js.map +1 -1
- package/src/executors/test/schema.d.js +0 -2
- package/src/executors/test/vitest.impl.js +18 -14
- package/src/executors/test/vitest.impl.js.map +1 -1
- package/src/generators/configuration/configuration.js +30 -24
- package/src/generators/configuration/configuration.js.map +1 -1
- package/src/generators/configuration/schema.d.js +0 -2
- package/src/generators/init/init.js +26 -18
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/schema.d.js +0 -2
- package/src/generators/vitest/schema.d.js +0 -2
- package/src/generators/vitest/vitest-generator.js +25 -17
- package/src/generators/vitest/vitest-generator.js.map +1 -1
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js +14 -10
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js.map +1 -1
- package/src/migrations/update-15-3-4/set-mode-in-configuration.js +12 -8
- package/src/migrations/update-15-3-4/set-mode-in-configuration.js.map +1 -1
- package/src/migrations/update-15-4-3/update-report-directory.js +8 -4
- package/src/migrations/update-15-4-3/update-report-directory.js.map +1 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +5 -3
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -1
- package/src/utils/generator-utils.js +120 -70
- package/src/utils/generator-utils.js.map +1 -1
- package/src/utils/options-utils.js +23 -9
- package/src/utils/options-utils.js.map +1 -1
- package/src/utils/test-files/angular-project.config.json +2 -2
- package/src/utils/test-files/react-lib-non-buildable-jest.json +2 -2
- package/src/utils/test-files/react-lib-non-buildable-vitest.json +2 -2
- package/src/utils/test-files/react-mixed-project.config.json +5 -5
- package/src/utils/test-files/react-project.config.json +5 -5
- package/src/utils/test-files/test-vite-configs.js +45 -15
- package/src/utils/test-files/test-vite-configs.js.map +1 -1
- package/src/utils/test-files/web-project.config.json +4 -4
- package/src/utils/test-utils.js +59 -43
- package/src/utils/test-utils.js.map +1 -1
- package/src/utils/versions.js +39 -13
- package/src/utils/versions.js.map +1 -1
- package/src/utils/vite-config-edit-utils.js +11 -9
- package/src/utils/vite-config-edit-utils.js.map +1 -1
- package/src/executors/build/schema.d.js.map +0 -1
- package/src/executors/dev-server/schema.d.js.map +0 -1
- package/src/executors/preview-server/schema.d.js.map +0 -1
- package/src/executors/test/schema.d.js.map +0 -1
- package/src/generators/configuration/schema.d.js.map +0 -1
- package/src/generators/init/schema.d.js.map +0 -1
- package/src/generators/vitest/schema.d.js.map +0 -1
package/src/utils/test-utils.js
CHANGED
|
@@ -6,25 +6,41 @@ function _export(target, all) {
|
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
8
|
_export(exports, {
|
|
9
|
-
mockViteReactAppGenerator: ()
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
mockViteReactAppGenerator: function() {
|
|
10
|
+
return mockViteReactAppGenerator;
|
|
11
|
+
},
|
|
12
|
+
mockReactAppGenerator: function() {
|
|
13
|
+
return mockReactAppGenerator;
|
|
14
|
+
},
|
|
15
|
+
mockReactMixedAppGenerator: function() {
|
|
16
|
+
return mockReactMixedAppGenerator;
|
|
17
|
+
},
|
|
18
|
+
mockWebAppGenerator: function() {
|
|
19
|
+
return mockWebAppGenerator;
|
|
20
|
+
},
|
|
21
|
+
mockAngularAppGenerator: function() {
|
|
22
|
+
return mockAngularAppGenerator;
|
|
23
|
+
},
|
|
24
|
+
mockUnknownAppGenerator: function() {
|
|
25
|
+
return mockUnknownAppGenerator;
|
|
26
|
+
},
|
|
27
|
+
mockReactLibNonBuildableJestTestRunnerGenerator: function() {
|
|
28
|
+
return mockReactLibNonBuildableJestTestRunnerGenerator;
|
|
29
|
+
},
|
|
30
|
+
mockReactLibNonBuildableVitestRunnerGenerator: function() {
|
|
31
|
+
return mockReactLibNonBuildableVitestRunnerGenerator;
|
|
32
|
+
}
|
|
17
33
|
});
|
|
18
|
-
const _extends = require("@swc/helpers/
|
|
34
|
+
const _extends = require("@swc/helpers/_/_extends");
|
|
19
35
|
const _devkit = require("@nx/devkit");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
36
|
+
const _reactprojectconfigjson = require("./test-files/react-project.config.json");
|
|
37
|
+
const _reactviteprojectconfigjson = require("./test-files/react-vite-project.config.json");
|
|
38
|
+
const _webprojectconfigjson = require("./test-files/web-project.config.json");
|
|
39
|
+
const _angularprojectconfigjson = require("./test-files/angular-project.config.json");
|
|
40
|
+
const _unknownprojectconfigjson = require("./test-files/unknown-project.config.json");
|
|
41
|
+
const _reactmixedprojectconfigjson = require("./test-files/react-mixed-project.config.json");
|
|
42
|
+
const _reactlibnonbuildablejestjson = require("./test-files/react-lib-non-buildable-jest.json");
|
|
43
|
+
const _reactlibnonbuildablevitestjson = require("./test-files/react-lib-non-buildable-vitest.json");
|
|
28
44
|
function mockViteReactAppGenerator(tree) {
|
|
29
45
|
const appName = 'my-test-react-vite-app';
|
|
30
46
|
tree.write(`apps/${appName}/src/main.tsx`, `import ReactDOM from 'react-dom';\n`);
|
|
@@ -57,8 +73,8 @@ function mockViteReactAppGenerator(tree) {
|
|
|
57
73
|
"types": ["node"]
|
|
58
74
|
},
|
|
59
75
|
"files": [
|
|
60
|
-
"../../node_modules/@
|
|
61
|
-
"../../node_modules/@
|
|
76
|
+
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
77
|
+
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
62
78
|
],
|
|
63
79
|
"exclude": [
|
|
64
80
|
"src/**/*.spec.ts",
|
|
@@ -119,13 +135,13 @@ function mockViteReactAppGenerator(tree) {
|
|
|
119
135
|
`);
|
|
120
136
|
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
121
137
|
projects: {
|
|
122
|
-
'my-test-react-vite-app': _extends({},
|
|
138
|
+
'my-test-react-vite-app': _extends._({}, _reactviteprojectconfigjson, {
|
|
123
139
|
root: `apps/${appName}`,
|
|
124
140
|
projectType: 'application'
|
|
125
141
|
})
|
|
126
142
|
}
|
|
127
143
|
});
|
|
128
|
-
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({},
|
|
144
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends._({}, _reactviteprojectconfigjson, {
|
|
129
145
|
root: `apps/${appName}`,
|
|
130
146
|
projectType: 'application'
|
|
131
147
|
}));
|
|
@@ -166,8 +182,8 @@ function mockReactAppGenerator(tree) {
|
|
|
166
182
|
"outDir": "../../dist/out-tsc"
|
|
167
183
|
},
|
|
168
184
|
"files": [
|
|
169
|
-
"../../node_modules/@
|
|
170
|
-
"../../node_modules/@
|
|
185
|
+
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
186
|
+
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
171
187
|
],
|
|
172
188
|
"exclude": [
|
|
173
189
|
"jest.config.ts",
|
|
@@ -199,13 +215,13 @@ function mockReactAppGenerator(tree) {
|
|
|
199
215
|
</html>`);
|
|
200
216
|
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
201
217
|
projects: {
|
|
202
|
-
'my-test-react-app': _extends({},
|
|
218
|
+
'my-test-react-app': _extends._({}, _reactprojectconfigjson, {
|
|
203
219
|
root: `apps/${appName}`,
|
|
204
220
|
projectType: 'application'
|
|
205
221
|
})
|
|
206
222
|
}
|
|
207
223
|
});
|
|
208
|
-
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({},
|
|
224
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends._({}, _reactprojectconfigjson, {
|
|
209
225
|
root: `apps/${appName}`,
|
|
210
226
|
projectType: 'application'
|
|
211
227
|
}));
|
|
@@ -246,8 +262,8 @@ function mockReactMixedAppGenerator(tree) {
|
|
|
246
262
|
"outDir": "../../dist/out-tsc"
|
|
247
263
|
},
|
|
248
264
|
"files": [
|
|
249
|
-
"../../node_modules/@
|
|
250
|
-
"../../node_modules/@
|
|
265
|
+
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
266
|
+
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
251
267
|
],
|
|
252
268
|
"exclude": [
|
|
253
269
|
"jest.config.ts",
|
|
@@ -279,13 +295,13 @@ function mockReactMixedAppGenerator(tree) {
|
|
|
279
295
|
</html>`);
|
|
280
296
|
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
281
297
|
projects: {
|
|
282
|
-
'my-test-mixed-react-app': _extends({},
|
|
298
|
+
'my-test-mixed-react-app': _extends._({}, _reactmixedprojectconfigjson, {
|
|
283
299
|
root: `apps/${appName}`,
|
|
284
300
|
projectType: 'application'
|
|
285
301
|
})
|
|
286
302
|
}
|
|
287
303
|
});
|
|
288
|
-
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({},
|
|
304
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends._({}, _reactmixedprojectconfigjson, {
|
|
289
305
|
root: `apps/${appName}`,
|
|
290
306
|
projectType: 'application'
|
|
291
307
|
}));
|
|
@@ -325,13 +341,13 @@ function mockWebAppGenerator(tree) {
|
|
|
325
341
|
`);
|
|
326
342
|
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
327
343
|
projects: {
|
|
328
|
-
'my-test-web-app': _extends({},
|
|
344
|
+
'my-test-web-app': _extends._({}, _webprojectconfigjson, {
|
|
329
345
|
root: `apps/${appName}`,
|
|
330
346
|
projectType: 'application'
|
|
331
347
|
})
|
|
332
348
|
}
|
|
333
349
|
});
|
|
334
|
-
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({},
|
|
350
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends._({}, _webprojectconfigjson, {
|
|
335
351
|
root: `apps/${appName}`,
|
|
336
352
|
projectType: 'application'
|
|
337
353
|
}));
|
|
@@ -341,13 +357,13 @@ function mockAngularAppGenerator(tree) {
|
|
|
341
357
|
const appName = 'my-test-angular-app';
|
|
342
358
|
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
343
359
|
projects: {
|
|
344
|
-
'my-test-angular-app': _extends({},
|
|
360
|
+
'my-test-angular-app': _extends._({}, _angularprojectconfigjson, {
|
|
345
361
|
root: `apps/${appName}`,
|
|
346
362
|
projectType: 'application'
|
|
347
363
|
})
|
|
348
364
|
}
|
|
349
365
|
});
|
|
350
|
-
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({},
|
|
366
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends._({}, _angularprojectconfigjson, {
|
|
351
367
|
root: `apps/${appName}`,
|
|
352
368
|
projectType: 'application'
|
|
353
369
|
}));
|
|
@@ -357,13 +373,13 @@ function mockUnknownAppGenerator(tree) {
|
|
|
357
373
|
const appName = 'my-test-random-app';
|
|
358
374
|
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
359
375
|
projects: {
|
|
360
|
-
'my-test-random-app': _extends({},
|
|
376
|
+
'my-test-random-app': _extends._({}, _unknownprojectconfigjson, {
|
|
361
377
|
root: `apps/${appName}`,
|
|
362
378
|
projectType: 'application'
|
|
363
379
|
})
|
|
364
380
|
}
|
|
365
381
|
});
|
|
366
|
-
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({},
|
|
382
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends._({}, _unknownprojectconfigjson, {
|
|
367
383
|
root: `apps/${appName}`,
|
|
368
384
|
projectType: 'application'
|
|
369
385
|
}));
|
|
@@ -399,8 +415,8 @@ function mockReactLibNonBuildableJestTestRunnerGenerator(tree) {
|
|
|
399
415
|
"types": ["node"]
|
|
400
416
|
},
|
|
401
417
|
"files": [
|
|
402
|
-
"../../node_modules/@
|
|
403
|
-
"../../node_modules/@
|
|
418
|
+
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
419
|
+
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
404
420
|
],
|
|
405
421
|
"exclude": [
|
|
406
422
|
"jest.config.ts",
|
|
@@ -417,13 +433,13 @@ function mockReactLibNonBuildableJestTestRunnerGenerator(tree) {
|
|
|
417
433
|
}`);
|
|
418
434
|
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
419
435
|
projects: {
|
|
420
|
-
[`${libName}`]: _extends({},
|
|
436
|
+
[`${libName}`]: _extends._({}, _reactlibnonbuildablejestjson, {
|
|
421
437
|
root: `libs/${libName}`,
|
|
422
438
|
projectType: 'library'
|
|
423
439
|
})
|
|
424
440
|
}
|
|
425
441
|
});
|
|
426
|
-
(0, _devkit.writeJson)(tree, `libs/${libName}/project.json`, _extends({},
|
|
442
|
+
(0, _devkit.writeJson)(tree, `libs/${libName}/project.json`, _extends._({}, _reactlibnonbuildablejestjson, {
|
|
427
443
|
root: `libs/${libName}`,
|
|
428
444
|
projectType: 'library'
|
|
429
445
|
}));
|
|
@@ -483,8 +499,8 @@ function mockReactLibNonBuildableVitestRunnerGenerator(tree) {
|
|
|
483
499
|
"types": ["node"]
|
|
484
500
|
},
|
|
485
501
|
"files": [
|
|
486
|
-
"../../node_modules/@
|
|
487
|
-
"../../node_modules/@
|
|
502
|
+
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
503
|
+
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
488
504
|
],
|
|
489
505
|
"exclude": [
|
|
490
506
|
"**/*.spec.ts",
|
|
@@ -500,13 +516,13 @@ function mockReactLibNonBuildableVitestRunnerGenerator(tree) {
|
|
|
500
516
|
}`);
|
|
501
517
|
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
502
518
|
projects: {
|
|
503
|
-
[`${libName}`]: _extends({},
|
|
519
|
+
[`${libName}`]: _extends._({}, _reactlibnonbuildablevitestjson, {
|
|
504
520
|
root: `libs/${libName}`,
|
|
505
521
|
projectType: 'library'
|
|
506
522
|
})
|
|
507
523
|
}
|
|
508
524
|
});
|
|
509
|
-
(0, _devkit.writeJson)(tree, `libs/${libName}/project.json`, _extends({},
|
|
525
|
+
(0, _devkit.writeJson)(tree, `libs/${libName}/project.json`, _extends._({}, _reactlibnonbuildablevitestjson, {
|
|
510
526
|
root: `libs/${libName}`,
|
|
511
527
|
projectType: 'library'
|
|
512
528
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/vite/src/utils/test-utils.ts"],"sourcesContent":["import { Tree, writeJson } from '@nx/devkit';\nimport * as reactAppConfig from './test-files/react-project.config.json';\nimport * as reactViteConfig from './test-files/react-vite-project.config.json';\nimport * as webAppConfig from './test-files/web-project.config.json';\nimport * as angularAppConfig from './test-files/angular-project.config.json';\nimport * as randomAppConfig from './test-files/unknown-project.config.json';\nimport * as mixedAppConfig from './test-files/react-mixed-project.config.json';\nimport * as reactLibNBJest from './test-files/react-lib-non-buildable-jest.json';\nimport * as reactLibNBVitest from './test-files/react-lib-non-buildable-vitest.json';\n\nexport function mockViteReactAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-react-vite-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true,\n \"types\": [\"vite/client\"]\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nrwl/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nrwl/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Rv1</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\" />\n <link rel=\"stylesheet\" href=\"/src/styles.css\" />\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n </html>`\n );\n\n tree.write(\n `apps/${appName}/vite.config.ts`,\n ` /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import tsconfigPaths from 'vite-tsconfig-paths';\n \n export default defineConfig({\n server: {\n port: 4200,\n host: 'localhost',\n },\n plugins: [\n react(),\n tsconfigPaths({\n root: '../../',\n projects: ['tsconfig.base.json'],\n }),\n ],\n \n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-react-vite-app': {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nrwl/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nrwl/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-react-app': {\n ...reactAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...reactAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\nexport function mockReactMixedAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-mixed-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nrwl/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nrwl/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-mixed-react-app': {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockWebAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-web-app';\n\n tree.write(`apps/${appName}/src/main.ts`, `import './app/app.element.ts';`);\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>WebappPure</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <workspace-root></workspace-root>\n </body>\n </html>\n `\n );\n\n writeJson(\n tree,\n 'workspace.json',\n\n {\n projects: {\n 'my-test-web-app': {\n ...webAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n }\n );\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...webAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n return tree;\n}\n\nexport function mockAngularAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-angular-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-angular-app': {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockUnknownAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-random-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-random-app': {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableJestTestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-jest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nrwl/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nrwl/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableVitestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-vitest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/vite.config.ts`,\n `/// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nrwl/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nrwl/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n"],"names":["mockViteReactAppGenerator","mockReactAppGenerator","mockReactMixedAppGenerator","mockWebAppGenerator","mockAngularAppGenerator","mockUnknownAppGenerator","mockReactLibNonBuildableJestTestRunnerGenerator","mockReactLibNonBuildableVitestRunnerGenerator","tree","appName","write","writeJson","projects","reactViteConfig","root","projectType","reactAppConfig","mixedAppConfig","webAppConfig","angularAppConfig","randomAppConfig","libName","reactLibNBJest","reactLibNBVitest"],"mappings":"AAAA;;;;;;;;IAUgBA,yBAAyB,MAAzBA;IAmIAC,qBAAqB,MAArBA;IAoGAC,0BAA0B,MAA1BA;IAqGAC,mBAAmB,MAAnBA;IAiEAC,uBAAuB,MAAvBA;IAsBAC,uBAAuB,MAAvBA;IAsBAC,+CAA+C,MAA/CA;IA4EAC,6CAA6C,MAA7CA;;;wBA/gBgB;wCACA;4CACC;sCACH;0CACI;0CACD;6CACD;8CACA;gDACE;AAE3B,SAASP,0BAA0BQ,IAAU,EAAQ;IAC1D,MAAMC,UAAU;IAEhBD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,aAAa,CAAC,EAC9B,CAAC,mCAAmC,CAAC;IAGvCD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,cAAc,CAAC,EAC/B,CAAC;;;;;;;;;;;;;;;;;;;;;MAqBC,CAAC;IAELD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,kBAAkB,CAAC,EACnC,CAAC;;;;;;;;;;;;;;;;;;;;;;MAsBC,CAAC;IAGLD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,WAAW,CAAC,EAC5B,CAAC;;;;;;;;;;;;;;;WAeM,CAAC;IAGVD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,eAAe,CAAC,EAChC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BD,CAAC;IAGHE,IAAAA,iBAAS,EAACH,MAAM,kBAAkB;QAChCI,UAAU;YACR,0BAA0B,aACrBC;gBACHC,MAAM,CAAC,KAAK,EAAEL,QAAQ,CAAC;gBACvBM,aAAa;;QAEjB;IACF;IAEAJ,IAAAA,iBAAS,EA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iBAAS,EAACH,MAAM,CAAC,KAAK,EAAEa,QAAQ,aAAa,CAAC,EAAE,aAC3CC;QACHR,MAAM,CAAC,KAAK,EAAEO,QAAQ,CAAC;QACvBN,aAAa;;IAGf,OAAOP;AACT;AAEO,SAASD,8CACdC,IAAU,EACJ;IACN,MAAMa,UAAU;IAEhBb,KAAKE,KAAK,CAAC,CAAC,KAAK,EAAEW,QAAQ,aAAa,CAAC,EAAE,CAAC,CAAC;IAE7Cb,KAAKE,KAAK,CACR,CAAC,KAAK,EAAEW,QAAQ,eAAe,CAAC,EAChC,CAAC;;;;;;;;;;;;;;;;;;;;;;;EAuBH,CAAC;IAGDb,KAAKE,KAAK,CACR,CAAC,KAAK,EAAEW,QAAQ,cAAc,CAAC,EAC/B,CAAC;;;;;;;;;;;;;;;;;;;KAmBA,CAAC;IAEJb,KAAKE,KAAK,CACR,CAAC,KAAK,EAAEW,QAAQ,kBAAkB,CAAC,EACnC,CAAC;;;;;;;;;;;;;;;;;;;;;KAqBA,CAAC;IAGJV,IAAAA,iBAAS,EAACH,MAAM,kBAAkB;QAChCI,UAAU;YACR,CAAC,CAAC,EAAES,QAAQ,CAAC,CAAC,EAAE,aACXE;gBACHT,MAAM,CAAC,KAAK,EAAEO,QAAQ,CAAC;gBACvBN,aAAa;;QAEjB;IACF;IAEAJ,IAAAA,iBAAS,EAACH,MAAM,CAAC,KAAK,EAAEa,QAAQ,aAAa,CAAC,EAAE,aAC3CE;QACHT,MAAM,CAAC,KAAK,EAAEO,QAAQ,CAAC;QACvBN,aAAa;;IAGf,OAAOP;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/test-utils.ts"],"sourcesContent":["import { Tree, writeJson } from '@nx/devkit';\nimport * as reactAppConfig from './test-files/react-project.config.json';\nimport * as reactViteConfig from './test-files/react-vite-project.config.json';\nimport * as webAppConfig from './test-files/web-project.config.json';\nimport * as angularAppConfig from './test-files/angular-project.config.json';\nimport * as randomAppConfig from './test-files/unknown-project.config.json';\nimport * as mixedAppConfig from './test-files/react-mixed-project.config.json';\nimport * as reactLibNBJest from './test-files/react-lib-non-buildable-jest.json';\nimport * as reactLibNBVitest from './test-files/react-lib-non-buildable-vitest.json';\n\nexport function mockViteReactAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-react-vite-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true,\n \"types\": [\"vite/client\"]\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Rv1</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\" />\n <link rel=\"stylesheet\" href=\"/src/styles.css\" />\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n </html>`\n );\n\n tree.write(\n `apps/${appName}/vite.config.ts`,\n ` /// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import tsconfigPaths from 'vite-tsconfig-paths';\n \n export default defineConfig({\n server: {\n port: 4200,\n host: 'localhost',\n },\n plugins: [\n react(),\n tsconfigPaths({\n root: '../../',\n projects: ['tsconfig.base.json'],\n }),\n ],\n \n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-react-vite-app': {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...reactViteConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-react-app': {\n ...reactAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...reactAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\nexport function mockReactMixedAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-mixed-react-app';\n\n tree.write(\n `apps/${appName}/src/main.tsx`,\n `import ReactDOM from 'react-dom';\\n`\n );\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n }\n `\n );\n tree.write(\n `apps/${appName}/tsconfig.app.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\"\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>My Test React App</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html>`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-mixed-react-app': {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...mixedAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockWebAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-web-app';\n\n tree.write(`apps/${appName}/src/main.ts`, `import './app/app.element.ts';`);\n\n tree.write(\n `apps/${appName}/tsconfig.json`,\n `{\n \"extends\": \"../../tsconfig.base.json\",\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ]\n } \n `\n );\n\n tree.write(\n `apps/${appName}/src/index.html`,\n `<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>WebappPure</title>\n <base href=\"/\" />\n \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n </head>\n <body>\n <workspace-root></workspace-root>\n </body>\n </html>\n `\n );\n\n writeJson(\n tree,\n 'workspace.json',\n\n {\n projects: {\n 'my-test-web-app': {\n ...webAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n }\n );\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...webAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n return tree;\n}\n\nexport function mockAngularAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-angular-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-angular-app': {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...angularAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockUnknownAppGenerator(tree: Tree): Tree {\n const appName = 'my-test-random-app';\n\n writeJson(tree, 'workspace.json', {\n projects: {\n 'my-test-random-app': {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n },\n },\n });\n\n writeJson(tree, `apps/${appName}/project.json`, {\n ...randomAppConfig,\n root: `apps/${appName}`,\n projectType: 'application',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableJestTestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-jest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"jest.config.ts\",\n \"src/**/*.spec.ts\",\n \"src/**/*.test.ts\",\n \"src/**/*.spec.tsx\",\n \"src/**/*.test.tsx\",\n \"src/**/*.spec.js\",\n \"src/**/*.test.js\",\n \"src/**/*.spec.jsx\",\n \"src/**/*.test.jsx\"\n ],\n \"include\": [\"src/**/*.js\", \"src/**/*.jsx\", \"src/**/*.ts\", \"src/**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBJest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n\nexport function mockReactLibNonBuildableVitestRunnerGenerator(\n tree: Tree\n): Tree {\n const libName = 'react-lib-nonb-vitest';\n\n tree.write(`libs/${libName}/src/index.ts`, ``);\n\n tree.write(\n `libs/${libName}/vite.config.ts`,\n `/// <reference types=\"vitest\" />\n import { defineConfig } from 'vite';\n import react from '@vitejs/plugin-react';\n import viteTsConfigPaths from 'vite-tsconfig-paths';\n\n export default defineConfig({\n\n plugins: [\n react(),\n viteTsConfigPaths({\n root: '../../',\n }),\n ],\n\n test: {\n globals: true,\n cache: {\n dir: '../../node_modules/.vitest',\n },\n environment: 'jsdom',\n include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n },\n });\n `\n );\n\n tree.write(\n `libs/${libName}/tsconfig.json`,\n `{\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"allowJs\": false,\n \"esModuleInterop\": false,\n \"allowSyntheticDefaultImports\": true,\n \"strict\": true\n },\n \"files\": [],\n \"include\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.lib.json\"\n },\n {\n \"path\": \"./tsconfig.spec.json\"\n }\n ],\n \"extends\": \"../../tsconfig.base.json\"\n }`\n );\n tree.write(\n `libs/${libName}/tsconfig.lib.json`,\n `{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../../dist/out-tsc\",\n \"types\": [\"node\"]\n },\n \"files\": [\n \"../../node_modules/@nx/react/typings/cssmodule.d.ts\",\n \"../../node_modules/@nx/react/typings/image.d.ts\"\n ],\n \"exclude\": [\n \"**/*.spec.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.tsx\",\n \"**/*.test.tsx\",\n \"**/*.spec.js\",\n \"**/*.test.js\",\n \"**/*.spec.jsx\",\n \"**/*.test.jsx\"\n ],\n \"include\": [\"**/*.js\", \"**/*.jsx\", \"**/*.ts\", \"**/*.tsx\"]\n }`\n );\n\n writeJson(tree, 'workspace.json', {\n projects: {\n [`${libName}`]: {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n },\n },\n });\n\n writeJson(tree, `libs/${libName}/project.json`, {\n ...reactLibNBVitest,\n root: `libs/${libName}`,\n projectType: 'library',\n });\n\n return tree;\n}\n"],"names":["mockViteReactAppGenerator","mockReactAppGenerator","mockReactMixedAppGenerator","mockWebAppGenerator","mockAngularAppGenerator","mockUnknownAppGenerator","mockReactLibNonBuildableJestTestRunnerGenerator","mockReactLibNonBuildableVitestRunnerGenerator","tree","appName","write","writeJson","projects","reactViteConfig","root","projectType","reactAppConfig","mixedAppConfig","webAppConfig","angularAppConfig","randomAppConfig","libName","reactLibNBJest","reactLibNBVitest"],"mappings":";;;;;;;;IAUgBA,yBAAyB;eAAzBA;;IAmIAC,qBAAqB;eAArBA;;IAoGAC,0BAA0B;eAA1BA;;IAqGAC,mBAAmB;eAAnBA;;IAiEAC,uBAAuB;eAAvBA;;IAsBAC,uBAAuB;eAAvBA;;IAsBAC,+CAA+C;eAA/CA;;IA4EAC,6CAA6C;eAA7CA;;;;wBA/gBgB;wCACA;4CACC;sCACH;0CACI;0CACD;6CACD;8CACA;gDACE;AAE3B,SAASP,0BAA0BQ,IAAU,EAAQ;IAC1D,MAAMC,UAAU;IAEhBD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,aAAa,CAAC,EAC9B,CAAC,mCAAmC,CAAC;IAGvCD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,cAAc,CAAC,EAC/B,CAAC;;;;;;;;;;;;;;;;;;;;;MAqBC,CAAC;IAELD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,kBAAkB,CAAC,EACnC,CAAC;;;;;;;;;;;;;;;;;;;;;;MAsBC,CAAC;IAGLD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,WAAW,CAAC,EAC5B,CAAC;;;;;;;;;;;;;;;WAeM,CAAC;IAGVD,KAAKE,KAAK,CACR,CAAC,KAAK,EAAED,QAAQ,eAAe,CAAC,EAChC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BD,CAAC;IAGHE,IAAAA,iBAAS,EAACH,MAAM,kBAAkB;QAChCI,UAAU;YACR,0BAA0B,eACrBC;gBACHC,MAAM,CAAC,KAAK,EAAEL,QAAQ,CAAC;gBACvBM,aAAa;;QAEjB;IACF;IAEAJ,IAAAA,iBAAS,EAACH,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
20
|
-
|
|
21
|
-
|
|
9
|
+
nxVersion: function() {
|
|
10
|
+
return nxVersion;
|
|
11
|
+
},
|
|
12
|
+
viteVersion: function() {
|
|
13
|
+
return viteVersion;
|
|
14
|
+
},
|
|
15
|
+
vitePluginEslintVersion: function() {
|
|
16
|
+
return vitePluginEslintVersion;
|
|
17
|
+
},
|
|
18
|
+
vitestVersion: function() {
|
|
19
|
+
return vitestVersion;
|
|
20
|
+
},
|
|
21
|
+
vitestUiVersion: function() {
|
|
22
|
+
return vitestUiVersion;
|
|
23
|
+
},
|
|
24
|
+
vitePluginReactVersion: function() {
|
|
25
|
+
return vitePluginReactVersion;
|
|
26
|
+
},
|
|
27
|
+
vitePluginVueVersion: function() {
|
|
28
|
+
return vitePluginVueVersion;
|
|
29
|
+
},
|
|
30
|
+
vitePluginVueJsxVersion: function() {
|
|
31
|
+
return vitePluginVueJsxVersion;
|
|
32
|
+
},
|
|
33
|
+
viteTsConfigPathsVersion: function() {
|
|
34
|
+
return viteTsConfigPathsVersion;
|
|
35
|
+
},
|
|
36
|
+
jsdomVersion: function() {
|
|
37
|
+
return jsdomVersion;
|
|
38
|
+
},
|
|
39
|
+
vitePluginDtsVersion: function() {
|
|
40
|
+
return vitePluginDtsVersion;
|
|
41
|
+
},
|
|
42
|
+
vitestCoverageC8Version: function() {
|
|
43
|
+
return vitestCoverageC8Version;
|
|
44
|
+
},
|
|
45
|
+
vitestCoverageIstanbulVersion: function() {
|
|
46
|
+
return vitestCoverageIstanbulVersion;
|
|
47
|
+
}
|
|
22
48
|
});
|
|
23
49
|
const nxVersion = require('../../package.json').version;
|
|
24
50
|
const viteVersion = '^4.0.1';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/vite/src/utils/versions.ts"],"sourcesContent":["export const nxVersion = require('../../package.json').version;\nexport const viteVersion = '^4.0.1';\nexport const vitePluginEslintVersion = '^1.8.1';\nexport const vitestVersion = '^0.25.8';\nexport const vitestUiVersion = '^0.25.8';\nexport const vitePluginReactVersion = '^3.0.0';\nexport const vitePluginVueVersion = '^3.2.0';\nexport const vitePluginVueJsxVersion = '^2.1.1';\nexport const viteTsConfigPathsVersion = '^4.0.2';\nexport const jsdomVersion = '~20.0.3';\nexport const vitePluginDtsVersion = '~1.7.1';\n\n// Coverage providers\nexport const vitestCoverageC8Version = '~0.25.8';\nexport const vitestCoverageIstanbulVersion = '~0.25.8';\n"],"names":["nxVersion","viteVersion","vitePluginEslintVersion","vitestVersion","vitestUiVersion","vitePluginReactVersion","vitePluginVueVersion","vitePluginVueJsxVersion","viteTsConfigPathsVersion","jsdomVersion","vitePluginDtsVersion","vitestCoverageC8Version","vitestCoverageIstanbulVersion","require","version"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/versions.ts"],"sourcesContent":["export const nxVersion = require('../../package.json').version;\nexport const viteVersion = '^4.0.1';\nexport const vitePluginEslintVersion = '^1.8.1';\nexport const vitestVersion = '^0.25.8';\nexport const vitestUiVersion = '^0.25.8';\nexport const vitePluginReactVersion = '^3.0.0';\nexport const vitePluginVueVersion = '^3.2.0';\nexport const vitePluginVueJsxVersion = '^2.1.1';\nexport const viteTsConfigPathsVersion = '^4.0.2';\nexport const jsdomVersion = '~20.0.3';\nexport const vitePluginDtsVersion = '~1.7.1';\n\n// Coverage providers\nexport const vitestCoverageC8Version = '~0.25.8';\nexport const vitestCoverageIstanbulVersion = '~0.25.8';\n"],"names":["nxVersion","viteVersion","vitePluginEslintVersion","vitestVersion","vitestUiVersion","vitePluginReactVersion","vitePluginVueVersion","vitePluginVueJsxVersion","viteTsConfigPathsVersion","jsdomVersion","vitePluginDtsVersion","vitestCoverageC8Version","vitestCoverageIstanbulVersion","require","version"],"mappings":";;;;;;;;IAAaA,SAAS;eAATA;;IACAC,WAAW;eAAXA;;IACAC,uBAAuB;eAAvBA;;IACAC,aAAa;eAAbA;;IACAC,eAAe;eAAfA;;IACAC,sBAAsB;eAAtBA;;IACAC,oBAAoB;eAApBA;;IACAC,uBAAuB;eAAvBA;;IACAC,wBAAwB;eAAxBA;;IACAC,YAAY;eAAZA;;IACAC,oBAAoB;eAApBA;;IAGAC,uBAAuB;eAAvBA;;IACAC,6BAA6B;eAA7BA;;;AAdN,MAAMZ,YAAYa,QAAQ,sBAAsBC,OAAO;AACvD,MAAMb,cAAc;AACpB,MAAMC,0BAA0B;AAChC,MAAMC,gBAAgB;AACtB,MAAMC,kBAAkB;AACxB,MAAMC,yBAAyB;AAC/B,MAAMC,uBAAuB;AAC7B,MAAMC,0BAA0B;AAChC,MAAMC,2BAA2B;AACjC,MAAMC,eAAe;AACrB,MAAMC,uBAAuB;AAG7B,MAAMC,0BAA0B;AAChC,MAAMC,gCAAgC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "ensureViteConfigIsCorrect", {
|
|
3
3
|
enumerable: true,
|
|
4
|
-
get: ()
|
|
4
|
+
get: function() {
|
|
5
|
+
return ensureViteConfigIsCorrect;
|
|
6
|
+
}
|
|
5
7
|
});
|
|
6
8
|
const _devkit = require("@nx/devkit");
|
|
7
|
-
const
|
|
9
|
+
const _js = require("@nx/js");
|
|
8
10
|
function ensureViteConfigIsCorrect(tree, path, buildConfigString, buildConfigObject, dtsPlugin, dtsImportLine, pluginOption, testConfigString, testConfigObject, cacheDir, projectAlreadyHasViteTargets) {
|
|
9
11
|
const fileContent = tree.read(path, 'utf-8');
|
|
10
12
|
let updatedContent = undefined;
|
|
@@ -88,12 +90,12 @@ function handleBuildOrTestNode(updatedFileContent, configContentString, configCo
|
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
function transformCurrentBuildObject(index, returnStatements, appFileContent, buildConfigObject) {
|
|
91
|
-
var
|
|
93
|
+
var _tsquery_query;
|
|
92
94
|
if (!(returnStatements == null ? void 0 : returnStatements[index])) {
|
|
93
95
|
return undefined;
|
|
94
96
|
}
|
|
95
97
|
const { tsquery } = require('@phenomnomnominal/tsquery');
|
|
96
|
-
const currentBuildObject = (
|
|
98
|
+
const currentBuildObject = (_tsquery_query = tsquery.query(returnStatements[index], 'ObjectLiteralExpression')) == null ? void 0 : _tsquery_query[0].getText();
|
|
97
99
|
const currentBuildObjectStart = returnStatements[index].getStart();
|
|
98
100
|
const currentBuildObjectEnd = returnStatements[index].getEnd();
|
|
99
101
|
const newReturnObject = tsquery.replace(returnStatements[index].getText(), 'ObjectLiteralExpression', (_node)=>{
|
|
@@ -125,13 +127,13 @@ function transformConditionalConfig(conditionalConfig, appFileContent, buildConf
|
|
|
125
127
|
const buildExists = binaryExpressions == null ? void 0 : binaryExpressions.find((binaryExpression)=>binaryExpression.getText() === `command === 'build'`);
|
|
126
128
|
const buildExistsExpressionIndex = binaryExpressions == null ? void 0 : binaryExpressions.findIndex((binaryExpression)=>binaryExpression.getText() === `command === 'build'`);
|
|
127
129
|
const serveExists = binaryExpressions == null ? void 0 : binaryExpressions.find((binaryExpression)=>binaryExpression.getText() === `command === 'serve'`);
|
|
128
|
-
const elseKeywordExists = (0,
|
|
130
|
+
const elseKeywordExists = (0, _js.findNodes)(ifStatement == null ? void 0 : ifStatement[0], SyntaxKind.ElseKeyword);
|
|
129
131
|
const returnStatements = tsquery.query(ifStatement[0], 'ReturnStatement');
|
|
130
132
|
if (!buildExists) {
|
|
131
133
|
if (serveExists && elseKeywordExists) {
|
|
132
|
-
var
|
|
134
|
+
var _transformCurrentBuildObject;
|
|
133
135
|
// build options live inside the else block
|
|
134
|
-
return (
|
|
136
|
+
return (_transformCurrentBuildObject = transformCurrentBuildObject((returnStatements == null ? void 0 : returnStatements.length) - 1, returnStatements, appFileContent, buildConfigObject)) != null ? _transformCurrentBuildObject : appFileContent;
|
|
135
137
|
} else {
|
|
136
138
|
// no build options exist yet
|
|
137
139
|
const functionBlockStart = functionBlock == null ? void 0 : functionBlock[0].getStart();
|
|
@@ -149,11 +151,11 @@ function transformConditionalConfig(conditionalConfig, appFileContent, buildConf
|
|
|
149
151
|
return newContents;
|
|
150
152
|
}
|
|
151
153
|
} else {
|
|
152
|
-
var
|
|
154
|
+
var _transformCurrentBuildObject1;
|
|
153
155
|
// build already exists
|
|
154
156
|
// it will be the return statement which lives
|
|
155
157
|
// at the buildExistsExpressionIndex
|
|
156
|
-
return (
|
|
158
|
+
return (_transformCurrentBuildObject1 = transformCurrentBuildObject(buildExistsExpressionIndex, returnStatements, appFileContent, buildConfigObject)) != null ? _transformCurrentBuildObject1 : appFileContent;
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
function handlePluginNode(appFileContent, dtsPlugin, dtsImportLine, pluginOption) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/vite/src/utils/vite-config-edit-utils.ts"],"sourcesContent":["import { applyChangesToString, ChangeType, Tree } from '@nx/devkit';\nimport { findNodes } from 'nx/src/utils/typescript';\nimport { TargetFlags } from './generator-utils';\nimport type { Node, ReturnStatement } from 'typescript';\n\nexport function ensureViteConfigIsCorrect(\n tree: Tree,\n path: string,\n buildConfigString: string,\n buildConfigObject: {},\n dtsPlugin: string,\n dtsImportLine: string,\n pluginOption: string,\n testConfigString: string,\n testConfigObject: {},\n cacheDir: string,\n projectAlreadyHasViteTargets?: TargetFlags\n): boolean {\n const fileContent = tree.read(path, 'utf-8');\n\n let updatedContent = undefined;\n\n if (!projectAlreadyHasViteTargets?.test && testConfigString?.length) {\n updatedContent = handleBuildOrTestNode(\n fileContent,\n testConfigString,\n testConfigObject,\n 'test'\n );\n }\n\n if (!projectAlreadyHasViteTargets?.build && buildConfigString?.length) {\n updatedContent = handlePluginNode(\n updatedContent ?? fileContent,\n dtsPlugin,\n dtsImportLine,\n pluginOption\n );\n\n updatedContent = handleBuildOrTestNode(\n updatedContent ?? fileContent,\n buildConfigString,\n buildConfigObject,\n 'build'\n );\n }\n\n if (cacheDir?.length) {\n updatedContent = handleCacheDirNode(\n updatedContent ?? fileContent,\n cacheDir\n );\n }\n if (updatedContent) {\n tree.write(path, updatedContent);\n return true;\n } else {\n return false;\n }\n}\n\nfunction handleBuildOrTestNode(\n updatedFileContent: string,\n configContentString: string,\n configContentObject: {},\n name: 'build' | 'test'\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const buildNode = tsquery.query(\n updatedFileContent,\n `PropertyAssignment:has(Identifier[name=\"${name}\"])`\n );\n\n if (buildNode.length) {\n return tsquery.replace(\n updatedFileContent,\n `PropertyAssignment:has(Identifier[name=\"${name}\"])`,\n (node: Node) => {\n const found = tsquery.query(node, 'ObjectLiteralExpression');\n return `${name}: {\n ...${found?.[0].getText()},\n ...${JSON.stringify(configContentObject)}\n }`;\n }\n );\n } else {\n const foundDefineConfig = tsquery.query(\n updatedFileContent,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n if (name === 'build') {\n return transformConditionalConfig(\n conditionalConfig,\n updatedFileContent,\n configContentString\n );\n } else {\n // no test config in conditional config\n return updatedFileContent;\n }\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: configContentString,\n },\n ]);\n } else {\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: configContentString,\n },\n ]);\n }\n }\n } else {\n // build config does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(\n updatedFileContent,\n 'ExportAssignment'\n );\n const found = tsquery.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: configContentString,\n },\n ]);\n } catch {\n return updatedFileContent;\n }\n }\n }\n}\n\nfunction transformCurrentBuildObject(\n index: number,\n returnStatements: ReturnStatement[],\n appFileContent: string,\n buildConfigObject: {}\n): string | undefined {\n if (!returnStatements?.[index]) {\n return undefined;\n }\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const currentBuildObject = tsquery\n .query(returnStatements[index], 'ObjectLiteralExpression')?.[0]\n .getText();\n\n const currentBuildObjectStart = returnStatements[index].getStart();\n const currentBuildObjectEnd = returnStatements[index].getEnd();\n\n const newReturnObject = tsquery.replace(\n returnStatements[index].getText(),\n 'ObjectLiteralExpression',\n (_node: Node) => {\n return `{\n ...${currentBuildObject},\n ...${JSON.stringify(buildConfigObject)}\n }`;\n }\n );\n\n const newContents = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Delete,\n start: currentBuildObjectStart,\n length: currentBuildObjectEnd - currentBuildObjectStart,\n },\n {\n type: ChangeType.Insert,\n index: currentBuildObjectStart,\n text: newReturnObject,\n },\n ]);\n\n return newContents;\n}\n\nfunction transformConditionalConfig(\n conditionalConfig: Node[],\n appFileContent: string,\n buildConfigObject: {}\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const { SyntaxKind } = require('typescript');\n const functionBlock = tsquery.query(conditionalConfig[0], 'Block');\n\n const ifStatement = tsquery.query(functionBlock?.[0], 'IfStatement');\n\n const binaryExpressions = tsquery.query(ifStatement?.[0], 'BinaryExpression');\n\n const buildExists = binaryExpressions?.find(\n (binaryExpression) => binaryExpression.getText() === `command === 'build'`\n );\n\n const buildExistsExpressionIndex = binaryExpressions?.findIndex(\n (binaryExpression) => binaryExpression.getText() === `command === 'build'`\n );\n\n const serveExists = binaryExpressions?.find(\n (binaryExpression) => binaryExpression.getText() === `command === 'serve'`\n );\n\n const elseKeywordExists = findNodes(ifStatement?.[0], SyntaxKind.ElseKeyword);\n const returnStatements: ReturnStatement[] = tsquery.query(\n ifStatement[0],\n 'ReturnStatement'\n );\n\n if (!buildExists) {\n if (serveExists && elseKeywordExists) {\n // build options live inside the else block\n\n return (\n transformCurrentBuildObject(\n returnStatements?.length - 1,\n returnStatements,\n appFileContent,\n buildConfigObject\n ) ?? appFileContent\n );\n } else {\n // no build options exist yet\n const functionBlockStart = functionBlock?.[0].getStart();\n const newContents = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: functionBlockStart + 1,\n text: `\n if (command === 'build') {\n return ${JSON.stringify(buildConfigObject)}\n }\n `,\n },\n ]);\n return newContents;\n }\n } else {\n // build already exists\n // it will be the return statement which lives\n // at the buildExistsExpressionIndex\n\n return (\n transformCurrentBuildObject(\n buildExistsExpressionIndex,\n returnStatements,\n appFileContent,\n buildConfigObject\n ) ?? appFileContent\n );\n }\n}\n\nfunction handlePluginNode(\n appFileContent: string,\n dtsPlugin: string,\n dtsImportLine: string,\n pluginOption: string\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n\n const file = tsquery.ast(appFileContent);\n const pluginsNode = tsquery.query(\n file,\n 'PropertyAssignment:has(Identifier[name=\"plugins\"])'\n );\n\n let writeFile = false;\n\n if (pluginsNode.length) {\n appFileContent = tsquery.replace(\n file.getText(),\n 'PropertyAssignment:has(Identifier[name=\"plugins\"])',\n (node: Node) => {\n const found = tsquery.query(node, 'ArrayLiteralExpression');\n return `plugins: [\n ...${found?.[0].getText()},\n ${dtsPlugin}\n ]`;\n }\n );\n writeFile = true;\n } else {\n // Plugins node does not exist yet\n // So make one from scratch\n\n const foundDefineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n // We are NOT transforming the conditional config\n // with plugins\n writeFile = false;\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: pluginOption,\n },\n ]);\n writeFile = true;\n } else {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: pluginOption,\n },\n ]);\n writeFile = true;\n }\n }\n } else {\n // Plugins option does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(file, 'ExportAssignment');\n const found = tsquery?.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: pluginOption,\n },\n ]);\n writeFile = true;\n } catch {\n writeFile = false;\n }\n }\n }\n\n if (writeFile) {\n if (!appFileContent.includes(`import dts from 'vite-plugin-dts'`)) {\n return dtsImportLine + '\\n' + appFileContent;\n }\n return appFileContent;\n }\n return appFileContent;\n}\n\nfunction handleCacheDirNode(appFileContent: string, cacheDir: string): string {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n\n const file = tsquery.ast(appFileContent);\n const cacheDirNode = tsquery.query(\n file,\n 'PropertyAssignment:has(Identifier[name=\"cacheDir\"])'\n );\n\n if (!cacheDirNode?.length || cacheDirNode?.length === 0) {\n // cacheDir node does not exist yet\n // So make one from scratch\n\n const foundDefineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n // We are NOT transforming the conditional config\n // with cacheDir\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: cacheDir,\n },\n ]);\n } else {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: cacheDir,\n },\n ]);\n }\n }\n } else {\n // cacheDir option does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(file, 'ExportAssignment');\n const found = tsquery?.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: cacheDir,\n },\n ]);\n } catch {}\n }\n }\n\n return appFileContent;\n}\n"],"names":["ensureViteConfigIsCorrect","tree","path","buildConfigString","buildConfigObject","dtsPlugin","dtsImportLine","pluginOption","testConfigString","testConfigObject","cacheDir","projectAlreadyHasViteTargets","fileContent","read","updatedContent","undefined","test","length","handleBuildOrTestNode","build","handlePluginNode","handleCacheDirNode","write","updatedFileContent","configContentString","configContentObject","name","tsquery","require","buildNode","query","replace","node","found","getText","JSON","stringify","foundDefineConfig","conditionalConfig","transformConditionalConfig","propertyAssignments","applyChangesToString","type","ChangeType","Insert","index","getStart","text","defaultExport","startOfObject","transformCurrentBuildObject","returnStatements","appFileContent","currentBuildObject","currentBuildObjectStart","currentBuildObjectEnd","getEnd","newReturnObject","_node","newContents","Delete","start","SyntaxKind","functionBlock","ifStatement","binaryExpressions","buildExists","find","binaryExpression","buildExistsExpressionIndex","findIndex","serveExists","elseKeywordExists","findNodes","ElseKeyword","functionBlockStart","file","ast","pluginsNode","writeFile","includes","cacheDirNode"],"mappings":"AAAA;+BAKgBA;;aAAAA;;wBALuC;4BAC7B;AAInB,SAASA,0BACdC,IAAU,EACVC,IAAY,EACZC,iBAAyB,EACzBC,iBAAqB,EACrBC,SAAiB,EACjBC,aAAqB,EACrBC,YAAoB,EACpBC,gBAAwB,EACxBC,gBAAoB,EACpBC,QAAgB,EAChBC,4BAA0C,EACjC;IACT,MAAMC,cAA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,QAASG,KAAK,CAC1BkB,wBAAAA,KAAAA,IAAAA,aAAe,CAAC,EAAE,EAClB;gBAEF,MAAMC,gBAAgBhB,gBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE,CAACa,QAAQ,EAAE;gBAC3CM,iBAAiBX,IAAAA,4BAAoB,EAACW,gBAAgB;oBACpD;wBACEV,MAAMC,kBAAU,CAACC,MAAM;wBACvBC,OAAOI,gBAAgB;wBACvBF,MAAMrC;oBACR;iBACD;YACH,EAAE,UAAM,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO0C;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/vite-config-edit-utils.ts"],"sourcesContent":["import { applyChangesToString, ChangeType, Tree } from '@nx/devkit';\nimport { findNodes } from '@nx/js';\nimport { TargetFlags } from './generator-utils';\nimport type { Node, ReturnStatement } from 'typescript';\n\nexport function ensureViteConfigIsCorrect(\n tree: Tree,\n path: string,\n buildConfigString: string,\n buildConfigObject: {},\n dtsPlugin: string,\n dtsImportLine: string,\n pluginOption: string,\n testConfigString: string,\n testConfigObject: {},\n cacheDir: string,\n projectAlreadyHasViteTargets?: TargetFlags\n): boolean {\n const fileContent = tree.read(path, 'utf-8');\n\n let updatedContent = undefined;\n\n if (!projectAlreadyHasViteTargets?.test && testConfigString?.length) {\n updatedContent = handleBuildOrTestNode(\n fileContent,\n testConfigString,\n testConfigObject,\n 'test'\n );\n }\n\n if (!projectAlreadyHasViteTargets?.build && buildConfigString?.length) {\n updatedContent = handlePluginNode(\n updatedContent ?? fileContent,\n dtsPlugin,\n dtsImportLine,\n pluginOption\n );\n\n updatedContent = handleBuildOrTestNode(\n updatedContent ?? fileContent,\n buildConfigString,\n buildConfigObject,\n 'build'\n );\n }\n\n if (cacheDir?.length) {\n updatedContent = handleCacheDirNode(\n updatedContent ?? fileContent,\n cacheDir\n );\n }\n if (updatedContent) {\n tree.write(path, updatedContent);\n return true;\n } else {\n return false;\n }\n}\n\nfunction handleBuildOrTestNode(\n updatedFileContent: string,\n configContentString: string,\n configContentObject: {},\n name: 'build' | 'test'\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const buildNode = tsquery.query(\n updatedFileContent,\n `PropertyAssignment:has(Identifier[name=\"${name}\"])`\n );\n\n if (buildNode.length) {\n return tsquery.replace(\n updatedFileContent,\n `PropertyAssignment:has(Identifier[name=\"${name}\"])`,\n (node: Node) => {\n const found = tsquery.query(node, 'ObjectLiteralExpression');\n return `${name}: {\n ...${found?.[0].getText()},\n ...${JSON.stringify(configContentObject)}\n }`;\n }\n );\n } else {\n const foundDefineConfig = tsquery.query(\n updatedFileContent,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n if (name === 'build') {\n return transformConditionalConfig(\n conditionalConfig,\n updatedFileContent,\n configContentString\n );\n } else {\n // no test config in conditional config\n return updatedFileContent;\n }\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: configContentString,\n },\n ]);\n } else {\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: configContentString,\n },\n ]);\n }\n }\n } else {\n // build config does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(\n updatedFileContent,\n 'ExportAssignment'\n );\n const found = tsquery.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n return applyChangesToString(updatedFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: configContentString,\n },\n ]);\n } catch {\n return updatedFileContent;\n }\n }\n }\n}\n\nfunction transformCurrentBuildObject(\n index: number,\n returnStatements: ReturnStatement[],\n appFileContent: string,\n buildConfigObject: {}\n): string | undefined {\n if (!returnStatements?.[index]) {\n return undefined;\n }\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const currentBuildObject = tsquery\n .query(returnStatements[index], 'ObjectLiteralExpression')?.[0]\n .getText();\n\n const currentBuildObjectStart = returnStatements[index].getStart();\n const currentBuildObjectEnd = returnStatements[index].getEnd();\n\n const newReturnObject = tsquery.replace(\n returnStatements[index].getText(),\n 'ObjectLiteralExpression',\n (_node: Node) => {\n return `{\n ...${currentBuildObject},\n ...${JSON.stringify(buildConfigObject)}\n }`;\n }\n );\n\n const newContents = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Delete,\n start: currentBuildObjectStart,\n length: currentBuildObjectEnd - currentBuildObjectStart,\n },\n {\n type: ChangeType.Insert,\n index: currentBuildObjectStart,\n text: newReturnObject,\n },\n ]);\n\n return newContents;\n}\n\nfunction transformConditionalConfig(\n conditionalConfig: Node[],\n appFileContent: string,\n buildConfigObject: {}\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n const { SyntaxKind } = require('typescript');\n const functionBlock = tsquery.query(conditionalConfig[0], 'Block');\n\n const ifStatement = tsquery.query(functionBlock?.[0], 'IfStatement');\n\n const binaryExpressions = tsquery.query(ifStatement?.[0], 'BinaryExpression');\n\n const buildExists = binaryExpressions?.find(\n (binaryExpression) => binaryExpression.getText() === `command === 'build'`\n );\n\n const buildExistsExpressionIndex = binaryExpressions?.findIndex(\n (binaryExpression) => binaryExpression.getText() === `command === 'build'`\n );\n\n const serveExists = binaryExpressions?.find(\n (binaryExpression) => binaryExpression.getText() === `command === 'serve'`\n );\n\n const elseKeywordExists = findNodes(ifStatement?.[0], SyntaxKind.ElseKeyword);\n const returnStatements: ReturnStatement[] = tsquery.query(\n ifStatement[0],\n 'ReturnStatement'\n );\n\n if (!buildExists) {\n if (serveExists && elseKeywordExists) {\n // build options live inside the else block\n\n return (\n transformCurrentBuildObject(\n returnStatements?.length - 1,\n returnStatements,\n appFileContent,\n buildConfigObject\n ) ?? appFileContent\n );\n } else {\n // no build options exist yet\n const functionBlockStart = functionBlock?.[0].getStart();\n const newContents = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: functionBlockStart + 1,\n text: `\n if (command === 'build') {\n return ${JSON.stringify(buildConfigObject)}\n }\n `,\n },\n ]);\n return newContents;\n }\n } else {\n // build already exists\n // it will be the return statement which lives\n // at the buildExistsExpressionIndex\n\n return (\n transformCurrentBuildObject(\n buildExistsExpressionIndex,\n returnStatements,\n appFileContent,\n buildConfigObject\n ) ?? appFileContent\n );\n }\n}\n\nfunction handlePluginNode(\n appFileContent: string,\n dtsPlugin: string,\n dtsImportLine: string,\n pluginOption: string\n): string | undefined {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n\n const file = tsquery.ast(appFileContent);\n const pluginsNode = tsquery.query(\n file,\n 'PropertyAssignment:has(Identifier[name=\"plugins\"])'\n );\n\n let writeFile = false;\n\n if (pluginsNode.length) {\n appFileContent = tsquery.replace(\n file.getText(),\n 'PropertyAssignment:has(Identifier[name=\"plugins\"])',\n (node: Node) => {\n const found = tsquery.query(node, 'ArrayLiteralExpression');\n return `plugins: [\n ...${found?.[0].getText()},\n ${dtsPlugin}\n ]`;\n }\n );\n writeFile = true;\n } else {\n // Plugins node does not exist yet\n // So make one from scratch\n\n const foundDefineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n // We are NOT transforming the conditional config\n // with plugins\n writeFile = false;\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: pluginOption,\n },\n ]);\n writeFile = true;\n } else {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: pluginOption,\n },\n ]);\n writeFile = true;\n }\n }\n } else {\n // Plugins option does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(file, 'ExportAssignment');\n const found = tsquery?.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: pluginOption,\n },\n ]);\n writeFile = true;\n } catch {\n writeFile = false;\n }\n }\n }\n\n if (writeFile) {\n if (!appFileContent.includes(`import dts from 'vite-plugin-dts'`)) {\n return dtsImportLine + '\\n' + appFileContent;\n }\n return appFileContent;\n }\n return appFileContent;\n}\n\nfunction handleCacheDirNode(appFileContent: string, cacheDir: string): string {\n const { tsquery } = require('@phenomnomnominal/tsquery');\n\n const file = tsquery.ast(appFileContent);\n const cacheDirNode = tsquery.query(\n file,\n 'PropertyAssignment:has(Identifier[name=\"cacheDir\"])'\n );\n\n if (!cacheDirNode?.length || cacheDirNode?.length === 0) {\n // cacheDir node does not exist yet\n // So make one from scratch\n\n const foundDefineConfig = tsquery.query(\n file,\n 'CallExpression:has(Identifier[name=\"defineConfig\"])'\n );\n\n if (foundDefineConfig.length) {\n const conditionalConfig = tsquery.query(\n foundDefineConfig[0],\n 'ArrowFunction'\n );\n\n if (conditionalConfig.length) {\n // We are NOT transforming the conditional config\n // with cacheDir\n } else {\n const propertyAssignments = tsquery.query(\n foundDefineConfig[0],\n 'PropertyAssignment'\n );\n\n if (propertyAssignments.length) {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: propertyAssignments[0].getStart(),\n text: cacheDir,\n },\n ]);\n } else {\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: foundDefineConfig[0].getStart() + 14,\n text: cacheDir,\n },\n ]);\n }\n }\n } else {\n // cacheDir option does not exist and defineConfig is not used\n // could also potentially be invalid syntax, so try-catch\n try {\n const defaultExport = tsquery.query(file, 'ExportAssignment');\n const found = tsquery?.query(\n defaultExport?.[0],\n 'ObjectLiteralExpression'\n );\n const startOfObject = found?.[0].getStart();\n appFileContent = applyChangesToString(appFileContent, [\n {\n type: ChangeType.Insert,\n index: startOfObject + 1,\n text: cacheDir,\n },\n ]);\n } catch {}\n }\n }\n\n return appFileContent;\n}\n"],"names":["ensureViteConfigIsCorrect","tree","path","buildConfigString","buildConfigObject","dtsPlugin","dtsImportLine","pluginOption","testConfigString","testConfigObject","cacheDir","projectAlreadyHasViteTargets","fileContent","read","updatedContent","undefined","test","length","handleBuildOrTestNode","build","handlePluginNode","handleCacheDirNode","write","updatedFileContent","configContentString","configContentObject","name","tsquery","require","buildNode","query","replace","node","found","getText","JSON","stringify","foundDefineConfig","conditionalConfig","transformConditionalConfig","propertyAssignments","applyChangesToString","type","ChangeType","Insert","index","getStart","text","defaultExport","startOfObject","transformCurrentBuildObject","returnStatements","appFileContent","currentBuildObject","currentBuildObjectStart","currentBuildObjectEnd","getEnd","newReturnObject","_node","newContents","Delete","start","SyntaxKind","functionBlock","ifStatement","binaryExpressions","buildExists","find","binaryExpression","buildExistsExpressionIndex","findIndex","serveExists","elseKeywordExists","findNodes","ElseKeyword","functionBlockStart","file","ast","pluginsNode","writeFile","includes","cacheDirNode"],"mappings":";+BAKgBA;;;eAAAA;;;wBALuC;oBAC7B;AAInB,SAASA,0BACdC,IAAU,EACVC,IAAY,EACZC,iBAAyB,EACzBC,iBAAqB,EACrBC,SAAiB,EACjBC,aAAqB,EACrBC,YAAoB,EACpBC,gBAAwB,EACxBC,gBAAoB,EACpBC,QAAgB,EAChBC,4BAA0C,EACjC;IACT,MAAMC,cAAcX,KAAKY,IAAI,CAACX,MAAM;IAEpC,IAAIY,iBAAiBC;IAErB,IAAI,C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E,EAClB;gBAEF,MAAMC,gBAAgBhB,gBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE,CAACa,QAAQ,EAAE;gBAC3CM,iBAAiBX,IAAAA,4BAAoB,EAACW,gBAAgB;oBACpD;wBACEV,MAAMC,kBAAU,CAACC,MAAM;wBACvBC,OAAOI,gBAAgB;wBACvBF,MAAMrC;oBACR;iBACD;YACH,EAAE,UAAM,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO0C;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/executors/build/schema.d.ts"],"sourcesContent":["import type { FileReplacement } from '../../plugins/rollup-replace-files.plugin';\nexport interface ViteBuildExecutorOptions {\n outputPath: string;\n emptyOutDir?: boolean;\n base?: string;\n configFile?: string;\n fileReplacements?: FileReplacement[];\n force?: boolean;\n sourcemap?: boolean | 'inline' | 'hidden';\n minify?: boolean | 'esbuild' | 'terser';\n manifest?: boolean | string;\n ssrManifest?: boolean | string;\n logLevel?: 'info' | 'warn' | 'error' | 'silent';\n mode?: string;\n ssr?: boolean | string;\n watch?: object | boolean;\n}\n"],"names":[],"mappings":"AAAA"}
|