@nx/react 23.0.0-beta.4 → 23.0.0-beta.6
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/package.json +16 -16
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +2 -2
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +3 -3
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +2 -2
- package/src/generators/application/application.d.ts.map +1 -1
- package/src/generators/application/application.js +3 -4
- package/src/generators/application/lib/add-e2e.d.ts.map +1 -1
- package/src/generators/application/lib/normalize-options.js +3 -3
- package/src/generators/component/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/component/lib/normalize-options.js +2 -2
- package/src/generators/component/schema.d.ts +1 -1
- package/src/generators/federate-module/federate-module.d.ts.map +1 -1
- package/src/generators/federate-module/federate-module.js +2 -2
- package/src/generators/hook/hook.d.ts.map +1 -1
- package/src/generators/hook/hook.js +2 -2
- package/src/generators/host/host.d.ts.map +1 -1
- package/src/generators/host/host.js +2 -2
- package/src/generators/host/lib/normalize-host-name.js +2 -2
- package/src/generators/init/init.d.ts.map +1 -1
- package/src/generators/init/init.js +2 -2
- package/src/generators/library/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/library/lib/normalize-options.js +3 -3
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +3 -4
- package/src/generators/redux/redux.d.ts.map +1 -1
- package/src/generators/redux/redux.js +2 -2
- package/src/generators/redux/schema.d.ts +1 -1
- package/src/generators/remote/remote.d.ts.map +1 -1
- package/src/generators/remote/remote.js +2 -2
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.d.ts.map +1 -1
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +2 -2
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.d.ts.map +1 -1
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.js +2 -2
- package/src/migrations/update-22-0-0/add-svgr-to-webpack-config.d.ts.map +1 -1
- package/src/migrations/update-22-0-0/add-svgr-to-webpack-config.js +2 -2
- package/src/plugins/router-plugin.d.ts.map +1 -1
- package/src/plugins/router-plugin.js +11 -19
- package/src/utils/normalize-remote.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -37,28 +37,28 @@
|
|
|
37
37
|
"@svgr/webpack": "^8.0.1",
|
|
38
38
|
"minimatch": "10.2.4",
|
|
39
39
|
"tslib": "^2.3.0",
|
|
40
|
-
"@nx/devkit": "23.0.0-beta.
|
|
41
|
-
"@nx/js": "23.0.0-beta.
|
|
42
|
-
"@nx/eslint": "23.0.0-beta.
|
|
43
|
-
"@nx/web": "23.0.0-beta.
|
|
44
|
-
"@nx/module-federation": "23.0.0-beta.
|
|
45
|
-
"@nx/rollup": "23.0.0-beta.
|
|
40
|
+
"@nx/devkit": "23.0.0-beta.6",
|
|
41
|
+
"@nx/js": "23.0.0-beta.6",
|
|
42
|
+
"@nx/eslint": "23.0.0-beta.6",
|
|
43
|
+
"@nx/web": "23.0.0-beta.6",
|
|
44
|
+
"@nx/module-federation": "23.0.0-beta.6",
|
|
45
|
+
"@nx/rollup": "23.0.0-beta.6",
|
|
46
46
|
"express": "^4.21.2",
|
|
47
47
|
"http-proxy-middleware": "^3.0.5",
|
|
48
48
|
"semver": "^7.6.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@nx/cypress": "23.0.0-beta.
|
|
52
|
-
"@nx/playwright": "23.0.0-beta.
|
|
53
|
-
"@nx/rsbuild": "23.0.0-beta.
|
|
54
|
-
"@nx/vite": "23.0.0-beta.
|
|
55
|
-
"@nx/vitest": "23.0.0-beta.
|
|
56
|
-
"@nx/webpack": "23.0.0-beta.
|
|
57
|
-
"@nx/storybook": "23.0.0-beta.
|
|
58
|
-
"nx": "23.0.0-beta.
|
|
51
|
+
"@nx/cypress": "23.0.0-beta.6",
|
|
52
|
+
"@nx/playwright": "23.0.0-beta.6",
|
|
53
|
+
"@nx/rsbuild": "23.0.0-beta.6",
|
|
54
|
+
"@nx/vite": "23.0.0-beta.6",
|
|
55
|
+
"@nx/vitest": "23.0.0-beta.6",
|
|
56
|
+
"@nx/webpack": "23.0.0-beta.6",
|
|
57
|
+
"@nx/storybook": "23.0.0-beta.6",
|
|
58
|
+
"nx": "23.0.0-beta.6"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@nx/vite": "23.0.0-beta.
|
|
61
|
+
"@nx/vite": "23.0.0-beta.6"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = moduleFederationDevServer;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
8
|
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
|
9
9
|
const file_server_impl_1 = tslib_1.__importDefault(require("@nx/web/src/executors/file-server/file-server.impl"));
|
|
@@ -41,7 +41,7 @@ async function* moduleFederationDevServer(schema, context) {
|
|
|
41
41
|
return yield* currIter;
|
|
42
42
|
}
|
|
43
43
|
const { staticRemotesIter, devRemoteIters, remotes } = await (0, utils_1.startRemoteIterators)(options, context, lib_1.startRemotes, pathToManifestFile, 'react');
|
|
44
|
-
return yield* (0,
|
|
44
|
+
return yield* (0, internal_1.combineAsyncIterables)(currIter, ...devRemoteIters, ...(staticRemotesIter ? [staticRemotesIter] : []), (0, internal_1.createAsyncIterable)(async ({ next, done }) => {
|
|
45
45
|
if (!options.isInitialHost) {
|
|
46
46
|
done();
|
|
47
47
|
return;
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = moduleFederationSsrDevServer;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
8
|
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
|
9
9
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
@@ -31,7 +31,7 @@ async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
|
|
31
31
|
return yield* iter;
|
|
32
32
|
}
|
|
33
33
|
const { staticRemotesIter, devRemoteIters, remotes } = await (0, utils_1.startRemoteIterators)(options, context, lib_1.startRemotes, pathToManifestFile, 'react', true);
|
|
34
|
-
const combined = (0,
|
|
34
|
+
const combined = (0, internal_1.combineAsyncIterables)(staticRemotesIter, ...devRemoteIters);
|
|
35
35
|
let refs = 1 + (devRemoteIters?.length ?? 0);
|
|
36
36
|
for await (const result of combined) {
|
|
37
37
|
if (result.success === false)
|
|
@@ -41,7 +41,7 @@ async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
|
|
41
41
|
if (refs === 0)
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
|
-
return yield* (0,
|
|
44
|
+
return yield* (0, internal_1.combineAsyncIterables)(iter, (0, internal_1.createAsyncIterable)(async ({ next, done }) => {
|
|
45
45
|
const host = options.host ?? 'localhost';
|
|
46
46
|
const baseUrl = `http${options.ssl ? 's' : ''}://${host}:${options.port}`;
|
|
47
47
|
if (!options.isInitialHost) {
|
package/src/executors/module-federation-static-server/module-federation-static-server.impl.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.startProxies = startProxies;
|
|
4
4
|
exports.default = moduleFederationStaticServer;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
8
8
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
9
|
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
|
10
10
|
const utils_2 = require("@nx/module-federation/src/utils");
|
|
@@ -201,7 +201,7 @@ async function* moduleFederationStaticServer(schema, context) {
|
|
|
201
201
|
pathToKey: (0, path_1.join)(devkit_1.workspaceRoot, options.serveOptions.sslKey),
|
|
202
202
|
}
|
|
203
203
|
: undefined);
|
|
204
|
-
return yield* (0,
|
|
204
|
+
return yield* (0, internal_1.combineAsyncIterables)(staticFileServerIter, (0, internal_1.createAsyncIterable)(async ({ next, done }) => {
|
|
205
205
|
const host = options.serveOptions.host ?? 'localhost';
|
|
206
206
|
const baseUrl = `http${options.serveOptions.ssl ? 's' : ''}://${host}:${options.serveOptions.port}`;
|
|
207
207
|
if (remotes.remotePorts.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/application/application.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/application/application.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AA6BpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAM5B;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAsL5B;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.applicationGenerator = applicationGenerator;
|
|
4
4
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const js_1 = require("@nx/js");
|
|
8
|
-
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
9
9
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
10
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
11
11
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
@@ -24,7 +24,6 @@ const add_rspack_1 = require("./lib/bundlers/add-rspack");
|
|
|
24
24
|
const add_rsbuild_1 = require("./lib/bundlers/add-rsbuild");
|
|
25
25
|
const add_vite_1 = require("./lib/bundlers/add-vite");
|
|
26
26
|
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
27
|
-
const prompt_1 = require("@nx/devkit/src/generators/prompt");
|
|
28
27
|
async function applicationGenerator(tree, schema) {
|
|
29
28
|
return await applicationGeneratorInternal(tree, {
|
|
30
29
|
addPlugin: false,
|
|
@@ -48,7 +47,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
48
47
|
options.useReactRouter =
|
|
49
48
|
options.routing && options.bundler === 'vite'
|
|
50
49
|
? (options.useReactRouter ??
|
|
51
|
-
(await (0,
|
|
50
|
+
(await (0, internal_1.promptWhenInteractive)({
|
|
52
51
|
name: 'response',
|
|
53
52
|
message: 'Would you like to use react-router for server-side rendering?',
|
|
54
53
|
type: 'autocomplete',
|
|
@@ -163,7 +162,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
163
162
|
await (0, devkit_1.formatFiles)(tree);
|
|
164
163
|
}
|
|
165
164
|
tasks.push(() => {
|
|
166
|
-
(0,
|
|
165
|
+
(0, internal_1.logShowProjectCommand)(options.projectName);
|
|
167
166
|
});
|
|
168
167
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
169
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAwN5B"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
7
7
|
const find_free_port_1 = require("./find-free-port");
|
|
8
8
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
9
|
async function normalizeOptions(host, options) {
|
|
10
|
-
await (0,
|
|
11
|
-
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0,
|
|
10
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
11
|
+
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
12
12
|
name: options.name,
|
|
13
13
|
projectType: 'application',
|
|
14
14
|
directory: options.directory,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/component/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/component/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,IAAI,EAAE,MAAM,YAAY,CAAC;AAI3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGrD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CA2D3B"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
8
|
async function normalizeOptions(tree, options) {
|
|
9
9
|
(0, assertion_1.assertValidStyle)(options.style);
|
|
10
|
-
const { artifactName: name, directory, fileName, filePath, fileExtension, fileExtensionType, project: projectName, } = await (0,
|
|
10
|
+
const { artifactName: name, directory, fileName, filePath, fileExtension, fileExtensionType, project: projectName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
11
11
|
path: options.path,
|
|
12
12
|
name: options.name,
|
|
13
13
|
allowedFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"federate-module.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/federate-module/federate-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"federate-module.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/federate-module/federate-module.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,IAAI,EAQL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlC,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAiEvE;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.federateModuleGenerator = federateModuleGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const remote_1 = require("../remote/remote");
|
|
6
7
|
const utils_1 = require("./lib/utils");
|
|
7
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
8
8
|
const js_1 = require("@nx/js");
|
|
9
9
|
async function federateModuleGenerator(tree, schema) {
|
|
10
10
|
// Check if the file exists
|
|
@@ -14,7 +14,7 @@ async function federateModuleGenerator(tree, schema) {
|
|
|
14
14
|
Path: ${schema.path}`);
|
|
15
15
|
}
|
|
16
16
|
const tasks = [];
|
|
17
|
-
const { projectName: remoteName, projectRoot: remoteRoot } = await (0,
|
|
17
|
+
const { projectName: remoteName, projectRoot: remoteRoot } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
18
18
|
name: schema.remote,
|
|
19
19
|
directory: schema.remoteDirectory,
|
|
20
20
|
projectType: 'application',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/hook/hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/hook/hook.ts"],"names":[],"mappings":"AAKA,OAAO,EAQL,IAAI,EACL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAclC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAO7D;AAmHD,eAAe,aAAa,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hookGenerator = hookGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
// TODO(jack): Remove inline renderHook function when RTL releases with its own version
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
7
7
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const ast_utils_1 = require("../../utils/ast-utils");
|
|
@@ -45,7 +45,7 @@ function addExportsToBarrel(host, options) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
async function normalizeOptions(host, options) {
|
|
48
|
-
const { artifactName, directory, fileName: hookFilename, fileExtension, fileExtensionType, project: projectName, } = await (0,
|
|
48
|
+
const { artifactName, directory, fileName: hookFilename, fileExtension, fileExtensionType, project: projectName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
49
49
|
path: options.path,
|
|
50
50
|
name: options.name,
|
|
51
51
|
allowedFileExtensions: ['js', 'ts'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/host/host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/host/host.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAoB,MAAM,EAAE,MAAM,UAAU,CAAC;AAWpD,wBAAsB,aAAa,CACjC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAmJ5B;AAmCD,eAAe,aAAa,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hostGenerator = hostGenerator;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
|
|
7
8
|
const application_1 = tslib_1.__importDefault(require("../application/application"));
|
|
@@ -16,7 +17,6 @@ const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
|
|
|
16
17
|
const js_1 = require("@nx/js");
|
|
17
18
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
18
19
|
const versions_1 = require("../../utils/versions");
|
|
19
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
20
20
|
const update_module_federation_tsconfig_1 = require("./lib/update-module-federation-tsconfig");
|
|
21
21
|
const normalize_host_name_1 = require("./lib/normalize-host-name");
|
|
22
22
|
async function hostGenerator(host, schema) {
|
|
@@ -46,7 +46,7 @@ async function hostGenerator(host, schema) {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
await (0,
|
|
49
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
50
50
|
const initTask = await (0, application_1.default)(host, {
|
|
51
51
|
...options,
|
|
52
52
|
directory: options.appProjectRoot,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeHostName = normalizeHostName;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
async function normalizeHostName(tree, directory, name) {
|
|
6
|
-
const { projectName } = await (0,
|
|
6
|
+
const { projectName } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
7
7
|
name,
|
|
8
8
|
directory,
|
|
9
9
|
projectType: 'application',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/init/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,8BAyDtE;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reactInitGenerator = reactInitGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const versions_1 = require("../../utils/versions");
|
|
6
7
|
const version_utils_1 = require("../../utils/version-utils");
|
|
7
|
-
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
8
8
|
const router_plugin_1 = require("../../plugins/router-plugin");
|
|
9
9
|
async function reactInitGenerator(tree, schema) {
|
|
10
10
|
const tasks = [];
|
|
@@ -23,7 +23,7 @@ async function reactInitGenerator(tree, schema) {
|
|
|
23
23
|
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
24
24
|
nxJson.useInferencePlugins !== false;
|
|
25
25
|
if (schema.useReactRouterPlugin && schema.addPlugin) {
|
|
26
|
-
await (0,
|
|
26
|
+
await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/react/router-plugin', router_plugin_1.createNodesV2, {
|
|
27
27
|
buildTargetName: ['build', 'react-router:build', 'react-router-build'],
|
|
28
28
|
devTargetName: ['dev', 'react-router:dev', 'react-router-dev'],
|
|
29
29
|
startTargetName: ['start', 'react-router-serve', 'react-router-start'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOrD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAmG3B"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
8
|
async function normalizeOptions(host, options) {
|
|
9
9
|
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
10
|
-
await (0,
|
|
11
|
-
const { projectName, names: projectNames, projectRoot, importPath, } = await (0,
|
|
10
|
+
await (0, internal_1.ensureRootProjectName)(options, 'library');
|
|
11
|
+
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
12
12
|
name: options.name,
|
|
13
13
|
projectType: 'library',
|
|
14
14
|
directory: options.directory,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/library/library.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/library/library.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AA8BpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMhE;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BA0RxE;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
8
|
-
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
9
8
|
const js_1 = require("@nx/js");
|
|
10
9
|
const path_1 = require("path");
|
|
11
10
|
const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
|
|
@@ -184,7 +183,7 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
184
183
|
}, true);
|
|
185
184
|
}
|
|
186
185
|
if (options.component) {
|
|
187
|
-
const relativeCwd = (0,
|
|
186
|
+
const relativeCwd = (0, internal_1.getRelativeCwd)();
|
|
188
187
|
const path = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/lib', options.fileName);
|
|
189
188
|
const componentTask = await (0, component_1.default)(host, {
|
|
190
189
|
path: relativeCwd ? (0, path_1.relative)(relativeCwd, path) : path,
|
|
@@ -242,7 +241,7 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
242
241
|
tasks.push(() => (0, devkit_1.installPackagesTask)(host, true));
|
|
243
242
|
}
|
|
244
243
|
tasks.push(() => {
|
|
245
|
-
(0,
|
|
244
|
+
(0, internal_1.logShowProjectCommand)(options.name);
|
|
246
245
|
});
|
|
247
246
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
248
247
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redux.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/redux/redux.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"redux.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/redux/redux.ts"],"names":[],"mappings":"AACA,OAAO,EASL,IAAI,EACL,MAAM,YAAY,CAAC;AAcpB,OAAO,EAAoB,MAAM,EAAE,MAAM,UAAU,CAAC;AAIpD,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mDAW9D;AA0LD,eAAe,cAAc,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reduxGenerator = reduxGenerator;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
8
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
9
9
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
@@ -77,7 +77,7 @@ function updateReducerConfiguration(host, options) {
|
|
|
77
77
|
host.write(options.appMainFilePath, changes);
|
|
78
78
|
}
|
|
79
79
|
async function normalizeOptions(host, options) {
|
|
80
|
-
const { artifactName: name, directory, fileName, fileExtension, fileExtensionType, project: projectName, } = await (0,
|
|
80
|
+
const { artifactName: name, directory, fileName, fileExtension, fileExtensionType, project: projectName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
81
81
|
path: options.path,
|
|
82
82
|
name: options.name,
|
|
83
83
|
suffix: 'slice',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/remote/remote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/remote/remote.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAsBpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAmFlC;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAqK/D;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addModuleFederationFiles = addModuleFederationFiles;
|
|
4
4
|
exports.remoteGenerator = remoteGenerator;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const path_1 = require("path");
|
|
8
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
9
9
|
const js_1 = require("@nx/js");
|
|
10
10
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
11
11
|
const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
|
|
@@ -93,7 +93,7 @@ async function remoteGenerator(host, schema) {
|
|
|
93
93
|
throw new Error(`Invalid remote name provided: ${options.projectName}. ${isValidRemote.message}`);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
await (0,
|
|
96
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
97
97
|
const isValidRemote = (0, js_1.isValidVariable)(options.projectName);
|
|
98
98
|
if (!isValidRemote.isValid) {
|
|
99
99
|
throw new Error(`Invalid remote name provided: ${options.projectName}. ${isValidRemote.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-with-mf-import-to-new-package.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate-with-mf-import-to-new-package.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAKV,MAAM,YAAY,CAAC;AAQpB,wBAA8B,mBAAmB,CAAC,IAAI,EAAE,IAAI,iBAqD3D"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = migrateWithMfImport;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
6
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
7
7
|
const versions_1 = require("../../utils/versions");
|
|
8
8
|
const NX_RSPACK_MODULE_FEDERATION_IMPORT_SELECTOR = 'ImportDeclaration > StringLiteral[value=@nx/react/module-federation], VariableStatement CallExpression:has(Identifier[name=require]) > StringLiteral[value=@nx/react/module-federation]';
|
|
9
9
|
const NEW_IMPORT_PATH = `'@nx/module-federation/webpack'`;
|
|
10
10
|
async function migrateWithMfImport(tree) {
|
|
11
11
|
const projects = new Set();
|
|
12
|
-
(0,
|
|
12
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nx/react:module-federation-dev-server', (options, project, target) => {
|
|
13
13
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
14
14
|
projects.add(projectConfig.root);
|
|
15
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-nx-module-federation-package.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-20-3-0/ensure-nx-module-federation-package.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensure-nx-module-federation-package.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-20-3-0/ensure-nx-module-federation-package.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAGpB,wBAA8B,eAAe,CAAC,IAAI,EAAE,IAAI,iBAqBvD"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = ensureMfPackage;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
6
|
const versions_1 = require("../../utils/versions");
|
|
7
7
|
async function ensureMfPackage(tree) {
|
|
8
8
|
const projects = new Set();
|
|
9
|
-
(0,
|
|
9
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nx/react:module-federation-dev-server', (options, project, target) => {
|
|
10
10
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
11
11
|
projects.add(projectConfig.root);
|
|
12
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-svgr-to-webpack-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-22-0-0/add-svgr-to-webpack-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-svgr-to-webpack-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-22-0-0/add-svgr-to-webpack-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAKV,MAAM,YAAY,CAAC;AAgHpB,wBAA8B,sBAAsB,CAAC,IAAI,EAAE,IAAI,iBAsZ9D"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = addSvgrToWebpackConfig;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
7
7
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
8
8
|
const ts = tslib_1.__importStar(require("typescript"));
|
|
9
9
|
const withSvgrFunctionForWithReact = `
|
|
@@ -115,7 +115,7 @@ function withSvgr(svgrOptions = {}) {
|
|
|
115
115
|
async function addSvgrToWebpackConfig(tree) {
|
|
116
116
|
const projects = new Map();
|
|
117
117
|
// Find all React webpack projects using either withReact OR NxReactWebpackPlugin
|
|
118
|
-
(0,
|
|
118
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (options, project, target) => {
|
|
119
119
|
if (!options.webpackConfig)
|
|
120
120
|
return;
|
|
121
121
|
const webpackConfigPath = options.webpackConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/plugins/router-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router-plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/plugins/router-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAUpB,MAAM,WAAW,wBAAwB;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAUD,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,wBAAwB,CA2FjE,CAAC"}
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNodesV2 = void 0;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const fs_1 = require("fs");
|
|
7
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
8
8
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
9
|
-
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
10
9
|
const js_1 = require("@nx/js");
|
|
11
10
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
12
11
|
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
13
12
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
14
|
-
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
15
13
|
const pmCommand = (0, devkit_1.getPackageManagerCommand)();
|
|
16
14
|
const reactRouterConfigBlob = '**/react-router.config.{ts,js,cjs,cts,mjs,mts}';
|
|
17
|
-
function readTargetsCache(cachePath) {
|
|
18
|
-
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false' && (0, fs_1.existsSync)(cachePath)
|
|
19
|
-
? (0, devkit_1.readJsonFile)(cachePath)
|
|
20
|
-
: {};
|
|
21
|
-
}
|
|
22
|
-
function writeTargetsToCache(cachePath, results) {
|
|
23
|
-
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
24
|
-
}
|
|
25
15
|
exports.createNodesV2 = [
|
|
26
16
|
reactRouterConfigBlob,
|
|
27
17
|
async (configFiles, options, context) => {
|
|
28
18
|
const optionsHash = (0, devkit_internals_1.hashObject)(options);
|
|
29
19
|
const normalizedOptions = normalizeOptions(options);
|
|
30
20
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `react-router-${optionsHash}.hash`);
|
|
31
|
-
const targetsCache =
|
|
21
|
+
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
32
22
|
const isUsingTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
|
|
33
23
|
const { roots: projectRoots, configFiles: validConfigFiles } = configFiles.reduce((acc, configFile) => {
|
|
34
24
|
const potentialRoot = (0, path_1.dirname)(configFile);
|
|
@@ -42,14 +32,16 @@ exports.createNodesV2 = [
|
|
|
42
32
|
configFiles: [],
|
|
43
33
|
});
|
|
44
34
|
const lockfile = (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
45
|
-
const hashes = await (0,
|
|
35
|
+
const hashes = await (0, internal_1.calculateHashesForCreateNodes)(projectRoots, { ...normalizedOptions, isUsingTsSolutionSetup }, context, projectRoots.map((_) => [lockfile]));
|
|
46
36
|
try {
|
|
47
37
|
return await (0, devkit_1.createNodesFromFiles)(async (configFile, _, context, idx) => {
|
|
48
38
|
const projectRoot = (0, path_1.dirname)(configFile);
|
|
49
39
|
const siblingFiles = (0, fs_1.readdirSync)((0, devkit_1.joinPathFragments)(context.workspaceRoot, projectRoot));
|
|
50
40
|
const hash = hashes[idx] + configFile;
|
|
51
|
-
|
|
52
|
-
await buildReactRouterTargets(configFile, projectRoot, normalizedOptions, context, siblingFiles, isUsingTsSolutionSetup));
|
|
41
|
+
if (!targetsCache.has(hash)) {
|
|
42
|
+
targetsCache.set(hash, await buildReactRouterTargets(configFile, projectRoot, normalizedOptions, context, siblingFiles, isUsingTsSolutionSetup));
|
|
43
|
+
}
|
|
44
|
+
const { projectType, metadata, targets } = targetsCache.get(hash);
|
|
53
45
|
const project = {
|
|
54
46
|
root: projectRoot,
|
|
55
47
|
targets,
|
|
@@ -66,16 +58,16 @@ exports.createNodesV2 = [
|
|
|
66
58
|
}, validConfigFiles, options, context);
|
|
67
59
|
}
|
|
68
60
|
finally {
|
|
69
|
-
|
|
61
|
+
targetsCache.writeToDisk();
|
|
70
62
|
}
|
|
71
63
|
},
|
|
72
64
|
];
|
|
73
65
|
async function buildReactRouterTargets(configFilePath, projectRoot, options, context, siblingFiles, isUsingTsSolutionSetup) {
|
|
74
|
-
const namedInputs = (0,
|
|
66
|
+
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
75
67
|
const configPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
|
|
76
68
|
if (require.cache[configPath])
|
|
77
|
-
(0,
|
|
78
|
-
const reactRouterConfig = await (0,
|
|
69
|
+
(0, internal_1.clearRequireCache)();
|
|
70
|
+
const reactRouterConfig = await (0, internal_1.loadConfigFile)(configPath);
|
|
79
71
|
const isLibMode = reactRouterConfig?.ssr !== undefined && reactRouterConfig.ssr === false;
|
|
80
72
|
const { buildDirectory, serverBuildPath } = await getBuildPaths(reactRouterConfig, isLibMode);
|
|
81
73
|
const targets = {};
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeRemoteName = normalizeRemoteName;
|
|
4
4
|
exports.normalizeRemoteDirectory = normalizeRemoteDirectory;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
async function normalizeRemoteName(tree, remote, options) {
|
|
8
|
-
const { projectName: remoteName } = await (0,
|
|
8
|
+
const { projectName: remoteName } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
9
9
|
name: remote,
|
|
10
10
|
projectType: 'application',
|
|
11
11
|
directory: options.directory,
|