@nx/next 0.0.0-pr-22179-271588f → 0.0.0-pr-26482-ebe2dba

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.
Files changed (38) hide show
  1. package/LICENSE +1 -1
  2. package/migrations.json +13 -40
  3. package/package.json +14 -13
  4. package/plugins/component-testing.js +1 -1
  5. package/plugins/with-nx.d.ts +6 -1
  6. package/plugins/with-nx.js +53 -44
  7. package/plugins/with-stylus.js +1 -1
  8. package/src/executors/build/build.impl.js +20 -9
  9. package/src/executors/build/lib/create-next-config-file.js +3 -3
  10. package/src/executors/server/custom-server.impl.js +2 -1
  11. package/src/executors/server/schema.json +16 -0
  12. package/src/executors/server/server.impl.js +15 -2
  13. package/src/generators/application/application.js +7 -0
  14. package/src/generators/application/files/app/page.tsx__tmpl__ +3 -3
  15. package/src/generators/application/files/pages/__fileName__.tsx__tmpl__ +2 -2
  16. package/src/generators/application/lib/add-e2e.js +8 -6
  17. package/src/generators/application/lib/create-application-files.js +1 -1
  18. package/src/generators/application/lib/normalize-options.d.ts +3 -0
  19. package/src/generators/application/lib/normalize-options.js +27 -2
  20. package/src/generators/application/schema.json +6 -2
  21. package/src/generators/component/component.d.ts +1 -1
  22. package/src/generators/component/component.js +1 -1
  23. package/src/generators/component/schema.json +1 -1
  24. package/src/generators/init/init.js +12 -7
  25. package/src/generators/page/page.js +1 -1
  26. package/src/generators/page/schema.d.ts +1 -1
  27. package/src/generators/page/schema.json +2 -2
  28. package/src/plugins/plugin.d.ts +0 -2
  29. package/src/plugins/plugin.js +22 -50
  30. package/src/utils/create-cli-options.js +4 -1
  31. package/src/utils/styles.d.ts +4 -4
  32. package/src/utils/types.d.ts +4 -0
  33. package/src/utils/versions.d.ts +2 -2
  34. package/src/utils/versions.js +2 -2
  35. package/src/generators/init/lib/add-plugin.d.ts +0 -2
  36. package/src/generators/init/lib/add-plugin.js +0 -26
  37. package/src/migrations/update-15-8-8/add-style-packages.d.ts +0 -3
  38. package/src/migrations/update-15-8-8/add-style-packages.js +0 -23
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2023 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2024 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/migrations.json CHANGED
@@ -1,11 +1,5 @@
1
1
  {
2
2
  "generators": {
3
- "add-style-packages": {
4
- "cli": "nx",
5
- "version": "15.8.8-beta.0",
6
- "description": "Add less and stylus packages if used.",
7
- "factory": "./src/migrations/update-15-8-8/add-style-packages"
8
- },
9
3
  "update-16-0-0-add-nx-packages": {
10
4
  "cli": "nx",
11
5
  "version": "16.0.0-beta.1",
@@ -32,40 +26,6 @@
32
26
  }
33
27
  },
34
28
  "packageJsonUpdates": {
35
- "15.0.4": {
36
- "version": "15.0.4-beta.0",
37
- "packages": {
38
- "next": {
39
- "version": "13.0.0",
40
- "alwaysAddToPackageJson": false
41
- },
42
- "eslint-config-next": {
43
- "version": "13.0.0",
44
- "alwaysAddToPackageJson": false
45
- },
46
- "less-loader": {
47
- "version": "11.1.0",
48
- "alwaysAddToPackageJson": false
49
- },
50
- "stylus-loader": {
51
- "version": "7.1.0",
52
- "alwaysAddToPackageJson": false
53
- }
54
- }
55
- },
56
- "15.4.5": {
57
- "version": "15.4.5-beta.0",
58
- "packages": {
59
- "next": {
60
- "version": "13.1.1",
61
- "alwaysAddToPackageJson": false
62
- },
63
- "eslint-config-next": {
64
- "version": "13.1.1",
65
- "alwaysAddToPackageJson": false
66
- }
67
- }
68
- },
69
29
  "16.0.0": {
70
30
  "version": "16.0.0-beta.0",
71
31
  "packages": {
@@ -101,6 +61,19 @@
101
61
  "alwaysAddToPackageJson": false
102
62
  }
103
63
  }
64
+ },
65
+ "19.0.3": {
66
+ "version": "19.0.3-beta.0",
67
+ "packages": {
68
+ "next": {
69
+ "version": "14.2.3",
70
+ "alwaysAddToPackageJson": false
71
+ },
72
+ "eslint-config-next": {
73
+ "version": "14.2.3",
74
+ "alwaysAddToPackageJson": false
75
+ }
76
+ }
104
77
  }
105
78
  }
106
79
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "0.0.0-pr-22179-271588f",
3
+ "version": "0.0.0-pr-26482-ebe2dba",
4
4
  "private": false,
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, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
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": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/nrwl/nx.git",
@@ -14,9 +14,10 @@
14
14
  "Next",
15
15
  "Jest",
16
16
  "Cypress",
17
- "CLI"
17
+ "CLI",
18
+ "Front-end"
18
19
  ],
19
- "main": "./index.js",
20
+ "main": "./index",
20
21
  "typings": "./index.d.ts",
21
22
  "author": "Victor Savkin",
22
23
  "license": "MIT",
@@ -34,24 +35,24 @@
34
35
  "next": ">=14.0.0"
35
36
  },
