@leyyo/common 1.3.18 → 1.3.20

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.
Files changed (84) hide show
  1. package/dist/base/index.d.ts +3 -3
  2. package/dist/base/index.js +3 -3
  3. package/dist/base/index.types.d.ts +3 -3
  4. package/dist/base/leyyo.js +1 -1
  5. package/dist/class/index.d.ts +2 -2
  6. package/dist/class/index.js +2 -2
  7. package/dist/class/logger.instance.d.ts +6 -6
  8. package/dist/class/logger.instance.js +11 -12
  9. package/dist/common/deploy.common.js +4 -4
  10. package/dist/common/enum.pool.d.ts +5 -3
  11. package/dist/common/enum.pool.js +16 -3
  12. package/dist/common/error.common.js +33 -29
  13. package/dist/common/error.pool.d.ts +1 -1
  14. package/dist/common/error.pool.js +2 -3
  15. package/dist/common/event.common.js +12 -9
  16. package/dist/common/index.d.ts +11 -11
  17. package/dist/common/index.js +11 -11
  18. package/dist/common/index.types.d.ts +18 -9
  19. package/dist/common/inert.d.ts +1 -1
  20. package/dist/common/inert.js +35 -35
  21. package/dist/common/lifecycle.common.js +13 -13
  22. package/dist/common/literal.pool.d.ts +1 -1
  23. package/dist/common/literal.pool.js +3 -3
  24. package/dist/common/log.common.js +68 -63
  25. package/dist/common/repo.common.js +23 -28
  26. package/dist/const/index.d.ts +0 -1
  27. package/dist/const/index.js +28 -29
  28. package/dist/enum/index.d.ts +1 -1
  29. package/dist/enum/index.js +1 -1
  30. package/dist/enum/log-level.d.ts +1 -1
  31. package/dist/enum/log-level.js +1 -1
  32. package/dist/error/developer.error.d.ts +1 -2
  33. package/dist/error/developer.error.js +6 -15
  34. package/dist/error/http.error.js +1 -1
  35. package/dist/error/index.d.ts +7 -7
  36. package/dist/error/index.js +7 -7
  37. package/dist/error/index.types.d.ts +1 -1
  38. package/dist/error/invalid-value.error.js +1 -1
  39. package/dist/error/leyyo.error.js +25 -21
  40. package/dist/error/multiple.error.js +2 -2
  41. package/dist/function/delete-prop.js +6 -6
  42. package/dist/function/empty-fn.js +1 -2
  43. package/dist/function/extended-type.js +18 -17
  44. package/dist/function/get-fqn.js +3 -2
  45. package/dist/function/get-prop.js +5 -5
  46. package/dist/function/get-stat.js +7 -2
  47. package/dist/function/has-fqn.js +3 -2
  48. package/dist/function/index.d.ts +40 -40
  49. package/dist/function/index.js +40 -40
  50. package/dist/function/index.types.d.ts +1 -1
  51. package/dist/function/is-anonymous-name.js +1 -1
  52. package/dist/function/is-class.js +2 -2
  53. package/dist/function/is-empty.js +1 -1
  54. package/dist/function/is-obj.js +1 -1
  55. package/dist/function/is-test.js +3 -5
  56. package/dist/function/is-text.js +1 -1
  57. package/dist/function/jitter-interval.js +2 -2
  58. package/dist/function/load-config.js +9 -9
  59. package/dist/function/on-fqn-set.js +4 -3
  60. package/dist/function/opt-add.js +2 -2
  61. package/dist/function/opt-check.js +2 -2
  62. package/dist/function/opt-field.js +6 -6
  63. package/dist/function/remove-fqn.js +3 -2
  64. package/dist/function/run-exporter.js +3 -3
  65. package/dist/function/secure-clone.js +3 -3
  66. package/dist/function/secure-json.js +12 -10
  67. package/dist/function/set-anonymous-fqn.js +5 -4
  68. package/dist/function/set-anonymous-name.js +14 -14
  69. package/dist/function/set-fqn.js +9 -8
  70. package/dist/function/set-prop.js +6 -6
  71. package/dist/function/stamp-loader.js +1 -1
  72. package/dist/function/test-case.js +3 -3
  73. package/dist/function/test-name.js +2 -2
  74. package/dist/function/trigger-fqn.js +2 -2
  75. package/dist/index.d.ts +10 -10
  76. package/dist/index.foretell.js +7 -7
  77. package/dist/index.js +10 -10
  78. package/dist/index.loader.js +3 -3
  79. package/dist/init/index.js +5 -7
  80. package/dist/sys/index.d.ts +2 -2
  81. package/dist/sys/index.js +2 -2
  82. package/dist/sys/leyyo-storage.js +5 -5
  83. package/dist/sys/package-json.js +5 -5
  84. package/package.json +16 -31
package/dist/sys/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from './package-json.js';
2
- export * from './leyyo-storage.js';
1
+ export * from "./package-json.js";
2
+ export * from "./leyyo-storage.js";
@@ -1,4 +1,4 @@
1
- const _NAME = '$$leyyo.packages';
1
+ const _NAME = "$$leyyo.packages";
2
2
  /**
3
3
  * Create a standalone storage
4
4
  *
@@ -45,14 +45,14 @@ export const leyyoStorage = _build();
45
45
  * @param {any} def - initial value
46
46
  * */
