@nx/react 23.0.0-beta.2 → 23.0.0-beta.21
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/generators.json +16 -3
- 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.d.ts.map +1 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +6 -4
- package/src/executors/module-federation-dev-server/schema.json +1 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts.map +1 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +7 -5
- package/src/executors/module-federation-ssr-dev-server/schema.json +1 -0
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts.map +1 -1
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +6 -4
- package/src/executors/module-federation-static-server/schema.json +1 -0
- package/src/generators/_utils/mf-dependencies.d.ts +8 -0
- package/src/generators/_utils/mf-dependencies.d.ts.map +1 -0
- package/src/generators/_utils/mf-dependencies.js +84 -0
- package/src/generators/_utils/mf-versions.d.ts +12 -0
- package/src/generators/_utils/mf-versions.d.ts.map +1 -0
- package/src/generators/_utils/mf-versions.js +29 -0
- package/src/generators/_utils/normalize.d.ts +20 -0
- package/src/generators/_utils/normalize.d.ts.map +1 -0
- package/src/generators/_utils/normalize.js +48 -0
- 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/consumer/consumer.d.ts +5 -0
- package/src/generators/consumer/consumer.d.ts.map +1 -0
- package/src/generators/consumer/consumer.js +135 -0
- package/src/generators/consumer/files/_common/src/App.tsx__tmpl__ +53 -0
- package/src/generators/consumer/files/_common/src/bootstrap.tsx__tmpl__ +12 -0
- package/src/generators/consumer/files/_common/src/index.ts__tmpl__ +4 -0
- package/src/generators/consumer/files/_common/src/mf.ts__tmpl__ +35 -0
- package/src/generators/consumer/files/_common/tsconfig.json__tmpl__ +17 -0
- package/src/generators/consumer/files/rsbuild/index.html__tmpl__ +12 -0
- package/src/generators/consumer/files/rsbuild/package.json__tmpl__ +23 -0
- package/src/generators/consumer/files/rsbuild/rsbuild.config.ts__tmpl__ +25 -0
- package/src/generators/consumer/files/rspack/index.html__tmpl__ +12 -0
- package/src/generators/consumer/files/rspack/package.json__tmpl__ +23 -0
- package/src/generators/consumer/files/rspack/rspack.config.ts__tmpl__ +59 -0
- package/src/generators/consumer/files/vite/index.html__tmpl__ +12 -0
- package/src/generators/consumer/files/vite/package.json__tmpl__ +24 -0
- package/src/generators/consumer/files/vite/vite.config.ts__tmpl__ +27 -0
- package/src/generators/consumer/schema.d.ts +8 -0
- package/src/generators/consumer/schema.json +43 -0
- 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 +4 -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 +7 -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/provider/files/_common/src/__componentName__.tsx__tmpl__ +11 -0
- package/src/generators/provider/files/_common/src/bootstrap.tsx__tmpl__ +12 -0
- package/src/generators/provider/files/_common/src/index.ts__tmpl__ +5 -0
- package/src/generators/provider/files/_common/tsconfig.json__tmpl__ +17 -0
- package/src/generators/provider/files/rsbuild/index.html__tmpl__ +12 -0
- package/src/generators/provider/files/rsbuild/package.json__tmpl__ +22 -0
- package/src/generators/provider/files/rsbuild/rsbuild.config.ts__tmpl__ +31 -0
- package/src/generators/provider/files/rspack/index.html__tmpl__ +12 -0
- package/src/generators/provider/files/rspack/package.json__tmpl__ +22 -0
- package/src/generators/provider/files/rspack/rspack.config.ts__tmpl__ +69 -0
- package/src/generators/provider/files/vite/index.html__tmpl__ +12 -0
- package/src/generators/provider/files/vite/package.json__tmpl__ +23 -0
- package/src/generators/provider/files/vite/vite.config.ts__tmpl__ +37 -0
- package/src/generators/provider/provider.d.ts +5 -0
- package/src/generators/provider/provider.d.ts.map +1 -0
- package/src/generators/provider/provider.js +92 -0
- package/src/generators/provider/schema.d.ts +9 -0
- package/src/generators/provider/schema.json +46 -0
- 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 +9 -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/module-federation-deprecation.d.ts +13 -0
- package/src/utils/module-federation-deprecation.d.ts.map +1 -0
- package/src/utils/module-federation-deprecation.js +46 -0
- 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
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hookGenerator = hookGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
// TODO(jack): Remove inline renderHook function when RTL releases with its own version
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
7
|
-
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const ast_utils_1 = require("../../utils/ast-utils");
|
|
10
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
11
10
|
async function hookGenerator(host, schema) {
|
|
12
11
|
const options = await normalizeOptions(host, schema);
|
|
13
12
|
createFiles(host, options);
|
|
@@ -29,7 +28,7 @@ function createFiles(host, options) {
|
|
|
29
28
|
let tsModule;
|
|
30
29
|
function addExportsToBarrel(host, options) {
|
|
31
30
|
if (!tsModule) {
|
|
32
|
-
tsModule = (0,
|
|
31
|
+
tsModule = (0, internal_2.ensureTypescript)();
|
|
33
32
|
}
|
|
34
33
|
const workspace = (0, devkit_1.getProjects)(host);
|
|
35
34
|
const isApp = workspace.get(options.projectName).projectType === 'application';
|
|
@@ -45,7 +44,7 @@ function addExportsToBarrel(host, options) {
|
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
async function normalizeOptions(host, options) {
|
|
48
|
-
const { artifactName, directory, fileName: hookFilename, fileExtension, fileExtensionType, project: projectName, } = await (0,
|
|
47
|
+
const { artifactName, directory, fileName: hookFilename, fileExtension, fileExtensionType, project: projectName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
49
48
|
path: options.path,
|
|
50
49
|
name: options.name,
|
|
51
50
|
allowedFileExtensions: ['js', 'ts'],
|
|
@@ -64,7 +63,7 @@ async function normalizeOptions(host, options) {
|
|
|
64
63
|
const project = (0, devkit_1.getProjects)(host).get(projectName);
|
|
65
64
|
const { root, sourceRoot: projectSourceRoot, projectType } = project;
|
|
66
65
|
if (options.export &&
|
|
67
|
-
(0,
|
|
66
|
+
(0, internal_2.getProjectType)(host, root, projectType) === 'application') {
|
|
68
67
|
devkit_1.logger.warn(`The "--export" option should not be used with applications and will do nothing.`);
|
|
69
68
|
}
|
|
70
69
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
2
|
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } from '@nx/module-federation/rspack
|
|
3
|
+
import { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } from '@nx/module-federation/rspack';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
6
6
|
import browserMfConfig from './module-federation.config';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
2
|
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack
|
|
4
|
-
import { ModuleFederationConfig } from '@nx/module-federation';
|
|
3
|
+
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack';
|
|
4
|
+
import type { ModuleFederationConfig } from '@nx/module-federation';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
|
|
7
7
|
import baseConfig from './module-federation.config';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
2
|
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack
|
|
3
|
+
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
6
6
|
import config from './module-federation.config';
|
package/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {composePlugins, withNx} from '@nx/webpack';
|
|
2
2
|
import {withReact} from '@nx/react';
|
|
3
|
-
import {withModuleFederationForSSR} from '@nx/module-federation/webpack
|
|
3
|
+
import {withModuleFederationForSSR} from '@nx/module-federation/webpack';
|
|
4
4
|
|
|
5
5
|
import baseConfig from './module-federation.config';
|
|
6
6
|
|
package/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { composePlugins, withNx } from '@nx/webpack';
|
|
2
2
|
import { withReact } from '@nx/react';
|
|
3
|
-
import { withModuleFederation } from '@nx/module-federation/webpack
|
|
4
|
-
import { ModuleFederationConfig } from '@nx/module-federation';
|
|
3
|
+
import { withModuleFederation } from '@nx/module-federation/webpack';
|
|
4
|
+
import type { ModuleFederationConfig } from '@nx/module-federation';
|
|
5
5
|
|
|
6
6
|
import baseConfig from './module-federation.config';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {composePlugins, withNx} from '@nx/webpack';
|
|
2
2
|
import {withReact} from '@nx/react';
|
|
3
|
-
import {withModuleFederation} from '@nx/module-federation/webpack
|
|
4
|
-
import { ModuleFederationConfig } from '@nx/module-federation';
|
|
3
|
+
import {withModuleFederation} from '@nx/module-federation/webpack';
|
|
4
|
+
import type { ModuleFederationConfig } from '@nx/module-federation';
|
|
5
5
|
|
|
6
6
|
import baseConfig from './module-federation.config';
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/host/host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/host/host.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAoB,MAAM,EAAE,MAAM,UAAU,CAAC;AAYpD,wBAAsB,aAAa,CACjC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAoJ5B;AAmCD,eAAe,aAAa,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hostGenerator = hostGenerator;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
|
|
7
8
|
const application_1 = tslib_1.__importDefault(require("../application/application"));
|
|
@@ -14,12 +15,13 @@ const setup_ssr_for_host_1 = require("./lib/setup-ssr-for-host");
|
|
|
14
15
|
const update_module_federation_e2e_project_1 = require("./lib/update-module-federation-e2e-project");
|
|
15
16
|
const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
|
|
16
17
|
const js_1 = require("@nx/js");
|
|
17
|
-
const
|
|
18
|
+
const internal_2 = require("@nx/js/internal");
|
|
18
19
|
const versions_1 = require("../../utils/versions");
|
|
19
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
20
20
|
const update_module_federation_tsconfig_1 = require("./lib/update-module-federation-tsconfig");
|
|
21
21
|
const normalize_host_name_1 = require("./lib/normalize-host-name");
|
|
22
|
+
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
22
23
|
async function hostGenerator(host, schema) {
|
|
24
|
+
(0, module_federation_deprecation_1.warnReactHostGeneratorDeprecation)();
|
|
23
25
|
const tasks = [];
|
|
24
26
|
const name = await (0, normalize_host_name_1.normalizeHostName)(host, schema.directory, schema.name);
|
|
25
27
|
const options = {
|
|
@@ -46,7 +48,7 @@ async function hostGenerator(host, schema) {
|
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
|
-
await (0,
|
|
51
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
50
52
|
const initTask = await (0, application_1.default)(host, {
|
|
51
53
|
...options,
|
|
52
54
|
directory: options.appProjectRoot,
|
|
@@ -57,7 +59,7 @@ async function hostGenerator(host, schema) {
|
|
|
57
59
|
});
|
|
58
60
|
tasks.push(initTask);
|
|
59
61
|
// In TS solution setup, update package.json to use simple name instead of scoped name
|
|
60
|
-
if ((0,
|
|
62
|
+
if ((0, internal_2.isUsingTsSolutionSetup)(host)) {
|
|
61
63
|
const hostPackageJsonPath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json');
|
|
62
64
|
if (host.exists(hostPackageJsonPath)) {
|
|
63
65
|
(0, devkit_1.updateJson)(host, hostPackageJsonPath, (json) => {
|
|
@@ -98,7 +100,7 @@ async function hostGenerator(host, schema) {
|
|
|
98
100
|
(0, update_module_federation_e2e_project_1.updateModuleFederationE2eProject)(host, options);
|
|
99
101
|
(0, update_module_federation_tsconfig_1.updateModuleFederationTsconfig)(host, options);
|
|
100
102
|
// Add remotes as devDependencies in TS solution setup
|
|
101
|
-
if ((0,
|
|
103
|
+
if ((0, internal_2.isUsingTsSolutionSetup)(host) && remotesWithPorts.length > 0) {
|
|
102
104
|
addRemotesAsHostDependencies(host, options.projectName, remotesWithPorts);
|
|
103
105
|
}
|
|
104
106
|
if (options.ssr) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-module-federation-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/host/lib/add-module-federation-files.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAML,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"add-module-federation-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/host/lib/add-module-federation-files.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAML,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,EACzB,qBAAqB,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,QAgJxD"}
|
|
@@ -2,7 +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
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
7
7
|
const create_application_files_1 = require("../../application/lib/create-application-files");
|
|
8
8
|
const path_1 = require("path");
|
|
@@ -35,7 +35,7 @@ function addModuleFederationFiles(host, options, defaultRemoteManifest) {
|
|
|
35
35
|
}),
|
|
36
36
|
};
|
|
37
37
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
38
|
-
const pathToMFManifest = (0, devkit_1.joinPathFragments)((0,
|
|
38
|
+
const pathToMFManifest = (0, devkit_1.joinPathFragments)((0, internal_1.getProjectSourceRoot)(projectConfig, host), 'assets/module-federation.manifest.json');
|
|
39
39
|
// Module federation requires bootstrap code to be dynamically imported.
|
|
40
40
|
// Renaming original entry file so we can use `import(./bootstrap)` in
|
|
41
41
|
// new entry file.
|
|
@@ -69,7 +69,7 @@ function addModuleFederationFiles(host, options, defaultRemoteManifest) {
|
|
|
69
69
|
processBundlerConfigFile(options, host, 'webpack.config.prod.js');
|
|
70
70
|
}
|
|
71
71
|
// Delete TypeScript prod config in TS solution setup - not needed in Crystal
|
|
72
|
-
if ((0,
|
|
72
|
+
if ((0, internal_1.isUsingTsSolutionSetup)(host)) {
|
|
73
73
|
const prodConfigFileName = options.bundler === 'rspack'
|
|
74
74
|
? 'rspack.config.prod.ts'
|
|
75
75
|
: 'webpack.config.prod.ts';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeHostName = normalizeHostName;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
async function normalizeHostName(tree, directory, name) {
|
|
6
|
-
const { projectName } = await (0,
|
|
6
|
+
const { projectName } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
7
7
|
name,
|
|
8
8
|
directory,
|
|
9
9
|
projectType: 'application',
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateModuleFederationTsconfig = updateModuleFederationTsconfig;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
function updateModuleFederationTsconfig(host, options) {
|
|
7
7
|
const tsconfigPath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json');
|
|
8
8
|
const tsconfigRuntimePath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json');
|
|
9
9
|
if (!host.exists(tsconfigPath) || !host.exists(tsconfigRuntimePath))
|
|
10
10
|
return;
|
|
11
|
-
if ((0,
|
|
11
|
+
if ((0, internal_1.isUsingTsSolutionSetup)(host)) {
|
|
12
12
|
// Update references to match what `nx sync` does.
|
|
13
13
|
if (options.remotes?.length) {
|
|
14
14
|
(0, devkit_1.updateJson)(host, tsconfigPath, (json) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/init/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,8BAyDtE;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reactInitGenerator = reactInitGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const versions_1 = require("../../utils/versions");
|
|
6
7
|
const version_utils_1 = require("../../utils/version-utils");
|
|
7
|
-
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
8
8
|
const router_plugin_1 = require("../../plugins/router-plugin");
|
|
9
9
|
async function reactInitGenerator(tree, schema) {
|
|
10
10
|
const tasks = [];
|
|
@@ -23,7 +23,7 @@ async function reactInitGenerator(tree, schema) {
|
|
|
23
23
|
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
24
24
|
nxJson.useInferencePlugins !== false;
|
|
25
25
|
if (schema.useReactRouterPlugin && schema.addPlugin) {
|
|
26
|
-
await (0,
|
|
26
|
+
await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/react/router-plugin', router_plugin_1.createNodesV2, {
|
|
27
27
|
buildTargetName: ['build', 'react-router:build', 'react-router-build'],
|
|
28
28
|
devTargetName: ['dev', 'react-router:dev', 'react-router-dev'],
|
|
29
29
|
startTargetName: ['start', 'react-router-serve', 'react-router-start'],
|
|
@@ -5,8 +5,7 @@ const eslint_1 = require("@nx/eslint");
|
|
|
5
5
|
const path_1 = require("nx/src/utils/path");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const lint_1 = require("../../../utils/lint");
|
|
8
|
-
const
|
|
9
|
-
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
8
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
10
9
|
async function addLinting(host, options) {
|
|
11
10
|
if (options.linter === 'eslint') {
|
|
12
11
|
const tasks = [];
|
|
@@ -23,17 +22,17 @@ async function addLinting(host, options) {
|
|
|
23
22
|
addPlugin: options.addPlugin,
|
|
24
23
|
});
|
|
25
24
|
tasks.push(lintTask);
|
|
26
|
-
if ((0,
|
|
27
|
-
if ((0,
|
|
28
|
-
(0,
|
|
25
|
+
if ((0, internal_1.isEslintConfigSupported)(host)) {
|
|
26
|
+
if ((0, internal_1.useFlatConfig)(host)) {
|
|
27
|
+
(0, internal_1.addPredefinedConfigToFlatLintConfig)(host, options.projectRoot, 'flat/react', { checkBaseConfig: true });
|
|
29
28
|
// Add an empty rules object to users know how to add/override rules
|
|
30
|
-
(0,
|
|
29
|
+
(0, internal_1.addOverrideToLintConfig)(host, options.projectRoot, {
|
|
31
30
|
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
|
32
31
|
rules: {},
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
else {
|
|
36
|
-
const addExtendsTask = (0,
|
|
35
|
+
const addExtendsTask = (0, internal_1.addExtendsToLintConfig)(host, options.projectRoot, {
|
|
37
36
|
name: 'plugin:@nx/react',
|
|
38
37
|
needCompatFixup: true,
|
|
39
38
|
});
|
|
@@ -41,7 +40,7 @@ async function addLinting(host, options) {
|
|
|
41
40
|
}
|
|
42
41
|
// Add out-tsc ignore pattern when using TS solution setup
|
|
43
42
|
if (options.isUsingTsSolutionConfig) {
|
|
44
|
-
(0,
|
|
43
|
+
(0, internal_1.addIgnoresToLintConfig)(host, options.projectRoot, ['**/out-tsc']);
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
let installTask = () => { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-rollup-build-target.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/add-rollup-build-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAGL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"add-rollup-build-target.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/add-rollup-build-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAGL,iBAAiB,EAQlB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAA;CAAE,EAC7D,QAAQ,GAAE,GAAG,CAAC,MAAM,CAAmC,8BAyHxD"}
|
|
@@ -59,6 +59,12 @@ module.exports = withNx(
|
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
61
|
// Legacy behavior, there is a target in project.json using rollup executor.
|
|
62
|
+
// Mirrors warnRollupExecutorGenerating from @nx/rollup/src/utils/deprecation.
|
|
63
|
+
// Inlined to avoid a cross-package deep import; @nx/rollup's package
|
|
64
|
+
// exports field doesn't expose internal `src/...` paths, so the import
|
|
65
|
+
// works at compile time (via tsconfig project refs) but fails at runtime
|
|
66
|
+
// in published packages.
|
|
67
|
+
devkit_1.logger.warn('The `@nx/rollup:rollup` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rollup:convert-to-inferred` to migrate to the `@nx/rollup/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
62
68
|
const { targets } = (0, devkit_1.readProjectConfiguration)(host, options.name);
|
|
63
69
|
targets.build = {
|
|
64
70
|
executor: '@nx/rollup:rollup',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.installCommonDependencies = installCommonDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const version_utils_1 = require("../../../utils/version-utils");
|
|
7
7
|
const versions_1 = require("../../../utils/versions");
|
|
8
8
|
async function installCommonDependencies(host, options) {
|
|
@@ -32,7 +32,7 @@ async function installCommonDependencies(host, options) {
|
|
|
32
32
|
const baseInstallTask = (0, devkit_1.addDependenciesToPackageJson)(host, dependencies, devDependencies);
|
|
33
33
|
tasks.push(baseInstallTask);
|
|
34
34
|
if (options.compiler === 'swc') {
|
|
35
|
-
tasks.push((0,
|
|
35
|
+
tasks.push((0, internal_1.addSwcDependencies)(host));
|
|
36
36
|
}
|
|
37
37
|
else if (options.compiler === 'babel') {
|
|
38
38
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOrD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAmG3B"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
7
|
-
const
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
async function normalizeOptions(host, options) {
|
|
9
|
-
const isUsingTsSolutionConfig = (0,
|
|
10
|
-
await (0,
|
|
11
|
-
const { projectName, names: projectNames, projectRoot, importPath, } = await (0,
|
|
9
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
10
|
+
await (0, internal_1.ensureRootProjectName)(options, 'library');
|
|
11
|
+
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
12
12
|
name: options.name,
|
|
13
13
|
projectType: 'library',
|
|
14
14
|
directory: options.directory,
|
|
@@ -50,11 +50,11 @@ async function normalizeOptions(host, options) {
|
|
|
50
50
|
normalized.inSourceTests === normalized.minimal || normalized.inSourceTests;
|
|
51
51
|
if (options.appProject) {
|
|
52
52
|
const appProjectConfig = (0, devkit_1.getProjects)(host).get(options.appProject);
|
|
53
|
-
const appProjectType = (0,
|
|
53
|
+
const appProjectType = (0, internal_2.getProjectType)(host, appProjectConfig.root, appProjectConfig.projectType);
|
|
54
54
|
if (appProjectType !== 'application') {
|
|
55
55
|
throw new Error(`appProject expected type of "application" but got "${appProjectType}"`);
|
|
56
56
|
}
|
|
57
|
-
const appSourceRoot = (0,
|
|
57
|
+
const appSourceRoot = (0, internal_2.getProjectSourceRoot)(appProjectConfig, host);
|
|
58
58
|
normalized.appMain =
|
|
59
59
|
appProjectConfig.targets.build?.options?.main ??
|
|
60
60
|
findMainEntry(host, appProjectConfig.root);
|
|
@@ -6,7 +6,7 @@ const ast_utils_1 = require("../../../utils/ast-utils");
|
|
|
6
6
|
const ast_utils_2 = require("../../../utils/ast-utils");
|
|
7
7
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
8
8
|
const versions_1 = require("../../../utils/versions");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@nx/js/internal");
|
|
10
10
|
let tsModule;
|
|
11
11
|
function updateAppRoutes(host, options) {
|
|
12
12
|
if (!options.appMain || !options.appSourceRoot) {
|
|
@@ -53,7 +53,7 @@ function readComponent(host, path) {
|
|
|
53
53
|
throw new Error(`Cannot find ${path}`);
|
|
54
54
|
}
|
|
55
55
|
if (!tsModule) {
|
|
56
|
-
tsModule = (0,
|
|
56
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
57
57
|
}
|
|
58
58
|
const content = host.read(path, 'utf-8');
|
|
59
59
|
const source = tsModule.createSourceFile(path, content, tsModule.ScriptTarget.Latest, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/library/library.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/library/library.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AA4BpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMhE;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAyRxE;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -3,14 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
8
|
-
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
9
8
|
const js_1 = require("@nx/js");
|
|
10
9
|
const path_1 = require("path");
|
|
11
|
-
const
|
|
12
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
13
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
|
+
const internal_2 = require("@nx/js/internal");
|
|
14
11
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
15
12
|
const jest_utils_1 = require("../../utils/jest-utils");
|
|
16
13
|
const maybe_js_1 = require("../../utils/maybe-js");
|
|
@@ -34,7 +31,7 @@ async function libraryGenerator(host, schema) {
|
|
|
34
31
|
}
|
|
35
32
|
async function libraryGeneratorInternal(host, schema) {
|
|
36
33
|
const tasks = [];
|
|
37
|
-
const addTsPlugin = (0,
|
|
34
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host, schema.addPlugin);
|
|
38
35
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
39
36
|
...schema,
|
|
40
37
|
addTsPlugin,
|
|
@@ -85,7 +82,7 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
85
82
|
}
|
|
86
83
|
(0, create_files_1.createFiles)(host, options);
|
|
87
84
|
if (options.isUsingTsSolutionConfig) {
|
|
88
|
-
await (0,
|
|
85
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
89
86
|
}
|
|
90
87
|
const lintTask = await (0, add_linting_1.addLinting)(host, options);
|
|
91
88
|
tasks.push(lintTask);
|
|
@@ -110,7 +107,7 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
110
107
|
includeLib: true,
|
|
111
108
|
includeVitest: options.unitTestRunner === 'vitest',
|
|
112
109
|
inSourceTests: options.inSourceTests,
|
|
113
|
-
|
|
110
|
+
rolldownOptionsExternal: [
|
|
114
111
|
"'react'",
|
|
115
112
|
"'react-dom'",
|
|
116
113
|
"'react/jsx-runtime'",
|
|
@@ -169,7 +166,7 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
169
166
|
includeLib: true,
|
|
170
167
|
includeVitest: true,
|
|
171
168
|
inSourceTests: options.inSourceTests,
|
|
172
|
-
|
|
169
|
+
rolldownOptionsExternal: [
|
|
173
170
|
"'react'",
|
|
174
171
|
"'react-dom'",
|
|
175
172
|
"'react/jsx-runtime'",
|
|
@@ -184,8 +181,8 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
184
181
|
}, true);
|
|
185
182
|
}
|
|
186
183
|
if (options.component) {
|
|
187
|
-
const relativeCwd = (0,
|
|
188
|
-
const path = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/lib', options.fileName);
|
|
184
|
+
const relativeCwd = (0, internal_1.getRelativeCwd)();
|
|
185
|
+
const path = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/lib', options.js ? `${options.fileName}.js` : options.fileName);
|
|
189
186
|
const componentTask = await (0, component_1.default)(host, {
|
|
190
187
|
path: relativeCwd ? (0, path_1.relative)(relativeCwd, path) : path,
|
|
191
188
|
style: options.style,
|
|
@@ -193,7 +190,6 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
193
190
|
(options.unitTestRunner === 'vitest' && options.inSourceTests == true),
|
|
194
191
|
export: true,
|
|
195
192
|
routing: options.routing,
|
|
196
|
-
js: options.js,
|
|
197
193
|
name: options.name,
|
|
198
194
|
inSourceTests: options.inSourceTests,
|
|
199
195
|
skipFormat: true,
|
|
@@ -204,14 +200,14 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
204
200
|
if (options.publishable) {
|
|
205
201
|
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.name);
|
|
206
202
|
if (options.isUsingTsSolutionConfig) {
|
|
207
|
-
await (0,
|
|
203
|
+
await (0, internal_2.addReleaseConfigForTsSolution)(host, options.name, projectConfiguration);
|
|
208
204
|
}
|
|
209
205
|
else {
|
|
210
206
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
211
|
-
await (0,
|
|
207
|
+
await (0, internal_2.addReleaseConfigForNonTsSolution)(host, options.name, projectConfiguration);
|
|
212
208
|
}
|
|
213
209
|
(0, devkit_1.updateProjectConfiguration)(host, options.name, projectConfiguration);
|
|
214
|
-
tasks.push(await (0,
|
|
210
|
+
tasks.push(await (0, internal_2.releaseTasks)(host));
|
|
215
211
|
}
|
|
216
212
|
if (!options.skipPackageJson) {
|
|
217
213
|
const installReactTask = await (0, install_common_dependencies_1.installCommonDependencies)(host, options);
|
|
@@ -226,14 +222,14 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
226
222
|
(0, maybe_js_1.maybeJs)(options, (0, devkit_1.joinPathFragments)(options.projectRoot, './src/index.ts')),
|
|
227
223
|
]);
|
|
228
224
|
}
|
|
229
|
-
(0,
|
|
225
|
+
(0, internal_2.updateTsconfigFiles)(host, options.projectRoot, 'tsconfig.lib.json', {
|
|
230
226
|
jsx: 'react-jsx',
|
|
231
227
|
module: 'esnext',
|
|
232
228
|
moduleResolution: 'bundler',
|
|
233
229
|
}, options.linter === 'eslint'
|
|
234
230
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
235
231
|
: undefined);
|
|
236
|
-
(0,
|
|
232
|
+
(0, internal_2.sortPackageJsonFields)(host, options.projectRoot);
|
|
237
233
|
if (!options.skipFormat) {
|
|
238
234
|
await (0, devkit_1.formatFiles)(host);
|
|
239
235
|
}
|
|
@@ -242,7 +238,7 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
242
238
|
tasks.push(() => (0, devkit_1.installPackagesTask)(host, true));
|
|
243
239
|
}
|
|
244
240
|
tasks.push(() => {
|
|
245
|
-
(0,
|
|
241
|
+
(0, internal_1.logShowProjectCommand)(options.name);
|
|
246
242
|
});
|
|
247
243
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
248
244
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Exposed by the federation plugin as '<%= projectName %>/<%= exposeName %>'.
|
|
2
|
+
// Consumers render it lazily via `lazyProvider('<%= projectName %>', '<%= exposeName %>')`.
|
|
3
|
+
export function <%= componentName %>() {
|
|
4
|
+
return (
|
|
5
|
+
<section data-testid="<%= projectName %>">
|
|
6
|
+
<h1>Hello from <%= projectName %></h1>
|
|
7
|
+
</section>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default <%= componentName %>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { <%= componentName %> } from './<%= componentName %>';
|
|
4
|
+
|
|
5
|
+
const container = document.getElementById('root');
|
|
6
|
+
if (!container) throw new Error('#root element not found');
|
|
7
|
+
|
|
8
|
+
createRoot(container).render(
|
|
9
|
+
<StrictMode>
|
|
10
|
+
<<%= componentName %> />
|
|
11
|
+
</StrictMode>
|
|
12
|
+
);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Indirection required by Module Federation: the federation runtime must boot
|
|
2
|
+
// before any shared dependency (React, react-dom, etc.) is evaluated. Dynamic
|
|
3
|
+
// `import('./bootstrap')` defers the real entry until federation is ready.
|
|
4
|
+
import('./bootstrap');
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"allowSyntheticDefaultImports": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
+
<title><%= projectName %> (standalone)</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<!-- Rsbuild's html plugin injects the entry script automatically. -->
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|