binary-collections 2.0.10 → 2.0.11

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 (165) hide show
  1. package/.puppeterrc.cjs +25 -0
  2. package/binaries/binary-executor.cjs +138 -3
  3. package/binaries/clean-nodemodule.cjs +138 -3
  4. package/binaries/clean-nodemodules.cjs +138 -3
  5. package/binaries/dev.cjs +138 -3
  6. package/binaries/empty.cjs +138 -3
  7. package/binaries/git-reduce-size.cjs +138 -3
  8. package/binaries/javakill.cjs +138 -3
  9. package/binaries/kill-night-crows.bat +7 -0
  10. package/binaries/kill-night-crows.ps1 +172 -0
  11. package/binaries/kill-process.cjs +138 -3
  12. package/binaries/nodekill.cjs +138 -3
  13. package/binaries/prod.cjs +138 -3
  14. package/binaries/py +111 -0
  15. package/binaries/py.cjs +178 -0
  16. package/binaries/py.cmd +49 -0
  17. package/binaries/rmfind.cjs +138 -3
  18. package/binaries/rmx.cjs +138 -3
  19. package/binaries/submodule-token.cjs +138 -3
  20. package/binaries/test-cjs +10 -0
  21. package/binaries/test-cjs.cjs +178 -0
  22. package/binaries/test-cjs.cmd +11 -0
  23. package/binaries/yarn-clean +32 -0
  24. package/binaries/yarn-clean.cjs +178 -0
  25. package/binaries/yarn-clean.cmd +30 -0
  26. package/binaries/yarn-clean.py +148 -0
  27. package/lib/binary-collections-config.cjs +1 -1
  28. package/lib/binary-collections-config.mjs +1 -1
  29. package/lib/binary-collections.cjs +167 -106
  30. package/lib/binary-collections.mjs +108 -94
  31. package/lib/changelog.cjs +61 -13
  32. package/lib/changelog.mjs +1 -1
  33. package/lib/{chunk-AI4CVPJ7.mjs → chunk-2CBJCW7E.mjs} +4 -4
  34. package/lib/chunk-34IQDTLZ.mjs +27 -0
  35. package/lib/chunk-3HFFECCI.mjs +27 -0
  36. package/lib/{chunk-SBNDSKG5.mjs → chunk-4UHL4WVN.mjs} +1 -1
  37. package/lib/chunk-7XTEJHOE.mjs +193 -0
  38. package/lib/chunk-AJDD5DZM.mjs +109 -0
  39. package/lib/chunk-BZWVHODJ.mjs +62 -0
  40. package/lib/{chunk-BEZKJ25G.mjs → chunk-FCDQGYBF.mjs} +5 -9
  41. package/lib/chunk-GEYA2USY.mjs +207 -0
  42. package/lib/chunk-ID2WBTE2.mjs +80 -0
  43. package/lib/chunk-JXFOHKDM.mjs +239 -0
  44. package/lib/{chunk-DI5MDPSN.mjs → chunk-N436BNBK.mjs} +192 -64
  45. package/lib/chunk-NCXAP7AA.mjs +31 -0
  46. package/lib/chunk-PDN26I7O.mjs +188 -0
  47. package/lib/{chunk-E6FDDAOO.mjs → chunk-RWLXRTYP.mjs} +1 -1
  48. package/lib/{chunk-BDCHCWHD.mjs → chunk-TOIVAQF7.mjs} +4 -4
  49. package/lib/chunk-V5SKYJUB.mjs +136 -0
  50. package/lib/{chunk-HMRMTYZM.mjs → chunk-WSRETQCA.mjs} +21 -2
  51. package/lib/chunk-XA3SNBPA.mjs +184 -0
  52. package/lib/chunk-YYLIQQKF.mjs +31 -0
  53. package/lib/{chunk-V3N3JEUF.mjs → chunk-Z6JLYU2J.mjs} +60 -13
  54. package/lib/{chunk-O6SWBEOQ.mjs → chunk-ZDMWBSYF.mjs} +2 -2
  55. package/lib/clean-github-actions-caches.cjs +63 -15
  56. package/lib/clean-github-actions-caches.mjs +3 -3
  57. package/lib/del-gradle.cjs +61 -13
  58. package/lib/del-gradle.js +1 -0
  59. package/lib/del-gradle.mjs +1 -1
  60. package/lib/del-node-modules.cjs +143 -148
  61. package/lib/del-node-modules.js +210 -14
  62. package/lib/del-node-modules.mjs +148 -17
  63. package/lib/del-ps.cjs +61 -13
  64. package/lib/del-ps.js +1 -0
  65. package/lib/del-ps.mjs +1 -1
  66. package/lib/del-yarn-caches.cjs +61 -13
  67. package/lib/del-yarn-caches.mjs +1 -1
  68. package/lib/find-node-modules-cli.js +1 -0
  69. package/lib/free-chatgpt.cjs +253 -47
  70. package/lib/free-chatgpt.mjs +2 -2
  71. package/lib/git/gitattributes.cjs +1 -0
  72. package/lib/git/gitattributes.d.cts +7 -2
  73. package/lib/git/gitattributes.mjs +1 -1
  74. package/lib/git/line-endings.cjs +2 -1
  75. package/lib/git/line-endings.mjs +2 -2
  76. package/lib/git/undo-commit-cli.cjs +110 -0
  77. package/lib/git/undo-commit-cli.d.ts +1 -0
  78. package/lib/git/undo-commit-cli.js +4 -0
  79. package/lib/git/undo-commit-cli.mjs +14 -0
  80. package/lib/git/undo-commit.cjs +81 -0
  81. package/lib/git/undo-commit.d.cts +1 -0
  82. package/lib/git/undo-commit.mjs +7 -0
  83. package/lib/git/undo-staged-cli.cjs +110 -0
  84. package/lib/git/undo-staged-cli.d.ts +1 -0
  85. package/lib/git/undo-staged-cli.js +4 -0
  86. package/lib/git/undo-staged-cli.mjs +14 -0
  87. package/lib/git/undo-staged.cjs +81 -0
  88. package/lib/git/undo-staged.d.cts +1 -0
  89. package/lib/git/undo-staged.mjs +7 -0
  90. package/lib/git/user-config.cjs +61 -14
  91. package/lib/git/user-config.mjs +2 -2
  92. package/lib/git-diff-cli.cjs +255 -49
  93. package/lib/git-diff-cli.d.ts +1 -0
  94. package/lib/git-diff-cli.js +1 -0
  95. package/lib/git-diff-cli.mjs +5 -4
  96. package/lib/git-diff.cjs +254 -49
  97. package/lib/git-diff.mjs +4 -4
  98. package/lib/git-fix.cjs +64 -16
  99. package/lib/git-fix.mjs +10 -10
  100. package/lib/git-purge.cjs +61 -13
  101. package/lib/git-purge.mjs +1 -1
  102. package/lib/kill-night-crows.cjs +87 -0
  103. package/lib/kill-night-crows.d.mts +1 -0
  104. package/lib/kill-night-crows.mjs +65 -0
  105. package/lib/npm-run-series.cjs +60 -13
  106. package/lib/npm-run-series.mjs +1 -1
  107. package/lib/package-resolutions-updater-cli.cjs +560 -0
  108. package/lib/package-resolutions-updater-cli.d.mts +1 -0
  109. package/lib/package-resolutions-updater-cli.mjs +124 -0
  110. package/lib/package-resolutions-updater.cjs +174 -154
  111. package/lib/package-resolutions-updater.d.mts +32 -1
  112. package/lib/package-resolutions-updater.mjs +16 -294
  113. package/lib/php-cs-fixer-staged.cjs +105 -0
  114. package/lib/php-cs-fixer-staged.d.cts +2 -0
  115. package/lib/php-cs-fixer-staged.mjs +117 -0
  116. package/lib/print-directory-tree.cjs +62 -14
  117. package/lib/print-directory-tree.mjs +2 -2
  118. package/lib/ps/connected-domain.d.ts +1 -1
  119. package/lib/ps/index.js +1 -0
  120. package/lib/remove-module.cjs +61 -13
  121. package/lib/remove-module.mjs +1 -1
  122. package/lib/rmpath.cjs +63 -15
  123. package/lib/rmpath.mjs +2 -2
  124. package/lib/submodule-install.cjs +62 -15
  125. package/lib/submodule-install.mjs +3 -3
  126. package/lib/submodule-remove-cli.cjs +5 -1
  127. package/lib/submodule-remove-cli.mjs +1 -1
  128. package/lib/submodule-remove.cjs +4 -1
  129. package/lib/submodule-remove.mjs +1 -1
  130. package/lib/utils/chatgpt.cjs +192 -34
  131. package/lib/utils/chatgpt.js +210 -43
  132. package/lib/utils/chatgpt.mjs +1 -1
  133. package/lib/utils/findEnvFiles.cjs +107 -0
  134. package/lib/utils/findEnvFiles.d.ts +8 -0
  135. package/lib/utils/findEnvFiles.js +121 -0
  136. package/lib/utils/findEnvFiles.mjs +8 -0
  137. package/lib/utils/findWorkspaceRoot.cjs +70 -0
  138. package/lib/utils/findWorkspaceRoot.d.ts +9 -0
  139. package/lib/utils/findWorkspaceRoot.js +57 -0
  140. package/lib/utils/findWorkspaceRoot.mjs +40 -0
  141. package/lib/utils/index.cjs +60 -13
  142. package/lib/utils/index.mjs +1 -1
  143. package/lib/utils/isGithubTokenValid.cjs +64 -0
  144. package/lib/utils/isGithubTokenValid.d.ts +7 -0
  145. package/lib/utils/isGithubTokenValid.js +48 -0
  146. package/lib/utils/isGithubTokenValid.mjs +36 -0
  147. package/lib/yarn-reinstall.cjs +61 -13
  148. package/lib/yarn-reinstall.mjs +1 -1
  149. package/package.json +107 -93
  150. package/readme.md +33 -34
  151. package/releases/readme.md +1 -1
  152. package/requirements.txt +1 -0
  153. package/lib/chunk-4EWQC6GZ.mjs +0 -382
  154. package/lib/chunk-4ZI7BQKQ.mjs +0 -381
  155. package/lib/chunk-5J2BEPY5.mjs +0 -83
  156. package/lib/chunk-AGZYRDC2.mjs +0 -323
  157. package/lib/chunk-HN52G2YL.mjs +0 -305
  158. package/lib/chunk-HO6GHCOB.mjs +0 -385
  159. package/lib/chunk-LEM5OMRP.mjs +0 -384
  160. package/lib/chunk-RCP7DHVY.mjs +0 -190
  161. package/lib/chunk-U6SO4QEV.mjs +0 -320
  162. package/lib/chunk-XD6BJK6Q.mjs +0 -351
  163. package/lib/chunk-YXSFGA2D.mjs +0 -383
  164. package/lib/git/gitattributes.d.ts +0 -33
  165. package/lib/git/gitattributes.js +0 -223
