@layerzerolabs/common-node-utils 0.2.89 → 0.2.91

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/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@layerzerolabs/common-node-utils",
3
- "version": "0.2.89",
3
+ "version": "0.2.91",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  "types": "./dist/index.d.ts",
9
- "require": "./dist/index.cjs",
10
9
  "import": "./dist/index.js",
11
- "default": "./dist/index.cjs"
10
+ "default": "./dist/index.js"
12
11
  },
13
- "main": "./dist/index.cjs",
12
+ "main": "./dist/index.js",
14
13
  "module": "./dist/index.js",
15
14
  "types": "./dist/index.d.ts",
16
15
  "files": [
@@ -19,8 +18,9 @@
19
18
  "devDependencies": {
20
19
  "tsup": "^8.4.0",
21
20
  "vitest": "^3.2.3",
22
- "@layerzerolabs/tsup-configuration": "0.2.89",
23
- "@layerzerolabs/typescript-configuration": "0.2.89"
21
+ "@layerzerolabs/vitest-configuration": "0.2.91",
22
+ "@layerzerolabs/typescript-configuration": "0.2.91",
23
+ "@layerzerolabs/tsup-configuration": "0.2.91"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public",
@@ -29,14 +29,15 @@
29
29
  "externalRepoConfig": {
30
30
  "targets": [
31
31
  "audit-external",
32
+ "console-pen-test",
33
+ "layerzero-ver",
32
34
  "monorepo-external",
33
- "onesig-client",
34
- "layerzero-ver"
35
+ "onesig-client"
35
36
  ]
36
37
  },
37
38
  "scripts": {
38
39
  "build": "tsup",
39
40
  "lint": "eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)",
40
- "test": "vitest --run --pass-with-no-tests --typecheck"
41
+ "test": "vitest"
41
42
  }
42
43
  }
package/dist/II2MVA6U.cjs DELETED
@@ -1,53 +0,0 @@
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
- const ensureDir = /* @__PURE__ */ __name(() => {
12
- const cached = dirCache.get(dir);
13
- if (cached) return cached;
14
- const created = promises.mkdir(dir, {
15
- recursive: true
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
- });
37
- }
38
- }, "writeFileAndCreateDirsCached");
39
- async function pathExists(path) {
40
- try {
41
- await promises.stat(path);
42
- return true;
43
- } catch (err) {
44
- return err.code !== "ENOENT" ? true : false;
45
- }
46
- }
47
- __name(pathExists, "pathExists");
48
-
49
- exports.__name = __name;
50
- exports.pathExists = pathExists;
51
- exports.writeFileAndCreateDirsCached = writeFileAndCreateDirsCached;
52
- //# sourceMappingURL=II2MVA6U.cjs.map
53
- //# sourceMappingURL=II2MVA6U.cjs.map
@@ -1 +0,0 @@
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,M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BC,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"]}
package/dist/files.cjs DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- var II2MVA6U_cjs = require('./II2MVA6U.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "pathExists", {
8
- enumerable: true,
9
- get: function () { return II2MVA6U_cjs.pathExists; }
10
- });
11
- Object.defineProperty(exports, "writeFileAndCreateDirsCached", {
12
- enumerable: true,
13
- get: function () { return II2MVA6U_cjs.writeFileAndCreateDirsCached; }
14
- });
15
- //# sourceMappingURL=files.cjs.map
16
- //# sourceMappingURL=files.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"files.cjs"}
package/dist/index.cjs DELETED
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- var II2MVA6U_cjs = require('./II2MVA6U.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__ */ II2MVA6U_cjs.__name(() => {
32
- if (!_fullyQualifiedRepoRootPath) {
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;
49
- }
50
- }
51
- })();
52
- }
53
- }
54
- return _fullyQualifiedRepoRootPath;
55
- }, "getFullyQualifiedRepoRootPath");
56
-
57
- Object.defineProperty(exports, "pathExists", {
58
- enumerable: true,
59
- get: function () { return II2MVA6U_cjs.pathExists; }
60
- });
61
- Object.defineProperty(exports, "writeFileAndCreateDirsCached", {
62
- enumerable: true,
63
- get: function () { return II2MVA6U_cjs.writeFileAndCreateDirsCached; }
64
- });
65
- exports.getFullyQualifiedRepoRootPath = getFullyQualifiedRepoRootPath;
66
- //# sourceMappingURL=index.cjs.map
67
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
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"]}