@nx/vite 16.0.0-beta.1
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/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +63 -0
- package/executors.d.ts +8 -0
- package/executors.js +19 -0
- package/executors.js.map +1 -0
- package/executors.json +46 -0
- package/generators.json +46 -0
- package/index.d.ts +8 -0
- package/index.js +20 -0
- package/index.js.map +1 -0
- package/migrations.json +80 -0
- package/package.json +60 -0
- package/plugins/rollup-replace-files.plugin.d.ts +16 -0
- package/plugins/rollup-replace-files.plugin.js +49 -0
- package/plugins/rollup-replace-files.plugin.js.map +1 -0
- package/src/executors/build/build.impl.d.ts +10 -0
- package/src/executors/build/build.impl.js +91 -0
- package/src/executors/build/build.impl.js.map +1 -0
- package/src/executors/build/compat.d.ts +2 -0
- package/src/executors/build/compat.js +10 -0
- package/src/executors/build/compat.js.map +1 -0
- package/src/executors/build/schema.d.js +3 -0
- package/src/executors/build/schema.d.js.map +1 -0
- package/src/executors/build/schema.d.ts +17 -0
- package/src/executors/build/schema.json +143 -0
- package/src/executors/dev-server/compat.d.ts +2 -0
- package/src/executors/dev-server/compat.js +10 -0
- package/src/executors/dev-server/compat.js.map +1 -0
- package/src/executors/dev-server/dev-server.impl.d.ts +8 -0
- package/src/executors/dev-server/dev-server.impl.js +68 -0
- package/src/executors/dev-server/dev-server.impl.js.map +1 -0
- package/src/executors/dev-server/schema.d.js +3 -0
- package/src/executors/dev-server/schema.d.js.map +1 -0
- package/src/executors/dev-server/schema.d.ts +14 -0
- package/src/executors/dev-server/schema.json +89 -0
- package/src/executors/preview-server/compat.d.ts +2 -0
- package/src/executors/preview-server/compat.js +10 -0
- package/src/executors/preview-server/compat.js.map +1 -0
- package/src/executors/preview-server/preview-server.impl.d.ts +7 -0
- package/src/executors/preview-server/preview-server.impl.js +107 -0
- package/src/executors/preview-server/preview-server.impl.js.map +1 -0
- package/src/executors/preview-server/schema.d.js +3 -0
- package/src/executors/preview-server/schema.d.js.map +1 -0
- package/src/executors/preview-server/schema.d.ts +12 -0
- package/src/executors/preview-server/schema.json +80 -0
- package/src/executors/test/compat.d.ts +2 -0
- package/src/executors/test/compat.js +10 -0
- package/src/executors/test/compat.js.map +1 -0
- package/src/executors/test/schema.d.js +3 -0
- package/src/executors/test/schema.d.js.map +1 -0
- package/src/executors/test/schema.d.ts +11 -0
- package/src/executors/test/schema.json +63 -0
- package/src/executors/test/vitest.impl.d.ts +6 -0
- package/src/executors/test/vitest.impl.js +130 -0
- package/src/executors/test/vitest.impl.js.map +1 -0
- package/src/generators/configuration/configuration.d.ts +5 -0
- package/src/generators/configuration/configuration.js +130 -0
- package/src/generators/configuration/configuration.js.map +1 -0
- package/src/generators/configuration/schema.d.js +3 -0
- package/src/generators/configuration/schema.d.js.map +1 -0
- package/src/generators/configuration/schema.d.ts +12 -0
- package/src/generators/configuration/schema.json +61 -0
- package/src/generators/init/init.d.ts +6 -0
- package/src/generators/init/init.js +84 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.js +3 -0
- package/src/generators/init/schema.d.js.map +1 -0
- package/src/generators/init/schema.d.ts +4 -0
- package/src/generators/init/schema.json +22 -0
- package/src/generators/vitest/files/tsconfig.spec.json__tmpl__ +19 -0
- package/src/generators/vitest/schema.d.js +3 -0
- package/src/generators/vitest/schema.d.js.map +1 -0
- package/src/generators/vitest/schema.d.ts +9 -0
- package/src/generators/vitest/schema.json +49 -0
- package/src/generators/vitest/vitest-generator.d.ts +5 -0
- package/src/generators/vitest/vitest-generator.js +99 -0
- package/src/generators/vitest/vitest-generator.js.map +1 -0
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.d.ts +3 -0
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js +63 -0
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js.map +1 -0
- package/src/migrations/update-15-3-4/set-mode-in-configuration.d.ts +3 -0
- package/src/migrations/update-15-3-4/set-mode-in-configuration.js +33 -0
- package/src/migrations/update-15-3-4/set-mode-in-configuration.js.map +1 -0
- package/src/migrations/update-15-4-3/update-report-directory.d.ts +3 -0
- package/src/migrations/update-15-4-3/update-report-directory.js +35 -0
- package/src/migrations/update-15-4-3/update-report-directory.js.map +1 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/utils/generator-utils.d.ts +34 -0
- package/src/utils/generator-utils.js +567 -0
- package/src/utils/generator-utils.js.map +1 -0
- package/src/utils/options-utils.d.ts +32 -0
- package/src/utils/options-utils.js +113 -0
- package/src/utils/options-utils.js.map +1 -0
- package/src/utils/test-files/angular-project.config.json +89 -0
- package/src/utils/test-files/react-lib-non-buildable-jest.json +25 -0
- package/src/utils/test-files/react-lib-non-buildable-vitest.json +25 -0
- package/src/utils/test-files/react-mixed-project.config.json +52 -0
- package/src/utils/test-files/react-project.config.json +85 -0
- package/src/utils/test-files/react-vite-project.config.json +57 -0
- package/src/utils/test-files/test-vite-configs.d.ts +32 -0
- package/src/utils/test-files/test-vite-configs.js +285 -0
- package/src/utils/test-files/test-vite-configs.js.map +1 -0
- package/src/utils/test-files/unknown-project.config.json +72 -0
- package/src/utils/test-files/web-project.config.json +72 -0
- package/src/utils/test-utils.d.ts +9 -0
- package/src/utils/test-utils.js +516 -0
- package/src/utils/test-utils.js.map +1 -0
- package/src/utils/versions.d.ts +13 -0
- package/src/utils/versions.js +37 -0
- package/src/utils/versions.js.map +1 -0
- package/src/utils/vite-config-edit-utils.d.ts +3 -0
- package/src/utils/vite-config-edit-utils.js +286 -0
- package/src/utils/vite-config-edit-utils.js.map +1 -0
|
@@ -0,0 +1,516 @@
|
|
|
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
|
+
mockViteReactAppGenerator: ()=>mockViteReactAppGenerator,
|
|
10
|
+
mockReactAppGenerator: ()=>mockReactAppGenerator,
|
|
11
|
+
mockReactMixedAppGenerator: ()=>mockReactMixedAppGenerator,
|
|
12
|
+
mockWebAppGenerator: ()=>mockWebAppGenerator,
|
|
13
|
+
mockAngularAppGenerator: ()=>mockAngularAppGenerator,
|
|
14
|
+
mockUnknownAppGenerator: ()=>mockUnknownAppGenerator,
|
|
15
|
+
mockReactLibNonBuildableJestTestRunnerGenerator: ()=>mockReactLibNonBuildableJestTestRunnerGenerator,
|
|
16
|
+
mockReactLibNonBuildableVitestRunnerGenerator: ()=>mockReactLibNonBuildableVitestRunnerGenerator
|
|
17
|
+
});
|
|
18
|
+
const _extends = require("@swc/helpers/lib/_extends.js").default;
|
|
19
|
+
const _devkit = require("@nx/devkit");
|
|
20
|
+
const _reactProjectConfigJson = require("./test-files/react-project.config.json");
|
|
21
|
+
const _reactViteProjectConfigJson = require("./test-files/react-vite-project.config.json");
|
|
22
|
+
const _webProjectConfigJson = require("./test-files/web-project.config.json");
|
|
23
|
+
const _angularProjectConfigJson = require("./test-files/angular-project.config.json");
|
|
24
|
+
const _unknownProjectConfigJson = require("./test-files/unknown-project.config.json");
|
|
25
|
+
const _reactMixedProjectConfigJson = require("./test-files/react-mixed-project.config.json");
|
|
26
|
+
const _reactLibNonBuildableJestJson = require("./test-files/react-lib-non-buildable-jest.json");
|
|
27
|
+
const _reactLibNonBuildableVitestJson = require("./test-files/react-lib-non-buildable-vitest.json");
|
|
28
|
+
function mockViteReactAppGenerator(tree) {
|
|
29
|
+
const appName = 'my-test-react-vite-app';
|
|
30
|
+
tree.write(`apps/${appName}/src/main.tsx`, `import ReactDOM from 'react-dom';\n`);
|
|
31
|
+
tree.write(`apps/${appName}/tsconfig.json`, `{
|
|
32
|
+
"compilerOptions": {
|
|
33
|
+
"jsx": "react-jsx",
|
|
34
|
+
"allowJs": false,
|
|
35
|
+
"esModuleInterop": false,
|
|
36
|
+
"allowSyntheticDefaultImports": true,
|
|
37
|
+
"strict": true,
|
|
38
|
+
"types": ["vite/client"]
|
|
39
|
+
},
|
|
40
|
+
"files": [],
|
|
41
|
+
"include": [],
|
|
42
|
+
"references": [
|
|
43
|
+
{
|
|
44
|
+
"path": "./tsconfig.app.json"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"path": "./tsconfig.spec.json"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"extends": "../../tsconfig.base.json"
|
|
51
|
+
}
|
|
52
|
+
`);
|
|
53
|
+
tree.write(`apps/${appName}/tsconfig.app.json`, `{
|
|
54
|
+
"extends": "./tsconfig.json",
|
|
55
|
+
"compilerOptions": {
|
|
56
|
+
"outDir": "../../dist/out-tsc",
|
|
57
|
+
"types": ["node"]
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
61
|
+
"../../node_modules/@nrwl/react/typings/image.d.ts"
|
|
62
|
+
],
|
|
63
|
+
"exclude": [
|
|
64
|
+
"src/**/*.spec.ts",
|
|
65
|
+
"src/**/*.test.ts",
|
|
66
|
+
"src/**/*.spec.tsx",
|
|
67
|
+
"src/**/*.test.tsx",
|
|
68
|
+
"src/**/*.spec.js",
|
|
69
|
+
"src/**/*.test.js",
|
|
70
|
+
"src/**/*.spec.jsx",
|
|
71
|
+
"src/**/*.test.jsx"
|
|
72
|
+
],
|
|
73
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
74
|
+
}
|
|
75
|
+
`);
|
|
76
|
+
tree.write(`apps/${appName}/index.html`, `<!DOCTYPE html>
|
|
77
|
+
<html lang="en">
|
|
78
|
+
<head>
|
|
79
|
+
<meta charset="utf-8" />
|
|
80
|
+
<title>Rv1</title>
|
|
81
|
+
<base href="/" />
|
|
82
|
+
|
|
83
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
84
|
+
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
85
|
+
<link rel="stylesheet" href="/src/styles.css" />
|
|
86
|
+
</head>
|
|
87
|
+
<body>
|
|
88
|
+
<div id="root"></div>
|
|
89
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
90
|
+
</body>
|
|
91
|
+
</html>`);
|
|
92
|
+
tree.write(`apps/${appName}/vite.config.ts`, ` /// <reference types="vitest" />
|
|
93
|
+
import { defineConfig } from 'vite';
|
|
94
|
+
import react from '@vitejs/plugin-react';
|
|
95
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
96
|
+
|
|
97
|
+
export default defineConfig({
|
|
98
|
+
server: {
|
|
99
|
+
port: 4200,
|
|
100
|
+
host: 'localhost',
|
|
101
|
+
},
|
|
102
|
+
plugins: [
|
|
103
|
+
react(),
|
|
104
|
+
tsconfigPaths({
|
|
105
|
+
root: '../../',
|
|
106
|
+
projects: ['tsconfig.base.json'],
|
|
107
|
+
}),
|
|
108
|
+
],
|
|
109
|
+
|
|
110
|
+
test: {
|
|
111
|
+
globals: true,
|
|
112
|
+
cache: {
|
|
113
|
+
dir: '../../node_modules/.vitest',
|
|
114
|
+
},
|
|
115
|
+
environment: 'jsdom',
|
|
116
|
+
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
`);
|
|
120
|
+
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
121
|
+
projects: {
|
|
122
|
+
'my-test-react-vite-app': _extends({}, _reactViteProjectConfigJson, {
|
|
123
|
+
root: `apps/${appName}`,
|
|
124
|
+
projectType: 'application'
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({}, _reactViteProjectConfigJson, {
|
|
129
|
+
root: `apps/${appName}`,
|
|
130
|
+
projectType: 'application'
|
|
131
|
+
}));
|
|
132
|
+
return tree;
|
|
133
|
+
}
|
|
134
|
+
function mockReactAppGenerator(tree) {
|
|
135
|
+
const appName = 'my-test-react-app';
|
|
136
|
+
tree.write(`apps/${appName}/src/main.tsx`, `import ReactDOM from 'react-dom';\n`);
|
|
137
|
+
tree.write(`apps/${appName}/tsconfig.json`, `{
|
|
138
|
+
"extends": "../../tsconfig.base.json",
|
|
139
|
+
"compilerOptions": {
|
|
140
|
+
"jsx": "react-jsx",
|
|
141
|
+
"allowJs": true,
|
|
142
|
+
"esModuleInterop": true,
|
|
143
|
+
"allowSyntheticDefaultImports": true,
|
|
144
|
+
"forceConsistentCasingInFileNames": true,
|
|
145
|
+
"strict": true,
|
|
146
|
+
"noImplicitOverride": true,
|
|
147
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
148
|
+
"noImplicitReturns": true,
|
|
149
|
+
"noFallthroughCasesInSwitch": true
|
|
150
|
+
},
|
|
151
|
+
"files": [],
|
|
152
|
+
"include": [],
|
|
153
|
+
"references": [
|
|
154
|
+
{
|
|
155
|
+
"path": "./tsconfig.app.json"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"path": "./tsconfig.spec.json"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
`);
|
|
163
|
+
tree.write(`apps/${appName}/tsconfig.app.json`, `{
|
|
164
|
+
"extends": "./tsconfig.json",
|
|
165
|
+
"compilerOptions": {
|
|
166
|
+
"outDir": "../../dist/out-tsc"
|
|
167
|
+
},
|
|
168
|
+
"files": [
|
|
169
|
+
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
170
|
+
"../../node_modules/@nrwl/react/typings/image.d.ts"
|
|
171
|
+
],
|
|
172
|
+
"exclude": [
|
|
173
|
+
"jest.config.ts",
|
|
174
|
+
"**/*.spec.ts",
|
|
175
|
+
"**/*.test.ts",
|
|
176
|
+
"**/*.spec.tsx",
|
|
177
|
+
"**/*.test.tsx",
|
|
178
|
+
"**/*.spec.js",
|
|
179
|
+
"**/*.test.js",
|
|
180
|
+
"**/*.spec.jsx",
|
|
181
|
+
"**/*.test.jsx"
|
|
182
|
+
],
|
|
183
|
+
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
184
|
+
}
|
|
185
|
+
`);
|
|
186
|
+
tree.write(`apps/${appName}/src/index.html`, `<!DOCTYPE html>
|
|
187
|
+
<html lang="en">
|
|
188
|
+
<head>
|
|
189
|
+
<meta charset="utf-8" />
|
|
190
|
+
<title>My Test React App</title>
|
|
191
|
+
<base href="/" />
|
|
192
|
+
|
|
193
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
194
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
195
|
+
</head>
|
|
196
|
+
<body>
|
|
197
|
+
<div id="root"></div>
|
|
198
|
+
</body>
|
|
199
|
+
</html>`);
|
|
200
|
+
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
201
|
+
projects: {
|
|
202
|
+
'my-test-react-app': _extends({}, _reactProjectConfigJson, {
|
|
203
|
+
root: `apps/${appName}`,
|
|
204
|
+
projectType: 'application'
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({}, _reactProjectConfigJson, {
|
|
209
|
+
root: `apps/${appName}`,
|
|
210
|
+
projectType: 'application'
|
|
211
|
+
}));
|
|
212
|
+
return tree;
|
|
213
|
+
}
|
|
214
|
+
function mockReactMixedAppGenerator(tree) {
|
|
215
|
+
const appName = 'my-test-mixed-react-app';
|
|
216
|
+
tree.write(`apps/${appName}/src/main.tsx`, `import ReactDOM from 'react-dom';\n`);
|
|
217
|
+
tree.write(`apps/${appName}/tsconfig.json`, `{
|
|
218
|
+
"extends": "../../tsconfig.base.json",
|
|
219
|
+
"compilerOptions": {
|
|
220
|
+
"jsx": "react-jsx",
|
|
221
|
+
"allowJs": true,
|
|
222
|
+
"esModuleInterop": true,
|
|
223
|
+
"allowSyntheticDefaultImports": true,
|
|
224
|
+
"forceConsistentCasingInFileNames": true,
|
|
225
|
+
"strict": true,
|
|
226
|
+
"noImplicitOverride": true,
|
|
227
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
228
|
+
"noImplicitReturns": true,
|
|
229
|
+
"noFallthroughCasesInSwitch": true
|
|
230
|
+
},
|
|
231
|
+
"files": [],
|
|
232
|
+
"include": [],
|
|
233
|
+
"references": [
|
|
234
|
+
{
|
|
235
|
+
"path": "./tsconfig.app.json"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"path": "./tsconfig.spec.json"
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
`);
|
|
243
|
+
tree.write(`apps/${appName}/tsconfig.app.json`, `{
|
|
244
|
+
"extends": "./tsconfig.json",
|
|
245
|
+
"compilerOptions": {
|
|
246
|
+
"outDir": "../../dist/out-tsc"
|
|
247
|
+
},
|
|
248
|
+
"files": [
|
|
249
|
+
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
250
|
+
"../../node_modules/@nrwl/react/typings/image.d.ts"
|
|
251
|
+
],
|
|
252
|
+
"exclude": [
|
|
253
|
+
"jest.config.ts",
|
|
254
|
+
"**/*.spec.ts",
|
|
255
|
+
"**/*.test.ts",
|
|
256
|
+
"**/*.spec.tsx",
|
|
257
|
+
"**/*.test.tsx",
|
|
258
|
+
"**/*.spec.js",
|
|
259
|
+
"**/*.test.js",
|
|
260
|
+
"**/*.spec.jsx",
|
|
261
|
+
"**/*.test.jsx"
|
|
262
|
+
],
|
|
263
|
+
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
264
|
+
}
|
|
265
|
+
`);
|
|
266
|
+
tree.write(`apps/${appName}/src/index.html`, `<!DOCTYPE html>
|
|
267
|
+
<html lang="en">
|
|
268
|
+
<head>
|
|
269
|
+
<meta charset="utf-8" />
|
|
270
|
+
<title>My Test React App</title>
|
|
271
|
+
<base href="/" />
|
|
272
|
+
|
|
273
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
274
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
275
|
+
</head>
|
|
276
|
+
<body>
|
|
277
|
+
<div id="root"></div>
|
|
278
|
+
</body>
|
|
279
|
+
</html>`);
|
|
280
|
+
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
281
|
+
projects: {
|
|
282
|
+
'my-test-mixed-react-app': _extends({}, _reactMixedProjectConfigJson, {
|
|
283
|
+
root: `apps/${appName}`,
|
|
284
|
+
projectType: 'application'
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({}, _reactMixedProjectConfigJson, {
|
|
289
|
+
root: `apps/${appName}`,
|
|
290
|
+
projectType: 'application'
|
|
291
|
+
}));
|
|
292
|
+
return tree;
|
|
293
|
+
}
|
|
294
|
+
function mockWebAppGenerator(tree) {
|
|
295
|
+
const appName = 'my-test-web-app';
|
|
296
|
+
tree.write(`apps/${appName}/src/main.ts`, `import './app/app.element.ts';`);
|
|
297
|
+
tree.write(`apps/${appName}/tsconfig.json`, `{
|
|
298
|
+
"extends": "../../tsconfig.base.json",
|
|
299
|
+
"files": [],
|
|
300
|
+
"include": [],
|
|
301
|
+
"references": [
|
|
302
|
+
{
|
|
303
|
+
"path": "./tsconfig.app.json"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"path": "./tsconfig.spec.json"
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
`);
|
|
311
|
+
tree.write(`apps/${appName}/src/index.html`, `<!DOCTYPE html>
|
|
312
|
+
<html lang="en">
|
|
313
|
+
<head>
|
|
314
|
+
<meta charset="utf-8" />
|
|
315
|
+
<title>WebappPure</title>
|
|
316
|
+
<base href="/" />
|
|
317
|
+
|
|
318
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
319
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
320
|
+
</head>
|
|
321
|
+
<body>
|
|
322
|
+
<workspace-root></workspace-root>
|
|
323
|
+
</body>
|
|
324
|
+
</html>
|
|
325
|
+
`);
|
|
326
|
+
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
327
|
+
projects: {
|
|
328
|
+
'my-test-web-app': _extends({}, _webProjectConfigJson, {
|
|
329
|
+
root: `apps/${appName}`,
|
|
330
|
+
projectType: 'application'
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({}, _webProjectConfigJson, {
|
|
335
|
+
root: `apps/${appName}`,
|
|
336
|
+
projectType: 'application'
|
|
337
|
+
}));
|
|
338
|
+
return tree;
|
|
339
|
+
}
|
|
340
|
+
function mockAngularAppGenerator(tree) {
|
|
341
|
+
const appName = 'my-test-angular-app';
|
|
342
|
+
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
343
|
+
projects: {
|
|
344
|
+
'my-test-angular-app': _extends({}, _angularProjectConfigJson, {
|
|
345
|
+
root: `apps/${appName}`,
|
|
346
|
+
projectType: 'application'
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({}, _angularProjectConfigJson, {
|
|
351
|
+
root: `apps/${appName}`,
|
|
352
|
+
projectType: 'application'
|
|
353
|
+
}));
|
|
354
|
+
return tree;
|
|
355
|
+
}
|
|
356
|
+
function mockUnknownAppGenerator(tree) {
|
|
357
|
+
const appName = 'my-test-random-app';
|
|
358
|
+
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
359
|
+
projects: {
|
|
360
|
+
'my-test-random-app': _extends({}, _unknownProjectConfigJson, {
|
|
361
|
+
root: `apps/${appName}`,
|
|
362
|
+
projectType: 'application'
|
|
363
|
+
})
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
(0, _devkit.writeJson)(tree, `apps/${appName}/project.json`, _extends({}, _unknownProjectConfigJson, {
|
|
367
|
+
root: `apps/${appName}`,
|
|
368
|
+
projectType: 'application'
|
|
369
|
+
}));
|
|
370
|
+
return tree;
|
|
371
|
+
}
|
|
372
|
+
function mockReactLibNonBuildableJestTestRunnerGenerator(tree) {
|
|
373
|
+
const libName = 'react-lib-nonb-jest';
|
|
374
|
+
tree.write(`libs/${libName}/src/index.ts`, ``);
|
|
375
|
+
tree.write(`libs/${libName}/tsconfig.json`, `{
|
|
376
|
+
"compilerOptions": {
|
|
377
|
+
"jsx": "react-jsx",
|
|
378
|
+
"allowJs": false,
|
|
379
|
+
"esModuleInterop": false,
|
|
380
|
+
"allowSyntheticDefaultImports": true,
|
|
381
|
+
"strict": true
|
|
382
|
+
},
|
|
383
|
+
"files": [],
|
|
384
|
+
"include": [],
|
|
385
|
+
"references": [
|
|
386
|
+
{
|
|
387
|
+
"path": "./tsconfig.lib.json"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"path": "./tsconfig.spec.json"
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
"extends": "../../tsconfig.base.json"
|
|
394
|
+
}`);
|
|
395
|
+
tree.write(`libs/${libName}/tsconfig.lib.json`, `{
|
|
396
|
+
"extends": "./tsconfig.json",
|
|
397
|
+
"compilerOptions": {
|
|
398
|
+
"outDir": "../../dist/out-tsc",
|
|
399
|
+
"types": ["node"]
|
|
400
|
+
},
|
|
401
|
+
"files": [
|
|
402
|
+
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
403
|
+
"../../node_modules/@nrwl/react/typings/image.d.ts"
|
|
404
|
+
],
|
|
405
|
+
"exclude": [
|
|
406
|
+
"jest.config.ts",
|
|
407
|
+
"src/**/*.spec.ts",
|
|
408
|
+
"src/**/*.test.ts",
|
|
409
|
+
"src/**/*.spec.tsx",
|
|
410
|
+
"src/**/*.test.tsx",
|
|
411
|
+
"src/**/*.spec.js",
|
|
412
|
+
"src/**/*.test.js",
|
|
413
|
+
"src/**/*.spec.jsx",
|
|
414
|
+
"src/**/*.test.jsx"
|
|
415
|
+
],
|
|
416
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
417
|
+
}`);
|
|
418
|
+
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
419
|
+
projects: {
|
|
420
|
+
[`${libName}`]: _extends({}, _reactLibNonBuildableJestJson, {
|
|
421
|
+
root: `libs/${libName}`,
|
|
422
|
+
projectType: 'library'
|
|
423
|
+
})
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
(0, _devkit.writeJson)(tree, `libs/${libName}/project.json`, _extends({}, _reactLibNonBuildableJestJson, {
|
|
427
|
+
root: `libs/${libName}`,
|
|
428
|
+
projectType: 'library'
|
|
429
|
+
}));
|
|
430
|
+
return tree;
|
|
431
|
+
}
|
|
432
|
+
function mockReactLibNonBuildableVitestRunnerGenerator(tree) {
|
|
433
|
+
const libName = 'react-lib-nonb-vitest';
|
|
434
|
+
tree.write(`libs/${libName}/src/index.ts`, ``);
|
|
435
|
+
tree.write(`libs/${libName}/vite.config.ts`, `/// <reference types="vitest" />
|
|
436
|
+
import { defineConfig } from 'vite';
|
|
437
|
+
import react from '@vitejs/plugin-react';
|
|
438
|
+
import viteTsConfigPaths from 'vite-tsconfig-paths';
|
|
439
|
+
|
|
440
|
+
export default defineConfig({
|
|
441
|
+
|
|
442
|
+
plugins: [
|
|
443
|
+
react(),
|
|
444
|
+
viteTsConfigPaths({
|
|
445
|
+
root: '../../',
|
|
446
|
+
}),
|
|
447
|
+
],
|
|
448
|
+
|
|
449
|
+
test: {
|
|
450
|
+
globals: true,
|
|
451
|
+
cache: {
|
|
452
|
+
dir: '../../node_modules/.vitest',
|
|
453
|
+
},
|
|
454
|
+
environment: 'jsdom',
|
|
455
|
+
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
`);
|
|
459
|
+
tree.write(`libs/${libName}/tsconfig.json`, `{
|
|
460
|
+
"compilerOptions": {
|
|
461
|
+
"jsx": "react-jsx",
|
|
462
|
+
"allowJs": false,
|
|
463
|
+
"esModuleInterop": false,
|
|
464
|
+
"allowSyntheticDefaultImports": true,
|
|
465
|
+
"strict": true
|
|
466
|
+
},
|
|
467
|
+
"files": [],
|
|
468
|
+
"include": [],
|
|
469
|
+
"references": [
|
|
470
|
+
{
|
|
471
|
+
"path": "./tsconfig.lib.json"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"path": "./tsconfig.spec.json"
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
"extends": "../../tsconfig.base.json"
|
|
478
|
+
}`);
|
|
479
|
+
tree.write(`libs/${libName}/tsconfig.lib.json`, `{
|
|
480
|
+
"extends": "./tsconfig.json",
|
|
481
|
+
"compilerOptions": {
|
|
482
|
+
"outDir": "../../dist/out-tsc",
|
|
483
|
+
"types": ["node"]
|
|
484
|
+
},
|
|
485
|
+
"files": [
|
|
486
|
+
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
487
|
+
"../../node_modules/@nrwl/react/typings/image.d.ts"
|
|
488
|
+
],
|
|
489
|
+
"exclude": [
|
|
490
|
+
"**/*.spec.ts",
|
|
491
|
+
"**/*.test.ts",
|
|
492
|
+
"**/*.spec.tsx",
|
|
493
|
+
"**/*.test.tsx",
|
|
494
|
+
"**/*.spec.js",
|
|
495
|
+
"**/*.test.js",
|
|
496
|
+
"**/*.spec.jsx",
|
|
497
|
+
"**/*.test.jsx"
|
|
498
|
+
],
|
|
499
|
+
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
500
|
+
}`);
|
|
501
|
+
(0, _devkit.writeJson)(tree, 'workspace.json', {
|
|
502
|
+
projects: {
|
|
503
|
+
[`${libName}`]: _extends({}, _reactLibNonBuildableVitestJson, {
|
|
504
|
+
root: `libs/${libName}`,
|
|
505
|
+
projectType: 'library'
|
|
506
|
+
})
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
(0, _devkit.writeJson)(tree, `libs/${libName}/project.json`, _extends({}, _reactLibNonBuildableVitestJson, {
|
|
510
|
+
root: `libs/${libName}`,
|
|
511
|
+
projectType: 'library'
|
|
512
|
+
}));
|
|
513
|
+
return tree;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
//# sourceMappingURL=test-utils.js.map
|
|
@@ -0,0 +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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Q,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const nxVersion: any;
|
|
2
|
+
export declare const viteVersion = "^4.0.1";
|
|
3
|
+
export declare const vitePluginEslintVersion = "^1.8.1";
|
|
4
|
+
export declare const vitestVersion = "^0.25.8";
|
|
5
|
+
export declare const vitestUiVersion = "^0.25.8";
|
|
6
|
+
export declare const vitePluginReactVersion = "^3.0.0";
|
|
7
|
+
export declare const vitePluginVueVersion = "^3.2.0";
|
|
8
|
+
export declare const vitePluginVueJsxVersion = "^2.1.1";
|
|
9
|
+
export declare const viteTsConfigPathsVersion = "^4.0.2";
|
|
10
|
+
export declare const jsdomVersion = "~20.0.3";
|
|
11
|
+
export declare const vitePluginDtsVersion = "~1.7.1";
|
|
12
|
+
export declare const vitestCoverageC8Version = "~0.25.8";
|
|
13
|
+
export declare const vitestCoverageIstanbulVersion = "~0.25.8";
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
nxVersion: ()=>nxVersion,
|
|
10
|
+
viteVersion: ()=>viteVersion,
|
|
11
|
+
vitePluginEslintVersion: ()=>vitePluginEslintVersion,
|
|
12
|
+
vitestVersion: ()=>vitestVersion,
|
|
13
|
+
vitestUiVersion: ()=>vitestUiVersion,
|
|
14
|
+
vitePluginReactVersion: ()=>vitePluginReactVersion,
|
|
15
|
+
vitePluginVueVersion: ()=>vitePluginVueVersion,
|
|
16
|
+
vitePluginVueJsxVersion: ()=>vitePluginVueJsxVersion,
|
|
17
|
+
viteTsConfigPathsVersion: ()=>viteTsConfigPathsVersion,
|
|
18
|
+
jsdomVersion: ()=>jsdomVersion,
|
|
19
|
+
vitePluginDtsVersion: ()=>vitePluginDtsVersion,
|
|
20
|
+
vitestCoverageC8Version: ()=>vitestCoverageC8Version,
|
|
21
|
+
vitestCoverageIstanbulVersion: ()=>vitestCoverageIstanbulVersion
|
|
22
|
+
});
|
|
23
|
+
const nxVersion = require('../../package.json').version;
|
|
24
|
+
const viteVersion = '^4.0.1';
|
|
25
|
+
const vitePluginEslintVersion = '^1.8.1';
|
|
26
|
+
const vitestVersion = '^0.25.8';
|
|
27
|
+
const vitestUiVersion = '^0.25.8';
|
|
28
|
+
const vitePluginReactVersion = '^3.0.0';
|
|
29
|
+
const vitePluginVueVersion = '^3.2.0';
|
|
30
|
+
const vitePluginVueJsxVersion = '^2.1.1';
|
|
31
|
+
const viteTsConfigPathsVersion = '^4.0.2';
|
|
32
|
+
const jsdomVersion = '~20.0.3';
|
|
33
|
+
const vitePluginDtsVersion = '~1.7.1';
|
|
34
|
+
const vitestCoverageC8Version = '~0.25.8';
|
|
35
|
+
const vitestCoverageIstanbulVersion = '~0.25.8';
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=versions.js.map
|
|
@@ -0,0 +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":"AAAA;;;;;;;;IAAaA,SAAS,MAATA;IACAC,WAAW,MAAXA;IACAC,uBAAuB,MAAvBA;IACAC,aAAa,MAAbA;IACAC,eAAe,MAAfA;IACAC,sBAAsB,MAAtBA;IACAC,oBAAoB,MAApBA;IACAC,uBAAuB,MAAvBA;IACAC,wBAAwB,MAAxBA;IACAC,YAAY,MAAZA;IACAC,oBAAoB,MAApBA;IAGAC,uBAAuB,MAAvBA;IACAC,6BAA6B,MAA7BA;;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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { TargetFlags } from './generator-utils';
|
|
3
|
+
export declare function ensureViteConfigIsCorrect(tree: Tree, path: string, buildConfigString: string, buildConfigObject: {}, dtsPlugin: string, dtsImportLine: string, pluginOption: string, testConfigString: string, testConfigObject: {}, cacheDir: string, projectAlreadyHasViteTargets?: TargetFlags): boolean;
|