nx 21.4.0-canary.20250726-64897b7 → 21.4.0-canary.20250729-c2d0ecf

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 (31) hide show
  1. package/bin/post-install.js +8 -22
  2. package/package.json +11 -11
  3. package/src/command-line/init/implementation/utils.d.ts.map +1 -1
  4. package/src/command-line/init/implementation/utils.js +1 -2
  5. package/src/command-line/nx-cloud/connect/connect-to-nx-cloud.d.ts.map +1 -1
  6. package/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +4 -4
  7. package/src/command-line/nx-cloud/connect/view-logs.d.ts.map +1 -1
  8. package/src/command-line/nx-cloud/connect/view-logs.js +3 -5
  9. package/src/native/nx.wasm32-wasi.wasm +0 -0
  10. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -1
  11. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts.map +1 -1
  12. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +5 -3
  13. package/src/nx-cloud/utilities/onboarding.d.ts.map +1 -1
  14. package/src/nx-cloud/utilities/onboarding.js +1 -1
  15. package/src/nx-cloud/utilities/url-shorten.d.ts +1 -2
  16. package/src/nx-cloud/utilities/url-shorten.d.ts.map +1 -1
  17. package/src/nx-cloud/utilities/url-shorten.js +17 -21
  18. package/src/plugins/js/index.d.ts.map +1 -1
  19. package/src/plugins/js/index.js +10 -16
  20. package/src/plugins/js/lock-file/bun-parser.d.ts +15 -0
  21. package/src/plugins/js/lock-file/bun-parser.d.ts.map +1 -0
  22. package/src/plugins/js/lock-file/bun-parser.js +964 -0
  23. package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
  24. package/src/plugins/js/lock-file/lock-file.d.ts.map +1 -1
  25. package/src/plugins/js/lock-file/lock-file.js +40 -17
  26. package/src/utils/ab-testing.d.ts +1 -1
  27. package/src/utils/ab-testing.d.ts.map +1 -1
  28. package/src/utils/ab-testing.js +1 -1
  29. package/src/utils/git-utils.d.ts +6 -6
  30. package/src/utils/git-utils.d.ts.map +1 -1
  31. package/src/utils/git-utils.js +75 -50
@@ -2,11 +2,11 @@
2
2
  * This is the main API for accessing the lock file functionality.
3
3
  * It encapsulates the package manager specific logic and implementation details.
4
4
  */
5
- import { PackageManager } from '../../../utils/package-manager';
6
5
  import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
6
+ import { CreateDependenciesContext, CreateNodesContext } from '../../../project-graph/plugins';
7
7
  import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
8
8
  import { PackageJson } from '../../../utils/package-json';
9
- import { CreateDependenciesContext, CreateNodesContext } from '../../../project-graph/plugins';
9
+ import { PackageManager } from '../../../utils/package-manager';
10
10
  export declare const LOCKFILES: string[];
