@layerzerolabs/common-node-utils 0.2.22 → 0.2.24
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/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-lint.log +1 -1
- package/LICENSE +23 -0
- package/dist/{AY3Z4VAF.cjs → II2MVA6U.cjs} +27 -8
- package/dist/II2MVA6U.cjs.map +1 -0
- package/dist/{P5H7F74Q.js → OKSMIGRA.js} +28 -9
- package/dist/OKSMIGRA.js.map +1 -0
- package/dist/files.cjs +3 -3
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +1 -1
- package/dist/index.cjs +22 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -16
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
- package/src/files.ts +23 -4
- package/src/index.ts +26 -16
- package/dist/AY3Z4VAF.cjs.map +0 -1
- package/dist/P5H7F74Q.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[32mESM[39m [1mdist/files.js [22m[32m141.00 B[39m
|
|
15
|
-
[32mESM[39m [1mdist/index.js [22m[32m1.09 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/P5H7F74Q.js [22m[32m1.20 KB[39m
|
|
17
|
-
[32mESM[39m [1mdist/files.js.map [22m[32m69.00 B[39m
|
|
18
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m2.04 KB[39m
|
|
19
|
-
[32mESM[39m [1mdist/P5H7F74Q.js.map [22m[32m2.51 KB[39m
|
|
20
|
-
[32mESM[39m ⚡️ Build success in 180ms
|
|
21
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m1.99 KB[39m
|
|
22
|
-
[32mCJS[39m [1mdist/AY3Z4VAF.cjs [22m[32m1019.00 B[39m
|
|
23
14
|
[32mCJS[39m [1mdist/files.cjs [22m[32m421.00 B[39m
|
|
24
|
-
[32mCJS[39m [1mdist/index.cjs
|
|
25
|
-
[32mCJS[39m [1mdist/
|
|
15
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m2.15 KB[39m
|
|
16
|
+
[32mCJS[39m [1mdist/II2MVA6U.cjs [22m[32m1.42 KB[39m
|
|
26
17
|
[32mCJS[39m [1mdist/files.cjs.map [22m[32m70.00 B[39m
|
|
27
|
-
[32mCJS[39m
|
|
18
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m2.78 KB[39m
|
|
19
|
+
[32mCJS[39m [1mdist/II2MVA6U.cjs.map [22m[32m2.68 KB[39m
|
|
20
|
+
[32mCJS[39m ⚡️ Build success in 156ms
|
|
21
|
+
[32mESM[39m [1mdist/files.js [22m[32m141.00 B[39m
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m1.24 KB[39m
|
|
23
|
+
[32mESM[39m [1mdist/OKSMIGRA.js [22m[32m1.61 KB[39m
|
|
24
|
+
[32mESM[39m [1mdist/files.js.map [22m[32m69.00 B[39m
|
|
25
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m2.75 KB[39m
|
|
26
|
+
[32mESM[39m [1mdist/OKSMIGRA.js.map [22m[32m3.46 KB[39m
|
|
27
|
+
[32mESM[39m ⚡️ Build success in 157ms
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
> @layerzerolabs/common-node-utils@0.0.0 lint /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-node-utils
|
|
3
3
|
> eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)
|
|
4
4
|
|
|
5
|
-
(node:
|
|
5
|
+
(node:54620) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/monorepo-internal/monorepo-internal/eslint.config.js?mtime=1770955556851 is not specified and it doesn't parse as CommonJS.
|
|
6
6
|
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
|
|
7
7
|
To eliminate this warning, add "type": "module" to /home/runner/work/monorepo-internal/monorepo-internal/package.json.
|
|
8
8
|
(Use `node --trace-warnings ...` to show where the warning was created)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Copyright (c) 2026 - LayerZero Labs Ltd.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any
|
|
4
|
+
person obtaining a copy of this software and associated
|
|
5
|
+
documentation files (the "Software"), to deal in the
|
|
6
|
+
Software without restriction, including without
|
|
7
|
+
limitation the rights to use, copy, modify, merge,
|
|
8
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software
|
|
10
|
+
is furnished to do so, subject to the following
|
|
11
|
+
conditions:
|
|
12
|
+
The above copyright notice and this permission notice
|
|
13
|
+
shall be included in all copies or substantial portions
|
|
14
|
+
of the Software.
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
16
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
17
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
18
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
19
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
22
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
23
|
+
DEALINGS IN THE SOFTWARE.
|
|
@@ -8,14 +8,33 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
8
8
|
var dirCache = /* @__PURE__ */ new Map();
|
|
9
9
|
var writeFileAndCreateDirsCached = /* @__PURE__ */ __name(async (path$1, data) => {
|
|
10
10
|
const dir = path.dirname(path$1);
|
|
11
|
-
|
|
12
|
-
dirCache.
|
|
11
|
+
const ensureDir = /* @__PURE__ */ __name(() => {
|
|
12
|
+
const cached = dirCache.get(dir);
|
|
13
|
+
if (cached) return cached;
|
|
14
|
+
const created = promises.mkdir(dir, {
|
|
13
15
|
recursive: true
|
|
14
|
-
}))
|
|
16
|
+
}).catch((err) => {
|
|
17
|
+
dirCache.delete(dir);
|
|
18
|
+
throw err;
|
|
19
|
+
});
|
|
20
|
+
dirCache.set(dir, created);
|
|
21
|
+
return created;
|
|
22
|
+
}, "ensureDir");
|
|
23
|
+
try {
|
|
24
|
+
await ensureDir();
|
|
25
|
+
await promises.writeFile(path$1, data, {
|
|
26
|
+
encoding: "utf-8"
|
|
27
|
+
});
|
|
28
|
+
} catch (err) {
|
|
29
|
+
if (err?.code !== "ENOENT") {
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
dirCache.delete(dir);
|
|
33
|
+
await ensureDir();
|
|
34
|
+
await promises.writeFile(path$1, data, {
|
|
35
|
+
encoding: "utf-8"
|
|
36
|
+
});
|
|
15
37
|
}
|
|
16
|
-
await dirCache.get(dir)?.then(() => promises.writeFile(path$1, data, {
|
|
17
|
-
encoding: "utf-8"
|
|
18
|
-
}));
|
|
19
38
|
}, "writeFileAndCreateDirsCached");
|
|
20
39
|
async function pathExists(path) {
|
|
21
40
|
try {
|
|
@@ -30,5 +49,5 @@ __name(pathExists, "pathExists");
|
|
|
30
49
|
exports.__name = __name;
|
|
31
50
|
exports.pathExists = pathExists;
|
|
32
51
|
exports.writeFileAndCreateDirsCached = writeFileAndCreateDirsCached;
|
|
33
|
-
//# sourceMappingURL=
|
|
34
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=II2MVA6U.cjs.map
|
|
53
|
+
//# sourceMappingURL=II2MVA6U.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/files.ts"],"names":["dirCache","Map","writeFileAndCreateDirsCached","path","data","dir","dirname","ensureDir","cached","get","created","mkdir","recursive","catch","err","delete","set","writeFile","encoding","code","pathExists","stat"],"mappings":";;;;;;;AAGA,IAAMA,QAAAA,uBAAeC,GAAAA,EAAAA;AAEd,IAAMC,4BAAAA,mBAA+B,MAAA,CAAA,OAAOC,MAAAA,EAAcC,IAAAA,KAAAA;AAC7D,EAAA,MAAMC,GAAAA,GAAMC,aAAQH,MAAAA,CAAAA;AACpB,EAAA,MAAMI,4BAAY,MAAA,CAAA,MAAA;AACd,IAAA,MAAMC,MAAAA,GAASR,QAAAA,CAASS,GAAAA,CAAIJ,GAAAA,CAAAA;AAC5B,IAAA,IAAIG,QAAQ,OAAOA,MAAAA;AAEnB,IAAA,MAAME,OAAAA,GAAUC,eAAMN,GAAAA,EAAK;MAAEO,SAAAA,EAAW;KAAK,CAAA,CAAGC,KAAAA,CAAM,CAACC,GAAAA,KAAAA;AACnDd,MAAAA,QAAAA,CAASe,OAAOV,GAAAA,CAAAA;AAChB,MAAA,MAAMS,GAAAA;IACV,CAAA,CAAA;AACAd,IAAAA,QAAAA,CAASgB,GAAAA,CAAIX,KAAKK,OAAAA,CAAAA;AAClB,IAAA,OAAOA,OAAAA;EACX,CAAA,EAVkB,WAAA,CAAA;AAYlB,EAAA,IAAI;AACA,IAAA,MAAMH,SAAAA,EAAAA;AACN,IAAA,MAAMU,kBAAAA,CAAUd,QAAMC,IAAAA,EAAM;MAAEc,QAAAA,EAAU;KAAQ,CAAA;AACpD,EAAA,CAAA,CAAA,OAASJ,GAAAA,EAAU;AACf,IAAA,IAAIA,GAAAA,EAAKK,SAAS,QAAA,EAAU;AACxB,MAAA,MAAML,GAAAA;AACV,IAAA;AAEAd,IAAAA,QAAAA,CAASe,OAAOV,GAAAA,CAAAA;AAChB,IAAA,MAAME,SAAAA,EAAAA;AACN,IAAA,MAAMU,kBAAAA,CAAUd,QAAMC,IAAAA,EAAM;MAAEc,QAAAA,EAAU;KAAQ,CAAA;AACpD,EAAA;AACJ,CAAA,EA1B4C,8BAAA;AA4B5C,eAAsBE,WAAWjB,IAAAA,EAAY;AACzC,EAAA,IAAI;AACA,IAAA,MAAMkB,cAAKlB,IAAAA,CAAAA;AACX,IAAA,OAAO,IAAA;AACX,EAAA,CAAA,CAAA,OAASW,GAAAA,EAAU;AACf,IAAA,OAAOA,GAAAA,CAAIK,IAAAA,KAAS,QAAA,GAAW,IAAA,GAAO,KAAA;AAC1C,EAAA;AACJ;AAPsBC,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA","file":"II2MVA6U.cjs","sourcesContent":["import { mkdir, stat, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\n\nconst dirCache = new Map<string, Promise<string | undefined>>();\n\nexport const writeFileAndCreateDirsCached = async (path: string, data: string) => {\n const dir = dirname(path);\n const ensureDir = () => {\n const cached = dirCache.get(dir);\n if (cached) return cached;\n\n const created = mkdir(dir, { recursive: true }).catch((err) => {\n dirCache.delete(dir);\n throw err;\n });\n dirCache.set(dir, created);\n return created;\n };\n\n try {\n await ensureDir();\n await writeFile(path, data, { encoding: 'utf-8' });\n } catch (err: any) {\n if (err?.code !== 'ENOENT') {\n throw err;\n }\n\n dirCache.delete(dir);\n await ensureDir();\n await writeFile(path, data, { encoding: 'utf-8' });\n }\n};\n\nexport async function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch (err: any) {\n return err.code !== 'ENOENT' ? true : false;\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path, { dirname } from 'path';
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
|
-
import {
|
|
3
|
+
import { writeFile, mkdir, stat } from 'fs/promises';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -10,14 +10,33 @@ var __dirname$1 = /* @__PURE__ */ getDirname();
|
|
|
10
10
|
var dirCache = /* @__PURE__ */ new Map();
|
|
11
11
|
var writeFileAndCreateDirsCached = /* @__PURE__ */ __name(async (path2, data) => {
|
|
12
12
|
const dir = dirname(path2);
|
|
13
|
-
|
|
14
|
-
dirCache.
|
|
13
|
+
const ensureDir = /* @__PURE__ */ __name(() => {
|
|
14
|
+
const cached = dirCache.get(dir);
|
|
15
|
+
if (cached) return cached;
|
|
16
|
+
const created = mkdir(dir, {
|
|
15
17
|
recursive: true
|
|
16
|
-
}))
|
|
18
|
+
}).catch((err) => {
|
|
19
|
+
dirCache.delete(dir);
|
|
20
|
+
throw err;
|
|
21
|
+
});
|
|
22
|
+
dirCache.set(dir, created);
|
|
23
|
+
return created;
|
|
24
|
+
}, "ensureDir");
|
|
25
|
+
try {
|
|
26
|
+
await ensureDir();
|
|
27
|
+
await writeFile(path2, data, {
|
|
28
|
+
encoding: "utf-8"
|
|
29
|
+
});
|
|
30
|
+
} catch (err) {
|
|
31
|
+
if (err?.code !== "ENOENT") {
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
dirCache.delete(dir);
|
|
35
|
+
await ensureDir();
|
|
36
|
+
await writeFile(path2, data, {
|
|
37
|
+
encoding: "utf-8"
|
|
38
|
+
});
|
|
17
39
|
}
|
|
18
|
-
await dirCache.get(dir)?.then(() => writeFile(path2, data, {
|
|
19
|
-
encoding: "utf-8"
|
|
20
|
-
}));
|
|
21
40
|
}, "writeFileAndCreateDirsCached");
|
|
22
41
|
async function pathExists(path2) {
|
|
23
42
|
try {
|
|
@@ -30,5 +49,5 @@ async function pathExists(path2) {
|
|
|
30
49
|
__name(pathExists, "pathExists");
|
|
31
50
|
|
|
32
51
|
export { __dirname$1 as __dirname, __name, pathExists, writeFileAndCreateDirsCached };
|
|
33
|
-
//# sourceMappingURL=
|
|
34
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=OKSMIGRA.js.map
|
|
53
|
+
//# sourceMappingURL=OKSMIGRA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js","../src/files.ts"],"names":["getFilename","fileURLToPath","url","getDirname","path","dirname","__dirname","dirCache","Map","writeFileAndCreateDirsCached","data","dir","ensureDir","cached","get","created","mkdir","recursive","catch","err","delete","set","writeFile","encoding","code","pathExists","stat"],"mappings":";;;;;;AAIA,IAAMA,WAAAA,mBAAc,MAAA,CAAA,MAAMC,aAAAA,CAAc,MAAA,CAAA,IAAA,CAAYC,GAAG,CAAA,EAAnC,aAAA,CAAA;AACpB,IAAMC,6BAAa,MAAA,CAAA,MAAMC,IAAAA,CAAKC,OAAAA,CAAQL,WAAAA,EAAAA,CAAAA,EAAnB,YAAA,CAAA;AAEZ,IAAMM,8BAA4BH,UAAAA;ACJzC,IAAMI,QAAAA,uBAAeC,GAAAA,EAAAA;AAEd,IAAMC,4BAAAA,mBAA+B,MAAA,CAAA,OAAOL,KAAAA,EAAcM,IAAAA,KAAAA;AAC7D,EAAA,MAAMC,GAAAA,GAAMN,QAAQD,KAAAA,CAAAA;AACpB,EAAA,MAAMQ,4BAAY,MAAA,CAAA,MAAA;AACd,IAAA,MAAMC,MAAAA,GAASN,QAAAA,CAASO,GAAAA,CAAIH,GAAAA,CAAAA;AAC5B,IAAA,IAAIE,QAAQ,OAAOA,MAAAA;AAEnB,IAAA,MAAME,OAAAA,GAAUC,MAAML,GAAAA,EAAK;MAAEM,SAAAA,EAAW;KAAK,CAAA,CAAGC,KAAAA,CAAM,CAACC,GAAAA,KAAAA;AACnDZ,MAAAA,QAAAA,CAASa,OAAOT,GAAAA,CAAAA;AAChB,MAAA,MAAMQ,GAAAA;IACV,CAAA,CAAA;AACAZ,IAAAA,QAAAA,CAASc,GAAAA,CAAIV,KAAKI,OAAAA,CAAAA;AAClB,IAAA,OAAOA,OAAAA;EACX,CAAA,EAVkB,WAAA,CAAA;AAYlB,EAAA,IAAI;AACA,IAAA,MAAMH,SAAAA,EAAAA;AACN,IAAA,MAAMU,SAAAA,CAAUlB,OAAMM,IAAAA,EAAM;MAAEa,QAAAA,EAAU;KAAQ,CAAA;AACpD,EAAA,CAAA,CAAA,OAASJ,GAAAA,EAAU;AACf,IAAA,IAAIA,GAAAA,EAAKK,SAAS,QAAA,EAAU;AACxB,MAAA,MAAML,GAAAA;AACV,IAAA;AAEAZ,IAAAA,QAAAA,CAASa,OAAOT,GAAAA,CAAAA;AAChB,IAAA,MAAMC,SAAAA,EAAAA;AACN,IAAA,MAAMU,SAAAA,CAAUlB,OAAMM,IAAAA,EAAM;MAAEa,QAAAA,EAAU;KAAQ,CAAA;AACpD,EAAA;AACJ,CAAA,EA1B4C,8BAAA;AA4B5C,eAAsBE,WAAWrB,KAAAA,EAAY;AACzC,EAAA,IAAI;AACA,IAAA,MAAMsB,KAAKtB,KAAAA,CAAAA;AACX,IAAA,OAAO,IAAA;AACX,EAAA,CAAA,CAAA,OAASe,GAAAA,EAAU;AACf,IAAA,OAAOA,GAAAA,CAAIK,IAAAA,KAAS,QAAA,GAAW,IAAA,GAAO,KAAA;AAC1C,EAAA;AACJ;AAPsBC,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA","file":"OKSMIGRA.js","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import { mkdir, stat, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\n\nconst dirCache = new Map<string, Promise<string | undefined>>();\n\nexport const writeFileAndCreateDirsCached = async (path: string, data: string) => {\n const dir = dirname(path);\n const ensureDir = () => {\n const cached = dirCache.get(dir);\n if (cached) return cached;\n\n const created = mkdir(dir, { recursive: true }).catch((err) => {\n dirCache.delete(dir);\n throw err;\n });\n dirCache.set(dir, created);\n return created;\n };\n\n try {\n await ensureDir();\n await writeFile(path, data, { encoding: 'utf-8' });\n } catch (err: any) {\n if (err?.code !== 'ENOENT') {\n throw err;\n }\n\n dirCache.delete(dir);\n await ensureDir();\n await writeFile(path, data, { encoding: 'utf-8' });\n }\n};\n\nexport async function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch (err: any) {\n return err.code !== 'ENOENT' ? true : false;\n }\n}\n"]}
|
package/dist/files.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var II2MVA6U_cjs = require('./II2MVA6U.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "pathExists", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return II2MVA6U_cjs.pathExists; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "writeFileAndCreateDirsCached", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return II2MVA6U_cjs.writeFileAndCreateDirsCached; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=files.cjs.map
|
|
16
16
|
//# sourceMappingURL=files.cjs.map
|
package/dist/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,4BAA4B,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,4BAA4B,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,kBA0B5E,CAAC;AAEF,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D"}
|
package/dist/files.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var II2MVA6U_cjs = require('./II2MVA6U.cjs');
|
|
4
4
|
var fs = require('fs/promises');
|
|
5
5
|
var path = require('path');
|
|
6
6
|
|
|
@@ -28,35 +28,39 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
|
28
28
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
29
29
|
|
|
30
30
|
var _fullyQualifiedRepoRootPath = void 0;
|
|
31
|
-
var getFullyQualifiedRepoRootPath = /* @__PURE__ */
|
|
31
|
+
var getFullyQualifiedRepoRootPath = /* @__PURE__ */ II2MVA6U_cjs.__name(() => {
|
|
32
32
|
if (!_fullyQualifiedRepoRootPath) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
if (process.env.REPO_ROOT) {
|
|
34
|
+
_fullyQualifiedRepoRootPath = Promise.resolve(process.env.REPO_ROOT);
|
|
35
|
+
} else {
|
|
36
|
+
_fullyQualifiedRepoRootPath = (async () => {
|
|
37
|
+
let currentDir = __dirname;
|
|
38
|
+
while (true) {
|
|
39
|
+
const candidate = path__default.default.join(currentDir, "pnpm-workspace.yaml");
|
|
40
|
+
try {
|
|
41
|
+
await fs__namespace.access(candidate);
|
|
42
|
+
return currentDir;
|
|
43
|
+
} catch {
|
|
44
|
+
const parent = path__default.default.dirname(currentDir);
|
|
45
|
+
if (parent === currentDir) {
|
|
46
|
+
throw new Error(`Could not locate root (pnpm-workspace.yaml not found)--started from ${__dirname}, ended at ${currentDir}`);
|
|
47
|
+
}
|
|
48
|
+
currentDir = parent;
|
|
44
49
|
}
|
|
45
|
-
currentDir = parent;
|
|
46
50
|
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
51
|
+
})();
|
|
52
|
+
}
|
|
49
53
|
}
|
|
50
54
|
return _fullyQualifiedRepoRootPath;
|
|
51
55
|
}, "getFullyQualifiedRepoRootPath");
|
|
52
56
|
|
|
53
57
|
Object.defineProperty(exports, "pathExists", {
|
|
54
58
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
59
|
+
get: function () { return II2MVA6U_cjs.pathExists; }
|
|
56
60
|
});
|
|
57
61
|
Object.defineProperty(exports, "writeFileAndCreateDirsCached", {
|
|
58
62
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
63
|
+
get: function () { return II2MVA6U_cjs.writeFileAndCreateDirsCached; }
|
|
60
64
|
});
|
|
61
65
|
exports.getFullyQualifiedRepoRootPath = getFullyQualifiedRepoRootPath;
|
|
62
66
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["_fullyQualifiedRepoRootPath","undefined","getFullyQualifiedRepoRootPath","__name","currentDir","__dirname","candidate","path","join","access","parent","dirname","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAIA,2BAAAA,GAA2DC,MAAAA;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["_fullyQualifiedRepoRootPath","undefined","getFullyQualifiedRepoRootPath","__name","process","env","REPO_ROOT","Promise","resolve","currentDir","__dirname","candidate","path","join","access","parent","dirname","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAIA,2BAAAA,GAA2DC,MAAAA;AAKxD,IAAMC,gDAAgCC,mBAAA,CAAA,MAAA;AACzC,EAAA,IAAI,CAACH,2BAAAA,EAA6B;AAE9B,IAAA,IAAII,OAAAA,CAAQC,IAAIC,SAAAA,EAAW;AAEvBN,MAAAA,2BAAAA,GAA8BO,OAAAA,CAAQC,OAAAA,CAAQJ,OAAAA,CAAQC,GAAAA,CAAIC,SAAS,CAAA;IACvE,CAAA,MAAO;AACHN,MAAAA,2BAAAA,GAAAA,CAA+B,YAAA;AAC3B,QAAA,IAAIS,UAAAA,GAAaC,SAAAA;AACjB,QAAA,OAAO,IAAA,EAAM;AACT,UAAA,MAAMC,SAAAA,GAAYC,qBAAAA,CAAKC,IAAAA,CAAKJ,UAAAA,EAAY,qBAAA,CAAA;AACxC,UAAA,IAAI;AACA,YAAA,MAASK,qBAAOH,SAAAA,CAAAA;AAChB,YAAA,OAAOF,UAAAA;UACX,CAAA,CAAA,MAAQ;AACJ,YAAA,MAAMM,MAAAA,GAASH,qBAAAA,CAAKI,OAAAA,CAAQP,UAAAA,CAAAA;AAC5B,YAAA,IAAIM,WAAWN,UAAAA,EAAY;AACvB,cAAA,MAAM,IAAIQ,KAAAA,CACN,CAAA,oEAAA,EAAuEP,SAAAA,CAAAA,WAAAA,EAAuBD,UAAAA,CAAAA,CAAY,CAAA;AAElH,YAAA;AACAA,YAAAA,UAAAA,GAAaM,MAAAA;AACjB,UAAA;AACJ,QAAA;MACJ,CAAA,GAAA;AACJ,IAAA;AACJ,EAAA;AAEA,EAAA,OAAOf,2BAAAA;AACX,CAAA,EA7B6C,+BAAA","file":"index.cjs","sourcesContent":["import * as fs from 'fs/promises';\nimport path from 'path';\n\nlet _fullyQualifiedRepoRootPath: Promise<string> | undefined = undefined;\n/**\n * Get the fully qualified path to the repository root by searching for pnpm-workspace.yaml\n * @returns The absolute path to the repository root\n */\nexport const getFullyQualifiedRepoRootPath = (): Promise<string> => {\n if (!_fullyQualifiedRepoRootPath) {\n // eslint-disable-next-line turbo/no-undeclared-env-vars\n if (process.env.REPO_ROOT) {\n // eslint-disable-next-line turbo/no-undeclared-env-vars\n _fullyQualifiedRepoRootPath = Promise.resolve(process.env.REPO_ROOT);\n } else {\n _fullyQualifiedRepoRootPath = (async (): Promise<string> => {\n let currentDir = __dirname;\n while (true) {\n const candidate = path.join(currentDir, 'pnpm-workspace.yaml');\n try {\n await fs.access(candidate);\n return currentDir;\n } catch {\n const parent = path.dirname(currentDir);\n if (parent === currentDir) {\n throw new Error(\n `Could not locate root (pnpm-workspace.yaml not found)--started from ${__dirname}, ended at ${currentDir}`,\n );\n }\n currentDir = parent;\n }\n }\n })();\n }\n }\n\n return _fullyQualifiedRepoRootPath;\n};\n\nexport * from './files';\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the fully qualified path to the repository root by searching for pnpm-workspace.yaml
|
|
3
|
+
* @returns The absolute path to the repository root
|
|
4
|
+
*/
|
|
1
5
|
export declare const getFullyQualifiedRepoRootPath: () => Promise<string>;
|
|
2
6
|
export * from './files';
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,6BAA6B,QAAO,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,6BAA6B,QAAO,OAAO,CAAC,MAAM,CA6B9D,CAAC;AAEF,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
import { __name, __dirname as __dirname$1 } from './
|
|
2
|
-
export { pathExists, writeFileAndCreateDirsCached } from './
|
|
1
|
+
import { __name, __dirname as __dirname$1 } from './OKSMIGRA.js';
|
|
2
|
+
export { pathExists, writeFileAndCreateDirsCached } from './OKSMIGRA.js';
|
|
3
3
|
import * as fs from 'fs/promises';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
|
|
6
6
|
var _fullyQualifiedRepoRootPath = void 0;
|
|
7
7
|
var getFullyQualifiedRepoRootPath = /* @__PURE__ */ __name(() => {
|
|
8
8
|
if (!_fullyQualifiedRepoRootPath) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
if (process.env.REPO_ROOT) {
|
|
10
|
+
_fullyQualifiedRepoRootPath = Promise.resolve(process.env.REPO_ROOT);
|
|
11
|
+
} else {
|
|
12
|
+
_fullyQualifiedRepoRootPath = (async () => {
|
|
13
|
+
let currentDir = __dirname$1;
|
|
14
|
+
while (true) {
|
|
15
|
+
const candidate = path.join(currentDir, "pnpm-workspace.yaml");
|
|
16
|
+
try {
|
|
17
|
+
await fs.access(candidate);
|
|
18
|
+
return currentDir;
|
|
19
|
+
} catch {
|
|
20
|
+
const parent = path.dirname(currentDir);
|
|
21
|
+
if (parent === currentDir) {
|
|
22
|
+
throw new Error(`Could not locate root (pnpm-workspace.yaml not found)--started from ${__dirname$1}, ended at ${currentDir}`);
|
|
23
|
+
}
|
|
24
|
+
currentDir = parent;
|
|
20
25
|
}
|
|
21
|
-
currentDir = parent;
|
|
22
26
|
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
27
|
+
})();
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
return _fullyQualifiedRepoRootPath;
|
|
27
31
|
}, "getFullyQualifiedRepoRootPath");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["_fullyQualifiedRepoRootPath","undefined","getFullyQualifiedRepoRootPath","currentDir","__dirname","candidate","path","join","access","parent","dirname","Error"],"mappings":";;;;;AAGA,IAAIA,2BAAAA,GAA2DC,MAAAA;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["_fullyQualifiedRepoRootPath","undefined","getFullyQualifiedRepoRootPath","process","env","REPO_ROOT","Promise","resolve","currentDir","__dirname","candidate","path","join","access","parent","dirname","Error"],"mappings":";;;;;AAGA,IAAIA,2BAAAA,GAA2DC,MAAAA;AAKxD,IAAMC,gDAAgC,MAAA,CAAA,MAAA;AACzC,EAAA,IAAI,CAACF,2BAAAA,EAA6B;AAE9B,IAAA,IAAIG,OAAAA,CAAQC,IAAIC,SAAAA,EAAW;AAEvBL,MAAAA,2BAAAA,GAA8BM,OAAAA,CAAQC,OAAAA,CAAQJ,OAAAA,CAAQC,GAAAA,CAAIC,SAAS,CAAA;IACvE,CAAA,MAAO;AACHL,MAAAA,2BAAAA,GAAAA,CAA+B,YAAA;AAC3B,QAAA,IAAIQ,UAAAA,GAAaC,WAAAA;AACjB,QAAA,OAAO,IAAA,EAAM;AACT,UAAA,MAAMC,SAAAA,GAAYC,IAAAA,CAAKC,IAAAA,CAAKJ,UAAAA,EAAY,qBAAA,CAAA;AACxC,UAAA,IAAI;AACA,YAAA,MAASK,UAAOH,SAAAA,CAAAA;AAChB,YAAA,OAAOF,UAAAA;UACX,CAAA,CAAA,MAAQ;AACJ,YAAA,MAAMM,MAAAA,GAASH,IAAAA,CAAKI,OAAAA,CAAQP,UAAAA,CAAAA;AAC5B,YAAA,IAAIM,WAAWN,UAAAA,EAAY;AACvB,cAAA,MAAM,IAAIQ,KAAAA,CACN,CAAA,oEAAA,EAAuEP,WAAAA,CAAAA,WAAAA,EAAuBD,UAAAA,CAAAA,CAAY,CAAA;AAElH,YAAA;AACAA,YAAAA,UAAAA,GAAaM,MAAAA;AACjB,UAAA;AACJ,QAAA;MACJ,CAAA,GAAA;AACJ,IAAA;AACJ,EAAA;AAEA,EAAA,OAAOd,2BAAAA;AACX,CAAA,EA7B6C,+BAAA","file":"index.js","sourcesContent":["import * as fs from 'fs/promises';\nimport path from 'path';\n\nlet _fullyQualifiedRepoRootPath: Promise<string> | undefined = undefined;\n/**\n * Get the fully qualified path to the repository root by searching for pnpm-workspace.yaml\n * @returns The absolute path to the repository root\n */\nexport const getFullyQualifiedRepoRootPath = (): Promise<string> => {\n if (!_fullyQualifiedRepoRootPath) {\n // eslint-disable-next-line turbo/no-undeclared-env-vars\n if (process.env.REPO_ROOT) {\n // eslint-disable-next-line turbo/no-undeclared-env-vars\n _fullyQualifiedRepoRootPath = Promise.resolve(process.env.REPO_ROOT);\n } else {\n _fullyQualifiedRepoRootPath = (async (): Promise<string> => {\n let currentDir = __dirname;\n while (true) {\n const candidate = path.join(currentDir, 'pnpm-workspace.yaml');\n try {\n await fs.access(candidate);\n return currentDir;\n } catch {\n const parent = path.dirname(currentDir);\n if (parent === currentDir) {\n throw new Error(\n `Could not locate root (pnpm-workspace.yaml not found)--started from ${__dirname}, ended at ${currentDir}`,\n );\n }\n currentDir = parent;\n }\n }\n })();\n }\n }\n\n return _fullyQualifiedRepoRootPath;\n};\n\nexport * from './files';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/common-node-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,13 +16,19 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"tsup": "^8.4.0",
|
|
18
18
|
"vitest": "^3.2.3",
|
|
19
|
-
"@layerzerolabs/tsup-configuration": "0.2.
|
|
20
|
-
"@layerzerolabs/typescript-configuration": "0.2.
|
|
19
|
+
"@layerzerolabs/tsup-configuration": "0.2.24",
|
|
20
|
+
"@layerzerolabs/typescript-configuration": "0.2.24"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "restricted",
|
|
24
24
|
"registry": "https://registry.npmjs.org/"
|
|
25
25
|
},
|
|
26
|
+
"externalRepoConfig": {
|
|
27
|
+
"targets": [
|
|
28
|
+
"monorepo-external",
|
|
29
|
+
"onesig-client"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
26
32
|
"scripts": {
|
|
27
33
|
"build": "tsup",
|
|
28
34
|
"lint": "eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)",
|
package/src/files.ts
CHANGED
|
@@ -5,11 +5,30 @@ const dirCache = new Map<string, Promise<string | undefined>>();
|
|
|
5
5
|
|
|
6
6
|
export const writeFileAndCreateDirsCached = async (path: string, data: string) => {
|
|
7
7
|
const dir = dirname(path);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const ensureDir = () => {
|
|
9
|
+
const cached = dirCache.get(dir);
|
|
10
|
+
if (cached) return cached;
|
|
11
|
+
|
|
12
|
+
const created = mkdir(dir, { recursive: true }).catch((err) => {
|
|
13
|
+
dirCache.delete(dir);
|
|
14
|
+
throw err;
|
|
15
|
+
});
|
|
16
|
+
dirCache.set(dir, created);
|
|
17
|
+
return created;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
await ensureDir();
|
|
22
|
+
await writeFile(path, data, { encoding: 'utf-8' });
|
|
23
|
+
} catch (err: any) {
|
|
24
|
+
if (err?.code !== 'ENOENT') {
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
dirCache.delete(dir);
|
|
29
|
+
await ensureDir();
|
|
30
|
+
await writeFile(path, data, { encoding: 'utf-8' });
|
|
11
31
|
}
|
|
12
|
-
await dirCache.get(dir)?.then(() => writeFile(path, data, { encoding: 'utf-8' }));
|
|
13
32
|
};
|
|
14
33
|
|
|
15
34
|
export async function pathExists(path: string): Promise<boolean> {
|
package/src/index.ts
CHANGED
|
@@ -2,26 +2,36 @@ import * as fs from 'fs/promises';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
4
|
let _fullyQualifiedRepoRootPath: Promise<string> | undefined = undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Get the fully qualified path to the repository root by searching for pnpm-workspace.yaml
|
|
7
|
+
* @returns The absolute path to the repository root
|
|
8
|
+
*/
|
|
5
9
|
export const getFullyQualifiedRepoRootPath = (): Promise<string> => {
|
|
6
10
|
if (!_fullyQualifiedRepoRootPath) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
|
12
|
+
if (process.env.REPO_ROOT) {
|
|
13
|
+
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
|
14
|
+
_fullyQualifiedRepoRootPath = Promise.resolve(process.env.REPO_ROOT);
|
|
15
|
+
} else {
|
|
16
|
+
_fullyQualifiedRepoRootPath = (async (): Promise<string> => {
|
|
17
|
+
let currentDir = __dirname;
|
|
18
|
+
while (true) {
|
|
19
|
+
const candidate = path.join(currentDir, 'pnpm-workspace.yaml');
|
|
20
|
+
try {
|
|
21
|
+
await fs.access(candidate);
|
|
22
|
+
return currentDir;
|
|
23
|
+
} catch {
|
|
24
|
+
const parent = path.dirname(currentDir);
|
|
25
|
+
if (parent === currentDir) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Could not locate root (pnpm-workspace.yaml not found)--started from ${__dirname}, ended at ${currentDir}`,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
currentDir = parent;
|
|
20
31
|
}
|
|
21
|
-
currentDir = parent;
|
|
22
32
|
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
33
|
+
})();
|
|
34
|
+
}
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
return _fullyQualifiedRepoRootPath;
|
package/dist/AY3Z4VAF.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/files.ts"],"names":["dirCache","Map","writeFileAndCreateDirsCached","path","data","dir","dirname","has","set","mkdir","recursive","get","then","writeFile","encoding","pathExists","stat","err","code"],"mappings":";;;;;;;AAGA,IAAMA,QAAAA,uBAAeC,GAAAA,EAAAA;AAEd,IAAMC,4BAAAA,mBAA+B,MAAA,CAAA,OAAOC,MAAAA,EAAcC,IAAAA,KAAAA;AAC7D,EAAA,MAAMC,GAAAA,GAAMC,aAAQH,MAAAA,CAAAA;AAEpB,EAAA,IAAI,CAACH,QAAAA,CAASO,GAAAA,CAAIF,GAAAA,CAAAA,EAAM;AACpBL,IAAAA,QAAAA,CAASQ,GAAAA,CAAIH,GAAAA,EAAKI,cAAAA,CAAMJ,GAAAA,EAAK;MAAEK,SAAAA,EAAW;AAAK,KAAA,CAAA,CAAA;AACnD,EAAA;AACA,EAAA,MAAMV,QAAAA,CAASW,IAAIN,GAAAA,CAAAA,EAAMO,KAAK,MAAMC,kBAAAA,CAAUV,QAAMC,IAAAA,EAAM;IAAEU,QAAAA,EAAU;AAAQ,GAAA,CAAA,CAAA;AAClF,CAAA,EAP4C,8BAAA;AAS5C,eAAsBC,WAAWZ,IAAAA,EAAY;AACzC,EAAA,IAAI;AACA,IAAA,MAAMa,cAAKb,IAAAA,CAAAA;AACX,IAAA,OAAO,IAAA;AACX,EAAA,CAAA,CAAA,OAASc,GAAAA,EAAU;AACf,IAAA,OAAOA,GAAAA,CAAIC,IAAAA,KAAS,QAAA,GAAW,IAAA,GAAO,KAAA;AAC1C,EAAA;AACJ;AAPsBH,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA","file":"AY3Z4VAF.cjs","sourcesContent":["import { mkdir, stat, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\n\nconst dirCache = new Map<string, Promise<string | undefined>>();\n\nexport const writeFileAndCreateDirsCached = async (path: string, data: string) => {\n const dir = dirname(path);\n // Deduplicate concurrent mkdir calls\n if (!dirCache.has(dir)) {\n dirCache.set(dir, mkdir(dir, { recursive: true }));\n }\n await dirCache.get(dir)?.then(() => writeFile(path, data, { encoding: 'utf-8' }));\n};\n\nexport async function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch (err: any) {\n return err.code !== 'ENOENT' ? true : false;\n }\n}\n"]}
|
package/dist/P5H7F74Q.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js","../src/files.ts"],"names":["getFilename","fileURLToPath","url","getDirname","path","dirname","__dirname","dirCache","Map","writeFileAndCreateDirsCached","data","dir","has","set","mkdir","recursive","get","then","writeFile","encoding","pathExists","stat","err","code"],"mappings":";;;;;;AAIA,IAAMA,WAAAA,mBAAc,MAAA,CAAA,MAAMC,aAAAA,CAAc,MAAA,CAAA,IAAA,CAAYC,GAAG,CAAA,EAAnC,aAAA,CAAA;AACpB,IAAMC,6BAAa,MAAA,CAAA,MAAMC,IAAAA,CAAKC,OAAAA,CAAQL,WAAAA,EAAAA,CAAAA,EAAnB,YAAA,CAAA;AAEZ,IAAMM,8BAA4BH,UAAAA;ACJzC,IAAMI,QAAAA,uBAAeC,GAAAA,EAAAA;AAEd,IAAMC,4BAAAA,mBAA+B,MAAA,CAAA,OAAOL,KAAAA,EAAcM,IAAAA,KAAAA;AAC7D,EAAA,MAAMC,GAAAA,GAAMN,QAAQD,KAAAA,CAAAA;AAEpB,EAAA,IAAI,CAACG,QAAAA,CAASK,GAAAA,CAAID,GAAAA,CAAAA,EAAM;AACpBJ,IAAAA,QAAAA,CAASM,GAAAA,CAAIF,GAAAA,EAAKG,KAAAA,CAAMH,GAAAA,EAAK;MAAEI,SAAAA,EAAW;AAAK,KAAA,CAAA,CAAA;AACnD,EAAA;AACA,EAAA,MAAMR,QAAAA,CAASS,IAAIL,GAAAA,CAAAA,EAAMM,KAAK,MAAMC,SAAAA,CAAUd,OAAMM,IAAAA,EAAM;IAAES,QAAAA,EAAU;AAAQ,GAAA,CAAA,CAAA;AAClF,CAAA,EAP4C,8BAAA;AAS5C,eAAsBC,WAAWhB,KAAAA,EAAY;AACzC,EAAA,IAAI;AACA,IAAA,MAAMiB,KAAKjB,KAAAA,CAAAA;AACX,IAAA,OAAO,IAAA;AACX,EAAA,CAAA,CAAA,OAASkB,GAAAA,EAAU;AACf,IAAA,OAAOA,GAAAA,CAAIC,IAAAA,KAAS,QAAA,GAAW,IAAA,GAAO,KAAA;AAC1C,EAAA;AACJ;AAPsBH,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA","file":"P5H7F74Q.js","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import { mkdir, stat, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\n\nconst dirCache = new Map<string, Promise<string | undefined>>();\n\nexport const writeFileAndCreateDirsCached = async (path: string, data: string) => {\n const dir = dirname(path);\n // Deduplicate concurrent mkdir calls\n if (!dirCache.has(dir)) {\n dirCache.set(dir, mkdir(dir, { recursive: true }));\n }\n await dirCache.get(dir)?.then(() => writeFile(path, data, { encoding: 'utf-8' }));\n};\n\nexport async function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch (err: any) {\n return err.code !== 'ENOENT' ? true : false;\n }\n}\n"]}
|