@layerzerolabs/common-node-utils 0.0.31
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 +26 -0
- package/.turbo/turbo-checkdeps.log +8 -0
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +12 -0
- package/dist/ORVETYPP.cjs +24 -0
- package/dist/ORVETYPP.cjs.map +1 -0
- package/dist/PXUGBXL3.js +26 -0
- package/dist/PXUGBXL3.js.map +1 -0
- package/dist/files.cjs +12 -0
- package/dist/files.cjs.map +1 -0
- package/dist/files.d.ts +2 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +3 -0
- package/dist/files.js.map +1 -0
- package/dist/index.cjs +59 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -0
- package/src/files.ts +13 -0
- package/src/index.ts +30 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +8 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
> @layerzerolabs/common-node-utils@0.0.0 build /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-node-utils
|
|
3
|
+
> tsup
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/files.ts, src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.4.0
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-node-utils/tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: es2022
|
|
10
|
+
[34mCLI[39m Cleaning output folder
|
|
11
|
+
[34mCJS[39m Build start
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m1.06 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/PXUGBXL3.js [22m[32m1.00 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/files.js [22m[32m129.00 B[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m2.04 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/PXUGBXL3.js.map [22m[32m1.98 KB[39m
|
|
18
|
+
[32mESM[39m [1mdist/files.js.map [22m[32m69.00 B[39m
|
|
19
|
+
[32mESM[39m ⚡️ Build success in 98ms
|
|
20
|
+
[32mCJS[39m [1mdist/files.cjs [22m[32m295.00 B[39m
|
|
21
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m1.87 KB[39m
|
|
22
|
+
[32mCJS[39m [1mdist/ORVETYPP.cjs [22m[32m789.00 B[39m
|
|
23
|
+
[32mCJS[39m [1mdist/files.cjs.map [22m[32m70.00 B[39m
|
|
24
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m2.08 KB[39m
|
|
25
|
+
[32mCJS[39m [1mdist/ORVETYPP.cjs.map [22m[32m1.23 KB[39m
|
|
26
|
+
[32mCJS[39m ⚡️ Build success in 98ms
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
> @layerzerolabs/common-node-utils@0.0.0 checkdeps /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-node-utils
|
|
3
|
+
> pnpm --filter @layerzerolabs/depcheck run depcheck validate --catalog --missing-dependencies --only $npm_package_name
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> @layerzerolabs/depcheck@1.0.1 depcheck /home/runner/work/monorepo-internal/monorepo-internal/tools/repo/depcheck
|
|
7
|
+
> tsx ./src/index.ts "validate" "--catalog" "--missing-dependencies" "--only" "@layerzerolabs/common-node-utils"
|
|
8
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
> @layerzerolabs/common-node-utils@0.0.0 test /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-node-utils
|
|
3
|
+
> vitest --run --pass-with-no-tests
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[1m[46m RUN [49m[22m [36mv3.2.3 [39m[90m/home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-node-utils[39m
|
|
7
|
+
|
|
8
|
+
No test files found, exiting with code 0
|
|
9
|
+
|
|
10
|
+
[2minclude: [22m[33m**/*.{test,spec}.?(c|m)[jt]s?(x)[39m
|
|
11
|
+
[2mexclude: [22m[33m**/node_modules/**[2m, [22m**/dist/**[2m, [22m**/cypress/**[2m, [22m**/.{idea,git,cache,output,temp}/**[2m, [22m**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*[39m
|
|
12
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var promises = require('fs/promises');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var dirCache = /* @__PURE__ */ new Map();
|
|
9
|
+
var writeFileAndCreateDirsCached = /* @__PURE__ */ __name(async (path$1, data) => {
|
|
10
|
+
const dir = path.dirname(path$1);
|
|
11
|
+
if (!dirCache.has(dir)) {
|
|
12
|
+
dirCache.set(dir, promises.mkdir(dir, {
|
|
13
|
+
recursive: true
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
await dirCache.get(dir)?.then(() => promises.writeFile(path$1, data, {
|
|
17
|
+
encoding: "utf-8"
|
|
18
|
+
}));
|
|
19
|
+
}, "writeFileAndCreateDirsCached");
|
|
20
|
+
|
|
21
|
+
exports.__name = __name;
|
|
22
|
+
exports.writeFileAndCreateDirsCached = writeFileAndCreateDirsCached;
|
|
23
|
+
//# sourceMappingURL=ORVETYPP.cjs.map
|
|
24
|
+
//# sourceMappingURL=ORVETYPP.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/files.ts"],"names":["dirCache","Map","writeFileAndCreateDirsCached","path","data","dir","dirname","has","set","mkdir","recursive","get","then","writeFile","encoding"],"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","file":"ORVETYPP.cjs","sourcesContent":["import { mkdir, 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"]}
|
package/dist/PXUGBXL3.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { dirname } from 'node:path';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var getFilename = /* @__PURE__ */ __name(() => fileURLToPath(import.meta.url), "getFilename");
|
|
9
|
+
var getDirname = /* @__PURE__ */ __name(() => path.dirname(getFilename()), "getDirname");
|
|
10
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
11
|
+
var dirCache = /* @__PURE__ */ new Map();
|
|
12
|
+
var writeFileAndCreateDirsCached = /* @__PURE__ */ __name(async (path2, data) => {
|
|
13
|
+
const dir = dirname(path2);
|
|
14
|
+
if (!dirCache.has(dir)) {
|
|
15
|
+
dirCache.set(dir, mkdir(dir, {
|
|
16
|
+
recursive: true
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
await dirCache.get(dir)?.then(() => writeFile(path2, data, {
|
|
20
|
+
encoding: "utf-8"
|
|
21
|
+
}));
|
|
22
|
+
}, "writeFileAndCreateDirsCached");
|
|
23
|
+
|
|
24
|
+
export { __dirname, __name, writeFileAndCreateDirsCached };
|
|
25
|
+
//# sourceMappingURL=PXUGBXL3.js.map
|
|
26
|
+
//# sourceMappingURL=PXUGBXL3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.12.5_@swc+helpers@0.5.17__postcss@8.5.3_tsx@4.20.4_typescript@5.8.2_yaml@2.8.0/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"],"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,4BAA4BH,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","file":"PXUGBXL3.js","sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\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, 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"]}
|
package/dist/files.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ORVETYPP_cjs = require('./ORVETYPP.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "writeFileAndCreateDirsCached", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return ORVETYPP_cjs.writeFileAndCreateDirsCached; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=files.cjs.map
|
|
12
|
+
//# sourceMappingURL=files.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"files.cjs"}
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +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,kBAO5E,CAAC"}
|
package/dist/files.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"files.js"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ORVETYPP_cjs = require('./ORVETYPP.cjs');
|
|
4
|
+
var fs = require('fs/promises');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
28
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
29
|
+
|
|
30
|
+
var _fullyQualifiedRepoRootPath = void 0;
|
|
31
|
+
var getFullyQualifiedRepoRootPath = /* @__PURE__ */ ORVETYPP_cjs.__name(() => {
|
|
32
|
+
if (!_fullyQualifiedRepoRootPath) {
|
|
33
|
+
_fullyQualifiedRepoRootPath = (async () => {
|
|
34
|
+
let currentDir = __dirname;
|
|
35
|
+
while (true) {
|
|
36
|
+
const candidate = path__default.default.join(currentDir, "pnpm-workspace.yaml");
|
|
37
|
+
try {
|
|
38
|
+
await fs__namespace.access(candidate);
|
|
39
|
+
return currentDir;
|
|
40
|
+
} catch {
|
|
41
|
+
const parent = path__default.default.dirname(currentDir);
|
|
42
|
+
if (parent === currentDir) {
|
|
43
|
+
throw new Error(`Could not locate root (pnpm-workspace.yaml not found)--started from ${__dirname}, ended at ${currentDir}`);
|
|
44
|
+
}
|
|
45
|
+
currentDir = parent;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
49
|
+
}
|
|
50
|
+
return _fullyQualifiedRepoRootPath;
|
|
51
|
+
}, "getFullyQualifiedRepoRootPath");
|
|
52
|
+
|
|
53
|
+
Object.defineProperty(exports, "writeFileAndCreateDirsCached", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return ORVETYPP_cjs.writeFileAndCreateDirsCached; }
|
|
56
|
+
});
|
|
57
|
+
exports.getFullyQualifiedRepoRootPath = getFullyQualifiedRepoRootPath;
|
|
58
|
+
//# sourceMappingURL=index.cjs.map
|
|
59
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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;AACxD,IAAMC,gDAAgCC,mBAAA,CAAA,MAAA;AACzC,EAAA,IAAI,CAACH,2BAAAA,EAA6B;AAC9BA,IAAAA,2BAAAA,GAAAA,CAA+B,YAAA;AAC3B,MAAA,IAAII,UAAAA,GAAaC,SAAAA;AACjB,MAAA,OAAO,IAAA,EAAM;AACT,QAAA,MAAMC,SAAAA,GAAYC,qBAAAA,CAAKC,IAAAA,CAAKJ,UAAAA,EAAY,qBAAA,CAAA;AACxC,QAAA,IAAI;AACA,UAAA,MAASK,qBAAOH,SAAAA,CAAAA;AAChB,UAAA,OAAOF,UAAAA;QACX,CAAA,CAAA,MAAQ;AACJ,UAAA,MAAMM,MAAAA,GAASH,qBAAAA,CAAKI,OAAAA,CAAQP,UAAAA,CAAAA;AAC5B,UAAA,IAAIM,WAAWN,UAAAA,EAAY;AACvB,YAAA,MAAM,IAAIQ,KAAAA,CACN,CAAA,oEAAA,EAAuEP,SAAAA,CAAAA,WAAAA,EAAuBD,UAAAA,CAAAA,CAAY,CAAA;AAElH,UAAA;AACAA,UAAAA,UAAAA,GAAaM,MAAAA;AACjB,QAAA;AACJ,MAAA;IACJ,CAAA,GAAA;AACJ,EAAA;AAEA,EAAA,OAAOV,2BAAAA;AACX,CAAA,EAvB6C,+BAAA","file":"index.cjs","sourcesContent":["import * as fs from 'fs/promises';\nimport path from 'path';\n\nlet _fullyQualifiedRepoRootPath: Promise<string> | undefined = undefined;\nexport const getFullyQualifiedRepoRootPath = (): Promise<string> => {\n if (!_fullyQualifiedRepoRootPath) {\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 return _fullyQualifiedRepoRootPath;\n};\n\nexport * from './files';\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,6BAA6B,QAAO,OAAO,CAAC,MAAM,CAuB9D,CAAC;AAEF,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __name, __dirname } from './PXUGBXL3.js';
|
|
2
|
+
export { writeFileAndCreateDirsCached } from './PXUGBXL3.js';
|
|
3
|
+
import * as fs from 'fs/promises';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
var _fullyQualifiedRepoRootPath = void 0;
|
|
7
|
+
var getFullyQualifiedRepoRootPath = /* @__PURE__ */ __name(() => {
|
|
8
|
+
if (!_fullyQualifiedRepoRootPath) {
|
|
9
|
+
_fullyQualifiedRepoRootPath = (async () => {
|
|
10
|
+
let currentDir = __dirname;
|
|
11
|
+
while (true) {
|
|
12
|
+
const candidate = path.join(currentDir, "pnpm-workspace.yaml");
|
|
13
|
+
try {
|
|
14
|
+
await fs.access(candidate);
|
|
15
|
+
return currentDir;
|
|
16
|
+
} catch {
|
|
17
|
+
const parent = path.dirname(currentDir);
|
|
18
|
+
if (parent === currentDir) {
|
|
19
|
+
throw new Error(`Could not locate root (pnpm-workspace.yaml not found)--started from ${__dirname}, ended at ${currentDir}`);
|
|
20
|
+
}
|
|
21
|
+
currentDir = parent;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
}
|
|
26
|
+
return _fullyQualifiedRepoRootPath;
|
|
27
|
+
}, "getFullyQualifiedRepoRootPath");
|
|
28
|
+
|
|
29
|
+
export { getFullyQualifiedRepoRootPath };
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;AACxD,IAAMC,gDAAgC,MAAA,CAAA,MAAA;AACzC,EAAA,IAAI,CAACF,2BAAAA,EAA6B;AAC9BA,IAAAA,2BAAAA,GAAAA,CAA+B,YAAA;AAC3B,MAAA,IAAIG,UAAAA,GAAaC,SAAAA;AACjB,MAAA,OAAO,IAAA,EAAM;AACT,QAAA,MAAMC,SAAAA,GAAYC,IAAAA,CAAKC,IAAAA,CAAKJ,UAAAA,EAAY,qBAAA,CAAA;AACxC,QAAA,IAAI;AACA,UAAA,MAASK,UAAOH,SAAAA,CAAAA;AAChB,UAAA,OAAOF,UAAAA;QACX,CAAA,CAAA,MAAQ;AACJ,UAAA,MAAMM,MAAAA,GAASH,IAAAA,CAAKI,OAAAA,CAAQP,UAAAA,CAAAA;AAC5B,UAAA,IAAIM,WAAWN,UAAAA,EAAY;AACvB,YAAA,MAAM,IAAIQ,KAAAA,CACN,CAAA,oEAAA,EAAuEP,SAAAA,CAAAA,WAAAA,EAAuBD,UAAAA,CAAAA,CAAY,CAAA;AAElH,UAAA;AACAA,UAAAA,UAAAA,GAAaM,MAAAA;AACjB,QAAA;AACJ,MAAA;IACJ,CAAA,GAAA;AACJ,EAAA;AAEA,EAAA,OAAOT,2BAAAA;AACX,CAAA,EAvB6C,+BAAA","file":"index.js","sourcesContent":["import * as fs from 'fs/promises';\nimport path from 'path';\n\nlet _fullyQualifiedRepoRootPath: Promise<string> | undefined = undefined;\nexport const getFullyQualifiedRepoRootPath = (): Promise<string> => {\n if (!_fullyQualifiedRepoRootPath) {\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 return _fullyQualifiedRepoRootPath;\n};\n\nexport * from './files';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@layerzerolabs/common-node-utils",
|
|
3
|
+
"version": "0.0.31",
|
|
4
|
+
"private": false,
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"require": "./dist/index.cjs",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.cjs"
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/ms": "^2.1.0",
|
|
18
|
+
"bs58": "^5.0.0",
|
|
19
|
+
"tsup": "^8.4.0",
|
|
20
|
+
"vitest": "^3.2.3",
|
|
21
|
+
"@layerzerolabs/tsup-configuration": "0.0.31",
|
|
22
|
+
"@layerzerolabs/typescript-configuration": "0.0.31"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "restricted",
|
|
26
|
+
"registry": "https://registry.npmjs.org/"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsup",
|
|
30
|
+
"checkdeps": "pnpm --filter @layerzerolabs/depcheck run depcheck validate --catalog --missing-dependencies --only $npm_package_name",
|
|
31
|
+
"clean": "rm -rf ./node_modules .turbo ./dist",
|
|
32
|
+
"dev": "tsup --watch",
|
|
33
|
+
"lint": "eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)",
|
|
34
|
+
"test": "vitest --run --pass-with-no-tests"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/files.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const dirCache = new Map<string, Promise<string | undefined>>();
|
|
5
|
+
|
|
6
|
+
export const writeFileAndCreateDirsCached = async (path: string, data: string) => {
|
|
7
|
+
const dir = dirname(path);
|
|
8
|
+
// Deduplicate concurrent mkdir calls
|
|
9
|
+
if (!dirCache.has(dir)) {
|
|
10
|
+
dirCache.set(dir, mkdir(dir, { recursive: true }));
|
|
11
|
+
}
|
|
12
|
+
await dirCache.get(dir)?.then(() => writeFile(path, data, { encoding: 'utf-8' }));
|
|
13
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
let _fullyQualifiedRepoRootPath: Promise<string> | undefined = undefined;
|
|
5
|
+
export const getFullyQualifiedRepoRootPath = (): Promise<string> => {
|
|
6
|
+
if (!_fullyQualifiedRepoRootPath) {
|
|
7
|
+
_fullyQualifiedRepoRootPath = (async (): Promise<string> => {
|
|
8
|
+
let currentDir = __dirname;
|
|
9
|
+
while (true) {
|
|
10
|
+
const candidate = path.join(currentDir, 'pnpm-workspace.yaml');
|
|
11
|
+
try {
|
|
12
|
+
await fs.access(candidate);
|
|
13
|
+
return currentDir;
|
|
14
|
+
} catch {
|
|
15
|
+
const parent = path.dirname(currentDir);
|
|
16
|
+
if (parent === currentDir) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`Could not locate root (pnpm-workspace.yaml not found)--started from ${__dirname}, ended at ${currentDir}`,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
currentDir = parent;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return _fullyQualifiedRepoRootPath;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export * from './files';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@layerzerolabs/typescript-configuration/tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": "./src",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"strictPropertyInitialization": false,
|
|
7
|
+
"noUnusedLocals": false,
|
|
8
|
+
"noUnusedParameters": false,
|
|
9
|
+
"jsx": "react-jsx"
|
|
10
|
+
},
|
|
11
|
+
"exclude": [
|
|
12
|
+
"node_modules",
|
|
13
|
+
"**/__mocks__/*",
|
|
14
|
+
"**/__tests__/*",
|
|
15
|
+
"**/*.spec.ts",
|
|
16
|
+
"**/*.test.ts",
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"include": ["src/**/*"]
|
|
20
|
+
}
|