@nx/node 23.2.0-pr.36527.2252709 → 23.2.0-pr.36866.449f6f3

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/README.md CHANGED
@@ -7,9 +7,9 @@
7
7
 
8
8
  <div style="text-align: center;">
9
9
 
10
- [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
10
+ [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)](<>)
11
11
  [![NPM Version](https://badge.fury.io/js/nx.svg)](https://www.npmjs.com/package/nx)
12
- [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
12
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](<>)
13
13
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
14
14
  [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
15
15
  [![Nx Sandboxing](https://staging.nx.app/workspaces/62d013ea0852fe0a2df74438/sandbox-badge.svg)](https://nx.dev/docs/features/ci-features/sandboxing)
@@ -14,23 +14,28 @@ function addProject(tree, options, frameworkDependencies) {
14
14
  targets: {},
15
15
  tags: options.parsedTags,
16
16
  };
17
+ // The generated build target emits the pruned pnpm deploy output when
18
+ // generatePackageJson is on; the install settings it carries are hashed by
19
+ // no default input (see PNPM_INSTALL_SETTINGS_INPUTS).
20
+ const pnpmDeployInputs = tree.exists('pnpm-lock.yaml')
21
+ ? internal_2.PNPM_INSTALL_SETTINGS_INPUTS
22
+ : [];
17
23
  if (options.bundler === 'esbuild') {
18
24
  (0, internal_1.addBuildTargetDefaults)(tree, '@nx/esbuild:esbuild', 'build', [
19
25
  internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
26
+ ...pnpmDeployInputs,
20
27
  ]);
21
28
  project.targets.build = (0, create_targets_1.getEsBuildConfig)(tree, project, options);
29
+ ensurePnpmDeployInputs(tree, options, project.targets.build);
22
30
  }
23
31
  else if (options.bundler === 'webpack') {
24
32
  if (!(0, has_webpack_plugin_1.hasWebpackPlugin)(tree) && options.addPlugin === false) {
25
33
  (0, internal_1.addBuildTargetDefaults)(tree, `@nx/webpack:webpack`, 'build', [
26
34
  internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
35
+ ...pnpmDeployInputs,
27
36
  ]);
28
37
  project.targets.build = (0, create_targets_1.getWebpackBuildConfig)(tree, project, options);
29
- }
30
- else if (options.isNest) {
31
- // If we are using Nest that has the webpack plugin we need to override the
32
- // build target so that NODE_ENV can be set to production or development so the serve target can be run in development mode
33
- project.targets.build = (0, create_targets_1.getNestWebpackBuildConfig)(project);
38
+ ensurePnpmDeployInputs(tree, options, project.targets.build);
34
39
  }
35
40
  }
36
41
  project.targets = {
@@ -58,3 +63,31 @@ function addProject(tree, options, frameworkDependencies) {
58
63
  (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
59
64
  }
60
65
  }
66
+ /**
67
+ * Guarantees the pnpm deploy-settings inputs reach the generated build target
68
+ * even when `addBuildTargetDefaults` skipped writing them because an
69
+ * executor-keyed `targetDefaults` entry already existed. Resolution and
70
+ * placement follow nx's own targetDefaults matching (see
71
+ * `addPnpmDeployOutputCacheInputs`).
72
+ */
73
+ function ensurePnpmDeployInputs(tree, options, buildTarget) {
74
+ if (!tree.exists('pnpm-lock.yaml')) {
75
+ return;
76
+ }
77
+ const nxJson = (0, devkit_1.readNxJson)(tree);
78
+ const ref = {
79
+ targetName: 'build',
80
+ projectName: options.name,
81
+ projectNode: {
82
+ name: options.name,
83
+ type: 'app',
84
+ data: { root: options.appProjectRoot, tags: options.parsedTags },
85
+ },
86
+ matcherExecutor: buildTarget.executor,
87
+ target: buildTarget,
88
+ };
89
+ const changed = (0, internal_2.addPnpmDeployOutputCacheInputs)(ref, nxJson?.targetDefaults, buildTarget.executor);
90
+ if (changed === 'defaults') {
91
+ (0, devkit_1.updateNxJson)(tree, nxJson);
92
+ }
93
+ }
@@ -3,7 +3,6 @@ import { NormalizedSchema } from './normalized-schema';
3
3
  export declare function getWebpackBuildConfig(tree: Tree, project: ProjectConfiguration, options: NormalizedSchema): TargetConfiguration;
4
4
  export declare function getEsBuildConfig(tree: Tree, project: ProjectConfiguration, options: NormalizedSchema): TargetConfiguration;
5
5
  export declare function getServeConfig(options: NormalizedSchema): TargetConfiguration;
6
- export declare function getNestWebpackBuildConfig(project: ProjectConfiguration): TargetConfiguration;
7
6
  export declare function getPruneTargets(buildTarget: string, outputPath: string): {
8
7
  prune: TargetConfiguration;
9
8
  'prune-lockfile': TargetConfiguration;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWebpackBuildConfig = getWebpackBuildConfig;
4
4
  exports.getEsBuildConfig = getEsBuildConfig;
5
5
  exports.getServeConfig = getServeConfig;
6
- exports.getNestWebpackBuildConfig = getNestWebpackBuildConfig;
7
6
  exports.getPruneTargets = getPruneTargets;
8
7
  const devkit_1 = require("@nx/devkit");
9
8
  const internal_1 = require("@nx/js/internal");
@@ -93,32 +92,47 @@ function getServeConfig(options) {
93
92
  },
94
93
  };
95
94
  }
96
- function getNestWebpackBuildConfig(project) {
97
- return {
98
- executor: 'nx:run-commands',
99
- options: {
100
- command: 'webpack-cli build',
101
- env: { NODE_ENV: 'production' },
102
- cwd: project.root,
103
- },
104
- configurations: {
105
- development: {
106
- env: { NODE_ENV: 'development' },
107
- },
108
- },
109
- };
110
- }
111
95
  function getPruneTargets(buildTarget, outputPath) {
112
- const lockFileName = (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)() ?? 'npm') ?? 'package-lock.json';
96
+ const packageManager = (0, devkit_1.detectPackageManager)() ?? 'npm';
97
+ const lockFileName = (0, js_1.getLockFileName)(packageManager) ?? 'package-lock.json';
98
+ const pruneLockfileOutputs = [
99
+ `{workspaceRoot}/${(0, devkit_1.joinPathFragments)(outputPath, 'package.json')}`,
100
+ `{workspaceRoot}/${(0, devkit_1.joinPathFragments)(outputPath, lockFileName)}`,
101
+ ];
102
+ let pruneLockfileInputs;
103
+ if (packageManager === 'pnpm') {
104
+ // Beside the pruned lockfile the executor emits a settings-only
105
+ // pnpm-workspace.yaml, a `pnpm patch` workspace emits the referenced `.patch`
106
+ // files under `patches/`, and any non-workspace local-path deps (`file:`
107
+ // tarballs/dirs, `link:` targets) ship under `local_path_modules/`; declare
108
+ // all three so a cache replay restores them and native build-script
109
+ // approvals, patches, or vendored dependencies are not silently dropped.
110
+ // The last two are declared for any pnpm since the generator can't know
111
+ // whether the workspace uses them; Nx tolerates absent outputs.
112
+ pruneLockfileOutputs.push(`{workspaceRoot}/${(0, devkit_1.joinPathFragments)(outputPath, 'pnpm-workspace.yaml')}`, `{workspaceRoot}/${(0, devkit_1.joinPathFragments)(outputPath, 'patches')}`, `{workspaceRoot}/${(0, devkit_1.joinPathFragments)(outputPath, 'local_path_modules')}`);
113
+ // The build approvals and `supportedArchitectures` those artifacts carry are
114
+ // recorded nowhere in the lockfile, so without the root files in the hash a
115
+ // revoked approval replays the previous artifact, and the ambient pnpm
116
+ // major (probed at hash time) decides which emitted file carries them.
117
+ // `default` and `^default` keep what an undeclared `inputs` would have
118
+ // hashed. Deliberately coarser than the settings-narrowed json input the
119
+ // bundler build targets use: over-invalidating this small, rarely-run task
120
+ // costs nothing.
121
+ pruneLockfileInputs = [
122
+ 'default',
123
+ '^default',
124
+ `{workspaceRoot}/pnpm-workspace.yaml`,
125
+ `{workspaceRoot}/package.json`,
126
+ internal_1.PNPM_MAJOR_RUNTIME_INPUT,
127
+ ];
128
+ }
113
129
  return {
114
130
  'prune-lockfile': {
115
131
  dependsOn: ['build'],
116
132
  cache: true,
117
133
  executor: '@nx/js:prune-lockfile',
118
- outputs: [
119
- `{workspaceRoot}/${(0, devkit_1.joinPathFragments)(outputPath, 'package.json')}`,
120
- `{workspaceRoot}/${(0, devkit_1.joinPathFragments)(outputPath, lockFileName)}`,
121
- ],
134
+ ...(pruneLockfileInputs ? { inputs: pruneLockfileInputs } : {}),
135
+ outputs: pruneLockfileOutputs,
122
136
  options: {
123
137
  buildTarget,
124
138
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/node",
3
- "version": "23.2.0-pr.36527.2252709",
3
+ "version": "23.2.0-pr.36866.449f6f3",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -73,16 +73,16 @@
73
73
  "semver": "^7.6.3",
74
74
  "tcp-port-used": "^1.0.2",
75
75
  "kill-port": "^1.6.1",
76
- "@nx/devkit": "23.2.0-pr.36527.2252709",
77
- "@nx/jest": "23.2.0-pr.36527.2252709",
78
- "@nx/js": "23.2.0-pr.36527.2252709",
79
- "@nx/eslint": "23.2.0-pr.36527.2252709",
80
- "@nx/docker": "23.2.0-pr.36527.2252709"
76
+ "@nx/devkit": "23.2.0-pr.36866.449f6f3",
77
+ "@nx/jest": "23.2.0-pr.36866.449f6f3",
78
+ "@nx/js": "23.2.0-pr.36866.449f6f3",
79
+ "@nx/eslint": "23.2.0-pr.36866.449f6f3",
80
+ "@nx/docker": "23.2.0-pr.36866.449f6f3"
81
81
  },
82
82
  "devDependencies": {
83
- "nx": "23.2.0-pr.36527.2252709",
84
- "@nx/webpack": "23.2.0-pr.36527.2252709",
85
- "@nx/vitest": "23.2.0-pr.36527.2252709"
83
+ "nx": "23.2.0-pr.36866.449f6f3",
84
+ "@nx/webpack": "23.2.0-pr.36866.449f6f3",
85
+ "@nx/vitest": "23.2.0-pr.36866.449f6f3"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "express": ">=4.0.0 <6.0.0",