@nx/rspack 16.0.0-beta.0
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/README.md +81 -0
- package/executors.json +15 -0
- package/generators.json +31 -0
- package/package.json +35 -0
- package/src/executors/dev-server/dev-server.impl.d.ts +3 -0
- package/src/executors/dev-server/dev-server.impl.js +47 -0
- package/src/executors/dev-server/dev-server.impl.js.map +1 -0
- package/src/executors/dev-server/schema.d.ts +8 -0
- package/src/executors/dev-server/schema.json +23 -0
- package/src/executors/rspack/rspack.impl.d.ts +6 -0
- package/src/executors/rspack/rspack.impl.js +102 -0
- package/src/executors/rspack/rspack.impl.js.map +1 -0
- package/src/executors/rspack/schema.d.ts +15 -0
- package/src/executors/rspack/schema.json +104 -0
- package/src/generators/application/application.d.ts +3 -0
- package/src/generators/application/application.js +81 -0
- package/src/generators/application/application.js.map +1 -0
- package/src/generators/application/lib/create-ts-config.d.ts +3 -0
- package/src/generators/application/lib/create-ts-config.js +48 -0
- package/src/generators/application/lib/create-ts-config.js.map +1 -0
- package/src/generators/application/lib/normalize-options.d.ts +5 -0
- package/src/generators/application/lib/normalize-options.js +38 -0
- package/src/generators/application/lib/normalize-options.js.map +1 -0
- package/src/generators/application/schema.d.ts +16 -0
- package/src/generators/application/schema.json +97 -0
- package/src/generators/configuration/configuration.d.ts +4 -0
- package/src/generators/configuration/configuration.js +79 -0
- package/src/generators/configuration/configuration.js.map +1 -0
- package/src/generators/configuration/schema.d.ts +12 -0
- package/src/generators/configuration/schema.json +72 -0
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +37 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +8 -0
- package/src/generators/init/schema.json +24 -0
- package/src/generators/preset/preset.d.ts +3 -0
- package/src/generators/preset/preset.js +37 -0
- package/src/generators/preset/preset.js.map +1 -0
- package/src/generators/preset/schema.d.ts +18 -0
- package/src/generators/preset/schema.json +70 -0
- package/src/index.d.ts +6 -0
- package/src/index.js +10 -0
- package/src/index.js.map +1 -0
- package/src/utils/config.d.ts +3 -0
- package/src/utils/config.js +17 -0
- package/src/utils/config.js.map +1 -0
- package/src/utils/create-compiler.d.ts +4 -0
- package/src/utils/create-compiler.js +19 -0
- package/src/utils/create-compiler.js.map +1 -0
- package/src/utils/generator-utils.d.ts +34 -0
- package/src/utils/generator-utils.js +456 -0
- package/src/utils/generator-utils.js.map +1 -0
- package/src/utils/get-copy-patterns.d.ts +9 -0
- package/src/utils/get-copy-patterns.js +25 -0
- package/src/utils/get-copy-patterns.js.map +1 -0
- package/src/utils/jest-utils.d.ts +1 -0
- package/src/utils/jest-utils.js +10 -0
- package/src/utils/jest-utils.js.map +1 -0
- package/src/utils/mode-utils.d.ts +2 -0
- package/src/utils/mode-utils.js +8 -0
- package/src/utils/mode-utils.js.map +1 -0
- package/src/utils/model.d.ts +6 -0
- package/src/utils/model.js +3 -0
- package/src/utils/model.js.map +1 -0
- package/src/utils/normalize-assets.d.ts +1 -0
- package/src/utils/normalize-assets.js +41 -0
- package/src/utils/normalize-assets.js.map +1 -0
- package/src/utils/versions.d.ts +19 -0
- package/src/utils/versions.js +23 -0
- package/src/utils/versions.js.map +1 -0
- package/src/utils/with-nx.d.ts +3 -0
- package/src/utils/with-nx.js +75 -0
- package/src/utils/with-nx.js.map +1 -0
- package/src/utils/with-react.d.ts +3 -0
- package/src/utils/with-react.js +20 -0
- package/src/utils/with-react.js.map +1 -0
- package/src/utils/with-web.d.ts +9 -0
- package/src/utils/with-web.js +82 -0
- package/src/utils/with-web.js.map +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TargetConfiguration, Tree } from '@nx/devkit';
|
|
2
|
+
import { ConfigurationSchema } from '../generators/configuration/schema';
|
|
3
|
+
import { Framework } from '../generators/init/schema';
|
|
4
|
+
export type Target = 'build' | 'serve';
|
|
5
|
+
export type TargetFlags = Partial<Record<Target, boolean>>;
|
|
6
|
+
export type UserProvidedTargetName = Partial<Record<Target, string>>;
|
|
7
|
+
export type ValidFoundTargetName = Partial<Record<Target, string>>;
|
|
8
|
+
export declare function findExistingTargetsInProject(targets: {
|
|
9
|
+
[targetName: string]: TargetConfiguration;
|
|
10
|
+
}, userProvidedTargets?: UserProvidedTargetName): {
|
|
11
|
+
validFoundTargetName: ValidFoundTargetName;
|
|
12
|
+
projectContainsUnsupportedExecutor: boolean;
|
|
13
|
+
userProvidedTargetIsUnsupported: TargetFlags;
|
|
14
|
+
alreadyHasNxRspackTargets: TargetFlags;
|
|
15
|
+
};
|
|
16
|
+
export declare function addOrChangeBuildTarget(tree: Tree, options: ConfigurationSchema, target: string): void;
|
|
17
|
+
export declare function addOrChangeServeTarget(tree: Tree, options: ConfigurationSchema, target: string): void;
|
|
18
|
+
export declare function writeRspackConfigFile(tree: Tree, options: ConfigurationSchema, stylePreprocessorOptions?: {
|
|
19
|
+
includePaths?: string[];
|
|
20
|
+
}): void;
|
|
21
|
+
export declare function deleteWebpackConfig(tree: Tree, projectRoot: string, webpackConfigFilePath?: string): void;
|
|
22
|
+
export declare function moveAndEditIndexHtml(tree: Tree, options: ConfigurationSchema, buildTarget: string): void;
|
|
23
|
+
export declare function normalizeViteConfigFilePathWithTree(tree: Tree, projectRoot: string, configFile?: string): string;
|
|
24
|
+
export declare function getViteConfigPathForProject(tree: Tree, projectName: string, target?: string): string;
|
|
25
|
+
export declare function handleUnsupportedUserProvidedTargets(userProvidedTargetIsUnsupported: TargetFlags, userProvidedTargetName: UserProvidedTargetName, validFoundTargetName: ValidFoundTargetName, framework: Framework): Promise<void>;
|
|
26
|
+
export declare function handleUnknownExecutors(projectName: string): Promise<void>;
|
|
27
|
+
export declare function determineFrameworkAndTarget(tree: Tree, options: ConfigurationSchema, projectRoot: string, targets: {
|
|
28
|
+
[targetName: string]: TargetConfiguration<any>;
|
|
29
|
+
}): {
|
|
30
|
+
target: 'node' | 'web';
|
|
31
|
+
framework?: Framework;
|
|
32
|
+
};
|
|
33
|
+
export declare function determineMain(tree: Tree, options: ConfigurationSchema): string;
|
|
34
|
+
export declare function determineTsConfig(tree: Tree, options: ConfigurationSchema): string;
|
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.determineTsConfig = exports.determineMain = exports.determineFrameworkAndTarget = exports.handleUnknownExecutors = exports.handleUnsupportedUserProvidedTargets = exports.getViteConfigPathForProject = exports.normalizeViteConfigFilePathWithTree = exports.moveAndEditIndexHtml = exports.deleteWebpackConfig = exports.writeRspackConfigFile = exports.addOrChangeServeTarget = exports.addOrChangeBuildTarget = exports.findExistingTargetsInProject = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
7
|
+
function findExistingTargetsInProject(targets, userProvidedTargets) {
|
|
8
|
+
const output = {
|
|
9
|
+
validFoundTargetName: {},
|
|
10
|
+
projectContainsUnsupportedExecutor: false,
|
|
11
|
+
userProvidedTargetIsUnsupported: {},
|
|
12
|
+
alreadyHasNxRspackTargets: {},
|
|
13
|
+
};
|
|
14
|
+
const supportedExecutors = {
|
|
15
|
+
build: [
|
|
16
|
+
'@nxext/vite:build',
|
|
17
|
+
'@nrwl/webpack:webpack',
|
|
18
|
+
'@nrwl/rollup:rollup',
|
|
19
|
+
'@nrwl/web:rollup',
|
|
20
|
+
'@nrwl/vite:build',
|
|
21
|
+
'@nx/webpack:webpack',
|
|
22
|
+
'@nx/rollup:rollup',
|
|
23
|
+
'@nx/web:rollup',
|
|
24
|
+
'@nx/vite:build',
|
|
25
|
+
],
|
|
26
|
+
serve: [
|
|
27
|
+
'@nxext/vite:dev',
|
|
28
|
+
'@nrwl/webpack:dev-server',
|
|
29
|
+
'@nrwl/vite:dev-server',
|
|
30
|
+
'@nx/webpack:dev-server',
|
|
31
|
+
'@nx/vite:dev-server',
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
const unsupportedExecutors = [
|
|
35
|
+
'@nx/js:babel',
|
|
36
|
+
'@nx/js:node',
|
|
37
|
+
'@nx/js:swc',
|
|
38
|
+
'@nx/react-native:run-ios',
|
|
39
|
+
'@nx/react-native:start',
|
|
40
|
+
'@nx/react-native:run-android',
|
|
41
|
+
'@nx/react-native:bundle',
|
|
42
|
+
'@nx/react-native:build-android',
|
|
43
|
+
'@nx/react-native:bundle',
|
|
44
|
+
'@nx/next:build',
|
|
45
|
+
'@nx/next:server',
|
|
46
|
+
'@nx/js:tsc',
|
|
47
|
+
'@nx/angular:ng-packagr-lite',
|
|
48
|
+
'@nx/angular:package',
|
|
49
|
+
'@nx/angular:webpack-browser',
|
|
50
|
+
'@nx/esbuild:esbuild',
|
|
51
|
+
'@nrwl/js:babel',
|
|
52
|
+
'@nrwl/js:node',
|
|
53
|
+
'@nrwl/js:swc',
|
|
54
|
+
'@nrwl/react-native:run-ios',
|
|
55
|
+
'@nrwl/react-native:start',
|
|
56
|
+
'@nrwl/react-native:run-android',
|
|
57
|
+
'@nrwl/react-native:bundle',
|
|
58
|
+
'@nrwl/react-native:build-android',
|
|
59
|
+
'@nrwl/react-native:bundle',
|
|
60
|
+
'@nrwl/next:build',
|
|
61
|
+
'@nrwl/next:server',
|
|
62
|
+
'@nrwl/js:tsc',
|
|
63
|
+
'@nrwl/angular:ng-packagr-lite',
|
|
64
|
+
'@nrwl/angular:package',
|
|
65
|
+
'@nrwl/angular:webpack-browser',
|
|
66
|
+
'@nrwl/esbuild:esbuild',
|
|
67
|
+
'@angular-devkit/build-angular:browser',
|
|
68
|
+
'@angular-devkit/build-angular:dev-server',
|
|
69
|
+
];
|
|
70
|
+
// First, we check if the user has provided a target
|
|
71
|
+
// If they have, we check if the executor the target is using is supported
|
|
72
|
+
// If it's not supported, then we set the unsupported flag to true for that target
|
|
73
|
+
function checkUserProvidedTarget(target) {
|
|
74
|
+
var _a;
|
|
75
|
+
if (userProvidedTargets === null || userProvidedTargets === void 0 ? void 0 : userProvidedTargets[target]) {
|
|
76
|
+
if (supportedExecutors[target].includes((_a = targets[userProvidedTargets[target]]) === null || _a === void 0 ? void 0 : _a.executor)) {
|
|
77
|
+
output.validFoundTargetName[target] = userProvidedTargets[target];
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
output.userProvidedTargetIsUnsupported[target] = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
checkUserProvidedTarget('build');
|
|
85
|
+
checkUserProvidedTarget('serve');
|
|
86
|
+
// Returns early when we have a build, serve, and test targets.
|
|
87
|
+
if (output.validFoundTargetName.build && output.validFoundTargetName.serve) {
|
|
88
|
+
return output;
|
|
89
|
+
}
|
|
90
|
+
// We try to find the targets that are using the supported executors
|
|
91
|
+
// for build, serve and test, since these are the ones we will be converting
|
|
92
|
+
for (const target in targets) {
|
|
93
|
+
const executorName = targets[target].executor;
|
|
94
|
+
const hasRspackTargets = output.alreadyHasNxRspackTargets;
|
|
95
|
+
hasRspackTargets.build || (hasRspackTargets.build = executorName === '@nx/rspack:rspack');
|
|
96
|
+
hasRspackTargets.serve || (hasRspackTargets.serve = executorName === '@nx/rspack:dev-server');
|
|
97
|
+
const foundTargets = output.validFoundTargetName;
|
|
98
|
+
if (!foundTargets.build &&
|
|
99
|
+
supportedExecutors.build.includes(executorName)) {
|
|
100
|
+
foundTargets.build = target;
|
|
101
|
+
}
|
|
102
|
+
if (!foundTargets.serve &&
|
|
103
|
+
supportedExecutors.serve.includes(executorName)) {
|
|
104
|
+
foundTargets.serve = target;
|
|
105
|
+
}
|
|
106
|
+
output.projectContainsUnsupportedExecutor || (output.projectContainsUnsupportedExecutor = unsupportedExecutors.includes(executorName));
|
|
107
|
+
}
|
|
108
|
+
return output;
|
|
109
|
+
}
|
|
110
|
+
exports.findExistingTargetsInProject = findExistingTargetsInProject;
|
|
111
|
+
function addOrChangeBuildTarget(tree, options, target) {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
114
|
+
const assets = [];
|
|
115
|
+
if (options.target === 'web' &&
|
|
116
|
+
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'src/favicon.ico'))) {
|
|
117
|
+
assets.push((0, devkit_1.joinPathFragments)(project.root, 'src/favicon.ico'));
|
|
118
|
+
}
|
|
119
|
+
if (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'src/assets'))) {
|
|
120
|
+
assets.push((0, devkit_1.joinPathFragments)(project.root, 'src/assets'));
|
|
121
|
+
}
|
|
122
|
+
const buildOptions = {
|
|
123
|
+
target: (_a = options.target) !== null && _a !== void 0 ? _a : 'web',
|
|
124
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist',
|
|
125
|
+
// If standalone project then use the project's name in dist.
|
|
126
|
+
project.root === '.' ? project.name : project.root),
|
|
127
|
+
main: determineMain(tree, options),
|
|
128
|
+
tsConfig: determineTsConfig(tree, options),
|
|
129
|
+
rspackConfig: (0, devkit_1.joinPathFragments)(project.root, 'rspack.config.js'),
|
|
130
|
+
assets,
|
|
131
|
+
};
|
|
132
|
+
(_b = project.targets) !== null && _b !== void 0 ? _b : (project.targets = {});
|
|
133
|
+
project.targets[target] = {
|
|
134
|
+
executor: '@nx/rspack:rspack',
|
|
135
|
+
outputs: ['{options.outputPath}'],
|
|
136
|
+
defaultConfiguration: 'production',
|
|
137
|
+
options: buildOptions,
|
|
138
|
+
configurations: {
|
|
139
|
+
development: {
|
|
140
|
+
mode: 'development',
|
|
141
|
+
},
|
|
142
|
+
production: {
|
|
143
|
+
mode: 'production',
|
|
144
|
+
optimization: options.target === 'web' ? true : undefined,
|
|
145
|
+
sourceMap: false,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.project, project);
|
|
150
|
+
}
|
|
151
|
+
exports.addOrChangeBuildTarget = addOrChangeBuildTarget;
|
|
152
|
+
function addOrChangeServeTarget(tree, options, target) {
|
|
153
|
+
var _a;
|
|
154
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
155
|
+
(_a = project.targets) !== null && _a !== void 0 ? _a : (project.targets = {});
|
|
156
|
+
project.targets[target] = {
|
|
157
|
+
executor: '@nx/rspack:dev-server',
|
|
158
|
+
options: {
|
|
159
|
+
buildTarget: `${options.project}:build:development`,
|
|
160
|
+
},
|
|
161
|
+
configurations: {
|
|
162
|
+
development: {},
|
|
163
|
+
production: {
|
|
164
|
+
buildTarget: `${options.project}:build:production`,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.project, project);
|
|
169
|
+
}
|
|
170
|
+
exports.addOrChangeServeTarget = addOrChangeServeTarget;
|
|
171
|
+
function writeRspackConfigFile(tree, options, stylePreprocessorOptions) {
|
|
172
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
173
|
+
tree.write((0, devkit_1.joinPathFragments)(project.root, 'rspack.config.js'), createConfig(options, stylePreprocessorOptions));
|
|
174
|
+
}
|
|
175
|
+
exports.writeRspackConfigFile = writeRspackConfigFile;
|
|
176
|
+
function createConfig(options, stylePreprocessorOptions) {
|
|
177
|
+
if (options.framework === 'react') {
|
|
178
|
+
return `
|
|
179
|
+
const { composePlugins, withNx, withReact } = require('@nx/rspack');
|
|
180
|
+
|
|
181
|
+
module.exports = composePlugins(withNx(), withReact(${stylePreprocessorOptions
|
|
182
|
+
? `
|
|
183
|
+
{
|
|
184
|
+
stylePreprocessorOptions: ${JSON.stringify(stylePreprocessorOptions)},
|
|
185
|
+
}
|
|
186
|
+
`
|
|
187
|
+
: ''}), (config) => {
|
|
188
|
+
return config;
|
|
189
|
+
});
|
|
190
|
+
`;
|
|
191
|
+
}
|
|
192
|
+
else if (options.framework === 'web' || options.target === 'web') {
|
|
193
|
+
return `
|
|
194
|
+
const { composePlugins, withNx, withWeb } = require('@nx/rspack');
|
|
195
|
+
|
|
196
|
+
module.exports = composePlugins(withNx(), withWeb(${stylePreprocessorOptions
|
|
197
|
+
? `
|
|
198
|
+
{
|
|
199
|
+
stylePreprocessorOptions: ${JSON.stringify(stylePreprocessorOptions)},
|
|
200
|
+
}
|
|
201
|
+
`
|
|
202
|
+
: ''}), (config) => {
|
|
203
|
+
return config;
|
|
204
|
+
});
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
else if (options.framework === 'nest') {
|
|
208
|
+
return `
|
|
209
|
+
const { composePlugins, withNx } = require('@nx/rspack');
|
|
210
|
+
|
|
211
|
+
module.exports = composePlugins(withNx(), (config) => {
|
|
212
|
+
return config;
|
|
213
|
+
});
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
return `
|
|
218
|
+
const { composePlugins, withNx${stylePreprocessorOptions ? ', withWeb' : ''} } = require('@nx/rspack');
|
|
219
|
+
|
|
220
|
+
module.exports = composePlugins(withNx()${stylePreprocessorOptions
|
|
221
|
+
? `,
|
|
222
|
+
withWeb({
|
|
223
|
+
stylePreprocessorOptions: ${JSON.stringify(stylePreprocessorOptions)},
|
|
224
|
+
})`
|
|
225
|
+
: ''}, (config) => {
|
|
226
|
+
return config;
|
|
227
|
+
});
|
|
228
|
+
`;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
function deleteWebpackConfig(tree, projectRoot, webpackConfigFilePath) {
|
|
232
|
+
const webpackConfigPath = webpackConfigFilePath && tree.exists(webpackConfigFilePath)
|
|
233
|
+
? webpackConfigFilePath
|
|
234
|
+
: tree.exists(`${projectRoot}/webpack.config.js`)
|
|
235
|
+
? `${projectRoot}/webpack.config.js`
|
|
236
|
+
: tree.exists(`${projectRoot}/webpack.config.ts`)
|
|
237
|
+
? `${projectRoot}/webpack.config.ts`
|
|
238
|
+
: null;
|
|
239
|
+
if (webpackConfigPath) {
|
|
240
|
+
tree.delete(webpackConfigPath);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
exports.deleteWebpackConfig = deleteWebpackConfig;
|
|
244
|
+
// Maybe add delete vite config?
|
|
245
|
+
function moveAndEditIndexHtml(tree, options, buildTarget) {
|
|
246
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
247
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
248
|
+
let indexHtmlPath = (_d = (_c = (_b = (_a = projectConfig.targets) === null || _a === void 0 ? void 0 : _a[buildTarget]) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.index) !== null && _d !== void 0 ? _d : `${projectConfig.root}/src/index.html`;
|
|
249
|
+
let mainPath = (_h = (_g = (_f = (_e = projectConfig.targets) === null || _e === void 0 ? void 0 : _e[buildTarget]) === null || _f === void 0 ? void 0 : _f.options) === null || _g === void 0 ? void 0 : _g.main) !== null && _h !== void 0 ? _h : `${projectConfig.root}/src/main.ts${options.framework === 'react' ? 'x' : ''}`;
|
|
250
|
+
if (projectConfig.root !== '.') {
|
|
251
|
+
mainPath = mainPath.replace(projectConfig.root, '');
|
|
252
|
+
}
|
|
253
|
+
if (!tree.exists(indexHtmlPath) &&
|
|
254
|
+
tree.exists(`${projectConfig.root}/index.html`)) {
|
|
255
|
+
indexHtmlPath = `${projectConfig.root}/index.html`;
|
|
256
|
+
}
|
|
257
|
+
if (tree.exists(indexHtmlPath)) {
|
|
258
|
+
const indexHtmlContent = tree.read(indexHtmlPath, 'utf8');
|
|
259
|
+
if (!indexHtmlContent.includes(`<script type="module" src="${mainPath}"></script>`)) {
|
|
260
|
+
tree.write(`${projectConfig.root}/index.html`, indexHtmlContent.replace('</body>', `<script type="module" src="${mainPath}"></script>
|
|
261
|
+
</body>`));
|
|
262
|
+
if (tree.exists(`${projectConfig.root}/src/index.html`)) {
|
|
263
|
+
tree.delete(`${projectConfig.root}/src/index.html`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
tree.write(`${projectConfig.root}/index.html`, `<!DOCTYPE html>
|
|
269
|
+
<html lang="en">
|
|
270
|
+
<head>
|
|
271
|
+
<meta charset="UTF-8" />
|
|
272
|
+
<link rel="icon" href="/favicon.ico" />
|
|
273
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
274
|
+
<title>Vite</title>
|
|
275
|
+
</head>
|
|
276
|
+
<body>
|
|
277
|
+
<div id="root"></div>
|
|
278
|
+
<script type="module" src="${mainPath}"></script>
|
|
279
|
+
</body>
|
|
280
|
+
</html>`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.moveAndEditIndexHtml = moveAndEditIndexHtml;
|
|
284
|
+
function normalizeViteConfigFilePathWithTree(tree, projectRoot, configFile) {
|
|
285
|
+
return configFile && tree.exists(configFile)
|
|
286
|
+
? configFile
|
|
287
|
+
: tree.exists((0, devkit_1.joinPathFragments)(`${projectRoot}/rspack.config.ts`))
|
|
288
|
+
? (0, devkit_1.joinPathFragments)(`${projectRoot}/rspack.config.ts`)
|
|
289
|
+
: tree.exists((0, devkit_1.joinPathFragments)(`${projectRoot}/rspack.config.js`))
|
|
290
|
+
? (0, devkit_1.joinPathFragments)(`${projectRoot}/rspack.config.js`)
|
|
291
|
+
: undefined;
|
|
292
|
+
}
|
|
293
|
+
exports.normalizeViteConfigFilePathWithTree = normalizeViteConfigFilePathWithTree;
|
|
294
|
+
function getViteConfigPathForProject(tree, projectName, target) {
|
|
295
|
+
var _a, _b, _c;
|
|
296
|
+
let viteConfigPath;
|
|
297
|
+
const { targets, root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
298
|
+
if (target) {
|
|
299
|
+
viteConfigPath = (_b = (_a = targets === null || targets === void 0 ? void 0 : targets[target]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.configFile;
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
const config = Object.values(targets).find((config) => config.executor === '@nx/rspack:build');
|
|
303
|
+
viteConfigPath = (_c = config === null || config === void 0 ? void 0 : config.options) === null || _c === void 0 ? void 0 : _c.configFile;
|
|
304
|
+
}
|
|
305
|
+
return normalizeViteConfigFilePathWithTree(tree, root, viteConfigPath);
|
|
306
|
+
}
|
|
307
|
+
exports.getViteConfigPathForProject = getViteConfigPathForProject;
|
|
308
|
+
function handleUnsupportedUserProvidedTargets(userProvidedTargetIsUnsupported, userProvidedTargetName, validFoundTargetName, framework) {
|
|
309
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
310
|
+
if (userProvidedTargetIsUnsupported.build && validFoundTargetName.build) {
|
|
311
|
+
yield handleUnsupportedUserProvidedTargetsErrors(userProvidedTargetName.build, validFoundTargetName.build, 'build', 'rspack');
|
|
312
|
+
}
|
|
313
|
+
if (framework !== 'nest' &&
|
|
314
|
+
userProvidedTargetIsUnsupported.serve &&
|
|
315
|
+
validFoundTargetName.serve) {
|
|
316
|
+
yield handleUnsupportedUserProvidedTargetsErrors(userProvidedTargetName.serve, validFoundTargetName.serve, 'serve', 'dev-server');
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
exports.handleUnsupportedUserProvidedTargets = handleUnsupportedUserProvidedTargets;
|
|
321
|
+
function handleUnsupportedUserProvidedTargetsErrors(userProvidedTargetName, validFoundTargetName, target, executor) {
|
|
322
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
323
|
+
devkit_1.logger.warn(`The custom ${target} target you provided (${userProvidedTargetName}) cannot be converted to use the @nx/rspack:${executor} executor.
|
|
324
|
+
However, we found the following ${target} target in your project that can be converted: ${validFoundTargetName}
|
|
325
|
+
|
|
326
|
+
Please note that converting a potentially non-compatible project to use Vite.js may result in unexpected behavior. Always commit
|
|
327
|
+
your changes before converting a project to use Vite.js, and test the converted project thoroughly before deploying it.
|
|
328
|
+
`);
|
|
329
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
330
|
+
const { Confirm } = require('enquirer');
|
|
331
|
+
const prompt = new Confirm({
|
|
332
|
+
name: 'question',
|
|
333
|
+
message: `Should we convert the ${validFoundTargetName} target to use the @nx/rspack:${executor} executor?`,
|
|
334
|
+
initial: true,
|
|
335
|
+
});
|
|
336
|
+
const shouldConvert = yield prompt.run();
|
|
337
|
+
if (!shouldConvert) {
|
|
338
|
+
throw new Error(`The ${target} target ${userProvidedTargetName} cannot be converted to use the @nx/rspack:${executor} executor.
|
|
339
|
+
Please try again, either by providing a different ${target} target or by not providing a target at all (Nx will
|
|
340
|
+
convert the first one it finds, most probably this one: ${validFoundTargetName})
|
|
341
|
+
|
|
342
|
+
Please note that converting a potentially non-compatible project to use Vite.js may result in unexpected behavior. Always commit
|
|
343
|
+
your changes before converting a project to use Vite.js, and test the converted project thoroughly before deploying it.
|
|
344
|
+
`);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
function handleUnknownExecutors(projectName) {
|
|
349
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
350
|
+
devkit_1.logger.warn(`
|
|
351
|
+
We could not find any targets in project ${projectName} that use executors which
|
|
352
|
+
can be converted to the @nx/rspack executors.
|
|
353
|
+
|
|
354
|
+
This either means that your project may not have a target
|
|
355
|
+
for building, serving, or testing at all, or that your targets are
|
|
356
|
+
using executors that are not known to Nx.
|
|
357
|
+
|
|
358
|
+
If you still want to convert your project to use the @nx/rspack executors,
|
|
359
|
+
please make sure to commit your changes before running this generator.
|
|
360
|
+
`);
|
|
361
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
362
|
+
const { Confirm } = require('enquirer');
|
|
363
|
+
const prompt = new Confirm({
|
|
364
|
+
name: 'question',
|
|
365
|
+
message: `Should Nx convert your project to use the @nx/rspack executors?`,
|
|
366
|
+
initial: true,
|
|
367
|
+
});
|
|
368
|
+
const shouldConvert = yield prompt.run();
|
|
369
|
+
if (!shouldConvert) {
|
|
370
|
+
throw new Error(`
|
|
371
|
+
Nx could not verify that the executors you are using can be converted to the @nx/rspack executors.
|
|
372
|
+
Please try again with a different project.
|
|
373
|
+
`);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
exports.handleUnknownExecutors = handleUnknownExecutors;
|
|
378
|
+
function determineFrameworkAndTarget(tree, options, projectRoot, targets) {
|
|
379
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
380
|
+
(0, ensure_typescript_1.ensureTypescript)();
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
382
|
+
const { tsquery } = require('@phenomnomnominal/tsquery');
|
|
383
|
+
// First try to infer if the target is node
|
|
384
|
+
if (options.target !== 'node') {
|
|
385
|
+
// Try to infer from jest config if the env is node
|
|
386
|
+
let jestConfigPath;
|
|
387
|
+
if (((_a = targets === null || targets === void 0 ? void 0 : targets.test) === null || _a === void 0 ? void 0 : _a.executor) !== '@nx/jest:jest' &&
|
|
388
|
+
((_c = (_b = targets === null || targets === void 0 ? void 0 : targets.test) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.jestConfig)) {
|
|
389
|
+
jestConfigPath = (_e = (_d = targets === null || targets === void 0 ? void 0 : targets.test) === null || _d === void 0 ? void 0 : _d.options) === null || _e === void 0 ? void 0 : _e.jestConfig;
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
jestConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, 'jest.config.ts');
|
|
393
|
+
}
|
|
394
|
+
if (!tree.exists(jestConfigPath)) {
|
|
395
|
+
return { target: options.target, framework: options.framework };
|
|
396
|
+
}
|
|
397
|
+
const appFileContent = tree.read(jestConfigPath, 'utf-8');
|
|
398
|
+
const file = tsquery.ast(appFileContent);
|
|
399
|
+
// find testEnvironment: 'node' in jest config
|
|
400
|
+
const testEnvironment = tsquery(file, `PropertyAssignment:has(Identifier[name="testEnvironment"]) > StringLiteral[value="node"]`);
|
|
401
|
+
if (testEnvironment.length > 0) {
|
|
402
|
+
return { target: 'node', framework: options.framework };
|
|
403
|
+
}
|
|
404
|
+
if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'src/main.ts'))) {
|
|
405
|
+
const appFileContent = tree.read((0, devkit_1.joinPathFragments)(projectRoot, 'src/main.ts'), 'utf-8');
|
|
406
|
+
const file = tsquery.ast(appFileContent);
|
|
407
|
+
const hasNestJsDependency = tsquery(file, `ImportDeclaration:has(StringLiteral[value="@nestjs/common"])`);
|
|
408
|
+
if ((hasNestJsDependency === null || hasNestJsDependency === void 0 ? void 0 : hasNestJsDependency.length) > 0) {
|
|
409
|
+
return { target: 'node', framework: 'nest' };
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (options.framework === 'nest') {
|
|
414
|
+
return { target: 'node', framework: 'nest' };
|
|
415
|
+
}
|
|
416
|
+
if (options.framework !== 'react' && options.target === 'web') {
|
|
417
|
+
// Look if React is used in the project
|
|
418
|
+
let tsConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.json');
|
|
419
|
+
if (!tree.exists(tsConfigPath)) {
|
|
420
|
+
tsConfigPath = determineTsConfig(tree, options);
|
|
421
|
+
}
|
|
422
|
+
const tsConfig = JSON.parse(tree.read(tsConfigPath).toString());
|
|
423
|
+
if ((_g = (_f = tsConfig === null || tsConfig === void 0 ? void 0 : tsConfig.compilerOptions) === null || _f === void 0 ? void 0 : _f.jsx) === null || _g === void 0 ? void 0 : _g.includes('react')) {
|
|
424
|
+
return { target: 'web', framework: 'react' };
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
return { target: options.target, framework: options.framework };
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return { target: options.target, framework: options.framework };
|
|
431
|
+
}
|
|
432
|
+
exports.determineFrameworkAndTarget = determineFrameworkAndTarget;
|
|
433
|
+
function determineMain(tree, options) {
|
|
434
|
+
if (options.main)
|
|
435
|
+
return options.main;
|
|
436
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
437
|
+
const mainTsx = (0, devkit_1.joinPathFragments)(project.root, 'src/main.tsx');
|
|
438
|
+
if (tree.exists(mainTsx))
|
|
439
|
+
return mainTsx;
|
|
440
|
+
return (0, devkit_1.joinPathFragments)(project.root, 'src/main.ts');
|
|
441
|
+
}
|
|
442
|
+
exports.determineMain = determineMain;
|
|
443
|
+
function determineTsConfig(tree, options) {
|
|
444
|
+
if (options.tsConfig)
|
|
445
|
+
return options.tsConfig;
|
|
446
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
447
|
+
const appJson = (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.app.json');
|
|
448
|
+
if (tree.exists(appJson))
|
|
449
|
+
return appJson;
|
|
450
|
+
const libJson = (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.lib.json');
|
|
451
|
+
if (tree.exists(libJson))
|
|
452
|
+
return libJson;
|
|
453
|
+
return (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.json');
|
|
454
|
+
}
|
|
455
|
+
exports.determineTsConfig = determineTsConfig;
|
|
456
|
+
//# sourceMappingURL=generator-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-utils.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/generator-utils.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,qFAAiF;AAUjF,SAAgB,4BAA4B,CAC1C,OAEC,EACD,mBAA4C;IAO5C,MAAM,MAAM,GAAoD;QAC9D,oBAAoB,EAAE,EAAE;QACxB,kCAAkC,EAAE,KAAK;QACzC,+BAA+B,EAAE,EAAE;QACnC,yBAAyB,EAAE,EAAE;KAC9B,CAAC;IAEF,MAAM,kBAAkB,GAAG;QACzB,KAAK,EAAE;YACL,mBAAmB;YACnB,uBAAuB;YACvB,qBAAqB;YACrB,kBAAkB;YAClB,kBAAkB;YAClB,q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AAiB,EAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAChE,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAEzC,OAAO,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AACxD,CAAC;AATD,sCASC;AAED,SAAgB,iBAAiB,CAAC,IAAU,EAAE,OAA4B;IACxE,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC;IAE9C,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhE,MAAM,OAAO,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACrE,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAEzC,MAAM,OAAO,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACrE,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAEzC,OAAO,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;AAC1D,CAAC;AAZD,8CAYC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCopyPatterns = void 0;
|
|
4
|
+
function getCopyPatterns(assets) {
|
|
5
|
+
return assets.map((asset) => {
|
|
6
|
+
var _a;
|
|
7
|
+
return {
|
|
8
|
+
context: asset.input,
|
|
9
|
+
// Now we remove starting slash to make Webpack place it from the output root.
|
|
10
|
+
to: asset.output,
|
|
11
|
+
from: asset.glob,
|
|
12
|
+
globOptions: {
|
|
13
|
+
ignore: [
|
|
14
|
+
'.gitkeep',
|
|
15
|
+
'**/.DS_Store',
|
|
16
|
+
'**/Thumbs.db',
|
|
17
|
+
...((_a = asset.ignore) !== null && _a !== void 0 ? _a : []),
|
|
18
|
+
],
|
|
19
|
+
dot: true,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.getCopyPatterns = getCopyPatterns;
|
|
25
|
+
//# sourceMappingURL=get-copy-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-copy-patterns.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/get-copy-patterns.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,MAAa;IAC3C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;;QAC1B,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,KAAK;YACpB,8EAA8E;YAC9E,EAAE,EAAE,KAAK,CAAC,MAAM;YAChB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,WAAW,EAAE;gBACX,MAAM,EAAE;oBACN,UAAU;oBACV,cAAc;oBACd,cAAc;oBACd,GAAG,CAAC,MAAA,KAAK,CAAC,MAAM,mCAAI,EAAE,CAAC;iBACxB;gBACD,GAAG,EAAE,IAAI;aACV;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,0CAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function updateJestConfigContent(content: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateJestConfigContent = void 0;
|
|
4
|
+
function updateJestConfigContent(content) {
|
|
5
|
+
return content
|
|
6
|
+
.replace('transform: {', "transform: {\n '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',")
|
|
7
|
+
.replace(`'babel-jest'`, `['babel-jest', { presets: ['@nx/react/babel'] }]`);
|
|
8
|
+
}
|
|
9
|
+
exports.updateJestConfigContent = updateJestConfigContent;
|
|
10
|
+
//# sourceMappingURL=jest-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest-utils.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/jest-utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,uBAAuB,CAAC,OAAe;IACrD,OAAO,OAAO;SACX,OAAO,CACN,cAAc,EACd,sFAAsF,CACvF;SACA,OAAO,CACN,cAAc,EACd,kDAAkD,CACnD,CAAC;AACN,CAAC;AAVD,0DAUC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMode = void 0;
|
|
4
|
+
function isMode(mode) {
|
|
5
|
+
return mode === 'development' || mode === 'production' || mode === 'none';
|
|
6
|
+
}
|
|
7
|
+
exports.isMode = isMode;
|
|
8
|
+
//# sourceMappingURL=mode-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-utils.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/mode-utils.ts"],"names":[],"mappings":";;;AAEA,SAAgB,MAAM,CAAC,IAAY;IACjC,OAAO,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,MAAM,CAAC;AAC5E,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeAssets(assets: any[], root: string, sourceRoot: string): any[];
|