@nx/next 22.7.0-beta.12 → 22.7.0-beta.14

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "22.7.0-beta.12",
3
+ "version": "22.7.0-beta.14",
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": {
@@ -36,7 +36,7 @@
36
36
  "next": ">=14.0.0 <17.0.0"
37
37
  },
38
38
  "dependencies": {
39
- "@nx/devkit": "22.7.0-beta.12",
39
+ "@nx/devkit": "22.7.0-beta.14",
40
40
  "@babel/plugin-proposal-decorators": "^7.22.7",
41
41
  "@svgr/webpack": "^8.1.0",
42
42
  "copy-webpack-plugin": "^14.0.0",
@@ -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.7.0-beta.12",
48
- "@nx/eslint": "22.7.0-beta.12",
49
- "@nx/react": "22.7.0-beta.12",
50
- "@nx/web": "22.7.0-beta.12",
51
- "@nx/webpack": "22.7.0-beta.12",
47
+ "@nx/js": "22.7.0-beta.14",
48
+ "@nx/eslint": "22.7.0-beta.14",
49
+ "@nx/react": "22.7.0-beta.14",
50
+ "@nx/web": "22.7.0-beta.14",
51
+ "@nx/webpack": "22.7.0-beta.14",
52
52
  "@phenomnomnominal/tsquery": "~6.1.4"
53
53
  },
54
54
  "devDependencies": {
55
- "@nx/cypress": "22.7.0-beta.12",
56
- "@nx/playwright": "22.7.0-beta.12",
57
- "nx": "22.7.0-beta.12"
55
+ "@nx/cypress": "22.7.0-beta.14",
56
+ "@nx/playwright": "22.7.0-beta.14",
57
+ "nx": "22.7.0-beta.14"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public"
@@ -160,10 +160,14 @@ function normalizeOptions(options) {
160
160
  function getInputs(namedInputs) {
161
161
  return [
162
162
  ...('production' in namedInputs
163
- ? ['default', '^production']
163
+ ? ['default', '^default']
164
164
  : ['default', '^default']),
165
165
  {
166
166
  externalDependencies: ['next'],
167
167
  },
168
+ {
169
+ dependentTasksOutputFiles: '**/*.d.ts',
170
+ transitive: true,
171
+ },
168
172
  ];
169
173
  }
@@ -1 +1 @@
1
- {"version":3,"file":"jest-config-util.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/jest-config-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAC;AAelD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,QAwDF"}
1
+ {"version":3,"file":"jest-config-util.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/jest-config-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAC;AAelD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,QAkFF"}
@@ -22,6 +22,10 @@ function updateJestConfig(host, options) {
22
22
  const offset = (0, devkit_1.offsetFromRoot)(options.projectRoot);
23
23
  const isCommonJS = configPath.endsWith('.js') || configPath.endsWith('.cts');
24
24
  // Easier to override the whole file rather than replace content since the structure has changed with `next/jest.js` being used.
25
+ // The wrapper around createJestConfig disables SWC path alias resolution.
26
+ // Without explicit baseUrl, Next.js resolves aliases from the app root instead
27
+ // of the workspace root, producing wrong paths. The Nx jest resolver handles
28
+ // alias resolution correctly, so we let it take over.
25
29
  const newContent = isCommonJS
26
30
  ? `const nextJest = require('next/jest.js');
27
31
 
@@ -40,7 +44,18 @@ const config = {
40
44
  testEnvironment: 'jsdom',
41
45
  };
42
46
 
43
- module.exports = createJestConfig(config);
47
+ const jestConfig = createJestConfig(config);
48
+
49
+ module.exports = async () => {
50
+ const resolved = await jestConfig();
51
+ // Disable SWC path alias resolution — handled by Nx jest resolver.
52
+ for (const value of Object.values(resolved.transform)) {
53
+ if (Array.isArray(value) && value[1]?.resolvedBaseUrl) {
54
+ value[1] = { ...value[1], resolvedBaseUrl: undefined };
55
+ }
56
+ }
57
+ return resolved;
58
+ };
44
59
  `
45
60
  : `import type { Config } from 'jest';
46
61
  import nextJest from 'next/jest.js';
@@ -60,7 +75,18 @@ const config: Config = {
60
75
  testEnvironment: 'jsdom',
61
76
  };
62
77
 
63
- export default createJestConfig(config);
78
+ const jestConfig = createJestConfig(config);
79
+
80
+ export default async () => {
81
+ const resolved = await jestConfig();
82
+ // Disable SWC path alias resolution — handled by Nx jest resolver.
83
+ for (const value of Object.values(resolved.transform)) {
84
+ if (Array.isArray(value) && value[1]?.resolvedBaseUrl) {
85
+ value[1] = { ...value[1], resolvedBaseUrl: undefined };
86
+ }
87
+ }
88
+ return resolved;
89
+ };
64
90
  `;
65
91
  host.write(configPath, newContent);
66
92
  }