@nx/workspace 22.4.3 → 22.4.5

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
@@ -1,7 +1,7 @@
1
1
  <p style="text-align: center;">
2
2
  <picture>
3
3
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
- <img alt="Nx - Smart Repos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
4
+ <img alt="Nx - Smart Monorepos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
5
  </picture>
6
6
  </p>
7
7
 
@@ -20,7 +20,7 @@
20
20
 
21
21
  <hr>
22
22
 
23
- # Nx: Smart Repos · Fast Builds
23
+ # Nx: Smart Monorepos · Fast Builds
24
24
 
25
25
  Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
26
26
 
@@ -62,5 +62,5 @@ npx nx@latest init
62
62
  - [Blog Posts About Nx](https://nx.dev/blog)
63
63
 
64
64
  <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
65
- width="100%" alt="Nx - Smart Repos · Fast Builds"></a></p>
65
+ width="100%" alt="Nx - Smart Monorepos · Fast Builds"></a></p>
66
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "22.4.3",
3
+ "version": "22.4.5",
4
4
  "private": false,
5
5
  "description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@nx/devkit": "22.4.3",
41
+ "@nx/devkit": "22.4.5",
42
42
  "@zkochan/js-yaml": "0.0.7",
43
43
  "chalk": "^4.1.0",
44
44
  "enquirer": "~2.3.6",
@@ -46,10 +46,10 @@
46
46
  "semver": "^7.6.3",
47
47
  "tslib": "^2.3.0",
48
48
  "yargs-parser": "21.1.1",
49
- "nx": "22.4.3"
49
+ "nx": "22.4.5"
50
50
  },
51
51
  "devDependencies": {
52
- "nx": "22.4.3"
52
+ "nx": "22.4.5"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
@@ -1 +1 @@
1
- {"version":3,"file":"get-npm-package-version.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/utils/get-npm-package-version.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,GAAG,IAAI,CA0Bf"}
1
+ {"version":3,"file":"get-npm-package-version.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/utils/get-npm-package-version.ts"],"names":[],"mappings":"AAKA,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,GAAG,IAAI,CAmCf"}
@@ -1,9 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNpmPackageVersion = getNpmPackageVersion;
4
+ // Valid npm package names: optional @scope/ prefix, then URL-safe chars (A-Za-z0-9 . - _ ~)
5
+ // Must not start with . or _ per npm rules. Uppercase allowed for legacy packages.
6
+ const validNpmPackageNameRegex = /^(@[a-zA-Z0-9~-][a-zA-Z0-9._~-]*\/)?[a-zA-Z0-9~-][a-zA-Z0-9._~-]*$/;
4
7
  function getNpmPackageVersion(packageName, packageVersion) {
8
+ if (!validNpmPackageNameRegex.test(packageName)) {
9
+ throw new Error(`Invalid npm package name: "${packageName}". Package names can only contain URL-safe characters (letters, digits, hyphens, dots, underscores, and tildes).`);
10
+ }
5
11
  try {
6
- const version = require('child_process').execSync(`npm view ${packageName}${packageVersion ? '@' + packageVersion : ''} version --json`, {
12
+ const packageSpec = packageVersion
13
+ ? `${packageName}@${packageVersion}`
14
+ : packageName;
15
+ // Use npm.cmd on Windows since execFileSync without a shell can't run .cmd files
16
+ const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
17
+ const version = require('child_process').execFileSync(npmBin, ['view', packageSpec, 'version', '--json'], {
7
18
  stdio: ['pipe', 'pipe', 'ignore'],
8
19
  windowsHide: false,
9
20
  });