binary-collections 2.0.7 → 2.0.8

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 (150) hide show
  1. package/bin/dir-tree.cmd +7 -0
  2. package/bin/git-diff +4 -0
  3. package/bin/git-diff.cmd +5 -2
  4. package/bin/{git-fix-encoding → git-fix} +1 -4
  5. package/bin/git-fix.cmd +7 -0
  6. package/bin/nodekill +0 -0
  7. package/bin/nodekill.ps1 +0 -0
  8. package/bin/{submodule → submodule.txt} +0 -0
  9. package/lib/binary-collections-config.cjs +14 -0
  10. package/lib/binary-collections-config.d.mts +18 -0
  11. package/lib/binary-collections-config.d.ts +16 -0
  12. package/lib/binary-collections-config.js +39 -0
  13. package/lib/binary-collections-config.mjs +6 -0
  14. package/lib/binary-collections.cjs +105 -0
  15. package/lib/binary-collections.d.cts +2 -0
  16. package/lib/binary-collections.d.mts +121 -0
  17. package/lib/binary-collections.d.ts +121 -0
  18. package/lib/binary-collections.mjs +108 -0
  19. package/lib/chunk-4BYBVEYC.mjs +30 -0
  20. package/lib/{chunk-FB6YIQYR.mjs → chunk-AASHBCRW.mjs} +17 -2
  21. package/lib/chunk-APBWENF6.mjs +135 -0
  22. package/lib/{chunk-4LEXWIIF.mjs → chunk-DPKAJKFO.mjs} +2 -4
  23. package/lib/chunk-EGSSKVDH.mjs +66 -0
  24. package/lib/{chunk-3LOB2P54.mjs → chunk-G3THLIDT.mjs} +3 -5
  25. package/lib/chunk-JGR2NW6D.mjs +187 -0
  26. package/lib/chunk-ONIBBBQ3.mjs +108 -0
  27. package/lib/chunk-SH3L6HHV.mjs +27 -0
  28. package/lib/chunk-VVEZVNIV.mjs +81 -0
  29. package/lib/{chunk-JL32QDSH.mjs → chunk-W3ENOM53.mjs} +2 -4
  30. package/lib/chunk-YV7DO3YV.mjs +48 -0
  31. package/lib/{chunk-BSD5CIRU.mjs → chunk-YX5U7XDR.mjs} +11 -5
  32. package/lib/chunk-ZYAQRPUL.mjs +28 -0
  33. package/lib/clean-github-actions-caches.cjs +162 -0
  34. package/lib/clean-github-actions-caches.d.cts +1 -0
  35. package/lib/clean-github-actions-caches.d.mts +169 -0
  36. package/lib/clean-github-actions-caches.d.ts +169 -0
  37. package/lib/clean-github-actions-caches.mjs +132 -0
  38. package/lib/del-gradle.cjs +87 -3
  39. package/lib/del-gradle.js +1 -1
  40. package/lib/del-gradle.mjs +4 -6
  41. package/lib/del-node-modules.cjs +86 -2
  42. package/lib/del-node-modules.mjs +3 -5
  43. package/lib/del-ps.cjs +89 -5
  44. package/lib/del-ps.js +2 -2
  45. package/lib/del-ps.mjs +6 -8
  46. package/lib/del-yarn-caches.cjs +86 -2
  47. package/lib/del-yarn-caches.mjs +3 -5
  48. package/lib/find-node-modules-cli.cjs +8 -0
  49. package/lib/find-node-modules-cli.mjs +2 -3
  50. package/lib/find-node-modules.cjs +8 -0
  51. package/lib/find-node-modules.d.mts +3 -0
  52. package/lib/find-node-modules.d.ts +3 -0
  53. package/lib/find-node-modules.js +12 -0
  54. package/lib/find-node-modules.mjs +2 -3
  55. package/lib/git/gitattributes.cjs +171 -0
  56. package/lib/git/gitattributes.d.mts +35 -0
  57. package/lib/git/gitattributes.d.ts +33 -0
  58. package/lib/git/gitattributes.js +223 -0
  59. package/lib/git/gitattributes.mjs +6 -0
  60. package/lib/git/line-endings.cjs +74 -0
  61. package/lib/git/line-endings.d.cts +7 -0
  62. package/lib/git/line-endings.d.mts +83 -0
  63. package/lib/git/line-endings.d.ts +83 -0
  64. package/lib/git/line-endings.mjs +8 -0
  65. package/lib/git/normalize.cjs +42 -0
  66. package/lib/git/normalize.d.cts +6 -0
  67. package/lib/git/normalize.d.mts +43 -0
  68. package/lib/git/normalize.d.ts +43 -0
  69. package/lib/git/normalize.mjs +6 -0
  70. package/lib/git/permissions.cjs +15 -0
  71. package/lib/git/permissions.d.cts +6 -0
  72. package/lib/git/permissions.d.mts +17 -0
  73. package/lib/git/permissions.d.ts +17 -0
  74. package/lib/git/permissions.mjs +7 -0
  75. package/lib/git/pull-strategy.cjs +13 -0
  76. package/lib/git/pull-strategy.d.cts +5 -0
  77. package/lib/git/pull-strategy.d.mts +15 -0
  78. package/lib/git/pull-strategy.d.ts +15 -0
  79. package/lib/git/pull-strategy.mjs +7 -0
  80. package/lib/git/user-config.cjs +100 -0
  81. package/lib/git/user-config.d.cts +10 -0
  82. package/lib/git/user-config.d.mts +105 -0
  83. package/lib/git/user-config.d.ts +105 -0
  84. package/lib/git/user-config.mjs +8 -0
  85. package/lib/git/utils.cjs +70 -0
  86. package/lib/git/utils.d.cts +20 -0
  87. package/lib/git/utils.d.mts +69 -0
  88. package/lib/git/utils.d.ts +69 -0
  89. package/lib/git/utils.mjs +6 -0
  90. package/lib/git-diff.cjs +23 -24
  91. package/lib/git-diff.d.mts +25 -28
  92. package/lib/git-diff.d.ts +25 -28
  93. package/lib/git-diff.mjs +32 -27
  94. package/lib/git-fix.cjs +129 -0
  95. package/lib/git-fix.d.cts +2 -0
  96. package/lib/git-fix.d.mts +141 -0
  97. package/lib/git-fix.d.ts +141 -0
  98. package/lib/git-fix.mjs +151 -0
  99. package/lib/git-purge.cjs +86 -2
  100. package/lib/git-purge.mjs +3 -5
  101. package/lib/index.cjs +8 -0
  102. package/lib/index.mjs +3 -5
  103. package/lib/npm-run-series.cjs +140 -1
  104. package/lib/npm-run-series.js +2 -1
  105. package/lib/npm-run-series.mjs +7 -5
  106. package/lib/package-resolutions-updater.cjs +274 -0
  107. package/lib/package-resolutions-updater.d.mts +1 -0
  108. package/lib/package-resolutions-updater.d.ts +326 -0
  109. package/lib/package-resolutions-updater.mjs +316 -0
  110. package/lib/print-directory-tree.cjs +241 -0
  111. package/lib/print-directory-tree.d.cts +1 -0
  112. package/lib/print-directory-tree.d.mts +234 -0
  113. package/lib/print-directory-tree.d.ts +234 -0
  114. package/lib/print-directory-tree.mjs +182 -0
  115. package/lib/ps/connected-domain.mjs +2 -3
  116. package/lib/ps/index.cjs +3 -3
  117. package/lib/ps/index.d.mjs +1 -2
  118. package/lib/ps/index.js +6 -3
  119. package/lib/ps/index.mjs +9 -11
  120. package/lib/ps/isWin.mjs +2 -3
  121. package/lib/ps/table-parser.mjs +3 -4
  122. package/lib/submodule-install.cjs +13 -31
  123. package/lib/submodule-install.d.mts +12 -32
  124. package/lib/submodule-install.d.ts +12 -32
  125. package/lib/submodule-install.mjs +16 -25
  126. package/lib/utils.cjs +86 -2
  127. package/lib/utils.d.mts +29 -9
  128. package/lib/utils.d.ts +28 -8
  129. package/lib/utils.js +139 -8
  130. package/lib/utils.mjs +2 -3
  131. package/lib/yarn-reinstall.cjs +9 -7
  132. package/lib/yarn-reinstall.d.mts +12 -8
  133. package/lib/yarn-reinstall.d.ts +12 -8
  134. package/lib/yarn-reinstall.mjs +14 -10
  135. package/package.json +109 -80
  136. package/readme.md +74 -11
  137. package/src/package-resolutions-updater.mjs +325 -0
  138. package/src/print-directory-tree.cjs +234 -0
  139. package/src/ps/index.js +4 -3
  140. package/src/yarn-reinstall.cjs +49 -0
  141. package/test-project/package.json +16 -0
  142. package/tmp/test-repo/package.json +7 -0
  143. package/bin/git-fix-encoding.cmd +0 -6
  144. package/lib/chunk-OKYLF2MU.mjs +0 -53
  145. package/lib/chunk-VXZQNLPU.mjs +0 -23
  146. package/lib/package-resolutions.cjs +0 -28
  147. package/lib/package-resolutions.d.mts +0 -25
  148. package/lib/package-resolutions.d.ts +0 -25
  149. package/lib/package-resolutions.mjs +0 -31
  150. /package/bin/{submodule-install → submodule-install.txt} +0 -0
