@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultPort = getDefaultPort;
|
|
4
|
+
exports.toFederationName = toFederationName;
|
|
5
|
+
exports.normalizeScaffoldOptions = normalizeScaffoldOptions;
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
8
|
+
// Default ports are split so a `consumer` + `provider` generated with no
|
|
9
|
+
// overrides don't collide. Consumer gets the round base (the user navigates
|
|
10
|
+
// to it); providers get base+1, base+2, etc., so a manifest pointing at
|
|
11
|
+
// `consumer-base + 1` lines up with the first generated provider.
|
|
12
|
+
//
|
|
13
|
+
// Vite base deliberately avoids 5000 (macOS AirTunes binds it on the IPv4
|
|
14
|
+
// wildcard, leading to silent EADDRINUSE on `127.0.0.1`).
|
|
15
|
+
const DEFAULT_BASE_PORTS = {
|
|
16
|
+
vite: 5100,
|
|
17
|
+
rsbuild: 3100,
|
|
18
|
+
rspack: 8100,
|
|
19
|
+
};
|
|
20
|
+
function getDefaultPort(bundler, surface) {
|
|
21
|
+
const base = DEFAULT_BASE_PORTS[bundler];
|
|
22
|
+
return surface === 'consumer' ? base : base + 1;
|
|
23
|
+
}
|
|
24
|
+
// Federation `name` must be a JS identifier so the bundler can use it as a
|
|
25
|
+
// global namespace. Hyphens are allowed in project names but invalid as an
|
|
26
|
+
// identifier, so we coerce to underscores.
|
|
27
|
+
function toFederationName(projectName) {
|
|
28
|
+
if (!/[A-Za-z0-9]/.test(projectName)) {
|
|
29
|
+
throw new Error(`Cannot derive a federation name from project name '${projectName}'. Use letters, digits, hyphens, or underscores.`);
|
|
30
|
+
}
|
|
31
|
+
const candidate = projectName
|
|
32
|
+
.replace(/-/g, '_')
|
|
33
|
+
.replace(/[^A-Za-z0-9_]/g, '');
|
|
34
|
+
if (/^[0-9]/.test(candidate)) {
|
|
35
|
+
throw new Error(`Federation name '${candidate}' (derived from project '${projectName}') cannot start with a digit. Rename the project.`);
|
|
36
|
+
}
|
|
37
|
+
return candidate;
|
|
38
|
+
}
|
|
39
|
+
async function normalizeScaffoldOptions(tree, raw) {
|
|
40
|
+
const bundler = raw.bundler ?? 'vite';
|
|
41
|
+
const { projectName, projectRoot } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
42
|
+
projectType: 'application',
|
|
43
|
+
directory: raw.directory,
|
|
44
|
+
});
|
|
45
|
+
const federationName = toFederationName((0, devkit_1.names)(projectName).fileName);
|
|
46
|
+
const port = raw.port ?? getDefaultPort(bundler, raw.surface);
|
|
47
|
+
return { projectName, federationName, bundler, port, projectRoot };
|
|
48
|
+
}
|
|
@@ -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
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
7
7
|
const find_free_port_1 = require("./find-free-port");
|
|
8
|
-
const
|
|
8
|
+
const internal_2 = require("@nx/js/internal");
|
|
9
9
|
async function normalizeOptions(host, options) {
|
|
10
|
-
await (0,
|
|
11
|
-
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0,
|
|
10
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
11
|
+
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
12
12
|
name: options.name,
|
|
13
13
|
projectType: 'application',
|
|
14
14
|
directory: options.directory,
|
|
@@ -19,7 +19,7 @@ async function normalizeOptions(host, options) {
|
|
|
19
19
|
nxJson.useInferencePlugins !== false;
|
|
20
20
|
options.addPlugin ??= addPlugin;
|
|
21
21
|
options.rootProject = appProjectRoot === '.';
|
|
22
|
-
const isUsingTsSolutionConfig = (0,
|
|
22
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
23
23
|
const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
|
|
24
24
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
25
25
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentGenerator = componentGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const ast_utils_1 = require("../../utils/ast-utils");
|
|
8
8
|
const get_in_source_vitest_tests_template_1 = require("../../utils/get-in-source-vitest-tests-template");
|
|
@@ -45,7 +45,7 @@ function createComponentFiles(host, options) {
|
|
|
45
45
|
let tsModule;
|
|
46
46
|
function addExportsToBarrel(host, options) {
|
|
47
47
|
if (!tsModule) {
|
|
48
|
-
tsModule = (0,
|
|
48
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
49
49
|
}
|
|
50
50
|
const workspace = (0, devkit_1.getProjects)(host);
|
|
51
51
|
const isApp = workspace.get(options.projectName).projectType === 'application';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/component/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/component/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,IAAI,EAAE,MAAM,YAAY,CAAC;AAI3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGrD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CA0D3B"}
|
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
7
|
-
const
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
async function normalizeOptions(tree, options) {
|
|
9
9
|
(0, assertion_1.assertValidStyle)(options.style);
|
|
10
|
-
const { artifactName: name, directory, fileName, filePath, fileExtension, fileExtensionType, project: projectName, } = await (0,
|
|
10
|
+
const { artifactName: name, directory, fileName, filePath, fileExtension, fileExtensionType, project: projectName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
11
11
|
path: options.path,
|
|
12
12
|
name: options.name,
|
|
13
13
|
allowedFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
|
|
14
|
-
fileExtension:
|
|
15
|
-
js: options.js,
|
|
14
|
+
fileExtension: 'tsx',
|
|
16
15
|
});
|
|
17
16
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
18
17
|
const { className } = (0, devkit_1.names)(name);
|
|
19
18
|
const { sourceRoot: projectSourceRoot, root: projectRoot, projectType, } = project;
|
|
20
19
|
if (options.export &&
|
|
21
|
-
(0,
|
|
20
|
+
(0, internal_2.getProjectType)(tree, projectRoot, projectType) === 'application') {
|
|
22
21
|
devkit_1.logger.warn(`The "--export" option should not be used with applications and will do nothing.`);
|
|
23
22
|
}
|
|
24
23
|
options.classComponent = options.classComponent ?? false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileExtensionType } from '@nx/devkit/
|
|
1
|
+
import type { FileExtensionType } from '@nx/devkit/internal';
|
|
2
2
|
import { SupportedStyles } from '../../../typings/style';
|
|
3
3
|
|
|
4
4
|
export interface Schema {
|
|
@@ -14,14 +14,9 @@ export interface Schema {
|
|
|
14
14
|
skipFormat?: boolean;
|
|
15
15
|
// Used by Next.js to determine how React should generate the page
|
|
16
16
|
isNextPage?: boolean;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Provide the full file path including the file extension in the `path` option. This option will be removed in Nx v21.
|
|
20
|
-
*/
|
|
21
|
-
js?: boolean;
|
|
22
17
|
}
|
|
23
18
|
|
|
24
|
-
export interface NormalizedSchema extends
|
|
19
|
+
export interface NormalizedSchema extends Schema {
|
|
25
20
|
directory: string;
|
|
26
21
|
projectRoot: string;
|
|
27
22
|
projectSourceRoot: string;
|
|
@@ -45,11 +45,6 @@
|
|
|
45
45
|
]
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
"js": {
|
|
49
|
-
"type": "boolean",
|
|
50
|
-
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
51
|
-
"x-deprecated": "Provide the full file path including the file extension in the `path` option. This option will be removed in Nx v21."
|
|
52
|
-
},
|
|
53
48
|
"skipTests": {
|
|
54
49
|
"type": "boolean",
|
|
55
50
|
"description": "When true, does not create `spec.ts` test files for the new component.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-story.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-story/component-story.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"component-story.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-story/component-story.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAWtC,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,EACE,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,EAAE,gCAAgC,QA2EpC;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,cAAc,EAAE,EAAE,CAAC,IAAI,EACvB,kBAAkB,EAAE,MAAM,EAC1B,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,OAAO,EACzB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,OAAO,EAClB,aAAa,CAAC,EAAE,OAAO,QAwBxB;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gCAAgC,iBAWzC;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -4,8 +4,7 @@ exports.createComponentStoriesFile = createComponentStoriesFile;
|
|
|
4
4
|
exports.findPropsAndGenerateFile = findPropsAndGenerateFile;
|
|
5
5
|
exports.componentStoryGenerator = componentStoryGenerator;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
9
8
|
const ast_utils_1 = require("../../utils/ast-utils");
|
|
10
9
|
const component_props_1 = require("../../utils/component-props");
|
|
11
10
|
const framework_1 = require("../../utils/framework");
|
|
@@ -13,10 +12,10 @@ const path_1 = require("path");
|
|
|
13
12
|
let tsModule;
|
|
14
13
|
function createComponentStoriesFile(host, { project, componentPath, interactionTests, uiFramework, }) {
|
|
15
14
|
if (!tsModule) {
|
|
16
|
-
tsModule = (0,
|
|
15
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
17
16
|
}
|
|
18
17
|
const proj = (0, devkit_1.getProjects)(host).get(project);
|
|
19
|
-
const componentFilePath = (0, devkit_1.joinPathFragments)((0,
|
|
18
|
+
const componentFilePath = (0, devkit_1.joinPathFragments)((0, internal_1.getProjectSourceRoot)(proj, host), componentPath);
|
|
20
19
|
const componentDirectory = componentFilePath.replace(componentFilePath.slice(componentFilePath.lastIndexOf('/')), '');
|
|
21
20
|
const isPlainJs = componentFilePath.endsWith('.jsx') || componentFilePath.endsWith('.js');
|
|
22
21
|
const componentFileName = componentFilePath
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-test.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/component-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"component-test.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/component-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mBAAmB,iBAkB7B;AAqED,eAAe,sBAAsB,CAAC"}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentTestGenerator = componentTestGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
6
|
const path_1 = require("path");
|
|
8
7
|
const ast_utils_1 = require("../../utils/ast-utils");
|
|
9
8
|
const component_props_1 = require("../../utils/component-props");
|
|
@@ -14,7 +13,7 @@ async function componentTestGenerator(tree, options) {
|
|
|
14
13
|
// normalize any windows paths
|
|
15
14
|
options.componentPath = options.componentPath.replace(/\\/g, '/');
|
|
16
15
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
17
|
-
const sourceRoot = (0,
|
|
16
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(projectConfig, tree);
|
|
18
17
|
const normalizedPath = options.componentPath.startsWith(sourceRoot)
|
|
19
18
|
? (0, path_1.relative)(sourceRoot, options.componentPath)
|
|
20
19
|
: options.componentPath;
|
|
@@ -25,7 +24,7 @@ async function componentTestGenerator(tree, options) {
|
|
|
25
24
|
}
|
|
26
25
|
function generateSpecsForComponents(tree, filePath) {
|
|
27
26
|
if (!tsModule) {
|
|
28
|
-
tsModule = (0,
|
|
27
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
29
28
|
}
|
|
30
29
|
const sourceFile = tsModule.createSourceFile(filePath, tree.read(filePath, 'utf-8'), tsModule.ScriptTarget.Latest, true);
|
|
31
30
|
const cmpNodes = (0, ast_utils_1.findExportDeclarationsForJsx)(sourceFile);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import type { ConsumerGeneratorSchema } from './schema';
|
|
3
|
+
export declare function consumerGenerator(tree: Tree, schema: ConsumerGeneratorSchema): Promise<GeneratorCallback>;
|
|
4
|
+
export default consumerGenerator;
|
|
5
|
+
//# sourceMappingURL=consumer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/consumer/consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EAIjB,IAAI,EACL,MAAM,YAAY,CAAC;AAgBpB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAgBxD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAqI5B;AAED,eAAe,iBAAiB,CAAC"}
|