36
37
  "dependencies": {
37
- "@nx/devkit": "0.0.0-pr-22179-271588f",
38
+ "@nx/devkit": "0.0.0-pr-26482-ebe2dba",
38
39
  "@babel/plugin-proposal-decorators": "^7.22.7",
39
40
  "@svgr/webpack": "^8.0.1",
40
41
  "chalk": "^4.1.0",
41
42
  "copy-webpack-plugin": "^10.2.4",
43
+ "file-loader": "^6.2.0",
42
44
  "fs-extra": "^11.1.0",
43
45
  "ignore": "^5.0.4",
44
46
  "semver": "^7.5.3",
45
- "url-loader": "^4.1.1",
46
47
  "tslib": "^2.3.0",
47
48
  "webpack-merge": "^5.8.0",
48
- "@nx/js": "0.0.0-pr-22179-271588f",
49
- "@nx/eslint": "0.0.0-pr-22179-271588f",
50
- "@nx/react": "0.0.0-pr-22179-271588f",
51
- "@nx/web": "0.0.0-pr-22179-271588f",
52
- "@nx/webpack": "0.0.0-pr-22179-271588f",
53
- "@nx/workspace": "0.0.0-pr-22179-271588f",
54
- "@nrwl/next": "0.0.0-pr-22179-271588f"
49
+ "@nx/js": "0.0.0-pr-26482-ebe2dba",
50
+ "@nx/eslint": "0.0.0-pr-26482-ebe2dba",
51
+ "@nx/react": "0.0.0-pr-26482-ebe2dba",
52
+ "@nx/web": "0.0.0-pr-26482-ebe2dba",
53
+ "@nx/webpack": "0.0.0-pr-26482-ebe2dba",
54
+ "@nx/workspace": "0.0.0-pr-26482-ebe2dba",
55
+ "@nrwl/next": "0.0.0-pr-26482-ebe2dba"
55
56
  },