@@ -0,0 +1,70 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/utils/findWorkspaceRoot.js
30
+ var findWorkspaceRoot_exports = {};
31
+ __export(findWorkspaceRoot_exports, {
32
+ findWorkspaceRoot: () => findYarnWorkspaceRootFS,
33
+ findWorkspaceRootYC: () => findWorkspaceRootYC,
34
+ findYarnWorkspaceRootFS: () => findYarnWorkspaceRootFS
35
+ });
36
+ module.exports = __toCommonJS(findWorkspaceRoot_exports);
37
+ var import_core = require("@yarnpkg/core");
38
+ var import_upath = __toESM(require("upath"), 1);
39
+ var import_fs_extra = __toESM(require("fs-extra"), 1);
40
+ async function findWorkspaceRootYC(cwd = process.cwd()) {
41
+ const configuration = await import_core.Configuration.find(cwd, null);
42
+ const { project } = await import_core.Project.find(configuration, cwd);
43
+ return project.cwd;
44
+ }
45
+ function findYarnWorkspaceRootFS(cwd = process.cwd()) {
46
+ let current = import_upath.default.resolve(cwd);
47
+ while (true) {
48
+ const pkgPath = import_upath.default.join(current, "package.json");
49
+ if (import_fs_extra.default.existsSync(pkgPath)) {
50
+ try {
51
+ const pkg = JSON.parse(import_fs_extra.default.readFileSync(pkgPath, "utf8"));
52
+ if (pkg.workspaces || import_fs_extra.default.existsSync(import_upath.default.join(current, "yarn.lock")) || import_fs_extra.default.existsSync(import_upath.default.join(current, ".yarn"))) {
53
+ return current;
54
+ }
55
+ } catch {
56
+ }
57
+ }
58
+ const parent = import_upath.default.dirname(current);
59
+ if (parent === current) {
60
+ return null;
61
+ }
62
+ current = parent;
63
+ }
64
+ }
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ findWorkspaceRoot,
68
+ findWorkspaceRootYC,
69
+ findYarnWorkspaceRootFS
70
+ });
@@ -0,0 +1,9 @@
1
+ export function findWorkspaceRootYC(cwd?: string): Promise<import("@yarnpkg/fslib").PortablePath>;
2
+ /**
3
+ * Find Yarn workspace root directory.
4
+ *
5
+ * @param {string} cwd
6
+ * @returns {string|null}
7
+ */
8
+ export function findYarnWorkspaceRootFS(cwd?: string): string | null;
9
+ export { findYarnWorkspaceRootFS as findWorkspaceRoot };
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.findWorkspaceRootYC = findWorkspaceRootYC;
16
+ exports.findYarnWorkspaceRootFS = findYarnWorkspaceRootFS;
17
+ exports.findWorkspaceRoot = findYarnWorkspaceRootFS;
18
+ const core_1 = require("@yarnpkg/core");
19
+ const upath_1 = __importDefault(require("upath"));
20
+ const fs_extra_1 = __importDefault(require("fs-extra"));
21
+ function findWorkspaceRootYC() {
22
+ return __awaiter(this, arguments, void 0, function* (cwd = process.cwd()) {
23
+ const configuration = yield core_1.Configuration.find(cwd, null);
24
+ const { project } = yield core_1.Project.find(configuration, cwd);
25
+ return project.cwd;
26
+ });
27
+ }
28
+ /**
29
+ * Find Yarn workspace root directory.
30
+ *
31
+ * @param {string} cwd
32
+ * @returns {string|null}
33
+ */
34
+ function findYarnWorkspaceRootFS(cwd = process.cwd()) {
35
+ let current = upath_1.default.resolve(cwd);
36
+ while (true) {
37
+ const pkgPath = upath_1.default.join(current, "package.json");
38
+ if (fs_extra_1.default.existsSync(pkgPath)) {
39
+ try {
40
+ const pkg = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, "utf8"));
41
+ if (pkg.workspaces ||
42
+ fs_extra_1.default.existsSync(upath_1.default.join(current, "yarn.lock")) ||
43
+ fs_extra_1.default.existsSync(upath_1.default.join(current, ".yarn"))) {
44
+ return current;
45
+ }
46
+ }
47
+ catch (_a) {
48
+ // ignore invalid package.json
49
+ }
50
+ }
51
+ const parent = upath_1.default.dirname(current);
52
+ if (parent === current) {
53
+ return null;
54
+ }
55
+ current = parent;
56
+ }
57
+ }
@@ -0,0 +1,40 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ init_esm_shims
4
+ } from "../chunk-QQ4A6DLD.mjs";
5
+
6
+ // src/utils/findWorkspaceRoot.js
7
+ init_esm_shims();
8
+ import { Configuration, Project } from "@yarnpkg/core";
9
+ import path from "upath";
10
+ import fs from "fs-extra";
11
+ async function findWorkspaceRootYC(cwd = process.cwd()) {
12
+ const configuration = await Configuration.find(cwd, null);
13
+ const { project } = await Project.find(configuration, cwd);
14
+ return project.cwd;
15
+ }
16
+ function findYarnWorkspaceRootFS(cwd = process.cwd()) {
17
+ let current = path.resolve(cwd);
18
+ while (true) {
19
+ const pkgPath = path.join(current, "package.json");
20
+ if (fs.existsSync(pkgPath)) {
21
+ try {
22
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
23
+ if (pkg.workspaces || fs.existsSync(path.join(current, "yarn.lock")) || fs.existsSync(path.join(current, ".yarn"))) {
24
+ return current;
25
+ }
26
+ } catch {
27
+ }
28
+ }
29
+ const parent = path.dirname(current);
30
+ if (parent === current) {
31
+ return null;
32
+ }
33
+ current = parent;
34
+ }
35
+ }
36
+ export {
37
+ findYarnWorkspaceRootFS as findWorkspaceRoot,
38
+ findWorkspaceRootYC,
39
+ findYarnWorkspaceRootFS
40
+ };
@@ -50,31 +50,78 @@ function getArgs() {
50
50
  }
