binary-collections 2.0.14 → 2.0.15
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/.opencode/plugins/opencode-request-logger/README.md +44 -0
- package/.venv/Lib/site-packages/pyarrow/tests/data/orc/README.md +22 -0
- package/docs-src/install-opencode-plugins.md +86 -0
- package/docs-src/opencode-cli.md +38 -10
- package/lib/binary-collections/config-types.cjs +17 -0
- package/lib/binary-collections/config-types.d.ts +12 -0
- package/lib/binary-collections/config-types.js +2 -0
- package/lib/binary-collections/config-types.mjs +7 -0
- package/lib/binary-collections/config.cjs +16 -8
- package/lib/binary-collections/config.d.cts +18 -10
- package/lib/binary-collections/config.mjs +1 -1
- package/lib/binary-collections/findScript.cjs +8 -6
- package/lib/binary-collections/findScript.mjs +2 -2
- package/lib/binary-collections/listScript.cjs +8 -6
- package/lib/binary-collections/listScript.mjs +2 -2
- package/lib/binary-collections.cjs +8 -6
- package/lib/binary-collections.mjs +3 -3
- package/lib/changelog.cjs +142 -4
- package/lib/changelog.mjs +9 -5
- package/lib/{chunk-SARIXFHP.mjs → chunk-3T6AMFI3.mjs} +16 -8
- package/lib/{chunk-3F6EIHYG.mjs → chunk-3ZF2QMDK.mjs} +3 -3
- package/lib/chunk-B77D3SR4.mjs +28 -0
- package/lib/chunk-BPED62FN.mjs +115 -0
- package/lib/{chunk-XI67TI46.mjs → chunk-DHFRWM2W.mjs} +1 -1
- package/lib/{chunk-2SJKVOTN.mjs → chunk-DPEE3FBB.mjs} +1 -1
- package/lib/{chunk-UYNBNLV5.mjs → chunk-H7AE4IO3.mjs} +1 -1
- package/lib/{chunk-YWSLMAQ7.mjs → chunk-KCJYREA2.mjs} +14 -12
- package/lib/{chunk-JK3MG2KF.mjs → chunk-NHD4HLSU.mjs} +1 -1
- package/lib/{chunk-I3O5ZRYU.mjs → chunk-OWNVMKAA.mjs} +1 -1
- package/lib/chunk-SKVF4TMD.mjs +59 -0
- package/lib/{chunk-SJYP66BO.mjs → chunk-TDUUOAQD.mjs} +1 -1
- package/lib/{chunk-D42YBRZW.mjs → chunk-UAEKSLAX.mjs} +1 -1
- package/lib/chunk-V6PTSDW5.mjs +82 -0
- package/lib/{chunk-AJ3OIYYP.mjs → chunk-WNUEY6VJ.mjs} +8 -6
- package/lib/{chunk-YLV4QATP.mjs → chunk-Z53IUBUN.mjs} +6 -5
- package/lib/{chunk-JMUFQSPE.mjs → chunk-Z7RM46Q4.mjs} +1 -1
- package/lib/cross-env/index.mjs +3 -3
- package/lib/git/git-diff-cli.cjs +16 -8
- package/lib/git/git-diff-cli.mjs +3 -3
- package/lib/git/git-diff.cjs +16 -8
- package/lib/git/git-diff.mjs +3 -3
- package/lib/git/git-fix.cjs +16 -8
- package/lib/git/git-fix.mjs +2 -2
- package/lib/git/user-config.cjs +16 -8
- package/lib/git/user-config.mjs +2 -2
- package/lib/github-workflows/clean-github-actions-caches-cli.cjs +16 -8
- package/lib/github-workflows/clean-github-actions-caches-cli.mjs +2 -2
- package/lib/github-workflows/clean-github-actions-caches.cjs +16 -8
- package/lib/github-workflows/clean-github-actions-caches.mjs +2 -2
- package/lib/github-workflows/get-latest-workflow-status-cli.cjs +16 -8
- package/lib/github-workflows/get-latest-workflow-status-cli.mjs +2 -2
- package/lib/github-workflows/utils.cjs +16 -8
- package/lib/github-workflows/utils.mjs +2 -2
- package/lib/github-workflows/workflow-badge-cli.cjs +16 -8
- package/lib/github-workflows/workflow-badge-cli.mjs +4 -4
- package/lib/node-cache-cleaner-cli.mjs +3 -3
- package/lib/opencode/cli/auth-rotate.cjs +343 -28
- package/lib/opencode/cli/auth-rotate.d.ts +3 -1
- package/lib/opencode/cli/auth-rotate.js +10 -15
- package/lib/opencode/cli/auth-rotate.mjs +6 -2
- package/lib/opencode/cli/auth-rotate.runner.cjs +454 -0
- package/lib/opencode/cli/auth-rotate.runner.d.ts +1 -0
- package/lib/opencode/cli/auth-rotate.runner.js +8 -0
- package/lib/opencode/cli/auth-rotate.runner.mjs +21 -0
- package/lib/opencode/install-opencode-plugins-cli.cjs +82 -0
- package/lib/opencode/install-opencode-plugins-cli.d.ts +1 -0
- package/lib/opencode/install-opencode-plugins-cli.js +78 -0
- package/lib/opencode/install-opencode-plugins-cli.mjs +65 -0
- package/lib/opencode/utils/check-api.cjs +332 -18
- package/lib/opencode/utils/check-api.d.ts +5 -1
- package/lib/opencode/utils/check-api.js +101 -15
- package/lib/opencode/utils/check-api.mjs +5 -1
- package/lib/opencode/utils/check-api.runner.cjs +0 -0
- package/lib/opencode/utils/check-api.runner.d.ts +0 -0
- package/lib/opencode/utils/check-api.runner.js +1 -0
- package/lib/opencode/utils/check-api.runner.mjs +7 -0
- package/lib/opencode-cli.cjs +352 -29
- package/lib/opencode-cli.js +3 -2
- package/lib/opencode-cli.mjs +11 -6
- package/lib/package-resolutions-updater-cli.cjs +16 -8
- package/lib/package-resolutions-updater-cli.mjs +2 -2
- package/lib/package-resolutions-updater.cjs +16 -8
- package/lib/package-resolutions-updater.mjs +2 -2
- package/lib/print-directory-tree.cjs +16 -8
- package/lib/print-directory-tree.mjs +1 -1
- package/lib/print-tarball-tree-cli.cjs +305 -0
- package/lib/print-tarball-tree-cli.d.mts +2 -0
- package/lib/print-tarball-tree-cli.mjs +54 -0
- package/lib/print-tarball-tree.cjs +43 -216
- package/lib/print-tarball-tree.d.mts +4 -1
- package/lib/print-tarball-tree.mjs +12 -66
- package/lib/rmpath-cli.cjs +16 -8
- package/lib/rmpath-cli.mjs +2 -2
- package/lib/rmpath.cjs +16 -8
- package/lib/rmpath.mjs +2 -2
- package/lib/run-by-checksum/hash.cjs +45 -67
- package/lib/run-by-checksum/{hash.d.ts → hash.d.cts} +9 -2
- package/lib/run-by-checksum/hash.mjs +3 -7
- package/lib/run-by-checksum/run.cjs +95 -58
- package/lib/run-by-checksum/run.js +3 -3
- package/lib/run-by-checksum/run.mjs +2 -2
- package/lib/run-by-checksum-cli.cjs +96 -74
- package/lib/run-by-checksum-cli.mjs +2 -2
- package/lib/submodule-install.cjs +16 -8
- package/lib/submodule-install.mjs +1 -1
- package/lib/submodule-remove-cli.cjs +16 -8
- package/lib/submodule-remove-cli.mjs +2 -2
- package/lib/submodule-remove.cjs +16 -8
- package/lib/submodule-remove.mjs +2 -2
- package/lib/utils/isDebug.cjs +13 -0
- package/lib/utils/isDebug.d.cts +9 -0
- package/lib/utils/isDebug.mjs +6 -0
- package/package.json +9 -7
- package/readme.md +63 -0
- package/releases/readme.md +1 -1
- package/lib/chunk-546KAIYT.mjs +0 -113
- package/lib/chunk-5WAOOOGZ.mjs +0 -77
- package/lib/chunk-72XTQ3CK.mjs +0 -45
- package/lib/chunk-7Q6YEUQF.mjs +0 -246
- package/lib/chunk-AQZ7LMFS.mjs +0 -100
- package/lib/chunk-BDCMTOZI.mjs +0 -246
- package/lib/chunk-BEUM4LH4.mjs +0 -184
- package/lib/chunk-BO4TZS4Q.mjs +0 -246
- package/lib/chunk-BZWVHODJ.mjs +0 -62
- package/lib/chunk-CM3IC5YC.mjs +0 -226
- package/lib/chunk-FR3DMHJC.mjs +0 -146
- package/lib/chunk-H44UWUFY.mjs +0 -105
- package/lib/chunk-JVMLKHD2.mjs +0 -62
- package/lib/chunk-KAT2JNLZ.mjs +0 -146
- package/lib/chunk-KRCPFWIF.mjs +0 -193
- package/lib/chunk-LVSPEFU2.mjs +0 -86
- package/lib/chunk-MCCMMZSM.mjs +0 -60
- package/lib/chunk-MGPYPKIE.mjs +0 -109
- package/lib/chunk-OA2RKEY3.mjs +0 -162
- package/lib/chunk-PAZH45HS.mjs +0 -41
- package/lib/chunk-QZMGBDSA.mjs +0 -32
- package/lib/chunk-RDGDLSPD.mjs +0 -76
- package/lib/chunk-RKPIBGKE.mjs +0 -61
- package/lib/chunk-SWUAEY4H.mjs +0 -44
- package/lib/chunk-UAIF5VIA.mjs +0 -89
- package/lib/chunk-UHPFLJXH.mjs +0 -227
- package/lib/chunk-WOC4FZ6F.mjs +0 -164
- package/lib/chunk-WSHVPGNM.mjs +0 -44
- package/lib/run-by-checksum/hash.js +0 -119
- package/readme.html +0 -784
|
@@ -4,6 +4,12 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
7
13
|
var __export = (target, all) => {
|
|
8
14
|
for (var name in all)
|
|
9
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -26,69 +32,100 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
32
|
));
|
|
27
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
34
|
|
|
35
|
+
// node_modules/tsup/assets/cjs_shims.js
|
|
36
|
+
var init_cjs_shims = __esm({
|
|
37
|
+
"node_modules/tsup/assets/cjs_shims.js"() {
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// src/run-by-checksum/hash.cjs
|
|
42
|
+
var require_hash = __commonJS({
|
|
43
|
+
"src/run-by-checksum/hash.cjs"(exports2, module2) {
|
|
44
|
+
init_cjs_shims();
|
|
45
|
+
var fs2 = require("fs-extra");
|
|
46
|
+
var glob = require("glob");
|
|
47
|
+
var path2 = require("upath");
|
|
48
|
+
var CryptoJS = require("crypto-js");
|
|
49
|
+
var globSync = typeof glob.sync === "function" ? glob.sync : glob.globSync;
|
|
50
|
+
function getAllFiles2({ patterns = [], ignore = [], cwd } = {}) {
|
|
51
|
+
const files = /* @__PURE__ */ new Set();
|
|
52
|
+
const root = path2.resolve(cwd || process.cwd());
|
|
53
|
+
for (const pattern of patterns) {
|
|
54
|
+
const matched = globSync(pattern, {
|
|
55
|
+
cwd: root,
|
|
56
|
+
nodir: true,
|
|
57
|
+
ignore,
|
|
58
|
+
absolute: false
|
|
59
|
+
});
|
|
60
|
+
for (const f of matched) {
|
|
61
|
+
files.add(path2.normalize(path2.resolve(root, f)));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return Array.from(files).sort();
|
|
65
|
+
}
|
|
66
|
+
function isBinaryFile(filePath, bytesToCheck = 8e3) {
|
|
67
|
+
const size = Math.max(0, Number(bytesToCheck) || 0);
|
|
68
|
+
if (size === 0) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const fd = fs2.openSync(filePath, "r");
|
|
72
|
+
try {
|
|
73
|
+
const buffer = Buffer.allocUnsafe(size);
|
|
74
|
+
const bytesRead = fs2.readSync(fd, buffer, 0, size, 0);
|
|
75
|
+
for (let i = 0; i < bytesRead; i++) {
|
|
76
|
+
if (buffer[i] === 0) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
} finally {
|
|
82
|
+
fs2.closeSync(fd);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function hashFile(file) {
|
|
86
|
+
if (!isBinaryFile(file)) {
|
|
87
|
+
const content = fs2.readFileSync(file, "utf8");
|
|
88
|
+
const normalized = content.replace(/\s+/g, " ").trim();
|
|
89
|
+
return CryptoJS.SHA256(normalized).toString(CryptoJS.enc.Hex);
|
|
90
|
+
}
|
|
91
|
+
const stats = fs2.statSync(file);
|
|
92
|
+
const binHash = CryptoJS.algo.SHA256.create();
|
|
93
|
+
binHash.update(file);
|
|
94
|
+
binHash.update(String(stats.size));
|
|
95
|
+
return binHash.finalize().toString(CryptoJS.enc.Hex);
|
|
96
|
+
}
|
|
97
|
+
function buildChecksum2(files = []) {
|
|
98
|
+
const hash = CryptoJS.algo.SHA256.create();
|
|
99
|
+
for (const file of files) {
|
|
100
|
+
hash.update(file);
|
|
101
|
+
hash.update(hashFile(file));
|
|
102
|
+
}
|
|
103
|
+
return hash.finalize().toString(CryptoJS.enc.Hex);
|
|
104
|
+
}
|
|
105
|
+
function sha256(data, trim = 128) {
|
|
106
|
+
const hash = CryptoJS.SHA256(String(data)).toString(CryptoJS.enc.Hex);
|
|
107
|
+
return trim ? hash.substring(0, trim) : hash;
|
|
108
|
+
}
|
|
109
|
+
module2.exports = { getAllFiles: getAllFiles2, buildChecksum: buildChecksum2, sha256 };
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
29
113
|
// src/run-by-checksum/run.js
|
|
30
114
|
var run_exports = {};
|
|
31
115
|
__export(run_exports, {
|
|
32
116
|
runChecksum: () => runChecksum
|
|
33
117
|
});
|
|
34
118
|
module.exports = __toCommonJS(run_exports);
|
|
119
|
+
init_cjs_shims();
|
|
120
|
+
var import_hash = __toESM(require_hash(), 1);
|
|
35
121
|
|
|
36
|
-
// src/run-by-checksum/
|
|
122
|
+
// src/run-by-checksum/cache.js
|
|
123
|
+
init_cjs_shims();
|
|
37
124
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
38
|
-
var glob = __toESM(require("glob"), 1);
|
|
39
125
|
var import_upath = __toESM(require("upath"), 1);
|
|
40
|
-
var import_upath2 = __toESM(require("upath"), 1);
|
|
41
126
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
42
|
-
function getAllFiles({ patterns, ignore, cwd }) {
|
|
43
|
-
const files = /* @__PURE__ */ new Set();
|
|
44
|
-
const root = cwd || process.cwd();
|
|
45
|
-
for (const pattern of patterns) {
|
|
46
|
-
const matched = glob.sync(pattern, {
|
|
47
|
-
cwd: root,
|
|
48
|
-
nodir: true,
|
|
49
|
-
ignore
|
|
50
|
-
});
|
|
51
|
-
for (const f of matched) {
|
|
52
|
-
files.add(import_upath.default.normalize(import_upath2.default.resolve(root, f)));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return [...files].sort();
|
|
56
|
-
}
|
|
57
|
-
function isBinaryFile(filePath, bytesToCheck = 8e3) {
|
|
58
|
-
const buffer = import_fs_extra.default.readFileSync(filePath, { length: bytesToCheck });
|
|
59
|
-
for (let i = 0; i < buffer.length; i++) {
|
|
60
|
-
if (buffer[i] === 0) {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
function hashFile(file) {
|
|
67
|
-
const isBin = isBinaryFile(file);
|
|
68
|
-
if (!isBin) {
|
|
69
|
-
const content = import_fs_extra.default.readFileSync(file, { encoding: "utf-8" });
|
|
70
|
-
const normalized = content.toString().replace(/\s+/g, " ").trim();
|
|
71
|
-
return import_crypto.default.createHash("sha256").update(normalized).digest("hex");
|
|
72
|
-
} else {
|
|
73
|
-
const stats = import_fs_extra.default.statSync(file);
|
|
74
|
-
return import_crypto.default.createHash("sha256").update(file).update(String(stats.size)).digest("hex");
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function buildChecksum(files) {
|
|
78
|
-
const hash = import_crypto.default.createHash("sha256");
|
|
79
|
-
for (const file of files) {
|
|
80
|
-
hash.update(file);
|
|
81
|
-
hash.update(hashFile(file));
|
|
82
|
-
}
|
|
83
|
-
return hash.digest("hex");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// src/run-by-checksum/cache.js
|
|
87
|
-
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
88
|
-
var import_upath3 = __toESM(require("upath"), 1);
|
|
89
|
-
var import_crypto2 = __toESM(require("crypto"), 1);
|
|
90
127
|
function md5(str) {
|
|
91
|
-
return
|
|
128
|
+
return import_crypto.default.createHash("md5").update(str).digest("hex");
|
|
92
129
|
}
|
|
93
130
|
function getCacheFile({ patterns, ignore, cwd }) {
|
|
94
131
|
const root = cwd || process.env.INIT_CWD || process.cwd();
|
|
@@ -98,18 +135,18 @@ function getCacheFile({ patterns, ignore, cwd }) {
|
|
|
98
135
|
ignore: [...ignore].sort()
|
|
99
136
|
})
|
|
100
137
|
);
|
|
101
|
-
return
|
|
138
|
+
return import_upath.default.join(root, "tmp", ".checksum", `${key}.json`);
|
|
102
139
|
}
|
|
103
140
|
function loadCache(file) {
|
|
104
141
|
try {
|
|
105
|
-
return
|
|
142
|
+
return import_fs_extra.default.readJsonSync(file);
|
|
106
143
|
} catch {
|
|
107
144
|
return null;
|
|
108
145
|
}
|
|
109
146
|
}
|
|
110
147
|
function saveCache(file, data) {
|
|
111
|
-
|
|
112
|
-
|
|
148
|
+
import_fs_extra.default.ensureDirSync(import_upath.default.dirname(file));
|
|
149
|
+
import_fs_extra.default.writeJsonSync(file, data, { spaces: 2 });
|
|
113
150
|
}
|
|
114
151
|
|
|
115
152
|
// src/run-by-checksum/run.js
|
|
@@ -133,8 +170,8 @@ async function runChecksum({
|
|
|
133
170
|
console.log("No patterns provided, skipping checksum runner.");
|
|
134
171
|
process.exit(1);
|
|
135
172
|
}
|
|
136
|
-
const files = getAllFiles({ patterns, ignore, cwd });
|
|
137
|
-
const checksum = buildChecksum(files);
|
|
173
|
+
const files = (0, import_hash.getAllFiles)({ patterns, ignore, cwd });
|
|
174
|
+
const checksum = (0, import_hash.buildChecksum)(files);
|
|
138
175
|
const cacheFile = getCacheFile({ patterns, ignore, cwd });
|
|
139
176
|
const cache = loadCache(cacheFile);
|
|
140
177
|
if ((cache == null ? void 0 : cache.checksum) === checksum) {
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.runChecksum = runChecksum;
|
|
13
|
-
const
|
|
13
|
+
const hash_cjs_1 = require("./hash.cjs");
|
|
14
14
|
const cache_js_1 = require("./cache.js");
|
|
15
15
|
const child_process_1 = require("child_process");
|
|
16
16
|
/**
|
|
@@ -37,8 +37,8 @@ function runChecksum(_a) {
|
|
|
37
37
|
console.log('No patterns provided, skipping checksum runner.');
|
|
38
38
|
process.exit(1);
|
|
39
39
|
}
|
|
40
|
-
const files = (0,
|
|
41
|
-
const checksum = (0,
|
|
40
|
+
const files = (0, hash_cjs_1.getAllFiles)({ patterns, ignore, cwd });
|
|
41
|
+
const checksum = (0, hash_cjs_1.buildChecksum)(files);
|
|
42
42
|
const cacheFile = (0, cache_js_1.getCacheFile)({ patterns, ignore, cwd });
|
|
43
43
|
const cache = (0, cache_js_1.loadCache)(cacheFile);
|
|
44
44
|
if ((cache === null || cache === void 0 ? void 0 : cache.checksum) === checksum) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
runChecksum
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-Z53IUBUN.mjs";
|
|
5
5
|
import "../chunk-QD4T255Z.mjs";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-V6PTSDW5.mjs";
|
|
7
7
|
import "../chunk-QQ4A6DLD.mjs";
|
|
8
8
|
export {
|
|
9
9
|
runChecksum
|
|
@@ -38,8 +38,8 @@ var init_cjs_shims = __esm({
|
|
|
38
38
|
var require_utils = __commonJS({
|
|
39
39
|
"src/utils/index.cjs"(exports2, module2) {
|
|
40
40
|
init_cjs_shims();
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var fs2 = require("fs");
|
|
42
|
+
var path2 = require("upath");
|
|
43
43
|
var minimistLib = require("minimist");
|
|
44
44
|
var argv2 = minimistLib(process.argv.slice(2));
|
|
45
45
|
var { exec } = require("child_process");
|
|
@@ -85,11 +85,11 @@ var require_utils = __commonJS({
|
|
|
85
85
|
module2.exports.getArgs = getArgs2;
|
|
86
86
|
function del(fullPath) {
|
|
87
87
|
try {
|
|
88
|
-
if (!
|
|
89
|
-
const stat =
|
|
88
|
+
if (!fs2.existsSync(fullPath)) return;
|
|
89
|
+
const stat = fs2.lstatSync(fullPath);
|
|
90
90
|
if (stat.isSymbolicLink()) {
|
|
91
91
|
try {
|
|
92
|
-
|
|
92
|
+
fs2.unlinkSync(fullPath);
|
|
93
93
|
console.log("deleted symlink", fullPath);
|
|
94
94
|
} catch (e) {
|
|
95
95
|
console.log("failed delete symlink", fullPath, e && e.message);
|
|
@@ -97,16 +97,16 @@ var require_utils = __commonJS({
|
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
if (stat.isDirectory()) {
|
|
100
|
-
const subdir =
|
|
100
|
+
const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
101
101
|
for (let i = 0; i < subdir.length; i++) {
|
|
102
102
|
del(subdir[i]);
|
|
103
103
|
}
|
|
104
104
|
try {
|
|
105
|
-
|
|
105
|
+
fs2.rmdirSync(fullPath);
|
|
106
106
|
console.log("deleted", fullPath);
|
|
107
107
|
} catch (_e) {
|
|
108
108
|
try {
|
|
109
|
-
|
|
109
|
+
fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
110
110
|
console.log("deleted", fullPath);
|
|
111
111
|
} catch (ee) {
|
|
112
112
|
console.log("failed delete", fullPath, ee && ee.message);
|
|
@@ -115,11 +115,11 @@ var require_utils = __commonJS({
|
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
try {
|
|
118
|
-
|
|
118
|
+
fs2.unlinkSync(fullPath);
|
|
119
119
|
console.log("deleted", fullPath);
|
|
120
120
|
} catch (_e) {
|
|
121
121
|
try {
|
|
122
|
-
|
|
122
|
+
fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
123
123
|
console.log("deleted", fullPath);
|
|
124
124
|
} catch (ee) {
|
|
125
125
|
console.log("failed delete", fullPath, ee && ee.message);
|
|
@@ -132,13 +132,13 @@ var require_utils = __commonJS({
|
|
|
132
132
|
module2.exports.del = del;
|
|
133
133
|
function delStream(globStream) {
|
|
134
134
|
globStream.stream().on("data", (result) => {
|
|
135
|
-
const fullPath =
|
|
135
|
+
const fullPath = path2.resolve(process.cwd(), result);
|
|
136
136
|
try {
|
|
137
|
-
if (
|
|
138
|
-
const stat =
|
|
137
|
+
if (fs2.existsSync(fullPath)) {
|
|
138
|
+
const stat = fs2.lstatSync(fullPath);
|
|
139
139
|
if (stat.isSymbolicLink()) {
|
|
140
140
|
try {
|
|
141
|
-
|
|
141
|
+
fs2.unlinkSync(fullPath);
|
|
142
142
|
console.log("deleted symlink", fullPath);
|
|
143
143
|
} catch (e) {
|
|
144
144
|
console.log("failed delete symlink", fullPath, e && e.message);
|
|
@@ -146,7 +146,7 @@ var require_utils = __commonJS({
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
if (stat.isDirectory()) {
|
|
149
|
-
const subdir =
|
|
149
|
+
const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
150
150
|
for (let i = 0; i < subdir.length; i++) {
|
|
151
151
|
del(subdir[i]);
|
|
152
152
|
}
|
|
@@ -201,71 +201,93 @@ var require_utils = __commonJS({
|
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
203
|
|
|
204
|
+
// src/run-by-checksum/hash.cjs
|
|
205
|
+
var require_hash = __commonJS({
|
|
206
|
+
"src/run-by-checksum/hash.cjs"(exports2, module2) {
|
|
207
|
+
init_cjs_shims();
|
|
208
|
+
var fs2 = require("fs-extra");
|
|
209
|
+
var glob = require("glob");
|
|
210
|
+
var path2 = require("upath");
|
|
211
|
+
var CryptoJS = require("crypto-js");
|
|
212
|
+
var globSync = typeof glob.sync === "function" ? glob.sync : glob.globSync;
|
|
213
|
+
function getAllFiles2({ patterns: patterns2 = [], ignore: ignore2 = [], cwd } = {}) {
|
|
214
|
+
const files = /* @__PURE__ */ new Set();
|
|
215
|
+
const root = path2.resolve(cwd || process.cwd());
|
|
216
|
+
for (const pattern of patterns2) {
|
|
217
|
+
const matched = globSync(pattern, {
|
|
218
|
+
cwd: root,
|
|
219
|
+
nodir: true,
|
|
220
|
+
ignore: ignore2,
|
|
221
|
+
absolute: false
|
|
222
|
+
});
|
|
223
|
+
for (const f of matched) {
|
|
224
|
+
files.add(path2.normalize(path2.resolve(root, f)));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return Array.from(files).sort();
|
|
228
|
+
}
|
|
229
|
+
function isBinaryFile(filePath, bytesToCheck = 8e3) {
|
|
230
|
+
const size = Math.max(0, Number(bytesToCheck) || 0);
|
|
231
|
+
if (size === 0) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
const fd = fs2.openSync(filePath, "r");
|
|
235
|
+
try {
|
|
236
|
+
const buffer = Buffer.allocUnsafe(size);
|
|
237
|
+
const bytesRead = fs2.readSync(fd, buffer, 0, size, 0);
|
|
238
|
+
for (let i = 0; i < bytesRead; i++) {
|
|
239
|
+
if (buffer[i] === 0) {
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return false;
|
|
244
|
+
} finally {
|
|
245
|
+
fs2.closeSync(fd);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function hashFile(file) {
|
|
249
|
+
if (!isBinaryFile(file)) {
|
|
250
|
+
const content = fs2.readFileSync(file, "utf8");
|
|
251
|
+
const normalized = content.replace(/\s+/g, " ").trim();
|
|
252
|
+
return CryptoJS.SHA256(normalized).toString(CryptoJS.enc.Hex);
|
|
253
|
+
}
|
|
254
|
+
const stats = fs2.statSync(file);
|
|
255
|
+
const binHash = CryptoJS.algo.SHA256.create();
|
|
256
|
+
binHash.update(file);
|
|
257
|
+
binHash.update(String(stats.size));
|
|
258
|
+
return binHash.finalize().toString(CryptoJS.enc.Hex);
|
|
259
|
+
}
|
|
260
|
+
function buildChecksum2(files = []) {
|
|
261
|
+
const hash = CryptoJS.algo.SHA256.create();
|
|
262
|
+
for (const file of files) {
|
|
263
|
+
hash.update(file);
|
|
264
|
+
hash.update(hashFile(file));
|
|
265
|
+
}
|
|
266
|
+
return hash.finalize().toString(CryptoJS.enc.Hex);
|
|
267
|
+
}
|
|
268
|
+
function sha256(data, trim = 128) {
|
|
269
|
+
const hash = CryptoJS.SHA256(String(data)).toString(CryptoJS.enc.Hex);
|
|
270
|
+
return trim ? hash.substring(0, trim) : hash;
|
|
271
|
+
}
|
|
272
|
+
module2.exports = { getAllFiles: getAllFiles2, buildChecksum: buildChecksum2, sha256 };
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
|
|
204
276
|
// src/run-by-checksum-cli.js
|
|
205
277
|
init_cjs_shims();
|
|
206
278
|
var import_utils = __toESM(require_utils(), 1);
|
|
207
279
|
|
|
208
280
|
// src/run-by-checksum/run.js
|
|
209
281
|
init_cjs_shims();
|
|
282
|
+
var import_hash = __toESM(require_hash(), 1);
|
|
210
283
|
|
|
211
|
-
// src/run-by-checksum/
|
|
284
|
+
// src/run-by-checksum/cache.js
|
|
212
285
|
init_cjs_shims();
|
|
213
286
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
214
|
-
var glob = __toESM(require("glob"), 1);
|
|
215
287
|
var import_upath = __toESM(require("upath"), 1);
|
|
216
|
-
var import_upath2 = __toESM(require("upath"), 1);
|
|
217
288
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
218
|
-
function getAllFiles({ patterns: patterns2, ignore: ignore2, cwd }) {
|
|
219
|
-
const files = /* @__PURE__ */ new Set();
|
|
220
|
-
const root = cwd || process.cwd();
|
|
221
|
-
for (const pattern of patterns2) {
|
|
222
|
-
const matched = glob.sync(pattern, {
|
|
223
|
-
cwd: root,
|
|
224
|
-
nodir: true,
|
|
225
|
-
ignore: ignore2
|
|
226
|
-
});
|
|
227
|
-
for (const f of matched) {
|
|
228
|
-
files.add(import_upath.default.normalize(import_upath2.default.resolve(root, f)));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return [...files].sort();
|
|
232
|
-
}
|
|
233
|
-
function isBinaryFile(filePath, bytesToCheck = 8e3) {
|
|
234
|
-
const buffer = import_fs_extra.default.readFileSync(filePath, { length: bytesToCheck });
|
|
235
|
-
for (let i = 0; i < buffer.length; i++) {
|
|
236
|
-
if (buffer[i] === 0) {
|
|
237
|
-
return true;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
function hashFile(file) {
|
|
243
|
-
const isBin = isBinaryFile(file);
|
|
244
|
-
if (!isBin) {
|
|
245
|
-
const content = import_fs_extra.default.readFileSync(file, { encoding: "utf-8" });
|
|
246
|
-
const normalized = content.toString().replace(/\s+/g, " ").trim();
|
|
247
|
-
return import_crypto.default.createHash("sha256").update(normalized).digest("hex");
|
|
248
|
-
} else {
|
|
249
|
-
const stats = import_fs_extra.default.statSync(file);
|
|
250
|
-
return import_crypto.default.createHash("sha256").update(file).update(String(stats.size)).digest("hex");
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function buildChecksum(files) {
|
|
254
|
-
const hash = import_crypto.default.createHash("sha256");
|
|
255
|
-
for (const file of files) {
|
|
256
|
-
hash.update(file);
|
|
257
|
-
hash.update(hashFile(file));
|
|
258
|
-
}
|
|
259
|
-
return hash.digest("hex");
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// src/run-by-checksum/cache.js
|
|
263
|
-
init_cjs_shims();
|
|
264
|
-
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
265
|
-
var import_upath3 = __toESM(require("upath"), 1);
|
|
266
|
-
var import_crypto2 = __toESM(require("crypto"), 1);
|
|
267
289
|
function md5(str) {
|
|
268
|
-
return
|
|
290
|
+
return import_crypto.default.createHash("md5").update(str).digest("hex");
|
|
269
291
|
}
|
|
270
292
|
function getCacheFile({ patterns: patterns2, ignore: ignore2, cwd }) {
|
|
271
293
|
const root = cwd || process.env.INIT_CWD || process.cwd();
|
|
@@ -275,18 +297,18 @@ function getCacheFile({ patterns: patterns2, ignore: ignore2, cwd }) {
|
|
|
275
297
|
ignore: [...ignore2].sort()
|
|
276
298
|
})
|
|
277
299
|
);
|
|
278
|
-
return
|
|
300
|
+
return import_upath.default.join(root, "tmp", ".checksum", `${key}.json`);
|
|
279
301
|
}
|
|
280
302
|
function loadCache(file) {
|
|
281
303
|
try {
|
|
282
|
-
return
|
|
304
|
+
return import_fs_extra.default.readJsonSync(file);
|
|
283
305
|
} catch {
|
|
284
306
|
return null;
|
|
285
307
|
}
|
|
286
308
|
}
|
|
287
309
|
function saveCache(file, data) {
|
|
288
|
-
|
|
289
|
-
|
|
310
|
+
import_fs_extra.default.ensureDirSync(import_upath.default.dirname(file));
|
|
311
|
+
import_fs_extra.default.writeJsonSync(file, data, { spaces: 2 });
|
|
290
312
|
}
|
|
291
313
|
|
|
292
314
|
// src/run-by-checksum/run.js
|
|
@@ -310,8 +332,8 @@ async function runChecksum({
|
|
|
310
332
|
console.log("No patterns provided, skipping checksum runner.");
|
|
311
333
|
process.exit(1);
|
|
312
334
|
}
|
|
313
|
-
const files = getAllFiles({ patterns: patterns2, ignore: ignore2, cwd });
|
|
314
|
-
const checksum = buildChecksum(files);
|
|
335
|
+
const files = (0, import_hash.getAllFiles)({ patterns: patterns2, ignore: ignore2, cwd });
|
|
336
|
+
const checksum = (0, import_hash.buildChecksum)(files);
|
|
315
337
|
const cacheFile = getCacheFile({ patterns: patterns2, ignore: ignore2, cwd });
|
|
316
338
|
const cache = loadCache(cacheFile);
|
|
317
339
|
if ((cache == null ? void 0 : cache.checksum) === checksum) {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
runChecksum
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Z53IUBUN.mjs";
|
|
6
6
|
import "./chunk-QD4T255Z.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-V6PTSDW5.mjs";
|
|
8
8
|
import {
|
|
9
9
|
require_utils
|
|
10
10
|
} from "./chunk-6RK5UCTP.mjs";
|
|
@@ -286,25 +286,33 @@ var require_config = __commonJS({
|
|
|
286
286
|
var minimistLib = require("minimist");
|
|
287
287
|
var { findEnvWithToken } = require_findEnvFiles();
|
|
288
288
|
var dotenv = require("dotenv");
|
|
289
|
+
var { cosmiconfig } = require("cosmiconfig");
|
|
289
290
|
var loadDotenv = (tokenKey = /ACCESS_TOKEN|GITHUB_TOKEN/) => dotenv.config({ path: findEnvWithToken(void 0, tokenKey), quiet: true, overwrite: true });
|
|
290
291
|
loadDotenv();
|
|
291
292
|
var cliArgv = minimistLib(process.argv.slice(2), {
|
|
292
293
|
string: ["token"]
|
|
293
294
|
});
|
|
294
295
|
var GITHUB_ACCESS_TOKEN = cliArgv.token || process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
|
295
|
-
function getTempDir() {
|
|
296
|
-
return process.env.TEMP_DIR || path2.join(process.cwd(), "tmp");
|
|
297
|
-
}
|
|
298
296
|
function getTempPath(...segments) {
|
|
299
|
-
return path2.join(
|
|
297
|
+
return path2.join(process.env.TEMP_DIR || path2.join(process.cwd(), "tmp"), ...segments);
|
|
298
|
+
}
|
|
299
|
+
async function getConfig(options = {}) {
|
|
300
|
+
const explorer = cosmiconfig("binary-collections", {
|
|
301
|
+
searchStrategy: "project",
|
|
302
|
+
stopDir: options.stopDir
|
|
303
|
+
});
|
|
304
|
+
try {
|
|
305
|
+
const result = await explorer.search(options.searchFrom);
|
|
306
|
+
return result ? result.config : null;
|
|
307
|
+
} catch {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
300
310
|
}
|
|
301
|
-
var TEMP_BASE_DIR = getTempDir();
|
|
302
311
|
module2.exports = {
|
|
303
|
-
getTempDir,
|
|
304
312
|
getTempPath,
|
|
305
|
-
TEMP_BASE_DIR,
|
|
306
313
|
GITHUB_ACCESS_TOKEN,
|
|
307
|
-
loadDotenv
|
|
314
|
+
loadDotenv,
|
|
315
|
+
getConfig
|
|
308
316
|
};
|
|
309
317
|
}
|
|
310
318
|
});
|
|
@@ -307,25 +307,33 @@ var require_config = __commonJS({
|
|
|
307
307
|
var minimistLib = require("minimist");
|
|
308
308
|
var { findEnvWithToken } = require_findEnvFiles();
|
|
309
309
|
var dotenv = require("dotenv");
|
|
310
|
+
var { cosmiconfig } = require("cosmiconfig");
|
|
310
311
|
var loadDotenv = (tokenKey = /ACCESS_TOKEN|GITHUB_TOKEN/) => dotenv.config({ path: findEnvWithToken(void 0, tokenKey), quiet: true, overwrite: true });
|
|
311
312
|
loadDotenv();
|
|
312
313
|
var cliArgv = minimistLib(process.argv.slice(2), {
|
|
313
314
|
string: ["token"]
|
|
314
315
|
});
|
|
315
316
|
var GITHUB_ACCESS_TOKEN = cliArgv.token || process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
|
316
|
-
function getTempDir() {
|
|
317
|
-
return process.env.TEMP_DIR || path2.join(process.cwd(), "tmp");
|
|
318
|
-
}
|
|
319
317
|
function getTempPath(...segments) {
|
|
320
|
-
return path2.join(
|
|
318
|
+
return path2.join(process.env.TEMP_DIR || path2.join(process.cwd(), "tmp"), ...segments);
|
|
319
|
+
}
|
|
320
|
+
async function getConfig(options = {}) {
|
|
321
|
+
const explorer = cosmiconfig("binary-collections", {
|
|
322
|
+
searchStrategy: "project",
|
|
323
|
+
stopDir: options.stopDir
|
|
324
|
+
});
|
|
325
|
+
try {
|
|
326
|
+
const result = await explorer.search(options.searchFrom);
|
|
327
|
+
return result ? result.config : null;
|
|
328
|
+
} catch {
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
321
331
|
}
|
|
322
|
-
var TEMP_BASE_DIR = getTempDir();
|
|
323
332
|
module2.exports = {
|
|
324
|
-
getTempDir,
|
|
325
333
|
getTempPath,
|
|
326
|
-
TEMP_BASE_DIR,
|
|
327
334
|
GITHUB_ACCESS_TOKEN,
|
|
328
|
-
loadDotenv
|
|
335
|
+
loadDotenv,
|
|
336
|
+
getConfig
|
|
329
337
|
};
|
|
330
338
|
}
|
|
331
339
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_submodule_remove
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-TDUUOAQD.mjs";
|
|
5
|
+
import "./chunk-3T6AMFI3.mjs";
|
|
6
6
|
import "./chunk-J4M5EL5P.mjs";
|
|
7
7
|
import {
|
|
8
8
|
require_utils
|
package/lib/submodule-remove.cjs
CHANGED
|
@@ -118,25 +118,33 @@ var require_config = __commonJS({
|
|
|
118
118
|
var minimistLib = require("minimist");
|
|
119
119
|
var { findEnvWithToken } = require_findEnvFiles();
|
|
120
120
|
var dotenv = require("dotenv");
|
|
121
|
+
var { cosmiconfig } = require("cosmiconfig");
|
|
121
122
|
var loadDotenv2 = (tokenKey = /ACCESS_TOKEN|GITHUB_TOKEN/) => dotenv.config({ path: findEnvWithToken(void 0, tokenKey), quiet: true, overwrite: true });
|
|
122
123
|
loadDotenv2();
|
|
123
124
|
var cliArgv = minimistLib(process.argv.slice(2), {
|
|
124
125
|
string: ["token"]
|
|
125
126
|
});
|
|
126
127
|
var GITHUB_ACCESS_TOKEN = cliArgv.token || process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
|
127
|
-
function getTempDir() {
|
|
128
|
-
return process.env.TEMP_DIR || path2.join(process.cwd(), "tmp");
|
|
129
|
-
}
|
|
130
128
|
function getTempPath(...segments) {
|
|
131
|
-
return path2.join(
|
|
129
|
+
return path2.join(process.env.TEMP_DIR || path2.join(process.cwd(), "tmp"), ...segments);
|
|
130
|
+
}
|
|
131
|
+
async function getConfig(options = {}) {
|
|
132
|
+
const explorer = cosmiconfig("binary-collections", {
|
|
133
|
+
searchStrategy: "project",
|
|
134
|
+
stopDir: options.stopDir
|
|
135
|
+
});
|
|
136
|
+
try {
|
|
137
|
+
const result = await explorer.search(options.searchFrom);
|
|
138
|
+
return result ? result.config : null;
|
|
139
|
+
} catch {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
132
142
|
}
|
|
133
|
-
var TEMP_BASE_DIR = getTempDir();
|
|
134
143
|
module2.exports = {
|
|
135
|
-
getTempDir,
|
|
136
144
|
getTempPath,
|
|
137
|
-
TEMP_BASE_DIR,
|
|
138
145
|
GITHUB_ACCESS_TOKEN,
|
|
139
|
-
loadDotenv: loadDotenv2
|
|
146
|
+
loadDotenv: loadDotenv2,
|
|
147
|
+
getConfig
|
|
140
148
|
};
|
|
141
149
|
}
|
|
142
150
|
});
|
package/lib/submodule-remove.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_submodule_remove
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-TDUUOAQD.mjs";
|
|
5
|
+
import "./chunk-3T6AMFI3.mjs";
|
|
6
6
|
import "./chunk-J4M5EL5P.mjs";
|
|
7
7
|
import "./chunk-QQ4A6DLD.mjs";
|
|
8
8
|
export default require_submodule_remove();
|