@nx/react 0.0.0-pr-26898-bf1fe0e → 0.0.0-pr-27085-57245c5
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 +1 -1
- package/mf/dynamic-federation.js +3 -4
- package/package.json +6 -6
- package/plugins/component-testing/index.js +1 -2
- package/plugins/component-testing/webpack-fallback.js +1 -2
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +1 -2
- package/plugins/with-react.js +1 -2
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -10
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +18 -38
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +3 -1
- package/src/generators/application/application.js +2 -3
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +1 -1
- package/src/generators/application/lib/add-e2e.js +1 -2
- package/src/generators/application/lib/add-jest.js +1 -2
- package/src/generators/application/lib/add-project.js +1 -2
- package/src/generators/application/lib/add-routing.js +1 -2
- package/src/generators/application/lib/create-application-files.js +1 -2
- package/src/generators/application/lib/find-free-port.js +1 -2
- package/src/generators/application/lib/get-app-tests.js +1 -2
- package/src/generators/application/lib/install-common-dependencies.js +1 -2
- package/src/generators/application/lib/normalize-options.js +3 -4
- package/src/generators/application/lib/set-defaults.js +1 -2
- package/src/generators/application/lib/show-possible-warnings.js +1 -2
- package/src/generators/application/lib/update-jest-config.js +1 -2
- package/src/generators/component/component.js +2 -3
- package/src/generators/component/lib/get-component-tests.js +1 -2
- package/src/generators/component/lib/normalize-options.js +1 -2
- package/src/generators/component-cypress-spec/component-cypress-spec.js +3 -4
- package/src/generators/component-story/component-story.js +3 -4
- package/src/generators/component-test/component-test.js +1 -2
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +2 -3
- package/src/generators/cypress-component-configuration/lib/add-files.js +1 -2
- package/src/generators/federate-module/federate-module.js +1 -2
- package/src/generators/federate-module/lib/utils.js +8 -9
- package/src/generators/hook/hook.js +2 -3
- package/src/generators/host/host.js +2 -3
- package/src/generators/host/lib/add-module-federation-files.js +6 -3
- package/src/generators/host/lib/normalize-remote.js +2 -3
- package/src/generators/host/lib/setup-ssr-for-host.js +1 -2
- package/src/generators/host/lib/update-module-federation-e2e-project.js +1 -2
- package/src/generators/init/init.js +1 -2
- package/src/generators/library/lib/add-linting.js +1 -2
- package/src/generators/library/lib/add-rollup-build-target.js +1 -2
- package/src/generators/library/lib/create-files.js +1 -2
- package/src/generators/library/lib/install-common-dependencies.js +1 -2
- package/src/generators/library/lib/normalize-options.js +1 -2
- package/src/generators/library/lib/set-defaults.js +1 -2
- package/src/generators/library/lib/update-app-routes.js +1 -2
- package/src/generators/library/library.js +2 -3
- package/src/generators/redux/redux.js +2 -3
- package/src/generators/remote/lib/add-remote-to-dynamic-host.js +8 -7
- package/src/generators/remote/lib/setup-ssr-for-remote.js +1 -2
- package/src/generators/remote/lib/setup-tspath-for-remote.js +1 -2
- package/src/generators/remote/lib/update-host-with-remote.js +1 -2
- package/src/generators/remote/remote.js +3 -4
- package/src/generators/setup-ssr/setup-ssr.js +1 -2
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +1 -2
- package/src/generators/setup-tailwind/lib/update-project.js +1 -2
- package/src/generators/setup-tailwind/setup-tailwind.js +1 -2
- package/src/generators/stories/stories.js +4 -5
- package/src/generators/storybook-configuration/configuration.js +3 -4
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +1 -1
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js +1 -1
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js +1 -1
- package/src/migrations/update-16-7-0/add-babel-core.js +1 -1
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.js +1 -1
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +1 -1
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +1 -1
- package/src/module-federation/ast-utils.js +3 -4
- package/src/module-federation/load-config.js +1 -2
- package/src/module-federation/package-json.js +1 -2
- package/src/module-federation/utils.js +2 -3
- package/src/module-federation/with-module-federation-ssr.js +13 -2
- package/src/module-federation/with-module-federation.js +13 -2
- package/src/rules/add-styled-dependencies.js +1 -2
- package/src/rules/update-module-federation-project.js +1 -2
- package/src/utils/add-mf-env-to-inputs.js +2 -3
- package/src/utils/assertion.js +1 -2
- package/src/utils/ast-utils.js +19 -20
- package/src/utils/component-props.js +3 -4
- package/src/utils/create-ts-config.js +2 -3
- package/src/utils/ct-utils.js +4 -5
- package/src/utils/format-file.js +1 -2
- package/src/utils/get-in-source-vitest-tests-template.js +1 -2
- package/src/utils/has-vite-plugin.js +1 -2
- package/src/utils/has-webpack-plugin.js +1 -2
- package/src/utils/jest-utils.js +1 -2
- package/src/utils/lint.d.ts +12 -12
- package/src/utils/maybe-js.js +1 -2
- package/src/utils/testing-generators.js +2 -3
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/tailwind.js +1 -2
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ npx nx@latest init
|
|
|
61
61
|
- [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
|
|
62
62
|
- [Intro to Nx](https://nx.dev/getting-started/intro)
|
|
63
63
|
- [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
|
|
64
|
-
- [Blog Posts About Nx](https://
|
|
64
|
+
- [Blog Posts About Nx](https://nx.dev/blog)
|
|
65
65
|
|
|
66
66
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
67
67
|
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
package/mf/dynamic-federation.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setRemoteUrlResolver = setRemoteUrlResolver;
|
|
4
|
+
exports.setRemoteDefinitions = setRemoteDefinitions;
|
|
5
|
+
exports.loadRemoteModule = loadRemoteModule;
|
|
4
6
|
let remoteUrlDefinitions;
|
|
5
7
|
let resolveRemoteUrl;
|
|
6
8
|
const remoteModuleMap = new Map();
|
|
@@ -9,11 +11,9 @@ let initialSharingScopeCreated = false;
|
|
|
9
11
|
function setRemoteUrlResolver(_resolveRemoteUrl) {
|
|
10
12
|
resolveRemoteUrl = _resolveRemoteUrl;
|
|
11
13
|
}
|
|
12
|
-
exports.setRemoteUrlResolver = setRemoteUrlResolver;
|
|
13
14
|
function setRemoteDefinitions(definitions) {
|
|
14
15
|
remoteUrlDefinitions = definitions;
|
|
15
16
|
}
|
|
16
|
-
exports.setRemoteDefinitions = setRemoteDefinitions;
|
|
17
17
|
async function loadRemoteModule(remoteName, moduleName) {
|
|
18
18
|
const remoteModuleKey = `${remoteName}:${moduleName}`;
|
|
19
19
|
if (remoteModuleMap.has(remoteModuleKey)) {
|
|
@@ -27,7 +27,6 @@ async function loadRemoteModule(remoteName, moduleName) {
|
|
|
27
27
|
remoteModuleMap.set(remoteModuleKey, Module);
|
|
28
28
|
return Module;
|
|
29
29
|
}
|
|
30
|
-
exports.loadRemoteModule = loadRemoteModule;
|
|
31
30
|
const fetchRemoteModule = (url, remoteName) => {
|
|
32
31
|
return new Promise((resolve, reject) => {
|
|
33
32
|
const script = document.createElement('script');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-27085-57245c5",
|
|
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": {
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"minimatch": "9.0.3",
|
|
40
40
|
"tslib": "^2.3.0",
|
|
41
41
|
"@module-federation/enhanced": "~0.2.3",
|
|
42
|
-
"@nx/devkit": "0.0.0-pr-
|
|
43
|
-
"@nx/js": "0.0.0-pr-
|
|
44
|
-
"@nx/eslint": "0.0.0-pr-
|
|
45
|
-
"@nx/web": "0.0.0-pr-
|
|
46
|
-
"@nrwl/react": "0.0.0-pr-
|
|
42
|
+
"@nx/devkit": "0.0.0-pr-27085-57245c5",
|
|
43
|
+
"@nx/js": "0.0.0-pr-27085-57245c5",
|
|
44
|
+
"@nx/eslint": "0.0.0-pr-27085-57245c5",
|
|
45
|
+
"@nx/web": "0.0.0-pr-27085-57245c5",
|
|
46
|
+
"@nrwl/react": "0.0.0-pr-27085-57245c5"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nxComponentTestingPreset =
|
|
3
|
+
exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
|
4
4
|
const cypress_preset_1 = require("@nx/cypress/plugins/cypress-preset");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const ct_helpers_1 = require("@nx/cypress/src/utils/ct-helpers");
|
|
@@ -111,7 +111,6 @@ function nxComponentTestingPreset(pathToConfig, options) {
|
|
|
111
111
|
},
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
|
115
114
|
/**
|
|
116
115
|
* apply the schema.json defaults from the @nx/web:webpack executor to the target options
|
|
117
116
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildBaseWebpackConfig =
|
|
3
|
+
exports.buildBaseWebpackConfig = buildBaseWebpackConfig;
|
|
4
4
|
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
5
5
|
const webpack_1 = require("@nx/webpack");
|
|
6
6
|
function buildBaseWebpackConfig({ tsConfigPath = 'tsconfig.cy.json', compiler = 'babel', }) {
|
|
@@ -72,7 +72,6 @@ function buildBaseWebpackConfig({ tsConfigPath = 'tsconfig.cy.json', compiler =
|
|
|
72
72
|
}
|
|
73
73
|
return config;
|
|
74
74
|
}
|
|
75
|
-
exports.buildBaseWebpackConfig = buildBaseWebpackConfig;
|
|
76
75
|
const loaderModulesOptions = {
|
|
77
76
|
modules: {
|
|
78
77
|
mode: 'local',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyReactConfig =
|
|
3
|
+
exports.applyReactConfig = applyReactConfig;
|
|
4
4
|
function applyReactConfig(options, config = {}) {
|
|
5
5
|
if (!process.env['NX_TASK_TARGET_PROJECT'])
|
|
6
6
|
return;
|
|
@@ -56,7 +56,6 @@ function applyReactConfig(options, config = {}) {
|
|
|
56
56
|
__filename: true,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
exports.applyReactConfig = applyReactConfig;
|
|
60
59
|
function addHotReload(config) {
|
|
61
60
|
if (config.mode === 'development' && config['devServer']?.hot) {
|
|
62
61
|
// add `react-refresh/babel` to babel loader plugin
|
package/plugins/with-react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withReact =
|
|
3
|
+
exports.withReact = withReact;
|
|
4
4
|
const apply_react_config_1 = require("./nx-react-webpack-plugin/lib/apply-react-config");
|
|
5
5
|
const processed = new Set();
|
|
6
6
|
/**
|
|
@@ -19,4 +19,3 @@ function withReact(pluginOptions = {}) {
|
|
|
19
19
|
return config;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
exports.withReact = withReact;
|
|
@@ -12,16 +12,6 @@ type ModuleFederationDevServerOptions = WebDevServerOptions & {
|
|
|
12
12
|
staticRemotesPort?: number;
|
|
13
13
|
pathToManifestFile?: string;
|
|
14
14
|
};
|
|
15
|
-
type StaticRemoteConfig = {
|
|
16
|
-
basePath: string;
|
|
17
|
-
outputPath: string;
|
|
18
|
-
urlSegment: string;
|
|
19
|
-
};
|
|
20
|
-
type StaticRemotesConfig = {
|
|
21
|
-
remotes: string[];
|
|
22
|
-
config: Record<string, StaticRemoteConfig> | undefined;
|
|
23
|
-
};
|
|
24
|
-
export declare function parseStaticRemotesConfig(staticRemotes: string[] | undefined, context: ExecutorContext): StaticRemotesConfig;
|
|
25
15
|
export default function moduleFederationDevServer(options: ModuleFederationDevServerOptions, context: ExecutorContext): AsyncIterableIterator<{
|
|
26
16
|
success: boolean;
|
|
27
17
|
baseUrl?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.default = moduleFederationDevServer;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const dev_server_impl_1 = require("@nx/webpack/src/executors/dev-server/dev-server.impl");
|
|
6
6
|
const file_server_impl_1 = require("@nx/web/src/executors/file-server/file-server.impl");
|
|
@@ -13,6 +13,8 @@ const node_path_1 = require("node:path");
|
|
|
13
13
|
const node_fs_1 = require("node:fs");
|
|
14
14
|
const fs_1 = require("fs");
|
|
15
15
|
const path_1 = require("path");
|
|
16
|
+
const start_remote_proxies_1 = require("@nx/webpack/src/utils/module-federation/start-remote-proxies");
|
|
17
|
+
const parse_static_remotes_config_1 = require("@nx/webpack/src/utils/module-federation/parse-static-remotes-config");
|
|
16
18
|
function getBuildOptions(buildTarget, context) {
|
|
17
19
|
const target = (0, devkit_1.parseTargetString)(buildTarget, context);
|
|
18
20
|
const buildOptions = (0, devkit_1.readTargetOptions)(target, context);
|
|
@@ -21,6 +23,10 @@ function getBuildOptions(buildTarget, context) {
|
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
25
|
function startStaticRemotesFileServer(staticRemotesConfig, context, options) {
|
|
26
|
+
if (!staticRemotesConfig.remotes ||
|
|
27
|
+
staticRemotesConfig.remotes.length === 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
24
30
|
let shouldMoveToCommonLocation = false;
|
|
25
31
|
let commonOutputDirectory;
|
|
26
32
|
for (const app of staticRemotesConfig.remotes) {
|
|
@@ -55,6 +61,7 @@ function startStaticRemotesFileServer(staticRemotesConfig, context, options) {
|
|
|
55
61
|
ssl: options.ssl,
|
|
56
62
|
sslCert: options.sslCert,
|
|
57
63
|
sslKey: options.sslKey,
|
|
64
|
+
cacheSeconds: -1,
|
|
58
65
|
}, context);
|
|
59
66
|
return staticRemotesIter;
|
|
60
67
|
}
|
|
@@ -136,24 +143,9 @@ async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options)
|
|
|
136
143
|
process.on('SIGTERM', () => staticProcess.kill('SIGTERM'));
|
|
137
144
|
process.on('exit', () => staticProcess.kill('SIGTERM'));
|
|
138
145
|
});
|
|
146
|
+
return mappedLocationOfRemotes;
|
|
139
147
|
}
|
|
140
|
-
function parseStaticRemotesConfig(staticRemotes, context) {
|
|
141
|
-
if (!staticRemotes?.length) {
|
|
142
|
-
return { remotes: [], config: undefined };
|
|
143
|
-
}
|
|
144
|
-
const config = {};
|
|
145
|
-
for (const app of staticRemotes) {
|
|
146
|
-
const outputPath = context.projectGraph.nodes[app].data.targets['build'].options.outputPath;
|
|
147
|
-
const basePath = (0, node_path_1.dirname)(outputPath);
|
|
148
|
-
const urlSegment = (0, node_path_1.basename)(outputPath);
|
|
149
|
-
config[app] = { basePath, outputPath, urlSegment };
|
|
150
|
-
}
|
|
151
|
-
return { remotes: staticRemotes, config };
|
|
152
|
-
}
|
|
153
|
-
exports.parseStaticRemotesConfig = parseStaticRemotesConfig;
|
|
154
148
|
async function* moduleFederationDevServer(options, context) {
|
|
155
|
-
const initialStaticRemotesPorts = options.staticRemotesPort;
|
|
156
|
-
options.staticRemotesPort ??= options.port + 1;
|
|
157
149
|
// Force Node to resolve to look for the nx binary that is inside node_modules
|
|
158
150
|
const nxBin = require.resolve('nx/bin/nx');
|
|
159
151
|
const currIter = options.static
|
|
@@ -163,6 +155,7 @@ async function* moduleFederationDevServer(options, context) {
|
|
|
163
155
|
withDeps: false,
|
|
164
156
|
spa: false,
|
|
165
157
|
cors: true,
|
|
158
|
+
cacheSeconds: -1,
|
|
166
159
|
}, context)
|
|
167
160
|
: (0, dev_server_impl_1.default)(options, context);
|
|
168
161
|
const p = context.projectsConfigurations.projects[context.projectName];
|
|
@@ -188,27 +181,15 @@ async function* moduleFederationDevServer(options, context) {
|
|
|
188
181
|
projectGraph: context.projectGraph,
|
|
189
182
|
root: context.root,
|
|
190
183
|
}, pathToManifestFile);
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (remotePort >= portToUse) {
|
|
197
|
-
return remotePort + 1;
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
return portToUse;
|
|
201
|
-
}
|
|
202
|
-
}, options.staticRemotesPort);
|
|
203
|
-
}
|
|
204
|
-
const staticRemotesConfig = parseStaticRemotesConfig(remotes.staticRemotes, context);
|
|
205
|
-
await buildStaticRemotes(staticRemotesConfig, nxBin, context, options);
|
|
184
|
+
options.staticRemotesPort ??= remotes.staticRemotePort;
|
|
185
|
+
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
186
|
+
process.env.NX_MF_DEV_REMOTES = JSON.stringify(remotes.devRemotes.map((r) => (typeof r === 'string' ? r : r.remoteName)));
|
|
187
|
+
const staticRemotesConfig = (0, parse_static_remotes_config_1.parseStaticRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
|
|
188
|
+
const mappedLocationsOfStaticRemotes = await buildStaticRemotes(staticRemotesConfig, nxBin, context, options);
|
|
206
189
|
const devRemoteIters = await startRemotes(remotes.devRemotes, context, options, 'serve');
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
: undefined;
|
|
211
|
-
return yield* (0, async_iterable_1.combineAsyncIterables)(currIter, ...devRemoteIters, ...dynamicRemotesIters, ...(staticRemotesIter ? [staticRemotesIter] : []), (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
|
|
190
|
+
const staticRemotesIter = startStaticRemotesFileServer(staticRemotesConfig, context, options);
|
|
191
|
+
(0, start_remote_proxies_1.startRemoteProxies)(staticRemotesConfig, mappedLocationsOfStaticRemotes);
|
|
192
|
+
return yield* (0, async_iterable_1.combineAsyncIterables)(currIter, ...devRemoteIters, ...(staticRemotesIter ? [staticRemotesIter] : []), (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
|
|
212
193
|
if (!options.isInitialHost) {
|
|
213
194
|
done();
|
|
214
195
|
return;
|
|
@@ -241,4 +222,3 @@ async function* moduleFederationDevServer(options, context) {
|
|
|
241
222
|
}
|
|
242
223
|
}));
|
|
243
224
|
}
|
|
244
|
-
exports.default = moduleFederationDevServer;
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = moduleFederationSsrDevServer;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const ssr_dev_server_impl_1 = require("@nx/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl");
|
|
5
6
|
const path_1 = require("path");
|
|
@@ -65,6 +66,8 @@ async function* moduleFederationSsrDevServer(options, context) {
|
|
|
65
66
|
: Array.isArray(options.devRemotes)
|
|
66
67
|
? options.devRemotes
|
|
67
68
|
: [options.devRemotes];
|
|
69
|
+
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
70
|
+
process.env.NX_MF_DEV_REMOTES = JSON.stringify(devServeApps);
|
|
68
71
|
for (const app of knownRemotes) {
|
|
69
72
|
const [appName] = Array.isArray(app) ? app : [app];
|
|
70
73
|
const isDev = devServeApps.includes(appName);
|
|
@@ -103,4 +106,3 @@ async function* moduleFederationSsrDevServer(options, context) {
|
|
|
103
106
|
}
|
|
104
107
|
});
|
|
105
108
|
}
|
|
106
|
-
exports.default = moduleFederationSsrDevServer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.applicationGenerator = applicationGenerator;
|
|
4
|
+
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
4
5
|
const lint_1 = require("../../utils/lint");
|
|
5
6
|
const create_application_files_1 = require("./lib/create-application-files");
|
|
6
7
|
const update_jest_config_1 = require("./lib/update-jest-config");
|
|
@@ -59,7 +60,6 @@ async function applicationGenerator(host, schema) {
|
|
|
59
60
|
...schema,
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
|
-
exports.applicationGenerator = applicationGenerator;
|
|
63
63
|
async function applicationGeneratorInternal(host, schema) {
|
|
64
64
|
const tasks = [];
|
|
65
65
|
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
@@ -241,5 +241,4 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
241
241
|
});
|
|
242
242
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
243
243
|
}
|
|
244
|
-
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
245
244
|
exports.default = applicationGenerator;
|
|
@@ -505,7 +505,7 @@ export function NxWelcome({ title }: { title: string }) {
|
|
|
505
505
|
</svg>
|
|
506
506
|
</a>
|
|
507
507
|
<a
|
|
508
|
-
href="https://blog
|
|
508
|
+
href="https://nx.dev/blog/?utm_source=nx-project"
|
|
509
509
|
target="_blank"
|
|
510
510
|
rel="noreferrer"
|
|
511
511
|
className="list-item-link"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addE2e =
|
|
3
|
+
exports.addE2e = addE2e;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const web_1 = require("@nx/web");
|
|
6
6
|
const versions_1 = require("../../../utils/versions");
|
|
@@ -77,4 +77,3 @@ async function addE2e(tree, options) {
|
|
|
77
77
|
return () => { };
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
exports.addE2e = addE2e;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addJest =
|
|
3
|
+
exports.addJest = addJest;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../../../utils/versions");
|
|
6
6
|
async function addJest(host, options) {
|
|
@@ -18,4 +18,3 @@ async function addJest(host, options) {
|
|
|
18
18
|
skipFormat: true,
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
exports.addJest = addJest;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addProject =
|
|
3
|
+
exports.addProject = addProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
6
6
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
@@ -24,7 +24,6 @@ function addProject(host, options) {
|
|
|
24
24
|
...project,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
exports.addProject = addProject;
|
|
28
27
|
function createBuildTarget(options) {
|
|
29
28
|
return {
|
|
30
29
|
executor: '@nx/webpack:webpack',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addRouting =
|
|
3
|
+
exports.addRouting = addRouting;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
6
6
|
const ast_utils_1 = require("../../../utils/ast-utils");
|
|
@@ -24,4 +24,3 @@ function addRouting(host, options) {
|
|
|
24
24
|
}
|
|
25
25
|
return () => { };
|
|
26
26
|
}
|
|
27
|
-
exports.addRouting = addRouting;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createApplicationFiles =
|
|
3
|
+
exports.createApplicationFiles = createApplicationFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -121,7 +121,6 @@ function createApplicationFiles(host, options) {
|
|
|
121
121
|
}
|
|
122
122
|
(0, create_ts_config_1.createTsConfig)(host, options.appProjectRoot, 'app', options, relativePathToRootTsConfig);
|
|
123
123
|
}
|
|
124
|
-
exports.createApplicationFiles = createApplicationFiles;
|
|
125
124
|
function createNxWebpackPluginOptions(options) {
|
|
126
125
|
return {
|
|
127
126
|
target: 'web',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findFreePort =
|
|
3
|
+
exports.findFreePort = findFreePort;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function findFreePort(host) {
|
|
6
6
|
const projects = (0, devkit_1.getProjects)(host);
|
|
@@ -13,4 +13,3 @@ function findFreePort(host) {
|
|
|
13
13
|
}
|
|
14
14
|
return port > 0 ? port + 1 : 4200;
|
|
15
15
|
}
|
|
16
|
-
exports.findFreePort = findFreePort;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAppTests =
|
|
3
|
+
exports.getAppTests = getAppTests;
|
|
4
4
|
function getAppTests(options) {
|
|
5
5
|
return `
|
|
6
6
|
it('should render successfully', () => {
|
|
@@ -18,4 +18,3 @@ it('should have a greeting as the title', () => {
|
|
|
18
18
|
});
|
|
19
19
|
`;
|
|
20
20
|
}
|
|
21
|
-
exports.getAppTests = getAppTests;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.installCommonDependencies =
|
|
3
|
+
exports.installCommonDependencies = installCommonDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../../../utils/versions");
|
|
6
6
|
function installCommonDependencies(host, options) {
|
|
@@ -44,4 +44,3 @@ function installCommonDependencies(host, options) {
|
|
|
44
44
|
}
|
|
45
45
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies);
|
|
46
46
|
}
|
|
47
|
-
exports.installCommonDependencies = installCommonDependencies;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.normalizeDirectory = normalizeDirectory;
|
|
4
|
+
exports.normalizeProjectName = normalizeProjectName;
|
|
5
|
+
exports.normalizeOptions = normalizeOptions;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
8
|
const assertion_1 = require("../../../utils/assertion");
|
|
@@ -12,11 +14,9 @@ function normalizeDirectory(options) {
|
|
|
12
14
|
? `${(0, devkit_1.names)(projectDirectory).fileName}/${(0, devkit_1.names)(options.name).fileName}`
|
|
13
15
|
: (0, devkit_1.names)(options.name).fileName;
|
|
14
16
|
}
|
|
15
|
-
exports.normalizeDirectory = normalizeDirectory;
|
|
16
17
|
function normalizeProjectName(options) {
|
|
17
18
|
return normalizeDirectory(options).replace(new RegExp('/', 'g'), '-');
|
|
18
19
|
}
|
|
19
|
-
exports.normalizeProjectName = normalizeProjectName;
|
|
20
20
|
async function normalizeOptions(host, options, callingGenerator = '@nx/react:application') {
|
|
21
21
|
const { projectName: appProjectName, projectRoot: appProjectRoot, projectNameAndRootFormat, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
22
22
|
name: options.name,
|
|
@@ -96,4 +96,3 @@ async function normalizeOptions(host, options, callingGenerator = '@nx/react:app
|
|
|
96
96
|
normalized.minimal = normalized.minimal ?? false;
|
|
97
97
|
return normalized;
|
|
98
98
|
}
|
|
99
|
-
exports.normalizeOptions = normalizeOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setDefaults =
|
|
3
|
+
exports.setDefaults = setDefaults;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function setDefaults(host, options) {
|
|
6
6
|
if (options.skipNxJson) {
|
|
@@ -40,4 +40,3 @@ function setDefaults(host, options) {
|
|
|
40
40
|
};
|
|
41
41
|
(0, devkit_1.updateNxJson)(host, nxJson);
|
|
42
42
|
}
|
|
43
|
-
exports.setDefaults = setDefaults;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.showPossibleWarnings =
|
|
3
|
+
exports.showPossibleWarnings = showPossibleWarnings;
|
|
4
4
|
const chalk = require("chalk");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
function showPossibleWarnings(tree, options) {
|
|
@@ -8,4 +8,3 @@ function showPossibleWarnings(tree, options) {
|
|
|
8
8
|
devkit_1.logger.warn(`styled-jsx may not work with SWC. Try using ${chalk.bold('nx g @nx/react:app --compiler=babel')} instead.`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
exports.showPossibleWarnings = showPossibleWarnings;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateSpecConfig =
|
|
3
|
+
exports.updateSpecConfig = updateSpecConfig;
|
|
4
4
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
5
5
|
const jest_utils_1 = require("../../../utils/jest-utils");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -27,4 +27,3 @@ function updateSpecConfig(host, options) {
|
|
|
27
27
|
const content = (0, jest_utils_1.updateJestConfigContent)(originalContent);
|
|
28
28
|
host.write(configPath, content);
|
|
29
29
|
}
|
|
30
|
-
exports.updateSpecConfig = updateSpecConfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.componentGenerator = componentGenerator;
|
|
4
|
+
exports.componentGeneratorInternal = componentGeneratorInternal;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
6
7
|
const path_1 = require("path");
|
|
@@ -16,7 +17,6 @@ async function componentGenerator(host, schema) {
|
|
|
16
17
|
...schema,
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
exports.componentGenerator = componentGenerator;
|
|
20
20
|
async function componentGeneratorInternal(host, schema) {
|
|
21
21
|
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
22
22
|
createComponentFiles(host, options);
|
|
@@ -33,7 +33,6 @@ async function componentGeneratorInternal(host, schema) {
|
|
|
33
33
|
}
|
|
34
34
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
35
35
|
}
|
|
36
|
-
exports.componentGeneratorInternal = componentGeneratorInternal;
|
|
37
36
|
function createComponentFiles(host, options) {
|
|
38
37
|
const componentTests = (0, get_component_tests_1.getComponentTests)(options);
|
|
39
38
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, './files'), options.directory, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getComponentTests =
|
|
3
|
+
exports.getComponentTests = getComponentTests;
|
|
4
4
|
function getComponentTests(schema) {
|
|
5
5
|
return `
|
|
6
6
|
it('should render successfully', () => {
|
|
@@ -9,4 +9,3 @@ function getComponentTests(schema) {
|
|
|
9
9
|
});
|
|
10
10
|
`;
|
|
11
11
|
}
|
|
12
|
-
exports.getComponentTests = getComponentTests;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeOptions =
|
|
3
|
+
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
6
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
@@ -47,4 +47,3 @@ async function normalizeOptions(tree, options) {
|
|
|
47
47
|
projectSourceRoot: projectSourceRoot ?? projectRoot,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
exports.normalizeOptions = normalizeOptions;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.componentCypressGenerator = componentCypressGenerator;
|
|
4
|
+
exports.getArgsDefaultValue = getArgsDefaultValue;
|
|
5
|
+
exports.createComponentSpecFile = createComponentSpecFile;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const path_1 = require("path");
|
|
6
8
|
const ast_utils_1 = require("../../utils/ast-utils");
|
|
@@ -12,7 +14,6 @@ async function componentCypressGenerator(host, schema) {
|
|
|
12
14
|
await (0, devkit_1.formatFiles)(host);
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
|
-
exports.componentCypressGenerator = componentCypressGenerator;
|
|
16
17
|
// TODO: candidate to refactor with the angular component story
|
|
17
18
|
function getArgsDefaultValue(property) {
|
|
18
19
|
if (!tsModule) {
|
|
@@ -34,7 +35,6 @@ function getArgsDefaultValue(property) {
|
|
|
34
35
|
return resolvedValue;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
exports.getArgsDefaultValue = getArgsDefaultValue;
|
|
38
38
|
function createComponentSpecFile(tree, { project, componentPath, js, cypressProject }) {
|
|
39
39
|
if (!tsModule) {
|
|
40
40
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -73,7 +73,6 @@ function createComponentSpecFile(tree, { project, componentPath, js, cypressProj
|
|
|
73
73
|
findPropsAndGenerateFileForCypress(tree, sourceFile, cmpDeclaration, e2eLibIntegrationFolderPath, componentName, project, js);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
exports.createComponentSpecFile = createComponentSpecFile;
|
|
77
76
|
function findPropsAndGenerateFileForCypress(tree, sourceFile, cmpDeclaration, e2eLibIntegrationFolderPath, componentName, project, js, fromNodeArray) {
|
|
78
77
|
const propsInterface = (0, ast_utils_1.getComponentPropsInterface)(sourceFile, cmpDeclaration);
|
|
79
78
|
let props = [];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createComponentStoriesFile = createComponentStoriesFile;
|
|
4
|
+
exports.findPropsAndGenerateFile = findPropsAndGenerateFile;
|
|
5
|
+
exports.componentStoryGenerator = componentStoryGenerator;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const ast_utils_1 = require("../../utils/ast-utils");
|
|
6
8
|
const component_props_1 = require("../../utils/component-props");
|
|
@@ -42,7 +44,6 @@ function createComponentStoriesFile(host, { project, componentPath, interactionT
|
|
|
42
44
|
findPropsAndGenerateFile(host, sourceFile, cmpDeclaration, componentDirectory, name, interactionTests, isPlainJs);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
|
-
exports.createComponentStoriesFile = createComponentStoriesFile;
|
|
46
47
|
function findPropsAndGenerateFile(host, sourceFile, cmpDeclaration, componentDirectory, name, interactionTests, isPlainJs, fromNodeArray) {
|
|
47
48
|
const { propsTypeName, props, argTypes } = (0, component_props_1.getDefaultsForComponent)(sourceFile, cmpDeclaration);
|
|
48
49
|
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, `./files${isPlainJs ? '/jsx' : '/tsx'}`), (0, devkit_1.normalizePath)(componentDirectory), {
|
|
@@ -58,7 +59,6 @@ function findPropsAndGenerateFile(host, sourceFile, cmpDeclaration, componentDir
|
|
|
58
59
|
interactionTests,
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
|
-
exports.findPropsAndGenerateFile = findPropsAndGenerateFile;
|
|
62
62
|
async function componentStoryGenerator(host, schema) {
|
|
63
63
|
createComponentStoriesFile(host, {
|
|
64
64
|
...schema,
|
|
@@ -68,5 +68,4 @@ async function componentStoryGenerator(host, schema) {
|
|
|
68
68
|
await (0, devkit_1.formatFiles)(host);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
exports.componentStoryGenerator = componentStoryGenerator;
|
|
72
71
|
exports.default = componentStoryGenerator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.componentTestGenerator =
|
|
3
|
+
exports.componentTestGenerator = componentTestGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const ast_utils_1 = require("../../utils/ast-utils");
|
|
@@ -23,7 +23,6 @@ async function componentTestGenerator(tree, options) {
|
|
|
23
23
|
generateSpecsForComponents(tree, componentPath);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
exports.componentTestGenerator = componentTestGenerator;
|
|
27
26
|
function generateSpecsForComponents(tree, filePath) {
|
|
28
27
|
if (!tsModule) {
|
|
29
28
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|