@nx/next 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/package.json +11 -11
- package/src/generators/convert-to-inferred/lib/update-next-config.js +11 -11
- 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-22-0-0/add-svgr-to-next-config.js +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "22.4.0-canary.
|
|
3
|
+
"version": "22.4.0-canary.20260114-45f2ae3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Playwright, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"next": ">=14.0.0 <17.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nx/devkit": "22.4.0-canary.
|
|
38
|
+
"@nx/devkit": "22.4.0-canary.20260114-45f2ae3",
|
|
39
39
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
40
40
|
"@svgr/webpack": "^8.1.0",
|
|
41
41
|
"copy-webpack-plugin": "^10.2.4",
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"semver": "^7.6.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/js": "22.4.0-canary.
|
|
48
|
-
"@nx/eslint": "22.4.0-canary.
|
|
49
|
-
"@nx/react": "22.4.0-canary.
|
|
50
|
-
"@nx/web": "22.4.0-canary.
|
|
51
|
-
"@nx/webpack": "22.4.0-canary.
|
|
52
|
-
"@phenomnomnominal/tsquery": "~
|
|
47
|
+
"@nx/js": "22.4.0-canary.20260114-45f2ae3",
|
|
48
|
+
"@nx/eslint": "22.4.0-canary.20260114-45f2ae3",
|
|
49
|
+
"@nx/react": "22.4.0-canary.20260114-45f2ae3",
|
|
50
|
+
"@nx/web": "22.4.0-canary.20260114-45f2ae3",
|
|
51
|
+
"@nx/webpack": "22.4.0-canary.20260114-45f2ae3",
|
|
52
|
+
"@phenomnomnominal/tsquery": "~6.1.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@nx/cypress": "22.4.0-canary.
|
|
56
|
-
"@nx/playwright": "22.4.0-canary.
|
|
57
|
-
"nx": "22.4.0-canary.
|
|
55
|
+
"@nx/cypress": "22.4.0-canary.20260114-45f2ae3",
|
|
56
|
+
"@nx/playwright": "22.4.0-canary.20260114-45f2ae3",
|
|
57
|
+
"nx": "22.4.0-canary.20260114-45f2ae3"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -15,13 +15,13 @@ function updateNextConfig(tree, updatedConfigFileContents, project, migrationLog
|
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
const nextConfigContents = tree.read(nextConfigPath, 'utf-8');
|
|
18
|
-
let
|
|
18
|
+
let sourceFile = (0, tsquery_1.ast)(nextConfigContents);
|
|
19
19
|
const reservedVarQuery = `
|
|
20
|
-
VariableStatement
|
|
21
|
-
VariableStatement
|
|
22
|
-
VariableStatement
|
|
20
|
+
VariableStatement VariableDeclarationList > VariableDeclaration:has(Identifier[name=configValues]),
|
|
21
|
+
VariableStatement VariableDeclarationList > VariableDeclaration:has(Identifier[name=configuration]),
|
|
22
|
+
VariableStatement VariableDeclarationList > VariableDeclaration:has(Identifier[name=options])
|
|
23
23
|
`;
|
|
24
|
-
const matches = (0, tsquery_1.
|
|
24
|
+
const matches = (0, tsquery_1.query)(sourceFile, reservedVarQuery);
|
|
25
25
|
if (matches.length > 0) {
|
|
26
26
|
migrationLogs.addLog({
|
|
27
27
|
project: project.projectName,
|
|
@@ -32,7 +32,7 @@ function updateNextConfig(tree, updatedConfigFileContents, project, migrationLog
|
|
|
32
32
|
}
|
|
33
33
|
// Query to check for composePlugins in module.exports
|
|
34
34
|
const composePluginsQuery = `ExpressionStatement > BinaryExpression > CallExpression > CallExpression:has(Identifier[name=composePlugins])`;
|
|
35
|
-
const composePluginNode = (0, tsquery_1.
|
|
35
|
+
const composePluginNode = (0, tsquery_1.query)(sourceFile, composePluginsQuery)[0];
|
|
36
36
|
if (!composePluginNode) {
|
|
37
37
|
migrationLogs.addLog({
|
|
38
38
|
project: project.projectName,
|
|
@@ -50,16 +50,16 @@ function updateNextConfig(tree, updatedConfigFileContents, project, migrationLog
|
|
|
50
50
|
}
|
|
51
51
|
ts.forEachChild(node, findLastRequire);
|
|
52
52
|
};
|
|
53
|
-
findLastRequire(
|
|
53
|
+
findLastRequire(sourceFile);
|
|
54
54
|
let updatedCode = `
|
|
55
55
|
${nextConfigContents.slice(0, lastRequireEndPosition)}\n
|
|
56
56
|
${updatedConfigFileContents}\n\n
|
|
57
57
|
${nextConfigContents.slice(lastRequireEndPosition)}
|
|
58
58
|
`;
|
|
59
|
-
|
|
60
|
-
const nextConfigNode = (0, tsquery_1.
|
|
59
|
+
sourceFile = (0, tsquery_1.ast)(updatedCode);
|
|
60
|
+
const nextConfigNode = (0, tsquery_1.query)(sourceFile, 'VariableDeclaration:has(Identifier[name=nextConfig]) ObjectLiteralExpression')[0];
|
|
61
61
|
if (nextConfigNode) {
|
|
62
|
-
const nxNode = (0, tsquery_1.
|
|
62
|
+
const nxNode = (0, tsquery_1.query)(nextConfigNode, 'PropertyAssignment:has(Identifier[name=nx]) ObjectLiteralExpression')[0];
|
|
63
63
|
if (nxNode) {
|
|
64
64
|
const spread = ts.factory.createSpreadAssignment(ts.factory.createIdentifier('options'));
|
|
65
65
|
const updatedNxNode = ts.factory.updateObjectLiteralExpression(nxNode, ts.factory.createNodeArray([...nxNode['properties'], spread]));
|
|
@@ -72,7 +72,7 @@ function updateNextConfig(tree, updatedConfigFileContents, project, migrationLog
|
|
|
72
72
|
}
|
|
73
73
|
return ts.visitNode(rootNode, visit);
|
|
74
74
|
};
|
|
75
|
-
const result = ts.transform(
|
|
75
|
+
const result = ts.transform(sourceFile, [transformer]);
|
|
76
76
|
const transformedSourceFile = result.transformed[0];
|
|
77
77
|
const printer = ts.createPrinter();
|
|
78
78
|
updatedCode = printer.printFile(transformedSourceFile);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-tailwind.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/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/next/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')) ||
|
|
@@ -16,9 +16,9 @@ async function addSvgrToNextConfig(tree) {
|
|
|
16
16
|
const content = tree.read(nextConfigPath, 'utf-8');
|
|
17
17
|
if (!content.includes('withNx'))
|
|
18
18
|
return;
|
|
19
|
-
const
|
|
19
|
+
const sourceFile = (0, tsquery_1.ast)(content);
|
|
20
20
|
let svgrValue;
|
|
21
|
-
const nextConfigDeclarations = (0, tsquery_1.
|
|
21
|
+
const nextConfigDeclarations = (0, tsquery_1.query)(sourceFile, 'VariableDeclaration:has(Identifier[name=nextConfig]) > ObjectLiteralExpression');
|
|
22
22
|
if (nextConfigDeclarations.length > 0) {
|
|
23
23
|
const objLiteral = nextConfigDeclarations[0];
|
|
24
24
|
const nxProp = objLiteral.properties.find((prop) => ts.isPropertyAssignment(prop) &&
|
|
@@ -66,9 +66,9 @@ async function addSvgrToNextConfig(tree) {
|
|
|
66
66
|
// Update next.config.js files to add SVGR webpack configuration
|
|
67
67
|
for (const [nextConfigPath, config] of projects.entries()) {
|
|
68
68
|
let content = tree.read(nextConfigPath, 'utf-8');
|
|
69
|
-
const
|
|
69
|
+
const sourceFile = (0, tsquery_1.ast)(content);
|
|
70
70
|
const changes = [];
|
|
71
|
-
const nextConfigDeclarations = (0, tsquery_1.
|
|
71
|
+
const nextConfigDeclarations = (0, tsquery_1.query)(sourceFile, 'VariableDeclaration:has(Identifier[name=nextConfig]) > ObjectLiteralExpression');
|
|
72
72
|
if (nextConfigDeclarations.length > 0) {
|
|
73
73
|
const objLiteral = nextConfigDeclarations[0];
|
|
74
74
|
const nxProp = objLiteral.properties.find((prop) => ts.isPropertyAssignment(prop) &&
|
|
@@ -175,7 +175,7 @@ async function addSvgrToNextConfig(tree) {
|
|
|
175
175
|
};
|
|
176
176
|
return config;
|
|
177
177
|
};`;
|
|
178
|
-
const pluginsArrayDeclarations = (0, tsquery_1.
|
|
178
|
+
const pluginsArrayDeclarations = (0, tsquery_1.query)(sourceFile, 'VariableDeclaration:has(Identifier[name=plugins]) ArrayLiteralExpression');
|
|
179
179
|
if (pluginsArrayDeclarations.length > 0) {
|
|
180
180
|
const pluginsArray = pluginsArrayDeclarations[0];
|
|
181
181
|
const pluginsStatement = pluginsArray.parent.parent;
|
|
@@ -185,7 +185,7 @@ async function addSvgrToNextConfig(tree) {
|
|
|
185
185
|
text: `\n\n// Add SVGR webpack config function\n// @ts-ignore\nconst withSvgr = ${svgrWebpackFunction};`,
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
const composePluginsCalls = (0, tsquery_1.
|
|
188
|
+
const composePluginsCalls = (0, tsquery_1.query)(sourceFile, 'CallExpression[expression.name=composePlugins]');
|
|
189
189
|
if (composePluginsCalls.length > 0) {
|
|
190
190
|
const composeCall = composePluginsCalls[0];
|
|
191
191
|
const spreadArg = composeCall.arguments.find((arg) => ts.isSpreadElement(arg));
|