@nx/next 24.0.2 → 24.0.3

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.
@@ -22,13 +22,16 @@ exports.createNodes = [
22
22
  const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
23
23
  const lockFileName = (0, js_1.getLockFileName)(packageManager);
24
24
  const normalizedOptions = normalizeOptions(options);
25
+ const typecheckTargetName = isTsSolutionSetup
26
+ ? getTypecheckTargetName(context.nxJsonConfiguration)
27
+ : false;
25
28
  try {
26
29
  const { entries, preErrors } = await filterNextConfigs(configFiles, context);
27
- const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
30
+ const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), { ...normalizedOptions, typecheckTargetName }, context, entries.map(() => [lockFileName]));
28
31
  let results = [];
29
32
  let nodeErrors = [];
30
33
  try {
31
- results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isTsSolutionSetup, pmc, projectHashes[idx]), entries.map((e) => e.configFile), options, context);
34
+ results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isTsSolutionSetup, typecheckTargetName, pmc, projectHashes[idx]), entries.map((e) => e.configFile), options, context);
32
35
  }
33
36
  catch (e) {
34
37
  if (e instanceof devkit_1.AggregateCreateNodesError) {
@@ -51,10 +54,10 @@ exports.createNodes = [
51
54
  },
52
55
  ];
53
56
  exports.createNodesV2 = exports.createNodes;
54
- async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, hash) {
57
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, typecheckTargetName, pmc, hash) {
55
58
  const projectRoot = (0, path_1.dirname)(configFilePath);
56
59
  if (!targetsCache.has(hash)) {
57
- targetsCache.set(hash, await buildNextTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc));
60
+ targetsCache.set(hash, await buildNextTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, typecheckTargetName, pmc));
58
61
  }
59
62
  return {
60
63
  projects: {
@@ -65,11 +68,11 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
65
68
  },
66
69
  };
67
70
  }
