@nx/react 23.0.0-beta.2 → 23.0.0-beta.20
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/index.d.ts +0 -3
- package/index.d.ts.map +1 -1
- package/index.js +1 -4
- package/migrations.json +6 -0
- package/package.json +18 -18
- package/plugins/component-testing/index.js +7 -7
- package/plugins/component-testing/webpack-fallback.js +2 -2
- package/plugins/storybook/index.js +3 -3
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +4 -4
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +5 -5
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +4 -4
- package/src/generators/application/application.d.ts.map +1 -1
- package/src/generators/application/application.js +32 -18
- package/src/generators/application/lib/add-e2e.d.ts.map +1 -1
- package/src/generators/application/lib/add-linting.js +10 -11
- package/src/generators/application/lib/add-project.d.ts.map +1 -1
- package/src/generators/application/lib/add-project.js +10 -0
- package/src/generators/application/lib/add-routing.js +2 -2
- package/src/generators/application/lib/bundlers/add-vite.d.ts.map +1 -1
- package/src/generators/application/lib/bundlers/add-vite.js +10 -2
- package/src/generators/application/lib/create-application-files.d.ts +1 -1
- package/src/generators/application/lib/create-application-files.js +2 -2
- package/src/generators/application/lib/normalize-options.js +5 -5
- package/src/generators/component/component.js +2 -2
- package/src/generators/component/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/component/lib/normalize-options.js +5 -6
- package/src/generators/component/schema.d.ts +2 -7
- package/src/generators/component/schema.json +0 -5
- package/src/generators/component-story/component-story.d.ts.map +1 -1
- package/src/generators/component-story/component-story.js +3 -4
- package/src/generators/component-test/component-test.d.ts.map +1 -1
- package/src/generators/component-test/component-test.js +3 -4
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +1 -1
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts.map +1 -1
- package/src/generators/cypress-component-configuration/lib/add-files.js +4 -4
- 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/federate-module/lib/utils.js +2 -2
- package/src/generators/hook/hook.d.ts.map +1 -1
- package/src/generators/hook/hook.js +5 -6
- package/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +2 -2
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +2 -2
- package/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +2 -2
- package/src/generators/host/host.d.ts.map +1 -1
- package/src/generators/host/host.js +5 -5
- package/src/generators/host/lib/add-module-federation-files.d.ts.map +1 -1
- package/src/generators/host/lib/add-module-federation-files.js +3 -3
- package/src/generators/host/lib/normalize-host-name.js +2 -2
- package/src/generators/host/lib/update-module-federation-tsconfig.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/add-linting.js +7 -8
- package/src/generators/library/lib/add-rollup-build-target.d.ts.map +1 -1
- package/src/generators/library/lib/add-rollup-build-target.js +6 -0
- package/src/generators/library/lib/install-common-dependencies.js +2 -2
- package/src/generators/library/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/library/lib/normalize-options.js +7 -7
- package/src/generators/library/lib/update-app-routes.js +2 -2
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +14 -18
- package/src/generators/redux/redux.d.ts.map +1 -1
- package/src/generators/redux/redux.js +7 -8
- package/src/generators/redux/schema.d.ts +1 -1
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +1 -1
- package/src/generators/remote/lib/setup-package-json-exports-for-remote.js +2 -2
- package/src/generators/remote/lib/update-host-with-remote.js +4 -5
- package/src/generators/remote/remote.d.ts.map +1 -1
- package/src/generators/remote/remote.js +7 -7
- package/src/generators/setup-ssr/setup-ssr.d.ts.map +1 -1
- package/src/generators/setup-ssr/setup-ssr.js +5 -7
- package/src/generators/stories/stories.js +5 -6
- 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/migrations/update-23-0-0/remove-nx-react-webpack-plugin-import.d.ts +3 -0
- package/src/migrations/update-23-0-0/remove-nx-react-webpack-plugin-import.d.ts.map +1 -0
- package/src/migrations/update-23-0-0/remove-nx-react-webpack-plugin-import.js +128 -0
- package/src/module-federation/ast-utils.js +2 -2
- package/src/plugins/router-plugin.d.ts.map +1 -1
- package/src/plugins/router-plugin.js +14 -23
- package/src/rules/update-module-federation-project.js +3 -3
- package/src/utils/add-mf-env-to-inputs.d.ts.map +1 -1
- package/src/utils/add-mf-env-to-inputs.js +15 -8
- package/src/utils/ast-utils.js +15 -15
- package/src/utils/component-props.js +3 -3
- package/src/utils/create-ts-config.js +3 -3
- package/src/utils/ct-utils.d.ts +1 -1
- package/src/utils/ct-utils.d.ts.map +1 -1
- package/src/utils/ct-utils.js +6 -6
- package/src/utils/normalize-remote.js +2 -2
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/tailwind.js +2 -2
package/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { NxReactWebpackPlugin as _NxReactWebpackPlugin } from './plugins/nx-react-webpack-plugin/nx-react-webpack-plugin';
|
|
2
|
-
/** @deprecated Use '@nx/react/webpack-plugin' instead, which can improve graph creation by 150-200ms per file. */
|
|
3
|
-
export declare const NxReactWebpackPlugin: typeof _NxReactWebpackPlugin;
|
|
4
1
|
export { extraEslintDependencies, extendReactEslintJson, } from './src/utils/lint';
|
|
5
2
|
export { assertValidStyle } from './src/utils/assertion';
|
|
6
3
|
export { reactDomVersion, reactVersion } from './src/utils/versions';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wDAAwD,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kFAAkF,CAAC;AACnI,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,cAAc,sBAAsB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.componentTestGenerator = exports.cypressComponentConfigGenerator = exports.remoteGenerator = exports.hostGenerator = exports.storybookConfigurationGenerator = exports.storiesGenerator = exports.reduxGenerator = exports.reactInitGenerator = exports.libraryGenerator = exports.componentStoryGenerator = exports.hookGenerator = exports.componentGenerator = exports.applicationGenerator = exports.reactVersion = exports.reactDomVersion = exports.assertValidStyle = exports.extendReactEslintJson = exports.extraEslintDependencies =
|
|
3
|
+
exports.componentTestGenerator = exports.cypressComponentConfigGenerator = exports.remoteGenerator = exports.hostGenerator = exports.storybookConfigurationGenerator = exports.storiesGenerator = exports.reduxGenerator = exports.reactInitGenerator = exports.libraryGenerator = exports.componentStoryGenerator = exports.hookGenerator = exports.componentGenerator = exports.applicationGenerator = exports.reactVersion = exports.reactDomVersion = exports.assertValidStyle = exports.extendReactEslintJson = exports.extraEslintDependencies = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const nx_react_webpack_plugin_1 = require("./plugins/nx-react-webpack-plugin/nx-react-webpack-plugin");
|
|
6
|
-
/** @deprecated Use '@nx/react/webpack-plugin' instead, which can improve graph creation by 150-200ms per file. */
|
|
7
|
-
exports.NxReactWebpackPlugin = nx_react_webpack_plugin_1.NxReactWebpackPlugin;
|
|
8
5
|
var lint_1 = require("./src/utils/lint");
|
|
9
6
|
Object.defineProperty(exports, "extraEslintDependencies", { enumerable: true, get: function () { return lint_1.extraEslintDependencies; } });
|
|
10
7
|
Object.defineProperty(exports, "extendReactEslintJson", { enumerable: true, get: function () { return lint_1.extendReactEslintJson; } });
|
package/migrations.json
CHANGED
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
"version": "22.0.0-beta.0",
|
|
36
36
|
"description": "Updates webpack configs using React to use the new withSvgr composable function instead of the svgr option in withReact or NxReactWebpackPlugin.",
|
|
37
37
|
"factory": "./src/migrations/update-22-0-0/add-svgr-to-webpack-config"
|
|
38
|
+
},
|
|
39
|
+
"update-23-0-0-remove-nx-react-webpack-plugin-import": {
|
|
40
|
+
"cli": "nx",
|
|
41
|
+
"version": "23.0.0-beta.10",
|
|
42
|
+
"description": "Rewrites imports of NxReactWebpackPlugin from '@nx/react' to the sub-path '@nx/react/webpack-plugin'.",
|
|
43
|
+
"factory": "./src/migrations/update-23-0-0/remove-nx-react-webpack-plugin-import"
|
|
38
44
|
}
|
|
39
45
|
},
|
|
40
46
|
"packageJsonUpdates": {
|
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.20",
|
|
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": {
|
|
@@ -33,32 +33,32 @@
|
|
|
33
33
|
"migrations": "./migrations.json"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@phenomnomnominal/tsquery": "~6.
|
|
36
|
+
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
37
37
|
"@svgr/webpack": "^8.0.1",
|
|
38
|
-
"minimatch": "10.2.
|
|
38
|
+
"minimatch": "10.2.5",
|
|
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.20",
|
|
41
|
+
"@nx/js": "23.0.0-beta.20",
|
|
42
|
+
"@nx/eslint": "23.0.0-beta.20",
|
|
43
|
+
"@nx/web": "23.0.0-beta.20",
|
|
44
|
+
"@nx/module-federation": "23.0.0-beta.20",
|
|
45
|
+
"@nx/rollup": "23.0.0-beta.20",
|
|
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.20",
|
|
52
|
+
"@nx/playwright": "23.0.0-beta.20",
|
|
53
|
+
"@nx/rsbuild": "23.0.0-beta.20",
|
|
54
|
+
"@nx/vite": "23.0.0-beta.20",
|
|
55
|
+
"@nx/vitest": "23.0.0-beta.20",
|
|
56
|
+
"@nx/webpack": "23.0.0-beta.20",
|
|
57
|
+
"@nx/storybook": "23.0.0-beta.20",
|
|
58
|
+
"nx": "23.0.0-beta.20"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@nx/vite": "23.0.0-beta.
|
|
61
|
+
"@nx/vite": "23.0.0-beta.20"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
@@ -2,9 +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
|
|
5
|
+
const internal_1 = require("@nx/cypress/internal");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const path_1 = require("path");
|
|
10
10
|
/**
|
|
@@ -71,10 +71,10 @@ function nxComponentTestingPreset(pathToConfig, options) {
|
|
|
71
71
|
let webpackConfig = null;
|
|
72
72
|
try {
|
|
73
73
|
const graph = (0, devkit_1.readCachedProjectGraph)();
|
|
74
|
-
const { targets: ctTargets, name: ctProjectName } = (0,
|
|
74
|
+
const { targets: ctTargets, name: ctProjectName } = (0, internal_1.getProjectConfigByPath)(graph, pathToConfig);
|
|
75
75
|
const ctTargetName = options?.ctTargetName || 'component-test';
|
|
76
76
|
const ctConfigurationName = process.env.NX_CYPRESS_TARGET_CONFIGURATION;
|
|
77
|
-
const ctExecutorContext = (0,
|
|
77
|
+
const ctExecutorContext = (0, internal_1.createExecutorContext)(graph, ctTargets, ctProjectName, ctTargetName, ctConfigurationName);
|
|
78
78
|
let buildTarget = options?.buildTarget;
|
|
79
79
|
if (!buildTarget) {
|
|
80
80
|
const ctExecutorOptions = (0, devkit_1.readTargetOptions)({
|
|
@@ -161,13 +161,13 @@ function buildTargetWebpack(ctx, buildTarget, componentTestingProjectName) {
|
|
|
161
161
|
throw new InvalidExecutorError(`The '${parsed.target}' target of the '${parsed.project}' project is not using the '@nx/webpack:webpack' or '@nx/rspack:rspack' executor. ` +
|
|
162
162
|
`Please make sure to use '@nx/webpack:webpack' or '@nx/rspack:rspack' executor in that target to use Cypress Component Testing.`);
|
|
163
163
|
}
|
|
164
|
-
const context = (0,
|
|
164
|
+
const context = (0, internal_1.createExecutorContext)(graph, buildableProjectConfig.targets, parsed.project, parsed.target, parsed.target);
|
|
165
165
|
const { normalizeOptions, } = require('@nx/webpack/src/executors/webpack/lib/normalize-options');
|
|
166
166
|
const { resolveUserDefinedWebpackConfig, } = require('@nx/webpack/src/utils/webpack/resolve-user-defined-webpack-config');
|
|
167
167
|
const { composePluginsSync } = require('@nx/webpack/src/utils/config');
|
|
168
168
|
const { withNx } = require('@nx/webpack/src/utils/with-nx');
|
|
169
169
|
const { withWeb } = require('@nx/webpack/src/utils/with-web');
|
|
170
|
-
const options = normalizeOptions(withSchemaDefaults(parsed, context), devkit_1.workspaceRoot, buildableProjectConfig.root, (0,
|
|
170
|
+
const options = normalizeOptions(withSchemaDefaults(parsed, context), devkit_1.workspaceRoot, buildableProjectConfig.root, (0, internal_2.getProjectSourceRoot)(buildableProjectConfig));
|
|
171
171
|
let customWebpack;
|
|
172
172
|
if (options.webpackConfig) {
|
|
173
173
|
customWebpack = resolveUserDefinedWebpackConfig(options.webpackConfig, options.tsConfig.startsWith(context.root)
|
|
@@ -189,7 +189,7 @@ function buildTargetWebpack(ctx, buildTarget, componentTestingProjectName) {
|
|
|
189
189
|
extractLicenses: false,
|
|
190
190
|
root: devkit_1.workspaceRoot,
|
|
191
191
|
projectRoot: ctProjectConfig.root,
|
|
192
|
-
sourceRoot: (0,
|
|
192
|
+
sourceRoot: (0, internal_2.getProjectSourceRoot)(ctProjectConfig),
|
|
193
193
|
},
|
|
194
194
|
context,
|
|
195
195
|
configuration: parsed.configuration,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
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
|
-
const
|
|
6
|
+
const js_1 = require("@nx/js");
|
|
7
7
|
function buildBaseWebpackConfig({ tsConfigPath = 'tsconfig.cy.json', compiler = 'babel', }) {
|
|
8
8
|
const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
|
|
9
9
|
const config = {
|
|
@@ -13,7 +13,7 @@ function buildBaseWebpackConfig({ tsConfigPath = 'tsconfig.cy.json', compiler =
|
|
|
13
13
|
plugins: [
|
|
14
14
|
new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({
|
|
15
15
|
configFile: tsConfigPath,
|
|
16
|
-
baseUrl: (0,
|
|
16
|
+
baseUrl: (0, js_1.resolvePathsBaseUrl)(tsConfigPath),
|
|
17
17
|
extensions,
|
|
18
18
|
}),
|
|
19
19
|
],
|
|
@@ -2,7 +2,7 @@
|
|
|
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
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const config_1 = require("@nx/webpack/src/utils/config");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = require("path");
|
|
@@ -64,7 +64,7 @@ const getProjectData = async (storybookOptions) => {
|
|
|
64
64
|
? {
|
|
65
65
|
workspaceRoot: process.env.NX_WORKSPACE_ROOT,
|
|
66
66
|
projectRoot: projectNode.data.root,
|
|
67
|
-
sourceRoot: (0,
|
|
67
|
+
sourceRoot: (0, internal_1.getProjectSourceRoot)(projectNode.data),
|
|
68
68
|
projectNode,
|
|
69
69
|
}
|
|
70
70
|
: // Edge-case: missing project node
|
|
@@ -130,7 +130,7 @@ const webpack = async (storybookWebpackConfig = {}, options) => {
|
|
|
130
130
|
...options,
|
|
131
131
|
root: projectData.workspaceRoot,
|
|
132
132
|
projectRoot: projectData.projectRoot,
|
|
133
|
-
sourceRoot: (0,
|
|
133
|
+
sourceRoot: (0, internal_1.getProjectSourceRoot)(projectData.projectNode.data),
|
|
134
134
|
fileReplacements: [],
|
|
135
135
|
sourceMap: true,
|
|
136
136
|
styles: options.styles ?? [],
|
|
@@ -3,8 +3,8 @@ 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
|
|
7
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
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"));
|
|
10
10
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
@@ -26,7 +26,7 @@ async function* moduleFederationDevServer(schema, context) {
|
|
|
26
26
|
: // TODO(JamesHenry): remove type assertion once the nx repo is updated to use https://github.com/nrwl/nx/pull/33095
|
|
27
27
|
(0, dev_server_impl_1.default)(options, context);
|
|
28
28
|
const p = context.projectsConfigurations.projects[context.projectName];
|
|
29
|
-
let pathToManifestFile = (0, path_1.join)(context.root, (0,
|
|
29
|
+
let pathToManifestFile = (0, path_1.join)(context.root, (0, internal_2.getProjectSourceRoot)(p), 'assets/module-federation.manifest.json');
|
|
30
30
|
if (options.pathToManifestFile) {
|
|
31
31
|
const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
|
|
32
32
|
if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
|
|
@@ -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,8 +3,8 @@ 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
|
|
7
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
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");
|
|
10
10
|
const ssr_dev_server_impl_1 = tslib_1.__importDefault(require("@nx/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl"));
|
|
@@ -16,7 +16,7 @@ async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
|
|
16
16
|
// TODO(JamesHenry): remove type assertion once the nx repo is updated to use https://github.com/nrwl/nx/pull/33095
|
|
17
17
|
let iter = (0, ssr_dev_server_impl_1.default)(options, context);
|
|
18
18
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
19
|
-
let pathToManifestFile = (0, path_1.join)(context.root, (0,
|
|
19
|
+
let pathToManifestFile = (0, path_1.join)(context.root, (0, internal_2.getProjectSourceRoot)(projectConfig), 'assets/module-federation.manifest.json');
|
|
20
20
|
if (options.pathToManifestFile) {
|
|
21
21
|
const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
|
|
22
22
|
if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
|
|
@@ -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,9 +3,9 @@ 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
|
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
+
const internal_2 = require("@nx/js/internal");
|
|
9
9
|
const utils_1 = require("@nx/module-federation/src/executors/utils");
|
|
10
10
|
const utils_2 = require("@nx/module-federation/src/utils");
|
|
11
11
|
const file_server_impl_1 = tslib_1.__importDefault(require("@nx/web/src/executors/file-server/file-server.impl"));
|
|
@@ -18,7 +18,7 @@ function getBuildAndServeOptionsFromServeTarget(serveTarget, context) {
|
|
|
18
18
|
const serveOptions = (0, devkit_1.readTargetOptions)(target, context);
|
|
19
19
|
const buildTarget = (0, devkit_1.parseTargetString)(serveOptions.buildTarget, context);
|
|
20
20
|
const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
|
|
21
|
-
let pathToManifestFile = (0, path_1.join)(context.root, (0,
|
|
21
|
+
let pathToManifestFile = (0, path_1.join)(context.root, (0, internal_2.getProjectSourceRoot)(context.projectGraph.nodes[context.projectName].data), 'assets/module-federation.manifest.json');
|
|
22
22
|
if (serveOptions.pathToManifestFile) {
|
|
23
23
|
const userPathToManifestFile = (0, path_1.join)(context.root, serveOptions.pathToManifestFile);
|
|
24
24
|
if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
|
|
@@ -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,EAMjB,IAAI,EAGL,MAAM,YAAY,CAAC;AA+BpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,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,CA2L5B;AAiBD,eAAe,oBAAoB,CAAC"}
|
|
@@ -3,10 +3,11 @@ 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");
|
|
8
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
7
9
|
const js_1 = require("@nx/js");
|
|
8
|
-
const
|
|
9
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
|
+
const internal_3 = require("@nx/js/internal");
|
|
10
11
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
11
12
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
12
13
|
const create_application_files_1 = require("./lib/create-application-files");
|
|
@@ -23,8 +24,6 @@ const add_webpack_1 = require("./lib/bundlers/add-webpack");
|
|
|
23
24
|
const add_rspack_1 = require("./lib/bundlers/add-rspack");
|
|
24
25
|
const add_rsbuild_1 = require("./lib/bundlers/add-rsbuild");
|
|
25
26
|
const add_vite_1 = require("./lib/bundlers/add-vite");
|
|
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,
|
|
@@ -34,7 +33,7 @@ async function applicationGenerator(tree, schema) {
|
|
|
34
33
|
}
|
|
35
34
|
async function applicationGeneratorInternal(tree, schema) {
|
|
36
35
|
const tasks = [];
|
|
37
|
-
const addTsPlugin = (0,
|
|
36
|
+
const addTsPlugin = (0, internal_3.shouldConfigureTsSolutionSetup)(tree, schema.addPlugin, schema.useTsSolution);
|
|
38
37
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
39
38
|
...schema,
|
|
40
39
|
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
@@ -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',
|
|
@@ -72,18 +71,23 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
72
71
|
});
|
|
73
72
|
tasks.push(initTask);
|
|
74
73
|
if (!options.addPlugin) {
|
|
75
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
76
|
-
nxJson.targetDefaults
|
|
77
|
-
if (!
|
|
78
|
-
|
|
74
|
+
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
75
|
+
const existing = findBuildDefault(nxJson.targetDefaults);
|
|
76
|
+
if (!existing) {
|
|
77
|
+
(0, internal_2.upsertTargetDefault)(tree, nxJson, {
|
|
78
|
+
target: 'build',
|
|
79
79
|
cache: true,
|
|
80
80
|
dependsOn: ['^build'],
|
|
81
|
-
};
|
|
81
|
+
});
|
|
82
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
82
83
|
}
|
|
83
|
-
else if (!
|
|
84
|
-
|
|
84
|
+
else if (!existing.dependsOn) {
|
|
85
|
+
(0, internal_2.upsertTargetDefault)(tree, nxJson, {
|
|
86
|
+
target: 'build',
|
|
87
|
+
dependsOn: ['^build'],
|
|
88
|
+
});
|
|
89
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
85
90
|
}
|
|
86
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
87
91
|
}
|
|
88
92
|
if (options.bundler === 'webpack') {
|
|
89
93
|
await (0, add_webpack_1.initWebpack)(tree, options, tasks);
|
|
@@ -102,7 +106,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
102
106
|
// If we are using the new TS solution
|
|
103
107
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
104
108
|
if (options.isUsingTsSolutionConfig) {
|
|
105
|
-
await (0,
|
|
109
|
+
await (0, internal_3.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
106
110
|
}
|
|
107
111
|
const lintTask = await (0, add_linting_1.addLinting)(tree, options);
|
|
108
112
|
tasks.push(lintTask);
|
|
@@ -151,20 +155,30 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
151
155
|
});
|
|
152
156
|
}
|
|
153
157
|
// Only for the new TS solution
|
|
154
|
-
(0,
|
|
158
|
+
(0, internal_3.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
|
|
155
159
|
jsx: 'react-jsx',
|
|
156
160
|
module: 'esnext',
|
|
157
161
|
moduleResolution: 'bundler',
|
|
158
162
|
}, options.linter === 'eslint'
|
|
159
163
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
160
164
|
: undefined, options.useReactRouter ? 'app' : 'src');
|
|
161
|
-
(0,
|
|
165
|
+
(0, internal_3.sortPackageJsonFields)(tree, options.appProjectRoot);
|
|
162
166
|
if (!options.skipFormat) {
|
|
163
167
|
await (0, devkit_1.formatFiles)(tree);
|
|
164
168
|
}
|
|
165
169
|
tasks.push(() => {
|
|
166
|
-
(0,
|
|
170
|
+
(0, internal_1.logShowProjectCommand)(options.projectName);
|
|
167
171
|
});
|
|
168
172
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
169
173
|
}
|
|
174
|
+
function findBuildDefault(td) {
|
|
175
|
+
if (!td)
|
|
176
|
+
return undefined;
|
|
177
|
+
if (Array.isArray(td)) {
|
|
178
|
+
return td.find((e) => e.target === 'build' &&
|
|
179
|
+
e.projects === undefined &&
|
|
180
|
+
e.plugin === undefined);
|
|
181
|
+
}
|
|
182
|
+
return td['build'];
|
|
183
|
+
}
|
|
170
184
|
exports.default = applicationGenerator;
|
|
@@ -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"}
|
|
@@ -37,10 +37,9 @@ exports.addLinting = addLinting;
|
|
|
37
37
|
exports.isEslintInstalled = isEslintInstalled;
|
|
38
38
|
const devkit_1 = require("@nx/devkit");
|
|
39
39
|
const eslint_1 = require("@nx/eslint");
|
|
40
|
-
const
|
|
41
|
-
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
40
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
42
41
|
const devkit_2 = require("@nx/devkit");
|
|
43
|
-
const
|
|
42
|
+
const internal_2 = require("@nx/js/internal");
|
|
44
43
|
const lint_1 = require("../../../utils/lint");
|
|
45
44
|
const versions_1 = require("../../../utils/versions");
|
|
46
45
|
async function addLinting(host, options) {
|
|
@@ -59,23 +58,23 @@ async function addLinting(host, options) {
|
|
|
59
58
|
addPlugin: options.addPlugin,
|
|
60
59
|
});
|
|
61
60
|
tasks.push(lintTask);
|
|
62
|
-
if ((0,
|
|
63
|
-
if ((0,
|
|
64
|
-
(0,
|
|
61
|
+
if ((0, internal_1.isEslintConfigSupported)(host)) {
|
|
62
|
+
if ((0, internal_1.useFlatConfig)(host)) {
|
|
63
|
+
(0, internal_1.addPredefinedConfigToFlatLintConfig)(host, options.appProjectRoot, 'flat/react', { checkBaseConfig: true });
|
|
65
64
|
// Add an empty rules object to users know how to add/override rules
|
|
66
|
-
(0,
|
|
65
|
+
(0, internal_1.addOverrideToLintConfig)(host, options.appProjectRoot, {
|
|
67
66
|
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
|
68
67
|
rules: {},
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
70
|
else {
|
|
72
|
-
const addExtendsTask = (0,
|
|
71
|
+
const addExtendsTask = (0, internal_1.addExtendsToLintConfig)(host, options.appProjectRoot, { name: 'plugin:@nx/react', needCompatFixup: true });
|
|
73
72
|
tasks.push(addExtendsTask);
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
if (!options.skipPackageJson) {
|
|
77
76
|
const installTask = (0, devkit_2.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
|
|
78
|
-
const addSwcTask = (0,
|
|
77
|
+
const addSwcTask = (0, internal_2.addSwcDependencies)(host);
|
|
79
78
|
tasks.push(installTask, addSwcTask);
|
|
80
79
|
}
|
|
81
80
|
if (options.useReactRouter) {
|
|
@@ -89,11 +88,11 @@ async function ignoreReactRouterFilesInEslintConfig(tree, projectRoot) {
|
|
|
89
88
|
return;
|
|
90
89
|
}
|
|
91
90
|
(0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
|
|
92
|
-
const { addIgnoresToLintConfig, isEslintConfigSupported } = await Promise.resolve().then(() => __importStar(require('@nx/eslint/
|
|
91
|
+
const { addIgnoresToLintConfig, isEslintConfigSupported } = await Promise.resolve().then(() => __importStar(require('@nx/eslint/internal')));
|
|
93
92
|
if (!isEslintConfigSupported(tree)) {
|
|
94
93
|
return;
|
|
95
94
|
}
|
|
96
|
-
const { useFlatConfig } = await Promise.resolve().then(() => __importStar(require('@nx/eslint/
|
|
95
|
+
const { useFlatConfig } = await Promise.resolve().then(() => __importStar(require('@nx/eslint/internal')));
|
|
97
96
|
const isUsingFlatConfig = useFlatConfig(tree);
|
|
98
97
|
if (!projectRoot && !isUsingFlatConfig) {
|
|
99
98
|
// root eslintrc files ignore all files and the root eslintrc files add
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/add-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"add-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/add-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAML,IAAI,EAGL,MAAM,YAAY,CAAC;AAMpB,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAyF/D"}
|
|
@@ -15,6 +15,12 @@ function addProject(host, options) {
|
|
|
15
15
|
};
|
|
16
16
|
if (options.bundler === 'webpack') {
|
|
17
17
|
if (!(0, has_webpack_plugin_1.hasWebpackPlugin)(host) || !options.addPlugin) {
|
|
18
|
+
// Mirrors warnWebpackExecutorGenerating from @nx/webpack/src/utils/deprecation.
|
|
19
|
+
// Inlined to avoid a cross-package deep import; @nx/webpack's package
|
|
20
|
+
// exports field doesn't expose internal `src/...` paths, so the import
|
|
21
|
+
// works at compile time (via tsconfig project refs) but fails at runtime
|
|
22
|
+
// in published packages.
|
|
23
|
+
devkit_1.logger.warn('Generating targets that use the deprecated `@nx/webpack:webpack` and `@nx/webpack:dev-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` next to migrate these targets to the `@nx/webpack/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
18
24
|
project.targets = {
|
|
19
25
|
build: createBuildTarget(options),
|
|
20
26
|
serve: createServeTarget(options),
|
|
@@ -23,6 +29,10 @@ function addProject(host, options) {
|
|
|
23
29
|
}
|
|
24
30
|
else if (options.bundler === 'rspack' &&
|
|
25
31
|
(!(0, has_rspack_plugin_1.hasRspackPlugin)(host) || !options.addPlugin)) {
|
|
32
|
+
// Mirrors warnRspackExecutorGenerating from @nx/rspack/src/utils/deprecation.
|
|
33
|
+
// Inlined to avoid a cross-package import where react does not declare a
|
|
34
|
+
// TypeScript project reference to rspack.
|
|
35
|
+
devkit_1.logger.warn('Generating targets that use the deprecated `@nx/rspack:rspack` and `@nx/rspack:dev-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` next to migrate these targets to the `@nx/rspack/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
26
36
|
project.targets = {
|
|
27
37
|
build: createRspackBuildTarget(options),
|
|
28
38
|
serve: createRspackServeTarget(options),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addRouting = addRouting;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const ast_utils_1 = require("../../../utils/ast-utils");
|
|
7
7
|
const versions_1 = require("../../../utils/versions");
|
|
8
8
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
@@ -12,7 +12,7 @@ function addRouting(host, options) {
|
|
|
12
12
|
return () => { };
|
|
13
13
|
}
|
|
14
14
|
if (!tsModule) {
|
|
15
|
-
tsModule = (0,
|
|
15
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
16
16
|
}
|
|
17
17
|
const appPath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({
|
|
18
18
|
js: options.js,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-vite.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/react/src/generators/application/lib/bundlers/add-vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAoC,MAAM,YAAY,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAExD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"add-vite.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/react/src/generators/application/lib/bundlers/add-vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAoC,MAAM,YAAY,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAExD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,GAAG,EAAE,iBAkEb;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,GAAG,EAAE,iBA8Cb"}
|
|
@@ -79,7 +79,11 @@ async function setupViteConfiguration(tree, options, tasks) {
|
|
|
79
79
|
includeLib: false,
|
|
80
80
|
includeVitest: options.unitTestRunner === 'vitest',
|
|
81
81
|
inSourceTests: options.inSourceTests,
|
|
82
|
-
|
|
82
|
+
rolldownOptionsExternal: [
|
|
83
|
+
"'react'",
|
|
84
|
+
"'react-dom'",
|
|
85
|
+
"'react/jsx-runtime'",
|
|
86
|
+
],
|
|
83
87
|
port: options.port,
|
|
84
88
|
previewPort: options.port,
|
|
85
89
|
useEsmExtension: true,
|
|
@@ -106,7 +110,11 @@ async function setupVitestConfiguration(tree, options, tasks) {
|
|
|
106
110
|
includeLib: false,
|
|
107
111
|
includeVitest: true,
|
|
108
112
|
inSourceTests: options.inSourceTests,
|
|
109
|
-
|
|
113
|
+
rolldownOptionsExternal: [
|
|
114
|
+
"'react'",
|
|
115
|
+
"'react-dom'",
|
|
116
|
+
"'react/jsx-runtime'",
|
|
117
|
+
],
|
|
110
118
|
imports: [
|
|
111
119
|
options.compiler === 'swc'
|
|
112
120
|
? `import react from '@vitejs/plugin-react-swc'`
|
|
@@ -37,7 +37,7 @@ export declare function getDefaultTemplateVariables(host: Tree, options: Normali
|
|
|
37
37
|
tags?: string;
|
|
38
38
|
inSourceTests?: boolean;
|
|
39
39
|
e2eTestRunner: "cypress" | "playwright" | "none";
|
|
40
|
-
linter: import("packages/eslint").Linter | import("packages/eslint").LinterType;
|
|
40
|
+
linter: import("packages/eslint/dist").Linter | import("packages/eslint/dist").LinterType;
|
|
41
41
|
classComponent?: boolean;
|
|
42
42
|
routing?: boolean;
|
|
43
43
|
useReactRouter?: boolean;
|
|
@@ -13,7 +13,7 @@ const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
|
13
13
|
const get_app_tests_1 = require("./get-app-tests");
|
|
14
14
|
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
15
15
|
const has_rspack_plugin_1 = require("../../../utils/has-rspack-plugin");
|
|
16
|
-
const
|
|
16
|
+
const internal_1 = require("@nx/js/internal");
|
|
17
17
|
const versions_1 = require("../../../utils/versions");
|
|
18
18
|
function getDefaultTemplateVariables(host, options) {
|
|
19
19
|
const hasStyleFile = ['scss', 'css'].includes(options.style);
|
|
@@ -35,7 +35,7 @@ function getDefaultTemplateVariables(host, options) {
|
|
|
35
35
|
inSourceVitestTests: (0, get_in_source_vitest_tests_template_1.getInSourceVitestTestsTemplate)(appTests),
|
|
36
36
|
style: options.style,
|
|
37
37
|
hasStyleFile,
|
|
38
|
-
isUsingTsSolutionSetup: (0,
|
|
38
|
+
isUsingTsSolutionSetup: (0, internal_1.isUsingTsSolutionSetup)(host),
|
|
39
39
|
port: options.port ?? 4200,
|
|
40
40
|
};
|
|
41
41
|
}
|