binary-collections 2.0.5 → 2.0.7

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 (126) hide show
  1. package/bin/bash-dummy +7 -2
  2. package/bin/clean-nodemodule +7 -2
  3. package/bin/clean-nodemodules +7 -2
  4. package/bin/dev +7 -2
  5. package/bin/empty +7 -2
  6. package/bin/git-diff.cmd +4 -0
  7. package/bin/git-fix-encoding +7 -2
  8. package/bin/git-fix-encoding.cmd +0 -0
  9. package/bin/git-reduce-size +7 -2
  10. package/bin/kill-process +7 -2
  11. package/bin/nodekill +7 -2
  12. package/bin/nodekill.cmd +0 -0
  13. package/bin/nodekill.ps1 +0 -0
  14. package/bin/prod +7 -2
  15. package/bin/rmfind +7 -2
  16. package/bin/rmpath +7 -2
  17. package/bin/rmx +9 -3
  18. package/bin/submodule +13 -2
  19. package/bin/submodule-install +7 -2
  20. package/bin/submodule-remove +7 -2
  21. package/lib/chunk-3LOB2P54.mjs +202 -0
  22. package/lib/chunk-4LEXWIIF.mjs +173 -0
  23. package/lib/chunk-BSD5CIRU.mjs +52 -0
  24. package/lib/chunk-FB6YIQYR.mjs +42 -0
  25. package/lib/chunk-JL32QDSH.mjs +20 -0
  26. package/lib/chunk-OKYLF2MU.mjs +53 -0
  27. package/lib/chunk-VXZQNLPU.mjs +23 -0
  28. package/lib/del-gradle.cjs +72 -0
  29. package/lib/del-gradle.d.mts +2 -0
  30. package/lib/del-gradle.d.ts +1 -0
  31. package/lib/del-gradle.js +15 -0
  32. package/lib/del-gradle.mjs +28 -0
  33. package/lib/del-node-modules.cjs +72 -0
  34. package/lib/del-node-modules.d.mts +2 -0
  35. package/lib/del-node-modules.d.ts +1 -0
  36. package/lib/del-node-modules.js +11 -15
  37. package/lib/del-node-modules.mjs +28 -0
  38. package/lib/del-ps.cjs +93 -0
  39. package/lib/del-ps.d.mts +2 -0
  40. package/lib/del-ps.d.ts +1 -0
  41. package/lib/del-ps.js +31 -0
  42. package/lib/del-ps.mjs +43 -0
  43. package/lib/del-yarn-caches.cjs +65 -0
  44. package/lib/del-yarn-caches.d.mts +2 -0
  45. package/lib/del-yarn-caches.d.ts +1 -0
  46. package/lib/del-yarn-caches.js +6 -9
  47. package/lib/del-yarn-caches.mjs +21 -0
  48. package/lib/find-node-modules-cli.cjs +59 -0
  49. package/lib/find-node-modules-cli.d.mts +1 -0
  50. package/lib/find-node-modules-cli.d.ts +2 -0
  51. package/lib/find-node-modules-cli.js +3 -0
  52. package/lib/find-node-modules-cli.mjs +14 -0
  53. package/lib/find-node-modules.cjs +34 -0
  54. package/lib/find-node-modules.d.mts +10 -0
  55. package/lib/find-node-modules.d.ts +9 -0
  56. package/lib/find-node-modules.js +41 -13
  57. package/lib/find-node-modules.mjs +7 -0
  58. package/lib/git-diff.cjs +74 -0
  59. package/lib/git-diff.d.cts +2 -0
  60. package/lib/git-diff.d.mts +87 -0
  61. package/lib/git-diff.d.ts +87 -0
  62. package/lib/git-diff.mjs +83 -0
  63. package/lib/git-purge.cjs +91 -0
  64. package/lib/git-purge.d.mts +2 -0
  65. package/lib/git-purge.d.ts +1 -0
  66. package/lib/git-purge.js +59 -0
  67. package/lib/git-purge.mjs +47 -0
  68. package/lib/index.cjs +92 -0
  69. package/lib/index.d.mts +1 -0
  70. package/lib/index.d.ts +2 -0
  71. package/lib/index.js +8 -0
  72. package/lib/index.mjs +18 -0
  73. package/lib/npm-run-series.cjs +61 -0
  74. package/lib/npm-run-series.d.mts +1 -0
  75. package/lib/npm-run-series.d.ts +2 -0
  76. package/lib/npm-run-series.js +80 -39
  77. package/lib/npm-run-series.mjs +47 -0
  78. package/lib/package-resolutions.cjs +28 -0
  79. package/lib/package-resolutions.d.mts +25 -0
  80. package/lib/package-resolutions.d.ts +25 -0
  81. package/lib/package-resolutions.mjs +31 -0
  82. package/lib/ps/connected-domain.cjs +156 -0
  83. package/lib/ps/connected-domain.d.mts +3 -0
  84. package/lib/ps/connected-domain.d.ts +2 -0
  85. package/lib/ps/connected-domain.js +202 -0
  86. package/lib/ps/connected-domain.mjs +7 -0
  87. package/lib/ps/index.cjs +555 -0
  88. package/lib/ps/index.d.cjs +17 -0
  89. package/lib/ps/index.d.d.mts +26 -0
  90. package/lib/ps/index.d.d.ts +26 -0
  91. package/lib/ps/index.d.mjs +8 -0
  92. package/lib/ps/index.d.mts +26 -0
  93. package/lib/ps/index.d.ts +2 -0
  94. package/lib/ps/index.js +250 -0
  95. package/lib/ps/index.mjs +203 -0
  96. package/lib/ps/isWin.cjs +3 -0
  97. package/lib/ps/isWin.d.mts +3 -0
  98. package/lib/ps/isWin.d.ts +2 -0
  99. package/lib/ps/isWin.js +2 -0
  100. package/lib/ps/isWin.mjs +7 -0
  101. package/lib/ps/table-parser.cjs +359 -0
  102. package/lib/ps/table-parser.d.mts +3 -0
  103. package/lib/ps/table-parser.d.ts +1 -0
  104. package/lib/ps/table-parser.js +268 -0
  105. package/lib/ps/table-parser.mjs +8 -0
  106. package/lib/submodule-install.cjs +118 -0
  107. package/lib/submodule-install.d.cts +2 -0
  108. package/lib/submodule-install.d.mts +141 -0
  109. package/lib/submodule-install.d.ts +141 -0
  110. package/lib/submodule-install.mjs +116 -0
  111. package/lib/utils.cjs +35 -0
  112. package/lib/utils.d.mts +20 -0
  113. package/lib/utils.d.ts +16 -0
  114. package/lib/utils.js +42 -28
  115. package/lib/utils.mjs +7 -0
  116. package/lib/yarn-reinstall.cjs +42 -0
  117. package/lib/yarn-reinstall.d.cts +1 -0
  118. package/lib/yarn-reinstall.d.mts +45 -0
  119. package/lib/yarn-reinstall.d.ts +45 -0
  120. package/lib/yarn-reinstall.mjs +50 -0
  121. package/package.json +80 -38
  122. package/readme.md +188 -40
  123. package/src/ps/index.js +285 -0
  124. package/test/package.json +19 -0
  125. package/index.js +0 -1
  126. package/lib/package-resolutions.json +0 -22
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ const { execSync } = require("child_process");
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ // Output path
7
+ const CACHE_DIR = ".cache/git";
8
+ const OUTPUT = path.join(CACHE_DIR, "diff.txt");
9
+
10
+ // Ensure output directory exists
11
+ if (!fs.existsSync(CACHE_DIR)) {
12
+ fs.mkdirSync(CACHE_DIR, { recursive: true });
13
+ }
14
+
15
+ function showHelp() {
16
+ console.log("Git Diff Helper");
17
+ console.log("----------------------------");
18
+ console.log("Usage:");
19
+ console.log(" git-diff FILE Show staged diff of specified file");
20
+ console.log(" git-diff --staged-only Show staged diff of all files");
21
+ console.log(" git-diff -s | -S Same as --staged-only");
22
+ console.log(" git-diff --help | -h Show this help message");
23
+ console.log("");
24
+ console.log(`Output is saved to: ${OUTPUT}`);
25
+ process.exit(0);
26
+ }
27
+
28
+ function runGitDiff(command, successMessage, errorMessage) {
29
+ try {
30
+ console.log(`[i] Running command: ${command}`);
31
+ const result = execSync(command, { encoding: "utf8" });
32
+
33
+ // If result is empty, inform user but don't treat as error
34
+ if (!result || result.trim() === "") {
35
+ console.log(`[i] No changes found for the specified criteria`);
36
+ fs.writeFileSync(OUTPUT, "# No changes found\n");
37
+ console.log(`[✓] Empty diff saved to "${OUTPUT}"`);
38
+ return;
39
+ }
40
+
41
+ fs.writeFileSync(OUTPUT, result);
42
+ console.log(`[✓] ${successMessage}`);
43
+ } catch (error) {
44
+ console.error(`[✗] ${errorMessage}`);
45
+ console.error(`Command: ${command}`);
46
+ console.error(`Error: ${error.message}`);
47
+
48
+ // Check if it's a git-related error
49
+ if (error.message.includes("not a git repository")) {
50
+ console.error("Make sure you are in a git repository");
51
+ }
52
+
53
+ process.exit(1);
54
+ }
55
+ }
56
+
57
+ // Parse command line arguments
58
+ const args = process.argv.slice(2);
59
+
60
+ // Show help if no arguments or --help/-h is passed
61
+ if (args[0] === "--help" || args[0] === "-h") {
62
+ showHelp();
63
+ }
64
+
65
+ // Parse options
66
+ switch (args[0]) {
67
+ case "--staged-only":
68
+ case "-s":
69
+ case "-S":
70
+ runGitDiff("git --no-pager diff --staged", `Full staged diff saved to "${OUTPUT}"`, "Failed to save staged diff");
71
+ break;
72
+
73
+ default: {
74
+ // Handle specific file diff
75
+ const file = args[0];
76
+ if (!file) {
77
+ runGitDiff("git --no-pager diff", `Full staged diff saved to "${OUTPUT}"`, "Failed to save all diff's");
78
+ } else {
79
+ runGitDiff(
80
+ `git --no-pager diff --cached -- "${file}"`,
81
+ `Staged diff of "${file}" saved to "${OUTPUT}"`,
82
+ `Failed to generate diff for "${file}"`
83
+ );
84
+ }
85
+ break;
86
+ }
87
+ }
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
+ import {
4
+ init_esm_shims
5
+ } from "./chunk-VXZQNLPU.mjs";
6
+ import {
7
+ __commonJS,
8
+ __require
9
+ } from "./chunk-FB6YIQYR.mjs";
10
+
11
+ // src/git-diff.cjs
12
+ var require_git_diff = __commonJS({
13
+ "src/git-diff.cjs"() {
14
+ init_esm_shims();
15
+ var { execSync } = __require("child_process");
16
+ var fs = __require("fs");
17
+ var path = __require("path");
18
+ var CACHE_DIR = ".cache/git";
19
+ var OUTPUT = path.join(CACHE_DIR, "diff.txt");
20
+ if (!fs.existsSync(CACHE_DIR)) {
21
+ fs.mkdirSync(CACHE_DIR, { recursive: true });
22
+ }
23
+ function showHelp() {
24
+ console.log("Git Diff Helper");
25
+ console.log("----------------------------");
26
+ console.log("Usage:");
27
+ console.log(" git-diff FILE Show staged diff of specified file");
28
+ console.log(" git-diff --staged-only Show staged diff of all files");
29
+ console.log(" git-diff -s | -S Same as --staged-only");
30
+ console.log(" git-diff --help | -h Show this help message");
31
+ console.log("");
32
+ console.log(`Output is saved to: ${OUTPUT}`);
33
+ process.exit(0);
34
+ }
35
+ function runGitDiff(command, successMessage, errorMessage) {
36
+ try {
37
+ console.log(`[i] Running command: ${command}`);
38
+ const result = execSync(command, { encoding: "utf8" });
39
+ if (!result || result.trim() === "") {
40
+ console.log(`[i] No changes found for the specified criteria`);
41
+ fs.writeFileSync(OUTPUT, "# No changes found\n");
42
+ console.log(`[\u2713] Empty diff saved to "${OUTPUT}"`);
43
+ return;
44
+ }
45
+ fs.writeFileSync(OUTPUT, result);
46
+ console.log(`[\u2713] ${successMessage}`);
47
+ } catch (error) {
48
+ console.error(`[\u2717] ${errorMessage}`);
49
+ console.error(`Command: ${command}`);
50
+ console.error(`Error: ${error.message}`);
51
+ if (error.message.includes("not a git repository")) {
52
+ console.error("Make sure you are in a git repository");
53
+ }
54
+ process.exit(1);
55
+ }
56
+ }
57
+ var args = process.argv.slice(2);
58
+ if (args[0] === "--help" || args[0] === "-h") {
59
+ showHelp();
60
+ }
61
+ switch (args[0]) {
62
+ case "--staged-only":
63
+ case "-s":
64
+ case "-S":
65
+ runGitDiff("git --no-pager diff --staged", `Full staged diff saved to "${OUTPUT}"`, "Failed to save staged diff");
66
+ break;
67
+ default: {
68
+ const file = args[0];
69
+ if (!file) {
70
+ runGitDiff("git --no-pager diff", `Full staged diff saved to "${OUTPUT}"`, "Failed to save all diff's");
71
+ } else {
72
+ runGitDiff(
73
+ `git --no-pager diff --cached -- "${file}"`,
74
+ `Staged diff of "${file}" saved to "${OUTPUT}"`,
75
+ `Failed to generate diff for "${file}"`
76
+ );
77
+ }
78
+ break;
79
+ }
80
+ }
81
+ }
82
+ });
83
+ export default require_git_diff();
@@ -0,0 +1,91 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __esm = (fn, res) => function __init() {
3
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
4
+ };
5
+ var __commonJS = (cb, mod) => function __require() {
6
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ };
8
+
9
+ // node_modules/tsup/assets/cjs_shims.js
10
+ var init_cjs_shims = __esm({
11
+ "node_modules/tsup/assets/cjs_shims.js"() {
12
+ }
13
+ });
14
+
15
+ // src/utils.js
16
+ var require_utils = __commonJS({
17
+ "src/utils.js"(exports2, module2) {
18
+ init_cjs_shims();
19
+ var { fs, path: path2 } = require("sbg-utility");
20
+ var argv = require("minimist")(process.argv.slice(2));
21
+ function getArgs() {
22
+ return argv;
23
+ }
24
+ function del(fullPath) {
25
+ if (fs.statSync(fullPath).isDirectory()) {
26
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
27
+ for (let i = 0; i < subdir.length; i++) {
28
+ del(subdir[i]);
29
+ }
30
+ } else {
31
+ try {
32
+ fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
33
+ console.log("deleted", fullPath);
34
+ } catch (_) {
35
+ console.log("failed delete", fullPath);
36
+ }
37
+ }
38
+ }
39
+ function delStream(globStream) {
40
+ globStream.stream().on("data", (result) => {
41
+ const fullPath = path2.resolve(process.cwd(), result);
42
+ if (fs.statSync(fullPath).isDirectory()) {
43
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
44
+ for (let i = 0; i < subdir.length; i++) {
45
+ del(subdir[i]);
46
+ }
47
+ }
48
+ del(fullPath);
49
+ });
50
+ }
51
+ var delay2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
52
+ module2.exports = { del, delStream, getArgs, delay: delay2 };
53
+ }
54
+ });
55
+
56
+ // src/git-purge.js
57
+ init_cjs_shims();
58
+ var { spawnAsync } = require("cross-spawn");
59
+ var glob = require("glob");
60
+ var path = require("path");
61
+ var { delay } = require_utils();
62
+ var dirs = [];
63
+ var fetchDirs = (pattern, callback) => {
64
+ const globStream = new glob.Glob(pattern, {
65
+ withFileTypes: false,
66
+ cwd: process.cwd(),
67
+ ignore: ["**/node_modules/**", "**/vendor/**"]
68
+ });
69
+ globStream.stream().on("data", (result) => {
70
+ const fullPath = path.resolve(process.cwd(), result);
71
+ if (typeof callback == "function") callback(fullPath);
72
+ const base = path.dirname(fullPath);
73
+ if (!dirs.includes(base)) dirs.push(base);
74
+ start();
75
+ });
76
+ };
77
+ var running = false;
78
+ async function start() {
79
+ if (running) return;
80
+ while (dirs.length > 0) {
81
+ running = true;
82
+ const cwd = dirs.shift();
83
+ console.log("pruning reflog", cwd);
84
+ await spawnAsync("git", ["reflog", "expire", "--expire=all", "--all"], { cwd, stdio: "pipe", shell: true }).catch(
85
+ (e) => console.log("failed prune reflog", e.message)
86
+ );
87
+ await delay(3);
88
+ running = false;
89
+ }
90
+ }
91
+ fetchDirs("**/.git");
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ const { spawnAsync } = require("cross-spawn");
11
+ const glob = require("glob");
12
+ const path = require("path");
13
+ const { delay } = require("./utils");
14
+ /** @type {string[]} */
15
+ const dirs = [];
16
+ /**
17
+ * fetch directories
18
+ * @param {string|string[]} pattern
19
+ * @param {(filePath: string) => any} callback
20
+ */
21
+ const fetchDirs = (pattern, callback) => {
22
+ const globStream = new glob.Glob(pattern, {
23
+ withFileTypes: false,
24
+ cwd: process.cwd(),
25
+ ignore: ["**/node_modules/**", "**/vendor/**"]
26
+ });
27
+ globStream.stream().on("data", (result) => {
28
+ const fullPath = path.resolve(process.cwd(), result);
29
+ if (typeof callback == "function")
30
+ callback(fullPath);
31
+ const base = path.dirname(fullPath);
32
+ // push directory when not exist
33
+ if (!dirs.includes(base))
34
+ dirs.push(base);
35
+ start();
36
+ });
37
+ };
38
+ let running = false;
39
+ function start() {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ // skip run when still running
42
+ if (running)
43
+ return;
44
+ while (dirs.length > 0) {
45
+ // start
46
+ running = true;
47
+ const cwd = dirs.shift();
48
+ console.log("pruning reflog", cwd);
49
+ yield spawnAsync("git", ["reflog", "expire", "--expire=all", "--all"], { cwd, stdio: "pipe", shell: true }).catch((e) => console.log("failed prune reflog", e.message));
50
+ // git gc --prune=now --aggressive
51
+ // delay 3s
52
+ yield delay(3);
53
+ // stop
54
+ running = false;
55
+ }
56
+ });
57
+ }
58
+ // script starts here
59
+ fetchDirs("**/.git");
@@ -0,0 +1,47 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_utils
4
+ } from "./chunk-OKYLF2MU.mjs";
5
+ import {
6
+ init_esm_shims
7
+ } from "./chunk-VXZQNLPU.mjs";
8
+ import {
9
+ __require
10
+ } from "./chunk-FB6YIQYR.mjs";
11
+
12
+ // src/git-purge.js
13
+ init_esm_shims();
14
+ var { spawnAsync } = __require("cross-spawn");
15
+ var glob = __require("glob");
16
+ var path = __require("path");
17
+ var { delay } = require_utils();
18
+ var dirs = [];
19
+ var fetchDirs = (pattern, callback) => {
20
+ const globStream = new glob.Glob(pattern, {
21
+ withFileTypes: false,
22
+ cwd: process.cwd(),
23
+ ignore: ["**/node_modules/**", "**/vendor/**"]
24
+ });
25
+ globStream.stream().on("data", (result) => {
26
+ const fullPath = path.resolve(process.cwd(), result);
27
+ if (typeof callback == "function") callback(fullPath);
28
+ const base = path.dirname(fullPath);
29
+ if (!dirs.includes(base)) dirs.push(base);
30
+ start();
31
+ });
32
+ };
33
+ var running = false;
34
+ async function start() {
35
+ if (running) return;
36
+ while (dirs.length > 0) {
37
+ running = true;
38
+ const cwd = dirs.shift();
39
+ console.log("pruning reflog", cwd);
40
+ await spawnAsync("git", ["reflog", "expire", "--expire=all", "--all"], { cwd, stdio: "pipe", shell: true }).catch(
41
+ (e) => console.log("failed prune reflog", e.message)
42
+ );
43
+ await delay(3);
44
+ running = false;
45
+ }
46
+ }
47
+ fetchDirs("**/.git");
package/lib/index.cjs ADDED
@@ -0,0 +1,92 @@
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 __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
+ };
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
33
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
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/find-node-modules.js
42
+ var require_find_node_modules = __commonJS({
43
+ "src/find-node-modules.js"(exports2, module2) {
44
+ init_cjs_shims();
45
+ var glob = require("glob");
46
+ var path = require("path");
47
+ function findNodeModules2(dir = process.cwd(), callback = null) {
48
+ const finalDir = typeof dir === "string" ? dir : process.cwd();
49
+ return new Promise((resolve, reject) => {
50
+ const results = [];
51
+ const g3 = new glob.Glob("**/node_modules", {
52
+ withFileTypes: false,
53
+ cwd: finalDir,
54
+ ignore: ["**/.git*", "**/vendor/**"]
55
+ });
56
+ const stream = g3.stream();
57
+ stream.on("data", (result) => {
58
+ const fullPath = path.resolve(finalDir, result);
59
+ if (typeof callback === "function") {
60
+ try {
61
+ callback(fullPath);
62
+ } catch (err) {
63
+ console.error("findNodeModules callback error:", err);
64
+ }
65
+ }
66
+ results.push(fullPath);
67
+ });
68
+ stream.on("error", (err) => reject(err));
69
+ stream.on("end", () => {
70
+ if (results.length === 0) {
71
+ console.log("No node_modules directories found.");
72
+ }
73
+ resolve(results);
74
+ });
75
+ });
76
+ }
77
+ module2.exports = findNodeModules2;
78
+ }
79
+ });
80
+
81
+ // src/index.ts
82
+ var index_exports = {};
83
+ __export(index_exports, {
84
+ findNodeModules: () => import_find_node_modules.default
85
+ });
86
+ module.exports = __toCommonJS(index_exports);
87
+ init_cjs_shims();
88
+ var import_find_node_modules = __toESM(require_find_node_modules());
89
+ // Annotate the CommonJS export names for ESM import in node:
90
+ 0 && (module.exports = {
91
+ findNodeModules
92
+ });
@@ -0,0 +1 @@
1
+ export { default as findNodeModules } from './find-node-modules.mjs';
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import findNodeModules from "./find-node-modules";
2
+ export { findNodeModules };
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.findNodeModules = void 0;
7
+ const find_node_modules_1 = __importDefault(require("./find-node-modules"));
8
+ exports.findNodeModules = find_node_modules_1.default;
package/lib/index.mjs ADDED
@@ -0,0 +1,18 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_find_node_modules
4
+ } from "./chunk-BSD5CIRU.mjs";
5
+ import {
6
+ init_esm_shims
7
+ } from "./chunk-VXZQNLPU.mjs";
8
+ import {
9
+ __toESM
10
+ } from "./chunk-FB6YIQYR.mjs";
11
+
12
+ // src/index.ts
13
+ init_esm_shims();
14
+ var import_find_node_modules = __toESM(require_find_node_modules());
15
+ var export_findNodeModules = import_find_node_modules.default;
16
+ export {
17
+ export_findNodeModules as findNodeModules
18
+ };
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+
25
+ // src/npm-run-series.js
26
+ var fs = require("fs");
27
+ var path = require("path");
28
+ var { Minimatch } = require("minimatch");
29
+ var args = require("minimist")(process.argv.slice(2));
30
+ var cwd = process.cwd();
31
+ var packagejson = path.join(cwd, "package.json");
32
+ var verbose = args["v"] || args["verbose"];
33
+ var usingYarn = args["yarn"];
34
+ (async function npmRunSeries() {
35
+ const { execa } = await import("execa");
36
+ if (fs.existsSync(packagejson)) {
37
+ const parse = JSON.parse(fs.readFileSync(packagejson, "utf-8"));
38
+ if (parse !== null && typeof parse === "object") {
39
+ if ("scripts" in parse) {
40
+ const patterns = args._;
41
+ const scripts = parse.scripts;
42
+ const scriptNames = Object.keys(scripts);
43
+ for (let i = 0; i < patterns.length; i++) {
44
+ const pattern = patterns[i];
45
+ const matcher = new Minimatch(pattern, { nonegate: true });
46
+ for (let ii = 0; ii < scriptNames.length; ii++) {
47
+ const scriptName = scriptNames[ii];
48
+ const match = matcher.match(scriptName);
49
+ if (verbose) console.log({ pattern, scriptName, match });
50
+ if (match === true) {
51
+ await execa(usingYarn ? "yarn" : "npm", ["run", scriptName], {
52
+ cwd,
53
+ stdio: "inherit"
54
+ });
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ })();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};