@nx/react 22.4.0-canary.20260112-6cca28c → 22.4.0-canary.20260114-45f2ae3
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 +2 -1
- package/migrations.json +2 -2
- package/package.json +18 -18
- package/src/generators/setup-tailwind/setup-tailwind.d.ts.map +1 -1
- package/src/generators/setup-tailwind/setup-tailwind.js +1 -0
- package/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.js +6 -6
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +2 -2
- package/src/migrations/update-22-0-0/add-svgr-to-webpack-config.js +11 -11
package/generators.json
CHANGED
|
@@ -90,7 +90,8 @@
|
|
|
90
90
|
"factory": "./src/generators/setup-tailwind/setup-tailwind#setupTailwindGenerator",
|
|
91
91
|
"schema": "./src/generators/setup-tailwind/schema.json",
|
|
92
92
|
"description": "Set up Tailwind configuration for a project.",
|
|
93
|
-
"hidden": false
|
|
93
|
+
"hidden": false,
|
|
94
|
+
"x-deprecated": "Generating Tailwind configuration is no longer maintained. This generator will be removed in Nx 23."
|
|
94
95
|
},
|
|
95
96
|
"setup-ssr": {
|
|
96
97
|
"factory": "./src/generators/setup-ssr/setup-ssr#setupSsrGenerator",
|
package/migrations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "22.4.0-canary.
|
|
3
|
+
"version": "22.4.0-canary.20260114-45f2ae3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -32,34 +32,34 @@
|
|
|
32
32
|
"migrations": "./migrations.json"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@phenomnomnominal/tsquery": "~
|
|
35
|
+
"@phenomnomnominal/tsquery": "~6.1.4",
|
|
36
36
|
"@svgr/webpack": "^8.0.1",
|
|
37
37
|
"file-loader": "^6.2.0",
|
|
38
|
-
"minimatch": "
|
|
38
|
+
"minimatch": "10.1.1",
|
|
39
39
|
"picocolors": "^1.1.0",
|
|
40
40
|
"tslib": "^2.3.0",
|
|
41
|
-
"@nx/devkit": "22.4.0-canary.
|
|
42
|
-
"@nx/js": "22.4.0-canary.
|
|
43
|
-
"@nx/eslint": "22.4.0-canary.
|
|
44
|
-
"@nx/web": "22.4.0-canary.
|
|
45
|
-
"@nx/module-federation": "22.4.0-canary.
|
|
46
|
-
"@nx/rollup": "22.4.0-canary.
|
|
41
|
+
"@nx/devkit": "22.4.0-canary.20260114-45f2ae3",
|
|
42
|
+
"@nx/js": "22.4.0-canary.20260114-45f2ae3",
|
|
43
|
+
"@nx/eslint": "22.4.0-canary.20260114-45f2ae3",
|
|
44
|
+
"@nx/web": "22.4.0-canary.20260114-45f2ae3",
|
|
45
|
+
"@nx/module-federation": "22.4.0-canary.20260114-45f2ae3",
|
|
46
|
+
"@nx/rollup": "22.4.0-canary.20260114-45f2ae3",
|
|
47
47
|
"express": "^4.21.2",
|
|
48
48
|
"http-proxy-middleware": "^3.0.5",
|
|
49
49
|
"semver": "^7.6.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@nx/cypress": "22.4.0-canary.
|
|
53
|
-
"@nx/playwright": "22.4.0-canary.
|
|
54
|
-
"@nx/rsbuild": "22.4.0-canary.
|
|
55
|
-
"@nx/vite": "22.4.0-canary.
|
|
56
|
-
"@nx/vitest": "22.4.0-canary.
|
|
57
|
-
"@nx/webpack": "22.4.0-canary.
|
|
58
|
-
"@nx/storybook": "22.4.0-canary.
|
|
59
|
-
"nx": "22.4.0-canary.
|
|
52
|
+
"@nx/cypress": "22.4.0-canary.20260114-45f2ae3",
|
|
53
|
+
"@nx/playwright": "22.4.0-canary.20260114-45f2ae3",
|
|
54
|
+
"@nx/rsbuild": "22.4.0-canary.20260114-45f2ae3",
|
|
55
|
+
"@nx/vite": "22.4.0-canary.20260114-45f2ae3",
|
|
56
|
+
"@nx/vitest": "22.4.0-canary.20260114-45f2ae3",
|
|
57
|
+
"@nx/webpack": "22.4.0-canary.20260114-45f2ae3",
|
|
58
|
+
"@nx/storybook": "22.4.0-canary.20260114-45f2ae3",
|
|
59
|
+
"nx": "22.4.0-canary.20260114-45f2ae3"
|
|
60
60
|
},
|
|
61
61
|
"optionalDependencies": {
|
|
62
|
-
"@nx/vite": "22.4.0-canary.
|
|
62
|
+
"@nx/vite": "22.4.0-canary.20260114-45f2ae3"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-tailwind.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/setup-tailwind/setup-tailwind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAgB1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"setup-tailwind.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/setup-tailwind/setup-tailwind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAgB1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,8BA8C9B;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -7,6 +7,7 @@ const add_tailwind_style_imports_1 = require("./lib/add-tailwind-style-imports")
|
|
|
7
7
|
const update_project_1 = require("./lib/update-project");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
async function setupTailwindGenerator(tree, options) {
|
|
10
|
+
devkit_1.logger.warn(`The 'setup-tailwind' generator is deprecated. Generating Tailwind configuration is no longer maintained. This generator will be removed in Nx 23.`);
|
|
10
11
|
const tasks = [];
|
|
11
12
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
12
13
|
if (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'postcss.config.js')) ||
|
|
@@ -32,15 +32,15 @@ async function migrateMfImportsToNewPackage(tree) {
|
|
|
32
32
|
if (!contents.includes(MF_IMPORT_TO_UPDATE)) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
const importNodes = (0, tsquery_1.
|
|
35
|
+
const sourceFile = (0, tsquery_1.ast)(contents);
|
|
36
|
+
const importNodes = (0, tsquery_1.query)(sourceFile, MF_CONFIG_IMPORT_SELECTOR);
|
|
37
37
|
if (importNodes.length === 0) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
const importNode = importNodes[0];
|
|
41
|
-
const importSpecifiers = (0, tsquery_1.
|
|
41
|
+
const importSpecifiers = (0, tsquery_1.query)(importNode, IMPORT_TOKENS_SELECTOR);
|
|
42
42
|
if (importSpecifiers.length > 1) {
|
|
43
|
-
const mfConfigImportSpecifierNode = (0, tsquery_1.
|
|
43
|
+
const mfConfigImportSpecifierNode = (0, tsquery_1.query)(importNode, MF_CONFIG_IMPORT_SPECIFIER_SELECTOR)[0];
|
|
44
44
|
const end = contents.charAt(mfConfigImportSpecifierNode.getEnd()) === ','
|
|
45
45
|
? mfConfigImportSpecifierNode.getEnd() + 1
|
|
46
46
|
: mfConfigImportSpecifierNode.getEnd();
|
|
@@ -48,8 +48,8 @@ async function migrateMfImportsToNewPackage(tree) {
|
|
|
48
48
|
${contents.slice(0, mfConfigImportSpecifierNode.getStart())}${contents.slice(end)}`;
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
const nxWebpackImportStringNodes = (0, tsquery_1.
|
|
52
|
-
const nxRspackImportStringNodes = (0, tsquery_1.
|
|
51
|
+
const nxWebpackImportStringNodes = (0, tsquery_1.query)(importNode, WEBPACK_IMPORT_SELECTOR);
|
|
52
|
+
const nxRspackImportStringNodes = (0, tsquery_1.query)(importNode, RSPACK_IMPORT_SELECTOR);
|
|
53
53
|
if (nxWebpackImportStringNodes.length === 0 &&
|
|
54
54
|
nxRspackImportStringNodes.length === 0) {
|
|
55
55
|
return;
|
|
@@ -22,8 +22,8 @@ async function migrateWithMfImport(tree) {
|
|
|
22
22
|
if (!contents.includes('@nx/react/module-federation')) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
const importNodes = (0, tsquery_1.
|
|
25
|
+
const sourceFile = (0, tsquery_1.ast)(contents);
|
|
26
|
+
const importNodes = (0, tsquery_1.query)(sourceFile, NX_RSPACK_MODULE_FEDERATION_IMPORT_SELECTOR);
|
|
27
27
|
if (importNodes.length === 0) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
@@ -111,10 +111,10 @@ async function addSvgrToWebpackConfig(tree) {
|
|
|
111
111
|
if (!tree.exists(webpackConfigPath))
|
|
112
112
|
return;
|
|
113
113
|
const content = tree.read(webpackConfigPath, 'utf-8');
|
|
114
|
-
const
|
|
114
|
+
const sourceFile = (0, tsquery_1.ast)(content);
|
|
115
115
|
// Check if this is a withReact setup
|
|
116
116
|
if (content.includes('withReact')) {
|
|
117
|
-
const withReactCalls = (0, tsquery_1.
|
|
117
|
+
const withReactCalls = (0, tsquery_1.query)(sourceFile, 'CallExpression[expression.name=withReact]');
|
|
118
118
|
if (withReactCalls.length > 0) {
|
|
119
119
|
const callExpr = withReactCalls[0];
|
|
120
120
|
if (callExpr.arguments.length === 0)
|
|
@@ -156,7 +156,7 @@ async function addSvgrToWebpackConfig(tree) {
|
|
|
156
156
|
}
|
|
157
157
|
// Otherwise check if this is NxReactWebpackPlugin setup
|
|
158
158
|
else if (content.includes('NxReactWebpackPlugin')) {
|
|
159
|
-
const pluginCalls = (0, tsquery_1.
|
|
159
|
+
const pluginCalls = (0, tsquery_1.query)(sourceFile, 'NewExpression[expression.name=NxReactWebpackPlugin]');
|
|
160
160
|
if (pluginCalls.length > 0) {
|
|
161
161
|
const newExpr = pluginCalls[0];
|
|
162
162
|
if (!newExpr.arguments || newExpr.arguments.length === 0)
|
|
@@ -207,13 +207,13 @@ async function addSvgrToWebpackConfig(tree) {
|
|
|
207
207
|
// Update webpack configs to add withSvgr function inline
|
|
208
208
|
for (const [webpackConfigPath, config] of projects.entries()) {
|
|
209
209
|
let content = tree.read(webpackConfigPath, 'utf-8');
|
|
210
|
-
const
|
|
210
|
+
const sourceFile = (0, tsquery_1.ast)(content);
|
|
211
211
|
const changes = [];
|
|
212
212
|
// Build the svgr options for this specific config
|
|
213
213
|
let svgrOptionsStr = '';
|
|
214
214
|
if (config.svgrOptions) {
|
|
215
|
-
const importStatements = (0, tsquery_1.
|
|
216
|
-
const requireStatements = (0, tsquery_1.
|
|
215
|
+
const importStatements = (0, tsquery_1.query)(sourceFile, 'ImportDeclaration');
|
|
216
|
+
const requireStatements = (0, tsquery_1.query)(sourceFile, 'VariableStatement:has(CallExpression[expression.name=require])');
|
|
217
217
|
const allImportRequires = [
|
|
218
218
|
...importStatements,
|
|
219
219
|
...requireStatements,
|
|
@@ -250,7 +250,7 @@ async function addSvgrToWebpackConfig(tree) {
|
|
|
250
250
|
// Remove svgr option based on the style (withReact OR NxReactWebpackPlugin)
|
|
251
251
|
if (config.isWithReact) {
|
|
252
252
|
// Remove svgr option from first withReact call (only one expected)
|
|
253
|
-
const withReactCalls = (0, tsquery_1.
|
|
253
|
+
const withReactCalls = (0, tsquery_1.query)(sourceFile, 'CallExpression[expression.name=withReact]');
|
|
254
254
|
if (withReactCalls.length > 0) {
|
|
255
255
|
const callExpr = withReactCalls[0];
|
|
256
256
|
if (callExpr.arguments.length > 0) {
|
|
@@ -266,7 +266,7 @@ async function addSvgrToWebpackConfig(tree) {
|
|
|
266
266
|
length: arg.getEnd() - arg.getStart(),
|
|
267
267
|
});
|
|
268
268
|
if (config.svgrOptions) {
|
|
269
|
-
const composePluginsCalls = (0, tsquery_1.
|
|
269
|
+
const composePluginsCalls = (0, tsquery_1.query)(sourceFile, 'CallExpression[expression.name=composePlugins]');
|
|
270
270
|
if (composePluginsCalls.length > 0) {
|
|
271
271
|
const composeCall = composePluginsCalls[0];
|
|
272
272
|
let svgrCallStr = '';
|
|
@@ -296,7 +296,7 @@ async function addSvgrToWebpackConfig(tree) {
|
|
|
296
296
|
}
|
|
297
297
|
else {
|
|
298
298
|
// Remove svgr option from first NxReactWebpackPlugin call
|
|
299
|
-
const pluginCalls = (0, tsquery_1.
|
|
299
|
+
const pluginCalls = (0, tsquery_1.query)(sourceFile, 'NewExpression[expression.name=NxReactWebpackPlugin]');
|
|
300
300
|
if (pluginCalls.length > 0) {
|
|
301
301
|
const newExpr = pluginCalls[0];
|
|
302
302
|
if (newExpr.arguments && newExpr.arguments.length > 0) {
|
|
@@ -346,7 +346,7 @@ async function addSvgrToWebpackConfig(tree) {
|
|
|
346
346
|
}
|
|
347
347
|
// For NxReactWebpackPlugin style, wrap the entire module.exports or export default with withSvgr
|
|
348
348
|
if (config.svgrOptions) {
|
|
349
|
-
const allAssignments = (0, tsquery_1.
|
|
349
|
+
const allAssignments = (0, tsquery_1.query)(sourceFile, 'BinaryExpression');
|
|
350
350
|
// Find the one that has module.exports on the left side
|
|
351
351
|
const moduleExportsAssignment = allAssignments.find((node) => {
|
|
352
352
|
const binaryExpr = node;
|
|
@@ -358,7 +358,7 @@ async function addSvgrToWebpackConfig(tree) {
|
|
|
358
358
|
left.name.text === 'exports');
|
|
359
359
|
});
|
|
360
360
|
// Also check for export default
|
|
361
|
-
const exportDefaultStatements = (0, tsquery_1.
|
|
361
|
+
const exportDefaultStatements = (0, tsquery_1.query)(sourceFile, 'ExportAssignment');
|
|
362
362
|
const exportDefaultStatement = exportDefaultStatements[0];
|
|
363
363
|
// Use whichever export style is found
|
|
364
364
|
let exportValue;
|