@ohos-ports/nx 23.2.0-beta.4 → 23.2.1-beta.1

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 (56) hide show
  1. package/dist/bin/nx.js +7 -7
  2. package/dist/bin/post-install.js +2 -4
  3. package/dist/release/changelog-renderer/index.d.ts +4 -0
  4. package/dist/release/changelog-renderer/index.js +17 -1
  5. package/dist/src/command-line/add/add.js +1 -1
  6. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +1 -1
  7. package/dist/src/command-line/init/init-v2.js +1 -1
  8. package/dist/src/command-line/migrate/migrate.js +9 -9
  9. package/dist/src/command-line/migrate/prompt-files.js +2 -9
  10. package/dist/src/command-line/migrate/run/worker.js +1 -1
  11. package/dist/src/command-line/release/changelog.js +3 -1
  12. package/dist/src/command-line/repair/repair.js +1 -1
  13. package/dist/src/command-line/report/report.d.ts +2 -0
  14. package/dist/src/command-line/report/report.js +29 -2
  15. package/dist/src/command-line/reset/reset.js +1 -3
  16. package/dist/src/command-line/run/run.js +1 -1
  17. package/dist/src/config/nx-json.d.ts +2 -2
  18. package/dist/src/daemon/client/daemon-environment.d.ts +10 -0
  19. package/dist/src/daemon/client/daemon-environment.js +44 -0
  20. package/dist/src/daemon/server/handle-client-env.js +24 -3
  21. package/dist/src/daemon/server/handle-configure-ai-agents.js +2 -2
  22. package/dist/src/daemon/server/nx-console-operations.js +2 -2
  23. package/dist/src/daemon/server/shutdown-utils.js +1 -1
  24. package/dist/src/native/assert-supported-platform.js +1 -2
  25. package/dist/src/native/index.js +2 -6
  26. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  27. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  28. package/dist/src/nx-cloud/update-manager.js +4 -3
  29. package/dist/src/plugins/js/lock-file/pruned-output.d.ts +10 -9
  30. package/dist/src/plugins/js/lock-file/pruned-output.js +37 -13
  31. package/dist/src/project-graph/plugins/in-process-loader.js +0 -9
  32. package/dist/src/project-graph/plugins/isolation/enabled.js +1 -8
  33. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +16 -0
  34. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +59 -22
  35. package/dist/src/tasks-runner/forked-process-task-runner.d.ts +3 -0
  36. package/dist/src/tasks-runner/forked-process-task-runner.js +15 -6
  37. package/dist/src/tasks-runner/init-tasks-runner.js +32 -2
  38. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +16 -11
  39. package/dist/src/tasks-runner/running-tasks/batch-process.js +3 -0
  40. package/dist/src/tasks-runner/running-tasks/shared-running-task.d.ts +1 -0
  41. package/dist/src/tasks-runner/running-tasks/shared-running-task.js +12 -1
  42. package/dist/src/tasks-runner/task-orchestrator.d.ts +3 -0
  43. package/dist/src/tasks-runner/task-orchestrator.js +31 -3
  44. package/dist/src/utils/installed-nx-version.js +1 -3
  45. package/dist/src/utils/min-release-age/behavior/pnpm.js +17 -9
  46. package/dist/src/utils/nx-package-group.js +1 -1
  47. package/dist/src/utils/owned-private-dir.js +4 -6
  48. package/dist/src/utils/package-json.js +13 -13
  49. package/dist/src/utils/params.js +1 -1
  50. package/dist/src/utils/path.d.ts +6 -0
  51. package/dist/src/utils/path.js +15 -0
  52. package/dist/src/utils/provenance.js +1 -1
  53. package/dist/src/utils/versions.js +1 -1
  54. package/dist/src/utils/workspace-root.js +1 -4
  55. package/package.json +20 -21
  56. package/dist/src/native/nx.openharmony-arm64.node +0 -0
@@ -9,6 +9,14 @@ const errors_1 = require("../errors");
9
9
  const pick_1 = require("../pick");
10
10
  // Ordered newest-bound-first so the first matching row applies.
