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.
Files changed (145) hide show
  1. package/.opencode/plugins/opencode-request-logger/README.md +44 -0
  2. package/.venv/Lib/site-packages/pyarrow/tests/data/orc/README.md +22 -0
  3. package/docs-src/install-opencode-plugins.md +86 -0
  4. package/docs-src/opencode-cli.md +38 -10
  5. package/lib/binary-collections/config-types.cjs +17 -0
  6. package/lib/binary-collections/config-types.d.ts +12 -0
  7. package/lib/binary-collections/config-types.js +2 -0
  8. package/lib/binary-collections/config-types.mjs +7 -0
  9. package/lib/binary-collections/config.cjs +16 -8
  10. package/lib/binary-collections/config.d.cts +18 -10
  11. package/lib/binary-collections/config.mjs +1 -1
  12. package/lib/binary-collections/findScript.cjs +8 -6
  13. package/lib/binary-collections/findScript.mjs +2 -2
  14. package/lib/binary-collections/listScript.cjs +8 -6
  15. package/lib/binary-collections/listScript.mjs +2 -2
  16. package/lib/binary-collections.cjs +8 -6
  17. package/lib/binary-collections.mjs +3 -3
  18. package/lib/changelog.cjs +142 -4
  19. package/lib/changelog.mjs +9 -5
  20. package/lib/{chunk-SARIXFHP.mjs → chunk-3T6AMFI3.mjs} +16 -8
  21. package/lib/{chunk-3F6EIHYG.mjs → chunk-3ZF2QMDK.mjs} +3 -3
  22. package/lib/chunk-B77D3SR4.mjs +28 -0
  23. package/lib/chunk-BPED62FN.mjs +115 -0
  24. package/lib/{chunk-XI67TI46.mjs → chunk-DHFRWM2W.mjs} +1 -1
  25. package/lib/{chunk-2SJKVOTN.mjs → chunk-DPEE3FBB.mjs} +1 -1
  26. package/lib/{chunk-UYNBNLV5.mjs → chunk-H7AE4IO3.mjs} +1 -1
  27. package/lib/{chunk-YWSLMAQ7.mjs → chunk-KCJYREA2.mjs} +14 -12
  28. package/lib/{chunk-JK3MG2KF.mjs → chunk-NHD4HLSU.mjs} +1 -1
  29. package/lib/{chunk-I3O5ZRYU.mjs → chunk-OWNVMKAA.mjs} +1 -1
  30. package/lib/chunk-SKVF4TMD.mjs +59 -0
  31. package/lib/{chunk-SJYP66BO.mjs → chunk-TDUUOAQD.mjs} +1 -1
  32. package/lib/{chunk-D42YBRZW.mjs → chunk-UAEKSLAX.mjs} +1 -1
  33. package/lib/chunk-V6PTSDW5.mjs +82 -0
  34. package/lib/{chunk-AJ3OIYYP.mjs → chunk-WNUEY6VJ.mjs} +8 -6
  35. package/lib/{chunk-YLV4QATP.mjs → chunk-Z53IUBUN.mjs} +6 -5
  36. package/lib/{chunk-JMUFQSPE.mjs → chunk-Z7RM46Q4.mjs} +1 -1
  37. package/lib/cross-env/index.mjs +3 -3
  38. package/lib/git/git-diff-cli.cjs +16 -8
  39. package/lib/git/git-diff-cli.mjs +3 -3
  40. package/lib/git/git-diff.cjs +16 -8
  41. package/lib/git/git-diff.mjs +3 -3
  42. package/lib/git/git-fix.cjs +16 -8
  43. package/lib/git/git-fix.mjs +2 -2
  44. package/lib/git/user-config.cjs +16 -8
  45. package/lib/git/user-config.mjs +2 -2
  46. package/lib/github-workflows/clean-github-actions-caches-cli.cjs +16 -8
  47. package/lib/github-workflows/clean-github-actions-caches-cli.mjs +2 -2
  48. package/lib/github-workflows/clean-github-actions-caches.cjs +16 -8
  49. package/lib/github-workflows/clean-github-actions-caches.mjs +2 -2
  50. package/lib/github-workflows/get-latest-workflow-status-cli.cjs +16 -8
  51. package/lib/github-workflows/get-latest-workflow-status-cli.mjs +2 -2
  52. package/lib/github-workflows/utils.cjs +16 -8
  53. package/lib/github-workflows/utils.mjs +2 -2
  54. package/lib/github-workflows/workflow-badge-cli.cjs +16 -8
  55. package/lib/github-workflows/workflow-badge-cli.mjs +4 -4
  56. package/lib/node-cache-cleaner-cli.mjs +3 -3
  57. package/lib/opencode/cli/auth-rotate.cjs +343 -28
  58. package/lib/opencode/cli/auth-rotate.d.ts +3 -1
  59. package/lib/opencode/cli/auth-rotate.js +10 -15
  60. package/lib/opencode/cli/auth-rotate.mjs +6 -2
  61. package/lib/opencode/cli/auth-rotate.runner.cjs +454 -0
  62. package/lib/opencode/cli/auth-rotate.runner.d.ts +1 -0
  63. package/lib/opencode/cli/auth-rotate.runner.js +8 -0
  64. package/lib/opencode/cli/auth-rotate.runner.mjs +21 -0
  65. package/lib/opencode/install-opencode-plugins-cli.cjs +82 -0
  66. package/lib/opencode/install-opencode-plugins-cli.d.ts +1 -0
  67. package/lib/opencode/install-opencode-plugins-cli.js +78 -0
  68. package/lib/opencode/install-opencode-plugins-cli.mjs +65 -0
  69. package/lib/opencode/utils/check-api.cjs +332 -18
  70. package/lib/opencode/utils/check-api.d.ts +5 -1
  71. package/lib/opencode/utils/check-api.js +101 -15
  72. package/lib/opencode/utils/check-api.mjs +5 -1
  73. package/lib/opencode/utils/check-api.runner.cjs +0 -0
  74. package/lib/opencode/utils/check-api.runner.d.ts +0 -0
  75. package/lib/opencode/utils/check-api.runner.js +1 -0
  76. package/lib/opencode/utils/check-api.runner.mjs +7 -0
  77. package/lib/opencode-cli.cjs +352 -29
  78. package/lib/opencode-cli.js +3 -2
  79. package/lib/opencode-cli.mjs +11 -6
  80. package/lib/package-resolutions-updater-cli.cjs +16 -8
  81. package/lib/package-resolutions-updater-cli.mjs +2 -2
  82. package/lib/package-resolutions-updater.cjs +16 -8
  83. package/lib/package-resolutions-updater.mjs +2 -2
  84. package/lib/print-directory-tree.cjs +16 -8
  85. package/lib/print-directory-tree.mjs +1 -1
  86. package/lib/print-tarball-tree-cli.cjs +305 -0
  87. package/lib/print-tarball-tree-cli.d.mts +2 -0
  88. package/lib/print-tarball-tree-cli.mjs +54 -0
  89. package/lib/print-tarball-tree.cjs +43 -216
  90. package/lib/print-tarball-tree.d.mts +4 -1
  91. package/lib/print-tarball-tree.mjs +12 -66
  92. package/lib/rmpath-cli.cjs +16 -8
  93. package/lib/rmpath-cli.mjs +2 -2
  94. package/lib/rmpath.cjs +16 -8
  95. package/lib/rmpath.mjs +2 -2
  96. package/lib/run-by-checksum/hash.cjs +45 -67
  97. package/lib/run-by-checksum/{hash.d.ts → hash.d.cts} +9 -2
  98. package/lib/run-by-checksum/hash.mjs +3 -7
  99. package/lib/run-by-checksum/run.cjs +95 -58
  100. package/lib/run-by-checksum/run.js +3 -3
  101. package/lib/run-by-checksum/run.mjs +2 -2
  102. package/lib/run-by-checksum-cli.cjs +96 -74
  103. package/lib/run-by-checksum-cli.mjs +2 -2
  104. package/lib/submodule-install.cjs +16 -8
  105. package/lib/submodule-install.mjs +1 -1
  106. package/lib/submodule-remove-cli.cjs +16 -8
  107. package/lib/submodule-remove-cli.mjs +2 -2
  108. package/lib/submodule-remove.cjs +16 -8
  109. package/lib/submodule-remove.mjs +2 -2
  110. package/lib/utils/isDebug.cjs +13 -0
  111. package/lib/utils/isDebug.d.cts +9 -0
  112. package/lib/utils/isDebug.mjs +6 -0
  113. package/package.json +9 -7
  114. package/readme.md +63 -0
  115. package/releases/readme.md +1 -1
  116. package/lib/chunk-546KAIYT.mjs +0 -113
  117. package/lib/chunk-5WAOOOGZ.mjs +0 -77
  118. package/lib/chunk-72XTQ3CK.mjs +0 -45
  119. package/lib/chunk-7Q6YEUQF.mjs +0 -246
  120. package/lib/chunk-AQZ7LMFS.mjs +0 -100
  121. package/lib/chunk-BDCMTOZI.mjs +0 -246
  122. package/lib/chunk-BEUM4LH4.mjs +0 -184
  123. package/lib/chunk-BO4TZS4Q.mjs +0 -246
  124. package/lib/chunk-BZWVHODJ.mjs +0 -62
  125. package/lib/chunk-CM3IC5YC.mjs +0 -226
  126. package/lib/chunk-FR3DMHJC.mjs +0 -146
  127. package/lib/chunk-H44UWUFY.mjs +0 -105
  128. package/lib/chunk-JVMLKHD2.mjs +0 -62
  129. package/lib/chunk-KAT2JNLZ.mjs +0 -146
  130. package/lib/chunk-KRCPFWIF.mjs +0 -193
  131. package/lib/chunk-LVSPEFU2.mjs +0 -86
  132. package/lib/chunk-MCCMMZSM.mjs +0 -60
  133. package/lib/chunk-MGPYPKIE.mjs +0 -109
  134. package/lib/chunk-OA2RKEY3.mjs +0 -162
  135. package/lib/chunk-PAZH45HS.mjs +0 -41
  136. package/lib/chunk-QZMGBDSA.mjs +0 -32
  137. package/lib/chunk-RDGDLSPD.mjs +0 -76
  138. package/lib/chunk-RKPIBGKE.mjs +0 -61
  139. package/lib/chunk-SWUAEY4H.mjs +0 -44
  140. package/lib/chunk-UAIF5VIA.mjs +0 -89
  141. package/lib/chunk-UHPFLJXH.mjs +0 -227
  142. package/lib/chunk-WOC4FZ6F.mjs +0 -164
  143. package/lib/chunk-WSHVPGNM.mjs +0 -44
  144. package/lib/run-by-checksum/hash.js +0 -119
  145. package/readme.html +0 -784