11
11
  /**
12
12
  * Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
@@ -1 +1 @@
1
- {"version":3,"file":"lock-file.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/lock-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAEL,cAAc,EACf,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAqB1D,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAOxC,eAAO,MAAM,SAAS,UAMrB,CAAC;AAQF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CA6B1C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,EAAE,CAyB7B;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAgBtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CActE;AAED,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAuBtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,YAAY,EACnB,cAAc,GAAE,cAAoD,GACnE,MAAM,CA8CR"}
1
+ {"version":3,"file":"lock-file.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/lock-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,cAAc,EACf,MAAM,gCAAgC,CAAC;AA8BxC,eAAO,MAAM,SAAS,UAMrB,CAAC;AAQF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAqC1C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,EAAE,CA8B7B;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAgBtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBtE;AAED,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAgCtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,YAAY,EACnB,cAAc,GAAE,cAAoD,GACnE,MAAM,CA8CR"}
@@ -15,32 +15,31 @@ const node_child_process_1 = require("node:child_process");
15
15
  const node_fs_1 = require("node:fs");
16
16
  const node_path_1 = require("node:path");
17
17
  const semver_1 = require("semver");
18
+ const fileutils_1 = require("../../../utils/fileutils");
19
+ const output_1 = require("../../../utils/output");
18
20
  const package_manager_1 = require("../../../utils/package-manager");
19
21
  const workspace_root_1 = require("../../../utils/workspace-root");
20
- const output_1 = require("../../../utils/output");
22
+ const bun_parser_1 = require("./bun-parser");
21
23
  const npm_parser_1 = require("./npm-parser");
22
24
  const pnpm_parser_1 = require("./pnpm-parser");
23
- const yarn_parser_1 = require("./yarn-parser");
24
25
  const project_graph_pruning_1 = require("./project-graph-pruning");
25
26
  const package_json_1 = require("./utils/package-json");
26
- const fileutils_1 = require("../../../utils/fileutils");
27
+ const yarn_parser_1 = require("./yarn-parser");
27
28
  const YARN_LOCK_FILE = 'yarn.lock';
28
29
  const NPM_LOCK_FILE = 'package-lock.json';
29
30
  const PNPM_LOCK_FILE = 'pnpm-lock.yaml';
30
- const BUN_LOCK_FILE = 'bun.lockb';
31
- const BUN_TEXT_LOCK_FILE = 'bun.lock';
32
31
  exports.LOCKFILES = [
33
32
  YARN_LOCK_FILE,
34
33
  NPM_LOCK_FILE,
35
34
  PNPM_LOCK_FILE,
36
- BUN_LOCK_FILE,
37
- BUN_TEXT_LOCK_FILE,
35
+ bun_parser_1.BUN_LOCK_FILE,
36
+ bun_parser_1.BUN_TEXT_LOCK_FILE,
38
37
  ];
39
38
  const YARN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, YARN_LOCK_FILE);
40
39
  const NPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, NPM_LOCK_FILE);
41
40
  const PNPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, PNPM_LOCK_FILE);
42
- const BUN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, BUN_LOCK_FILE);
43
- const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, BUN_TEXT_LOCK_FILE);
41
+ const BUN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, bun_parser_1.BUN_LOCK_FILE);
42
+ const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, bun_parser_1.BUN_TEXT_LOCK_FILE);
44
43
  /**
45
44
  * Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
46
45
  */
@@ -57,9 +56,16 @@ function getLockFileNodes(packageManager, contents, lockFileHash, context) {
57
56
  return (0, npm_parser_1.getNpmLockfileNodes)(contents, lockFileHash);
58
57
  }
59
58
  if (packageManager === 'bun') {
60
- // bun uses yarn v1 for the file format
61
- const packageJson = (0, fileutils_1.readJsonFile)('package.json');
62
- return (0, yarn_parser_1.getYarnLockfileNodes)(contents, lockFileHash, packageJson);
59
+ const lockFilePath = getLockFilePath(packageManager);
60
+ if (lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)) {
61
+ // Use new text-based parser
62
+ return (0, bun_parser_1.getBunTextLockfileNodes)(contents, lockFileHash);
63
+ }
64
+ else {
65
+ // Fallback to yarn parser for binary format
66
+ const packageJson = (0, fileutils_1.readJsonFile)((0, node_path_1.join)(context.workspaceRoot, 'package.json'));
67
+ return (0, yarn_parser_1.getYarnLockfileNodes)(contents, lockFileHash, packageJson);
68
+ }
63
69
  }
64
70
  }
65
71
  catch (e) {
@@ -88,8 +94,14 @@ function getLockFileDependencies(packageManager, contents, lockFileHash, context
88
94
  return (0, npm_parser_1.getNpmLockfileDependencies)(contents, lockFileHash, context);
89
95
  }
90
96
  if (packageManager === 'bun') {
91
- // bun uses yarn v1 for the file format
92
- return (0, yarn_parser_1.getYarnLockfileDependencies)(contents, lockFileHash, context);
97
+ const lockFilePath = getLockFilePath(packageManager);
98
+ if (lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)) {
99
+ return (0, bun_parser_1.getBunTextLockfileDependencies)(contents, lockFileHash, context);
100
+ }
101
+ else {
102
+ // Fallback to yarn parser for binary format
103
+ return (0, yarn_parser_1.getYarnLockfileDependencies)(contents, lockFileHash, context);
104
+ }
93
105
  }
