@nx/next 17.3.0 → 18.0.0-beta.0

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": "17.3.0",
3
+ "version": "18.0.0-beta.0",
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, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "next": ">=13.0.0"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "17.3.0",
37
+ "@nx/devkit": "18.0.0-beta.0",
38
38
  "@babel/plugin-proposal-decorators": "^7.22.7",
39
39
  "@svgr/webpack": "^8.0.1",
40
40
  "chalk": "^4.1.0",
@@ -45,12 +45,12 @@
45
45
  "url-loader": "^4.1.1",
46
46
  "tslib": "^2.3.0",
47
47
  "webpack-merge": "^5.8.0",
48
- "@nx/js": "17.3.0",
49
- "@nx/eslint": "17.3.0",
50
- "@nx/react": "17.3.0",
51
- "@nx/web": "17.3.0",
52
- "@nx/workspace": "17.3.0",
53
- "@nrwl/next": "17.3.0"
48
+ "@nx/js": "18.0.0-beta.0",
49
+ "@nx/eslint": "18.0.0-beta.0",
50
+ "@nx/react": "18.0.0-beta.0",
51
+ "@nx/web": "18.0.0-beta.0",
52
+ "@nx/workspace": "18.0.0-beta.0",
53
+ "@nrwl/next": "18.0.0-beta.0"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"
@@ -1,3 +1,3 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  import { CustomServerSchema } from './schema';
3
- export declare function customServerGenerator(host: Tree, options: CustomServerSchema): Promise<void>;
3
+ export declare function customServerGenerator(host: Tree, options: CustomServerSchema): Promise<() => void>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.customServerGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const path_1 = require("path");
6
+ const add_swc_to_custom_server_1 = require("../../utils/add-swc-to-custom-server");
6
7
  async function customServerGenerator(host, options) {
7
8
  const project = (0, devkit_1.readProjectConfiguration)(host, options.project);
8
9
  if (project.targets?.build?.executor !== '@nx/next:build' &&
@@ -35,7 +36,7 @@ async function customServerGenerator(host, options) {
35
36
  project.targets.serve.configurations.development.customServerTarget = `${options.project}:serve-custom-server:development`;
36
37
  project.targets.serve.configurations.production.customServerTarget = `${options.project}:serve-custom-server:production`;
37
38
  project.targets['build-custom-server'] = {
38
- executor: '@nx/js:tsc',
39
+ executor: options.compiler === 'tsc' ? '@nx/js:tsc' : '@nx/js:swc',
39
40
  defaultConfiguration: 'production',
40
41
  options: {
41
42
  outputPath,
@@ -75,5 +76,8 @@ async function customServerGenerator(host, options) {
75
76
  json.targetDefaults['build-custom-server'].cache ??= true;
76
77
  return json;
77
78
  });
79
+ if (options.compiler === 'swc') {
80
+ return (0, add_swc_to_custom_server_1.configureForSwc)(host, project.root);
81
+ }
78
82
  }
79
83
  exports.customServerGenerator = customServerGenerator;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function configureForSwc(tree: Tree, projectRoot: string): () => void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureForSwc = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const versions_1 = require("./versions");
6
+ const add_swc_config_1 = require("@nx/js/src/utils/swc/add-swc-config");
7
+ function configureForSwc(tree, projectRoot) {
8
+ const swcConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, '.swcrc');
9
+ const rootPackageJson = (0, devkit_1.readJson)(tree, 'package.json');
10
+ const hasSwcDepedency = rootPackageJson.dependencies?.['@swc/core'] ||
11
+ rootPackageJson.devDependencies?.['@swc/core'];
12
+ const hasSwcCliDependency = rootPackageJson.dependencies?.['@swc/cli'] ||
13
+ rootPackageJson.devDependencies?.['@swc/cli'];
14
+ if (!tree.exists(swcConfigPath)) {
15
+ (0, add_swc_config_1.addSwcConfig)(tree, swcConfigPath);
16
+ }
17
+ if (!hasSwcDepedency || !hasSwcCliDependency) {
18
+ addSwcDependencies(tree);
19
+ return () => (0, devkit_1.installPackagesTask)(tree);
20
+ }
21
+ }
22
+ exports.configureForSwc = configureForSwc;
23
+ function addSwcDependencies(tree) {
24
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
25
+ '@swc-node/register': versions_1.swcNodeVersion,
26
+ '@swc/cli': versions_1.swcCliVersion,
27
+ '@swc/core': versions_1.swcCoreVersion,
28
+ });
29
+ }
@@ -6,3 +6,7 @@ export declare const lessLoader = "11.1.0";
6
6
  export declare const emotionServerVersion = "11.11.0";
7
7
  export declare const babelPluginStyledComponentsVersion = "1.10.7";
8
8
  export declare const tsLibVersion = "^2.3.0";
9
+ export declare const swcCliVersion = "~0.1.62";
10
+ export declare const swcCoreVersion = "~1.3.85";
11
+ export declare const swcHelpersVersion = "~0.5.2";
12
+ export declare const swcNodeVersion = "~1.6.7";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.emotionServerVersion = exports.lessLoader = exports.sassVersion = exports.eslintConfigNextVersion = exports.nextVersion = exports.nxVersion = void 0;
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
5
  exports.nextVersion = '14.0.4';
6
6
  exports.eslintConfigNextVersion = '14.0.4';
@@ -9,3 +9,7 @@ exports.lessLoader = '11.1.0';
9
9
  exports.emotionServerVersion = '11.11.0';
10
10
  exports.babelPluginStyledComponentsVersion = '1.10.7';
11
11
  exports.tsLibVersion = '^2.3.0';
12
+ exports.swcCliVersion = '~0.1.62';
13
+ exports.swcCoreVersion = '~1.3.85';
14
+ exports.swcHelpersVersion = '~0.5.2';
15
+ exports.swcNodeVersion = '~1.6.7';