51
51
  module.exports.getArgs = getArgs;
52
52
  function del(fullPath) {
53
- if (fs.statSync(fullPath).isDirectory()) {
54
- const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
55
- for (let i = 0; i < subdir.length; i++) {
56
- del(subdir[i]);
53
+ try {
54
+ if (!fs.existsSync(fullPath)) return;
55
+ const stat = fs.lstatSync(fullPath);
56
+ if (stat.isSymbolicLink()) {
57
+ try {
58
+ fs.unlinkSync(fullPath);
59
+ console.log("deleted symlink", fullPath);
60
+ } catch (e) {
61
+ console.log("failed delete symlink", fullPath, e && e.message);
62
+ }
63
+ return;
64
+ }
65
+ if (stat.isDirectory()) {
66
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
67
+ for (let i = 0; i < subdir.length; i++) {
68
+ del(subdir[i]);
69
+ }
70
+ try {
71
+ fs.rmdirSync(fullPath);
72
+ console.log("deleted", fullPath);
73
+ } catch (e) {
74
+ try {
75
+ fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
76
+ console.log("deleted", fullPath);
77
+ } catch (ee) {
78
+ console.log("failed delete", fullPath, ee && ee.message);
79
+ }
80
+ }
81
+ return;
57
82
  }
58
- } else {
59
83
  try {
60
- fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
84
+ fs.unlinkSync(fullPath);
61
85
  console.log("deleted", fullPath);
62
- } catch (_) {
63
- console.log("failed delete", fullPath);
86
+ } catch (e) {
87
+ try {
88
+ fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
89
+ console.log("deleted", fullPath);
90
+ } catch (ee) {
91
+ console.log("failed delete", fullPath, ee && ee.message);
92
+ }
64
93
  }
94
+ } catch (err) {
95
+ console.log("failed delete", fullPath, err && err.message);
65
96
  }
66
97
  }
67
98
  module.exports.del = del;
68
99
  function delStream(globStream) {
69
100
  globStream.stream().on("data", (result) => {
70
101
  const fullPath = path.resolve(process.cwd(), result);
71
- if (fs.statSync(fullPath).isDirectory()) {
72
- const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
73
- for (let i = 0; i < subdir.length; i++) {
74
- del(subdir[i]);
102
+ try {
103
+ if (fs.existsSync(fullPath)) {
104
+ const stat = fs.lstatSync(fullPath);
105
+ if (stat.isSymbolicLink()) {
106
+ try {
107
+ fs.unlinkSync(fullPath);
108
+ console.log("deleted symlink", fullPath);
109
+ } catch (e) {
110
+ console.log("failed delete symlink", fullPath, e && e.message);
111
+ }
112
+ return;
113
+ }
114
+ if (stat.isDirectory()) {
115
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
116
+ for (let i = 0; i < subdir.length; i++) {
117
+ del(subdir[i]);
118
+ }
119
+ }
75
120
  }
121
+ del(fullPath);
122
+ } catch (err) {
123
+ console.log("failed processing", fullPath, err && err.message);
76
124
  }
77
- del(fullPath);
78
125
  });
79
126
  }
80
127
  module.exports.delStream = delStream;
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_utils
4
- } from "../chunk-V3N3JEUF.mjs";
4
+ } from "../chunk-Z6JLYU2J.mjs";
5
5
  import "../chunk-QQ4A6DLD.mjs";
6
6
  export default require_utils();
@@ -0,0 +1,64 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/utils/isGithubTokenValid.js
30
+ var isGithubTokenValid_exports = {};
31
+ __export(isGithubTokenValid_exports, {
32
+ isGitHubTokenValid: () => isGitHubTokenValid
33
+ });
34
+ module.exports = __toCommonJS(isGithubTokenValid_exports);
35
+ var import_node_https = __toESM(require("https"), 1);
36
+ async function isGitHubTokenValid(token) {
37
+ if (!token || typeof token !== "string") {
38
+ return false;
39
+ }
40
+ return new Promise((resolve) => {
41
+ const req = import_node_https.default.request(
42
+ {
43
+ hostname: "api.github.com",
44
+ path: "/user",
45
+ method: "GET",
46
+ headers: {
47
+ Authorization: `Bearer ${token}`,
48
+ "User-Agent": "github-token-validator",
49
+ Accept: "application/vnd.github+json"
50
+ }
51
+ },
52
+ (res) => {
53
+ resolve(res.statusCode === 200);
54
+ res.resume();
55
+ }
56
+ );
57
+ req.on("error", () => resolve(false));
58
+ req.end();
59
+ });
60
+ }
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ isGitHubTokenValid
64
+ });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Check whether a GitHub token is valid.
3
+ *
4
+ * @param {string} token GitHub personal access token
5
+ * @returns {Promise<boolean>}
6
+ */
7
+ export function isGitHubTokenValid(token: string): Promise<boolean>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.isGitHubTokenValid = isGitHubTokenValid;
16
+ const node_https_1 = __importDefault(require("node:https"));
17
+ /**
18
+ * Check whether a GitHub token is valid.
19
+ *
20
+ * @param {string} token GitHub personal access token
21
+ * @returns {Promise<boolean>}
22
+ */
23
+ function isGitHubTokenValid(token) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ if (!token || typeof token !== "string") {
26
+ return false;
27
+ }
28
+ return new Promise((resolve) => {
29
+ const req = node_https_1.default.request({
30
+ hostname: "api.github.com",
31
+ path: "/user",
32
+ method: "GET",
33
+ headers: {
34
+ Authorization: `Bearer ${token}`,
35
+ "User-Agent": "github-token-validator",
36
+ Accept: "application/vnd.github+json"
37
+ }
38
+ }, (res) => {
39
+ // 200 = valid token
40
+ resolve(res.statusCode === 200);
41
+ // consume response to avoid memory leak
42
+ res.resume();
43
+ });
44
+ req.on("error", () => resolve(false));
45
+ req.end();
46
+ });
47
+ });
48
+ }
@@ -0,0 +1,36 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ init_esm_shims
4
+ } from "../chunk-QQ4A6DLD.mjs";
5
+
6
+ // src/utils/isGithubTokenValid.js
7
+ init_esm_shims();
8
+ import https from "https";
9
+ async function isGitHubTokenValid(token) {
10
+ if (!token || typeof token !== "string") {
11
+ return false;
12
+ }
13
+ return new Promise((resolve) => {
14
+ const req = https.request(
15
+ {
16
+ hostname: "api.github.com",
17
+ path: "/user",
18
+ method: "GET",
19
+ headers: {
20
+ Authorization: `Bearer ${token}`,
21
+ "User-Agent": "github-token-validator",
22
+ Accept: "application/vnd.github+json"
23
+ }
24
+ },
25
+ (res) => {
26
+ resolve(res.statusCode === 200);
27
+ res.resume();
28
+ }
29
+ );
30
+ req.on("error", () => resolve(false));
31
+ req.end();
32
+ });
33
+ }
34
+ export {
35
+ isGitHubTokenValid
36
+ };
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
2
3
  var __esm = (fn, res) => function __init() {
3
4
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
@@ -67,31 +68,78 @@ var require_utils = __commonJS({
67
68
  }
68
69
  module2.exports.getArgs = getArgs2;
69
70
  function del(fullPath) {
70
- if (fs.statSync(fullPath).isDirectory()) {
71
- const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
72
- for (let i = 0; i < subdir.length; i++) {
73
- del(subdir[i]);
71
+ try {
72
+ if (!fs.existsSync(fullPath)) return;
73
+ const stat = fs.lstatSync(fullPath);
74
+ if (stat.isSymbolicLink()) {
75
+ try {
76
+ fs.unlinkSync(fullPath);
77
+ console.log("deleted symlink", fullPath);
78
+ } catch (e) {
79
+ console.log("failed delete symlink", fullPath, e && e.message);
80
+ }
81
+ return;
82
+ }
83
+ if (stat.isDirectory()) {
84
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
85
+ for (let i = 0; i < subdir.length; i++) {
86
+ del(subdir[i]);
87
+ }
88
+ try {
89
+ fs.rmdirSync(fullPath);
90
+ console.log("deleted", fullPath);
91
+ } catch (e) {
92
+ try {
93
+ fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
94
+ console.log("deleted", fullPath);
95
+ } catch (ee) {
96
+ console.log("failed delete", fullPath, ee && ee.message);
97
+ }
98
+ }
99
+ return;
74
100
  }
75
- } else {
76
101
  try {
77
- fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
102
+ fs.unlinkSync(fullPath);
78
103
  console.log("deleted", fullPath);
79
- } catch (_) {
80
- console.log("failed delete", fullPath);
104
+ } catch (e) {
105
+ try {
106
+ fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
107
+ console.log("deleted", fullPath);
108
+ } catch (ee) {
109
+ console.log("failed delete", fullPath, ee && ee.message);
110
+ }
81
111
  }
112
+ } catch (err) {
113
+ console.log("failed delete", fullPath, err && err.message);
82
114
  }
83
115
  }
84
116
  module2.exports.del = del;
85
117
  function delStream(globStream) {
86
118
  globStream.stream().on("data", (result) => {
87
119
  const fullPath = path.resolve(process.cwd(), result);
88
- if (fs.statSync(fullPath).isDirectory()) {
89
- const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
90
- for (let i = 0; i < subdir.length; i++) {
91
- del(subdir[i]);
120
+ try {
121
+ if (fs.existsSync(fullPath)) {
122
+ const stat = fs.lstatSync(fullPath);
123
+ if (stat.isSymbolicLink()) {
124
+ try {
125
+ fs.unlinkSync(fullPath);
126
+ console.log("deleted symlink", fullPath);
127
+ } catch (e) {
128
+ console.log("failed delete symlink", fullPath, e && e.message);
129
+ }
130
+ return;
131
+ }
132
+ if (stat.isDirectory()) {
133
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
134
+ for (let i = 0; i < subdir.length; i++) {
135
+ del(subdir[i]);
136
+ }
137
+ }
92
138
  }
139
+ del(fullPath);
140
+ } catch (err) {
141
+ console.log("failed processing", fullPath, err && err.message);
93
142
  }
94
- del(fullPath);
95
143
  });
96
144
  }
97
145
  module2.exports.delStream = delStream;
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_utils
4
- } from "./chunk-V3N3JEUF.mjs";
4
+ } from "./chunk-Z6JLYU2J.mjs";
5
5
  import {
6
6
  __commonJS,
7
7
  __require,