@vxrn/utils 1.27.0 → 1.27.1-1789509973946
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/dist/cjs/createMessageSocket.cjs +115 -121
- package/dist/cjs/createMessageSocket.native.cjs +166 -0
- package/dist/cjs/createMessageSocket.native.js +152 -166
- package/dist/cjs/createMessageSocket.native.js.map +1 -1
- package/dist/cjs/detectPackageManager.cjs +76 -72
- package/dist/cjs/detectPackageManager.native.cjs +106 -0
- package/dist/cjs/detectPackageManager.native.js +82 -77
- package/dist/cjs/detectPackageManager.native.js.map +1 -1
- package/dist/cjs/exec.cjs +43 -45
- package/dist/cjs/exec.native.cjs +65 -0
- package/dist/cjs/exec.native.js +48 -49
- package/dist/cjs/exec.native.js.map +1 -1
- package/dist/cjs/index.cjs +9 -11
- package/dist/cjs/index.native.cjs +25 -0
- package/dist/cjs/index.native.js +9 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/mustReplace.cjs +27 -35
- package/dist/cjs/mustReplace.native.cjs +60 -0
- package/dist/cjs/mustReplace.native.js +44 -60
- package/dist/cjs/mustReplace.native.js.map +1 -1
- package/dist/esm/createMessageSocket.mjs +103 -103
- package/dist/esm/createMessageSocket.mjs.map +1 -1
- package/dist/esm/createMessageSocket.native.js +139 -148
- package/dist/esm/createMessageSocket.native.js.map +1 -1
- package/dist/esm/detectPackageManager.mjs +65 -55
- package/dist/esm/detectPackageManager.mjs.map +1 -1
- package/dist/esm/detectPackageManager.native.js +71 -61
- package/dist/esm/detectPackageManager.native.js.map +1 -1
- package/dist/esm/exec.mjs +29 -27
- package/dist/esm/exec.mjs.map +1 -1
- package/dist/esm/exec.native.js +34 -32
- package/dist/esm/exec.native.js.map +1 -1
- package/dist/esm/index.js +11 -7
- package/dist/esm/index.mjs +11 -7
- package/dist/esm/index.native.js +11 -7
- package/dist/esm/mustReplace.mjs +15 -17
- package/dist/esm/mustReplace.mjs.map +1 -1
- package/dist/esm/mustReplace.native.js +32 -43
- package/dist/esm/mustReplace.native.js.map +1 -1
- package/package.json +4 -4
- package/types/createMessageSocket.d.ts +1 -1
- package/types/createMessageSocket.d.ts.map +1 -1
- package/types/detectPackageManager.d.ts.map +1 -1
- package/types/exec.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
|
@@ -1,68 +1,78 @@
|
|
|
1
|
-
import { promises
|
|
1
|
+
import { promises } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { exec } from "./exec.mjs";
|
|
4
|
+
|
|
4
5
|
async function pathExists(p) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
try {
|
|
7
|
+
await promises.access(p);
|
|
8
|
+
return true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
11
12
|
}
|
|
12
13
|
async function hasGlobal(pm) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
try {
|
|
15
|
+
const command = process.platform === "win32" ? `where ${pm}` : `which ${pm}`;
|
|
16
|
+
const res = exec(command);
|
|
17
|
+
return !!res.length;
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
20
21
|
}
|
|
21
22
|
async function getFromLockfile(cwd = ".") {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
const [yarn, npm, pnpm, bun] = await Promise.all([
|
|
24
|
+
pathExists(resolve(cwd, "yarn.lock")),
|
|
25
|
+
pathExists(resolve(cwd, "package-lock.json")),
|
|
26
|
+
pathExists(resolve(cwd, "pnpm-lock.yaml")),
|
|
27
|
+
pathExists(resolve(cwd, "bun.lockb"))
|
|
28
|
+
]);
|
|
29
|
+
return {
|
|
30
|
+
bun,
|
|
31
|
+
yarn,
|
|
32
|
+
pnpm,
|
|
33
|
+
npm
|
|
34
|
+
};
|
|
29
35
|
}
|
|
30
36
|
async function getFromPackage(cwd = ".") {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
if (await pathExists(resolve(cwd, "package.json"))) {
|
|
38
|
+
const json = JSON.parse(await promises.readFile(resolve(cwd, "package.json"), "utf-8"));
|
|
39
|
+
if (json.packageManager) {
|
|
40
|
+
const yarn = !!json.packageManager.startsWith("yarn");
|
|
41
|
+
const pnpm = !!json.packageManager.startsWith("pnpm");
|
|
42
|
+
const bun = !!json.packageManager.startsWith("bun");
|
|
43
|
+
const npm = !!json.packageManager.startsWith("npm");
|
|
44
|
+
return {
|
|
45
|
+
bun,
|
|
46
|
+
yarn,
|
|
47
|
+
pnpm,
|
|
48
|
+
npm
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
|
-
const foundSome = obj => Object.keys(obj).some(k => !!obj[k]);
|
|
48
|
-
const detectPackageManager = async ({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
const foundSome = (obj) => Object.keys(obj).some((k) => !!obj[k]);
|
|
54
|
+
const detectPackageManager = async ({ cwd } = {}) => {
|
|
55
|
+
const fromLockfile = await getFromLockfile(cwd);
|
|
56
|
+
if (foundSome(fromLockfile)) {
|
|
57
|
+
return fromLockfile;
|
|
58
|
+
}
|
|
59
|
+
const fromPackageJson = await getFromPackage(cwd);
|
|
60
|
+
if (fromPackageJson && foundSome(fromPackageJson)) {
|
|
61
|
+
return fromPackageJson;
|
|
62
|
+
}
|
|
63
|
+
const [npm, yarn, pnpm, bun] = await Promise.all([
|
|
64
|
+
hasGlobal("npm"),
|
|
65
|
+
hasGlobal("yarn"),
|
|
66
|
+
hasGlobal("pnpm"),
|
|
67
|
+
hasGlobal("bun")
|
|
68
|
+
]);
|
|
69
|
+
return {
|
|
70
|
+
bun,
|
|
71
|
+
yarn,
|
|
72
|
+
pnpm,
|
|
73
|
+
npm
|
|
74
|
+
};
|
|
66
75
|
};
|
|
76
|
+
|
|
67
77
|
export { detectPackageManager };
|
|
68
78
|
//# sourceMappingURL=detectPackageManager.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"detectPackageManager.js","names":["fs"],"sources":["esm/detectPackageManager.js"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { exec } from \"./exec\";\nasync function pathExists(p) {\n try {\n await fs.access(p);\n return true;\n } catch {\n return false;\n }\n}\nasync function hasGlobal(pm) {\n try {\n const command = process.platform === \"win32\" ? `where ${pm}` : `which ${pm}`;\n const res = exec(command);\n return !!res.length;\n } catch {\n return false;\n }\n}\nasync function getFromLockfile(cwd = \".\") {\n const [yarn, npm, pnpm, bun] = await Promise.all([\n pathExists(resolve(cwd, \"yarn.lock\")),\n pathExists(resolve(cwd, \"package-lock.json\")),\n pathExists(resolve(cwd, \"pnpm-lock.yaml\")),\n pathExists(resolve(cwd, \"bun.lockb\"))\n ]);\n return { bun, yarn, pnpm, npm };\n}\nasync function getFromPackage(cwd = \".\") {\n if (await pathExists(resolve(cwd, \"package.json\"))) {\n const json = JSON.parse(await fs.readFile(resolve(cwd, \"package.json\"), \"utf-8\"));\n if (json.packageManager) {\n const yarn = !!json.packageManager.startsWith(\"yarn\");\n const pnpm = !!json.packageManager.startsWith(\"pnpm\");\n const bun = !!json.packageManager.startsWith(\"bun\");\n const npm = !!json.packageManager.startsWith(\"npm\");\n return { bun, yarn, pnpm, npm };\n }\n }\n}\nconst foundSome = (obj) => Object.keys(obj).some((k) => !!obj[k]);\nconst detectPackageManager = async ({ cwd } = {}) => {\n const fromLockfile = await getFromLockfile(cwd);\n if (foundSome(fromLockfile)) {\n return fromLockfile;\n }\n const fromPackageJson = await getFromPackage(cwd);\n if (fromPackageJson && foundSome(fromPackageJson)) {\n return fromPackageJson;\n }\n const [npm, yarn, pnpm, bun] = await Promise.all([\n hasGlobal(\"npm\"),\n hasGlobal(\"yarn\"),\n hasGlobal(\"pnpm\"),\n hasGlobal(\"bun\")\n ]);\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n};\nexport {\n detectPackageManager\n};\n//# sourceMappingURL=detectPackageManager.js.map\n"],"mappings":";;;;;AAGA,eAAe,WAAW,GAAG;CAC3B,IAAI;EACF,MAAMA,SAAG,OAAO,CAAC;EACjB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AACA,eAAe,UAAU,IAAI;CAC3B,IAAI;EACF,MAAM,UAAU,QAAQ,aAAa,UAAU,SAAS,OAAO,SAAS;EACxE,MAAM,MAAM,KAAK,OAAO;EACxB,OAAO,CAAC,CAAC,IAAI;CACf,QAAQ;EACN,OAAO;CACT;AACF;AACA,eAAe,gBAAgB,MAAM,KAAK;CACxC,MAAM,CAAC,MAAM,KAAK,MAAM,OAAO,MAAM,QAAQ,IAAI;EAC/C,WAAW,QAAQ,KAAK,WAAW,CAAC;EACpC,WAAW,QAAQ,KAAK,mBAAmB,CAAC;EAC5C,WAAW,QAAQ,KAAK,gBAAgB,CAAC;EACzC,WAAW,QAAQ,KAAK,WAAW,CAAC;CACtC,CAAC;CACD,OAAO;EAAE;EAAK;EAAM;EAAM;CAAI;AAChC;AACA,eAAe,eAAe,MAAM,KAAK;CACvC,IAAI,MAAM,WAAW,QAAQ,KAAK,cAAc,CAAC,GAAG;EAClD,MAAM,OAAO,KAAK,MAAM,MAAMA,SAAG,SAAS,QAAQ,KAAK,cAAc,GAAG,OAAO,CAAC;EAChF,IAAI,KAAK,gBAAgB;GACvB,MAAM,OAAO,CAAC,CAAC,KAAK,eAAe,WAAW,MAAM;GACpD,MAAM,OAAO,CAAC,CAAC,KAAK,eAAe,WAAW,MAAM;GACpD,MAAM,MAAM,CAAC,CAAC,KAAK,eAAe,WAAW,KAAK;GAClD,MAAM,MAAM,CAAC,CAAC,KAAK,eAAe,WAAW,KAAK;GAClD,OAAO;IAAE;IAAK;IAAM;IAAM;GAAI;EAChC;CACF;AACF;AACA,MAAM,aAAa,QAAQ,OAAO,KAAK,GAAG,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,IAAI,EAAE;AAChE,MAAM,uBAAuB,OAAO,EAAE,QAAQ,CAAC,MAAM;CACnD,MAAM,eAAe,MAAM,gBAAgB,GAAG;CAC9C,IAAI,UAAU,YAAY,GAAG;EAC3B,OAAO;CACT;CACA,MAAM,kBAAkB,MAAM,eAAe,GAAG;CAChD,IAAI,mBAAmB,UAAU,eAAe,GAAG;EACjD,OAAO;CACT;CACA,MAAM,CAAC,KAAK,MAAM,MAAM,OAAO,MAAM,QAAQ,IAAI;EAC/C,UAAU,KAAK;EACf,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,KAAK;CACjB,CAAC;CACD,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -1,75 +1,85 @@
|
|
|
1
|
-
import { promises
|
|
1
|
+
import { promises } from "fs";
|
|
2
2
|
import { resolve } from "path";
|
|
3
3
|
import { exec } from "./exec.native.js";
|
|
4
|
+
|
|
4
5
|
async function pathExists(p) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
try {
|
|
7
|
+
await promises.access(p);
|
|
8
|
+
return true;
|
|
9
|
+
} catch (unused) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
11
12
|
}
|
|
12
13
|
async function hasGlobal(pm) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
try {
|
|
15
|
+
var command = process.platform === "win32" ? `where ${pm}` : `which ${pm}`;
|
|
16
|
+
var res = exec(command);
|
|
17
|
+
return !!res.length;
|
|
18
|
+
} catch (unused) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
20
21
|
}
|
|
21
22
|
async function getFromLockfile() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ".";
|
|
24
|
+
var [yarn, npm, pnpm, bun] = await Promise.all([
|
|
25
|
+
pathExists(resolve(cwd, "yarn.lock")),
|
|
26
|
+
pathExists(resolve(cwd, "package-lock.json")),
|
|
27
|
+
pathExists(resolve(cwd, "pnpm-lock.yaml")),
|
|
28
|
+
pathExists(resolve(cwd, "bun.lockb"))
|
|
29
|
+
]);
|
|
30
|
+
return {
|
|
31
|
+
bun,
|
|
32
|
+
yarn,
|
|
33
|
+
pnpm,
|
|
34
|
+
npm
|
|
35
|
+
};
|
|
30
36
|
}
|
|
31
37
|
async function getFromPackage() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ".";
|
|
39
|
+
if (await pathExists(resolve(cwd, "package.json"))) {
|
|
40
|
+
var json = JSON.parse(await promises.readFile(resolve(cwd, "package.json"), "utf-8"));
|
|
41
|
+
if (json.packageManager) {
|
|
42
|
+
var yarn = !!json.packageManager.startsWith("yarn");
|
|
43
|
+
var pnpm = !!json.packageManager.startsWith("pnpm");
|
|
44
|
+
var bun = !!json.packageManager.startsWith("bun");
|
|
45
|
+
var npm = !!json.packageManager.startsWith("npm");
|
|
46
|
+
return {
|
|
47
|
+
bun,
|
|
48
|
+
yarn,
|
|
49
|
+
pnpm,
|
|
50
|
+
npm
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
|
-
var foundSome = function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
var foundSome = function(obj) {
|
|
56
|
+
return Object.keys(obj).some(function(k) {
|
|
57
|
+
return !!obj[k];
|
|
58
|
+
});
|
|
53
59
|
};
|
|
54
|
-
var detectPackageManager = async function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
var detectPackageManager = async function() {
|
|
61
|
+
var { cwd } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
62
|
+
var fromLockfile = await getFromLockfile(cwd);
|
|
63
|
+
if (foundSome(fromLockfile)) {
|
|
64
|
+
return fromLockfile;
|
|
65
|
+
}
|
|
66
|
+
var fromPackageJson = await getFromPackage(cwd);
|
|
67
|
+
if (fromPackageJson && foundSome(fromPackageJson)) {
|
|
68
|
+
return fromPackageJson;
|
|
69
|
+
}
|
|
70
|
+
var [npm, yarn, pnpm, bun] = await Promise.all([
|
|
71
|
+
hasGlobal("npm"),
|
|
72
|
+
hasGlobal("yarn"),
|
|
73
|
+
hasGlobal("pnpm"),
|
|
74
|
+
hasGlobal("bun")
|
|
75
|
+
]);
|
|
76
|
+
return {
|
|
77
|
+
bun,
|
|
78
|
+
yarn,
|
|
79
|
+
pnpm,
|
|
80
|
+
npm
|
|
81
|
+
};
|
|
73
82
|
};
|
|
83
|
+
|
|
74
84
|
export { detectPackageManager };
|
|
75
85
|
//# sourceMappingURL=detectPackageManager.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"detectPackageManager.native.js","names":["fs"],"sources":["esm/detectPackageManager.native.js"],"sourcesContent":["import { promises as fs } from \"fs\";\nimport { resolve } from \"path\";\nimport { exec } from \"./exec\";\nasync function pathExists(p) {\n try {\n await fs.access(p);\n return true;\n } catch (unused) {\n return false;\n }\n}\nasync function hasGlobal(pm) {\n try {\n var command = process.platform === \"win32\" ? `where ${pm}` : `which ${pm}`;\n var res = exec(command);\n return !!res.length;\n } catch (unused) {\n return false;\n }\n}\nasync function getFromLockfile() {\n var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \".\";\n var [yarn, npm, pnpm, bun] = await Promise.all([\n pathExists(resolve(cwd, \"yarn.lock\")),\n pathExists(resolve(cwd, \"package-lock.json\")),\n pathExists(resolve(cwd, \"pnpm-lock.yaml\")),\n pathExists(resolve(cwd, \"bun.lockb\"))\n ]);\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n}\nasync function getFromPackage() {\n var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \".\";\n if (await pathExists(resolve(cwd, \"package.json\"))) {\n var json = JSON.parse(await fs.readFile(resolve(cwd, \"package.json\"), \"utf-8\"));\n if (json.packageManager) {\n var yarn = !!json.packageManager.startsWith(\"yarn\");\n var pnpm = !!json.packageManager.startsWith(\"pnpm\");\n var bun = !!json.packageManager.startsWith(\"bun\");\n var npm = !!json.packageManager.startsWith(\"npm\");\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n }\n }\n}\nvar foundSome = function(obj) {\n return Object.keys(obj).some(function(k) {\n return !!obj[k];\n });\n};\nvar detectPackageManager = async function() {\n var { cwd } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n var fromLockfile = await getFromLockfile(cwd);\n if (foundSome(fromLockfile)) {\n return fromLockfile;\n }\n var fromPackageJson = await getFromPackage(cwd);\n if (fromPackageJson && foundSome(fromPackageJson)) {\n return fromPackageJson;\n }\n var [npm, yarn, pnpm, bun] = await Promise.all([\n hasGlobal(\"npm\"),\n hasGlobal(\"yarn\"),\n hasGlobal(\"pnpm\"),\n hasGlobal(\"bun\")\n ]);\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n};\nexport {\n detectPackageManager\n};\n//# sourceMappingURL=detectPackageManager.js.map\n"],"mappings":";;;;;AAGA,eAAe,WAAW,GAAG;CAC3B,IAAI;EACF,MAAMA,SAAG,OAAO,CAAC;EACjB,OAAO;CACT,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AACA,eAAe,UAAU,IAAI;CAC3B,IAAI;EACF,IAAI,UAAU,QAAQ,aAAa,UAAU,SAAS,OAAO,SAAS;EACtE,IAAI,MAAM,KAAK,OAAO;EACtB,OAAO,CAAC,CAAC,IAAI;CACf,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AACA,eAAe,kBAAkB;CAC/B,IAAI,MAAM,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CAC3E,IAAI,CAAC,MAAM,KAAK,MAAM,OAAO,MAAM,QAAQ,IAAI;EAC7C,WAAW,QAAQ,KAAK,WAAW,CAAC;EACpC,WAAW,QAAQ,KAAK,mBAAmB,CAAC;EAC5C,WAAW,QAAQ,KAAK,gBAAgB,CAAC;EACzC,WAAW,QAAQ,KAAK,WAAW,CAAC;CACtC,CAAC;CACD,OAAO;EACL;EACA;EACA;EACA;CACF;AACF;AACA,eAAe,iBAAiB;CAC9B,IAAI,MAAM,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CAC3E,IAAI,MAAM,WAAW,QAAQ,KAAK,cAAc,CAAC,GAAG;EAClD,IAAI,OAAO,KAAK,MAAM,MAAMA,SAAG,SAAS,QAAQ,KAAK,cAAc,GAAG,OAAO,CAAC;EAC9E,IAAI,KAAK,gBAAgB;GACvB,IAAI,OAAO,CAAC,CAAC,KAAK,eAAe,WAAW,MAAM;GAClD,IAAI,OAAO,CAAC,CAAC,KAAK,eAAe,WAAW,MAAM;GAClD,IAAI,MAAM,CAAC,CAAC,KAAK,eAAe,WAAW,KAAK;GAChD,IAAI,MAAM,CAAC,CAAC,KAAK,eAAe,WAAW,KAAK;GAChD,OAAO;IACL;IACA;IACA;IACA;GACF;EACF;CACF;AACF;AACA,IAAI,YAAY,SAAS,KAAK;CAC5B,OAAO,OAAO,KAAK,GAAG,CAAC,CAAC,KAAK,SAAS,GAAG;EACvC,OAAO,CAAC,CAAC,IAAI;CACf,CAAC;AACH;AACA,IAAI,uBAAuB,iBAAiB;CAC1C,IAAI,EAAE,QAAQ,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAChF,IAAI,eAAe,MAAM,gBAAgB,GAAG;CAC5C,IAAI,UAAU,YAAY,GAAG;EAC3B,OAAO;CACT;CACA,IAAI,kBAAkB,MAAM,eAAe,GAAG;CAC9C,IAAI,mBAAmB,UAAU,eAAe,GAAG;EACjD,OAAO;CACT;CACA,IAAI,CAAC,KAAK,MAAM,MAAM,OAAO,MAAM,QAAQ,IAAI;EAC7C,UAAU,KAAK;EACf,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,KAAK;CACjB,CAAC;CACD,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
package/dist/esm/exec.mjs
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
import { execSync, spawn } from "node:child_process";
|
|
2
|
+
|
|
2
3
|
const exec = (cmd, options) => {
|
|
3
|
-
|
|
4
|
+
return execSync(cmd, options)?.toString() || "";
|
|
4
5
|
};
|
|
5
6
|
const execPromise = (cmd, options) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const [command, ...args] = cmd.split(" ");
|
|
9
|
+
const child = spawn(command, args, {
|
|
10
|
+
stdio: options?.quiet ? "pipe" : "inherit",
|
|
11
|
+
shell: true,
|
|
12
|
+
...options
|
|
13
|
+
});
|
|
14
|
+
if (!options?.quiet || process.env.DEBUG) {
|
|
15
|
+
child.stdout?.pipe(process.stdout);
|
|
16
|
+
child.stderr?.pipe(process.stderr);
|
|
17
|
+
}
|
|
18
|
+
child.on("close", (code) => {
|
|
19
|
+
if (code !== 0) {
|
|
20
|
+
reject(new Error(`Command failed with exit code ${code}: ${cmd}`));
|
|
21
|
+
} else {
|
|
22
|
+
resolve();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
child.on("error", (error) => {
|
|
26
|
+
reject(error);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
28
29
|
};
|
|
29
30
|
const execPromiseQuiet = (cmd, options) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
return execPromise(cmd, {
|
|
32
|
+
...options,
|
|
33
|
+
quiet: true
|
|
34
|
+
});
|
|
34
35
|
};
|
|
36
|
+
|
|
35
37
|
export { exec, execPromise, execPromiseQuiet };
|
|
36
38
|
//# sourceMappingURL=exec.mjs.map
|
package/dist/esm/exec.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"exec.js","names":[],"sources":["esm/exec.js"],"sourcesContent":["import { execSync, spawn } from \"node:child_process\";\nconst exec = (cmd, options) => {\n return execSync(cmd, options)?.toString() || \"\";\n};\nconst execPromise = (cmd, options) => {\n return new Promise((resolve, reject) => {\n const [command, ...args] = cmd.split(\" \");\n const child = spawn(command, args, {\n stdio: options?.quiet ? \"pipe\" : \"inherit\",\n shell: true,\n ...options\n });\n if (!options?.quiet || process.env.DEBUG) {\n child.stdout?.pipe(process.stdout);\n child.stderr?.pipe(process.stderr);\n }\n child.on(\"close\", (code) => {\n if (code !== 0) {\n reject(new Error(`Command failed with exit code ${code}: ${cmd}`));\n } else {\n resolve();\n }\n });\n child.on(\"error\", (error) => {\n reject(error);\n });\n });\n};\nconst execPromiseQuiet = (cmd, options) => {\n return execPromise(cmd, {\n ...options,\n quiet: true\n });\n};\nexport {\n exec,\n execPromise,\n execPromiseQuiet\n};\n//# sourceMappingURL=exec.js.map\n"],"mappings":";;;AACA,MAAM,QAAQ,KAAK,YAAY;CAC7B,OAAO,SAAS,KAAK,OAAO,CAAC,EAAE,SAAS,KAAK;AAC/C;AACA,MAAM,eAAe,KAAK,YAAY;CACpC,OAAO,IAAI,SAAS,SAAS,WAAW;EACtC,MAAM,CAAC,SAAS,GAAG,QAAQ,IAAI,MAAM,GAAG;EACxC,MAAM,QAAQ,MAAM,SAAS,MAAM;GACjC,OAAO,SAAS,QAAQ,SAAS;GACjC,OAAO;GACP,GAAG;EACL,CAAC;EACD,IAAI,CAAC,SAAS,SAAS,QAAQ,IAAI,OAAO;GACxC,MAAM,QAAQ,KAAK,QAAQ,MAAM;GACjC,MAAM,QAAQ,KAAK,QAAQ,MAAM;EACnC;EACA,MAAM,GAAG,UAAU,SAAS;GAC1B,IAAI,SAAS,GAAG;IACd,OAAO,IAAI,MAAM,iCAAiC,KAAK,IAAI,KAAK,CAAC;GACnE,OAAO;IACL,QAAQ;GACV;EACF,CAAC;EACD,MAAM,GAAG,UAAU,UAAU;GAC3B,OAAO,KAAK;EACd,CAAC;CACH,CAAC;AACH;AACA,MAAM,oBAAoB,KAAK,YAAY;CACzC,OAAO,YAAY,KAAK;EACtB,GAAG;EACH,OAAO;CACT,CAAC;AACH"}
|
package/dist/esm/exec.native.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { execSync, spawn } from "child_process";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
var exec = function(cmd, options) {
|
|
4
|
+
var _execSync;
|
|
5
|
+
return ((_execSync = execSync(cmd, options)) === null || _execSync === void 0 ? void 0 : _execSync.toString()) || "";
|
|
5
6
|
};
|
|
6
|
-
var execPromise = function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
7
|
+
var execPromise = function(cmd, options) {
|
|
8
|
+
return new Promise(function(resolve, reject) {
|
|
9
|
+
var [command, ...args] = cmd.split(" ");
|
|
10
|
+
var child = spawn(command, args, {
|
|
11
|
+
stdio: (options === null || options === void 0 ? void 0 : options.quiet) ? "pipe" : "inherit",
|
|
12
|
+
shell: true,
|
|
13
|
+
...options
|
|
14
|
+
});
|
|
15
|
+
if (!(options === null || options === void 0 ? void 0 : options.quiet) || process.env.DEBUG) {
|
|
16
|
+
var _child_stdout, _child_stderr;
|
|
17
|
+
(_child_stdout = child.stdout) === null || _child_stdout === void 0 ? void 0 : _child_stdout.pipe(process.stdout);
|
|
18
|
+
(_child_stderr = child.stderr) === null || _child_stderr === void 0 ? void 0 : _child_stderr.pipe(process.stderr);
|
|
19
|
+
}
|
|
20
|
+
child.on("close", function(code) {
|
|
21
|
+
if (code !== 0) {
|
|
22
|
+
reject(new Error(`Command failed with exit code ${code}: ${cmd}`));
|
|
23
|
+
} else {
|
|
24
|
+
resolve();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
child.on("error", function(error) {
|
|
28
|
+
reject(error);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
30
31
|
};
|
|
31
|
-
var execPromiseQuiet = function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
var execPromiseQuiet = function(cmd, options) {
|
|
33
|
+
return execPromise(cmd, {
|
|
34
|
+
...options,
|
|
35
|
+
quiet: true
|
|
36
|
+
});
|
|
36
37
|
};
|
|
38
|
+
|
|
37
39
|
export { exec, execPromise, execPromiseQuiet };
|
|
38
40
|
//# sourceMappingURL=exec.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"exec.native.js","names":[],"sources":["esm/exec.native.js"],"sourcesContent":["import { execSync, spawn } from \"child_process\";\nvar exec = function(cmd, options) {\n var _execSync;\n return ((_execSync = execSync(cmd, options)) === null || _execSync === void 0 ? void 0 : _execSync.toString()) || \"\";\n};\nvar execPromise = function(cmd, options) {\n return new Promise(function(resolve, reject) {\n var [command, ...args] = cmd.split(\" \");\n var child = spawn(command, args, {\n stdio: (options === null || options === void 0 ? void 0 : options.quiet) ? \"pipe\" : \"inherit\",\n shell: true,\n ...options\n });\n if (!(options === null || options === void 0 ? void 0 : options.quiet) || process.env.DEBUG) {\n var _child_stdout, _child_stderr;\n (_child_stdout = child.stdout) === null || _child_stdout === void 0 ? void 0 : _child_stdout.pipe(process.stdout);\n (_child_stderr = child.stderr) === null || _child_stderr === void 0 ? void 0 : _child_stderr.pipe(process.stderr);\n }\n child.on(\"close\", function(code) {\n if (code !== 0) {\n reject(new Error(`Command failed with exit code ${code}: ${cmd}`));\n } else {\n resolve();\n }\n });\n child.on(\"error\", function(error) {\n reject(error);\n });\n });\n};\nvar execPromiseQuiet = function(cmd, options) {\n return execPromise(cmd, {\n ...options,\n quiet: true\n });\n};\nexport {\n exec,\n execPromise,\n execPromiseQuiet\n};\n//# sourceMappingURL=exec.js.map\n"],"mappings":";;;AACA,IAAI,OAAO,SAAS,KAAK,SAAS;CAChC,IAAI;CACJ,SAAS,YAAY,SAAS,KAAK,OAAO,OAAO,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU,SAAS,MAAM;AACpH;AACA,IAAI,cAAc,SAAS,KAAK,SAAS;CACvC,OAAO,IAAI,QAAQ,SAAS,SAAS,QAAQ;EAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,IAAI,MAAM,GAAG;EACtC,IAAI,QAAQ,MAAM,SAAS,MAAM;GAC/B,QAAQ,YAAY,QAAQ,YAAY,KAAK,IAAI,KAAK,IAAI,QAAQ,SAAS,SAAS;GACpF,OAAO;GACP,GAAG;EACL,CAAC;EACD,IAAI,EAAE,YAAY,QAAQ,YAAY,KAAK,IAAI,KAAK,IAAI,QAAQ,UAAU,QAAQ,IAAI,OAAO;GAC3F,IAAI,eAAe;GACnB,CAAC,gBAAgB,MAAM,YAAY,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,KAAK,QAAQ,MAAM;GAChH,CAAC,gBAAgB,MAAM,YAAY,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,KAAK,QAAQ,MAAM;EAClH;EACA,MAAM,GAAG,SAAS,SAAS,MAAM;GAC/B,IAAI,SAAS,GAAG;IACd,OAAO,IAAI,MAAM,iCAAiC,KAAK,IAAI,KAAK,CAAC;GACnE,OAAO;IACL,QAAQ;GACV;EACF,CAAC;EACD,MAAM,GAAG,SAAS,SAAS,OAAO;GAChC,OAAO,KAAK;EACd,CAAC;CACH,CAAC;AACH;AACA,IAAI,mBAAmB,SAAS,KAAK,SAAS;CAC5C,OAAO,YAAY,KAAK;EACtB,GAAG;EACH,OAAO;CACT,CAAC;AACH"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export * from "@vxrn/debug"
|
|
2
|
-
|
|
3
|
-
export * from "
|
|
4
|
-
|
|
5
|
-
export * from "./
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export * from "@vxrn/debug"
|
|
2
|
+
|
|
3
|
+
export * from "@vxrn/resolve"
|
|
4
|
+
|
|
5
|
+
export * from "./createMessageSocket.mjs"
|
|
6
|
+
|
|
7
|
+
export * from "./detectPackageManager.mjs"
|
|
8
|
+
|
|
9
|
+
export * from "./exec.mjs"
|
|
10
|
+
|
|
11
|
+
export * from "./mustReplace.mjs"
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export * from "@vxrn/debug"
|
|
2
|
-
|
|
3
|
-
export * from "
|
|
4
|
-
|
|
5
|
-
export * from "./
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export * from "@vxrn/debug"
|
|
2
|
+
|
|
3
|
+
export * from "@vxrn/resolve"
|
|
4
|
+
|
|
5
|
+
export * from "./createMessageSocket.mjs"
|
|
6
|
+
|
|
7
|
+
export * from "./detectPackageManager.mjs"
|
|
8
|
+
|
|
9
|
+
export * from "./exec.mjs"
|
|
10
|
+
|
|
11
|
+
export * from "./mustReplace.mjs"
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export * from "@vxrn/debug"
|
|
2
|
-
|
|
3
|
-
export * from "
|
|
4
|
-
|
|
5
|
-
export * from "./
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export * from "@vxrn/debug"
|
|
2
|
+
|
|
3
|
+
export * from "@vxrn/resolve"
|
|
4
|
+
|
|
5
|
+
export * from "./createMessageSocket.native.js"
|
|
6
|
+
|
|
7
|
+
export * from "./detectPackageManager.native.js"
|
|
8
|
+
|
|
9
|
+
export * from "./exec.native.js"
|
|
10
|
+
|
|
11
|
+
export * from "./mustReplace.native.js"
|
package/dist/esm/mustReplace.mjs
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { writeFileSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
|
|
4
5
|
function mustReplace(source, replacements) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
sourceOut = sourceOut.replace(find, replace);
|
|
20
|
-
}
|
|
21
|
-
return sourceOut;
|
|
6
|
+
let sourceOut = source;
|
|
7
|
+
for (const { find, replace, optional } of replacements) {
|
|
8
|
+
if (!optional) {
|
|
9
|
+
const found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
|
|
10
|
+
if (!found) {
|
|
11
|
+
const tmpPath = join(tmpdir(), `replace-error-${Math.random()}`);
|
|
12
|
+
writeFileSync(tmpPath, sourceOut, "utf-8");
|
|
13
|
+
throw new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
sourceOut = sourceOut.replace(find, replace);
|
|
17
|
+
}
|
|
18
|
+
return sourceOut;
|
|
22
19
|
}
|
|
20
|
+
|
|
23
21
|
export { mustReplace };
|
|
24
22
|
//# sourceMappingURL=mustReplace.mjs.map
|