@nx/next 16.9.0-beta.2 → 16.9.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "16.9.0-beta.2",
3
+ "version": "16.9.0-beta.3",
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": {
@@ -35,13 +35,13 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@babel/plugin-proposal-decorators": "^7.22.7",
38
- "@nrwl/next": "16.9.0-beta.2",
39
- "@nx/devkit": "16.9.0-beta.2",
40
- "@nx/js": "16.9.0-beta.2",
41
- "@nx/linter": "16.9.0-beta.2",
42
- "@nx/react": "16.9.0-beta.2",
43
- "@nx/web": "16.9.0-beta.2",
44
- "@nx/workspace": "16.9.0-beta.2",
38
+ "@nrwl/next": "16.9.0-beta.3",
39
+ "@nx/devkit": "16.9.0-beta.3",
40
+ "@nx/js": "16.9.0-beta.3",
41
+ "@nx/linter": "16.9.0-beta.3",
42
+ "@nx/react": "16.9.0-beta.3",
43
+ "@nx/web": "16.9.0-beta.3",
44
+ "@nx/workspace": "16.9.0-beta.3",
45
45
  "@svgr/webpack": "^8.0.1",
46
46
  "chalk": "^4.1.0",
47
47
  "copy-webpack-plugin": "^10.2.4",
@@ -56,5 +56,5 @@
56
56
  "access": "public"
57
57
  },
58
58
  "type": "commonjs",
59
- "gitHead": "e11d538fa2c7266066d554d9405abab8e0a65040"
59
+ "gitHead": "d5692528c089a75c76b21d2d1235d8cc5dbb1d26"
60
60
  }
@@ -23,7 +23,13 @@ function nxComponentTestingPreset(pathToConfig, options) {
23
23
  let buildFileReplacements = [];
24
24
  let buildOuputPath = `dist/${ctProjectName}/.next`;
25
25
  if (buildTarget) {
26
- const parsedBuildTarget = (0, devkit_1.parseTargetString)(buildTarget, graph);
26
+ const parsedBuildTarget = (0, devkit_1.parseTargetString)(buildTarget, {
27
+ cwd: process.cwd(),
28
+ root: devkit_1.workspaceRoot,
29
+ isVerbose: false,
30
+ projectName: ctProjectName,
31
+ projectGraph: graph,
32
+ });
27
33
  const buildProjectConfig = graph.nodes[parsedBuildTarget.project]?.data;
28
34
  const buildExecutorContext = (0, ct_helpers_1.createExecutorContext)(graph, buildProjectConfig.targets, parsedBuildTarget.project, parsedBuildTarget.target, parsedBuildTarget.configuration);
29
35
  const buildExecutorOptions = (0, devkit_1.readTargetOptions)({
@@ -50,20 +50,27 @@ function getWithNxContext() {
50
50
  };
51
51
  }
52
52
  function getNxContext(graph, target) {
53
- const { parseTargetString } = require('@nx/devkit');
53
+ const { parseTargetString, workspaceRoot } = require('@nx/devkit');
54
54
  const projectNode = graph.nodes[target.project];
55
55
  const targetConfig = projectNode.data.targets[target.target];
56
56
  const targetOptions = targetConfig.options;
57
57
  if (target.configuration) {
58
58
  Object.assign(targetOptions, targetConfig.configurations[target.configuration]);
59
59
  }
60
+ const partialExecutorContext = {
61
+ projectName: target.project,
62
+ targetName: target.target,
63
+ projectGraph: graph,
64
+ configurationName: target.configuration,
65
+ root: workspaceRoot,
66
+ };
60
67
  if (targetOptions.devServerTarget) {
61
68
  // Executors such as @nx/cypress:cypress define the devServerTarget option.
62
- return getNxContext(graph, parseTargetString(targetOptions.devServerTarget, graph));
69
+ return getNxContext(graph, parseTargetString(targetOptions.devServerTarget, partialExecutorContext));
63
70
  }
64
71
  else if (targetOptions.buildTarget) {
65
72
  // Executors such as @nx/next:server or @nx/next:export define the buildTarget option.
66
- return getNxContext(graph, parseTargetString(targetOptions.buildTarget, graph));
73
+ return getNxContext(graph, parseTargetString(targetOptions.buildTarget, partialExecutorContext));
67
74
  }
68
75
  // Default case, return info for current target.
69
76
  // This could be a build using @nx/next:build or run-commands without using our executors.
@@ -28,7 +28,7 @@ async function exportExecutor(options, context) {
28
28
  context.configurationName);
29
29
  dependencies = result.dependencies;
30
30
  }
31
- const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph);
31
+ const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
32
32
  try {
33
33
  const args = getBuildTargetCommand(options);
34
34
  (0, child_process_1.execFileSync)(pmCmd, args, {
@@ -19,7 +19,7 @@ async function* runCustomServer(root, options, context) {
19
19
  process.env.NX_NEXT_DIR = root;
20
20
  process.env.NX_NEXT_PUBLIC_DIR = (0, path_1.join)(root, 'public');
21
21
  const baseUrl = `http://${options.hostname || 'localhost'}:${options.port}`;
22
- const customServerBuild = await (0, devkit_1.runExecutor)((0, devkit_1.parseTargetString)(options.customServerTarget, context.projectGraph), {
22
+ const customServerBuild = await (0, devkit_1.runExecutor)((0, devkit_1.parseTargetString)(options.customServerTarget, context), {
23
23
  watch: options.dev ? true : false,
24
24
  }, context);
25
25
  for await (const result of customServerBuild) {