56
57
  "publishConfig": {
57
58
  "access": "public"
@@ -8,7 +8,7 @@ const react_1 = require("@nx/react");
8
8
  const webpack_1 = require("@nx/webpack");
9
9
  const path_1 = require("path");
10
10
  function nxComponentTestingPreset(pathToConfig, options) {
11
- if (global.NX_GRAPH_CREATION || global.NX_CYPRESS_INIT_GENERATOR_RUNNING) {
11
+ if (global.NX_GRAPH_CREATION) {
12
12
  // this is only used by plugins, so we don't need the component testing
13
13
  // options, cast to any to avoid type errors
14
14
  return (0, cypress_preset_1.nxBaseCypressPreset)(pathToConfig);
@@ -5,9 +5,14 @@
5
5
  import type { NextConfig } from 'next';
6
6
  import type { NextConfigFn } from '../src/utils/config';
7
7
  import { type ProjectGraphProjectNode } from '@nx/devkit';
8
+ export interface SvgrOptions {
9
+ svgo?: boolean;
10
+ titleProp?: boolean;
11
+ ref?: boolean;
12
+ }
8
13
  export interface WithNxOptions extends NextConfig {
9
14
  nx?: {
10
- svgr?: boolean;
15
+ svgr?: boolean | SvgrOptions;
11
16
  babelUpwardRootMode?: boolean;
12
17
  };
13
18
  }
@@ -216,27 +216,60 @@ function getNextConfig(nextConfig = {}, context = getWithNxContext()) {
216
216
  delete nextGlobalCssLoader.issuer.and;
217
217
  }
218
218
  /**
219
- * 5. Add env variables prefixed with NX_
220
- */
221
- addNxEnvVariables(config);
222
- /**
223
- * 6. Add SVGR support if option is on.
219
+ * 5. Add SVGR support if option is on.
224
220
  */
225
221
  // Default SVGR support to be on for projects.
226
- if (nx?.svgr !== false) {
227
- config.module.rules.push(
228
- // Apply rule for svg imports ending in ?url
229
- {
230
- test: /\.svg$/i,
231
- type: 'asset',
232
- resourceQuery: /url/, // apply to *.svg?url
233
- },
234
- // Convert all other svg imports to React components
235
- {
236
- test: /\.svg$/i,
237
- issuer: /\.[jt]sx?$/,
238
- resourceQuery: { not: [/url/] },
239
- use: ['@svgr/webpack'],
222
+ if (nx?.svgr !== false || typeof nx?.svgr === 'object') {
223
+ const defaultSvgrOptions = {
224
+ svgo: false,
225
+ titleProp: true,
226
+ ref: true,
227
+ };
228
+ const svgrOptions = typeof nx?.svgr === 'object' ? nx.svgr : defaultSvgrOptions;
229
+ // TODO(v20): Remove file-loader and use `?react` querystring to differentiate between asset and SVGR.
230
+ // It should be:
231
+ // use: [{
232
+ // test: /\.svg$/i,
233
+ // type: 'asset',
234
+ // resourceQuery: /react/, // *.svg?react
235
+ // },
236
+ // {
237
+ // test: /\.svg$/i,
238
+ // issuer: /\.[jt]sx?$/,
239
+ // resourceQuery: { not: [/react/] }, // exclude react component if *.svg?react
240
+ // use: ['@svgr/webpack'],
241
+ // }],
242
+ // See:
243
+ // - SVGR: https://react-svgr.com/docs/webpack/#use-svgr-and-asset-svg-in-the-same-project
244
+ // - Vite: https://www.npmjs.com/package/vite-plugin-svgr
245
+ // - Rsbuild: https://github.com/web-infra-dev/rsbuild/pull/1783
246
+ // Note: We also need a migration for any projects that are using SVGR to convert
247
+ // `import { ReactComponent as X } from './x.svg` to
248
+ // `import X from './x.svg?react';
249
+ config.module.rules.push({
250
+ test: /\.svg$/,
251
+ issuer: { not: /\.(css|scss|sass)$/ },
252
+ resourceQuery: {
253
+ not: [
254
+ /__next_metadata__/,
255
+ /__next_metadata_route__/,
256
+ /__next_metadata_image_meta__/,
257
+ ],
258
+ },
259
+ use: [
260
+ {
261
+ loader: require.resolve('@svgr/webpack'),
262
+ options: svgrOptions,
263
+ },
264
+ {
265
+ loader: require.resolve('file-loader'),
266
+ options: {
267
+ // Next.js hard-codes assets to load from "static/media".
268
+ // See: https://github.com/vercel/next.js/blob/53d017d/packages/next/src/build/webpack-config.ts#L1993
269
+ name: 'static/media/[name].[hash].[ext]',
270
+ },
271
+ },
272
+ ],
240
273
  });
241
274
  }
242
275
  return userWebpack(config, options);
@@ -244,30 +277,6 @@ function getNextConfig(nextConfig = {}, context = getWithNxContext()) {
244
277
  };
245
278
  }
246
279
  exports.getNextConfig = getNextConfig;
247
- function getNxEnvironmentVariables() {
248
- return Object.keys(process.env)
249
- .filter((env) => /^NX_/i.test(env))
250
- .reduce((env, key) => {
251
- env[key] = process.env[key];
252
- return env;
253
- }, {});
254
- }
255
- /**
256
- * TODO(v19)
257
- * @deprecated Use Next.js 9.4+ built-in support for environment variables. Reference https://nextjs.org/docs/pages/api-reference/next-config-js/env
258
- */
259
- function addNxEnvVariables(config) {
260
- const maybeDefinePlugin = config.plugins?.find((plugin) => {
261
- return plugin.definitions?.['process.env.NODE_ENV'];
262
- });
263
- if (maybeDefinePlugin) {
264
- const env = getNxEnvironmentVariables();
265
- Object.entries(env)
266
- .map(([name, value]) => [`process.env.${name}`, `"${value}"`])
267
- .filter(([name]) => !maybeDefinePlugin.definitions[name])
268
- .forEach(([name, value]) => (maybeDefinePlugin.definitions[name] = value));
269
- }
270
- }
271
280
  function getAliasForProject(node, paths) {
272
281
  // Match workspace libs to their alias in tsconfig paths.
273
282
  for (const [alias, lookup] of Object.entries(paths ?? {})) {
@@ -284,7 +293,7 @@ exports.getAliasForProject = getAliasForProject;
284
293
  function forNextVersion(range, fn) {
285
294
  const semver = require('semver');
286
295
  const nextJsVersion = require('next/package.json').version;
287
- if (semver.satisfies(nextJsVersion, range)) {
296
+ if (semver.satisfies(nextJsVersion, range, { includePrerelease: true })) {
288
297
  fn();
289
298
  }
290
299
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withStylus = void 0;
4
- // TODO(v19): Remove file, it is here until users migrate over to SASS manually.
4
+ // TODO(v20): Remove file, it is here until users migrate over to SASS manually.
5
5
  function withStylus(configOrFn) {
6
6
  return async (phase) => {
7
7
  throw new Error(`Stylus support has been removed and you should use the built-in SASS support. Remove the "withStylus" plugin from your Next.js config, and rename your files from .styl to .scss.`);
@@ -12,6 +12,7 @@ const create_next_config_file_1 = require("./lib/create-next-config-file");
12
12
  const check_project_1 = require("./lib/check-project");
13
13
  const child_process_1 = require("child_process");
14
14
  const create_cli_options_1 = require("../../utils/create-cli-options");
15
+ const exit_codes_1 = require("nx/src/utils/exit-codes");
15
16
  let childProcess;
16
17
  async function buildExecutor(options, context) {
17
18
  // Cast to any to overwrite NODE_ENV
@@ -34,9 +35,14 @@ async function buildExecutor(options, context) {
34
35
  try {
35
36
  await runCliBuild(devkit_1.workspaceRoot, projectRoot, options);
36
37
  }
37
- catch (error) {
38
- devkit_1.logger.error(`Error occurred while trying to run the build command`);
39
- devkit_1.logger.error(error);
38
+ catch ({ error, code, signal }) {
39
+ if (code || signal) {
40
+ devkit_1.logger.error(`Build process exited due to ${code ? 'code ' + code : ''} ${code && signal ? 'and' : ''} ${signal ? 'signal ' + signal : ''}`);
41
+ }
42
+ else {
43
+ devkit_1.logger.error(`Error occurred while trying to run the build command`);
44
+ devkit_1.logger.error(error);
45
+ }
40
46
  return { success: false };
41
47
  }
42
48
  finally {
@@ -85,21 +91,26 @@ function runCliBuild(workspaceRoot, projectRoot, options) {
85
91
  return new Promise((resolve, reject) => {
86
92
  childProcess = (0, child_process_1.fork)(require.resolve('next/dist/bin/next'), ['build', ...args], {
87
93
  cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
88
- stdio: 'inherit',
94
+ stdio: ['ignore', 'inherit', 'inherit', 'ipc'],
89
95
  env: process.env,
90
96
  });
91
97
  // Ensure the child process is killed when the parent exits
92
98
  process.on('exit', () => childProcess.kill());
93
- process.on('SIGTERM', () => childProcess.kill());
99
+ process.on('SIGTERM', (signal) => {
100
+ reject({ code: (0, exit_codes_1.signalToCode)(signal), signal });
101
+ });
102
+ process.on('SIGINT', (signal) => {
103
+ reject({ code: (0, exit_codes_1.signalToCode)(signal), signal });
104
+ });
94
105
  childProcess.on('error', (err) => {
95
- reject(err);
106
+ reject({ error: err });
96
107
  });
97
- childProcess.on('exit', (code) => {
108
+ childProcess.on('exit', (code, signal) => {
98
109
  if (code === 0) {
99
- resolve(code);
110
+ resolve({ code, signal });
100
111
  }
101
112
  else {
102
- reject(code);
113
+ reject({ code, signal });
103
114
  }
104
115
  });
105
116
  });
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
5
5
  const ts = require("typescript");
6
6
  const fs_extra_1 = require("fs-extra");
7
7
  const path_1 = require("path");
8
- const typescript_1 = require("nx/src/utils/typescript");
8
+ const js_1 = require("@nx/js");
9
9
  function createNextConfigFile(options, context) {
10
10
  // Don't overwrite the next.config.js file if output path is the same as the source path.
11
11
  if (options.outputPath.replace(/\/$/, '') ===
@@ -57,7 +57,7 @@ function readSource(getFile) {
57
57
  // Exported for testing
58
58
  function getWithNxContent({ file, content } = readSource(() => (0, path_1.join)(__dirname, '../../../../plugins/with-nx.js'))) {
59
59
  const withNxSource = ts.createSourceFile(file, content, ts.ScriptTarget.Latest, true);
60
- const getWithNxContextDeclaration = (0, typescript_1.findNodes)(withNxSource, ts.SyntaxKind.FunctionDeclaration)?.find((node) => node.name?.text === 'getWithNxContext');
60
+ const getWithNxContextDeclaration = (0, js_1.findNodes)(withNxSource, ts.SyntaxKind.FunctionDeclaration)?.find((node) => node.name?.text === 'getWithNxContext');
61
61
  if (getWithNxContextDeclaration) {
62
62
  content = (0, devkit_1.applyChangesToString)(content, [
63
63
  {
@@ -122,7 +122,7 @@ exports.getRelativeFilesToCopy = getRelativeFilesToCopy;
122
122
  // Exported for testing
123
123
  function getRelativeImports({ file, content, }) {
124
124
  const source = ts.createSourceFile(file, content, ts.ScriptTarget.Latest, true);
125
- const callExpressionsOrImportDeclarations = (0, typescript_1.findNodes)(source, [
125
+ const callExpressionsOrImportDeclarations = (0, js_1.findNodes)(source, [
126
126
  ts.SyntaxKind.CallExpression,
127
127
  ts.SyntaxKind.ImportDeclaration,
128
128
  ]);
@@ -19,7 +19,8 @@ exports.default = serveExecutor;
19
19
  async function* runCustomServer(root, options, context) {
20
20
  process.env.NX_NEXT_DIR ??= root;
21
21
  process.env.NX_NEXT_PUBLIC_DIR = (0, path_1.join)(root, 'public');
22
- const baseUrl = `http://${options.hostname || 'localhost'}:${options.port}`;
22
+ const httpProtocol = options.customServerHttps ? 'https' : 'http';
23
+ const baseUrl = `${httpProtocol}://${options.hostname || 'localhost'}:${options.port}`;
23
24
  const customServerBuild = await (0, devkit_1.runExecutor)((0, devkit_1.parseTargetString)(options.customServerTarget, context), {
24
25
  watch: options.dev ? true : false,
25
26
  }, context);
@@ -56,6 +56,22 @@
56
56
  "experimentalHttps": {
57
57
  "type": "boolean",
58
58
  "description": "Enable HTTPS support for the Next.js development server."
59
+ },
60
+ "experimentalHttpsKey": {
61
+ "type": "string",
62
+ "description": "Path to a HTTPS key file."
63
+ },
64
+ "experimentalHttpsCert": {
65
+ "type": "string",
66
+ "description": "Path to a HTTPS certificate file."
67
+ },
68
+ "experimentalHttpsCa": {
69
+ "type": "string",
70
+ "description": "Path to a HTTPS certificate authority file."
71
+ },
72
+ "customServerHttps:": {
73
+ "type": "boolean",
74
+ "description": "Enable HTTPS support for the custom server."
59
75
  }
60
76
  },
61
77
  "required": ["buildTarget"],
@@ -32,10 +32,9 @@ async function* serveExecutor(options, context) {
32
32
  }
33
33
  const mode = options.dev ? 'dev' : 'start';
34
34
  const turbo = options.turbo && options.dev ? '--turbo' : '';
35
- const experimentalHttps = options.experimentalHttps && options.dev ? '--experimental-https' : '';
36
35
  const nextBin = require.resolve('next/dist/bin/next');
37
36
  yield* (0, async_iterable_1.createAsyncIterable)(async ({ done, next, error }) => {
38
- const server = (0, child_process_1.fork)(nextBin, [mode, ...args, turbo, experimentalHttps], {
37
+ const server = (0, child_process_1.fork)(nextBin, [mode, ...args, turbo, ...getExperimentalHttpsFlags(options)], {
39
38
  cwd: options.dev ? projectRoot : nextDir,
40
39
  stdio: 'inherit',
41
40
  });
@@ -64,3 +63,17 @@ async function* serveExecutor(options, context) {
64
63
  });
65
64
  }
66
65
  exports.default = serveExecutor;
66
+ function getExperimentalHttpsFlags(options) {
67
+ if (!options.dev)
68
+ return [];
69
+ const flags = [];
70
+ if (options.experimentalHttps)
71
+ flags.push('--experimental-https');
72
+ if (options.experimentalHttpsKey)
73
+ flags.push(`--experimental-https-key=${options.experimentalHttpsKey}`);
74
+ if (options.experimentalHttpsCert)
75
+ flags.push(`--experimental-https-cert=${options.experimentalHttpsCert}`);
76
+ if (options.experimentalHttpsCa)
77
+ flags.push(`--experimental-https-ca=${options.experimentalHttpsCa}`);
78
+ return flags;
79
+ }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applicationGeneratorInternal = exports.applicationGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const js_1 = require("@nx/js");
6
+ const react_1 = require("@nx/react");
6
7
  const versions_1 = require("@nx/react/src/utils/versions");
7
8
  const normalize_options_1 = require("./lib/normalize-options");
8
9
  const add_e2e_1 = require("./lib/add-e2e");
@@ -50,6 +51,12 @@ async function applicationGeneratorInternal(host, schema) {
50
51
  tasks.push(jestTask);
51
52
  const lintTask = await (0, add_linting_1.addLinting)(host, options);
52
53
  tasks.push(lintTask);
54
+ if (options.style === 'tailwind') {
55
+ const tailwindTask = await (0, react_1.setupTailwindGenerator)(host, {
56
+ project: options.projectName,
57
+ });
58
+ tasks.push(tailwindTask);
59
+ }
53
60
  const styledTask = (0, styles_1.addStyleDependencies)(host, {
54
61
  style: options.style,
55
62
  swc: !host.exists((0, devkit_1.joinPathFragments)(options.appProjectRoot, '.babelrc')),
@@ -7,7 +7,7 @@
7
7
  %>import styled from '<%= styledModule %>';<% } else {
8
8
  var wrapper = 'div';
9
9
  %>
10
- <%- style !== 'styled-jsx' ? `import styles from './page.module.${style}';` : '' %>
10
+ <%- (style !== 'styled-jsx' && style !== 'tailwind') ? `import styles from './page.module.${style}';` : '' %>
11
11
  <% }
12
12
  %>
13
13
 
@@ -22,9 +22,9 @@ export default function Index() {
22
22
  * Note: The corresponding styles are in the ./<%= fileName %>.<%= style %> file.
23
23
  */
24
24
  return (
25
- <<%= wrapper %><% if (!styledModule) {%> className={styles.page}<% } %>>
25
+ <<%= wrapper %><% if (!styledModule && style !== 'tailwind') {%> className={styles.page}<% } %>>
26
26
  <%- styledModule === 'styled-jsx' && style !== 'none' ? `<style jsx>{\`${pageStyleContent}\`}</style>` : `` %>
27
27
  <%- appContent %>
28
28
  </<%= wrapper %>>
29
29
  );
30
- };
30
+ };
@@ -4,7 +4,7 @@
4
4
  %>import styled from '<%= styledModule %>';<% } else {
5
5
  var wrapper = 'div';
6
6
  %>
7
- <%- style !== 'styled-jsx' ? `import styles from './${fileName}.module.${style}';` : '' %>
7
+ <%- (style !== 'styled-jsx' && style !== 'tailwind') ? `import styles from './${fileName}.module.${style}';` : '' %>
8
8
  <% }
9
9
  %>
10
10
 
@@ -20,7 +20,7 @@ export function Index() {
20
20
  * Note: The corresponding styles are in the ./<%= fileName %>.<%= style %> file.
21
21
  */
22
22
  return (
23
- <<%= wrapper %><% if (!styledModule) {%> className={styles.page}<% } %>>
23
+ <<%= wrapper %><% if (!styledModule && style !== 'tailwind') {%> className={styles.page}<% } %>>
24
24
  <%- styledModule === 'styled-jsx' && style !== 'none' ? `<style jsx>{\`${pageStyleContent}\`}</style>` : `` %>
25
25
  <%- appContent %>
26
26
  </<%= wrapper %>>
@@ -13,10 +13,11 @@ async function addE2e(host, options) {
13
13
  if (options.e2eTestRunner === 'cypress') {
14
14
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
15
15
  if (!hasPlugin) {
16
- (0, web_1.webStaticServeGenerator)(host, {
16
+ await (0, web_1.webStaticServeGenerator)(host, {
17
17
  buildTarget: `${options.projectName}:build`,
18
18
  outputPath: `${options.outputPath}/out`,
19
19
  targetName: 'serve-static',
20
+ spa: true,
20
21
  });
21
22
  }
22
23
  (0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
@@ -32,12 +33,12 @@ async function addE2e(host, options) {
32
33
  project: options.e2eProjectName,
33
34
  directory: 'src',
34
35
  skipFormat: true,
35
- devServerTarget: `${options.projectName}:${hasPlugin ? 'start' : 'serve'}`,
36
- baseUrl: `http://localhost:${hasPlugin ? '3000' : '4200'}`,
36
+ devServerTarget: `${options.projectName}:${options.e2eWebServerTarget}`,
37
+ baseUrl: options.e2eWebServerAddress,
37
38
  jsx: true,
38
39
  webServerCommands: hasPlugin
39
40
  ? {
40
- default: `nx run ${options.projectName}:start`,
41
+ default: `nx run ${options.projectName}:${options.e2eWebServerTarget}`,
41
42
  }
42
43
  : undefined,
43
44
  ciWebServerCommand: hasPlugin
@@ -51,6 +52,7 @@ async function addE2e(host, options) {
51
52
  root: options.e2eProjectRoot,
52
53
  sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
53
54
  targets: {},
55
+ tags: [],
54
56
  implicitDependencies: [options.projectName],
55
57
  });
56
58
  return configurationGenerator(host, {
@@ -62,8 +64,8 @@ async function addE2e(host, options) {
62
64
  js: false,
63
65
  linter: options.linter,
64
66
  setParserOptionsProject: options.setParserOptionsProject,
65
- webServerAddress: `http://127.0.0.1:${hasPlugin ? '3000' : '4200'}`,
66
- webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${hasPlugin ? 'start' : 'serve'} ${options.projectName}`,
67
+ webServerAddress: `http://127.0.0.1:${options.e2ePort}`,
68
+ webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.projectName}`,
67
69
  addPlugin: options.addPlugin,
68
70
  });
69
71
  }
@@ -94,7 +94,7 @@ function createApplicationFiles(host, options) {
94
94
  if (options.swc !== false) {
95
95
  host.delete(`${options.appProjectRoot}/.babelrc`);
96
96
  }
97
- if (options.styledModule) {
97
+ if (options.styledModule || options.style === 'tailwind') {
98
98
  if (options.appDir) {
99
99
  host.delete(`${generatedAppFilePath}/app/page.module.${options.style}`);
100
100
  }
@@ -6,6 +6,9 @@ export interface NormalizedSchema extends Schema {
6
6
  outputPath: string;
7
7
  e2eProjectName: string;
8
8
  e2eProjectRoot: string;
9
+ e2eWebServerAddress: string;
10
+ e2eWebServerTarget: string;
11
+ e2ePort: number;
9
12
  parsedTags: string[];
10
13
  fileName: string;
11
14
  styledModule: null | string;
@@ -20,8 +20,30 @@ async function normalizeOptions(host, options) {
20
20
  const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
21
21
  nxJson.useInferencePlugins !== false;
22
22
  options.addPlugin ??= addPlugin;
23
+ let e2eWebServerTarget = options.addPlugin ? 'start' : 'serve';
24
+ if (options.addPlugin) {
25
+ if (nxJson.plugins) {
26
+ for (const plugin of nxJson.plugins) {
27
+ if (typeof plugin === 'object' &&
28
+ plugin.plugin === '@nx/next/plugin' &&
29
+ plugin.options.startTargetName) {
30
+ e2eWebServerTarget = plugin.options
31
+ .startTargetName;
32
+ }
33
+ }
34
+ }
35
+ }
36
+ let e2ePort = options.addPlugin ? 3000 : 4200;
37
+ if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
38
+ (nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
39
+ nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT)) {
40
+ e2ePort =
41
+ nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
42
+ nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT;
43
+ }
23
44
  const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
24
45
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
46
+ const e2eWebServerAddress = `http://localhost:${e2ePort}`;
25
47
  const name = (0, devkit_1.names)(options.name).fileName;
26
48
  const outputPath = (0, devkit_1.joinPathFragments)('dist', appProjectRoot, ...(options.rootProject ? [name] : []));
27
49
  const parsedTags = options.tags
@@ -30,7 +52,7 @@ async function normalizeOptions(host, options) {
30
52
  const fileName = 'index';
31
53
  const appDir = options.appDir ?? true;
32
54
  const src = options.src ?? true;
33
- const styledModule = /^(css|scss|less)$/.test(options.style)
55
+ const styledModule = /^(css|scss|less|tailwind)$/.test(options.style)
34
56
  ? null
35
57
  : options.style;
36
58
  (0, assertion_1.assertValidStyle)(options.style);
@@ -41,7 +63,10 @@ async function normalizeOptions(host, options) {
41
63
  appProjectRoot,
42
64
  e2eProjectName,
43
65
  e2eProjectRoot,
44
- e2eTestRunner: options.e2eTestRunner || 'cypress',
66
+ e2eWebServerAddress,
67
+ e2eWebServerTarget,
68
+ e2ePort,
69
+ e2eTestRunner: options.e2eTestRunner || 'playwright',
45
70
  fileName,
46
71
  linter: options.linter || eslint_1.Linter.EsLint,
47
72
  name,
@@ -46,6 +46,10 @@
46
46
  "value": "less",
47
47
  "label": "LESS [ https://lesscss.org ]"
48
48
  },
49
+ {
50
+ "value": "tailwind",
51
+ "label": "tailwind [ https://tailwindcss.com/ ]"
52
+ },
49
53
  {
50
54
  "value": "styled-components",
51
55
  "label": "styled-components [ https://styled-components.com ]"
@@ -85,10 +89,10 @@
85
89
  },
86
90
  "e2eTestRunner": {
87
91
  "type": "string",
88
- "enum": ["cypress", "playwright", "none"],
92
+ "enum": ["playwright", "cypress", "none"],
89
93
  "description": "Test runner to use for end to end (E2E) tests.",
90
94
  "x-prompt": "Which E2E test runner would you like to use?",
91
- "default": "cypress"
95
+ "default": "playwright"
92
96
  },
93
97
  "tags": {
94
98
  "type": "string",
@@ -3,7 +3,7 @@ import type { SupportedStyles } from '@nx/react';
3
3
  interface Schema {
4
4
  name: string;
5
5
  /**
6
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19.
6
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v20.
7
7
  */
8
8
  project?: string;
9
9
  style: SupportedStyles;
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
5
5
  const react_1 = require("@nx/react");
6
6
  const styles_1 = require("../../utils/styles");
7
7
  const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
8
- // TODO(v19): Remove this logic once we no longer derive directory.
8
+ // TODO(v20): Remove this logic once we no longer derive directory.
9
9
  function maybeGetDerivedDirectory(host, options) {
10
10
  if (!options.project)
11
11
  return options.directory;
@@ -13,7 +13,7 @@
13
13
  "$default": {
14
14
  "$source": "projectName"
15
15
  },
16
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
16
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v20."
17
17
  },
18
18
  "name": {
19
19
  "type": "string",
@@ -2,11 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nextInitGeneratorInternal = exports.nextInitGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
5
+ const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
6
6
  const versions_1 = require("@nx/react/src/utils/versions");
7
7
  const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
8
8
  const versions_2 = require("../../utils/versions");
9
- const add_plugin_1 = require("./lib/add-plugin");
10
9
  function updateDependencies(host, schema) {
11
10
  const tasks = [];
12
11
  tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(host, ['@nx/next'], []));
@@ -29,17 +28,23 @@ async function nextInitGeneratorInternal(host, schema) {
29
28
  nxJson.useInferencePlugins !== false;
30
29
  schema.addPlugin ??= addPluginDefault;
31
30
  if (schema.addPlugin) {
32
- (0, add_plugin_1.addPlugin)(host);
31
+ const { createNodes } = await Promise.resolve().then(() => require('../../plugins/plugin'));
32
+ await (0, add_plugin_1.addPluginV1)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/next/plugin', createNodes, {
33
+ startTargetName: ['start', 'next:start', 'next-start'],
34
+ buildTargetName: ['build', 'next:build', 'next-build'],
35
+ devTargetName: ['dev', 'next:dev', 'next-dev'],
36
+ serveStaticTargetName: [
37
+ 'serve-static',
38
+ 'next:serve-static',
39
+ 'next-serve-static',
40
+ ],
41
+ }, schema.updatePackageScripts);
33
42
  }
34
43
  (0, add_gitignore_entry_1.addGitIgnoreEntry)(host);
35
44
  let installTask = () => { };
36
45
  if (!schema.skipPackageJson) {
37
46
  installTask = updateDependencies(host, schema);
38
47
  }
39
- if (schema.updatePackageScripts) {
40
- const { createNodes } = await Promise.resolve().then(() => require('../../plugins/plugin'));
41
- await (0, update_package_scripts_1.updatePackageScripts)(host, createNodes);
42
- }
43
48
  return installTask;
44
49
  }
45
50
  exports.nextInitGeneratorInternal = nextInitGeneratorInternal;
@@ -46,7 +46,7 @@ async function normalizeOptions(host, options) {
46
46
  let routerDirectory;
47
47
  if (options.project) {
48
48
  // Legacy behavior, detect app vs page router from specified project.
49
- // TODO(v19): remove this logic
49
+ // TODO(v20): remove this logic
50
50
  const project = (0, devkit_1.readProjectConfiguration)(host, options.project);
51
51
  // app/ is a reserved folder in nextjs so it is safe to check it's existence
52
52
  isAppRouter =
@@ -3,7 +3,7 @@ import { SupportedStyles } from '@nx/react';
3
3
  export interface Schema {
4
4
  name: string;
5
5
  /**
6
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19.
6
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v20.
7
7
  */
8
8
  project?: string;
9
9
  style: SupportedStyles;
@@ -13,7 +13,7 @@
13
13
  "$default": {
14
14
  "$source": "projectName"
15
15
  },
16
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
16
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v20."
17
17
  },
18
18
  "name": {
19
19
  "type": "string",
@@ -97,7 +97,7 @@
97
97
  "type": "boolean",
98
98
  "description": "Create component at the source root rather than its own directory.",
99
99
  "default": false,
100
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
100
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
101
101
  },
102
102
  "skipFormat": {
103
103
  "description": "Skip formatting files.",
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { CreateDependencies, CreateNodes } from '@nx/devkit';
3
2
  export interface NextPluginOptions {
4
3
  buildTargetName?: string;
@@ -8,4 +7,3 @@ export interface NextPluginOptions {
8
7
  }
9
8
  export declare const createDependencies: CreateDependencies;
10
9
  export declare const createNodes: CreateNodes<NextPluginOptions>;
11
- export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadEsmModule = exports.createNodes = exports.createDependencies = void 0;
3
+ exports.createNodes = exports.createDependencies = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const path_1 = require("path");
6
6
  const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
@@ -8,17 +8,21 @@ const fs_1 = require("fs");
8
8
  const cache_directory_1 = require("nx/src/utils/cache-directory");
9
9
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
10
10
  const js_1 = require("@nx/js");
11
- const cachePath = (0, path_1.join)(cache_directory_1.projectGraphCacheDirectory, 'next.hash');
12
- const targetsCache = (0, fs_1.existsSync)(cachePath) ? readTargetsCache() : {};
13
- const calculatedTargets = {};
11
+ const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
12
+ const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'next.hash');
13
+ const targetsCache = readTargetsCache();
14
14
  function readTargetsCache() {
15
- return (0, devkit_1.readJsonFile)(cachePath);
15
+ return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
16
16
  }
17
- function writeTargetsToCache(targets) {
18
- (0, devkit_1.writeJsonFile)(cachePath, targets);
17
+ function writeTargetsToCache() {
18
+ const oldCache = readTargetsCache();
19
+ (0, devkit_1.writeJsonFile)(cachePath, {
20
+ ...oldCache,
21
+ ...targetsCache,
22
+ });
19
23
  }
20
24
  const createDependencies = () => {
21
- writeTargetsToCache(calculatedTargets);
25
+ writeTargetsToCache();
22
26
  return [];
23
27
  };
24
28
  exports.createDependencies = createDependencies;
@@ -33,17 +37,13 @@ exports.createNodes = [
33
37
  return {};
34
38
  }
35
39
  options = normalizeOptions(options);
36
- const hash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
37
- (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
38
- ]);
39
- const targets = targetsCache[hash] ??
40
- (await buildNextTargets(configFilePath, projectRoot, options, context));
41
- calculatedTargets[hash] = targets;
40
+ const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
41
+ targetsCache[hash] ??= await buildNextTargets(configFilePath, projectRoot, options, context);
42
42
  return {
43
43
  projects: {
44
44
  [projectRoot]: {
45
45
  root: projectRoot,
46
- targets,
46
+ targets: targetsCache[hash],
47
47
  },
48
48
  },
49
49
  };
@@ -72,6 +72,9 @@ async function getBuildTargetConfig(namedInputs, projectRoot, nextConfig) {
72
72
  inputs: getInputs(namedInputs),
73
73
  outputs: [nextOutputPath, `${nextOutputPath}/!(cache)`],
74
74
  };
75
+ // TODO(ndcunningham): Update this to be consider different versions of next.js which is running
76
+ // This doesn't actually need to be tty, but next.js has a bug, https://github.com/vercel/next.js/issues/62906, where it exits 0 when SIGINT is sent.
77
+ targetConfig.options.tty = false;
75
78
  return targetConfig;
76
79
  }
77
80
  function getDevTargetConfig(projectRoot) {
@@ -100,6 +103,8 @@ function getStaticServeTargetConfig(options) {
100
103
  buildTarget: options.buildTargetName,
101
104
  staticFilePath: '{projectRoot}/out',
102
105
  port: 3000,
106
+ // Routes are found correctly with serve-static
107
+ spa: false,
103
108
  },
104
109
  };
105
110
  return targetConfig;
@@ -125,16 +130,9 @@ async function getOutputs(projectRoot, nextConfig) {
125
130
  return `{workspaceRoot}/${projectRoot}/${dir}`;
126
131
  }
127
132
  }
128
- async function getNextConfig(configFilePath, context) {
133
+ function getNextConfig(configFilePath, context) {
129
134
  const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
130
- let module;
131
- if ((0, path_1.extname)(configFilePath) === '.mjs') {
132
- module = await loadEsmModule(resolvedPath);
133
- }
134
- else {
135
- module = load(resolvedPath);
136
- }
137
- return module.default ?? module;
135
+ return (0, config_utils_1.loadConfigFile)(resolvedPath);
138
136
  }
139
137
  function normalizeOptions(options) {
140
138
  options ??= {};
@@ -154,29 +152,3 @@ function getInputs(namedInputs) {
154
152
  },
155
153
  ];
156
154
  }
157
- const packageInstallationDirectories = ['node_modules', '.yarn'];
158
- /**
159
- * Load the module after ensuring that the require cache is cleared.
160
- */
161
- function load(path) {
162
- // Clear cache if the path is in the cache
163
- if (require.cache[path]) {
164
- for (const key of Object.keys(require.cache)) {
165
- if (!packageInstallationDirectories.some((dir) => key.includes(dir))) {
166
- delete require.cache[key];
167
- }
168
- }
169
- }
170
- // Then require
171
- return require(path);
172
- }
173
- /**
174
- * Lazily compiled dynamic import loader function.
175
- */
176
- let dynamicLoad;
177
- function loadEsmModule(modulePath) {
178
- const modulePathWithCacheBust = `${modulePath}?version=${Date.now()}`;
179
- dynamicLoad ??= new Function('modulePath', `return import(modulePath);`);
180
- return dynamicLoad(modulePathWithCacheBust);
181
- }
182
- exports.loadEsmModule = loadEsmModule;
@@ -5,7 +5,10 @@ function createCliOptions(obj) {
5
5
  return Object.entries(obj).reduce((arr, [key, value]) => {
6
6
  if (value !== undefined) {
7
7
  const kebabCase = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());
8
- arr.push(`--${kebabCase}=${value}`);
8
+ if (value === true || typeof value !== 'boolean') {
9
+ // Boolean flags don't need a value (e.g. --debug)
10
+ arr.push(`--${kebabCase}` + (typeof value !== 'boolean' ? `=${value}` : ''));
11
+ }
9
12
  }
10
13
  return arr;
11
14
  }, []);
@@ -1,7 +1,7 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  export declare const nextSpecificStyleDependenciesBabel: {
3
3
  'styled-components': {
4
- dependencies: import("../../../../build/packages/react/src/utils/dependencies").DependencyEntries;
4
+ dependencies: import("@nx/react/src/utils/dependencies").DependencyEntries;
5
5
  devDependencies: {
6
6
  'babel-plugin-styled-components': string;
7
7
  };
@@ -10,7 +10,7 @@ export declare const nextSpecificStyleDependenciesBabel: {
10
10
  dependencies: {
11
11
  '@emotion/server': string;
12
12
  };
13
- devDependencies: import("../../../../build/packages/react/src/utils/dependencies").DependencyEntries;
13
+ devDependencies: import("@nx/react/src/utils/dependencies").DependencyEntries;
14
14
  };
15
15
  css: {
16
16
  dependencies: {};
@@ -32,7 +32,7 @@ export declare const nextSpecificStyleDependenciesBabel: {
32
32
  };
33
33
  export declare const nextSpecificStyleDependenciesSwc: {
34
34
  'styled-components': {
35
- dependencies: import("../../../../build/packages/react/src/utils/dependencies").DependencyEntries;
35
+ dependencies: import("@nx/react/src/utils/dependencies").DependencyEntries;
36
36
  devDependencies: {
37
37
  'babel-plugin-styled-components': string;
38
38
  };
@@ -41,7 +41,7 @@ export declare const nextSpecificStyleDependenciesSwc: {
41
41
  dependencies: {
42
42
  '@emotion/server': string;
43
43
  };
44
- devDependencies: import("../../../../build/packages/react/src/utils/dependencies").DependencyEntries;
44
+ devDependencies: import("@nx/react/src/utils/dependencies").DependencyEntries;
45
45
  };
46
46
  css: {
47
47
  dependencies: {};
@@ -45,6 +45,10 @@ export interface NextServeBuilderOptions {
45
45
  keepAliveTimeout?: number;
46
46
  turbo?: boolean;
47
47
  experimentalHttps?: boolean;
48
+ experimentalHttpsKey?: string;
49
+ experimentalHttpsCert?: string;
50
+ experimentalHttpsCa?: string;
51
+ customServerHttps?: boolean;
48
52
  }
49
53
  export interface NextExportBuilderOptions {
50
54
  buildTarget: string;
@@ -1,6 +1,6 @@
1
1
  export declare const nxVersion: any;
2
- export declare const nextVersion = "14.0.4";
3
- export declare const eslintConfigNextVersion = "14.0.4";
2
+ export declare const nextVersion = "14.2.3";
3
+ export declare const eslintConfigNextVersion = "14.2.3";
4
4
  export declare const sassVersion = "1.62.1";
5
5
  export declare const lessLoader = "11.1.0";
6
6
  export declare const emotionServerVersion = "11.11.0";
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.swcNodeVersion = exports.swcHelpersVersion = exports.swcCoreVersion = exports.swcCliVersion = exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.emotionServerVersion = exports.lessLoader = exports.sassVersion = exports.eslintConfigNextVersion = exports.nextVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
- exports.nextVersion = '14.0.4';
6
- exports.eslintConfigNextVersion = '14.0.4';
5
+ exports.nextVersion = '14.2.3';
6
+ exports.eslintConfigNextVersion = '14.2.3';
7
7
  exports.sassVersion = '1.62.1';
8
8
  exports.lessLoader = '11.1.0';
9
9
  exports.emotionServerVersion = '11.11.0';
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function addPlugin(tree: Tree): void;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addPlugin = void 0;
4
- const devkit_1 = require("@nx/devkit");
5
- function addPlugin(tree) {
6
- const nxJson = (0, devkit_1.readNxJson)(tree);
7
- nxJson.plugins ??= [];
8
- for (const plugin of nxJson.plugins) {
9
- if (typeof plugin === 'string'
10
- ? plugin === '@nx/next/plugin'
11
- : plugin.plugin === '@nx/next/plugin') {
12
- return;
13
- }
14
- }
15
- nxJson.plugins.push({
16
- plugin: '@nx/next/plugin',
17
- options: {
18
- buildTargetName: 'build',
19
- devTargetName: 'dev',
20
- startTargetName: 'start',
21
- serveStaticTargetName: 'serve-static',
22
- },
23
- });
24
- (0, devkit_1.updateNxJson)(tree, nxJson);
25
- }
26
- exports.addPlugin = addPlugin;
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function update(tree: Tree): Promise<import("@nx/devkit").GeneratorCallback>;
3
- export default update;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.update = void 0;
4
- const devkit_1 = require("@nx/devkit");
5
- async function update(tree) {
6
- const projects = (0, devkit_1.getProjects)(tree);
7
- const missingDeps = {};
8
- for (const [, config] of projects) {
9
- if (config.targets?.build?.executor === '@nrwl/next:build' &&
10
- tree.exists((0, devkit_1.joinPathFragments)(config.root, 'next.config.js'))) {
11
- const nextConfigContent = tree.read((0, devkit_1.joinPathFragments)(config.root, 'next.config.js'), 'utf-8');
12
- if (nextConfigContent.includes('@nrwl/next/plugins/with-less')) {
13
- missingDeps['less'] = '3.12.2';
14
- }
15
- if (nextConfigContent.includes('@nrwl/next/plugins/with-stylus')) {
16
- missingDeps['stylus'] = '^0.55.0';
17
- }
18
- }
19
- }
20
- return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, missingDeps);
21
- }
22
- exports.update = update;
23
- exports.default = update;