11
11
  const PNPM_BEHAVIOR_ROWS = [
12
+ {
13
+ minVersion: '12.0.0',
14
+ major: 12,
15
+ strictMode: 'default-loose',
16
+ strictAutoOnWhenExplicit: true,
17
+ excludeGrammar: 'v2-globs-unions',
18
+ writesExcludes: true,
19
+ },
12
20
  {
13
21
  minVersion: '11.1.3',
14
22
  major: 11,
@@ -134,7 +142,7 @@ function toBoolean(value) {
134
142
  async function readPnpmPolicy(root, pmVersion) {
135
143
  // A pnpm major newer than the table knows can behave differently; defer to a
136
144
  // real install rather than guessing.
137
- if ((0, semver_1.gte)(pmVersion, '12.0.0')) {
145
+ if ((0, semver_1.gte)(pmVersion, '13.0.0')) {
138
146
  return {
139
147
  outcome: 'ambiguous',
140
148
  reason: `pnpm ${pmVersion} is newer than the known cooldown behavior table.`,
@@ -155,15 +163,15 @@ async function readPnpmPolicy(root, pmVersion) {
155
163
  }
156
164
  const { windowMinutes: explicitWindow, excludes, strictExplicit, ignoreMissingTimeExplicit, } = parseCooldownConfig(config);
157
165
  // An explicitly configured window (from whatever surface pnpm honors) wins;
158
- // otherwise v11 falls back to its built-in 1440-minute (1 day) default, while
159
- // v10 has no default (no cooldown).
166
+ // otherwise v11 and v12 fall back to the built-in 1440-minute (1 day) default,
167
+ // while v10 has no default (no cooldown).
160
168
  let windowMinutes;
161
169
  let windowExplicit;
162
170
  if (explicitWindow !== undefined) {
163
171
  windowMinutes = explicitWindow;
164
172
  windowExplicit = true;
165
173
  }
166
- else if (row.major === 11) {
174
+ else if (row.major >= 11) {
167
175
  windowMinutes = 1440;
168
176
  windowExplicit = false;
169
177
  }
@@ -178,14 +186,14 @@ async function readPnpmPolicy(root, pmVersion) {
178
186
  const cutoffMs = Date.now() - windowMs;
179
187
  const sourceDescription = `pnpm minimumReleaseAge (${windowMinutes} min)`;
180
188
  const strict = resolveStrict(row, strictExplicit, windowExplicit);
181
- // v10 always errors on missing time; v11 defaults to skip unless a surface
182
- // explicitly disabled it.
183
- const ignoreMissingTime = row.major === 11 ? (ignoreMissingTimeExplicit ?? true) : false;
189
+ // v10 always errors on missing time; v11 and above default to skip unless a
190
+ // surface explicitly disabled it.
191
+ const ignoreMissingTime = row.major >= 11 ? (ignoreMissingTimeExplicit ?? true) : false;
184
192
  const behavior = {
185
193
  packageManager: 'pnpm',
186
194
  strict,
187
- // Loose fallback only exists on v11 when strict is off.
188
- looseFallback: row.major === 11 && !strict,
195
+ // Loose fallback only exists from v11 onwards when strict is off.
196
+ looseFallback: row.major >= 11 && !strict,
189
197
  writesExcludes: row.writesExcludes,
190
198
  missingTimeMap: row.major === 10 ? 'error' : ignoreMissingTime ? 'skip' : 'error',
191
199
  };
@@ -10,6 +10,6 @@ const fileutils_1 = require("./fileutils");
10
10
  * the package group — no hand-maintained list.
11
11
  */
12
12
  function readNxPackageGroup() {
13
- const nxPkg = (0, fileutils_1.readJsonFile)(require.resolve('@ohos-ports/nx/package.json'));
13
+ const nxPkg = (0, fileutils_1.readJsonFile)(require.resolve('nx/package.json'));
14
14
  return (nxPkg['nx-migrations']?.packageGroup ?? []).map((e) => typeof e === 'string' ? e : e.package);
15
15
  }
@@ -190,9 +190,8 @@ function isSafeSharedRoot(dir) {
190
190
  if (!stats.isDirectory()) {
191
191
  return deny(notADirectory(dir, stats));
192
192
  }
193
- if (process.platform === 'win32' || process.platform === 'openharmony') {
194
- // Windows: the OS temp root is already scoped to the current user.
195
- // HarmonyOS: file_manager service remaps uid, so ownership checks are unreliable.
193
+ if (process.platform === 'win32') {
194
+ // The OS temp root is already scoped to the current Windows user.
196
195
  return allow(dir);
197
196
  }
198
197
  if (typeof process.getuid === 'function' &&
@@ -283,8 +282,7 @@ function isOwnedRealDirectory(dir) {
283
282
  return null;
284
283
  }
285
284
  return typeof process.getuid !== 'function' ||
286
- stats.uid === process.getuid() ||
287
- process.platform === 'openharmony'
285
+ stats.uid === process.getuid()
288
286
  ? dir
289
287
  : null;
290
288
  }
@@ -342,7 +340,7 @@ function ensureOwnedPrivateDir(dir) {
342
340
  // Windows: the roots there are per-user OS temp dirs, not a shared /tmp.
343
341
  return allow(dir);
344
342
  }
345
- if (stats.uid !== process.getuid() && process.platform !== 'openharmony') {
343
+ if (stats.uid !== process.getuid()) {
346
344
  return deny({ kind: 'foreign-owner', dir, uid: stats.uid });
347
345
  }
348
346
  if (stats.mode & 0o077) {
@@ -23,6 +23,7 @@ const target_merging_1 = require("../project-graph/utils/project-configuration/t
23
23
  const catalog_1 = require("./catalog");
24
24
  const fileutils_1 = require("./fileutils");
25
25
  const has_nx_js_plugin_1 = require("./has-nx-js-plugin");
26
+ const path_2 = require("./path");
26
27
  const installation_directory_1 = require("./installation-directory");
27
28
  const package_manager_1 = require("./package-manager");
28
29
  const workspace_root_1 = require("./workspace-root");
@@ -35,15 +36,25 @@ function normalizePackageGroup(packageGroup) {
35
36
  }));
36
37
  }
37
38
  function readNxMigrateConfig(json) {
39
+ // Registry fetching uses this value to build a temporary extraction path.
40
+ // Reject unsupported absolute paths and escaping parent traversal before extraction.
41
+ const assertContained = (migrations) => {
42
+ if (!(0, path_2.isContainedRelativePath)(migrations)) {
43
+ throw new Error(`Invalid migrations path "${migrations}" in package "${json.name ?? 'unknown'}@${json.version ?? 'unknown'}": migration paths must not be absolute or escape their base directory through parent traversal.`);
44
+ }
45
+ return migrations;
46
+ };
38
47
  const parseNxMigrationsConfig = (fromJson) => {
39
48
  if (!fromJson) {
40
49
  return {};
41
50
  }
42
51
  if (typeof fromJson === 'string') {
43
- return { migrations: fromJson, packageGroup: [] };
52
+ return { migrations: assertContained(fromJson), packageGroup: [] };
44
53
  }
45
54
  return {
46
- ...(fromJson.migrations ? { migrations: fromJson.migrations } : {}),
55
+ ...(fromJson.migrations
56
+ ? { migrations: assertContained(fromJson.migrations) }
57
+ : {}),
47
58
  ...(fromJson.packageGroup
48
59
  ? { packageGroup: normalizePackageGroup(fromJson.packageGroup) }
49
60
  : {}),
@@ -158,13 +169,6 @@ function readTargetsFromPackageJson(packageJson, nxJson, projectRoot, workspaceR
158
169
  * @returns package json contents and path
159
170
  */
160
171
  function readModulePackageJsonWithoutFallbacks(moduleSpecifier, requirePaths = (0, installation_directory_1.getNxRequirePaths)()) {
161
- // @ohos-ports/nx port: a bare `nx` specifier here refers to the nx package
162
- // itself. When installed as `@ohos-ports/nx` without a `node_modules/nx`
163
- // alias, map it to the real package name so Node's package self-reference
164
- // (via "exports") resolves it to this package itself.
165
- if (moduleSpecifier === 'nx') {
166
- moduleSpecifier = '@ohos-ports/nx';
167
- }
168
172
  const packageJsonPath = require.resolve(`${moduleSpecifier}/package.json`, {
169
173
  paths: requirePaths,
170
174
  });
@@ -189,10 +193,6 @@ function readModulePackageJsonWithoutFallbacks(moduleSpecifier, requirePaths = (
189
193
  * @returns package json contents and path
190
194
  */
191
195
  function readModulePackageJson(moduleSpecifier, requirePaths = (0, installation_directory_1.getNxRequirePaths)()) {
192
- // @ohos-ports/nx port: see readModulePackageJsonWithoutFallbacks above.
193
- if (moduleSpecifier === 'nx') {
194
- moduleSpecifier = '@ohos-ports/nx';
195
- }
196
196
  let packageJsonPath;
197
197
  let packageJson;
198
198
  try {
@@ -443,7 +443,7 @@ function applyVerbosity(options, schema, isVerbose) {
443
443
  }
444
444
  function combineOptionsForExecutor(commandLineOpts, config, target, schema, defaultProjectName, relativeCwd, isVerbose = false) {
445
445
  const r = convertAliases(coerceTypesInOptions(convertToCamelCase(commandLineOpts, schema), schema), schema, false);
446
- let combined = target.options || {};
446
+ let combined = { ...target.options };
447
447
  if (config && target.configurations && target.configurations[config]) {
448
448
  Object.assign(combined, target.configurations[config]);
449
449
  }
@@ -8,6 +8,12 @@ export declare function normalizePath(osSpecificPath: string): string;
8
8
  * This should not be used to read files on disk because of the removal of Windows drive letters.
9
9
  */
10
10
  export declare function joinPathFragments(...fragments: string[]): string;
11
+ /**
12
+ * True when `relativePath` stays inside the directory it is resolved against.
13
+ * Absolute paths are rejected because `path.join` silently treats them as
14
+ * relative, so they would otherwise slip past a `..` check.
15
+ */
16
+ export declare function isContainedRelativePath(relativePath: string): boolean;
11
17
  /**
12
18
  * When running a script with the package manager (e.g. `npm run`), the package manager will
13
19
  * traverse the directory tree upwards until it finds a `package.json` and will set `process.cwd()`
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizePath = normalizePath;
4
4
  exports.joinPathFragments = joinPathFragments;
5
+ exports.isContainedRelativePath = isContainedRelativePath;
5
6
  exports.getCwd = getCwd;
6
7
  const tslib_1 = require("tslib");
7
8
  const path = tslib_1.__importStar(require("path"));
@@ -23,6 +24,20 @@ function normalizePath(osSpecificPath) {
23
24
  function joinPathFragments(...fragments) {
24
25
  return normalizePath(path.join(...fragments));
25
26
  }
27
+ /**
28
+ * True when `relativePath` stays inside the directory it is resolved against.
29
+ * Absolute paths are rejected because `path.join` silently treats them as
30
+ * relative, so they would otherwise slip past a `..` check.
31
+ */
32
+ function isContainedRelativePath(relativePath) {
33
+ if (path.isAbsolute(relativePath)) {
34
+ return false;
35
+ }
36
+ const normalized = path.normalize(relativePath);
37
+ return !(normalized === '..' ||
38
+ normalized.startsWith(`..${path.sep}`) ||
39
+ normalized.startsWith(`..${path.posix.sep}`));
40
+ }
26
41
  /**
27
42
  * When running a script with the package manager (e.g. `npm run`), the package manager will
28
43
  * traverse the directory tree upwards until it finds a `package.json` and will set `process.cwd()`
@@ -96,7 +96,7 @@ class ProvenanceError extends Error {
96
96
  }
97
97
  exports.ProvenanceError = ProvenanceError;
98
98
  function getNxPackageGroup() {
99
- const packageJsonPath = (0, module_1.createRequire)(__filename).resolve('@ohos-ports/nx/package.json');
99
+ const packageJsonPath = (0, module_1.createRequire)(__filename).resolve('nx/package.json');
100
100
  const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
101
101
  if (!packageJson['nx-migrations']?.packageGroup) {
102
102
  return ['nx'];
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nxVersion = void 0;
4
- exports.nxVersion = require('@ohos-ports/nx/package.json').version;
4
+ exports.nxVersion = require('nx/package.json').version;
@@ -31,10 +31,7 @@ function workspaceRootInner(dir, candidateRoot) {
31
31
  // e.g. packages/my-lib/package.json contains @nx/devkit, which references Nx and is
32
32
  // thus located in //packages/my-lib/node_modules/nx/package.json
33
33
  }
34
- else if ((0, fileutils_1.fileExists)(path.join(dir, 'node_modules', 'nx', 'package.json')) ||
35
- // @ohos-ports/nx port: the workspace's nx dependency may be installed
36
- // under the ported package name without a `node_modules/nx` alias.
37
- (0, fileutils_1.fileExists)(path.join(dir, 'node_modules', '@ohos-ports', 'nx', 'package.json'))) {
34
+ else if ((0, fileutils_1.fileExists)(path.join(dir, 'node_modules', 'nx', 'package.json'))) {
38
35
  return workspaceRootInner(path.dirname(dir), dir);
39
36
  }
40
37
  else {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@ohos-ports/nx",
3
- "version": "23.2.0-beta.4",
3
+ "version": "23.2.1-beta.1",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/ohos-ports/ohos-ports.git",
10
- "directory": "ports/nx/23.2.0"
10
+ "directory": "ports/nx/23.2.1"
11
11
  },
12
12
  "files": [
13
13
  "dist/bin",
@@ -50,7 +50,7 @@
50
50
  "@clack/core": "1.4.3",
51
51
  "@clack/prompts": "1.7.0",
52
52
  "@emnapi/core": "1.4.5",
53
- "@ohos-ports/emnapi-runtime": "^1.11.2-beta.0",
53
+ "@emnapi/runtime": "1.4.5",
54
54
  "@emnapi/wasi-threads": "1.0.4",
55
55
  "@jest/diff-sequences": "30.0.1",
56
56
  "@napi-rs/wasm-runtime": "0.2.4",
@@ -79,8 +79,8 @@
79
79
  "color-name": "1.1.4",
80
80
  "combined-stream": "1.0.8",
81
81
  "debug": "4.4.3",
82
- "@ohos-ports/default-browser": "^5.5.0-beta.1",
83
- "@ohos-ports/default-browser-id": "^5.0.2-beta.0",
82
+ "default-browser": "5.2.1",
83
+ "default-browser-id": "5.0.0",
84
84
  "defaults": "1.0.4",
85
85
  "define-lazy-prop": "3.0.0",
86
86
  "delayed-stream": "1.0.0",
@@ -173,8 +173,8 @@
173
173
  "yargs-parser": "21.1.1"
174
174
  },
175
175
  "peerDependencies": {
176
- "@ohos-ports/swc-node-register": "^1.12.1-beta.0",
177
- "@ohos-ports/swc-core": "^1.15.43-beta.1"
176
+ "@swc-node/register": "^1.11.1",
177
+ "@swc/core": "^1.15.8"
178
178
  },
179
179
  "peerDependenciesMeta": {
180
180
  "@swc-node/register": {
@@ -185,16 +185,17 @@
185
185
  }
186
186
  },
187
187
  "optionalDependencies": {
188
- "@nx/nx-darwin-arm64": "23.2.0",
189
- "@nx/nx-darwin-x64": "23.2.0",
190
- "@nx/nx-freebsd-x64": "23.2.0",
191
- "@nx/nx-linux-arm-gnueabihf": "23.2.0",
192
- "@nx/nx-linux-arm64-gnu": "23.2.0",
193
- "@nx/nx-linux-arm64-musl": "23.2.0",
194
- "@nx/nx-linux-x64-musl": "23.2.0",
195
- "@nx/nx-win32-arm64-msvc": "23.2.0",
196
- "@nx/nx-win32-x64-msvc": "23.2.0",
197
- "@ohos-ports/nx-nx-linux-x64-gnu": "^23.2.0-beta.0"
188
+ "@nx/nx-darwin-arm64": "23.2.1",
189
+ "@nx/nx-darwin-x64": "23.2.1",
190
+ "@nx/nx-freebsd-x64": "23.2.1",
191
+ "@nx/nx-linux-arm-gnueabihf": "23.2.1",
192
+ "@nx/nx-linux-arm64-gnu": "23.2.1",
193
+ "@nx/nx-linux-arm64-musl": "23.2.1",
194
+ "@nx/nx-linux-x64-gnu": "23.2.1",
195
+ "@nx/nx-linux-x64-musl": "23.2.1",
196
+ "@nx/nx-win32-arm64-msvc": "23.2.1",
197
+ "@nx/nx-win32-x64-msvc": "23.2.1",
198
+ "@nx/nx-openharmony-arm64": "npm:@ohos-ports/nx-openharmony-arm64@23.2.1-beta.0"
198
199
  },
199
200
  "nx-migrations": {
200
201
  "migrations": "./migrations.json",
@@ -541,7 +542,5 @@
541
542
  "default": "./dist/tasks-runners/*.js"
542
543
  }
543
544
  },
544
- "scripts": {
545
- "postinstall": "node -e \"try{require('./dist/bin/post-install')}catch(e){}\""
546
- }
547
- }
545
+ "scripts": {}
546
+ }