binary-collections 2.0.9 → 2.0.10
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/binaries/binary-executor.cjs +43 -0
- package/{bin → binaries}/clean-nodemodule +0 -0
- package/binaries/clean-nodemodule.cjs +43 -0
- package/binaries/clean-nodemodule.cmd +4 -0
- package/{bin → binaries}/clean-nodemodules +0 -0
- package/binaries/clean-nodemodules.cjs +43 -0
- package/binaries/clean-nodemodules.cmd +5 -0
- package/{bin → binaries}/dev +0 -0
- package/binaries/dev.cjs +43 -0
- package/{bin → binaries}/empty +0 -0
- package/binaries/empty.cjs +43 -0
- package/{bin → binaries}/git-reduce-size +0 -0
- package/binaries/git-reduce-size.cjs +43 -0
- package/binaries/javakill.cjs +43 -0
- package/{bin → binaries}/javakill.cmd +0 -0
- package/{bin → binaries}/kill-process +0 -0
- package/binaries/kill-process.cjs +43 -0
- package/binaries/nodekill.cjs +43 -0
- package/{bin → binaries}/nodekill.ps1 +0 -0
- package/{bin → binaries}/prod +0 -0
- package/binaries/prod.cjs +43 -0
- package/{bin → binaries}/rmfind +0 -0
- package/binaries/rmfind.cjs +43 -0
- package/{bin → binaries}/rmx +0 -0
- package/binaries/rmx.cjs +43 -0
- package/{bin → binaries}/submodule-token +0 -0
- package/binaries/submodule-token.cjs +43 -0
- package/docs-src/clean-github-actions-caches.md +26 -0
- package/docs-src/free-chatgpt.md +26 -0
- package/lib/binary-collections-config.cjs +3 -2
- package/lib/binary-collections-config.mjs +2 -2
- package/lib/binary-collections.cjs +452 -105
- package/lib/binary-collections.mjs +131 -84
- package/lib/changelog.cjs +3 -3
- package/lib/changelog.mjs +177 -171
- package/lib/chunk-4EWQC6GZ.mjs +382 -0
- package/lib/chunk-4ZI7BQKQ.mjs +381 -0
- package/lib/chunk-5J2BEPY5.mjs +83 -0
- package/lib/{chunk-4BYBVEYC.mjs → chunk-66PAU5PS.mjs} +5 -4
- package/lib/chunk-6HHJRKFB.mjs +59 -0
- package/lib/chunk-6S4NXESK.mjs +26 -0
- package/lib/{chunk-ZYAQRPUL.mjs → chunk-7YD7IPFF.mjs} +2 -2
- package/lib/{chunk-SH3L6HHV.mjs → chunk-A2JQXI5Z.mjs} +2 -2
- package/lib/{chunk-EGSSKVDH.mjs → chunk-A3VUZEJK.mjs} +1 -1
- package/lib/chunk-AGZYRDC2.mjs +323 -0
- package/lib/{chunk-VVEZVNIV.mjs → chunk-AI4CVPJ7.mjs} +6 -6
- package/lib/chunk-BDCHCWHD.mjs +136 -0
- package/lib/chunk-BEZKJ25G.mjs +140 -0
- package/lib/chunk-DI5MDPSN.mjs +386 -0
- package/lib/{chunk-ONIBBBQ3.mjs → chunk-E6FDDAOO.mjs} +4 -3
- package/lib/chunk-FKI7IEB5.mjs +172 -0
- package/lib/chunk-GJTGHXRA.mjs +356 -0
- package/lib/{chunk-YV7DO3YV.mjs → chunk-HLGOWBEO.mjs} +1 -1
- package/lib/chunk-HMRMTYZM.mjs +40 -0
- package/lib/chunk-HN52G2YL.mjs +305 -0
- package/lib/chunk-HO6GHCOB.mjs +385 -0
- package/lib/chunk-LEM5OMRP.mjs +384 -0
- package/lib/{chunk-YX5U7XDR.mjs → chunk-M3YIYRHT.mjs} +6 -5
- package/lib/chunk-O6SWBEOQ.mjs +81 -0
- package/lib/{chunk-JGR2NW6D.mjs → chunk-PDSXF5HY.mjs} +3 -3
- package/lib/{chunk-AASHBCRW.mjs → chunk-QQ4A6DLD.mjs} +8 -0
- package/lib/chunk-RCP7DHVY.mjs +190 -0
- package/lib/chunk-SBNDSKG5.mjs +136 -0
- package/lib/chunk-U6SO4QEV.mjs +320 -0
- package/lib/{chunk-APBWENF6.mjs → chunk-V3N3JEUF.mjs} +3 -3
- package/lib/chunk-XD6BJK6Q.mjs +351 -0
- package/lib/chunk-XVBFFVCJ.mjs +209 -0
- package/lib/chunk-YXSFGA2D.mjs +383 -0
- package/lib/clean-github-actions-caches.cjs +243 -148
- package/lib/clean-github-actions-caches.mjs +3 -2
- package/lib/del-gradle.cjs +2 -2
- package/lib/del-gradle.js +1 -1
- package/lib/del-gradle.mjs +2 -2
- package/lib/del-node-modules.cjs +2 -2
- package/lib/del-node-modules.js +1 -1
- package/lib/del-node-modules.mjs +2 -2
- package/lib/del-ps.cjs +29 -8
- package/lib/del-ps.js +2 -2
- package/lib/del-ps.mjs +7 -5
- package/lib/del-yarn-caches.cjs +26 -5
- package/lib/del-yarn-caches.js +38 -3
- package/lib/del-yarn-caches.mjs +6 -6
- package/lib/find-node-modules-cli.cjs +5 -4
- package/lib/find-node-modules-cli.js +1 -1
- package/lib/find-node-modules-cli.mjs +2 -2
- package/lib/find-node-modules.cjs +4 -3
- package/lib/{find-node-modules.d.ts → find-node-modules.d.cts} +1 -1
- package/lib/find-node-modules.mjs +2 -2
- package/lib/free-chatgpt.cjs +548 -0
- package/lib/free-chatgpt.js +51 -0
- package/lib/free-chatgpt.mjs +50 -0
- package/lib/git/gitattributes.cjs +1 -1
- package/lib/git/{gitattributes.d.mts → gitattributes.d.cts} +5 -7
- package/lib/git/gitattributes.mjs +2 -2
- package/lib/git/line-endings.cjs +297 -64
- package/lib/git/line-endings.mjs +4 -4
- package/lib/git/normalize.cjs +26 -36
- package/lib/git/normalize.mjs +2 -2
- package/lib/git/permissions.cjs +77 -11
- package/lib/git/permissions.mjs +3 -3
- package/lib/git/pull-strategy.cjs +76 -9
- package/lib/git/pull-strategy.mjs +3 -3
- package/lib/git/user-config.cjs +266 -83
- package/lib/git/user-config.mjs +4 -4
- package/lib/git/utils.cjs +40 -60
- package/lib/git/utils.mjs +2 -2
- package/lib/git-diff-cli.cjs +651 -0
- package/lib/git-diff-cli.d.ts +1 -0
- package/lib/git-diff-cli.js +15 -0
- package/lib/git-diff-cli.mjs +16 -0
- package/lib/git-diff.cjs +657 -58
- package/lib/git-diff.d.ts +38 -83
- package/lib/git-diff.js +152 -0
- package/lib/git-diff.mjs +23 -85
- package/lib/git-fix.cjs +685 -97
- package/lib/git-fix.mjs +14 -13
- package/lib/git-purge.cjs +3 -3
- package/lib/git-purge.d.cts +1 -0
- package/lib/git-purge.mjs +43 -37
- package/lib/index.cjs +7 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -5
- package/lib/index.mjs +4 -4
- package/lib/npm-run-series.cjs +3 -3
- package/lib/npm-run-series.mjs +42 -36
- package/lib/package-resolutions-updater.cjs +5 -5
- package/lib/package-resolutions-updater.mjs +266 -309
- package/lib/print-directory-tree.cjs +275 -210
- package/lib/print-directory-tree.mjs +2 -2
- package/lib/ps/connected-domain.cjs +25 -2
- package/lib/ps/connected-domain.d.ts +10 -2
- package/lib/ps/connected-domain.js +5 -2
- package/lib/ps/connected-domain.mjs +8 -4
- package/lib/ps/index.cjs +345 -322
- package/lib/ps/index.d.mjs +1 -1
- package/lib/ps/index.js +1 -1
- package/lib/ps/index.mjs +179 -182
- package/lib/ps/isWin.cjs +24 -1
- package/lib/ps/isWin.d.ts +1 -1
- package/lib/ps/isWin.js +3 -1
- package/lib/ps/isWin.mjs +8 -4
- package/lib/ps/table-parser.cjs +167 -159
- package/lib/ps/table-parser.d.ts +5 -0
- package/lib/ps/table-parser.js +10 -4
- package/lib/ps/table-parser.mjs +9 -5
- package/lib/remove-module.cjs +262 -0
- package/lib/remove-module.d.mts +1 -0
- package/lib/remove-module.mjs +111 -0
- package/lib/rmpath.cjs +274 -0
- package/lib/rmpath.d.mts +3 -0
- package/lib/rmpath.mjs +108 -0
- package/lib/submodule-install.cjs +264 -86
- package/lib/submodule-install.mjs +51 -3
- package/lib/submodule-remove-cli.cjs +103 -0
- package/lib/submodule-remove-cli.d.ts +1 -0
- package/lib/submodule-remove-cli.js +31 -0
- package/lib/submodule-remove-cli.mjs +28 -0
- package/lib/submodule-remove.cjs +43 -0
- package/lib/submodule-remove.d.cts +2 -0
- package/lib/submodule-remove.mjs +6 -0
- package/lib/utils/chatgpt.cjs +383 -0
- package/lib/utils/chatgpt.d.ts +31 -0
- package/lib/utils/chatgpt.js +541 -0
- package/lib/utils/chatgpt.mjs +8 -0
- package/lib/{utils.cjs → utils/index.cjs} +1 -1
- package/lib/{utils.mjs → utils/index.mjs} +2 -2
- package/lib/yarn-reinstall.cjs +172 -38
- package/lib/yarn-reinstall.mjs +2 -2
- package/package.json +91 -71
- package/readme.md +43 -69
- package/releases/readme.md +36 -0
- package/test/README.md +101 -0
- package/test/package.json +2 -1
- package/test-project/readme.md +26 -0
- package/tmp/test-repo/README.md +35 -0
- package/tmp/test-repo/package.json +1 -1
- package/tmp/typedoc/readme.md +320 -0
- package/bin/bash-dummy +0 -56
- package/bin/bash-dummy.cmd +0 -25
- package/bin/dir-tree.cmd +0 -7
- package/bin/git-diff +0 -4
- package/bin/git-diff.cmd +0 -7
- package/bin/git-fix +0 -36
- package/bin/git-fix.cmd +0 -7
- package/bin/rmpath +0 -70
- package/bin/submodule-install.txt +0 -118
- package/bin/submodule-remove +0 -46
- package/bin/submodule.txt +0 -172
- package/lib/binary-collections-config.d.mts +0 -18
- package/lib/binary-collections-config.js +0 -39
- package/lib/binary-collections.d.mts +0 -137
- package/lib/binary-collections.d.ts +0 -137
- package/lib/changelog.d.mts +0 -2
- package/lib/changelog.js +0 -226
- package/lib/chunk-DPKAJKFO.mjs +0 -171
- package/lib/chunk-G3THLIDT.mjs +0 -200
- package/lib/chunk-W3ENOM53.mjs +0 -18
- package/lib/clean-github-actions-caches.d.mts +0 -169
- package/lib/clean-github-actions-caches.d.ts +0 -169
- package/lib/del-gradle.d.mts +0 -2
- package/lib/del-node-modules.d.mts +0 -2
- package/lib/del-ps.d.mts +0 -2
- package/lib/del-yarn-caches.d.mts +0 -2
- package/lib/find-node-modules-cli.d.mts +0 -1
- package/lib/find-node-modules.d.mts +0 -13
- package/lib/find-node-modules.js +0 -53
- package/lib/git/line-endings.d.mts +0 -83
- package/lib/git/line-endings.d.ts +0 -83
- package/lib/git/normalize.d.mts +0 -43
- package/lib/git/normalize.d.ts +0 -43
- package/lib/git/permissions.d.mts +0 -17
- package/lib/git/permissions.d.ts +0 -17
- package/lib/git/pull-strategy.d.mts +0 -15
- package/lib/git/pull-strategy.d.ts +0 -15
- package/lib/git/user-config.d.mts +0 -105
- package/lib/git/user-config.d.ts +0 -105
- package/lib/git/utils.d.mts +0 -69
- package/lib/git/utils.d.ts +0 -69
- package/lib/git-diff.d.mts +0 -84
- package/lib/git-fix.d.mts +0 -141
- package/lib/git-fix.d.ts +0 -141
- package/lib/git-purge.d.mts +0 -2
- package/lib/git-purge.js +0 -59
- package/lib/index.d.mts +0 -1
- package/lib/npm-run-series.d.mts +0 -1
- package/lib/npm-run-series.d.ts +0 -2
- package/lib/npm-run-series.js +0 -86
- package/lib/package-resolutions-updater.d.ts +0 -352
- package/lib/print-directory-tree.d.mts +0 -234
- package/lib/print-directory-tree.d.ts +0 -234
- package/lib/ps/connected-domain.d.mts +0 -3
- package/lib/ps/index.d.d.mts +0 -26
- package/lib/ps/index.d.d.ts +0 -26
- package/lib/ps/index.d.mts +0 -26
- package/lib/ps/isWin.d.mts +0 -3
- package/lib/ps/table-parser.d.mts +0 -3
- package/lib/submodule-install.d.mts +0 -121
- package/lib/submodule-install.d.ts +0 -121
- package/lib/utils.d.mts +0 -40
- package/lib/utils.js +0 -181
- package/lib/yarn-reinstall.d.mts +0 -49
- package/lib/yarn-reinstall.d.ts +0 -49
- package/src/package-resolutions-updater.mjs +0 -350
- package/src/print-directory-tree.cjs +0 -234
- package/src/ps/index.js +0 -286
- package/src/yarn-reinstall.cjs +0 -49
- /package/{bin → binaries}/nodekill +0 -0
- /package/{bin → binaries}/nodekill.cmd +0 -0
- /package/lib/{binary-collections-config.d.ts → binary-collections-config.d.cts} +0 -0
- /package/lib/{changelog.d.ts → changelog.d.cts} +0 -0
- /package/lib/{git-purge.d.ts → free-chatgpt.d.ts} +0 -0
- /package/lib/{git-diff.d.cts → npm-run-series.d.cts} +0 -0
- /package/lib/{utils.d.ts → utils/index.d.cts} +0 -0
|
@@ -1,220 +1,286 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
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
|
-
});
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
4
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.map((e) => e.trim().replace(/^\./, ""))
|
|
49
|
-
.filter(Boolean);
|
|
50
|
-
}
|
|
51
|
-
// Directories to exclude
|
|
52
|
-
let excludeDirs = [
|
|
53
|
-
"node_modules",
|
|
54
|
-
"vendor",
|
|
55
|
-
"venv",
|
|
56
|
-
".venv",
|
|
57
|
-
".git",
|
|
58
|
-
".hg",
|
|
59
|
-
".svn",
|
|
60
|
-
".idea",
|
|
61
|
-
".vscode",
|
|
62
|
-
"dist",
|
|
63
|
-
"build",
|
|
64
|
-
"out",
|
|
65
|
-
"coverage",
|
|
66
|
-
".DS_Store"
|
|
67
|
-
];
|
|
68
|
-
if (argv.exclude) {
|
|
69
|
-
const userExcludes = argv.exclude
|
|
70
|
-
.split(",")
|
|
71
|
-
.map((d) => d.trim())
|
|
72
|
-
.filter(Boolean);
|
|
73
|
-
if (argv["override-exclude"] || argv.we) {
|
|
74
|
-
// Override the default excludes with user-provided ones
|
|
75
|
-
excludeDirs = userExcludes;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
// Append user-provided excludes to the default ones
|
|
79
|
-
excludeDirs = excludeDirs.concat(userExcludes);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Convert excludeDirs into glob ignore patterns
|
|
83
|
-
const ignorePatterns = excludeDirs.map((dir) => `**/${dir}/**`);
|
|
84
|
-
// Initialize an array to hold the formatted outputs
|
|
85
|
-
let hashArray = [];
|
|
86
|
-
// Helper function to hash and add file if not already processed
|
|
87
|
-
const processedFiles = new Set();
|
|
88
|
-
/**
|
|
89
|
-
* Hashes a file and pushes its relative path and hash to the hashArray.
|
|
90
|
-
* @param {string} file - The absolute path to the file.
|
|
91
|
-
* @returns {Promise<void>} Resolves when the file has been processed and added to hashArray.
|
|
92
|
-
*/
|
|
93
|
-
function hashAndPush(file) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
if (processedFiles.has(file))
|
|
96
|
-
return;
|
|
97
|
-
processedFiles.add(file);
|
|
98
|
-
let relativePath = path.relative(projectDir, file);
|
|
99
|
-
relativePath = relativePath.split(path.sep).join("/");
|
|
100
|
-
try {
|
|
101
|
-
const stats = yield fs.stat(file);
|
|
102
|
-
const pseudoHash = `${stats.size}-${stats.mtimeMs}`;
|
|
103
|
-
const hash = crypto.createHash("sha256").update(pseudoHash).digest("hex");
|
|
104
|
-
hashArray.push(`${relativePath} ${hash.slice(0, 8)}`);
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
console.error(`Error processing file: ${file}`, err instanceof Error ? err.message : "<unknown error>");
|
|
108
|
-
if (err && err.code === "ENOENT") {
|
|
109
|
-
hashArray.push(`${relativePath} <file not found>`);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
hashArray.push(`${relativePath} <error: ${err && err.code ? `code ${err.code}` : "unknown"}>`);
|
|
113
|
-
}
|
|
5
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
6
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// node_modules/tsup/assets/cjs_shims.js
|
|
10
|
+
var init_cjs_shims = __esm({
|
|
11
|
+
"node_modules/tsup/assets/cjs_shims.js"() {
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// src/utils/index.cjs
|
|
16
|
+
var require_utils = __commonJS({
|
|
17
|
+
"src/utils/index.cjs"(exports2, module2) {
|
|
18
|
+
init_cjs_shims();
|
|
19
|
+
var fs2 = require("fs");
|
|
20
|
+
var path2 = require("upath");
|
|
21
|
+
var argv2 = 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);
|
|
114
42
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
path.join(projectDir, "package.json"),
|
|
120
|
-
path.join(projectDir, "composer.json"),
|
|
121
|
-
path.join(projectDir, "requirements.txt")
|
|
122
|
-
];
|
|
123
|
-
let patterns = [];
|
|
124
|
-
if (argv.pattern) {
|
|
125
|
-
if (Array.isArray(argv.pattern)) {
|
|
126
|
-
patterns = argv.pattern.map((p) => p.trim()).filter(Boolean);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
patterns = [argv.pattern.trim()];
|
|
43
|
+
remotes[name] = repoPath;
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.error("URL Parsing Error:", e.message);
|
|
130
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;
|
|
65
|
+
function getArgs2() {
|
|
66
|
+
return argv2;
|
|
67
|
+
}
|
|
68
|
+
module2.exports.getArgs = getArgs2;
|
|
69
|
+
function del(fullPath) {
|
|
70
|
+
if (fs2.statSync(fullPath).isDirectory()) {
|
|
71
|
+
const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
72
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
73
|
+
del(subdir[i]);
|
|
131
74
|
}
|
|
132
|
-
|
|
133
|
-
|
|
75
|
+
} else {
|
|
76
|
+
try {
|
|
77
|
+
fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
78
|
+
console.log("deleted", fullPath);
|
|
79
|
+
} catch (_) {
|
|
80
|
+
console.log("failed delete", fullPath);
|
|
134
81
|
}
|
|
135
|
-
|
|
136
|
-
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
module2.exports.del = del;
|
|
85
|
+
function delStream(globStream) {
|
|
86
|
+
globStream.stream().on("data", (result) => {
|
|
87
|
+
const fullPath = path2.resolve(process.cwd(), result);
|
|
88
|
+
if (fs2.statSync(fullPath).isDirectory()) {
|
|
89
|
+
const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
90
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
91
|
+
del(subdir[i]);
|
|
92
|
+
}
|
|
137
93
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const hashMap = {};
|
|
159
|
-
for (const entry of hashArray) {
|
|
160
|
-
const [filePath, hash] = entry.split(" ");
|
|
161
|
-
hashMap[filePath] = hash;
|
|
162
|
-
const parts = filePath.split("/");
|
|
163
|
-
let current = tree;
|
|
164
|
-
for (let i = 0; i < parts.length; i++) {
|
|
165
|
-
const part = parts[i];
|
|
166
|
-
if (i === parts.length - 1) {
|
|
167
|
-
current[part] = null; // file
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
current[part] = current[part] || {};
|
|
171
|
-
current = current[part];
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Recursively builds the tree string for a given node.
|
|
177
|
-
*
|
|
178
|
-
* @param {Object} node - The current node in the tree.
|
|
179
|
-
* @param {string} prefix - The prefix for the current tree level.
|
|
180
|
-
* @param {string} parentPath - The path to the current node.
|
|
181
|
-
* @returns {string[]} Array of lines representing the tree structure.
|
|
182
|
-
*/
|
|
183
|
-
function printNode(node, prefix = "", parentPath = "") {
|
|
184
|
-
const keys = Object.keys(node).sort();
|
|
185
|
-
let lines = [];
|
|
186
|
-
keys.forEach((key, idx) => {
|
|
187
|
-
const isLast = idx === keys.length - 1;
|
|
188
|
-
const branch = isLast ? "└── " : "├── ";
|
|
189
|
-
const currentPath = parentPath ? parentPath + "/" + key : key;
|
|
190
|
-
if (node[key] === null) {
|
|
191
|
-
// file: show hash
|
|
192
|
-
lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
lines.push(prefix + branch + key + "/");
|
|
196
|
-
lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "│ "), currentPath));
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
return lines;
|
|
200
|
-
}
|
|
201
|
-
return printNode(tree, "", "").join("\n");
|
|
94
|
+
del(fullPath);
|
|
95
|
+
});
|
|
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
|
+
}
|
|
202
114
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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;
|
|
135
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
136
|
+
module2.exports.delay = delay;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// src/print-directory-tree.cjs
|
|
141
|
+
init_cjs_shims();
|
|
142
|
+
var fs = require("fs").promises;
|
|
143
|
+
var path = require("path");
|
|
144
|
+
var crypto = require("crypto");
|
|
145
|
+
var { execSync } = require("child_process");
|
|
146
|
+
var glob = require("glob");
|
|
147
|
+
var { getArgs } = require_utils();
|
|
148
|
+
var sbgUtil = require("sbg-utility");
|
|
149
|
+
var dotenv = require("dotenv");
|
|
150
|
+
var projectDir = process.cwd();
|
|
151
|
+
var envPath = path.join(projectDir, ".env");
|
|
152
|
+
if (fs.existsSync(envPath)) dotenv.config({ path: envPath });
|
|
153
|
+
var argv = getArgs();
|
|
154
|
+
async function main() {
|
|
155
|
+
let relativeOutputFile = "tmp/directory-structure.txt";
|
|
156
|
+
if (argv.output || argv.o) {
|
|
157
|
+
relativeOutputFile = argv.output || argv.o;
|
|
158
|
+
}
|
|
159
|
+
const outputFile = path.isAbsolute(relativeOutputFile) ? relativeOutputFile : path.join(projectDir, relativeOutputFile);
|
|
160
|
+
sbgUtil.writefile(outputFile, "");
|
|
161
|
+
let extensions = [];
|
|
162
|
+
if (argv.ext) {
|
|
163
|
+
extensions = argv.ext.split(",").map((e) => e.trim().replace(/^\./, "")).filter(Boolean);
|
|
164
|
+
}
|
|
165
|
+
let excludeDirs = [
|
|
166
|
+
"node_modules",
|
|
167
|
+
"vendor",
|
|
168
|
+
"venv",
|
|
169
|
+
".venv",
|
|
170
|
+
".git",
|
|
171
|
+
".hg",
|
|
172
|
+
".svn",
|
|
173
|
+
".idea",
|
|
174
|
+
".vscode",
|
|
175
|
+
"dist",
|
|
176
|
+
"build",
|
|
177
|
+
"out",
|
|
178
|
+
"coverage",
|
|
179
|
+
".DS_Store"
|
|
180
|
+
];
|
|
181
|
+
if (argv.exclude) {
|
|
182
|
+
const userExcludes = argv.exclude.split(",").map((d) => d.trim()).filter(Boolean);
|
|
183
|
+
if (argv["override-exclude"] || argv.we) {
|
|
184
|
+
excludeDirs = userExcludes;
|
|
185
|
+
} else {
|
|
186
|
+
excludeDirs = excludeDirs.concat(userExcludes);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const ignorePatterns = excludeDirs.map((dir) => `**/${dir}/**`);
|
|
190
|
+
let hashArray = [];
|
|
191
|
+
const processedFiles = /* @__PURE__ */ new Set();
|
|
192
|
+
async function hashAndPush(file) {
|
|
193
|
+
if (processedFiles.has(file)) return;
|
|
194
|
+
processedFiles.add(file);
|
|
195
|
+
let relativePath = path.relative(projectDir, file);
|
|
196
|
+
relativePath = relativePath.split(path.sep).join("/");
|
|
197
|
+
try {
|
|
198
|
+
const stats = await fs.stat(file);
|
|
199
|
+
const pseudoHash = `${stats.size}-${stats.mtimeMs}`;
|
|
200
|
+
const hash = crypto.createHash("sha256").update(pseudoHash).digest("hex");
|
|
201
|
+
hashArray.push(`${relativePath} ${hash.slice(0, 8)}`);
|
|
202
|
+
} catch (err) {
|
|
203
|
+
console.error(`Error processing file: ${file}`, err instanceof Error ? err.message : "<unknown error>");
|
|
204
|
+
if (err && err.code === "ENOENT") {
|
|
205
|
+
hashArray.push(`${relativePath} <file not found>`);
|
|
206
|
+
} else {
|
|
207
|
+
hashArray.push(`${relativePath} <error: ${err && err.code ? `code ${err.code}` : "unknown"}>`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const initialFiles = [
|
|
212
|
+
path.join(projectDir, "package.json"),
|
|
213
|
+
path.join(projectDir, "composer.json"),
|
|
214
|
+
path.join(projectDir, "requirements.txt")
|
|
215
|
+
];
|
|
216
|
+
let patterns = [];
|
|
217
|
+
if (argv.pattern) {
|
|
218
|
+
if (Array.isArray(argv.pattern)) {
|
|
219
|
+
patterns = argv.pattern.map((p) => p.trim()).filter(Boolean);
|
|
220
|
+
} else {
|
|
221
|
+
patterns = [argv.pattern.trim()];
|
|
222
|
+
}
|
|
223
|
+
} else if (extensions.length === 0) {
|
|
224
|
+
patterns = ["**/*.*"];
|
|
225
|
+
} else {
|
|
226
|
+
patterns = extensions.map((ext) => `**/*.${ext}`);
|
|
227
|
+
}
|
|
228
|
+
const globFiles = glob.sync(patterns.length === 1 ? patterns[0] : `{${patterns.join(",")}}`, {
|
|
229
|
+
cwd: projectDir,
|
|
230
|
+
ignore: ignorePatterns,
|
|
231
|
+
absolute: true,
|
|
232
|
+
nodir: true
|
|
233
|
+
});
|
|
234
|
+
const allFiles = /* @__PURE__ */ new Set([...initialFiles, ...globFiles]);
|
|
235
|
+
await Promise.all(Array.from(allFiles).map(hashAndPush));
|
|
236
|
+
hashArray.sort((a, b) => a.localeCompare(b));
|
|
237
|
+
function getFileTreeString(hashArray2) {
|
|
238
|
+
const tree = {};
|
|
239
|
+
const hashMap = {};
|
|
240
|
+
for (const entry of hashArray2) {
|
|
241
|
+
const [filePath, hash] = entry.split(" ");
|
|
242
|
+
hashMap[filePath] = hash;
|
|
243
|
+
const parts = filePath.split("/");
|
|
244
|
+
let current = tree;
|
|
245
|
+
for (let i = 0; i < parts.length; i++) {
|
|
246
|
+
const part = parts[i];
|
|
247
|
+
if (i === parts.length - 1) {
|
|
248
|
+
current[part] = null;
|
|
249
|
+
} else {
|
|
250
|
+
current[part] = current[part] || {};
|
|
251
|
+
current = current[part];
|
|
210
252
|
}
|
|
211
|
-
|
|
212
|
-
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function printNode(node, prefix = "", parentPath = "") {
|
|
256
|
+
const keys = Object.keys(node).sort();
|
|
257
|
+
let lines = [];
|
|
258
|
+
keys.forEach((key, idx) => {
|
|
259
|
+
const isLast = idx === keys.length - 1;
|
|
260
|
+
const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
261
|
+
const currentPath = parentPath ? parentPath + "/" + key : key;
|
|
262
|
+
if (node[key] === null) {
|
|
263
|
+
lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
|
|
264
|
+
} else {
|
|
265
|
+
lines.push(prefix + branch + key + "/");
|
|
266
|
+
lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
|
|
213
267
|
}
|
|
214
|
-
|
|
268
|
+
});
|
|
269
|
+
return lines;
|
|
270
|
+
}
|
|
271
|
+
return printNode(tree, "", "").join("\n");
|
|
272
|
+
}
|
|
273
|
+
const fileTreeString = getFileTreeString(hashArray);
|
|
274
|
+
await fs.writeFile(outputFile, fileTreeString + "\n", "utf-8");
|
|
275
|
+
if (argv["git-add"]) {
|
|
276
|
+
execSync(`git add ${relativeOutputFile}`);
|
|
277
|
+
console.log(`Directory tree written to ${relativeOutputFile} and staged for git.`);
|
|
278
|
+
} else {
|
|
279
|
+
console.log(`Directory tree written to ${relativeOutputFile}.`);
|
|
280
|
+
}
|
|
215
281
|
}
|
|
216
282
|
if (argv.help || argv.h) {
|
|
217
|
-
|
|
283
|
+
console.log(`
|
|
218
284
|
Usage: node print-directory-tree.cjs [options]
|
|
219
285
|
|
|
220
286
|
Options:
|
|
@@ -232,10 +298,9 @@ Examples:
|
|
|
232
298
|
node print-directory-tree.cjs --exclude=dist,build
|
|
233
299
|
node print-directory-tree.cjs --output=tmp/tree.txt
|
|
234
300
|
`);
|
|
235
|
-
|
|
301
|
+
process.exit(0);
|
|
236
302
|
}
|
|
237
|
-
// Execute the main function
|
|
238
303
|
main().catch((err) => {
|
|
239
|
-
|
|
240
|
-
|
|
304
|
+
console.error(err);
|
|
305
|
+
process.exit(1);
|
|
241
306
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_utils
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-V3N3JEUF.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__require,
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
10
10
|
|
|
11
11
|
// src/print-directory-tree.cjs
|
|
12
12
|
var require_print_directory_tree = __commonJS({
|
|
@@ -1,5 +1,28 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
1
19
|
// src/ps/connected-domain.js
|
|
2
|
-
|
|
20
|
+
var connected_domain_exports = {};
|
|
21
|
+
__export(connected_domain_exports, {
|
|
22
|
+
default: () => connected_domain_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(connected_domain_exports);
|
|
25
|
+
function connected_domain_default(tdArray, indicator, hardlink) {
|
|
3
26
|
hardlink = hardlink || false;
|
|
4
27
|
if (!tdArray) {
|
|
5
28
|
throw new Error("tdArray must be provided");
|
|
@@ -153,4 +176,4 @@ module.exports = function(tdArray, indicator, hardlink) {
|
|
|
153
176
|
}
|
|
154
177
|
}
|
|
155
178
|
return result;
|
|
156
|
-
}
|
|
179
|
+
}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* calculate all the connected domains based on the given two-dimensional array
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @param {Array} tdArray
|
|
6
|
+
* @param {Function} indicator It receive the raw point data as the first parameter and decide what kind of domain the point belongs to, it should return a string as a domain identifier.
|
|
7
|
+
* @param {Boolean} hardlink If use hard link. Default to false.
|
|
8
|
+
* @return {Object} [{ bounding: { w: 12, h: 19, x: 0, y: 1 }, points: [ { x: 1, y: 2, point: {} } ], identifier: 'blue', domainId: 1 } ]
|
|
9
|
+
*/
|
|
10
|
+
export default function _default(tdArray: any[], indicator: Function, hardlink: boolean): any;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* calculate all the connected domains based on the given two-dimensional array
|
|
3
4
|
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = default_1;
|
|
4
7
|
/**
|
|
5
8
|
* @param {Array} tdArray
|
|
6
9
|
* @param {Function} indicator It receive the raw point data as the first parameter and decide what kind of domain the point belongs to, it should return a string as a domain identifier.
|
|
7
10
|
* @param {Boolean} hardlink If use hard link. Default to false.
|
|
8
11
|
* @return {Object} [{ bounding: { w: 12, h: 19, x: 0, y: 1 }, points: [ { x: 1, y: 2, point: {} } ], identifier: 'blue', domainId: 1 } ]
|
|
9
12
|
*/
|
|
10
|
-
|
|
13
|
+
function default_1(tdArray, indicator, hardlink) {
|
|
11
14
|
hardlink = hardlink || false;
|
|
12
15
|
if (!tdArray) {
|
|
13
16
|
throw new Error("tdArray must be provided");
|
|
@@ -199,4 +202,4 @@ module.exports = function (tdArray, indicator, hardlink) {
|
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
204
|
return result;
|
|
202
|
-
}
|
|
205
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
connected_domain_default,
|
|
4
|
+
init_connected_domain
|
|
5
|
+
} from "../chunk-FKI7IEB5.mjs";
|
|
6
|
+
import "../chunk-QQ4A6DLD.mjs";
|
|
7
|
+
init_connected_domain();
|
|
8
|
+
export {
|
|
9
|
+
connected_domain_default as default
|
|
10
|
+
};
|