68
- async function buildNextTargets(nextConfigPath, projectRoot, options, context, isTsSolutionSetup, pmc) {
71
+ async function buildNextTargets(nextConfigPath, projectRoot, options, context, isTsSolutionSetup, typecheckTargetName, pmc) {
69
72
  const nextConfig = await getNextConfig(nextConfigPath, context);
70
73
  const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
71
74
  const targets = {};
72
- targets[options.buildTargetName] = await getBuildTargetConfig(namedInputs, projectRoot, nextConfig, isTsSolutionSetup);
75
+ targets[options.buildTargetName] = await getBuildTargetConfig(namedInputs, projectRoot, nextConfig, isTsSolutionSetup, typecheckTargetName);
73
76
  targets[options.devTargetName] = getDevTargetConfig(namedInputs, projectRoot, isTsSolutionSetup);
74
77
  const startTarget = getStartTargetConfig(namedInputs, options, projectRoot);
75
78
  targets[options.startTargetName] = startTarget;
@@ -77,7 +80,7 @@ async function buildNextTargets(nextConfigPath, projectRoot, options, context, i
77
80
  (0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
78
81
  return targets;
79
82
  }
80
- async function getBuildTargetConfig(namedInputs, projectRoot, nextConfig, isTsSolutionSetup) {
83
+ async function getBuildTargetConfig(namedInputs, projectRoot, nextConfig, isTsSolutionSetup, typecheckTargetName) {
81
84
  const nextOutputPath = await getOutputs(projectRoot, nextConfig);
82
85
  // Set output path here so that `withNx` can pick it up.
83
86
  const targetConfig = {
@@ -96,10 +99,25 @@ async function getBuildTargetConfig(namedInputs, projectRoot, nextConfig, isTsSo
96
99
  // bundler differences live at the executor / runtime layer, not here.
97
100
  targetConfig.options.tty = false;
98
101
  if (isTsSolutionSetup) {
102
+ // `next build` type-checks against dependency declarations, which the
103
+ // dependencies' typecheck targets emit in TS solution setups.
104
+ if (typecheckTargetName) {
105
+ targetConfig.dependsOn.push(`^${typecheckTargetName}`);
106
+ }
99
107
  targetConfig.syncGenerators = ['@nx/js:typescript-sync'];
100
108
  }
101
109
  return targetConfig;
102
110
  }
111
+ function getTypecheckTargetName(nxJson) {
112
+ const registration = nxJson?.plugins?.find((p) => (typeof p === 'string' ? p : p.plugin) === '@nx/js/typescript');
113
+ const typecheck = typeof registration === 'object'
114
+ ? registration.options?.typecheck
115
+ : undefined;
116
+ if (typecheck === false) {
117
+ return false;
118
+ }
119
+ return (typeof typecheck === 'object' && typecheck.targetName) || 'typecheck';
120
+ }
103
121
  function getDevTargetConfig(namedInputs, projectRoot, isTsSolutionSetup) {
104
122
  const targetConfig = {
105
123
  continuous: true,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @deprecated `@nx/next/tailwind` will be removed in Nx 24. Migrate to Tailwind CSS v4 which no longer needs glob patterns.
2
+ * @deprecated `@nx/next/tailwind` will be removed in Nx 25. Migrate to Tailwind CSS v4 which no longer needs glob patterns.
3
3
  * See: https://nx.dev/docs/technologies/react/guides/using-tailwind-css-in-react
4
4
  */
5
5
  export declare function createGlobPatternsForDependencies(dirPath: string, fileGlobPatternToInclude?: string, fileGlobPatternToExclude?: string): string[];
package/dist/tailwind.js CHANGED
@@ -4,14 +4,15 @@ exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
4
4
  const internal_1 = require("@nx/js/internal");
5
5
  const path_1 = require("path");
6
6
  let hasWarned = false;
7
+ // TODO(v25): remove the deprecated tailwind glob helpers (NXC-5174).
7
8
  /**
8
- * @deprecated `@nx/next/tailwind` will be removed in Nx 24. Migrate to Tailwind CSS v4 which no longer needs glob patterns.
9
+ * @deprecated `@nx/next/tailwind` will be removed in Nx 25. Migrate to Tailwind CSS v4 which no longer needs glob patterns.
9
10
  * See: https://nx.dev/docs/technologies/react/guides/using-tailwind-css-in-react
10
11
  */
11
12
  function createGlobPatternsForDependencies(dirPath, fileGlobPatternToInclude = '/**/*.{tsx,ts,jsx,js,html}', fileGlobPatternToExclude = '/**/*.{stories,spec}.{tsx,ts,jsx,js,html}') {
12
13
  if (!hasWarned) {
13
14
  hasWarned = true;
14
- console.warn(`\nWARNING: "@nx/next/tailwind" is deprecated and will be removed in Nx 24.\n` +
15
+ console.warn(`\nWARNING: "@nx/next/tailwind" is deprecated and will be removed in Nx 25.\n` +
15
16
  `Migrate to Tailwind CSS v4 which no longer needs glob patterns for content detection.\n` +
16
17
  `See: https://nx.dev/docs/technologies/react/guides/using-tailwind-css-in-react\n`);
17
18
  }
@@ -23,8 +24,12 @@ function createGlobPatternsForDependencies(dirPath, fileGlobPatternToInclude = '
23
24
  if (majorVersion >= 4) {
24
25
  try {
25
26
  return [
26
- ...(0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToInclude).map((glob) => (0, path_1.relative)(dirPath, glob)),
27
- ...(0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToExclude).map((glob) => `!${(0, path_1.relative)(dirPath, glob)}`),
27
+ ...(0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToInclude).map((glob) => glob.startsWith('!')
28
+ ? `!${(0, path_1.relative)(dirPath, glob.slice(1))}`
29
+ : (0, path_1.relative)(dirPath, glob)),
30
+ ...(0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToExclude)
31
+ .filter((glob) => !glob.startsWith('!'))
32
+ .map((glob) => `!${(0, path_1.relative)(dirPath, glob)}`),
28
33
  ];
29
34
  }
30
35
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "24.0.2",
3
+ "version": "24.0.3",
4
4
  "private": false,
5
5
  "description": "The Next.js plugin for Nx infers tasks and provides 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": {
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "peerDependencies": {
73
73
  "next": ">=14.0.0 <17.0.0",
74
- "@nx/webpack": "24.0.2"
74
+ "@nx/webpack": "24.0.3"
75
75
  },
76
76
  "peerDependenciesMeta": {
77
77
  "@nx/webpack": {
@@ -79,26 +79,26 @@
79
79
  }
80
80
  },
81
81
  "dependencies": {
82
- "@nx/devkit": "24.0.2",
82
+ "@nx/devkit": "24.0.3",
83
83
  "@babel/plugin-proposal-decorators": "^7.22.7",
84
84
  "copy-webpack-plugin": "^14.0.0",
85
85
  "ignore": "^7.0.5",
86
86
  "semver": "^7.6.3",
87
87
  "tslib": "^2.3.0",
88
88
  "webpack-merge": "^5.8.0",
89
- "@nx/js": "24.0.2",
90
- "@nx/eslint": "24.0.2",
91
- "@nx/react": "24.0.2",
92
- "@nx/web": "24.0.2",
89
+ "@nx/js": "24.0.3",
90
+ "@nx/eslint": "24.0.3",
91
+ "@nx/react": "24.0.3",
92
+ "@nx/web": "24.0.3",
93
93
  "@phenomnomnominal/tsquery": "~6.2.0"
94
94
  },
95
95
  "devDependencies": {
96
- "@nx/cypress": "24.0.2",
97
- "@nx/playwright": "24.0.2",
98
- "@nx/vitest": "24.0.2",
99
- "@nx/webpack": "24.0.2",
96
+ "@nx/cypress": "24.0.3",
97
+ "@nx/playwright": "24.0.3",
98
+ "@nx/vitest": "24.0.3",
99
+ "@nx/webpack": "24.0.3",
100
100
  "next": "15.5.25",
101
- "nx": "24.0.2"
101
+ "nx": "24.0.3"
102
102
  },
103
103
  "publishConfig": {
104
104
  "access": "public"