@nx/react 21.3.0-canary.20250710-13551c9 → 21.3.0-canary.20250712-18e5d95
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 +6 -6
- package/plugins/component-testing/index.js +4 -3
- package/plugins/storybook/index.js +5 -4
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +5 -5
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +6 -6
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +3 -3
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +13 -12
- package/src/generators/component-story/component-story.js +3 -2
- package/src/generators/component-test/component-test.js +6 -4
- package/src/generators/cypress-component-configuration/lib/add-files.js +3 -1
- package/src/generators/host/lib/add-module-federation-files.js +2 -1
- package/src/generators/library/lib/normalize-options.js +1 -1
- package/src/generators/redux/redux.d.ts +1 -1
- package/src/generators/redux/redux.js +5 -5
- package/src/generators/remote/lib/update-host-with-remote.js +3 -2
- package/src/generators/remote/remote.js +12 -11
- package/src/generators/setup-ssr/setup-ssr.js +4 -3
- package/src/generators/stories/stories.js +5 -5
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/react",
|
3
|
-
"version": "21.3.0-canary.
|
3
|
+
"version": "21.3.0-canary.20250712-18e5d95",
|
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": {
|
@@ -38,11 +38,11 @@
|
|
38
38
|
"minimatch": "9.0.3",
|
39
39
|
"picocolors": "^1.1.0",
|
40
40
|
"tslib": "^2.3.0",
|
41
|
-
"@nx/devkit": "21.3.0-canary.
|
42
|
-
"@nx/js": "21.3.0-canary.
|
43
|
-
"@nx/eslint": "21.3.0-canary.
|
44
|
-
"@nx/web": "21.3.0-canary.
|
45
|
-
"@nx/module-federation": "21.3.0-canary.
|
41
|
+
"@nx/devkit": "21.3.0-canary.20250712-18e5d95",
|
42
|
+
"@nx/js": "21.3.0-canary.20250712-18e5d95",
|
43
|
+
"@nx/eslint": "21.3.0-canary.20250712-18e5d95",
|
44
|
+
"@nx/web": "21.3.0-canary.20250712-18e5d95",
|
45
|
+
"@nx/module-federation": "21.3.0-canary.20250712-18e5d95",
|
46
46
|
"express": "^4.21.2",
|
47
47
|
"http-proxy-middleware": "^3.0.3",
|
48
48
|
"semver": "^7.6.3"
|
@@ -2,8 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
4
4
|
const cypress_preset_1 = require("@nx/cypress/plugins/cypress-preset");
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
6
5
|
const ct_helpers_1 = require("@nx/cypress/src/utils/ct-helpers");
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
7
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
7
8
|
const fs_1 = require("fs");
|
8
9
|
const path_1 = require("path");
|
9
10
|
/**
|
@@ -160,7 +161,7 @@ function buildTargetWebpack(ctx, buildTarget, componentTestingProjectName) {
|
|
160
161
|
const { composePluginsSync } = require('@nx/webpack/src/utils/config');
|
161
162
|
const { withNx } = require('@nx/webpack/src/utils/with-nx');
|
162
163
|
const { withWeb } = require('@nx/webpack/src/utils/with-web');
|
163
|
-
const options = normalizeOptions(withSchemaDefaults(parsed, context), devkit_1.workspaceRoot, buildableProjectConfig.root,
|
164
|
+
const options = normalizeOptions(withSchemaDefaults(parsed, context), devkit_1.workspaceRoot, buildableProjectConfig.root, (0, ts_solution_setup_1.getProjectSourceRoot)(buildableProjectConfig));
|
164
165
|
let customWebpack;
|
165
166
|
if (options.webpackConfig) {
|
166
167
|
customWebpack = resolveUserDefinedWebpackConfig(options.webpackConfig, options.tsConfig.startsWith(context.root)
|
@@ -183,7 +184,7 @@ function buildTargetWebpack(ctx, buildTarget, componentTestingProjectName) {
|
|
183
184
|
extractLicenses: false,
|
184
185
|
root: devkit_1.workspaceRoot,
|
185
186
|
projectRoot: ctProjectConfig.root,
|
186
|
-
sourceRoot: ctProjectConfig
|
187
|
+
sourceRoot: (0, ts_solution_setup_1.getProjectSourceRoot)(ctProjectConfig),
|
187
188
|
},
|
188
189
|
context,
|
189
190
|
});
|
@@ -2,12 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.webpack = exports.core = void 0;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
5
6
|
const config_1 = require("@nx/webpack/src/utils/config");
|
7
|
+
const fs_1 = require("fs");
|
6
8
|
const path_1 = require("path");
|
7
9
|
const webpack_1 = require("webpack");
|
8
|
-
const merge_plugins_1 = require("./merge-plugins");
|
9
10
|
const with_react_1 = require("../with-react");
|
10
|
-
const
|
11
|
+
const merge_plugins_1 = require("./merge-plugins");
|
11
12
|
// This is shamelessly taken from CRA and modified for NX use
|
12
13
|
// https://github.com/facebook/create-react-app/blob/4784997f0682e75eb32a897b4ffe34d735912e6c/packages/react-scripts/config/env.js#L71
|
13
14
|
function getClientEnvironment(mode) {
|
@@ -62,7 +63,7 @@ const getProjectData = async (storybookOptions) => {
|
|
62
63
|
? {
|
63
64
|
workspaceRoot: process.env.NX_WORKSPACE_ROOT,
|
64
65
|
projectRoot: projectNode.data.root,
|
65
|
-
sourceRoot: projectNode.data
|
66
|
+
sourceRoot: (0, ts_solution_setup_1.getProjectSourceRoot)(projectNode.data),
|
66
67
|
projectNode,
|
67
68
|
}
|
68
69
|
: // Edge-case: missing project node
|
@@ -128,7 +129,7 @@ const webpack = async (storybookWebpackConfig = {}, options) => {
|
|
128
129
|
...options,
|
129
130
|
root: projectData.workspaceRoot,
|
130
131
|
projectRoot: projectData.projectRoot,
|
131
|
-
sourceRoot: projectData.
|
132
|
+
sourceRoot: (0, ts_solution_setup_1.getProjectSourceRoot)(projectData.projectNode.data),
|
132
133
|
fileReplacements: [],
|
133
134
|
sourceMap: true,
|
134
135
|
styles: options.styles ?? [],
|
@@ -2,11 +2,12 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.default = moduleFederationDevServer;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const dev_server_impl_1 = require("@nx/webpack/src/executors/dev-server/dev-server.impl");
|
6
|
-
const file_server_impl_1 = require("@nx/web/src/executors/file-server/file-server.impl");
|
7
|
-
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
8
5
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
7
|
+
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
8
|
+
const file_server_impl_1 = require("@nx/web/src/executors/file-server/file-server.impl");
|
9
9
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
10
|
+
const dev_server_impl_1 = require("@nx/webpack/src/executors/dev-server/dev-server.impl");
|
10
11
|
const fs_1 = require("fs");
|
11
12
|
const path_1 = require("path");
|
12
13
|
const lib_1 = require("./lib");
|
@@ -23,8 +24,7 @@ async function* moduleFederationDevServer(schema, context) {
|
|
23
24
|
}, context)
|
24
25
|
: (0, dev_server_impl_1.default)(options, context);
|
25
26
|
const p = context.projectsConfigurations.projects[context.projectName];
|
26
|
-
|
27
|
-
let pathToManifestFile = (0, path_1.join)(context.root, p.sourceRoot, 'assets/module-federation.manifest.json');
|
27
|
+
let pathToManifestFile = (0, path_1.join)(context.root, (0, ts_solution_setup_1.getProjectSourceRoot)(p), 'assets/module-federation.manifest.json');
|
28
28
|
if (options.pathToManifestFile) {
|
29
29
|
const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
|
30
30
|
if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.default = moduleFederationSsrDevServer;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ssr_dev_server_impl_1 = require("@nx/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl");
|
6
|
-
const path_1 = require("path");
|
7
|
-
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
8
5
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
9
|
-
const
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
7
|
+
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
10
8
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
9
|
+
const ssr_dev_server_impl_1 = require("@nx/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl");
|
10
|
+
const fs_1 = require("fs");
|
11
|
+
const path_1 = require("path");
|
11
12
|
const lib_1 = require("./lib");
|
12
13
|
async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
13
14
|
const options = (0, lib_1.normalizeOptions)(ssrDevServerOptions);
|
14
15
|
let iter = (0, ssr_dev_server_impl_1.default)(options, context);
|
15
16
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
16
|
-
|
17
|
-
let pathToManifestFile = (0, path_1.join)(context.root, projectConfig.sourceRoot, 'assets/module-federation.manifest.json');
|
17
|
+
let pathToManifestFile = (0, path_1.join)(context.root, (0, ts_solution_setup_1.getProjectSourceRoot)(projectConfig), 'assets/module-federation.manifest.json');
|
18
18
|
if (options.pathToManifestFile) {
|
19
19
|
const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
|
20
20
|
if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
|
package/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { ModuleFederationStaticServerSchema } from './schema';
|
2
|
-
import { ModuleFederationDevServerOptions } from '../module-federation-dev-server/schema';
|
3
|
-
import { ExecutorContext } from 'nx/src/config/misc-interfaces';
|
4
1
|
import { StaticRemotesConfig } from '@nx/module-federation/src/utils';
|
2
|
+
import { ExecutorContext } from 'nx/src/config/misc-interfaces';
|
3
|
+
import { ModuleFederationDevServerOptions } from '../module-federation-dev-server/schema';
|
4
|
+
import { ModuleFederationStaticServerSchema } from './schema';
|
5
5
|
export declare function startProxies(staticRemotesConfig: StaticRemotesConfig, hostServeOptions: ModuleFederationDevServerOptions, mappedLocationOfHost: string, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
|
6
6
|
pathToCert: string;
|
7
7
|
pathToKey: string;
|
package/src/executors/module-federation-static-server/module-federation-static-server.impl.js
CHANGED
@@ -2,22 +2,23 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.startProxies = startProxies;
|
4
4
|
exports.default = moduleFederationStaticServer;
|
5
|
-
const path_1 = require("path");
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
7
|
-
const fs_1 = require("fs");
|
8
|
-
const utils_1 = require("@nx/module-federation/src/utils");
|
9
|
-
const utils_2 = require("@nx/module-federation/src/executors/utils");
|
10
|
-
const child_process_1 = require("child_process");
|
11
|
-
const process = require("node:process");
|
12
|
-
const file_server_impl_1 = require("@nx/web/src/executors/file-server/file-server.impl");
|
13
6
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
7
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
8
|
+
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
9
|
+
const utils_2 = require("@nx/module-federation/src/utils");
|
10
|
+
const file_server_impl_1 = require("@nx/web/src/executors/file-server/file-server.impl");
|
14
11
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
12
|
+
const child_process_1 = require("child_process");
|
13
|
+
const fs_1 = require("fs");
|
14
|
+
const process = require("node:process");
|
15
|
+
const path_1 = require("path");
|
15
16
|
function getBuildAndServeOptionsFromServeTarget(serveTarget, context) {
|
16
17
|
const target = (0, devkit_1.parseTargetString)(serveTarget, context);
|
17
18
|
const serveOptions = (0, devkit_1.readTargetOptions)(target, context);
|
18
19
|
const buildTarget = (0, devkit_1.parseTargetString)(serveOptions.buildTarget, context);
|
19
20
|
const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
|
20
|
-
let pathToManifestFile = (0, path_1.join)(context.root, context.projectGraph.nodes[context.projectName].data
|
21
|
+
let pathToManifestFile = (0, path_1.join)(context.root, (0, ts_solution_setup_1.getProjectSourceRoot)(context.projectGraph.nodes[context.projectName].data), 'assets/module-federation.manifest.json');
|
21
22
|
if (serveOptions.pathToManifestFile) {
|
22
23
|
const userPathToManifestFile = (0, path_1.join)(context.root, serveOptions.pathToManifestFile);
|
23
24
|
if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
|
@@ -163,15 +164,15 @@ async function* moduleFederationStaticServer(schema, context) {
|
|
163
164
|
// Get the remotes from the module federation config
|
164
165
|
const p = context.projectsConfigurations.projects[context.projectName];
|
165
166
|
const options = getBuildAndServeOptionsFromServeTarget(schema.serveTarget, context);
|
166
|
-
const moduleFederationConfig = (0,
|
167
|
-
const remotes = (0,
|
167
|
+
const moduleFederationConfig = (0, utils_2.getModuleFederationConfig)(options.buildOptions.tsConfig, context.root, p.root, 'react');
|
168
|
+
const remotes = (0, utils_2.getRemotes)([], options.serveOptions.skipRemotes, moduleFederationConfig, {
|
168
169
|
projectName: context.projectName,
|
169
170
|
projectGraph: context.projectGraph,
|
170
171
|
root: context.root,
|
171
172
|
}, options.pathToManifestFile);
|
172
|
-
const staticRemotesConfig = (0,
|
173
|
+
const staticRemotesConfig = (0, utils_2.parseStaticRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
|
173
174
|
options.serveOptions.staticRemotesPort ??= remotes.staticRemotePort;
|
174
|
-
const mappedLocationsOfStaticRemotes = await (0,
|
175
|
+
const mappedLocationsOfStaticRemotes = await (0, utils_1.buildStaticRemotes)(staticRemotesConfig, nxBin, context, options.serveOptions);
|
175
176
|
// Build the host
|
176
177
|
const hostUrlSegment = (0, path_1.basename)(options.buildOptions.outputPath);
|
177
178
|
const mappedLocationOfHost = `http${options.serveOptions.ssl ? 's' : ''}://${options.serveOptions.host}:${options.serveOptions.staticRemotesPort}/${hostUrlSegment}`;
|
@@ -4,16 +4,17 @@ exports.createComponentStoriesFile = createComponentStoriesFile;
|
|
4
4
|
exports.findPropsAndGenerateFile = findPropsAndGenerateFile;
|
5
5
|
exports.componentStoryGenerator = componentStoryGenerator;
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
7
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
8
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
7
9
|
const ast_utils_1 = require("../../utils/ast-utils");
|
8
10
|
const component_props_1 = require("../../utils/component-props");
|
9
|
-
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
10
11
|
let tsModule;
|
11
12
|
function createComponentStoriesFile(host, { project, componentPath, interactionTests }) {
|
12
13
|
if (!tsModule) {
|
13
14
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
14
15
|
}
|
15
16
|
const proj = (0, devkit_1.getProjects)(host).get(project);
|
16
|
-
const componentFilePath = (0, devkit_1.joinPathFragments)(
|
17
|
+
const componentFilePath = (0, devkit_1.joinPathFragments)((0, ts_solution_setup_1.getProjectSourceRoot)(proj, host), componentPath);
|
17
18
|
const componentDirectory = componentFilePath.replace(componentFilePath.slice(componentFilePath.lastIndexOf('/')), '');
|
18
19
|
const isPlainJs = componentFilePath.endsWith('.jsx') || componentFilePath.endsWith('.js');
|
19
20
|
const componentFileName = componentFilePath
|
@@ -2,11 +2,12 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.componentTestGenerator = componentTestGenerator;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
5
7
|
const path_1 = require("path");
|
6
8
|
const ast_utils_1 = require("../../utils/ast-utils");
|
7
9
|
const component_props_1 = require("../../utils/component-props");
|
8
10
|
const versions_1 = require("../../utils/versions");
|
9
|
-
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
10
11
|
let tsModule;
|
11
12
|
async function componentTestGenerator(tree, options) {
|
12
13
|
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
@@ -15,10 +16,11 @@ async function componentTestGenerator(tree, options) {
|
|
15
16
|
// normalize any windows paths
|
16
17
|
options.componentPath = options.componentPath.replace(/\\/g, '/');
|
17
18
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
18
|
-
const
|
19
|
-
|
19
|
+
const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(projectConfig, tree);
|
20
|
+
const normalizedPath = options.componentPath.startsWith(sourceRoot)
|
21
|
+
? (0, path_1.relative)(sourceRoot, options.componentPath)
|
20
22
|
: options.componentPath;
|
21
|
-
const componentPath = (0, devkit_1.joinPathFragments)(
|
23
|
+
const componentPath = (0, devkit_1.joinPathFragments)(sourceRoot, normalizedPath);
|
22
24
|
if (tree.exists(componentPath)) {
|
23
25
|
generateSpecsForComponents(tree, componentPath);
|
24
26
|
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.addFiles = addFiles;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
5
6
|
const versions_1 = require("nx/src/utils/versions");
|
6
7
|
const ct_utils_1 = require("../../../utils/ct-utils");
|
7
8
|
const component_test_1 = require("../../component-test/component-test");
|
@@ -32,7 +33,8 @@ async function addFiles(tree, projectConfig, options, found) {
|
|
32
33
|
}
|
33
34
|
if (options.generateTests) {
|
34
35
|
const filePaths = [];
|
35
|
-
(0,
|
36
|
+
const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(projectConfig, tree);
|
37
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, sourceRoot, (filePath) => {
|
36
38
|
if ((0, ct_utils_1.isComponent)(tree, filePath)) {
|
37
39
|
filePaths.push(filePath);
|
38
40
|
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.addModuleFederationFiles = addModuleFederationFiles;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
5
6
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
6
7
|
const create_application_files_1 = require("../../application/lib/create-application-files");
|
7
8
|
function addModuleFederationFiles(host, options, defaultRemoteManifest) {
|
@@ -33,7 +34,7 @@ function addModuleFederationFiles(host, options, defaultRemoteManifest) {
|
|
33
34
|
}),
|
34
35
|
};
|
35
36
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
36
|
-
const pathToMFManifest = (0, devkit_1.joinPathFragments)(projectConfig
|
37
|
+
const pathToMFManifest = (0, devkit_1.joinPathFragments)((0, ts_solution_setup_1.getProjectSourceRoot)(projectConfig, host), 'assets/module-federation.manifest.json');
|
37
38
|
// Module federation requires bootstrap code to be dynamically imported.
|
38
39
|
// Renaming original entry file so we can use `import(./bootstrap)` in
|
39
40
|
// new entry file.
|
@@ -56,7 +56,7 @@ async function normalizeOptions(host, options) {
|
|
56
56
|
if (appProjectType !== 'application') {
|
57
57
|
throw new Error(`appProject expected type of "application" but got "${appProjectType}"`);
|
58
58
|
}
|
59
|
-
const appSourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(
|
59
|
+
const appSourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(appProjectConfig, host);
|
60
60
|
normalized.appMain =
|
61
61
|
appProjectConfig.targets.build?.options?.main ??
|
62
62
|
findMainEntry(host, appProjectConfig.root);
|
@@ -1,14 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.reduxGenerator = reduxGenerator;
|
4
|
-
const path = require("path");
|
5
|
-
const ast_utils_1 = require("../../utils/ast-utils");
|
6
|
-
const versions_1 = require("../../utils/versions");
|
7
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
+
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
8
6
|
const js_1 = require("@nx/js");
|
9
7
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
10
|
-
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
11
8
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
9
|
+
const path = require("path");
|
10
|
+
const ast_utils_1 = require("../../utils/ast-utils");
|
11
|
+
const versions_1 = require("../../utils/versions");
|
12
12
|
let tsModule;
|
13
13
|
async function reduxGenerator(host, schema) {
|
14
14
|
const options = await normalizeOptions(host, schema);
|
@@ -109,7 +109,7 @@ async function normalizeOptions(host, options) {
|
|
109
109
|
if (appConfig.projectType !== 'application') {
|
110
110
|
throw new Error(`Expected ${options.appProject} to be an application but got ${appConfig.projectType}`);
|
111
111
|
}
|
112
|
-
appProjectSourcePath = appConfig
|
112
|
+
appProjectSourcePath = (0, ts_solution_setup_1.getProjectSourceRoot)(appConfig, host);
|
113
113
|
appMainFilePath = path.join(appProjectSourcePath, options.js ? 'main.js' : 'main.tsx');
|
114
114
|
if (!host.exists(appMainFilePath)) {
|
115
115
|
throw new Error(`Could not find ${appMainFilePath} during store configuration`);
|
@@ -2,8 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.updateHostWithRemote = updateHostWithRemote;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ast_utils_1 = require("../../../module-federation/ast-utils");
|
6
5
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
7
|
+
const ast_utils_1 = require("../../../module-federation/ast-utils");
|
7
8
|
let tsModule;
|
8
9
|
function updateHostWithRemote(host, hostName, remoteName) {
|
9
10
|
if (!tsModule) {
|
@@ -14,7 +15,7 @@ function updateHostWithRemote(host, hostName, remoteName) {
|
|
14
15
|
if (!host.exists(moduleFederationConfigPath)) {
|
15
16
|
moduleFederationConfigPath = (0, devkit_1.joinPathFragments)(hostConfig.root, 'module-federation.config.ts');
|
16
17
|
}
|
17
|
-
const appComponentPath = findAppComponentPath(host,
|
18
|
+
const appComponentPath = findAppComponentPath(host, (0, ts_solution_setup_1.getProjectSourceRoot)(hostConfig, host));
|
18
19
|
if (host.exists(moduleFederationConfigPath)) {
|
19
20
|
// find the host project path
|
20
21
|
// Update remotes inside ${host_path}/src/remotes.d.ts
|
@@ -2,22 +2,23 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.addModuleFederationFiles = addModuleFederationFiles;
|
4
4
|
exports.remoteGenerator = remoteGenerator;
|
5
|
-
const path_1 = require("path");
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
6
|
+
const path_1 = require("path");
|
7
|
+
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
8
|
+
const js_1 = require("@nx/js");
|
9
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
10
10
|
const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
|
11
|
-
const setup_ssr_1 = require("../setup-ssr/setup-ssr");
|
12
|
-
const setup_ssr_for_remote_1 = require("./lib/setup-ssr-for-remote");
|
13
|
-
const setup_tspath_for_remote_1 = require("./lib/setup-tspath-for-remote");
|
14
|
-
const add_remote_to_dynamic_host_1 = require("./lib/add-remote-to-dynamic-host");
|
15
11
|
const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
|
16
12
|
const maybe_js_1 = require("../../utils/maybe-js");
|
17
|
-
const js_1 = require("@nx/js");
|
18
13
|
const versions_1 = require("../../utils/versions");
|
19
|
-
const
|
14
|
+
const application_1 = require("../application/application");
|
20
15
|
const create_application_files_1 = require("../application/lib/create-application-files");
|
16
|
+
const normalize_options_1 = require("../application/lib/normalize-options");
|
17
|
+
const setup_ssr_1 = require("../setup-ssr/setup-ssr");
|
18
|
+
const add_remote_to_dynamic_host_1 = require("./lib/add-remote-to-dynamic-host");
|
19
|
+
const setup_ssr_for_remote_1 = require("./lib/setup-ssr-for-remote");
|
20
|
+
const setup_tspath_for_remote_1 = require("./lib/setup-tspath-for-remote");
|
21
|
+
const update_host_with_remote_1 = require("./lib/update-host-with-remote");
|
21
22
|
function addModuleFederationFiles(host, options) {
|
22
23
|
const templateVariables = options.bundler === 'rspack'
|
23
24
|
? {
|
@@ -135,7 +136,7 @@ async function remoteGenerator(host, schema) {
|
|
135
136
|
}
|
136
137
|
if (options.host && options.dynamic) {
|
137
138
|
const hostConfig = (0, devkit_1.readProjectConfiguration)(host, schema.host);
|
138
|
-
const pathToMFManifest = (0, devkit_1.joinPathFragments)(hostConfig
|
139
|
+
const pathToMFManifest = (0, devkit_1.joinPathFragments)((0, ts_solution_setup_1.getProjectSourceRoot)(hostConfig, host), 'assets/module-federation.manifest.json');
|
139
140
|
(0, add_remote_to_dynamic_host_1.addRemoteToDynamicHost)(host, options.projectName, options.devServerPort, pathToMFManifest);
|
140
141
|
}
|
141
142
|
(0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(host, options.bundler);
|
@@ -2,10 +2,11 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.setupSsrGenerator = setupSsrGenerator;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const versions_1 = require("../../utils/versions");
|
6
|
-
const ast_utils_1 = require("../../utils/ast-utils");
|
7
5
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
8
7
|
const path_1 = require("path");
|
8
|
+
const ast_utils_1 = require("../../utils/ast-utils");
|
9
|
+
const versions_1 = require("../../utils/versions");
|
9
10
|
let tsModule;
|
10
11
|
function readEntryFile(host, path) {
|
11
12
|
if (!tsModule) {
|
@@ -43,7 +44,7 @@ async function setupSsrGenerator(tree, options) {
|
|
43
44
|
].map((importPath) => {
|
44
45
|
return {
|
45
46
|
importPath,
|
46
|
-
filePath: (0, devkit_1.joinPathFragments)(
|
47
|
+
filePath: (0, devkit_1.joinPathFragments)((0, ts_solution_setup_1.getProjectSourceRoot)(projectConfig, tree), `${importPath}.tsx`),
|
47
48
|
};
|
48
49
|
});
|
49
50
|
const appComponentInfo = appImportCandidates.find((candidate) => tree.exists(candidate.filePath));
|
@@ -4,13 +4,13 @@ exports.projectRootPath = projectRootPath;
|
|
4
4
|
exports.containsComponentDeclaration = containsComponentDeclaration;
|
5
5
|
exports.createAllStories = createAllStories;
|
6
6
|
exports.storiesGenerator = storiesGenerator;
|
7
|
-
const component_story_1 = require("../component-story/component-story");
|
8
|
-
const ast_utils_1 = require("../../utils/ast-utils");
|
9
7
|
const devkit_1 = require("@nx/devkit");
|
10
|
-
const path_1 = require("path");
|
11
|
-
const minimatch_1 = require("minimatch");
|
12
8
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
13
9
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
10
|
+
const minimatch_1 = require("minimatch");
|
11
|
+
const path_1 = require("path");
|
12
|
+
const ast_utils_1 = require("../../utils/ast-utils");
|
13
|
+
const component_story_1 = require("../component-story/component-story");
|
14
14
|
let tsModule;
|
15
15
|
async function projectRootPath(tree, config) {
|
16
16
|
let projectDir;
|
@@ -32,7 +32,7 @@ async function projectRootPath(tree, config) {
|
|
32
32
|
else {
|
33
33
|
projectDir = '.';
|
34
34
|
}
|
35
|
-
return (0, devkit_1.joinPathFragments)(
|
35
|
+
return (0, devkit_1.joinPathFragments)((0, ts_solution_setup_1.getProjectSourceRoot)(config, tree), projectDir);
|
36
36
|
}
|
37
37
|
function containsComponentDeclaration(tree, componentPath) {
|
38
38
|
if (!tsModule) {
|