binary-collections 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dir-tree.cmd +7 -0
- package/bin/git-diff +4 -0
- package/bin/git-diff.cmd +7 -0
- package/bin/{git-fix-encoding → git-fix} +1 -4
- package/bin/git-fix.cmd +7 -0
- package/bin/nodekill +0 -0
- package/bin/nodekill.cmd +0 -0
- package/bin/{submodule-install → submodule-install.txt} +0 -0
- package/bin/{submodule → submodule.txt} +0 -0
- package/lib/binary-collections-config.cjs +14 -0
- package/lib/binary-collections-config.d.mts +18 -0
- package/lib/binary-collections-config.d.ts +16 -0
- package/lib/binary-collections-config.js +39 -0
- package/lib/binary-collections-config.mjs +6 -0
- package/lib/binary-collections.cjs +105 -0
- package/lib/binary-collections.d.cts +2 -0
- package/lib/binary-collections.d.mts +121 -0
- package/lib/binary-collections.d.ts +121 -0
- package/lib/binary-collections.mjs +108 -0
- package/lib/chunk-4BYBVEYC.mjs +30 -0
- package/lib/chunk-AASHBCRW.mjs +57 -0
- package/lib/chunk-APBWENF6.mjs +135 -0
- package/lib/{chunk-M4IBUK4H.mjs → chunk-DPKAJKFO.mjs} +2 -4
- package/lib/chunk-EGSSKVDH.mjs +66 -0
- package/lib/{chunk-GA4DDV65.mjs → chunk-G3THLIDT.mjs} +3 -5
- package/lib/chunk-JGR2NW6D.mjs +187 -0
- package/lib/chunk-ONIBBBQ3.mjs +108 -0
- package/lib/chunk-SH3L6HHV.mjs +27 -0
- package/lib/chunk-VVEZVNIV.mjs +81 -0
- package/lib/{chunk-E75HJFJO.mjs → chunk-W3ENOM53.mjs} +2 -4
- package/lib/chunk-YV7DO3YV.mjs +48 -0
- package/lib/chunk-YX5U7XDR.mjs +58 -0
- package/lib/chunk-ZYAQRPUL.mjs +28 -0
- package/lib/clean-github-actions-caches.cjs +162 -0
- package/lib/clean-github-actions-caches.d.cts +1 -0
- package/lib/clean-github-actions-caches.d.mts +169 -0
- package/lib/clean-github-actions-caches.d.ts +169 -0
- package/lib/clean-github-actions-caches.mjs +132 -0
- package/lib/del-gradle.cjs +99 -15
- package/lib/del-gradle.d.ts +1 -2
- package/lib/del-gradle.js +12 -69
- package/lib/del-gradle.mjs +4 -6
- package/lib/del-node-modules.cjs +98 -14
- package/lib/del-node-modules.d.ts +1 -2
- package/lib/del-node-modules.js +11 -68
- package/lib/del-node-modules.mjs +3 -5
- package/lib/del-ps.cjs +98 -627
- package/lib/del-ps.d.ts +1 -2
- package/lib/del-ps.js +27 -702
- package/lib/del-ps.mjs +7 -12
- package/lib/del-yarn-caches.cjs +98 -14
- package/lib/del-yarn-caches.d.ts +1 -2
- package/lib/del-yarn-caches.js +6 -63
- package/lib/del-yarn-caches.mjs +3 -5
- package/lib/find-node-modules-cli.cjs +67 -0
- package/lib/find-node-modules-cli.d.mts +1 -0
- package/lib/find-node-modules-cli.d.ts +2 -0
- package/lib/find-node-modules-cli.js +3 -0
- package/lib/find-node-modules-cli.mjs +13 -0
- package/lib/find-node-modules.cjs +39 -9
- package/lib/find-node-modules.d.mts +12 -1
- package/lib/find-node-modules.d.ts +12 -2
- package/lib/find-node-modules.js +53 -12
- package/lib/find-node-modules.mjs +4 -19
- package/lib/git/gitattributes.cjs +171 -0
- package/lib/git/gitattributes.d.mts +35 -0
- package/lib/git/gitattributes.d.ts +33 -0
- package/lib/git/gitattributes.js +223 -0
- package/lib/git/gitattributes.mjs +6 -0
- package/lib/git/line-endings.cjs +74 -0
- package/lib/git/line-endings.d.cts +7 -0
- package/lib/git/line-endings.d.mts +83 -0
- package/lib/git/line-endings.d.ts +83 -0
- package/lib/git/line-endings.mjs +8 -0
- package/lib/git/normalize.cjs +42 -0
- package/lib/git/normalize.d.cts +6 -0
- package/lib/git/normalize.d.mts +43 -0
- package/lib/git/normalize.d.ts +43 -0
- package/lib/git/normalize.mjs +6 -0
- package/lib/git/permissions.cjs +15 -0
- package/lib/git/permissions.d.cts +6 -0
- package/lib/git/permissions.d.mts +17 -0
- package/lib/git/permissions.d.ts +17 -0
- package/lib/git/permissions.mjs +7 -0
- package/lib/git/pull-strategy.cjs +13 -0
- package/lib/git/pull-strategy.d.cts +5 -0
- package/lib/git/pull-strategy.d.mts +15 -0
- package/lib/git/pull-strategy.d.ts +15 -0
- package/lib/git/pull-strategy.mjs +7 -0
- package/lib/git/user-config.cjs +100 -0
- package/lib/git/user-config.d.cts +10 -0
- package/lib/git/user-config.d.mts +105 -0
- package/lib/git/user-config.d.ts +105 -0
- package/lib/git/user-config.mjs +8 -0
- package/lib/git/utils.cjs +70 -0
- package/lib/git/utils.d.cts +20 -0
- package/lib/git/utils.d.mts +69 -0
- package/lib/git/utils.d.ts +69 -0
- package/lib/git/utils.mjs +6 -0
- package/lib/git-diff.cjs +73 -0
- package/lib/git-diff.d.cts +2 -0
- package/lib/git-diff.d.mts +84 -0
- package/lib/git-diff.d.ts +84 -0
- package/lib/git-diff.mjs +88 -0
- package/lib/git-fix.cjs +129 -0
- package/lib/git-fix.d.cts +2 -0
- package/lib/git-fix.d.mts +141 -0
- package/lib/git-fix.d.ts +141 -0
- package/lib/git-fix.mjs +151 -0
- package/lib/git-purge.cjs +92 -621
- package/lib/git-purge.d.ts +1 -2
- package/lib/git-purge.js +53 -698
- package/lib/git-purge.mjs +4 -9
- package/lib/index.cjs +99 -1
- package/lib/index.d.mts +1 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +8 -2
- package/lib/index.mjs +10 -3
- package/lib/npm-run-series.cjs +140 -1
- package/lib/npm-run-series.d.ts +1 -0
- package/lib/npm-run-series.js +81 -56
- package/lib/npm-run-series.mjs +7 -5
- package/lib/package-resolutions-updater.cjs +274 -0
- package/lib/package-resolutions-updater.d.mts +1 -0
- package/lib/package-resolutions-updater.d.ts +326 -0
- package/lib/package-resolutions-updater.mjs +316 -0
- package/lib/print-directory-tree.cjs +241 -0
- package/lib/print-directory-tree.d.cts +1 -0
- package/lib/print-directory-tree.d.mts +234 -0
- package/lib/print-directory-tree.d.ts +234 -0
- package/lib/print-directory-tree.mjs +182 -0
- package/lib/ps/connected-domain.cjs +0 -0
- package/lib/ps/connected-domain.d.ts +1 -2
- package/lib/ps/connected-domain.js +196 -150
- package/lib/ps/connected-domain.mjs +2 -3
- package/lib/ps/index.cjs +3 -3
- package/lib/ps/index.d.mjs +1 -2
- package/lib/ps/index.d.ts +2 -26
- package/lib/ps/index.js +233 -535
- package/lib/ps/index.mjs +9 -11
- package/lib/ps/isWin.cjs +0 -0
- package/lib/ps/isWin.d.ts +1 -2
- package/lib/ps/isWin.js +1 -2
- package/lib/ps/isWin.mjs +2 -3
- package/lib/ps/table-parser.cjs +0 -0
- package/lib/ps/table-parser.d.ts +1 -3
- package/lib/ps/table-parser.js +254 -345
- package/lib/ps/table-parser.mjs +3 -4
- package/lib/submodule-install.cjs +100 -0
- package/lib/submodule-install.d.cts +2 -0
- package/lib/submodule-install.d.mts +121 -0
- package/lib/submodule-install.d.ts +121 -0
- package/lib/submodule-install.mjs +107 -0
- package/lib/utils.cjs +98 -14
- package/lib/utils.d.mts +29 -9
- package/lib/utils.d.ts +30 -14
- package/lib/utils.js +173 -27
- package/lib/utils.mjs +2 -3
- package/lib/yarn-reinstall.cjs +44 -0
- package/lib/yarn-reinstall.d.cts +1 -0
- package/lib/yarn-reinstall.d.mts +49 -0
- package/lib/yarn-reinstall.d.ts +49 -0
- package/lib/yarn-reinstall.mjs +54 -0
- package/package.json +126 -99
- package/readme.md +238 -50
- package/src/package-resolutions-updater.mjs +325 -0
- package/src/print-directory-tree.cjs +234 -0
- package/src/ps/index.js +4 -3
- package/src/yarn-reinstall.cjs +49 -0
- package/test-project/package.json +16 -0
- package/tmp/test-repo/package.json +7 -0
- package/bin/git-fix-encoding.cmd +0 -6
- package/eslint.config.cjs +0 -97
- package/lib/chunk-7MSZ52XC.mjs +0 -14
- package/lib/chunk-AVDT32AY.mjs +0 -20
- package/lib/chunk-LPLPQBYP.mjs +0 -53
- package/lib/chunk-S4SJ7SDW.mjs +0 -625
- package/lib/package-resolutions.cjs +0 -28
- package/lib/package-resolutions.d.mts +0 -25
- package/lib/package-resolutions.d.ts +0 -25
- package/lib/package-resolutions.js +0 -28
- package/lib/package-resolutions.mjs +0 -31
- package/lib/ps/index.d.js +0 -17
package/lib/del-ps.mjs
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_isWin
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
require_dist
|
|
7
|
-
} from "./chunk-S4SJ7SDW.mjs";
|
|
4
|
+
} from "./chunk-W3ENOM53.mjs";
|
|
8
5
|
import {
|
|
9
6
|
require_utils
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-APBWENF6.mjs";
|
|
11
8
|
import {
|
|
9
|
+
__require,
|
|
12
10
|
init_esm_shims
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
__require
|
|
16
|
-
} from "./chunk-AVDT32AY.mjs";
|
|
11
|
+
} from "./chunk-AASHBCRW.mjs";
|
|
17
12
|
|
|
18
13
|
// src/del-ps.js
|
|
19
14
|
init_esm_shims();
|
|
20
|
-
var crossSpawn =
|
|
15
|
+
var crossSpawn = __require("cross-spawn");
|
|
21
16
|
var ps = __require("ps-node");
|
|
22
17
|
var isWin = require_isWin();
|
|
23
|
-
var
|
|
24
|
-
|
|
18
|
+
var { getArgs } = require_utils();
|
|
19
|
+
getArgs()._.forEach((command) => {
|
|
25
20
|
ps.lookup(
|
|
26
21
|
{
|
|
27
22
|
command,
|
package/lib/del-yarn-caches.cjs
CHANGED
|
@@ -16,23 +16,56 @@ var init_cjs_shims = __esm({
|
|
|
16
16
|
var require_utils = __commonJS({
|
|
17
17
|
"src/utils.js"(exports2, module2) {
|
|
18
18
|
init_cjs_shims();
|
|
19
|
-
var
|
|
19
|
+
var fs = require("fs");
|
|
20
|
+
var path = require("upath");
|
|
20
21
|
var argv = require("minimist")(process.argv.slice(2));
|
|
22
|
+
var { exec } = require("child_process");
|
|
23
|
+
var { URL: URL2 } = require("url");
|
|
24
|
+
var { promisify } = require("util");
|
|
25
|
+
var execAsync = promisify(exec);
|
|
26
|
+
async function parseGitRemotes() {
|
|
27
|
+
try {
|
|
28
|
+
const { stdout } = await execAsync("git remote -v");
|
|
29
|
+
const lines = stdout.split("\n");
|
|
30
|
+
const remotes = {};
|
|
31
|
+
lines.forEach((line) => {
|
|
32
|
+
const [name, url] = line.split(" ");
|
|
33
|
+
if (name && url) {
|
|
34
|
+
const [repoUrl] = url.split(" ");
|
|
35
|
+
try {
|
|
36
|
+
const parsedUrl = new URL2(repoUrl);
|
|
37
|
+
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
38
|
+
if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
|
|
39
|
+
let repoPath = pathParts.join("/");
|
|
40
|
+
if (repoPath.endsWith(".git")) {
|
|
41
|
+
repoPath = repoPath.slice(0, -4);
|
|
42
|
+
}
|
|
43
|
+
remotes[name] = repoPath;
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.error("URL Parsing Error:", e.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return remotes;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error("Error:", error.message);
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
module2.exports.parseGitRemotes = parseGitRemotes;
|
|
57
|
+
function joinPathPreserveDriveLetter(...segments) {
|
|
58
|
+
let fullPath = require("path").join(...segments);
|
|
59
|
+
if (/^[a-z]:\\/.test(fullPath)) {
|
|
60
|
+
fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
|
|
61
|
+
}
|
|
62
|
+
return fullPath;
|
|
63
|
+
}
|
|
64
|
+
module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
|
|
21
65
|
function getArgs() {
|
|
22
66
|
return argv;
|
|
23
67
|
}
|
|
24
|
-
|
|
25
|
-
globStream.stream().on("data", (result) => {
|
|
26
|
-
const fullPath = path.resolve(process.cwd(), result);
|
|
27
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
28
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
29
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
30
|
-
del(subdir[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
del(fullPath);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
68
|
+
module2.exports.getArgs = getArgs;
|
|
36
69
|
function del(fullPath) {
|
|
37
70
|
if (fs.statSync(fullPath).isDirectory()) {
|
|
38
71
|
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
@@ -48,8 +81,59 @@ var require_utils = __commonJS({
|
|
|
48
81
|
}
|
|
49
82
|
}
|
|
50
83
|
}
|
|
84
|
+
module2.exports.del = del;
|
|
85
|
+
function delStream2(globStream) {
|
|
86
|
+
globStream.stream().on("data", (result) => {
|
|
87
|
+
const fullPath = path.resolve(process.cwd(), result);
|
|
88
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
89
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
90
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
91
|
+
del(subdir[i]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
del(fullPath);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
module2.exports.delStream = delStream2;
|
|
98
|
+
function getFileTreeString(hashArray) {
|
|
99
|
+
const tree = {};
|
|
100
|
+
const hashMap = {};
|
|
101
|
+
for (const entry of hashArray) {
|
|
102
|
+
const [filePath, hash] = entry.split(" ");
|
|
103
|
+
hashMap[filePath] = hash;
|
|
104
|
+
const parts = filePath.split("/");
|
|
105
|
+
let current = tree;
|
|
106
|
+
for (let i = 0; i < parts.length; i++) {
|
|
107
|
+
const part = parts[i];
|
|
108
|
+
if (i === parts.length - 1) {
|
|
109
|
+
current[part] = null;
|
|
110
|
+
} else {
|
|
111
|
+
current[part] = current[part] || {};
|
|
112
|
+
current = current[part];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function printNode(node, prefix = "", parentPath = "") {
|
|
117
|
+
const keys = Object.keys(node).sort();
|
|
118
|
+
let lines = [];
|
|
119
|
+
keys.forEach((key, idx) => {
|
|
120
|
+
const isLast = idx === keys.length - 1;
|
|
121
|
+
const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
122
|
+
const currentPath = parentPath ? parentPath + "/" + key : key;
|
|
123
|
+
if (node[key] === null) {
|
|
124
|
+
lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
|
|
125
|
+
} else {
|
|
126
|
+
lines.push(prefix + branch + key + "/");
|
|
127
|
+
lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return lines;
|
|
131
|
+
}
|
|
132
|
+
return printNode(tree, "", "").join("\n");
|
|
133
|
+
}
|
|
134
|
+
module2.exports.getFileTreeString = getFileTreeString;
|
|
51
135
|
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
|
-
module2.exports =
|
|
136
|
+
module2.exports.delay = delay;
|
|
53
137
|
}
|
|
54
138
|
});
|
|
55
139
|
|
package/lib/del-yarn-caches.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export {};
|
package/lib/del-yarn-caches.js
CHANGED
|
@@ -1,65 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.js
|
|
16
|
-
var require_utils = __commonJS({
|
|
17
|
-
"src/utils.js"(exports2, module2) {
|
|
18
|
-
init_cjs_shims();
|
|
19
|
-
var { fs, path } = require("sbg-utility");
|
|
20
|
-
var argv = require("minimist")(process.argv.slice(2));
|
|
21
|
-
function getArgs() {
|
|
22
|
-
return argv;
|
|
23
|
-
}
|
|
24
|
-
function delStream2(globStream) {
|
|
25
|
-
globStream.stream().on("data", (result) => {
|
|
26
|
-
const fullPath = path.resolve(process.cwd(), result);
|
|
27
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
28
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
29
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
30
|
-
del(subdir[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
del(fullPath);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function del(fullPath) {
|
|
37
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
38
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
39
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
40
|
-
del(subdir[i]);
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
try {
|
|
44
|
-
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
45
|
-
console.log("deleted", fullPath);
|
|
46
|
-
} catch (_) {
|
|
47
|
-
console.log("failed delete", fullPath);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
|
-
module2.exports = { del, delStream: delStream2, getArgs, delay };
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// src/del-yarn-caches.js
|
|
57
|
-
init_cjs_shims();
|
|
58
|
-
var glob = require("glob");
|
|
59
|
-
var { delStream } = require_utils();
|
|
60
|
-
var g3 = new glob.Glob(["**/.yarn/cache*", "**/.yarn/*.gz"], {
|
|
61
|
-
withFileTypes: false,
|
|
62
|
-
cwd: process.cwd(),
|
|
63
|
-
ignore: ["**/.git*", "**/vendor/**"]
|
|
1
|
+
const glob = require("glob");
|
|
2
|
+
const { delStream } = require("./utils");
|
|
3
|
+
const g3 = new glob.Glob(["**/.yarn/cache*", "**/.yarn/*.gz"], {
|
|
4
|
+
withFileTypes: false,
|
|
5
|
+
cwd: process.cwd(),
|
|
6
|
+
ignore: ["**/.git*", "**/vendor/**"]
|
|
64
7
|
});
|
|
65
8
|
delStream(g3);
|
package/lib/del-yarn-caches.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_utils
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-APBWENF6.mjs";
|
|
5
5
|
import {
|
|
6
|
+
__require,
|
|
6
7
|
init_esm_shims
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
__require
|
|
10
|
-
} from "./chunk-AVDT32AY.mjs";
|
|
8
|
+
} from "./chunk-AASHBCRW.mjs";
|
|
11
9
|
|
|
12
10
|
// src/del-yarn-caches.js
|
|
13
11
|
init_esm_shims();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __esm = (fn, res) => function __init() {
|
|
4
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
+
};
|
|
6
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
7
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// node_modules/tsup/assets/cjs_shims.js
|
|
11
|
+
var init_cjs_shims = __esm({
|
|
12
|
+
"node_modules/tsup/assets/cjs_shims.js"() {
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// src/find-node-modules.js
|
|
17
|
+
var require_find_node_modules = __commonJS({
|
|
18
|
+
"src/find-node-modules.js"(exports2, module2) {
|
|
19
|
+
init_cjs_shims();
|
|
20
|
+
var glob = require("glob");
|
|
21
|
+
var path = require("path");
|
|
22
|
+
function findNodeModules2(dir = process.cwd(), callback = null) {
|
|
23
|
+
const finalDir = typeof dir === "string" ? dir : process.cwd();
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
const results = [];
|
|
26
|
+
const g3 = new glob.Glob("**/node_modules", {
|
|
27
|
+
withFileTypes: false,
|
|
28
|
+
cwd: finalDir,
|
|
29
|
+
ignore: ["**/.git*", "**/vendor/**"]
|
|
30
|
+
});
|
|
31
|
+
const stream = g3.stream();
|
|
32
|
+
stream.on("data", (result) => {
|
|
33
|
+
const fullPath = path.resolve(finalDir, result);
|
|
34
|
+
if (typeof callback === "function") {
|
|
35
|
+
try {
|
|
36
|
+
callback(fullPath);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
console.error("findNodeModules callback error:", err);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
results.push(fullPath);
|
|
42
|
+
});
|
|
43
|
+
stream.on("error", (err) => reject(err));
|
|
44
|
+
stream.on("end", () => {
|
|
45
|
+
if (results.length === 0) {
|
|
46
|
+
console.log("No node_modules directories found.");
|
|
47
|
+
}
|
|
48
|
+
resolve(results);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (typeof module2 !== "undefined" && require.main === module2) {
|
|
53
|
+
findNodeModules2(null, console.log).then((dirs) => {
|
|
54
|
+
console.log(`Found ${dirs.length} node_modules directories.`);
|
|
55
|
+
}).catch((err) => {
|
|
56
|
+
console.error("Error finding node_modules directories:", err);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
module2.exports = findNodeModules2;
|
|
60
|
+
module2.exports.default = findNodeModules2;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// src/find-node-modules-cli.js
|
|
65
|
+
init_cjs_shims();
|
|
66
|
+
var findNodeModules = require_find_node_modules();
|
|
67
|
+
findNodeModules(null, console.log);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
require_find_node_modules
|
|
5
|
+
} from "./chunk-YX5U7XDR.mjs";
|
|
6
|
+
import {
|
|
7
|
+
init_esm_shims
|
|
8
|
+
} from "./chunk-AASHBCRW.mjs";
|
|
9
|
+
|
|
10
|
+
// src/find-node-modules-cli.js
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var findNodeModules = require_find_node_modules();
|
|
13
|
+
findNodeModules(null, console.log);
|
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
// src/find-node-modules.js
|
|
2
2
|
var glob = require("glob");
|
|
3
3
|
var path = require("path");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
4
|
+
function findNodeModules(dir = process.cwd(), callback = null) {
|
|
5
|
+
const finalDir = typeof dir === "string" ? dir : process.cwd();
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const results = [];
|
|
8
|
+
const g3 = new glob.Glob("**/node_modules", {
|
|
9
|
+
withFileTypes: false,
|
|
10
|
+
cwd: finalDir,
|
|
11
|
+
ignore: ["**/.git*", "**/vendor/**"]
|
|
12
|
+
});
|
|
13
|
+
const stream = g3.stream();
|
|
14
|
+
stream.on("data", (result) => {
|
|
15
|
+
const fullPath = path.resolve(finalDir, result);
|
|
16
|
+
if (typeof callback === "function") {
|
|
17
|
+
try {
|
|
18
|
+
callback(fullPath);
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error("findNodeModules callback error:", err);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
results.push(fullPath);
|
|
24
|
+
});
|
|
25
|
+
stream.on("error", (err) => reject(err));
|
|
26
|
+
stream.on("end", () => {
|
|
27
|
+
if (results.length === 0) {
|
|
28
|
+
console.log("No node_modules directories found.");
|
|
29
|
+
}
|
|
30
|
+
resolve(results);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (typeof module !== "undefined" && require.main === module) {
|
|
35
|
+
findNodeModules(null, console.log).then((dirs) => {
|
|
36
|
+
console.log(`Found ${dirs.length} node_modules directories.`);
|
|
37
|
+
}).catch((err) => {
|
|
38
|
+
console.error("Error finding node_modules directories:", err);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
module.exports = findNodeModules;
|
|
42
|
+
module.exports.default = findNodeModules;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asynchronously finds all "node_modules" directories within the given directory.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} [dir=process.cwd()] - The directory to start the search from. Defaults to the current working directory.
|
|
5
|
+
* @param {function} [callback=null] - Optional callback function that gets called with each found "node_modules" path.
|
|
6
|
+
* @returns {Promise<string[]>} - A promise that resolves to an array of full paths to "node_modules" directories.
|
|
7
|
+
*/
|
|
8
|
+
declare function findNodeModules(dir?: string, callback?: Function): Promise<string[]>;
|
|
9
|
+
declare namespace findNodeModules {
|
|
10
|
+
export { findNodeModules as default };
|
|
11
|
+
}
|
|
1
12
|
|
|
2
|
-
export {
|
|
13
|
+
export { findNodeModules as default };
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export = findNodeModules;
|
|
2
|
+
/**
|
|
3
|
+
* Asynchronously finds all "node_modules" directories within the given directory.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} [dir=process.cwd()] - The directory to start the search from. Defaults to the current working directory.
|
|
6
|
+
* @param {function} [callback=null] - Optional callback function that gets called with each found "node_modules" path.
|
|
7
|
+
* @returns {Promise<string[]>} - A promise that resolves to an array of full paths to "node_modules" directories.
|
|
8
|
+
*/
|
|
9
|
+
declare function findNodeModules(dir?: string, callback?: Function): Promise<string[]>;
|
|
10
|
+
declare namespace findNodeModules {
|
|
11
|
+
export { findNodeModules as default };
|
|
12
|
+
}
|
package/lib/find-node-modules.js
CHANGED
|
@@ -1,12 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
const glob = require("glob");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
/**
|
|
4
|
+
* Asynchronously finds all "node_modules" directories within the given directory.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} [dir=process.cwd()] - The directory to start the search from. Defaults to the current working directory.
|
|
7
|
+
* @param {function} [callback=null] - Optional callback function that gets called with each found "node_modules" path.
|
|
8
|
+
* @returns {Promise<string[]>} - A promise that resolves to an array of full paths to "node_modules" directories.
|
|
9
|
+
*/
|
|
10
|
+
function findNodeModules(dir = process.cwd(), callback = null) {
|
|
11
|
+
const finalDir = typeof dir === "string" ? dir : process.cwd();
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const results = [];
|
|
14
|
+
const g3 = new glob.Glob("**/node_modules", {
|
|
15
|
+
withFileTypes: false,
|
|
16
|
+
cwd: finalDir,
|
|
17
|
+
ignore: ["**/.git*", "**/vendor/**"]
|
|
18
|
+
});
|
|
19
|
+
const stream = g3.stream();
|
|
20
|
+
stream.on("data", (result) => {
|
|
21
|
+
const fullPath = path.resolve(finalDir, result);
|
|
22
|
+
if (typeof callback === "function") {
|
|
23
|
+
try {
|
|
24
|
+
callback(fullPath); // Safely invoke callback
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
console.error("findNodeModules callback error:", err);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
results.push(fullPath);
|
|
31
|
+
});
|
|
32
|
+
stream.on("error", (err) => reject(err)); // Handle errors
|
|
33
|
+
stream.on("end", () => {
|
|
34
|
+
if (results.length === 0) {
|
|
35
|
+
console.log("No node_modules directories found.");
|
|
36
|
+
}
|
|
37
|
+
resolve(results); // Resolve the full array when the stream ends
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
// Support both CommonJS and ESM usage
|
|
42
|
+
if (typeof module !== "undefined" && require.main === module) {
|
|
43
|
+
findNodeModules(null, console.log)
|
|
44
|
+
.then((dirs) => {
|
|
45
|
+
console.log(`Found ${dirs.length} node_modules directories.`);
|
|
46
|
+
})
|
|
47
|
+
.catch((err) => {
|
|
48
|
+
console.error("Error finding node_modules directories:", err);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// ESM export support
|
|
52
|
+
module.exports = findNodeModules;
|
|
53
|
+
module.exports.default = findNodeModules;
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
} from "./chunk-AVDT32AY.mjs";
|
|
8
|
-
|
|
9
|
-
// src/find-node-modules.js
|
|
10
|
-
init_esm_shims();
|
|
11
|
-
var glob = __require("glob");
|
|
12
|
-
var path = __require("path");
|
|
13
|
-
var g3 = new glob.Glob("**/node_modules", {
|
|
14
|
-
withFileTypes: false,
|
|
15
|
-
cwd: process.cwd(),
|
|
16
|
-
ignore: ["**/.git*", "**/vendor/**"]
|
|
17
|
-
});
|
|
18
|
-
g3.stream().on("data", (result) => {
|
|
19
|
-
const fullPath = path.resolve(process.cwd(), result);
|
|
20
|
-
console.log(fullPath);
|
|
21
|
-
});
|
|
3
|
+
require_find_node_modules
|
|
4
|
+
} from "./chunk-YX5U7XDR.mjs";
|
|
5
|
+
import "./chunk-AASHBCRW.mjs";
|
|
6
|
+
export default require_find_node_modules();
|