@@ -1,15 +1,12 @@
1
- #!/usr/bin/env node
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
- var __commonJS = (cb, mod) => function __require() {
12
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
13
10
  };
14
11
  var __copyProps = (to, from, except, desc) => {
15
12
  if (from && typeof from === "object" || typeof from === "function") {
@@ -27,236 +24,66 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
25
  mod
29
26
  ));
30
-
31
- // node_modules/tsup/assets/cjs_shims.js
32
- var init_cjs_shims = __esm({
33
- "node_modules/tsup/assets/cjs_shims.js"() {
34
- }
35
- });
36
-
37
- // src/utils/index.cjs
38
- var require_utils = __commonJS({
39
- "src/utils/index.cjs"(exports2, module2) {
40
- init_cjs_shims();
41
- var fs2 = require("fs");
42
- var path2 = require("upath");
43
- var minimistLib = require("minimist");
44
- var argv2 = minimistLib(process.argv.slice(2));
45
- var { exec } = require("child_process");
46
- var { promisify } = require("util");
47
- var execAsync = promisify(exec);
48
- async function parseGitRemotes() {
49
- try {
50
- const { stdout } = await execAsync("git remote -v");
51
- const lines = stdout.split("\n");
52
- const remotes = {};
53
- lines.forEach((line) => {
54
- const [name, url] = line.split(" ");
55
- if (name && url) {
56
- const [repoUrl] = url.split(" ");
57
- try {
58
- const parsedUrl = new URL(repoUrl);
59
- const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
60
- if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
61
- let repoPath = pathParts.join("/");
62
- if (repoPath.endsWith(".git")) {
63
- repoPath = repoPath.slice(0, -4);
64
- }
65
- remotes[name] = repoPath;
66
- }
67
- } catch (e) {
68
- console.error("URL Parsing Error:", e.message);
69
- }
70
- }
71
- });
72
- return remotes;
73
- } catch (error) {
74
- console.error("Error:", error.message);
75
- return {};
76
- }
77
- }
78
- module2.exports.parseGitRemotes = parseGitRemotes;
79
- function getArgs2(opts) {
80
- if (opts) {
81
- return minimistLib(process.argv.slice(2), opts);
82
- }
83
- return argv2;
84
- }
85
- module2.exports.getArgs = getArgs2;
86
- function del(fullPath) {
87
- try {
88
- if (!fs2.existsSync(fullPath)) return;
89
- const stat = fs2.lstatSync(fullPath);
90
- if (stat.isSymbolicLink()) {
91
- try {
92
- fs2.unlinkSync(fullPath);
93
- console.log("deleted symlink", fullPath);
94
- } catch (e) {
95
- console.log("failed delete symlink", fullPath, e && e.message);
96
- }
97
- return;
98
- }
99
- if (stat.isDirectory()) {
100
- const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
101
- for (let i = 0; i < subdir.length; i++) {
102
- del(subdir[i]);
103
- }
104
- try {
105
- fs2.rmdirSync(fullPath);
106
- console.log("deleted", fullPath);
107
- } catch (_e) {
108
- try {
109
- fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
110
- console.log("deleted", fullPath);
111
- } catch (ee) {
112
- console.log("failed delete", fullPath, ee && ee.message);
113
- }
114
- }
115
- return;
116
- }
117
- try {
118
- fs2.unlinkSync(fullPath);
119
- console.log("deleted", fullPath);
120
- } catch (_e) {
121
- try {
122
- fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
123
- console.log("deleted", fullPath);
124
- } catch (ee) {
125
- console.log("failed delete", fullPath, ee && ee.message);
126
- }
127
- }
128
- } catch (err) {
129
- console.log("failed delete", fullPath, err && err.message);
130
- }
131
- }
132
- module2.exports.del = del;
133
- function delStream(globStream) {
134
- globStream.stream().on("data", (result) => {
135
- const fullPath = path2.resolve(process.cwd(), result);
136
- try {
137
- if (fs2.existsSync(fullPath)) {
138
- const stat = fs2.lstatSync(fullPath);
139
- if (stat.isSymbolicLink()) {
140
- try {
141
- fs2.unlinkSync(fullPath);
142
- console.log("deleted symlink", fullPath);
143
- } catch (e) {
144
- console.log("failed delete symlink", fullPath, e && e.message);
145
- }
146
- return;
147
- }
148
- if (stat.isDirectory()) {
149
- const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
150
- for (let i = 0; i < subdir.length; i++) {
151
- del(subdir[i]);
152
- }
153
- }
154
- }
155
- del(fullPath);
156
- } catch (err) {
157
- console.log("failed processing", fullPath, err && err.message);
158
- }
159
- });
160
- }
161
- module2.exports.delStream = delStream;
162
- function getFileTreeString(hashArray) {
163
- const tree = {};
164
- const hashMap = {};
165
- for (const entry of hashArray) {
166
- const [filePath2, hash] = entry.split(" ");
167
- hashMap[filePath2] = hash;
168
- const parts = filePath2.split("/");
169
- let current = tree;
170
- for (let i = 0; i < parts.length; i++) {
171
- const part = parts[i];
172
- if (i === parts.length - 1) {
173
- current[part] = null;
174
- } else {
175
- current[part] = current[part] || {};
176
- current = current[part];
177
- }
178
- }
179
- }
180
- function printNode(node, prefix = "", parentPath = "") {
181
- const keys = Object.keys(node).sort();
182
- let lines = [];
183
- keys.forEach((key, idx) => {
184
- const isLast = idx === keys.length - 1;
185
- const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
186
- const currentPath = parentPath ? parentPath + "/" + key : key;
187
- if (node[key] === null) {
188
- lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
189
- } else {
190
- lines.push(prefix + branch + key + "/");
191
- lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
192
- }
193
- });
194
- return lines;
195
- }
196
- return printNode(tree, "", "").join("\n");
197
- }
198
- module2.exports.getFileTreeString = getFileTreeString;
199
- var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
200
- module2.exports.delay = delay;
201
- }
202
- });
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
203
28
 
