binary-collections 2.0.10 → 2.0.12
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/package.json +5 -0
- package/.puppeterrc.cjs +25 -0
- package/binaries/binary-executor.cjs +138 -3
- package/binaries/clean-nodemodule.cjs +138 -3
- package/binaries/clean-nodemodules.cjs +138 -3
- package/binaries/dev.cjs +138 -3
- package/binaries/empty.cjs +138 -3
- package/binaries/git-reduce-size.cjs +138 -3
- package/binaries/javakill.cjs +138 -3
- package/binaries/kill-night-crows.bat +7 -0
- package/binaries/kill-night-crows.ps1 +172 -0
- package/binaries/kill-process.cjs +138 -3
- package/binaries/nodekill.cjs +138 -3
- package/binaries/prod.cjs +138 -3
- package/binaries/py +111 -0
- package/binaries/py.cjs +178 -0
- package/binaries/py.cmd +49 -0
- package/binaries/rmfind.cjs +138 -3
- package/binaries/rmx +15 -1
- package/binaries/rmx.cjs +138 -3
- package/binaries/rmx.cmd +12 -0
- package/binaries/submodule-token.cjs +138 -3
- package/binaries/test-cjs +18 -0
- package/binaries/test-cjs.cjs +178 -0
- package/binaries/test-cjs.cmd +26 -0
- package/binaries/test-esm +16 -0
- package/binaries/test-esm.cjs +178 -0
- package/binaries/test-esm.cmd +23 -0
- package/binaries/yarn-clean +32 -0
- package/binaries/yarn-clean.cjs +178 -0
- package/binaries/yarn-clean.cmd +30 -0
- package/binaries/yarn-clean.py +166 -0
- package/binaries/yc +110 -0
- package/binaries/yc.cjs +178 -0
- package/lib/binary-collections/config.cjs +126 -0
- package/lib/binary-collections/config.mjs +7 -0
- package/lib/binary-collections/executeScript.cjs +19 -0
- package/lib/binary-collections/executeScript.d.cts +12 -0
- package/lib/binary-collections/executeScript.mjs +6 -0
- package/lib/binary-collections/findScript.cjs +284 -0
- package/lib/binary-collections/findScript.d.cts +12 -0
- package/lib/binary-collections/findScript.mjs +7 -0
- package/lib/binary-collections/listScript.cjs +266 -0
- package/lib/binary-collections/listScript.d.cts +19 -0
- package/lib/binary-collections/listScript.mjs +7 -0
- package/lib/binary-collections.cjs +342 -194
- package/lib/binary-collections.mjs +22 -268
- package/lib/changelog.cjs +61 -13
- package/lib/changelog.mjs +1 -1
- package/lib/{chunk-E6FDDAOO.mjs → chunk-2LSRSEXF.mjs} +2 -2
- package/lib/chunk-34IQDTLZ.mjs +27 -0
- package/lib/chunk-3HFFECCI.mjs +27 -0
- package/lib/{chunk-V3N3JEUF.mjs → chunk-5RTXZVCW.mjs} +60 -13
- package/lib/chunk-66KDU4TX.mjs +268 -0
- package/lib/chunk-6PU7BAHB.mjs +61 -0
- package/lib/{chunk-6HHJRKFB.mjs → chunk-BZWVHODJ.mjs} +4 -1
- package/lib/chunk-C6D2TTYU.mjs +32 -0
- package/lib/chunk-FB2WKVJD.mjs +158 -0
- package/lib/{chunk-66PAU5PS.mjs → chunk-G5UUEWUO.mjs} +9 -5
- package/lib/{chunk-HO6GHCOB.mjs → chunk-GAGABICI.mjs} +198 -63
- package/lib/chunk-H44UWUFY.mjs +105 -0
- package/lib/chunk-NCZPTKDV.mjs +79 -0
- package/lib/chunk-NGFK3EYW.mjs +28 -0
- package/lib/chunk-NVEG3LEZ.mjs +143 -0
- package/lib/chunk-OGXVGBRI.mjs +29 -0
- package/lib/chunk-OXV52GD5.mjs +62 -0
- package/lib/{chunk-PDSXF5HY.mjs → chunk-PDN26I7O.mjs} +1 -0
- package/lib/chunk-PXBMHE7O.mjs +35 -0
- package/lib/chunk-R5FJOR63.mjs +47 -0
- package/lib/chunk-SPTECFE5.mjs +180 -0
- package/lib/chunk-UXCFNAR6.mjs +55 -0
- package/lib/chunk-V2IBPCEV.mjs +39 -0
- package/lib/chunk-XPJGCDOD.mjs +14 -0
- package/lib/{chunk-AI4CVPJ7.mjs → chunk-ZDMWBSYF.mjs} +4 -4
- package/lib/chunk-ZOWVMII3.mjs +228 -0
- package/lib/clean-github-actions-caches-cli.cjs +465 -0
- package/lib/clean-github-actions-caches-cli.d.cts +1 -0
- package/lib/clean-github-actions-caches-cli.mjs +56 -0
- package/lib/clean-github-actions-caches.cjs +152 -160
- package/lib/clean-github-actions-caches.d.cts +15 -1
- package/lib/clean-github-actions-caches.mjs +4 -130
- package/lib/cross-env/command.cjs +63 -0
- package/lib/cross-env/command.d.ts +8 -0
- package/lib/cross-env/command.js +45 -0
- package/lib/cross-env/command.mjs +9 -0
- package/lib/cross-env/index.cjs +178 -0
- package/lib/cross-env/index.d.ts +8 -0
- package/lib/cross-env/index.js +102 -0
- package/lib/cross-env/index.mjs +101 -0
- package/lib/cross-env/variable.cjs +60 -0
- package/lib/cross-env/variable.d.ts +7 -0
- package/lib/cross-env/variable.js +59 -0
- package/lib/cross-env/variable.mjs +9 -0
- package/lib/del-gradle.cjs +61 -13
- package/lib/del-gradle.js +9 -8
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.cjs +143 -148
- package/lib/del-node-modules.js +210 -14
- package/lib/del-node-modules.mjs +148 -17
- package/lib/del-ps.cjs +61 -13
- package/lib/del-ps.js +9 -8
- package/lib/del-ps.mjs +1 -1
- package/lib/del-yarn-caches.cjs +61 -13
- package/lib/del-yarn-caches.js +2 -2
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/file/copy-cli.cjs +92 -0
- package/lib/file/copy-cli.d.mts +1 -0
- package/lib/file/copy-cli.mjs +55 -0
- package/lib/file/copy.cjs +56 -0
- package/lib/file/copy.d.mts +1 -0
- package/lib/file/copy.mjs +8 -0
- package/lib/file/move-cli.cjs +91 -0
- package/lib/file/move-cli.d.mts +1 -0
- package/lib/file/move-cli.mjs +55 -0
- package/lib/file/move.cjs +55 -0
- package/lib/file/move.d.mts +1 -0
- package/lib/file/move.mjs +8 -0
- package/lib/find-node-modules-cli.js +2 -1
- package/lib/free-chatgpt.cjs +259 -47
- package/lib/free-chatgpt.js +10 -10
- package/lib/free-chatgpt.mjs +2 -2
- package/lib/git/gitattributes.cjs +1 -0
- package/lib/git/gitattributes.d.cts +7 -2
- package/lib/git/gitattributes.mjs +1 -1
- package/lib/git/line-endings.cjs +2 -1
- package/lib/git/line-endings.mjs +2 -2
- package/lib/git/undo-commit-cli.cjs +110 -0
- package/lib/git/undo-commit-cli.d.ts +1 -0
- package/lib/git/undo-commit-cli.js +4 -0
- package/lib/git/undo-commit-cli.mjs +14 -0
- package/lib/git/undo-commit.cjs +81 -0
- package/lib/git/undo-commit.d.cts +1 -0
- package/lib/git/undo-commit.mjs +7 -0
- package/lib/git/undo-staged-cli.cjs +110 -0
- package/lib/git/undo-staged-cli.d.ts +1 -0
- package/lib/git/undo-staged-cli.js +4 -0
- package/lib/git/undo-staged-cli.mjs +14 -0
- package/lib/git/undo-staged.cjs +81 -0
- package/lib/git/undo-staged.d.cts +1 -0
- package/lib/git/undo-staged.mjs +7 -0
- package/lib/git/user-config.cjs +61 -14
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +427 -75
- package/lib/git-diff-cli.d.ts +1 -0
- package/lib/git-diff-cli.js +1 -0
- package/lib/git-diff-cli.mjs +6 -4
- package/lib/git-diff.cjs +426 -75
- package/lib/git-diff.d.ts +2 -1
- package/lib/git-diff.js +91 -34
- package/lib/git-diff.mjs +5 -4
- package/lib/git-fix.cjs +64 -16
- package/lib/git-fix.mjs +10 -10
- package/lib/git-purge.cjs +61 -13
- package/lib/git-purge.mjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/kill-night-crows.cjs +87 -0
- package/lib/kill-night-crows.d.mts +1 -0
- package/lib/kill-night-crows.mjs +65 -0
- package/lib/node-cache-cleaner/npm.cjs +65 -0
- package/lib/node-cache-cleaner/npm.d.ts +2 -0
- package/lib/node-cache-cleaner/npm.js +41 -0
- package/lib/node-cache-cleaner/npm.mjs +10 -0
- package/lib/node-cache-cleaner/npx.cjs +89 -0
- package/lib/node-cache-cleaner/npx.d.ts +4 -0
- package/lib/node-cache-cleaner/npx.js +82 -0
- package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
- package/lib/node-cache-cleaner/yarn.cjs +73 -0
- package/lib/node-cache-cleaner/yarn.d.ts +2 -0
- package/lib/node-cache-cleaner/yarn.js +62 -0
- package/lib/node-cache-cleaner/yarn.mjs +10 -0
- package/lib/node-cache-cleaner-cli.cjs +182 -0
- package/lib/node-cache-cleaner-cli.d.ts +2 -0
- package/lib/node-cache-cleaner-cli.js +60 -0
- package/lib/node-cache-cleaner-cli.mjs +56 -0
- package/lib/node-executor.cjs +91 -0
- package/lib/node-executor.d.cts +2 -0
- package/lib/node-executor.mjs +103 -0
- package/lib/npm-run-series.cjs +79 -39
- package/lib/npm-run-series.mjs +20 -6
- package/lib/package-resolutions-updater-cli.cjs +645 -0
- package/lib/package-resolutions-updater-cli.d.mts +1 -0
- package/lib/package-resolutions-updater-cli.mjs +102 -0
- package/lib/package-resolutions-updater.cjs +259 -133
- package/lib/package-resolutions-updater.d.mts +51 -1
- package/lib/package-resolutions-updater.mjs +18 -294
- package/lib/php-cs-fixer-staged.cjs +105 -0
- package/lib/php-cs-fixer-staged.d.cts +2 -0
- package/lib/php-cs-fixer-staged.mjs +117 -0
- package/lib/print-directory-tree.cjs +62 -14
- package/lib/print-directory-tree.mjs +2 -2
- package/lib/ps/connected-domain.d.ts +1 -1
- package/lib/ps/connected-domain.js +10 -10
- package/lib/ps/index.cjs +1 -1
- package/lib/ps/index.mjs +177 -171
- package/lib/ps/isWin.js +1 -1
- package/lib/ps/table-parser.js +6 -6
- package/lib/remove-module.cjs +61 -13
- package/lib/remove-module.mjs +1 -1
- package/lib/rm-node-module-cli.cjs +222 -0
- package/lib/rm-node-module-cli.d.cts +1 -0
- package/lib/rm-node-module-cli.mjs +89 -0
- package/lib/rm-node-modules.cjs +127 -0
- package/lib/rm-node-modules.d.cts +35 -0
- package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
- package/lib/rmpath.cjs +63 -15
- package/lib/rmpath.mjs +2 -2
- package/lib/submodule-install.cjs +107 -47
- package/lib/submodule-install.mjs +48 -35
- package/lib/submodule-remove-cli.cjs +6 -3
- package/lib/submodule-remove-cli.js +3 -3
- package/lib/submodule-remove-cli.mjs +2 -3
- package/lib/submodule-remove.cjs +4 -1
- package/lib/submodule-remove.mjs +1 -1
- package/lib/utils/chatgpt.cjs +198 -34
- package/lib/utils/chatgpt.js +260 -93
- package/lib/utils/chatgpt.mjs +1 -1
- package/lib/utils/findEnvFiles.cjs +89 -0
- package/lib/utils/findEnvFiles.d.cts +19 -0
- package/lib/utils/findEnvFiles.mjs +6 -0
- package/lib/utils/findWorkspaceRoot.cjs +70 -0
- package/lib/utils/findWorkspaceRoot.d.ts +9 -0
- package/lib/utils/findWorkspaceRoot.js +57 -0
- package/lib/utils/findWorkspaceRoot.mjs +40 -0
- package/lib/utils/index.cjs +60 -13
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isGithubTokenValid.cjs +64 -0
- package/lib/utils/isGithubTokenValid.d.ts +7 -0
- package/lib/utils/isGithubTokenValid.js +48 -0
- package/lib/utils/isGithubTokenValid.mjs +36 -0
- package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
- package/lib/utils/isWindows.d.ts +5 -0
- package/lib/utils/isWindows.js +10 -0
- package/lib/utils/isWindows.mjs +8 -0
- package/lib/utils/runBash.cjs +53 -0
- package/lib/utils/runBash.d.cts +12 -0
- package/lib/utils/runBash.mjs +66 -0
- package/lib/yarn-per-branch-lock-installer.cjs +97 -0
- package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
- package/lib/yarn-per-branch-lock-installer.mjs +109 -0
- package/lib/yarn-reinstall.cjs +61 -13
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +133 -110
- package/readme.html +784 -0
- package/readme.md +116 -229
- package/releases/readme.md +1 -1
- package/requirements.txt +1 -0
- package/test/README.md +2 -2
- package/test-project/package.json +8 -2
- package/test-project/workspaces/workspace-a/package.json +135 -0
- package/test-project/workspaces/workspace-a/readme.md +20 -0
- package/test-project/workspaces/workspace-a/release/readme.md +42 -0
- package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
- package/test-project/workspaces/workspace-a/test/readme.md +12 -0
- package/test-project/workspaces/workspace-b/package.json +139 -0
- package/test-project/workspaces/workspace-b/readme.md +94 -0
- package/test-project/workspaces/workspace-b/requirements.txt +1 -0
- package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
- package/tmp/rm-node-modules-test-project/package.json +17 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
- package/tmp/test-repo/README.md +2 -35
- package/tmp/test-repo/package.json +13 -3
- package/docs-src/clean-github-actions-caches.md +0 -26
- package/docs-src/free-chatgpt.md +0 -26
- package/lib/binary-collections-config.cjs +0 -15
- package/lib/chunk-4EWQC6GZ.mjs +0 -382
- package/lib/chunk-4ZI7BQKQ.mjs +0 -381
- package/lib/chunk-5J2BEPY5.mjs +0 -83
- package/lib/chunk-AGZYRDC2.mjs +0 -323
- package/lib/chunk-BDCHCWHD.mjs +0 -136
- package/lib/chunk-BEZKJ25G.mjs +0 -140
- package/lib/chunk-DI5MDPSN.mjs +0 -386
- package/lib/chunk-GJTGHXRA.mjs +0 -356
- package/lib/chunk-HMRMTYZM.mjs +0 -40
- package/lib/chunk-HN52G2YL.mjs +0 -305
- package/lib/chunk-LEM5OMRP.mjs +0 -384
- package/lib/chunk-O6SWBEOQ.mjs +0 -81
- package/lib/chunk-RCP7DHVY.mjs +0 -190
- package/lib/chunk-SBNDSKG5.mjs +0 -136
- package/lib/chunk-U6SO4QEV.mjs +0 -320
- package/lib/chunk-XD6BJK6Q.mjs +0 -351
- package/lib/chunk-YXSFGA2D.mjs +0 -383
- package/lib/git/gitattributes.d.ts +0 -33
- package/lib/git/gitattributes.js +0 -223
- package/lib/ps/index.d.ts +0 -2
- package/lib/ps/index.js +0 -253
- package/tmp/typedoc/readme.md +0 -320
- /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
__commonJS,
|
|
4
|
+
__require,
|
|
5
|
+
init_esm_shims
|
|
6
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
7
|
+
|
|
8
|
+
// src/rm-node-modules.cjs
|
|
9
|
+
var require_rm_node_modules = __commonJS({
|
|
10
|
+
"src/rm-node-modules.cjs"(exports, module) {
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var fs = __require("fs-extra");
|
|
13
|
+
var path = __require("upath");
|
|
14
|
+
var ansiColors = __require("ansi-colors");
|
|
15
|
+
var child_process = __require("child_process");
|
|
16
|
+
var os = __require("os");
|
|
17
|
+
function generateBashScript(options = {}) {
|
|
18
|
+
const { dryRun = true } = options;
|
|
19
|
+
return `
|
|
20
|
+
#!/bin/bash
|
|
21
|
+
|
|
22
|
+
set -u
|
|
23
|
+
|
|
24
|
+
cwd="$(pwd)"
|
|
25
|
+
max_jobs=4
|
|
26
|
+
DRY_RUN=${dryRun ? "true" : "false"}
|
|
27
|
+
|
|
28
|
+
cleanup_letter() {
|
|
29
|
+
local letter="$1"
|
|
30
|
+
|
|
31
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
32
|
+
echo "Would remove: node_modules/\${letter}*"
|
|
33
|
+
echo "Would remove: node_modules/@types/\${letter}*"
|
|
34
|
+
echo "Would remove: node_modules/@\${letter}*"
|
|
35
|
+
else
|
|
36
|
+
rm -rf "\${cwd}/node_modules/\${letter}"*
|
|
37
|
+
echo "Removed: node_modules/\${letter}*"
|
|
38
|
+
|
|
39
|
+
rm -rf "\${cwd}/node_modules/@types/\${letter}"*
|
|
40
|
+
echo "Removed: node_modules/@types/\${letter}*"
|
|
41
|
+
|
|
42
|
+
rm -rf "\${cwd}/node_modules/@\${letter}"*
|
|
43
|
+
echo "Removed: node_modules/@\${letter}*"
|
|
44
|
+
fi
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export -f cleanup_letter
|
|
48
|
+
export cwd
|
|
49
|
+
export DRY_RUN
|
|
50
|
+
|
|
51
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
52
|
+
echo "Dry-run mode (pass --force to actually delete)"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo "Cleaning \${cwd}/node_modules..."
|
|
56
|
+
|
|
57
|
+
running=0
|
|
58
|
+
|
|
59
|
+
for letter in {a..z}; do
|
|
60
|
+
cleanup_letter "$letter" &
|
|
61
|
+
|
|
62
|
+
((running++))
|
|
63
|
+
|
|
64
|
+
# limit concurrent jobs
|
|
65
|
+
if (( running >= max_jobs )); then
|
|
66
|
+
wait -n
|
|
67
|
+
((running--))
|
|
68
|
+
fi
|
|
69
|
+
done
|
|
70
|
+
|
|
71
|
+
wait
|
|
72
|
+
|
|
73
|
+
# final full cleanup (ensure nothing left behind)
|
|
74
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
75
|
+
echo "Would remove: node_modules (final cleanup)"
|
|
76
|
+
else
|
|
77
|
+
rm -rf "\${cwd}/node_modules"
|
|
78
|
+
echo "Removed: node_modules (final cleanup)"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
82
|
+
echo "Done (dry-run). Run with --force to delete for real."
|
|
83
|
+
else
|
|
84
|
+
echo "Done cleaning node_modules."
|
|
85
|
+
fi
|
|
86
|
+
`.trim();
|
|
87
|
+
}
|
|
88
|
+
async function cleanUp(rootDir, options = {}) {
|
|
89
|
+
const { dryRun = true } = options;
|
|
90
|
+
const nodeModulesDir = path.join(rootDir, "node_modules");
|
|
91
|
+
const script = generateBashScript({ dryRun });
|
|
92
|
+
const tmpDir = os.tmpdir();
|
|
93
|
+
const name = `rm-node-modules-${Date.now()}-${Math.random().toString(36).slice(2)}.sh`;
|
|
94
|
+
const scriptPath = path.join(tmpDir, name);
|
|
95
|
+
try {
|
|
96
|
+
fs.writeFileSync(scriptPath, script, { encoding: "utf8" });
|
|
97
|
+
try {
|
|
98
|
+
fs.chmodSync(scriptPath, 493);
|
|
99
|
+
} catch {
|
|
100
|
+
}
|
|
101
|
+
const result = child_process.spawnSync("bash", [scriptPath], {
|
|
102
|
+
cwd: rootDir,
|
|
103
|
+
env: process.env,
|
|
104
|
+
encoding: "utf8",
|
|
105
|
+
shell: false
|
|
106
|
+
});
|
|
107
|
+
if (result.stdout) process.stdout.write(result.stdout);
|
|
108
|
+
if (result.stderr) process.stderr.write(result.stderr);
|
|
109
|
+
if (result.error) {
|
|
110
|
+
try {
|
|
111
|
+
console.warn(
|
|
112
|
+
ansiColors.yellow(`bash execution failed: ${result.error.message}. Falling back to Node removal.`)
|
|
113
|
+
);
|
|
114
|
+
console.log(`Cleaning ${ansiColors.cyan(nodeModulesDir)}...`);
|
|
115
|
+
fs.rmSync(nodeModulesDir, { recursive: true, force: true });
|
|
116
|
+
console.log(`Removed: ${ansiColors.green("node_modules (final cleanup)")}`);
|
|
117
|
+
console.log("Done cleaning node_modules.");
|
|
118
|
+
return {
|
|
119
|
+
code: 0,
|
|
120
|
+
stdout: result.stdout || "",
|
|
121
|
+
stderr: (result.stderr || "") + `
|
|
122
|
+
${result.error.stack || result.error.message}`
|
|
123
|
+
};
|
|
124
|
+
} catch (e) {
|
|
125
|
+
return { code: 1, stdout: result.stdout || "", stderr: (result.stderr || "") + `
|
|
126
|
+
${e.stack || e.message}` };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return { code: result.status ?? 0, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
130
|
+
} finally {
|
|
131
|
+
try {
|
|
132
|
+
if (fs.existsSync(scriptPath)) fs.unlinkSync(scriptPath);
|
|
133
|
+
} catch {
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
module.exports = { generateBashScript, cleanUp };
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
require_rm_node_modules
|
|
143
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
5
|
+
|
|
6
|
+
// src/file/copy.mjs
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import fs from "fs-extra";
|
|
9
|
+
import path from "upath";
|
|
10
|
+
async function copy(src, dest) {
|
|
11
|
+
if (!await fs.pathExists(src)) {
|
|
12
|
+
throw new Error(`Source file does not exist: ${src}`);
|
|
13
|
+
}
|
|
14
|
+
const srcStat = await fs.stat(src);
|
|
15
|
+
let finalDest = dest;
|
|
16
|
+
if (srcStat.isFile()) {
|
|
17
|
+
const destExists = await fs.pathExists(dest);
|
|
18
|
+
const destStat = destExists ? await fs.stat(dest) : null;
|
|
19
|
+
if (destStat && destStat.isDirectory()) {
|
|
20
|
+
finalDest = path.join(dest, path.basename(src));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
await fs.ensureDir(path.dirname(finalDest));
|
|
24
|
+
await fs.copy(src, finalDest, { overwrite: true });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
copy
|
|
29
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
5
|
+
|
|
6
|
+
// src/node-cache-cleaner/npx.ts
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import fs from "fs-extra";
|
|
9
|
+
import upath from "upath";
|
|
10
|
+
import os from "os";
|
|
11
|
+
import { spawn } from "cross-spawn";
|
|
12
|
+
function getNpmCacheDir() {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const child = spawn("npm", ["config", "get", "cache"], {
|
|
16
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
17
|
+
shell: true
|
|
18
|
+
});
|
|
19
|
+
let output = "";
|
|
20
|
+
let error = "";
|
|
21
|
+
(_a = child.stdout) == null ? void 0 : _a.on("data", (data) => {
|
|
22
|
+
output += data.toString();
|
|
23
|
+
});
|
|
24
|
+
(_b = child.stderr) == null ? void 0 : _b.on("data", (data) => {
|
|
25
|
+
error += data.toString();
|
|
26
|
+
});
|
|
27
|
+
child.on("close", (code) => {
|
|
28
|
+
if (code === 0) {
|
|
29
|
+
resolve(output.trim());
|
|
30
|
+
} else {
|
|
31
|
+
reject(new Error(`Failed to get npm cache directory (code ${code}): ${error}`));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function removeDir(target) {
|
|
37
|
+
try {
|
|
38
|
+
const exists = await fs.pathExists(target);
|
|
39
|
+
if (exists) {
|
|
40
|
+
console.log(`Removing: ${target}`);
|
|
41
|
+
await fs.remove(target);
|
|
42
|
+
} else {
|
|
43
|
+
console.log(`Not found: ${target}`);
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(`Failed to remove ${target}:`, err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function cleanNpxCache() {
|
|
50
|
+
const cacheDir = await getNpmCacheDir();
|
|
51
|
+
console.log("Detected npm cache:", cacheDir);
|
|
52
|
+
console.log("\nCleaning npm/npx cache...\n");
|
|
53
|
+
const npxCache = upath.join(cacheDir, "_npx");
|
|
54
|
+
const npmCache = upath.join(cacheDir, "_cacache");
|
|
55
|
+
const altNpxLinux = upath.join(os.homedir(), ".cache", "npx");
|
|
56
|
+
await Promise.all([removeDir(npxCache), removeDir(npmCache), removeDir(altNpxLinux)]);
|
|
57
|
+
console.log("\nDone \u2714\uFE0F");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
cleanNpxCache
|
|
62
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
__commonJS,
|
|
4
|
+
__require,
|
|
5
|
+
init_esm_shims
|
|
6
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
7
|
+
|
|
8
|
+
// src/binary-collections/executeScript.cjs
|
|
9
|
+
var require_executeScript = __commonJS({
|
|
10
|
+
"src/binary-collections/executeScript.cjs"(exports, module) {
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var { spawn } = __require("child_process");
|
|
13
|
+
function executeScript(scriptPath, args) {
|
|
14
|
+
console.log(`\u{1F527} Executing script: ${scriptPath} args: ${args.join(" ")}
|
|
15
|
+
`);
|
|
16
|
+
const child = spawn("node", [scriptPath, ...args], {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
shell: true
|
|
19
|
+
});
|
|
20
|
+
child.on("error", (error) => {
|
|
21
|
+
console.error(`\u274C Error executing script: ${error.message}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|
|
24
|
+
child.on("close", (code) => {
|
|
25
|
+
process.exit(code);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
module.exports = executeScript;
|
|
29
|
+
module.exports.default = executeScript;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
require_executeScript
|
|
35
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
5
|
+
|
|
6
|
+
// src/node-cache-cleaner/npm.ts
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import { spawn } from "cross-spawn";
|
|
9
|
+
function npmVersion() {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
const process = spawn("npm", ["--version"], {
|
|
12
|
+
stdio: "pipe",
|
|
13
|
+
shell: true
|
|
14
|
+
});
|
|
15
|
+
let version = "";
|
|
16
|
+
process.stdout.on("data", (data) => {
|
|
17
|
+
version += data.toString();
|
|
18
|
+
});
|
|
19
|
+
process.on("close", (code) => {
|
|
20
|
+
if (code === 0) {
|
|
21
|
+
resolve(version.trim());
|
|
22
|
+
} else {
|
|
23
|
+
reject(new Error(`NPM version check failed with exit code ${code}`));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function cleanNpmCache() {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const process = spawn("npm", ["cache", "clean", "--force"], {
|
|
31
|
+
stdio: "inherit",
|
|
32
|
+
shell: true
|
|
33
|
+
});
|
|
34
|
+
process.on("close", (code) => {
|
|
35
|
+
if (code === 0) {
|
|
36
|
+
resolve(true);
|
|
37
|
+
} else {
|
|
38
|
+
reject(new Error(`NPM cache clean failed with exit code ${code}`));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
npmVersion,
|
|
46
|
+
cleanNpmCache
|
|
47
|
+
};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_config
|
|
4
|
+
} from "./chunk-G5UUEWUO.mjs";
|
|
5
|
+
import {
|
|
6
|
+
runChatGpt
|
|
7
|
+
} from "./chunk-GAGABICI.mjs";
|
|
8
|
+
import {
|
|
9
|
+
require_utils
|
|
10
|
+
} from "./chunk-5RTXZVCW.mjs";
|
|
11
|
+
import {
|
|
12
|
+
__toESM,
|
|
13
|
+
init_esm_shims
|
|
14
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
15
|
+
|
|
16
|
+
// src/git-diff.js
|
|
17
|
+
init_esm_shims();
|
|
18
|
+
var import_config = __toESM(require_config(), 1);
|
|
19
|
+
import ansiColors from "ansi-colors";
|
|
20
|
+
import { execSync } from "child_process";
|
|
21
|
+
import fs from "fs-extra";
|
|
22
|
+
import { md5, writefile } from "sbg-utility";
|
|
23
|
+
import path from "upath";
|
|
24
|
+
import { fileURLToPath } from "url";
|
|
25
|
+
var import_utils = __toESM(require_utils(), 1);
|
|
26
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
27
|
+
var __dirname = path.dirname(__filename);
|
|
28
|
+
var args = (0, import_utils.getArgs)();
|
|
29
|
+
var positional = args._ || [];
|
|
30
|
+
var FILENAME = md5((positional[0] || "default") + JSON.stringify(args));
|
|
31
|
+
var DIFF_OUTPUT = (0, import_config.getTempPath)(`git-diff/${FILENAME}.txt`);
|
|
32
|
+
var GPT_DIFF_OUTPUT = (0, import_config.getTempPath)(`git-diff/gpt-${FILENAME}.txt`);
|
|
33
|
+
var CACHE_DIR = path.dirname(DIFF_OUTPUT);
|
|
34
|
+
var DIFF_OUTPUT_RELATIVE = path.relative(process.cwd(), DIFF_OUTPUT);
|
|
35
|
+
var GPT_DIFF_OUTPUT_RELATIVE = path.relative(process.cwd(), GPT_DIFF_OUTPUT);
|
|
36
|
+
fs.ensureDirSync(CACHE_DIR, { mode: 493 });
|
|
37
|
+
function showHelp() {
|
|
38
|
+
console.log("\u{1F4DD} Git Diff Helper");
|
|
39
|
+
console.log("\u{1F4C4} Usage:");
|
|
40
|
+
console.log(" \u{1F4C2} git-diff FILE Show staged diff of specified file");
|
|
41
|
+
console.log(" \u{1F4C2} git-diff --staged-only Show staged diff of all files");
|
|
42
|
+
console.log(" \u{1F4C2} git-diff -s | -S Same as --staged-only");
|
|
43
|
+
console.log(" \u{1F4C2} git-diff --unstaged FILE Show unstaged diff of specified file");
|
|
44
|
+
console.log(" \u{1F4C2} git-diff --unstaged Show unstaged diff of all files");
|
|
45
|
+
console.log(" \u{1F4C2} git-diff -u Same as --unstaged");
|
|
46
|
+
console.log(" \u{1F4C2} git-diff --ai Run ChatGPT automation for commit message");
|
|
47
|
+
console.log(" \u{1F4C2} git-diff --help | -h Show this help message");
|
|
48
|
+
console.log("");
|
|
49
|
+
console.log(`\u{1F4BE} Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
|
|
50
|
+
console.log(`\u{1F916} GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
function runGitDiff(command, successMessage, errorMessage) {
|
|
54
|
+
try {
|
|
55
|
+
console.log(`\u{1F50D} [i] Running command: ${command}`);
|
|
56
|
+
const result = execSync(command, {
|
|
57
|
+
encoding: "utf8",
|
|
58
|
+
maxBuffer: 1024 * 1024 * 10
|
|
59
|
+
// 10MB buffer to handle large diffs
|
|
60
|
+
});
|
|
61
|
+
if (!result || result.trim() === "") {
|
|
62
|
+
console.log(`\u2139\uFE0F [i] No changes found for the specified criteria`);
|
|
63
|
+
writefile(DIFF_OUTPUT, "# No changes found\n");
|
|
64
|
+
console.log(`\u2705 Empty diff saved to "${DIFF_OUTPUT_RELATIVE}"`);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
writefile(DIFF_OUTPUT, result);
|
|
68
|
+
writefile(
|
|
69
|
+
GPT_DIFF_OUTPUT,
|
|
70
|
+
`Hello, ChatGPT!
|
|
71
|
+
Can you create a conventional commit message by diff content below:
|
|
72
|
+
|
|
73
|
+
\`\`\`${result}
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
Give me result as codeblock with language "text" only.
|
|
77
|
+
|
|
78
|
+
Thank you!`
|
|
79
|
+
);
|
|
80
|
+
console.log(`\u2705 ${successMessage}`);
|
|
81
|
+
console.log(`\u{1F4BE} GPT diff prompt saved to "${ansiColors.green(GPT_DIFF_OUTPUT_RELATIVE)}"`);
|
|
82
|
+
return true;
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error(`\u274C ${errorMessage}`);
|
|
85
|
+
console.error(`\u{1F4DD} Command: ${command}`);
|
|
86
|
+
console.error(`\u26A0\uFE0F Error: ${error.message}`);
|
|
87
|
+
if (error.message.includes("not a git repository")) {
|
|
88
|
+
console.error("\u{1F6A7} Make sure you are in a git repository");
|
|
89
|
+
}
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function fileHasChanges(file, mode) {
|
|
94
|
+
const command = mode === "staged" ? `git diff --cached --quiet -- "${file}"` : `git diff --quiet -- "${file}"`;
|
|
95
|
+
try {
|
|
96
|
+
execSync(command, { stdio: "ignore" });
|
|
97
|
+
return false;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (error.status === 1) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function mainGitDiff() {
|
|
106
|
+
if (args.help || args.h) {
|
|
107
|
+
showHelp();
|
|
108
|
+
}
|
|
109
|
+
const useUnstaged = args.unstaged || args.u;
|
|
110
|
+
const fileFromFlag = typeof args.unstaged === "string" ? args.unstaged : typeof args.u === "string" ? args.u : null;
|
|
111
|
+
let hasDiff = false;
|
|
112
|
+
if (args["staged-only"] || args.s || args.S) {
|
|
113
|
+
hasDiff = runGitDiff(
|
|
114
|
+
"git --no-pager diff --staged",
|
|
115
|
+
`Full staged diff saved to "${ansiColors.green(DIFF_OUTPUT_RELATIVE)}"`,
|
|
116
|
+
"Failed to save staged diff"
|
|
117
|
+
);
|
|
118
|
+
} else {
|
|
119
|
+
const file = positional[0] || fileFromFlag;
|
|
120
|
+
if (!file) {
|
|
121
|
+
const fullDiffModeLabel = useUnstaged ? "unstaged" : "unstaged";
|
|
122
|
+
hasDiff = runGitDiff(
|
|
123
|
+
"git --no-pager diff",
|
|
124
|
+
`Full ${fullDiffModeLabel} diff saved to "${ansiColors.green(DIFF_OUTPUT_RELATIVE)}"`,
|
|
125
|
+
"Failed to save all diff's"
|
|
126
|
+
);
|
|
127
|
+
} else {
|
|
128
|
+
let fileDiffMode = useUnstaged ? "unstaged" : "staged";
|
|
129
|
+
if (!useUnstaged && !fileHasChanges(file, "staged") && fileHasChanges(file, "unstaged")) {
|
|
130
|
+
fileDiffMode = "unstaged";
|
|
131
|
+
}
|
|
132
|
+
hasDiff = runGitDiff(
|
|
133
|
+
fileDiffMode === "unstaged" ? `git --no-pager diff -- "${file}"` : `git --no-pager diff --cached -- "${file}"`,
|
|
134
|
+
`${fileDiffMode[0].toUpperCase() + fileDiffMode.slice(1)} diff of "${file}" saved to "${ansiColors.green(
|
|
135
|
+
DIFF_OUTPUT_RELATIVE
|
|
136
|
+
)}"`,
|
|
137
|
+
`Failed to generate ${fileDiffMode} diff for "${file}"`
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (hasDiff) {
|
|
142
|
+
const opencodePrompt = [
|
|
143
|
+
"",
|
|
144
|
+
"\u{1F916} OpenCode Prompt Helper",
|
|
145
|
+
"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
|
|
146
|
+
"",
|
|
147
|
+
"\u{1F4C4} App Prompt:",
|
|
148
|
+
` Generate a conventional commit message from diff file: ${DIFF_OUTPUT}`,
|
|
149
|
+
"",
|
|
150
|
+
"\u{1F4BB} CLI Command:",
|
|
151
|
+
` opencode run "Generate a conventional commit message from diff file ${DIFF_OUTPUT}"`,
|
|
152
|
+
""
|
|
153
|
+
];
|
|
154
|
+
const opencodePromptPath = (0, import_config.getTempPath)(`git-diff/opencode-${FILENAME}.txt`);
|
|
155
|
+
writefile(opencodePromptPath, opencodePrompt.join("\n"));
|
|
156
|
+
console.log(`\u{1F4A1} OpenCode prompt saved to "${ansiColors.green(path.relative(process.cwd(), opencodePromptPath))}"`);
|
|
157
|
+
}
|
|
158
|
+
if (args.ai) {
|
|
159
|
+
try {
|
|
160
|
+
await runChatGpt({ headless: true, questionFile: GPT_DIFF_OUTPUT });
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.error("\u274C Error running ChatGPT:", error.message);
|
|
163
|
+
console.error("\u{1F4A1} Try running with visible browser mode or check if Chrome is installed");
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
console.log("\u{1F4A1} Tip: Use --ai flag to generate commit message with ChatGPT");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
var git_diff_default = runGitDiff;
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
DIFF_OUTPUT,
|
|
173
|
+
GPT_DIFF_OUTPUT,
|
|
174
|
+
CACHE_DIR,
|
|
175
|
+
DIFF_OUTPUT_RELATIVE,
|
|
176
|
+
GPT_DIFF_OUTPUT_RELATIVE,
|
|
177
|
+
runGitDiff,
|
|
178
|
+
mainGitDiff,
|
|
179
|
+
git_diff_default
|
|
180
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
5
|
+
|
|
6
|
+
// src/node-cache-cleaner/yarn.ts
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import { spawn } from "cross-spawn";
|
|
9
|
+
function yarnVersion() {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
const process = spawn("yarn", ["--version"], {
|
|
12
|
+
stdio: "pipe",
|
|
13
|
+
shell: true
|
|
14
|
+
});
|
|
15
|
+
let version = "";
|
|
16
|
+
process.stdout.on("data", (data) => {
|
|
17
|
+
version += data.toString();
|
|
18
|
+
});
|
|
19
|
+
process.on("close", (code) => {
|
|
20
|
+
if (code === 0) {
|
|
21
|
+
resolve(version.trim());
|
|
22
|
+
} else {
|
|
23
|
+
reject(new Error(`Yarn version check failed with exit code ${code}`));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async function cleanYarnCache() {
|
|
29
|
+
let version = "";
|
|
30
|
+
try {
|
|
31
|
+
version = await yarnVersion();
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
const major = parseInt(version.split(".")[0], 10);
|
|
35
|
+
const isClassic = major === 1 || version === "";
|
|
36
|
+
const args = isClassic ? ["cache", "clean"] : ["cache", "clean", "--all"];
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
const process = spawn("yarn", args, {
|
|
39
|
+
stdio: "inherit",
|
|
40
|
+
shell: true
|
|
41
|
+
});
|
|
42
|
+
process.on("close", (code) => {
|
|
43
|
+
if (code === 0) {
|
|
44
|
+
resolve(true);
|
|
45
|
+
} else {
|
|
46
|
+
reject(new Error(`Yarn cache clean failed with exit code ${code}`));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
yarnVersion,
|
|
54
|
+
cleanYarnCache
|
|
55
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isWindows
|
|
4
|
+
} from "./chunk-XPJGCDOD.mjs";
|
|
5
|
+
import {
|
|
6
|
+
init_esm_shims
|
|
7
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
8
|
+
|
|
9
|
+
// src/cross-env/variable.ts
|
|
10
|
+
init_esm_shims();
|
|
11
|
+
var pathLikeEnvVarWhitelist = /* @__PURE__ */ new Set(["PATH", "NODE_PATH"]);
|
|
12
|
+
function replaceListDelimiters(varValue, varName = "") {
|
|
13
|
+
const targetSeparator = isWindows() ? ";" : ":";
|
|
14
|
+
if (!pathLikeEnvVarWhitelist.has(varName)) {
|
|
15
|
+
return varValue;
|
|
16
|
+
}
|
|
17
|
+
return varValue.replace(/(\\*):/g, (match, backslashes) => {
|
|
18
|
+
if (backslashes.length % 2) {
|
|
19
|
+
return match.substring(1);
|
|
20
|
+
}
|
|
21
|
+
return backslashes + targetSeparator;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function resolveEnvVars(varValue) {
|
|
25
|
+
const envUnixRegex = /(\\*)(\$(\w+)|\${(\w+)})/g;
|
|
26
|
+
return varValue.replace(envUnixRegex, (_, escapeChars, varNameWithDollarSign, varName, altVarName) => {
|
|
27
|
+
if (escapeChars.length % 2 === 1) {
|
|
28
|
+
return varNameWithDollarSign;
|
|
29
|
+
}
|
|
30
|
+
return escapeChars.substring(0, escapeChars.length / 2) + (process.env[varName || altVarName] || "");
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function varValueConvert(originalValue, originalName) {
|
|
34
|
+
return resolveEnvVars(replaceListDelimiters(originalValue, originalName));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
varValueConvert
|
|
39
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
5
|
+
|
|
6
|
+
// src/utils/isWindows.js
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
function isWindows() {
|
|
9
|
+
return process.platform === "win32" || /^(msys|cygwin)$/.test(process.env.OSTYPE || "");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
isWindows
|
|
14
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_gitattributes
|
|
4
|
+
} from "./chunk-PDN26I7O.mjs";
|
|
2
5
|
import {
|
|
3
6
|
require_utils
|
|
4
7
|
} from "./chunk-A3VUZEJK.mjs";
|
|
5
|
-
import {
|
|
6
|
-
require_gitattributes
|
|
7
|
-
} from "./chunk-PDSXF5HY.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__commonJS,
|
|
10
10
|
__require,
|
|
@@ -18,7 +18,7 @@ var require_line_endings = __commonJS({
|
|
|
18
18
|
var path = __require("upath");
|
|
19
19
|
var fs = __require("fs");
|
|
20
20
|
var { runGitCommand } = require_utils();
|
|
21
|
-
var { updateGitAttributes } = require_gitattributes()
|
|
21
|
+
var { updateGitAttributes } = require_gitattributes();
|
|
22
22
|
function forceLfLineEndings() {
|
|
23
23
|
console.log("\n=== Configuring LF Line Endings ===");
|
|
24
24
|
runGitCommand(["config", "core.autocrlf", "false"], "Disable automatic CRLF conversion");
|