@ohos-ports/nx 23.2.0-beta.0 → 23.2.0-beta.2

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/dist/bin/nx.js CHANGED
@@ -36,10 +36,10 @@ async function main() {
36
36
  if (process.env.NX_COMPLETE) {
37
37
  try {
38
38
  perf_hooks_1.performance.mark('init-local');
39
- const { tryValueCompletion } = await import('nx/src/command-line/completion/value-completions');
39
+ const { tryValueCompletion } = await import('@ohos-ports/nx/src/command-line/completion/value-completions');
40
40
  if (tryValueCompletion())
41
41
  return;
42
- const { tryCommandSurfaceCompletion } = await import('nx/src/command-line/completion/command-completions');
42
+ const { tryCommandSurfaceCompletion } = await import('@ohos-ports/nx/src/command-line/completion/command-completions');
43
43
  tryCommandSurfaceCompletion();
44
44
  }
45
45
  catch (e) {
@@ -91,7 +91,7 @@ async function main() {
91
91
  // inherited via NX_ANALYTICS_SESSION_ID.
92
92
  await initAnalytics();
93
93
  }
94
- (await import('nx/src/command-line/nx-commands')).commandsObject.argv;
94
+ (await import('@ohos-ports/nx/src/command-line/nx-commands')).commandsObject.argv;
95
95
  }
96
96
  else {
97
97
  // polyfill rxjs observable to avoid issues with multiple version of Observable installed in node_modules
@@ -127,7 +127,7 @@ async function main() {
127
127
  await initAnalytics();
128
128
  // nx-cloud commands can run without local Nx installation
129
129
  process.env.NX_DAEMON = 'false';
130
- (await import('nx/src/command-line/nx-commands')).commandsObject.argv;
130
+ (await import('@ohos-ports/nx/src/command-line/nx-commands')).commandsObject.argv;
131
131
  }
132
132
  else if (isLocalInstall) {
133
133
  const { daemonClient } = await import('../src/daemon/client/client.js');
@@ -198,13 +198,13 @@ function resolveNx(workspace) {
198
198
  const installPath = (0, installation_directory_1.getNxInstallationPath)(root);
199
199
  if ((0, fs_1.existsSync)(installPath)) {
200
200
  const installRequire = (0, module_1.createRequire)((0, path_1.join)(installPath, 'package.json'));
201
- return installRequire.resolve('nx/bin/nx.js');
201
+ return installRequire.resolve('@ohos-ports/nx/bin/nx.js');
202
202
  }
203
203
  }
204
204
  catch { }
205
205
  // check for root install
206
206
  const rootRequire = (0, module_1.createRequire)((0, path_1.join)(root, 'package.json'));
207
- return rootRequire.resolve('nx/bin/nx.js');
207
+ return rootRequire.resolve('@ohos-ports/nx/bin/nx.js');
208
208
  }
209
209
  function isNxCloudCommand(command) {
210
210
  const nxCloudCommands = [
@@ -295,7 +295,7 @@ function getLocalNxVersion(workspace) {
295
295
  }
296
296
  try {
297
297
  const externalRequire = (0, module_1.createRequire)((0, path_1.join)(searchPath, 'package.json'));
298
- const pkgJsonPath = externalRequire.resolve('nx/package.json');
298
+ const pkgJsonPath = externalRequire.resolve('@ohos-ports/nx/package.json');
299
299
  return require(pkgJsonPath).version;
300
300
  }
301
301
  catch { }
@@ -129,7 +129,7 @@ function parsePackageSpecifier(packageSpecifier) {
129
129
  const version = packageSpecifier.substring(i + 1);
130
130
  return [pkgName, version];
131
131
  }
132
- exports.coreNxPluginVersions = require(require.resolve('nx/package.json'))['nx-migrations'].packageGroup.reduce((map, entry) => {
132
+ exports.coreNxPluginVersions = require(require.resolve('@ohos-ports/nx/package.json'))['nx-migrations'].packageGroup.reduce((map, entry) => {
133
133
  const packageName = typeof entry === 'string' ? entry : entry.package;
134
134
  const version = typeof entry === 'string' ? versions_1.nxVersion : entry.version;
135
135
  return map.set(packageName, version);
@@ -47,7 +47,7 @@ async function configureAiAgentsHandler(args, inner = false) {
47
47
  await (0, provenance_1.ensurePackageHasProvenance)('nx', 'latest');
48
48
  const packageInstallResults = (0, package_json_1.installPackageToTmp)('nx', 'latest', (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot));
49
49
  cleanup = packageInstallResults.cleanup;
50
- let modulePath = require.resolve('nx/src/command-line/configure-ai-agents/configure-ai-agents.js', { paths: [packageInstallResults.tempDir] });
50
+ let modulePath = require.resolve('@ohos-ports/nx/src/command-line/configure-ai-agents/configure-ai-agents.js', { paths: [packageInstallResults.tempDir] });
51
51
  const module = await (0, handle_import_1.handleImport)(modulePath);
52
52
  await module.configureAiAgentsHandler(args, true);
53
53
  cleanup();
@@ -48,7 +48,7 @@ async function initHandler(options, inner = false) {
48
48
  await (0, provenance_1.ensurePackageHasProvenance)('nx', 'latest');
49
49
  const packageInstallResults = (0, package_json_1.installPackageToTmp)('nx', 'latest', (0, package_manager_1.detectPackageManager)(process.cwd()));
50
50
  cleanup = packageInstallResults.cleanup;
51
- let modulePath = require.resolve('nx/src/command-line/init/init-v2.js', {
51
+ let modulePath = require.resolve('@ohos-ports/nx/src/command-line/init/init-v2.js', {
52
52
  paths: [packageInstallResults.tempDir],
53
53
  });
54
54
  const module = await (0, handle_import_1.handleImport)(modulePath);
@@ -1061,7 +1061,7 @@ function createInstalledPackageVersionsResolver(root) {
1061
1061
  (() => {
1062
1062
  for (const req of nxRequires) {
1063
1063
  try {
1064
- const packageJsonPath = req.resolve('nx/package.json');
1064
+ const packageJsonPath = req.resolve('@ohos-ports/nx/package.json');
1065
1065
  if (packageJsonPath.startsWith(workspace_root_1.workspaceRoot)) {
1066
1066
  return (0, fileutils_1.readJsonFile)(packageJsonPath).version;
1067
1067
  }
@@ -2472,7 +2472,7 @@ function readLocalNxVersion(root) {
2472
2472
  exports: {},
2473
2473
  };
2474
2474
  new Function('module', 'exports', 'require', '__dirname', '__filename', (0, fs_1.readFileSync)(pnpManifest, 'utf-8').replace(/^#!.*/, ''))(manifestModule, manifestModule.exports, require, root, pnpManifest);
2475
- const packageJsonPath = manifestModule.exports.resolveRequest('nx/package.json', (0, path_1.join)(root, 'package.json'));
2475
+ const packageJsonPath = manifestModule.exports.resolveRequest('@ohos-ports/nx/package.json', (0, path_1.join)(root, 'package.json'));
2476
2476
  if (packageJsonPath) {
2477
2477
  // A resolving manifest names the install the yarn spawn runs, so
2478
2478
  // every branch below returns rather than falling through to the
@@ -6,7 +6,7 @@ const migrate_1 = require("../migrate/migrate");
6
6
  const output_1 = require("../../utils/output");
7
7
  async function repair(args, extraMigrations = []) {
8
8
  return (0, handle_errors_1.handleErrors)(args.verbose, async () => {
9
- const migrationsJson = require(require.resolve('nx/migrations.json'));
9
+ const migrationsJson = require(require.resolve('@ohos-ports/nx/migrations.json'));
10
10
  const nxMigrations = Object.entries(migrationsJson.generators).reduce((agg, [name, migration]) => {
11
11
  const skip = migration['x-repair-skip'];
12
12
  if (!skip) {
@@ -27,7 +27,7 @@ const nx_key_1 = require("../../utils/nx-key");
27
27
  const cache_1 = require("../../tasks-runner/cache");
28
28
  const client_1 = require("../../daemon/client/client");
29
29
  const nx_package_group_1 = require("../../utils/nx-package-group");
30
- const nxPackageJson = (0, fileutils_1.readJsonFile)(require.resolve('nx/package.json'));
30
+ const nxPackageJson = (0, fileutils_1.readJsonFile)(require.resolve('@ohos-ports/nx/package.json'));
31
31
  exports.packagesWeCareAbout = [
32
32
  'lerna',
33
33
  ...(0, nx_package_group_1.readNxPackageGroup)(),
@@ -56,7 +56,7 @@ async function printTargetRunHelpInternal({ project, target }, root, projectsCon
56
56
  plugin: nodeModule,
57
57
  entity: executor,
58
58
  });
59
- if (nodeModule === 'nx' &&
59
+ if ((nodeModule === 'nx' || nodeModule === '@ohos-ports/nx') &&
60
60
  executor === 'run-commands' &&
61
61
  targetConfig.options.command) {
62
62
  const command = targetConfig.options.command.split(' ')[0];
@@ -71,11 +71,11 @@ async function computeAgentStatuses() {
71
71
  let modulePath;
72
72
  if (process.env.NX_USE_LOCAL === 'true') {
73
73
  log('Using local implementation (NX_USE_LOCAL=true)');
74
- modulePath = require.resolve('nx/src/ai/utils.js');
74
+ modulePath = require.resolve('@ohos-ports/nx/src/ai/utils.js');
75
75
  }
76
76
  else {
77
77
  const tmpPath = await (0, latest_nx_1.getLatestNxTmpPath)();
78
- modulePath = require.resolve('nx/src/ai/utils.js', {
78
+ modulePath = require.resolve('@ohos-ports/nx/src/ai/utils.js', {
79
79
  paths: [tmpPath],
80
80
  });
81
81
  }
@@ -26,7 +26,7 @@ async function getNxConsoleStatus({ inner, } = {}) {
26
26
  }
27
27
  try {
28
28
  const tmpPath = await (0, latest_nx_1.getLatestNxTmpPath)();
29
- const modulePath = require.resolve('nx/src/daemon/server/nx-console-operations.js', { paths: [tmpPath] });
29
+ const modulePath = require.resolve('@ohos-ports/nx/src/daemon/server/nx-console-operations.js', { paths: [tmpPath] });
30
30
  const module = await (0, handle_import_1.handleImport)(modulePath);
31
31
  const result = await module.getNxConsoleStatus({ inner: true });
32
32
  log('Console status check completed, shouldPrompt:', result);
@@ -53,7 +53,7 @@ async function handleNxConsolePreferenceAndInstall({ preference, inner, }) {
53
53
  }
54
54
  try {
55
55
  const tmpPath = await (0, latest_nx_1.getLatestNxTmpPath)();
56
- const modulePath = require.resolve('nx/src/daemon/server/nx-console-operations.js', { paths: [tmpPath] });
56
+ const modulePath = require.resolve('@ohos-ports/nx/src/daemon/server/nx-console-operations.js', { paths: [tmpPath] });
57
57
  const module = await (0, handle_import_1.handleImport)(modulePath);
58
58
  const result = await module.handleNxConsolePreferenceAndInstall({
59
59
  preference,
@@ -38,7 +38,7 @@ async function startNewDaemonInBackground() {
38
38
  // Resolve from workspace root to pick up the correct symlink target
39
39
  let startScriptPath;
40
40
  try {
41
- startScriptPath = require.resolve('nx/src/daemon/server/start.js', {
41
+ startScriptPath = require.resolve('@ohos-ports/nx/src/daemon/server/start.js', {
42
42
  paths: [workspace_root_1.workspaceRoot],
43
43
  });
44
44
  }
@@ -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('nx/package.json'));
13
+ const nxPkg = (0, fileutils_1.readJsonFile)(require.resolve('@ohos-ports/nx/package.json'));
14
14
  return (nxPkg['nx-migrations']?.packageGroup ?? []).map((e) => typeof e === 'string' ? e : e.package);
15
15
  }
@@ -190,8 +190,9 @@ function isSafeSharedRoot(dir) {
190
190
  if (!stats.isDirectory()) {
191
191
  return deny(notADirectory(dir, stats));
192
192
  }
193
- if (process.platform === 'win32') {
194
- // The OS temp root is already scoped to the current Windows user.
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.
195
196
  return allow(dir);
196
197
  }
197
198
  if (typeof process.getuid === 'function' &&
@@ -282,7 +283,8 @@ function isOwnedRealDirectory(dir) {
282
283
  return null;
283
284
  }
284
285
  return typeof process.getuid !== 'function' ||
285
- stats.uid === process.getuid()
286
+ stats.uid === process.getuid() ||
287
+ process.platform === 'openharmony'
286
288
  ? dir
287
289
  : null;
288
290
  }
@@ -340,7 +342,7 @@ function ensureOwnedPrivateDir(dir) {
340
342
  // Windows: the roots there are per-user OS temp dirs, not a shared /tmp.
341
343
  return allow(dir);
342
344
  }
343
- if (stats.uid !== process.getuid()) {
345
+ if (stats.uid !== process.getuid() && process.platform !== 'openharmony') {
344
346
  return deny({ kind: 'foreign-owner', dir, uid: stats.uid });
345
347
  }
346
348
  if (stats.mode & 0o077) {
@@ -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('nx/package.json');
99
+ const packageJsonPath = (0, module_1.createRequire)(__filename).resolve('@ohos-ports/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('nx/package.json').version;
4
+ exports.nxVersion = require('@ohos-ports/nx/package.json').version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohos-ports/nx",
3
- "version": "23.2.0-beta.0",
3
+ "version": "23.2.0-beta.2",
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.",
@@ -191,10 +191,10 @@
191
191
  "@nx/nx-linux-arm-gnueabihf": "23.2.0",
192
192
  "@nx/nx-linux-arm64-gnu": "23.2.0",
193
193
  "@nx/nx-linux-arm64-musl": "23.2.0",
194
- "@nx/nx-linux-x64-gnu": "23.2.0",
195
194
  "@nx/nx-linux-x64-musl": "23.2.0",
196
195
  "@nx/nx-win32-arm64-msvc": "23.2.0",
197
- "@nx/nx-win32-x64-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"
198
198
  },
199
199
  "nx-migrations": {
200
200
  "migrations": "./migrations.json",