204
29
  // src/print-tarball-tree.mjs
205
- init_cjs_shims();
206
- var import_fs = __toESM(require("fs"), 1);
207
- var import_zlib = __toESM(require("zlib"), 1);
30
+ var print_tarball_tree_exports = {};
31
+ __export(print_tarball_tree_exports, {
32
+ addToTree: () => addToTree,
33
+ formatTree: () => formatTree,
34
+ printTgzTree: () => printTgzTree,
35
+ printTree: () => printTree
36
+ });
37
+ module.exports = __toCommonJS(print_tarball_tree_exports);
38
+ var import_node_fs = __toESM(require("fs"), 1);
39
+ var zlib = __toESM(require("zlib"), 1);
40
+ var import_promises = require("stream/promises");
208
41
  var import_tar_stream = __toESM(require("tar-stream"), 1);
209
- var import_upath = __toESM(require("upath"), 1);
210
- var import_utils = __toESM(require_utils(), 1);
211
42
  function addToTree(tree, parts) {
212
43
  let node = tree;
213
44
  for (const part of parts) {
214
45
  if (!node[part]) node[part] = {};
215
46
  node = node[part];
216
47
  }
48
+ return tree;
217
49
  }
218
- function printTree(node, prefix = "") {
50
+ function formatTree(node, prefix = "") {
51
+ const lines = [];
219
52
  const entries = Object.keys(node).sort();
220
- entries.forEach((key, index) => {
53
+ entries.forEach(function(key, index) {
221
54
  const isLast = index === entries.length - 1;
222
- console.log(prefix + (isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + key);
223
55
  const child = node[key];
56
+ const line = prefix + (isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + key;
224
57
  const newPrefix = prefix + (isLast ? " " : "\u2502 ");
225
- printTree(child, newPrefix);
58
+ lines.push(line);
59
+ lines.push(...formatTree(child, newPrefix));
226
60
  });
61
+ return lines;
227
62
  }
228
- function printTgzTree(filePath2) {
63
+ function printTree(node, prefix = "", logger = console.log) {
64
+ for (const line of formatTree(node, prefix)) {
65
+ logger(line);
66
+ }
67
+ }
68
+ async function printTgzTree(filePath, options = {}) {
69
+ const logger = options.logger || console.log;
229
70
  const extract = import_tar_stream.default.extract();
230
71
  const tree = {};
231
- extract.on("entry", (header, stream, next) => {
72
+ extract.on("entry", function(header, stream, next) {
232
73
  const parts = header.name.split("/").filter(Boolean);
233
74
  if (parts.length) addToTree(tree, parts);
234
- stream.on("end", next);
75
+ stream.once("end", next);
76
+ stream.once("error", next);
235
77
  stream.resume();
236
78
  });
237
- extract.on("finish", () => {
238
- printTree(tree);
239
- });
240
- import_fs.default.createReadStream(filePath2).pipe(import_zlib.default.createGunzip()).pipe(extract);
241
- }
242
- var argv = (0, import_utils.getArgs)({ string: ["file"], alias: { f: "file", h: "help" } });
243
- if (argv.help) {
244
- console.log(`
245
- Usage: node src/print-tarball-tree.mjs [options]
246
-
247
- Options:
248
- -f, --file <path> Path to the tarball file (default: package.tgz)
249
- -h, --help Show this help message
250
- `);
251
- process.exit(0);
252
- }
253
- var filePath = argv.file ? import_upath.default.isAbsolute(argv.file) ? argv.file : import_upath.default.resolve(process.cwd(), argv.file) : null;
254
- if (!filePath) {
255
- console.error("Error: No file specified");
256
- process.exit(1);
79
+ await (0, import_promises.pipeline)(import_node_fs.default.createReadStream(filePath), zlib.createGunzip(), extract);
80
+ printTree(tree, "", logger);
81
+ return tree;
257
82
  }
258
- if (!import_fs.default.existsSync(filePath)) {
259
- console.error(`Error: File not found at ${filePath}`);
260
- process.exit(1);
261
- }
262
- printTgzTree(filePath);
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ addToTree,
86
+ formatTree,
87
+ printTgzTree,
88
+ printTree
89
+ });
@@ -1 +1,4 @@
1
- export {};
1
+ export function addToTree(tree: any, parts: any): any;
2
+ export function formatTree(node: any, prefix?: string): any[];
3
+ export function printTree(node: any, prefix?: string, logger?: (...data: any[]) => void): void;
4
+ export function printTgzTree(filePath: any, options?: {}): Promise<{}>;
@@ -1,68 +1,14 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
- require_utils
4
- } from "./chunk-6RK5UCTP.mjs";
5
- import {
6
- __toESM,
7
- init_esm_shims
8
- } from "./chunk-QQ4A6DLD.mjs";
9
-
10
- // src/print-tarball-tree.mjs
11
- init_esm_shims();
12
- var import_utils = __toESM(require_utils(), 1);
13
- import fs from "fs";
14
- import zlib from "zlib";
15
- import tar from "tar-stream";
16
- import path from "upath";
17
- function addToTree(tree, parts) {
18
- let node = tree;
19
- for (const part of parts) {
20
- if (!node[part]) node[part] = {};
21
- node = node[part];
22
- }
23
- }
24
- function printTree(node, prefix = "") {
25
- const entries = Object.keys(node).sort();
26
- entries.forEach((key, index) => {
27
- const isLast = index === entries.length - 1;
28
- console.log(prefix + (isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + key);
29
- const child = node[key];
30
- const newPrefix = prefix + (isLast ? " " : "\u2502 ");
31
- printTree(child, newPrefix);
32
- });
33
- }
34
- function printTgzTree(filePath2) {
35
- const extract = tar.extract();
36
- const tree = {};
37
- extract.on("entry", (header, stream, next) => {
38
- const parts = header.name.split("/").filter(Boolean);
39
- if (parts.length) addToTree(tree, parts);
40
- stream.on("end", next);
41
- stream.resume();
42
- });
43
- extract.on("finish", () => {
44
- printTree(tree);
45
- });
46
- fs.createReadStream(filePath2).pipe(zlib.createGunzip()).pipe(extract);
47
- }
48
- var argv = (0, import_utils.getArgs)({ string: ["file"], alias: { f: "file", h: "help" } });
49
- if (argv.help) {
50
- console.log(`
51
- Usage: node src/print-tarball-tree.mjs [options]
52
-
53
- Options:
54
- -f, --file <path> Path to the tarball file (default: package.tgz)
55
- -h, --help Show this help message
56
- `);
57
- process.exit(0);
58
- }
59
- var filePath = argv.file ? path.isAbsolute(argv.file) ? argv.file : path.resolve(process.cwd(), argv.file) : null;
60
- if (!filePath) {
61
- console.error("Error: No file specified");
62
- process.exit(1);
63
- }
64
- if (!fs.existsSync(filePath)) {
65
- console.error(`Error: File not found at ${filePath}`);
66
- process.exit(1);
67
- }
68
- printTgzTree(filePath);
3
+ addToTree,
4
+ formatTree,
5
+ printTgzTree,
6
+ printTree
7
+ } from "./chunk-SKVF4TMD.mjs";
8
+ import "./chunk-QQ4A6DLD.mjs";
9
+ export {
10
+ addToTree,
11
+ formatTree,
12
+ printTgzTree,
13
+ printTree
14
+ };
@@ -143,25 +143,33 @@ var require_config = __commonJS({
143
143
  var minimistLib = require("minimist");
144
144
  var { findEnvWithToken } = require_findEnvFiles();
145
145
  var dotenv = require("dotenv");
146
+ var { cosmiconfig } = require("cosmiconfig");
146
147
  var loadDotenv2 = (tokenKey = /ACCESS_TOKEN|GITHUB_TOKEN/) => dotenv.config({ path: findEnvWithToken(void 0, tokenKey), quiet: true, overwrite: true });
147
148
  loadDotenv2();
148
149
  var cliArgv = minimistLib(process.argv.slice(2), {
149
150
  string: ["token"]
150
151
  });
151
152
  var GITHUB_ACCESS_TOKEN = cliArgv.token || process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
152
- function getTempDir() {
153
- return process.env.TEMP_DIR || path2.join(process.cwd(), "tmp");
154
- }
155
153
  function getTempPath(...segments) {
156
- return path2.join(getTempDir(), ...segments);
154
+ return path2.join(process.env.TEMP_DIR || path2.join(process.cwd(), "tmp"), ...segments);
155
+ }
156
+ async function getConfig(options = {}) {
157
+ const explorer = cosmiconfig("binary-collections", {
158
+ searchStrategy: "project",
159
+ stopDir: options.stopDir
160
+ });
161
+ try {
162
+ const result = await explorer.search(options.searchFrom);
163
+ return result ? result.config : null;
164
+ } catch {
165
+ return null;
166
+ }
157
167
  }
158
- var TEMP_BASE_DIR = getTempDir();
159
168
  module2.exports = {
160
- getTempDir,
161
169
  getTempPath,
162
- TEMP_BASE_DIR,
163
170
  GITHUB_ACCESS_TOKEN,
164
- loadDotenv: loadDotenv2
171
+ loadDotenv: loadDotenv2,
172
+ getConfig
165
173
  };
166
174
  }
167
175
  });
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  deleteMainScript
4
- } from "./chunk-I3O5ZRYU.mjs";
5
- import "./chunk-SARIXFHP.mjs";
4
+ } from "./chunk-OWNVMKAA.mjs";
5
+ import "./chunk-3T6AMFI3.mjs";
6
6
  import "./chunk-J4M5EL5P.mjs";
7
7
  import {
8
8
  require_utils
package/lib/rmpath.cjs CHANGED
@@ -147,25 +147,33 @@ var require_config = __commonJS({
147
147
  var minimistLib = require("minimist");
148
148
  var { findEnvWithToken } = require_findEnvFiles();
149
149
  var dotenv = require("dotenv");
150
+ var { cosmiconfig } = require("cosmiconfig");
150
151
  var loadDotenv2 = (tokenKey = /ACCESS_TOKEN|GITHUB_TOKEN/) => dotenv.config({ path: findEnvWithToken(void 0, tokenKey), quiet: true, overwrite: true });
151
152
  loadDotenv2();
152
153
  var cliArgv = minimistLib(process.argv.slice(2), {
153
154
  string: ["token"]
154
155
  });
155
156
  var GITHUB_ACCESS_TOKEN = cliArgv.token || process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
156
- function getTempDir() {
157
- return process.env.TEMP_DIR || path2.join(process.cwd(), "tmp");
158
- }
159
157
  function getTempPath(...segments) {
160
- return path2.join(getTempDir(), ...segments);
158
+ return path2.join(process.env.TEMP_DIR || path2.join(process.cwd(), "tmp"), ...segments);
159
+ }
160
+ async function getConfig(options = {}) {
161
+ const explorer = cosmiconfig("binary-collections", {
162
+ searchStrategy: "project",
163
+ stopDir: options.stopDir
164
+ });
165
+ try {
166
+ const result = await explorer.search(options.searchFrom);
167
+ return result ? result.config : null;
168
+ } catch {
169
+ return null;
170
+ }
161
171
  }
162
- var TEMP_BASE_DIR = getTempDir();
163
172
  module2.exports = {
164
- getTempDir,
165
173
  getTempPath,
166
- TEMP_BASE_DIR,
167
174
  GITHUB_ACCESS_TOKEN,
168
- loadDotenv: loadDotenv2
175
+ loadDotenv: loadDotenv2,
176
+ getConfig
169
177
  };
170
178
  }
171
179
  });
package/lib/rmpath.mjs CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  deleteMainScript,
4
4
  deleteMatchingFiles,
5
5
  resolveDeletePatterns
6
- } from "./chunk-I3O5ZRYU.mjs";
7
- import "./chunk-SARIXFHP.mjs";
6
+ } from "./chunk-OWNVMKAA.mjs";
7
+ import "./chunk-3T6AMFI3.mjs";
8
8
  import "./chunk-J4M5EL5P.mjs";
