@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
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = addSvgrToWebpackConfig;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
7
7
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
8
8
|
const ts = tslib_1.__importStar(require("typescript"));
|
|
9
9
|
const withSvgrFunctionForWithReact = `
|
|
@@ -115,7 +115,7 @@ function withSvgr(svgrOptions = {}) {
|
|
|
115
115
|
async function addSvgrToWebpackConfig(tree) {
|
|
116
116
|
const projects = new Map();
|
|
117
117
|
// Find all React webpack projects using either withReact OR NxReactWebpackPlugin
|
|
118
|
-
(0,
|
|
118
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (options, project, target) => {
|
|
119
119
|
if (!options.webpackConfig)
|
|
120
120
|
return;
|
|
121
121
|
const webpackConfigPath = options.webpackConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-nx-react-webpack-plugin-import.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-23-0-0/remove-nx-react-webpack-plugin-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAwB,MAAM,YAAY,CAAC;AA8BrE,wBAA8B,gCAAgC,CAAC,IAAI,EAAE,IAAI,iBAuHxE"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = removeNxReactWebpackPluginImport;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
6
|
+
const DEPRECATED_SYMBOL = 'NxReactWebpackPlugin';
|
|
7
|
+
const DEPRECATED_PACKAGE = '@nx/react';
|
|
8
|
+
const NEW_PACKAGE = '@nx/react/webpack-plugin';
|
|
9
|
+
// ES module import: import { NxReactWebpackPlugin[, ...] } from '@nx/react'
|
|
10
|
+
const ES_IMPORT_SELECTOR = `ImportDeclaration:has(StringLiteral[value=${DEPRECATED_PACKAGE}]):has(ImportClause ImportSpecifier > Identifier[name=${DEPRECATED_SYMBOL}])`;
|
|
11
|
+
const IMPORT_SPECIFIERS_SELECTOR = `ImportClause ImportSpecifier`;
|
|
12
|
+
const TARGET_IMPORT_SPECIFIER_SELECTOR = `ImportClause ImportSpecifier > Identifier[name=${DEPRECATED_SYMBOL}]`;
|
|
13
|
+
const ES_MODULE_PATH_SELECTOR = `StringLiteral[value=${DEPRECATED_PACKAGE}]`;
|
|
14
|
+
// CJS require: const { NxReactWebpackPlugin[, ...] } = require('@nx/react')
|
|
15
|
+
const CJS_REQUIRE_STMT_SELECTOR = `VariableStatement:has(ObjectBindingPattern > BindingElement > Identifier[name=${DEPRECATED_SYMBOL}]):has(CallExpression:has(Identifier[name=require]) > StringLiteral[value=${DEPRECATED_PACKAGE}])`;
|
|
16
|
+
const CJS_BINDING_ELEMENTS_SELECTOR = `ObjectBindingPattern > BindingElement`;
|
|
17
|
+
const CJS_TARGET_BINDING_SELECTOR = `ObjectBindingPattern > BindingElement > Identifier[name=${DEPRECATED_SYMBOL}]`;
|
|
18
|
+
const CJS_REQUIRE_PATH_SELECTOR = `CallExpression:has(Identifier[name=require]) > StringLiteral[value=${DEPRECATED_PACKAGE}]`;
|
|
19
|
+
// Walk past whitespace from `fromIndex` to find a trailing comma. Returns the
|
|
20
|
+
// position AFTER the comma if found, otherwise the original index. Handles
|
|
21
|
+
// the `Foo , withReact` shape where the user wrote whitespace before the
|
|
22
|
+
// comma — `node.getEnd()` stops at the identifier and the comma sits one
|
|
23
|
+
// character past the whitespace.
|
|
24
|
+
function endAfterTrailingComma(text, fromIndex) {
|
|
25
|
+
let i = fromIndex;
|
|
26
|
+
while (i < text.length && /\s/.test(text.charAt(i)))
|
|
27
|
+
i++;
|
|
28
|
+
return text.charAt(i) === ',' ? i + 1 : fromIndex;
|
|
29
|
+
}
|
|
30
|
+
async function removeNxReactWebpackPluginImport(tree) {
|
|
31
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, '', (filePath) => {
|
|
32
|
+
if (!filePath.endsWith('.ts') &&
|
|
33
|
+
!filePath.endsWith('.tsx') &&
|
|
34
|
+
!filePath.endsWith('.js') &&
|
|
35
|
+
!filePath.endsWith('.jsx') &&
|
|
36
|
+
!filePath.endsWith('.cjs') &&
|
|
37
|
+
!filePath.endsWith('.mjs')) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let contents = tree.read(filePath, 'utf-8');
|
|
41
|
+
if (!contents)
|
|
42
|
+
return;
|
|
43
|
+
// Quick check: must contain the deprecated symbol and the deprecated package path
|
|
44
|
+
if (!contents.includes(DEPRECATED_SYMBOL) ||
|
|
45
|
+
(!contents.includes(`'${DEPRECATED_PACKAGE}'`) &&
|
|
46
|
+
!contents.includes(`"${DEPRECATED_PACKAGE}"`))) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
let changed = false;
|
|
50
|
+
// Re-parse on every iteration so multiple matches in the same file work
|
|
51
|
+
// correctly. The multi-specifier branch prepends a new declaration which
|
|
52
|
+
// shifts every offset; collected AST positions go stale after one rewrite,
|
|
53
|
+
// so process one match at a time.
|
|
54
|
+
let didRewrite = true;
|
|
55
|
+
while (didRewrite) {
|
|
56
|
+
didRewrite = false;
|
|
57
|
+
const sourceFile = (0, tsquery_1.ast)(contents);
|
|
58
|
+
const importNode = (0, tsquery_1.query)(sourceFile, ES_IMPORT_SELECTOR)[0];
|
|
59
|
+
if (importNode) {
|
|
60
|
+
const specifiers = (0, tsquery_1.query)(importNode, IMPORT_SPECIFIERS_SELECTOR);
|
|
61
|
+
const targetIdentifier = (0, tsquery_1.query)(importNode, TARGET_IMPORT_SPECIFIER_SELECTOR)[0];
|
|
62
|
+
if (targetIdentifier) {
|
|
63
|
+
// Walk to the ImportSpecifier to cover `Foo` and `Foo as Bar`.
|
|
64
|
+
const targetSpec = targetIdentifier.parent;
|
|
65
|
+
if (specifiers.length === 1) {
|
|
66
|
+
const modulePathNode = (0, tsquery_1.query)(importNode, ES_MODULE_PATH_SELECTOR)[0];
|
|
67
|
+
if (modulePathNode) {
|
|
68
|
+
contents =
|
|
69
|
+
contents.slice(0, modulePathNode.getStart()) +
|
|
70
|
+
`'${NEW_PACKAGE}'` +
|
|
71
|
+
contents.slice(modulePathNode.getEnd());
|
|
72
|
+
changed = true;
|
|
73
|
+
didRewrite = true;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// Extract target spec verbatim (preserves alias)
|
|
79
|
+
const end = endAfterTrailingComma(contents, targetSpec.getEnd());
|
|
80
|
+
contents =
|
|
81
|
+
`import { ${targetSpec.getText()} } from '${NEW_PACKAGE}';\n` +
|
|
82
|
+
contents.slice(0, targetSpec.getStart()) +
|
|
83
|
+
contents.slice(end);
|
|
84
|
+
changed = true;
|
|
85
|
+
didRewrite = true;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const stmtNode = (0, tsquery_1.query)(sourceFile, CJS_REQUIRE_STMT_SELECTOR)[0];
|
|
91
|
+
if (stmtNode) {
|
|
92
|
+
const bindingElements = (0, tsquery_1.query)(stmtNode, CJS_BINDING_ELEMENTS_SELECTOR);
|
|
93
|
+
const targetIdentifier = (0, tsquery_1.query)(stmtNode, CJS_TARGET_BINDING_SELECTOR)[0];
|
|
94
|
+
if (targetIdentifier) {
|
|
95
|
+
// Walk to the BindingElement to cover `Foo` and `Foo: Bar`.
|
|
96
|
+
const targetBinding = targetIdentifier.parent;
|
|
97
|
+
if (bindingElements.length === 1) {
|
|
98
|
+
const requirePathNode = (0, tsquery_1.query)(stmtNode, CJS_REQUIRE_PATH_SELECTOR)[0];
|
|
99
|
+
if (requirePathNode) {
|
|
100
|
+
contents =
|
|
101
|
+
contents.slice(0, requirePathNode.getStart()) +
|
|
102
|
+
`'${NEW_PACKAGE}'` +
|
|
103
|
+
contents.slice(requirePathNode.getEnd());
|
|
104
|
+
changed = true;
|
|
105
|
+
didRewrite = true;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// Extract target binding verbatim (preserves alias)
|
|
111
|
+
const end = endAfterTrailingComma(contents, targetBinding.getEnd());
|
|
112
|
+
contents =
|
|
113
|
+
`const { ${targetBinding.getText()} } = require('${NEW_PACKAGE}');\n` +
|
|
114
|
+
contents.slice(0, targetBinding.getStart()) +
|
|
115
|
+
contents.slice(end);
|
|
116
|
+
changed = true;
|
|
117
|
+
didRewrite = true;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (changed) {
|
|
124
|
+
tree.write(filePath, contents);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
128
|
+
}
|
|
@@ -6,11 +6,11 @@ exports.addRemoteRoute = addRemoteRoute;
|
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
8
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@nx/js/internal");
|
|
10
10
|
let tsModule;
|
|
11
11
|
function addRemoteToConfig(source, app) {
|
|
12
12
|
if (!tsModule) {
|
|
13
|
-
tsModule = (0,
|
|
13
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
14
14
|
}
|
|
15
15
|
const assignments = (0, js_1.findNodes)(source, tsModule.SyntaxKind.PropertyAssignment);
|
|
16
16
|
const remotesAssignment = assignments.find((s) => s.name.getText() === 'remotes');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/plugins/router-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router-plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/plugins/router-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,wBAAwB;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAUD,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,wBAAwB,CA2FjE,CAAC"}
|
|
@@ -1,35 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNodesV2 = void 0;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const fs_1 = require("fs");
|
|
7
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
8
8
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
9
|
-
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
10
9
|
const js_1 = require("@nx/js");
|
|
11
10
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
12
|
-
const
|
|
13
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
14
|
-
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
11
|
+
const internal_2 = require("@nx/js/internal");
|
|
15
12
|
const pmCommand = (0, devkit_1.getPackageManagerCommand)();
|
|
16
13
|
const reactRouterConfigBlob = '**/react-router.config.{ts,js,cjs,cts,mjs,mts}';
|
|
17
|
-
function readTargetsCache(cachePath) {
|
|
18
|
-
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false' && (0, fs_1.existsSync)(cachePath)
|
|
19
|
-
? (0, devkit_1.readJsonFile)(cachePath)
|
|
20
|
-
: {};
|
|
21
|
-
}
|
|
22
|
-
function writeTargetsToCache(cachePath, results) {
|
|
23
|
-
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
24
|
-
}
|
|
25
14
|
exports.createNodesV2 = [
|
|
26
15
|
reactRouterConfigBlob,
|
|
27
16
|
async (configFiles, options, context) => {
|
|
28
17
|
const optionsHash = (0, devkit_internals_1.hashObject)(options);
|
|
29
18
|
const normalizedOptions = normalizeOptions(options);
|
|
30
19
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `react-router-${optionsHash}.hash`);
|
|
31
|
-
const targetsCache =
|
|
32
|
-
const isUsingTsSolutionSetup = (0,
|
|
20
|
+
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
21
|
+
const isUsingTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
33
22
|
const { roots: projectRoots, configFiles: validConfigFiles } = configFiles.reduce((acc, configFile) => {
|
|
34
23
|
const potentialRoot = (0, path_1.dirname)(configFile);
|
|
35
24
|
if (checkIfConfigFileShouldBeProject(potentialRoot, context)) {
|
|
@@ -42,14 +31,16 @@ exports.createNodesV2 = [
|
|
|
42
31
|
configFiles: [],
|
|
43
32
|
});
|
|
44
33
|
const lockfile = (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
45
|
-
const hashes = await (0,
|
|
34
|
+
const hashes = await (0, internal_1.calculateHashesForCreateNodes)(projectRoots, { ...normalizedOptions, isUsingTsSolutionSetup }, context, projectRoots.map((_) => [lockfile]));
|
|
46
35
|
try {
|
|
47
36
|
return await (0, devkit_1.createNodesFromFiles)(async (configFile, _, context, idx) => {
|
|
48
37
|
const projectRoot = (0, path_1.dirname)(configFile);
|
|
49
38
|
const siblingFiles = (0, fs_1.readdirSync)((0, devkit_1.joinPathFragments)(context.workspaceRoot, projectRoot));
|
|
50
39
|
const hash = hashes[idx] + configFile;
|
|
51
|
-
|
|
52
|
-
await buildReactRouterTargets(configFile, projectRoot, normalizedOptions, context, siblingFiles, isUsingTsSolutionSetup));
|
|
40
|
+
if (!targetsCache.has(hash)) {
|
|
41
|
+
targetsCache.set(hash, await buildReactRouterTargets(configFile, projectRoot, normalizedOptions, context, siblingFiles, isUsingTsSolutionSetup));
|
|
42
|
+
}
|
|
43
|
+
const { projectType, metadata, targets } = targetsCache.get(hash);
|
|
53
44
|
const project = {
|
|
54
45
|
root: projectRoot,
|
|
55
46
|
targets,
|
|
@@ -66,16 +57,16 @@ exports.createNodesV2 = [
|
|
|
66
57
|
}, validConfigFiles, options, context);
|
|
67
58
|
}
|
|
68
59
|
finally {
|
|
69
|
-
|
|
60
|
+
targetsCache.writeToDisk();
|
|
70
61
|
}
|
|
71
62
|
},
|
|
72
63
|
];
|
|
73
64
|
async function buildReactRouterTargets(configFilePath, projectRoot, options, context, siblingFiles, isUsingTsSolutionSetup) {
|
|
74
|
-
const namedInputs = (0,
|
|
65
|
+
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
75
66
|
const configPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
|
|
76
67
|
if (require.cache[configPath])
|
|
77
|
-
(0,
|
|
78
|
-
const reactRouterConfig = await (0,
|
|
68
|
+
(0, internal_1.clearRequireCache)();
|
|
69
|
+
const reactRouterConfig = await (0, internal_1.loadConfigFile)(configPath);
|
|
79
70
|
const isLibMode = reactRouterConfig?.ssr !== undefined && reactRouterConfig.ssr === false;
|
|
80
71
|
const { buildDirectory, serverBuildPath } = await getBuildPaths(reactRouterConfig, isLibMode);
|
|
81
72
|
const targets = {};
|
|
@@ -85,7 +76,7 @@ async function buildReactRouterTargets(configFilePath, projectRoot, options, con
|
|
|
85
76
|
targets[options.startTargetName] = await startTarget(projectRoot, serverBuildPath, options.buildTargetName, isUsingTsSolutionSetup);
|
|
86
77
|
}
|
|
87
78
|
targets[options.typecheckTargetName] = await typecheckTarget(projectRoot, options.typecheckTargetName, namedInputs, siblingFiles, isUsingTsSolutionSetup);
|
|
88
|
-
(0,
|
|
79
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmCommand);
|
|
89
80
|
const metadata = {};
|
|
90
81
|
return {
|
|
91
82
|
targets,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateModuleFederationProject = updateModuleFederationProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const maybe_js_1 = require("../utils/maybe-js");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
function updateModuleFederationProject(host, options, isHost = false) {
|
|
8
8
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
9
9
|
projectConfig.targets ??= {};
|
|
@@ -14,7 +14,7 @@ function updateModuleFederationProject(host, options, isHost = false) {
|
|
|
14
14
|
webpackConfig: `${options.appProjectRoot}/webpack.config.${options.typescriptConfiguration && !options.js ? 'ts' : 'js'}`,
|
|
15
15
|
};
|
|
16
16
|
projectConfig.targets.build.configurations ??= {};
|
|
17
|
-
if (!(0,
|
|
17
|
+
if (!(0, internal_1.isUsingTsSolutionSetup)(host)) {
|
|
18
18
|
projectConfig.targets.build.configurations.production = {
|
|
19
19
|
...(projectConfig.targets.build.configurations?.production ?? {}),
|
|
20
20
|
webpackConfig: `${options.appProjectRoot}/webpack.config.prod.${options.typescriptConfiguration && !options.js ? 'ts' : 'js'}`,
|
|
@@ -62,7 +62,7 @@ function updateModuleFederationProject(host, options, isHost = false) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
// Typechecks must be performed first before build and serve to generate remote d.ts files.
|
|
65
|
-
if ((0,
|
|
65
|
+
if ((0, internal_1.isUsingTsSolutionSetup)(host)) {
|
|
66
66
|
projectConfig.targets.build ??= {};
|
|
67
67
|
projectConfig.targets.serve ??= {};
|
|
68
68
|
projectConfig.targets.build.dependsOn = ['^build', 'typecheck'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-mf-env-to-inputs.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/add-mf-env-to-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAA4B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"add-mf-env-to-inputs.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/add-mf-env-to-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAA4B,MAAM,YAAY,CAAC;AAMjE,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,QAAQ,GAAG,SAAS,QAkC9B"}
|
|
@@ -2,24 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addMfEnvToTargetDefaultInputs = addMfEnvToTargetDefaultInputs;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
function addMfEnvToTargetDefaultInputs(tree, bundler) {
|
|
6
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
7
8
|
const executor = bundler === 'rspack' ? '@nx/rspack:rspack' : '@nx/webpack:webpack';
|
|
8
9
|
const mfEnvVar = 'NX_MF_DEV_REMOTES';
|
|
9
|
-
nxJson.targetDefaults
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const existing = (0, internal_1.normalizeTargetDefaults)(nxJson.targetDefaults).find((e) => e.executor === executor &&
|
|
11
|
+
e.target === undefined &&
|
|
12
|
+
e.projects === undefined &&
|
|
13
|
+
e.plugin === undefined);
|
|
14
|
+
const inputs = [...(existing?.inputs ?? ['production', '^production'])];
|
|
13
15
|
let mfEnvVarExists = false;
|
|
14
|
-
for (const input of
|
|
16
|
+
for (const input of inputs) {
|
|
15
17
|
if (typeof input === 'object' && input['env'] === mfEnvVar) {
|
|
16
18
|
mfEnvVarExists = true;
|
|
17
19
|
break;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
if (!mfEnvVarExists) {
|
|
21
|
-
|
|
23
|
+
inputs.push({ env: mfEnvVar });
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
26
|
+
executor,
|
|
27
|
+
cache: true,
|
|
28
|
+
inputs,
|
|
29
|
+
dependsOn: existing?.dependsOn ?? ['^build'],
|
|
30
|
+
});
|
|
24
31
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
25
32
|
}
|
package/src/utils/ast-utils.js
CHANGED
|
@@ -21,11 +21,11 @@ exports.getComponentNode = getComponentNode;
|
|
|
21
21
|
exports.parseComponentPropsInfo = parseComponentPropsInfo;
|
|
22
22
|
const js_1 = require("@nx/js");
|
|
23
23
|
const devkit_1 = require("@nx/devkit");
|
|
24
|
-
const
|
|
24
|
+
const internal_1 = require("@nx/js/internal");
|
|
25
25
|
let tsModule;
|
|
26
26
|
function addImport(source, statement) {
|
|
27
27
|
if (!tsModule) {
|
|
28
|
-
tsModule = (0,
|
|
28
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
29
29
|
}
|
|
30
30
|
const allImports = (0, js_1.findNodes)(source, tsModule.SyntaxKind.ImportDeclaration);
|
|
31
31
|
if (allImports.length > 0) {
|
|
@@ -50,7 +50,7 @@ function addImport(source, statement) {
|
|
|
50
50
|
}
|
|
51
51
|
function findMainRenderStatement(source) {
|
|
52
52
|
if (!tsModule) {
|
|
53
|
-
tsModule = (0,
|
|
53
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
54
54
|
}
|
|
55
55
|
// 1. Try to find ReactDOM.render.
|
|
56
56
|
const calls = (0, js_1.findNodes)(source, tsModule.SyntaxKind.CallExpression);
|
|
@@ -88,7 +88,7 @@ function findDefaultExport(source) {
|
|
|
88
88
|
}
|
|
89
89
|
function findDefaultExportDeclaration(source) {
|
|
90
90
|
if (!tsModule) {
|
|
91
|
-
tsModule = (0,
|
|
91
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
92
92
|
}
|
|
93
93
|
const identifier = findDefaultExportIdentifier(source);
|
|
94
94
|
if (identifier) {
|
|
@@ -107,7 +107,7 @@ function findDefaultExportDeclaration(source) {
|
|
|
107
107
|
}
|
|
108
108
|
function findExportDeclarationsForJsx(source) {
|
|
109
109
|
if (!tsModule) {
|
|
110
|
-
tsModule = (0,
|
|
110
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
111
111
|
}
|
|
112
112
|
const variables = (0, js_1.findNodes)(source, tsModule.SyntaxKind.VariableDeclaration);
|
|
113
113
|
const variableStatements = (0, js_1.findNodes)(source, tsModule.SyntaxKind.VariableStatement);
|
|
@@ -157,7 +157,7 @@ function findExportDeclarationsForJsx(source) {
|
|
|
157
157
|
}
|
|
158
158
|
function findDefaultExportIdentifier(source) {
|
|
159
159
|
if (!tsModule) {
|
|
160
|
-
tsModule = (0,
|
|
160
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
161
161
|
}
|
|
162
162
|
const exports = (0, js_1.findNodes)(source, tsModule.SyntaxKind.ExportAssignment);
|
|
163
163
|
const identifier = exports
|
|
@@ -167,7 +167,7 @@ function findDefaultExportIdentifier(source) {
|
|
|
167
167
|
}
|
|
168
168
|
function findDefaultClassOrFunction(source) {
|
|
169
169
|
if (!tsModule) {
|
|
170
|
-
tsModule = (0,
|
|
170
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
171
171
|
}
|
|
172
172
|
const fns = (0, js_1.findNodes)(source, tsModule.SyntaxKind.FunctionDeclaration);
|
|
173
173
|
const cls = (0, js_1.findNodes)(source, tsModule.SyntaxKind.ClassDeclaration);
|
|
@@ -177,7 +177,7 @@ function findDefaultClassOrFunction(source) {
|
|
|
177
177
|
}
|
|
178
178
|
function hasDefaultExportModifier(x) {
|
|
179
179
|
if (!tsModule) {
|
|
180
|
-
tsModule = (0,
|
|
180
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
181
181
|
}
|
|
182
182
|
return (x.modifiers &&
|
|
183
183
|
x.modifiers.some((m) => m.kind === tsModule.SyntaxKind.ExportKeyword) &&
|
|
@@ -185,7 +185,7 @@ function hasDefaultExportModifier(x) {
|
|
|
185
185
|
}
|
|
186
186
|
function findComponentImportPath(componentName, source) {
|
|
187
187
|
if (!tsModule) {
|
|
188
|
-
tsModule = (0,
|
|
188
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
189
189
|
}
|
|
190
190
|
const allImports = (0, js_1.findNodes)(source, tsModule.SyntaxKind.ImportDeclaration);
|
|
191
191
|
const matching = allImports.filter((i) => {
|
|
@@ -201,7 +201,7 @@ function findComponentImportPath(componentName, source) {
|
|
|
201
201
|
}
|
|
202
202
|
function findElements(source, tagName) {
|
|
203
203
|
if (!tsModule) {
|
|
204
|
-
tsModule = (0,
|
|
204
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
205
205
|
}
|
|
206
206
|
const nodes = (0, js_1.findNodes)(source, [
|
|
207
207
|
tsModule.SyntaxKind.JsxSelfClosingElement,
|
|
@@ -222,7 +222,7 @@ function findClosestOpening(tagName, node) {
|
|
|
222
222
|
}
|
|
223
223
|
function isTag(tagName, node) {
|
|
224
224
|
if (!tsModule) {
|
|
225
|
-
tsModule = (0,
|
|
225
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
226
226
|
}
|
|
227
227
|
if (tsModule.isJsxOpeningLikeElement(node)) {
|
|
228
228
|
return (node.tagName.kind === tsModule.SyntaxKind.Identifier &&
|
|
@@ -236,7 +236,7 @@ function isTag(tagName, node) {
|
|
|
236
236
|
}
|
|
237
237
|
function addInitialRoutes(sourcePath, source, addBrowserRouter) {
|
|
238
238
|
if (!tsModule) {
|
|
239
|
-
tsModule = (0,
|
|
239
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
240
240
|
}
|
|
241
241
|
const jsxClosingElements = (0, js_1.findNodes)(source, [
|
|
242
242
|
tsModule.SyntaxKind.JsxClosingElement,
|
|
@@ -405,7 +405,7 @@ const store = configureStore({
|
|
|
405
405
|
}
|
|
406
406
|
function updateReduxStore(sourcePath, source, feature) {
|
|
407
407
|
if (!tsModule) {
|
|
408
|
-
tsModule = (0,
|
|
408
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
409
409
|
}
|
|
410
410
|
const calls = (0, js_1.findNodes)(source, tsModule.SyntaxKind.CallExpression);
|
|
411
411
|
let reducerDescriptor;
|
|
@@ -459,7 +459,7 @@ function updateReduxStore(sourcePath, source, feature) {
|
|
|
459
459
|
}
|
|
460
460
|
function getComponentNode(sourceFile) {
|
|
461
461
|
if (!tsModule) {
|
|
462
|
-
tsModule = (0,
|
|
462
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
463
463
|
}
|
|
464
464
|
const defaultExport = findDefaultExport(sourceFile);
|
|
465
465
|
if (!(defaultExport &&
|
|
@@ -472,7 +472,7 @@ function getComponentNode(sourceFile) {
|
|
|
472
472
|
}
|
|
473
473
|
function parseComponentPropsInfo(sourceFile, cmpDeclaration) {
|
|
474
474
|
if (!tsModule) {
|
|
475
|
-
tsModule = (0,
|
|
475
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
476
476
|
}
|
|
477
477
|
let propsTypeName = null;
|
|
478
478
|
let inlineTypeString = null;
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getArgsDefaultValue = getArgsDefaultValue;
|
|
4
4
|
exports.getComponentPropDefaults = getComponentPropDefaults;
|
|
5
5
|
exports.getImportForType = getImportForType;
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
const ast_utils_1 = require("./ast-utils");
|
|
8
8
|
let tsModule;
|
|
9
9
|
// TODO: candidate to refactor with the angular component story
|
|
10
10
|
function getArgsDefaultValue(property) {
|
|
11
11
|
if (!tsModule) {
|
|
12
|
-
tsModule = (0,
|
|
12
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
13
13
|
}
|
|
14
14
|
const typeNameToDefault = {
|
|
15
15
|
[tsModule.SyntaxKind.StringKeyword]: "''",
|
|
@@ -26,7 +26,7 @@ function getArgsDefaultValue(property) {
|
|
|
26
26
|
}
|
|
27
27
|
function getComponentPropDefaults(sourceFile, cmpDeclaration) {
|
|
28
28
|
if (!tsModule) {
|
|
29
|
-
tsModule = (0,
|
|
29
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
30
30
|
}
|
|
31
31
|
const info = (0, ast_utils_1.parseComponentPropsInfo)(sourceFile, cmpDeclaration);
|
|
32
32
|
let propsTypeName = null;
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createTsConfig = createTsConfig;
|
|
4
4
|
exports.extractTsConfigBase = extractTsConfigBase;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const shared = tslib_1.__importStar(require("@nx/js
|
|
6
|
+
const shared = tslib_1.__importStar(require("@nx/js"));
|
|
7
7
|
const json_1 = require("nx/src/generators/utils/json");
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@nx/js/internal");
|
|
9
9
|
function createTsConfig(host, projectRoot, type, options, relativePathToRootTsConfig) {
|
|
10
|
-
if ((0,
|
|
10
|
+
if ((0, internal_1.isUsingTsSolutionSetup)(host)) {
|
|
11
11
|
createTsConfigForTsSolution(host, projectRoot, type, options, relativePathToRootTsConfig);
|
|
12
12
|
}
|
|
13
13
|
else {
|
package/src/utils/ct-utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import { type FoundTarget } from '@nx/cypress/
|
|
2
|
+
import { type FoundTarget } from '@nx/cypress/internal';
|
|
3
3
|
export declare function configureCypressCT(tree: Tree, options: {
|
|
4
4
|
project: string;
|
|
5
5
|
buildTarget: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/ct-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ct-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/ct-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQxD,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IACP,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACjC,GACA,OAAO,CAAC,WAAW,CAAC,CAiEtB;AAUD,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAY7B;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EAC/D,KAAK,EAAE,WAAW,+BASnB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAmBjE"}
|
package/src/utils/ct-utils.js
CHANGED
|
@@ -38,7 +38,7 @@ exports.getBundlerFromTarget = getBundlerFromTarget;
|
|
|
38
38
|
exports.getActualBundler = getActualBundler;
|
|
39
39
|
exports.isComponent = isComponent;
|
|
40
40
|
const devkit_1 = require("@nx/devkit");
|
|
41
|
-
const
|
|
41
|
+
const internal_1 = require("@nx/js/internal");
|
|
42
42
|
const ast_utils_1 = require("./ast-utils");
|
|
43
43
|
let tsModule;
|
|
44
44
|
const allowedFileExt = new RegExp(/\.[jt]sx?/);
|
|
@@ -48,7 +48,7 @@ async function configureCypressCT(tree, options) {
|
|
|
48
48
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
49
49
|
// Specifically undefined as a workaround for Remix to pass an empty string as the buildTarget
|
|
50
50
|
if (options.buildTarget === undefined) {
|
|
51
|
-
const { findBuildConfig } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/
|
|
51
|
+
const { findBuildConfig } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/internal')));
|
|
52
52
|
found = await findBuildConfig(tree, {
|
|
53
53
|
project: options.project,
|
|
54
54
|
buildTarget: options.buildTarget,
|
|
@@ -65,7 +65,7 @@ async function configureCypressCT(tree, options) {
|
|
|
65
65
|
throw new Error(`Cypress Component Testing is not currently supported for this project. Either 'executer' is not defined in '${target} target' of '${project} project.json' or executer present is not valid one. Valid ones are ${JSON.stringify([...options.validExecutorNames])}. Please check https://github.com/nrwl/nx/issues/21546 for more information.`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
const { addDefaultCTConfig, getProjectCypressConfigPath } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/
|
|
68
|
+
const { addDefaultCTConfig, getProjectCypressConfigPath } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/internal')));
|
|
69
69
|
const ctConfigOptions = {
|
|
70
70
|
bundler: options.bundler ?? (await getActualBundler(tree, options, found)),
|
|
71
71
|
};
|
|
@@ -82,8 +82,8 @@ async function configureCypressCT(tree, options) {
|
|
|
82
82
|
ctConfigOptions.buildTarget = found.target;
|
|
83
83
|
}
|
|
84
84
|
const cypressConfigFilePath = getProjectCypressConfigPath(tree, projectConfig.root);
|
|
85
|
-
const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigFilePath, 'utf-8'), ctConfigOptions);
|
|
86
|
-
tree.write(cypressConfigFilePath,
|
|
85
|
+
const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigFilePath, 'utf-8'), ctConfigOptions, '@nx/react/plugins/component-testing');
|
|
86
|
+
tree.write(cypressConfigFilePath, updatedCyConfig);
|
|
87
87
|
return found;
|
|
88
88
|
}
|
|
89
89
|
function assertValidConfig(config) {
|
|
@@ -109,7 +109,7 @@ async function getActualBundler(tree, options, found) {
|
|
|
109
109
|
}
|
|
110
110
|
function isComponent(tree, filePath) {
|
|
111
111
|
if (!tsModule) {
|
|
112
|
-
tsModule = (0,
|
|
112
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
113
113
|
}
|
|
114
114
|
if (isSpecFile.test(filePath) || !allowedFileExt.test(filePath)) {
|
|
115
115
|
return false;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeRemoteName = normalizeRemoteName;
|
|
4
4
|
exports.normalizeRemoteDirectory = normalizeRemoteDirectory;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
async function normalizeRemoteName(tree, remote, options) {
|
|
8
|
-
const { projectName: remoteName } = await (0,
|
|
8
|
+
const { projectName: remoteName } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
9
9
|
name: remote,
|
|
10
10
|
projectType: 'application',
|
|
11
11
|
directory: options.directory,
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const typesReactDomVersion = "^19.0.0";
|
|
|
13
13
|
export declare const typesReactIsV18Version = "18.3.0";
|
|
14
14
|
export declare const typesReactIsVersion = "^19.0.0";
|
|
15
15
|
export declare const reactViteVersion = "^4.2.0";
|
|
16
|
-
export declare const typesNodeVersion = "^
|
|
16
|
+
export declare const typesNodeVersion = "^22.0.0";
|
|
17
17
|
export declare const babelPresetReactVersion = "^7.14.5";
|
|
18
18
|
export declare const babelCoreVersion = "^7.14.5";
|
|
19
19
|
export declare const reactRouterDomVersion = "6.30.3";
|
package/src/utils/versions.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.typesReactIsV18Version = '18.3.0';
|
|
|
17
17
|
exports.typesReactIsVersion = '^19.0.0';
|
|
18
18
|
exports.reactViteVersion = '^4.2.0';
|
|
19
19
|
// Needed for React-Router
|
|
20
|
-
exports.typesNodeVersion = '^
|
|
20
|
+
exports.typesNodeVersion = '^22.0.0';
|
|
21
21
|
exports.babelPresetReactVersion = '^7.14.5';
|
|
22
22
|
exports.babelCoreVersion = '^7.14.5';
|
|
23
23
|
exports.reactRouterDomVersion = '6.30.3';
|
package/tailwind.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/js/internal");
|
|
5
5
|
let hasWarned = false;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated `@nx/react/tailwind` will be removed in Nx 24. Migrate to Tailwind CSS v4 which no longer needs glob patterns.
|
|
@@ -15,7 +15,7 @@ function createGlobPatternsForDependencies(dirPath, fileGlobPattern = '/**/!(*.s
|
|
|
15
15
|
`See: https://nx.dev/docs/technologies/react/guides/using-tailwind-css-in-react\n`);
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPattern);
|
|
19
19
|
}
|
|
20
20
|
catch (e) {
|
|
21
21
|
/**
|