@@ -0,0 +1,132 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_utils
4
+ } from "./chunk-APBWENF6.mjs";
5
+ import {
6
+ __commonJS,
7
+ __require,
8
+ init_esm_shims
9
+ } from "./chunk-AASHBCRW.mjs";
10
+
11
+ // src/clean-github-actions-caches.cjs
12
+ var require_clean_github_actions_caches = __commonJS({
13
+ "src/clean-github-actions-caches.cjs"() {
14
+ init_esm_shims();
15
+ var axios = __require("axios");
16
+ var { parseGitRemotes } = require_utils();
17
+ var path = __require("upath");
18
+ var fs = __require("fs");
19
+ var projectDir = process.cwd();
20
+ var envPath = path.join(projectDir, ".env");
21
+ if (fs.existsSync(envPath)) {
22
+ __require("dotenv").config({ path: envPath });
23
+ } else {
24
+ console.warn(`.env file not found at ${envPath}`);
25
+ }
26
+ var ACCESS_TOKEN = process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN;
27
+ if (!ACCESS_TOKEN) {
28
+ throw new Error(
29
+ "Access token is not provided. Please set ACCESS_TOKEN or GITHUB_TOKEN in your environment variables."
30
+ );
31
+ }
32
+ function deleteGitHubActionsCache(GH_REPO, cacheId) {
33
+ return new Promise((resolve, reject) => {
34
+ const url = `https://api.github.com/repos/${GH_REPO}/actions/caches/${cacheId}`;
35
+ const token = ACCESS_TOKEN;
36
+ if (!token) {
37
+ return reject(new Error("Access token is not provided"));
38
+ }
39
+ axios.delete(url, {
40
+ headers: {
41
+ Authorization: `token ${token}`,
42
+ Accept: "application/vnd.github.v3+json"
43
+ }
44
+ }).then((response) => {
45
+ console.log(`Cache (${cacheId}) deleted successfully`, response.data);
46
+ resolve(response.data);
47
+ }).catch((error) => {
48
+ var _a;
49
+ console.error("Error deleting cache:", ((_a = error.response) == null ? void 0 : _a.data) || error.message || "Unknown error");
50
+ reject(error);
51
+ });
52
+ });
53
+ }
54
+ function get_caches(GH_REPO) {
55
+ const url = `https://api.github.com/repos/${GH_REPO}/actions/caches`;
56
+ return new Promise((resolve, reject) => {
57
+ axios.get(url, {
58
+ headers: {
59
+ Accept: "application/vnd.github.v3+json",
60
+ Authorization: `token ${ACCESS_TOKEN}`
61
+ }
62
+ }).then((response) => {
63
+ const data = response.data.actions_caches;
64
+ const getPrefix = (key) => {
65
+ const split = key.split(/[-_]/);
66
+ if (split.length == 3) {
67
+ return `${split[0]}-${split[1]}`;
68
+ } else if (split.length > 3) {
69
+ return `${split[0]}-${split[1]}-${split[2]}`;
70
+ }
71
+ return split[0];
72
+ };
73
+ const grouped = data.reduce(
74
+ /**
75
+ * @param {Record<string, Record<string, any>[]>} acc
76
+ * @param {Record<string, any>} item
77
+ * @returns {Record<string, Record<string, any>[]>}
78
+ */
79
+ (acc, item) => {
80
+ const prefix = getPrefix(item.key);
81
+ if (!acc[prefix]) {
82
+ acc[prefix] = [];
83
+ }
84
+ acc[prefix].push(item);
85
+ return acc;
86
+ },
87
+ {}
88
+ );
89
+ resolve(grouped);
90
+ }).catch((error) => {
91
+ console.error("Error fetching data:", error);
92
+ reject(error);
93
+ });
94
+ });
95
+ }
96
+ (async () => {
97
+ try {
98
+ const remotes = await parseGitRemotes();
99
+ const GH_REPO = remotes.origin;
100
+ const caches = await get_caches(GH_REPO);
101
+ for (const key in caches) {
102
+ if (Object.hasOwnProperty.call(caches, key)) {
103
+ const items = caches[key].sort((a, b) => new Date(b.created_at) - new Date(a.created_at)).map((item) => ({
104
+ ...item,
105
+ human_readable_date: new Date(item.created_at).toLocaleString()
106
+ }));
107
+ if (items.length > 1) {
108
+ const ids = items.map((o) => o.id);
109
+ ids.shift();
110
+ if (ids.length > 0) {
111
+ for (const id of ids) {
112
+ try {
113
+ await deleteGitHubActionsCache(GH_REPO, id);
114
+ } catch (err) {
115
+ console.error(`Error deleting cache ${id}:`, err);
116
+ }
117
+ }
118
+ } else {
119
+ console.log(`cache prefix ${key} no cache left`);
120
+ }
121
+ } else {
122
+ console.log(`cache prefix ${key} only have 1 cache`);
123
+ }
124
+ }
125
+ }
126
+ } catch (e) {
127
+ console.error(`Error: ${e}`);
128
+ }
129
+ })();
130
+ }
131
+ });
132
+ export default require_clean_github_actions_caches();
@@ -16,11 +16,56 @@ var init_cjs_shims = __esm({
16
16
  var require_utils = __commonJS({
17
17
  "src/utils.js"(exports2, module2) {
18
18
  init_cjs_shims();
19
- var { fs, path: path2 } = require("sbg-utility");
19
+ var fs = require("fs");
20
+ var path2 = require("upath");
20
21
  var argv = require("minimist")(process.argv.slice(2));
22
+ var { exec } = require("child_process");
23
+ var { URL: URL2 } = require("url");
24
+ var { promisify } = require("util");
25
+ var execAsync = promisify(exec);
26
+ async function parseGitRemotes() {
27
+ try {
28
+ const { stdout } = await execAsync("git remote -v");
29
+ const lines = stdout.split("\n");
30
+ const remotes = {};
31
+ lines.forEach((line) => {
32
+ const [name, url] = line.split(" ");
33
+ if (name && url) {
34
+ const [repoUrl] = url.split(" ");
35
+ try {
36
+ const parsedUrl = new URL2(repoUrl);
37
+ const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
38
+ if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
39
+ let repoPath = pathParts.join("/");
40
+ if (repoPath.endsWith(".git")) {
41
+ repoPath = repoPath.slice(0, -4);
42
+ }
43
+ remotes[name] = repoPath;
44
+ }
45
+ } catch (e) {
46
+ console.error("URL Parsing Error:", e.message);
47
+ }
48
+ }
49
+ });
50
+ return remotes;
51
+ } catch (error) {
52
+ console.error("Error:", error.message);
53
+ return {};
54
+ }
55
+ }
56
+ module2.exports.parseGitRemotes = parseGitRemotes;
57
+ function joinPathPreserveDriveLetter(...segments) {
58
+ let fullPath = require("path").join(...segments);
59
+ if (/^[a-z]:\\/.test(fullPath)) {
60
+ fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
61
+ }
62
+ return fullPath;
63
+ }
64
+ module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
21
65
  function getArgs() {
22
66
  return argv;
23
67
  }
68
+ module2.exports.getArgs = getArgs;
24
69
  function del2(fullPath) {
25
70
  if (fs.statSync(fullPath).isDirectory()) {
26
71
  const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
@@ -36,6 +81,7 @@ var require_utils = __commonJS({
36
81
  }
37
82
  }
38
83
  }
84
+ module2.exports.del = del2;
39
85
  function delStream(globStream2) {
40
86
  globStream2.stream().on("data", (result) => {
41
87
  const fullPath = path2.resolve(process.cwd(), result);
@@ -48,15 +94,53 @@ var require_utils = __commonJS({
48
94
  del2(fullPath);
49
95
  });
50
96
  }
97
+ module2.exports.delStream = delStream;
98
+ function getFileTreeString(hashArray) {
99
+ const tree = {};
100
+ const hashMap = {};
101
+ for (const entry of hashArray) {
102
+ const [filePath, hash] = entry.split(" ");
103
+ hashMap[filePath] = hash;
104
+ const parts = filePath.split("/");
105
+ let current = tree;
106
+ for (let i = 0; i < parts.length; i++) {
107
+ const part = parts[i];
108
+ if (i === parts.length - 1) {
109
+ current[part] = null;
110
+ } else {
111
+ current[part] = current[part] || {};
112
+ current = current[part];
113
+ }
114
+ }
115
+ }
116
+ function printNode(node, prefix = "", parentPath = "") {
117
+ const keys = Object.keys(node).sort();
118
+ let lines = [];
119
+ keys.forEach((key, idx) => {
120
+ const isLast = idx === keys.length - 1;
121
+ const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
122
+ const currentPath = parentPath ? parentPath + "/" + key : key;
123
+ if (node[key] === null) {
124
+ lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
125
+ } else {
126
+ lines.push(prefix + branch + key + "/");
127
+ lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
128
+ }
129
+ });
130
+ return lines;
131
+ }
132
+ return printNode(tree, "", "").join("\n");
133
+ }
134
+ module2.exports.getFileTreeString = getFileTreeString;
51
135
  var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
52
- module2.exports = { del: del2, delStream, getArgs, delay };
136
+ module2.exports.delay = delay;
53
137
  }
54
138
  });
55
139
 
56
140
  // src/del-gradle.js
57
141
  init_cjs_shims();
58
142
  var glob = require("glob");
59
- var { path } = require("sbg-utility");
143
+ var path = require("upath");
60
144
  var { del } = require_utils();
61
145
  var globStream = new glob.Glob(["**/build.gradle"], {
62
146
  withFileTypes: false,
package/lib/del-gradle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const glob = require("glob");
2
- const { path } = require("sbg-utility");
2
+ const path = require("upath");
3
3
  const { del } = require("./utils");
4
4
  const globStream = new glob.Glob(["**/build.gradle"], {
5
5
  withFileTypes: false,
@@ -1,18 +1,16 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_utils
4
- } from "./chunk-OKYLF2MU.mjs";
4
+ } from "./chunk-APBWENF6.mjs";
5
5
  import {
6
+ __require,
6
7
  init_esm_shims
7
- } from "./chunk-VXZQNLPU.mjs";
8
- import {
9
- __require
10
- } from "./chunk-FB6YIQYR.mjs";
8
+ } from "./chunk-AASHBCRW.mjs";
11
9
 
12
10
  // src/del-gradle.js
13
11
  init_esm_shims();
14
12
  var glob = __require("glob");
15
- var { path } = __require("sbg-utility");
13
+ var path = __require("upath");
16
14
  var { del } = require_utils();
17
15
  var globStream = new glob.Glob(["**/build.gradle"], {
18
16
  withFileTypes: false,
@@ -16,11 +16,56 @@ var init_cjs_shims = __esm({
16
16
  var require_utils = __commonJS({
17
17
  "src/utils.js"(exports2, module2) {
18
18
  init_cjs_shims();
19
- var { fs, path } = require("sbg-utility");
19
+ var fs = require("fs");
20
+ var path = require("upath");
20
21
  var argv = require("minimist")(process.argv.slice(2));
22
+ var { exec } = require("child_process");
23
+ var { URL: URL2 } = require("url");
24
+ var { promisify } = require("util");
25
+ var execAsync = promisify(exec);
26
+ async function parseGitRemotes() {
27
+ try {
28
+ const { stdout } = await execAsync("git remote -v");
29
+ const lines = stdout.split("\n");
30
+ const remotes = {};
31
+ lines.forEach((line) => {
32
+ const [name, url] = line.split(" ");
33
+ if (name && url) {
34
+ const [repoUrl] = url.split(" ");
35
+ try {
36
+ const parsedUrl = new URL2(repoUrl);
37
+ const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
38
+ if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
39
+ let repoPath = pathParts.join("/");
40
+ if (repoPath.endsWith(".git")) {
41
+ repoPath = repoPath.slice(0, -4);
42
+ }
43
+ remotes[name] = repoPath;
44
+ }
45
+ } catch (e) {
46
+ console.error("URL Parsing Error:", e.message);
47
+ }
48
+ }
49
+ });
50
+ return remotes;
51
+ } catch (error) {
52
+ console.error("Error:", error.message);
53
+ return {};
54
+ }
55
+ }
56
+ module2.exports.parseGitRemotes = parseGitRemotes;
57
+ function joinPathPreserveDriveLetter(...segments) {
58
+ let fullPath = require("path").join(...segments);
59
+ if (/^[a-z]:\\/.test(fullPath)) {
60
+ fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
61
+ }
62
+ return fullPath;
63
+ }
64
+ module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
21
65
  function getArgs() {
22
66
  return argv;
23
67
  }
68
+ module2.exports.getArgs = getArgs;
24
69
  function del(fullPath) {
25
70
  if (fs.statSync(fullPath).isDirectory()) {
26
71
  const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
@@ -36,6 +81,7 @@ var require_utils = __commonJS({
36
81
  }
37
82
  }
38
83
  }
84
+ module2.exports.del = del;
39
85
  function delStream2(globStream) {
40
86
  globStream.stream().on("data", (result) => {
41
87
  const fullPath = path.resolve(process.cwd(), result);
@@ -48,8 +94,46 @@ var require_utils = __commonJS({
48
94
  del(fullPath);
49
95
  });
50
96
  }
97
+ module2.exports.delStream = delStream2;
98
+ function getFileTreeString(hashArray) {
99
+ const tree = {};
100
+ const hashMap = {};
101
+ for (const entry of hashArray) {
102
+ const [filePath, hash] = entry.split(" ");
103
+ hashMap[filePath] = hash;
104
+ const parts = filePath.split("/");
105
+ let current = tree;
106
+ for (let i = 0; i < parts.length; i++) {
107
+ const part = parts[i];
108
+ if (i === parts.length - 1) {
109
+ current[part] = null;
110
+ } else {
111
+ current[part] = current[part] || {};
112
+ current = current[part];
113
+ }
114
+ }
115
+ }
116
+ function printNode(node, prefix = "", parentPath = "") {
117
+ const keys = Object.keys(node).sort();
118
+ let lines = [];
119
+ keys.forEach((key, idx) => {
120
+ const isLast = idx === keys.length - 1;
121
+ const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
122
+ const currentPath = parentPath ? parentPath + "/" + key : key;
123
+ if (node[key] === null) {
124
+ lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
125
+ } else {
126
+ lines.push(prefix + branch + key + "/");
127
+ lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
128
+ }
129
+ });
130
+ return lines;
131
+ }
132
+ return printNode(tree, "", "").join("\n");
133
+ }
134
+ module2.exports.getFileTreeString = getFileTreeString;
51
135
  var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
52
- module2.exports = { del, delStream: delStream2, getArgs, delay };
136
+ module2.exports.delay = delay;
53
137
  }
54
138
  });
55
139
 
@@ -1,13 +1,11 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_utils
4
- } from "./chunk-OKYLF2MU.mjs";
4
+ } from "./chunk-APBWENF6.mjs";
5
5
  import {
6
+ __require,
6
7
  init_esm_shims
7
- } from "./chunk-VXZQNLPU.mjs";
8
- import {
9
- __require
10
- } from "./chunk-FB6YIQYR.mjs";
8
+ } from "./chunk-AASHBCRW.mjs";
11
9
 
12
10
  // src/del-node-modules.js
13
11
  init_esm_shims();
package/lib/del-ps.cjs CHANGED
@@ -25,11 +25,56 @@ var require_isWin = __commonJS({
25
25
  var require_utils = __commonJS({
26
26
  "src/utils.js"(exports2, module2) {
27
27
  init_cjs_shims();
28
- var { fs, path } = require("sbg-utility");
28
+ var fs = require("fs");
29
+ var path = require("upath");
29
30
  var argv = require("minimist")(process.argv.slice(2));
30
- function getArgs() {
31
+ var { exec } = require("child_process");
32
+ var { URL: URL2 } = require("url");
33
+ var { promisify } = require("util");
34
+ var execAsync = promisify(exec);
35
+ async function parseGitRemotes() {
36
+ try {
37
+ const { stdout } = await execAsync("git remote -v");
38
+ const lines = stdout.split("\n");
39
+ const remotes = {};
40
+ lines.forEach((line) => {
41
+ const [name, url] = line.split(" ");
42
+ if (name && url) {
43
+ const [repoUrl] = url.split(" ");
44
+ try {
45
+ const parsedUrl = new URL2(repoUrl);
46
+ const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
47
+ if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
48
+ let repoPath = pathParts.join("/");
49
+ if (repoPath.endsWith(".git")) {
50
+ repoPath = repoPath.slice(0, -4);
51
+ }
52
+ remotes[name] = repoPath;
53
+ }
54
+ } catch (e) {
55
+ console.error("URL Parsing Error:", e.message);
56
+ }
57
+ }
58
+ });
59
+ return remotes;
60
+ } catch (error) {
61
+ console.error("Error:", error.message);
62
+ return {};
63
+ }
64
+ }
65
+ module2.exports.parseGitRemotes = parseGitRemotes;
66
+ function joinPathPreserveDriveLetter(...segments) {
67
+ let fullPath = require("path").join(...segments);
68
+ if (/^[a-z]:\\/.test(fullPath)) {
69
+ fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
70
+ }
71
+ return fullPath;
72
+ }
73
+ module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
74
+ function getArgs2() {
31
75
  return argv;
32
76
  }
77
+ module2.exports.getArgs = getArgs2;
33
78
  function del(fullPath) {
34
79
  if (fs.statSync(fullPath).isDirectory()) {
35
80
  const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
@@ -45,6 +90,7 @@ var require_utils = __commonJS({
45
90
  }
46
91
  }
47
92
  }
93
+ module2.exports.del = del;
48
94
  function delStream(globStream) {
49
95
  globStream.stream().on("data", (result) => {
50
96
  const fullPath = path.resolve(process.cwd(), result);
@@ -57,8 +103,46 @@ var require_utils = __commonJS({
57
103
  del(fullPath);
58
104
  });
59
105
  }
106
+ module2.exports.delStream = delStream;
107
+ function getFileTreeString(hashArray) {
108
+ const tree = {};
109
+ const hashMap = {};
110
+ for (const entry of hashArray) {
111
+ const [filePath, hash] = entry.split(" ");
112
+ hashMap[filePath] = hash;
113
+ const parts = filePath.split("/");
114
+ let current = tree;
115
+ for (let i = 0; i < parts.length; i++) {
116
+ const part = parts[i];
117
+ if (i === parts.length - 1) {
118
+ current[part] = null;
119
+ } else {
120
+ current[part] = current[part] || {};
121
+ current = current[part];
122
+ }
123
+ }
124
+ }
125
+ function printNode(node, prefix = "", parentPath = "") {
126
+ const keys = Object.keys(node).sort();
127
+ let lines = [];
128
+ keys.forEach((key, idx) => {
129
+ const isLast = idx === keys.length - 1;
130
+ const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
131
+ const currentPath = parentPath ? parentPath + "/" + key : key;
132
+ if (node[key] === null) {
133
+ lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
134
+ } else {
135
+ lines.push(prefix + branch + key + "/");
136
+ lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
137
+ }
138
+ });
139
+ return lines;
140
+ }
141
+ return printNode(tree, "", "").join("\n");
142
+ }
143
+ module2.exports.getFileTreeString = getFileTreeString;
60
144
  var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
61
- module2.exports = { del, delStream, getArgs, delay };
145
+ module2.exports.delay = delay;
62
146
  }
63
147
  });
64
148
 
@@ -67,8 +151,8 @@ init_cjs_shims();
67
151
  var crossSpawn = require("cross-spawn");
68
152
  var ps = require("ps-node");
69
153
  var isWin = require_isWin();
70
- var utils = require_utils();
71
- utils.getArgs()._.forEach((command) => {
154
+ var { getArgs } = require_utils();
155
+ getArgs()._.forEach((command) => {
72
156
  ps.lookup(
73
157
  {
74
158
  command,
package/lib/del-ps.js CHANGED
@@ -1,8 +1,8 @@
1
1
  const crossSpawn = require("cross-spawn");
2
2
  const ps = require("ps-node");
3
3
  const isWin = require("./ps/isWin");
4
- const utils = require("./utils");
5
- utils.getArgs()._.forEach((command) => {
4
+ const { getArgs } = require("./utils.js");
5
+ getArgs()._.forEach((command) => {
6
6
  ps.lookup({
7
7
  command,
8
8
  psargs: "ux"
package/lib/del-ps.mjs CHANGED
@@ -1,24 +1,22 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_isWin
4
- } from "./chunk-JL32QDSH.mjs";
4
+ } from "./chunk-W3ENOM53.mjs";
5
5
  import {
6
6
  require_utils
7
- } from "./chunk-OKYLF2MU.mjs";
7
+ } from "./chunk-APBWENF6.mjs";
8
8
  import {
9
+ __require,
9
10
  init_esm_shims
10
- } from "./chunk-VXZQNLPU.mjs";
11
- import {
12
- __require
13
- } from "./chunk-FB6YIQYR.mjs";
11
+ } from "./chunk-AASHBCRW.mjs";
14
12
 
15
13
  // src/del-ps.js
16
14
  init_esm_shims();
17
15
  var crossSpawn = __require("cross-spawn");
18
16
  var ps = __require("ps-node");
19
17
  var isWin = require_isWin();
20
- var utils = require_utils();
21
- utils.getArgs()._.forEach((command) => {
18
+ var { getArgs } = require_utils();
19
+ getArgs()._.forEach((command) => {
22
20
  ps.lookup(
23
21
  {
24
22
  command,