9
9
  import "./chunk-QQ4A6DLD.mjs";
10
10
  export {
@@ -1,88 +1,66 @@
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/run-by-checksum/hash.js
30
- var hash_exports = {};
31
- __export(hash_exports, {
32
- buildChecksum: () => buildChecksum,
33
- getAllFiles: () => getAllFiles
34
- });
35
- module.exports = __toCommonJS(hash_exports);
36
- var import_fs_extra = __toESM(require("fs-extra"), 1);
37
- var glob = __toESM(require("glob"), 1);
38
- var import_upath = __toESM(require("upath"), 1);
39
- var import_upath2 = __toESM(require("upath"), 1);
40
- var import_crypto = __toESM(require("crypto"), 1);
41
- function getAllFiles({ patterns, ignore, cwd }) {
1
+ // src/run-by-checksum/hash.cjs
2
+ var fs = require("fs-extra");
3
+ var glob = require("glob");
4
+ var path = require("upath");
5
+ var CryptoJS = require("crypto-js");
6
+ var globSync = typeof glob.sync === "function" ? glob.sync : glob.globSync;
7
+ function getAllFiles({ patterns = [], ignore = [], cwd } = {}) {
42
8
  const files = /* @__PURE__ */ new Set();
43
- const root = cwd || process.cwd();
9
+ const root = path.resolve(cwd || process.cwd());
44
10
  for (const pattern of patterns) {
45
- const matched = glob.sync(pattern, {
11
+ const matched = globSync(pattern, {
46
12
  cwd: root,
47
13
  nodir: true,
48
- ignore
14
+ ignore,
15
+ absolute: false
49
16
  });
50
17
  for (const f of matched) {
51
- files.add(import_upath.default.normalize(import_upath2.default.resolve(root, f)));
18
+ files.add(path.normalize(path.resolve(root, f)));
52
19
  }
53
20
  }
54
- return [...files].sort();
21
+ return Array.from(files).sort();
55
22
  }
56
23
  function isBinaryFile(filePath, bytesToCheck = 8e3) {
57
- const buffer = import_fs_extra.default.readFileSync(filePath, { length: bytesToCheck });
58
- for (let i = 0; i < buffer.length; i++) {
59
- if (buffer[i] === 0) {
60
- return true;
24
+ const size = Math.max(0, Number(bytesToCheck) || 0);
25
+ if (size === 0) {
26
+ return false;
27
+ }
28
+ const fd = fs.openSync(filePath, "r");
29
+ try {
30
+ const buffer = Buffer.allocUnsafe(size);
31
+ const bytesRead = fs.readSync(fd, buffer, 0, size, 0);
32
+ for (let i = 0; i < bytesRead; i++) {
33
+ if (buffer[i] === 0) {
34
+ return true;
35
+ }
61
36
  }
37
+ return false;
38
+ } finally {
39
+ fs.closeSync(fd);
62
40
  }
63
- return false;
64
41
  }
65
42
  function hashFile(file) {
66
- const isBin = isBinaryFile(file);
67
- if (!isBin) {
68
- const content = import_fs_extra.default.readFileSync(file, { encoding: "utf-8" });
69
- const normalized = content.toString().replace(/\s+/g, " ").trim();
70
- return import_crypto.default.createHash("sha256").update(normalized).digest("hex");
71
- } else {
72
- const stats = import_fs_extra.default.statSync(file);
73
- return import_crypto.default.createHash("sha256").update(file).update(String(stats.size)).digest("hex");
43
+ if (!isBinaryFile(file)) {
44
+ const content = fs.readFileSync(file, "utf8");
45
+ const normalized = content.replace(/\s+/g, " ").trim();
46
+ return CryptoJS.SHA256(normalized).toString(CryptoJS.enc.Hex);
74
47
  }
48
+ const stats = fs.statSync(file);
49
+ const binHash = CryptoJS.algo.SHA256.create();
50
+ binHash.update(file);
51
+ binHash.update(String(stats.size));
52
+ return binHash.finalize().toString(CryptoJS.enc.Hex);
75
53
  }
76
- function buildChecksum(files) {
77
- const hash = import_crypto.default.createHash("sha256");
54
+ function buildChecksum(files = []) {
55
+ const hash = CryptoJS.algo.SHA256.create();
78
56
  for (const file of files) {
79
57
  hash.update(file);
80
58
  hash.update(hashFile(file));
81
59
  }
82
- return hash.digest("hex");
60
+ return hash.finalize().toString(CryptoJS.enc.Hex);
61
+ }
62
+ function sha256(data, trim = 128) {
63
+ const hash = CryptoJS.SHA256(String(data)).toString(CryptoJS.enc.Hex);
64
+ return trim ? hash.substring(0, trim) : hash;
83
65
  }
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- buildChecksum,
87
- getAllFiles
88
- });
66
+ module.exports = { getAllFiles, buildChecksum, sha256 };
@@ -3,7 +3,7 @@
3
3
  * @param {{ patterns: string[], ignore: string[], cwd?: string }} options
4
4
  * @returns {string[]}
5
5
  */
6
- export function getAllFiles({ patterns, ignore, cwd }: {
6
+ export function getAllFiles({ patterns, ignore, cwd }?: {
7
7
  patterns: string[];
8
8
  ignore: string[];
9
9
  cwd?: string;
@@ -14,4 +14,11 @@ export function getAllFiles({ patterns, ignore, cwd }: {
14
14
  * @param {string[]} files - Ordered list of absolute file paths
15
15
  * @returns {string}
16
16
  */
17
- export function buildChecksum(files: string[]): string;
17
+ export function buildChecksum(files?: string[]): string;
18
+ /**
19
+ * Compute a SHA-256 hash of the given data, optionally trimming the output to a specified length.
20
+ * @param {string} data
21
+ * @param {number} trim
22
+ * @returns {string}
23
+ */
24
+ export function sha256(data: string, trim?: number): string;
@@ -1,10 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
- buildChecksum,
4
- getAllFiles
5
- } from "../chunk-MCCMMZSM.mjs";
3
+ require_hash
4
+ } from "../chunk-V6PTSDW5.mjs";
6
5
  import "../chunk-QQ4A6DLD.mjs";
7
- export {
8
- buildChecksum,
9
- getAllFiles
10
- };
6
+ export default require_hash();