94
106
  }
95
107
  catch (e) {
@@ -134,7 +146,10 @@ function getLockFileName(packageManager) {
134
146
  return NPM_LOCK_FILE;
135
147
  }
136
148
  if (packageManager === 'bun') {
137
- return BUN_LOCK_FILE;
149
+ const lockFilePath = getLockFilePath(packageManager);
150
+ return lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)
151
+ ? bun_parser_1.BUN_TEXT_LOCK_FILE
152
+ : bun_parser_1.BUN_LOCK_FILE;
138
153
  }
139
154
  throw new Error(`Unknown package manager: ${packageManager}`);
140
155
  }
@@ -150,10 +165,18 @@ function getLockFilePath(packageManager) {
150
165
  }
151
166
  if (packageManager === 'bun') {
152
167
  try {
168
+ // Check if text format exists first (prefer over binary)
169
+ if ((0, node_fs_1.existsSync)(BUN_TEXT_LOCK_PATH)) {
170
+ return BUN_TEXT_LOCK_PATH;
171
+ }
172
+ // Fall back to binary format
173
+ if ((0, node_fs_1.existsSync)(BUN_LOCK_PATH)) {
174
+ return BUN_LOCK_PATH;
175
+ }
153
176
  const bunVersion = (0, node_child_process_1.execSync)('bun --version').toString().trim();
154
- // In version 1.2.0, bun switched to a text based lockfile format by default
177
+ // Version-based fallback
155
178
  if ((0, semver_1.gte)(bunVersion, '1.2.0')) {
156
- return BUN_TEXT_LOCK_FILE;
179
+ return BUN_TEXT_LOCK_PATH;
157
180
  }
158
181
  return BUN_LOCK_PATH;
159
182
  }
@@ -26,7 +26,7 @@ declare const messageOptions: {
26
26
  readonly value: "skip";
27
27
  readonly name: "No";
28
28
  }];
29
- readonly footer: "\nRead more about remote cache at https://nx.dev/ci/features/remote-cache";
29
+ readonly footer: "\nRead more about Nx Cloud at https://nx.dev/nx-cloud";
30
30
  readonly hint: "\n(it's free and can be disabled any time)";
31
31
  }];
32
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/ab-testing.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9C,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCV,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,qBAAa,cAAc;IACzB,OAAO,CAAC,gBAAgB,CAAM;IAE9B,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,WAAW;IAavC,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAIjD;AAED,eAAO,MAAM,QAAQ,gBAAuB,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,iBAsBA"}
1
+ {"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/ab-testing.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9C,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BV,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,qBAAa,cAAc;IACzB,OAAO,CAAC,gBAAgB,CAAM;IAE9B,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,WAAW;IAavC,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAIjD;AAED,eAAO,MAAM,QAAQ,gBAAuB,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,iBAsBA"}
@@ -33,7 +33,7 @@ const messageOptions = {
33
33
  },
34
34
  { value: 'skip', name: 'No' },
35
35
  ],
36
- footer: '\nRead more about remote cache at https://nx.dev/ci/features/remote-cache',
36
+ footer: '\nRead more about Nx Cloud at https://nx.dev/nx-cloud',
37
37
  hint: `\n(it's free and can be disabled any time)`,
38
38
  },
39
39
  ],
@@ -32,12 +32,12 @@ export declare class GitRepository {
32
32
  private quotePath;
33
33
  private quoteArg;
34
34
  }
