@vxrn/utils 1.1.396 → 1.1.398
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/index.cjs +2 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +4 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/mustReplace.cjs +7 -1
- package/dist/cjs/mustReplace.js +7 -2
- package/dist/cjs/mustReplace.js.map +1 -1
- package/dist/cjs/mustReplace.native.js +5 -2
- package/dist/cjs/mustReplace.native.js.map +2 -2
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/mustReplace.js +9 -2
- package/dist/esm/mustReplace.js.map +1 -1
- package/dist/esm/mustReplace.mjs +7 -1
- package/dist/esm/mustReplace.mjs.map +1 -1
- package/dist/esm/mustReplace.native.js +7 -2
- package/dist/esm/mustReplace.native.js.map +2 -2
- package/package.json +7 -3
- package/src/index.ts +3 -0
- package/src/mustReplace.ts +9 -1
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/mustReplace.d.ts.map +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -15,6 +15,8 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
15
15
|
}), mod);
|
|
16
16
|
var index_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(index_exports);
|
|
18
|
+
__reExport(index_exports, require("@vxrn/debug"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("@vxrn/resolve"), module.exports);
|
|
18
20
|
__reExport(index_exports, require("./mustReplace.cjs"), module.exports);
|
|
19
21
|
__reExport(index_exports, require("./detectPackageManager.cjs"), module.exports);
|
|
20
22
|
__reExport(index_exports, require("./exec.cjs"), module.exports);
|
package/dist/cjs/index.js
CHANGED
|
@@ -11,6 +11,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
11
11
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
12
|
var index_exports = {};
|
|
13
13
|
module.exports = __toCommonJS(index_exports);
|
|
14
|
+
__reExport(index_exports, require("@vxrn/debug"), module.exports);
|
|
15
|
+
__reExport(index_exports, require("@vxrn/resolve"), module.exports);
|
|
14
16
|
__reExport(index_exports, require("./mustReplace"), module.exports);
|
|
15
17
|
__reExport(index_exports, require("./detectPackageManager"), module.exports);
|
|
16
18
|
__reExport(index_exports, require("./exec"), module.exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,
|
|
4
|
+
"mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,wBAAd;AACA,0BAAc,0BADd;AAGA,0BAAc,0BAHd;AAIA,0BAAc,mCAJd;AAKA,0BAAc,mBALd;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -12,11 +12,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
12
12
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
13
|
var index_exports = {};
|
|
14
14
|
module.exports = __toCommonJS(index_exports);
|
|
15
|
+
__reExport(index_exports, require("@vxrn/debug"), module.exports);
|
|
16
|
+
__reExport(index_exports, require("@vxrn/resolve"), module.exports);
|
|
15
17
|
__reExport(index_exports, require("./mustReplace"), module.exports);
|
|
16
18
|
__reExport(index_exports, require("./detectPackageManager"), module.exports);
|
|
17
19
|
__reExport(index_exports, require("./exec"), module.exports);
|
|
18
20
|
// Annotate the CommonJS export names for ESM import in node:
|
|
19
21
|
0 && (module.exports = {
|
|
22
|
+
...require("@vxrn/debug"),
|
|
23
|
+
...require("@vxrn/resolve"),
|
|
20
24
|
...require("./mustReplace"),
|
|
21
25
|
...require("./detectPackageManager"),
|
|
22
26
|
...require("./exec")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/utils/src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;AAAA;;0BAAc,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;AAAA;;0BAAc,wBAAd;AACA,0BAAc,0BADd;AAGA,0BAAc,0BAHd;AAIA,0BAAc,mCAJd;AAKA,0BAAc,mBALd;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/cjs/mustReplace.cjs
CHANGED
|
@@ -23,6 +23,9 @@ __export(mustReplace_exports, {
|
|
|
23
23
|
mustReplace: () => mustReplace
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(mustReplace_exports);
|
|
26
|
+
var import_node_fs = require("node:fs"),
|
|
27
|
+
import_node_os = require("node:os"),
|
|
28
|
+
import_node_path = require("node:path");
|
|
26
29
|
function mustReplace(source, replacements) {
|
|
27
30
|
let sourceOut = source;
|
|
28
31
|
for (const {
|
|
@@ -30,7 +33,10 @@ function mustReplace(source, replacements) {
|
|
|
30
33
|
replace,
|
|
31
34
|
optional
|
|
32
35
|
} of replacements) {
|
|
33
|
-
if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find)))
|
|
36
|
+
if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find))) {
|
|
37
|
+
const tmpPath = (0, import_node_path.join)((0, import_node_os.tmpdir)(), `replace-error-${Math.random()}`);
|
|
38
|
+
throw (0, import_node_fs.writeFileSync)(tmpPath, sourceOut, "utf-8"), new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
|
|
39
|
+
}
|
|
34
40
|
sourceOut = sourceOut.replace(find, replace);
|
|
35
41
|
}
|
|
36
42
|
return sourceOut;
|
package/dist/cjs/mustReplace.js
CHANGED
|
@@ -17,11 +17,16 @@ __export(mustReplace_exports, {
|
|
|
17
17
|
mustReplace: () => mustReplace
|
|
18
18
|
});
|
|
19
19
|
module.exports = __toCommonJS(mustReplace_exports);
|
|
20
|
+
var import_node_fs = require("node:fs"), import_node_os = require("node:os"), import_node_path = require("node:path");
|
|
20
21
|
function mustReplace(source, replacements) {
|
|
21
22
|
let sourceOut = source;
|
|
22
23
|
for (const { find, replace, optional } of replacements) {
|
|
23
|
-
if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find)))
|
|
24
|
-
|
|
24
|
+
if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find))) {
|
|
25
|
+
const tmpPath = (0, import_node_path.join)((0, import_node_os.tmpdir)(), `replace-error-${Math.random()}`);
|
|
26
|
+
throw (0, import_node_fs.writeFileSync)(tmpPath, sourceOut, "utf-8"), new Error(
|
|
27
|
+
`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
25
30
|
sourceOut = sourceOut.replace(find, replace);
|
|
26
31
|
}
|
|
27
32
|
return sourceOut;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mustReplace.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8B,oBAC9B,iBAAuB,oBACvB,mBAAqB;AAEd,SAAS,YACd,QACA,cAKA;AACA,MAAI,YAAY;AAChB,aAAW,EAAE,MAAM,SAAS,SAAS,KAAK,cAAc;AACtD,QAAI,CAAC,YAEC,EADU,gBAAgB,SAAS,KAAK,KAAK,SAAS,IAAI,UAAU,SAAS,IAAI,IACzE;AACV,YAAM,cAAU,2BAAK,uBAAO,GAAG,iBAAiB,KAAK,OAAO,CAAC,EAAE;AAC/D,8CAAc,SAAS,WAAW,OAAO,GACnC,IAAI;AAAA,QACR,yBAAyB,IAAI,mDAAmD,OAAO;AAAA,MACzF;AAAA,IACF;AAIF,gBAAY,UAAU,QAAQ,MAAM,OAAO;AAAA,EAC7C;AACA,SAAO;AACT;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -18,6 +18,7 @@ __export(mustReplace_exports, {
|
|
|
18
18
|
mustReplace: () => mustReplace
|
|
19
19
|
});
|
|
20
20
|
module.exports = __toCommonJS(mustReplace_exports);
|
|
21
|
+
var import_node_fs = require("node:fs"), import_node_os = require("node:os"), import_node_path = require("node:path");
|
|
21
22
|
function mustReplace(source, replacements) {
|
|
22
23
|
var sourceOut = source, _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
23
24
|
try {
|
|
@@ -25,8 +26,10 @@ function mustReplace(source, replacements) {
|
|
|
25
26
|
var { find, replace, optional } = _step.value;
|
|
26
27
|
if (!optional) {
|
|
27
28
|
var found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
|
|
28
|
-
if (!found)
|
|
29
|
-
|
|
29
|
+
if (!found) {
|
|
30
|
+
var tmpPath = (0, import_node_path.join)((0, import_node_os.tmpdir)(), `replace-error-${Math.random()}`);
|
|
31
|
+
throw (0, import_node_fs.writeFileSync)(tmpPath, sourceOut, "utf-8"), new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
sourceOut = sourceOut.replace(find, replace);
|
|
32
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/utils/src/mustReplace.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;
|
|
5
|
-
"names": ["mustReplace", "source", "replacements", "sourceOut", "find", "replace", "optional", "found", "RegExp", "test", "includes", "Error"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;qBAA8B,oBAC9B,iBAAuB,oBACvB,mBAAqB;AAEd,SAASA,YACdC,QACAC,cAIG;AAEH,MAAIC,YAAYF,QACX,4BAAA,IAAA,oBAAA,IAAA,iBAAA;;AAAL,aAAK,YAAqCC,aAAAA,OAAAA,QAAAA,EAAAA,GAArC,OAAA,EAAA,6BAAA,QAAA,UAAA,KAAA,GAAA,OAAA,4BAAA,IAAmD;AAAnD,UAAM,EAAEE,MAAMC,SAASC,SAAQ,IAA/B,MAAA;AACH,UAAI,CAACA,UAAU;AACb,YAAMC,QAAQH,gBAAgBI,SAASJ,KAAKK,KAAKN,SAAAA,IAAaA,UAAUO,SAASN,IAAAA;AACjF,YAAI,CAACG,OAAO;AACV,cAAMI,cAAUC,2BAAKC,uBAAAA,GAAU,iBAAiBC,KAAKC,OAAM,CAAA,EAAI;AAC/DC,kDAAcL,SAASR,WAAW,OAAA,GAC5B,IAAIc,MACR,yBAAyBb,IAAAA,mDAAuDO,OAAAA,GAAU;QAE9F;MACF;AAGAR,kBAAYA,UAAUE,QAAQD,MAAMC,OAAAA;IACtC;;AAdK,wBAAA,IAAA,iBAAA;;;OAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;UAAA;cAAA;;;AAeL,SAAOF;AACT;",
|
|
5
|
+
"names": ["mustReplace", "source", "replacements", "sourceOut", "find", "replace", "optional", "found", "RegExp", "test", "includes", "tmpPath", "join", "tmpdir", "Math", "random", "writeFileSync", "Error"]
|
|
6
6
|
}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
package/dist/esm/mustReplace.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
1
4
|
function mustReplace(source, replacements) {
|
|
2
5
|
let sourceOut = source;
|
|
3
6
|
for (const { find, replace, optional } of replacements) {
|
|
4
|
-
if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find)))
|
|
5
|
-
|
|
7
|
+
if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find))) {
|
|
8
|
+
const tmpPath = join(tmpdir(), `replace-error-${Math.random()}`);
|
|
9
|
+
throw writeFileSync(tmpPath, sourceOut, "utf-8"), new Error(
|
|
10
|
+
`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`
|
|
11
|
+
);
|
|
12
|
+
}
|
|
6
13
|
sourceOut = sourceOut.replace(find, replace);
|
|
7
14
|
}
|
|
8
15
|
return sourceOut;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mustReplace.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,YAAY;AAEd,SAAS,YACd,QACA,cAKA;AACA,MAAI,YAAY;AAChB,aAAW,EAAE,MAAM,SAAS,SAAS,KAAK,cAAc;AACtD,QAAI,CAAC,YAEC,EADU,gBAAgB,SAAS,KAAK,KAAK,SAAS,IAAI,UAAU,SAAS,IAAI,IACzE;AACV,YAAM,UAAU,KAAK,OAAO,GAAG,iBAAiB,KAAK,OAAO,CAAC,EAAE;AAC/D,0BAAc,SAAS,WAAW,OAAO,GACnC,IAAI;AAAA,QACR,yBAAyB,IAAI,mDAAmD,OAAO;AAAA,MACzF;AAAA,IACF;AAIF,gBAAY,UAAU,QAAQ,MAAM,OAAO;AAAA,EAC7C;AACA,SAAO;AACT;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/mustReplace.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
1
4
|
function mustReplace(source, replacements) {
|
|
2
5
|
let sourceOut = source;
|
|
3
6
|
for (const {
|
|
@@ -5,7 +8,10 @@ function mustReplace(source, replacements) {
|
|
|
5
8
|
replace,
|
|
6
9
|
optional
|
|
7
10
|
} of replacements) {
|
|
8
|
-
if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find)))
|
|
11
|
+
if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find))) {
|
|
12
|
+
const tmpPath = join(tmpdir(), `replace-error-${Math.random()}`);
|
|
13
|
+
throw writeFileSync(tmpPath, sourceOut, "utf-8"), new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
|
|
14
|
+
}
|
|
9
15
|
sourceOut = sourceOut.replace(find, replace);
|
|
10
16
|
}
|
|
11
17
|
return sourceOut;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["mustReplace","source","replacements","sourceOut","find","replace","optional","RegExp","test","includes","Error"],"sources":["../../src/mustReplace.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["writeFileSync","tmpdir","join","mustReplace","source","replacements","sourceOut","find","replace","optional","RegExp","test","includes","tmpPath","Math","random","Error"],"sources":["../../src/mustReplace.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,QAAqB;AAC9B,SAASC,MAAA,QAAc;AACvB,SAASC,IAAA,QAAY;AAEd,SAASC,YACdC,MAAA,EACAC,YAAA,EAKA;EACA,IAAIC,SAAA,GAAYF,MAAA;EAChB,WAAW;IAAEG,IAAA;IAAMC,OAAA;IAASC;EAAS,KAAKJ,YAAA,EAAc;IACtD,IAAI,CAACI,QAAA,IAEC,EADUF,IAAA,YAAgBG,MAAA,GAASH,IAAA,CAAKI,IAAA,CAAKL,SAAS,IAAIA,SAAA,CAAUM,QAAA,CAASL,IAAI,IACzE;MACV,MAAMM,OAAA,GAAUX,IAAA,CAAKD,MAAA,CAAO,GAAG,iBAAiBa,IAAA,CAAKC,MAAA,CAAO,CAAC,EAAE;MAC/D,MAAAf,aAAA,CAAca,OAAA,EAASP,SAAA,EAAW,OAAO,GACnC,IAAIU,KAAA,CACR,yBAAyBT,IAAI,mDAAmDM,OAAO,GACzF;IACF;IAIFP,SAAA,GAAYA,SAAA,CAAUE,OAAA,CAAQD,IAAA,EAAMC,OAAO;EAC7C;EACA,OAAOF,SAAA;AACT","ignoreList":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
1
4
|
function mustReplace(source, replacements) {
|
|
2
5
|
var sourceOut = source, _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
3
6
|
try {
|
|
@@ -5,8 +8,10 @@ function mustReplace(source, replacements) {
|
|
|
5
8
|
var { find, replace, optional } = _step.value;
|
|
6
9
|
if (!optional) {
|
|
7
10
|
var found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
|
|
8
|
-
if (!found)
|
|
9
|
-
|
|
11
|
+
if (!found) {
|
|
12
|
+
var tmpPath = join(tmpdir(), `replace-error-${Math.random()}`);
|
|
13
|
+
throw writeFileSync(tmpPath, sourceOut, "utf-8"), new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
sourceOut = sourceOut.replace(find, replace);
|
|
12
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/utils/src/mustReplace.ts"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["mustReplace", "source", "replacements", "sourceOut", "find", "replace", "optional", "found", "RegExp", "test", "includes", "Error"]
|
|
4
|
+
"mappings": "AAAA,SAASA,qBAAqB;AAC9B,SAASC,cAAc;AACvB,SAASC,YAAY;AAEd,SAASC,YACdC,QACAC,cAIG;AAEH,MAAIC,YAAYF,QACX,4BAAA,IAAA,oBAAA,IAAA,iBAAA;;AAAL,aAAK,YAAqCC,aAAAA,OAAAA,QAAAA,EAAAA,GAArC,OAAA,EAAA,6BAAA,QAAA,UAAA,KAAA,GAAA,OAAA,4BAAA,IAAmD;AAAnD,UAAM,EAAEE,MAAMC,SAASC,SAAQ,IAA/B,MAAA;AACH,UAAI,CAACA,UAAU;AACb,YAAMC,QAAQH,gBAAgBI,SAASJ,KAAKK,KAAKN,SAAAA,IAAaA,UAAUO,SAASN,IAAAA;AACjF,YAAI,CAACG,OAAO;AACV,cAAMI,UAAUZ,KAAKD,OAAAA,GAAU,iBAAiBc,KAAKC,OAAM,CAAA,EAAI;AAC/DhB,8BAAcc,SAASR,WAAW,OAAA,GAC5B,IAAIW,MACR,yBAAyBV,IAAAA,mDAAuDO,OAAAA,GAAU;QAE9F;MACF;AAGAR,kBAAYA,UAAUE,QAAQD,MAAMC,OAAAA;IACtC;;AAdK,wBAAA,IAAA,iBAAA;;;OAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;UAAA;cAAA;;;AAeL,SAAOF;AACT;",
|
|
5
|
+
"names": ["writeFileSync", "tmpdir", "join", "mustReplace", "source", "replacements", "sourceOut", "find", "replace", "optional", "found", "RegExp", "test", "includes", "tmpPath", "Math", "random", "Error"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.398",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -27,12 +27,16 @@
|
|
|
27
27
|
"build": "tamagui-build",
|
|
28
28
|
"watch": "tamagui-build --watch",
|
|
29
29
|
"lint": "npx biome check src",
|
|
30
|
-
"lint:fix": "npx biome check --
|
|
30
|
+
"lint:fix": "npx biome check --write --unsafe src",
|
|
31
31
|
"clean": "tamagui-build clean",
|
|
32
32
|
"clean:build": "tamagui-build clean:build"
|
|
33
33
|
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@vxrn/debug": "1.1.398",
|
|
36
|
+
"@vxrn/resolve": "1.1.398"
|
|
37
|
+
},
|
|
34
38
|
"devDependencies": {
|
|
35
|
-
"@tamagui/build": "^1.121.
|
|
39
|
+
"@tamagui/build": "^1.121.10"
|
|
36
40
|
},
|
|
37
41
|
"publishConfig": {
|
|
38
42
|
"access": "public"
|
package/src/index.ts
CHANGED
package/src/mustReplace.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { writeFileSync } from 'node:fs'
|
|
2
|
+
import { tmpdir } from 'node:os'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
|
|
1
5
|
export function mustReplace(
|
|
2
6
|
source: string,
|
|
3
7
|
replacements: {
|
|
@@ -11,7 +15,11 @@ export function mustReplace(
|
|
|
11
15
|
if (!optional) {
|
|
12
16
|
const found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find)
|
|
13
17
|
if (!found) {
|
|
14
|
-
|
|
18
|
+
const tmpPath = join(tmpdir(), `replace-error-${Math.random()}`)
|
|
19
|
+
writeFileSync(tmpPath, sourceOut, 'utf-8')
|
|
20
|
+
throw new Error(
|
|
21
|
+
`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`
|
|
22
|
+
)
|
|
15
23
|
}
|
|
16
24
|
}
|
|
17
25
|
|
package/types/index.d.ts
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAE7B,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,QAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mustReplace.d.ts","sourceRoot":"","sources":["../src/mustReplace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mustReplace.d.ts","sourceRoot":"","sources":["../src/mustReplace.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE;IACZ,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,EAAE,UAmBJ"}
|