47
47
  export function getRootStorage(name, def) {
48
- if (typeof name !== 'string') {
49
- throw new Error('Invalid storage name', name);
48
+ if (typeof name !== "string") {
49
+ throw new Error("Invalid storage name", name);
50
50
  }
51
51
  if (leyyoStorage.has(name)) {
52
52
  return leyyoStorage.get(name);
53
53
  }
54
- if (!def || typeof def !== 'object') {
55
- throw new Error('Invalid storage value', def);
54
+ if (!def || typeof def !== "object") {
55
+ throw new Error("Invalid storage value", def);
56
56
  }
57
57
  leyyoStorage.set(name, def);
58
58
  return def;
@@ -3,15 +3,15 @@ import path from "node:path";
3
3
  import { dirname } from "path";
4
4
  import { fileURLToPath } from "url";
5
5
  import { getRootStorage } from "./leyyo-storage.js";
6
- const _NAME = '$$leyyo.packages';
7
- const _empty = { fqn: 'leyyo.unknown', name: '@leyyo/unknown', version: '0.0.0' };
6
+ const _NAME = "$$leyyo.packages";
7
+ const _empty = { fqn: "leyyo.unknown", name: "@leyyo/unknown", version: "0.0.0" };
8
8
  const _map = getRootStorage(_NAME, new Map());
9
9
  export function packageJson(url, full) {
10
10
  try {
11
11
  const __dirname = dirname(dirname(fileURLToPath(url)));
12
- const jsonPath = path.normalize(__dirname + '/package.json');
12
+ const jsonPath = path.normalize(__dirname + "/package.json");
13
13
  if (fs.existsSync(jsonPath)) {
14
- const jsonData = JSON.parse(fs.readFileSync(jsonPath, { encoding: 'utf-8', flag: 'r' }));
14
+ const jsonData = JSON.parse(fs.readFileSync(jsonPath, { encoding: "utf-8", flag: "r" }));
15
15
  if (jsonData) {
16
16
  if (!jsonData?.name) {
17
17
  return _empty;
@@ -30,7 +30,7 @@ export function packageJson(url, full) {
30
30
  _map.set(name, []);
31
31
  }
32
32
  _map.get(name).push(version);
33
- const fqn = jsonData?.name.split('/').join('.').split('@').join('');
33
+ const fqn = jsonData?.name.split("/").join(".").split("@").join("");
34
34
  if (full) {
35
35
  return { ...jsonData, fqn };
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leyyo/common",
3
- "version": "1.3.18",
3
+ "version": "1.3.20",
4
4
  "description": "Leyyo common library",
5
5
  "keywords": [
6
6
  "common"
@@ -20,52 +20,37 @@
20
20
  "scripts": {
21
21
  "clear": "rimraf dist",
22
22
  "lint": "eslint src/**/*.ts",
23
+ "lint:fix": "eslint src/**/*.ts --fix",
24
+ "format": "prettier --check \"{src,test}/**/*.{ts,tsx,js}\"",
25
+ "format:force": "prettier --write \"{src,test}/**/*.{ts,tsx,js}\"",
26
+ "test": "vitest run",
27
+ "test:watch": "vitest",
28
+ "test:coverage": "vitest run --coverage",
23
29
  "asset": "node -r ts-node/register commands/assets.js",
24
30
  "build": "npm run clear && tsc && npm run asset",
25
- "test": "npx jest --config=jest.json --clearCache && npx jest --config=jest.json --verbose",
26
- "test:watch": "jest --watch --config=jest.json",
27
- "test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage",
28
- "~publish": "npm run build && npm publish -access=public"
31
+ "publish:public": "npm run lint && npm run format:force && npm run test && npm run build && npm publish --access=public"
29
32
  },
30
33
  "files": [
31
34
  "dist/*"
32
35
  ],
33
36
  "license": "ISC",
34
37
  "devDependencies": {
35
- "@babel/preset-env": "^7.29.0",
36
- "@babel/preset-typescript": "^7.27.0",
37
- "@eslint/js": "^9.33.0",
38
- "@jest/globals": "^29.7.0",
39
- "@types/jest": "^30.0.0",
38
+ "@eslint/js": "^9.0.0",
40
39
  "@types/js-yaml": "^4.0.9",
41
40
  "@types/node": "^24.2.1",
42
- "@types/node-localstorage": "^1.3.3",
43
- "@typescript-eslint/eslint-plugin": "^8.39.1",
44
- "@typescript-eslint/parser": "^8.39.1",
45
- "eslint": "^9.33.0",
41
+ "@vitest/coverage-istanbul": "^4.0.18",
42
+ "eslint": "^9.0.0",
46
43
  "eslint-config-prettier": "^10.1.8",
47
- "eslint-config-standard": "^17.1.0",
48
- "eslint-plugin-import": "^2.32.0",
49
- "eslint-plugin-jsdoc": "^54.0.0",
50
- "eslint-plugin-node": "^11.1.0",
51
- "husky": "^9.1.7",
52
- "jest": "^29.7.0",
53
- "prettier": "^3.6.2",
44
+ "eslint-plugin-n": "^17.24.0",
45
+ "prettier": "^3.8.1",
54
46
  "rimraf": "^6.0.1",
55
- "test": "^3.3.0",
56
- "ts-jest": "^29.4.1",
57
47
  "ts-node": "^10.9.2",
58
- "typescript": "^5.9.2",
59
- "typescript-eslint": "^8.39.1"
60
- },
61
- "overrides": {
62
- "eslint-config-standard": {
63
- "eslint": "^9.33.0"
64
- }
48
+ "typescript": "^5.9.3",
49
+ "typescript-eslint": "^8.0.0",
50
+ "vitest": "^4.0.18"
65
51
  },
66
52
  "dependencies": {
67
53
  "js-yaml": "^4.1.1",
68
- "node-localstorage": "^3.0.5",
69
54
  "stacktrace-parser": "^0.1.11"
70
55
  }
71
56
  }