35
- export declare function getGitRemote(): string;
36
- /**
37
- * This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
38
- */
39
- export declare function getGithubSlugOrNull(): string | null;
40
- export declare function extractUserAndRepoFromGitHubUrl(gitRemotes: string): string | null;
35
+ export interface VcsRemoteInfo {
36
+ domain: string;
37
+ slug: string;
38
+ }
39
+ export declare function parseVcsRemoteUrl(url: string): VcsRemoteInfo | null;
40
+ export declare function getVcsRemoteInfo(): VcsRemoteInfo | null;
41
41
  export declare function commitChanges(commitMessage: string, directory?: string): string | null;
42
42
  export declare function getLatestCommitSha(directory?: string): string | null;
43
43
  //# sourceMappingURL=git-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/git-utils.ts"],"names":[],"mappings":"AAeA,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,EAAE,UAAU,EAAE,KAAK,EAAE,GAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAE1D,0BAaF;AAED,qBAAa,aAAa;IAEZ,OAAO,CAAC,SAAS;IADtB,IAAI,SAAuC;gBAC9B,SAAS,EAAE,MAAM;IAErC,cAAc,CAAC,GAAG,EAAE,MAAM;IASpB,qBAAqB;IAKrB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAMjD,QAAQ;IAIR,YAAY;IAYZ,WAAW,CAAC,IAAI,EAAE,MAAM;IAUxB,KAAK,CAAC,GAAG,EAAE,MAAM;IAIjB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAKpD,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAIlC,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;QACJ,GAAG,EAAE,OAAO,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd;IASG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAMtC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAIpC,MAAM,CAAC,OAAO,EAAE,MAAM;IAGtB,WAAW;IAIX,eAAe,CAAC,IAAI,EAAE,MAAM;IAI5B,YAAY,CAAC,IAAI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
3
3
  exports.GitRepository = void 0;
4
4
  exports.cloneFromUpstream = cloneFromUpstream;
5
- exports.getGitRemote = getGitRemote;
6
- exports.getGithubSlugOrNull = getGithubSlugOrNull;
7
- exports.extractUserAndRepoFromGitHubUrl = extractUserAndRepoFromGitHubUrl;
5
+ exports.parseVcsRemoteUrl = parseVcsRemoteUrl;
6
+ exports.getVcsRemoteInfo = getVcsRemoteInfo;
8
7
  exports.commitChanges = commitChanges;
9
8
  exports.getLatestCommitSha = getLatestCommitSha;
10
9
  const child_process_1 = require("child_process");
@@ -171,61 +170,87 @@ class GitRepository {
171
170
  }
172
171
  }
173
172
  exports.GitRepository = GitRepository;
