@vxrn/utils 1.1.397 → 1.1.399
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/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/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 +4 -4
- package/src/mustReplace.ts +9 -1
- package/types/mustReplace.d.ts.map +1 -1
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/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.399",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"clean:build": "tamagui-build clean:build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vxrn/debug": "1.1.
|
|
36
|
-
"@vxrn/resolve": "1.1.
|
|
35
|
+
"@vxrn/debug": "1.1.399",
|
|
36
|
+
"@vxrn/resolve": "1.1.399"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@tamagui/build": "^1.121.
|
|
39
|
+
"@tamagui/build": "^1.121.10"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
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
|
|
|
@@ -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"}
|