174
- function getGitRemote() {
175
- const res = (0, child_process_1.execSync)('git remote -v', {
176
- stdio: 'pipe',
177
- windowsHide: false,
178
- })
179
- .toString()
180
- .trim();
181
- return res;
173
+ function parseVcsRemoteUrl(url) {
174
+ // Remove whitespace and handle common URL formats
175
+ const cleanUrl = url.trim();
176
+ // SSH format: git@domain:owner/repo.git
177
+ const sshMatch = cleanUrl.match(/^git@([^:]+):([^\/]+)\/(.+?)(\.git)?$/);
178
+ if (sshMatch) {
179
+ const [, domain, owner, repo] = sshMatch;
180
+ return {
181
+ domain,
182
+ slug: `${owner}/${repo}`,
183
+ };
184
+ }
185
+ // HTTPS with authentication: https://user@domain/owner/repo.git
186
+ const httpsAuthMatch = cleanUrl.match(/^https?:\/\/[^@]+@([^\/]+)\/([^\/]+)\/(.+?)(\.git)?$/);
187
+ if (httpsAuthMatch) {
188
+ const [, domain, owner, repo] = httpsAuthMatch;
189
+ return {
190
+ domain,
191
+ slug: `${owner}/${repo}`,
192
+ };
193
+ }
194
+ // HTTPS format: https://domain/owner/repo.git (without authentication)
195
+ const httpsMatch = cleanUrl.match(/^https?:\/\/([^@\/]+)\/([^\/]+)\/(.+?)(\.git)?$/);
196
+ if (httpsMatch) {
197
+ const [, domain, owner, repo] = httpsMatch;
198
+ return {
199
+ domain,
200
+ slug: `${owner}/${repo}`,
201
+ };
202
+ }
203
+ // SSH alternative format: ssh://git@domain/owner/repo.git or ssh://git@domain:port/owner/repo.git
204
+ const sshAltMatch = cleanUrl.match(/^ssh:\/\/[^@]+@([^:\/]+)(:[0-9]+)?\/([^\/]+)\/(.+?)(\.git)?$/);
205
+ if (sshAltMatch) {
206
+ const [, domain, , owner, repo] = sshAltMatch;
207
+ return {
208
+ domain,
209
+ slug: `${owner}/${repo}`,
210
+ };
211
+ }
212
+ return null;
182
213
  }
183
- /**
184
- * This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
185
- */
186
- function getGithubSlugOrNull() {
214
+ function getVcsRemoteInfo() {
187
215
  try {
188
- const gitRemote = getGitRemote();
189
- // If there are no remotes, we default to github
216
+ const gitRemote = (0, child_process_1.execSync)('git remote -v', {
217
+ stdio: 'pipe',
218
+ windowsHide: false,
219
+ })
220
+ .toString()
221
+ .trim();
190
222
  if (!gitRemote || gitRemote.length === 0) {
191
- return 'github';
223
+ return null;
192
224
  }
193
- return extractUserAndRepoFromGitHubUrl(gitRemote);
194
- }
195
- catch (e) {
196
- // Probably git is not set up, so we default to github
197
- return 'github';
198
- }
199
- }
200
- function extractUserAndRepoFromGitHubUrl(gitRemotes) {
201
- const regex = /^\s*(\w+)\s+(git@github\.com:|https:\/\/github\.com\/)([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/gm;
202
- const remotesPriority = ['origin', 'upstream', 'base'];
203
- const foundRemotes = {};
204
- let firstGitHubUrl = null;
205
- let match;
206
- while ((match = regex.exec(gitRemotes)) !== null) {
207
- const remoteName = match[1];
208
- const url = match[2] + match[3] + '/' + match[4] + '.git';
209
- foundRemotes[remoteName] = url;
210
- if (!firstGitHubUrl) {
211
- firstGitHubUrl = url;
225
+ const lines = gitRemote.split('\n').filter((line) => line.trim());
226
+ const remotesPriority = ['origin', 'upstream', 'base'];
227
+ const foundRemotes = {};
228
+ let firstRemote = null;
229
+ for (const line of lines) {
230
+ const match = line.trim().match(/^(\w+)\s+(\S+)\s+\((fetch|push)\)$/);
231
+ if (match) {
232
+ const [, remoteName, url] = match;
233
+ const remoteInfo = parseVcsRemoteUrl(url);
234
+ if (remoteInfo && !foundRemotes[remoteName]) {
235
+ foundRemotes[remoteName] = remoteInfo;
236
+ if (!firstRemote) {
237
+ firstRemote = remoteInfo;
238
+ }
239
+ }
240
+ }
212
241
  }
213
- }
214
- for (const remote of remotesPriority) {
215
- if (foundRemotes[remote]) {
216
- return parseGitHubUrl(foundRemotes[remote]);
242
+ // Return high-priority remote if found
243
+ for (const remote of remotesPriority) {
244
+ if (foundRemotes[remote]) {
245
+ return foundRemotes[remote];
246
+ }
217
247
  }
248
+ // Return first found remote
249
+ return firstRemote;
218
250
  }
219
- return firstGitHubUrl ? parseGitHubUrl(firstGitHubUrl) : null;
220
- }
221
- function parseGitHubUrl(url) {
222
- const sshPattern = /git@github\.com:([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/;
223
- const httpsPattern = /https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/;
224
- let match = url.match(sshPattern) || url.match(httpsPattern);
225
- if (match) {
226
- return `${match[1]}/${match[2]}`;
251
+ catch (e) {
252
+ return null;
227
253
  }
228
- return null;
229
254
  }
230
255
  function commitChanges(commitMessage, directory) {
231
256
  try {