@leyyo/common 1.3.10 → 1.3.12
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/function/index.d.ts +1 -1
- package/dist/function/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -1
- package/dist/sys/index.d.ts +4 -0
- package/dist/sys/index.js +4 -0
- package/dist/sys/index.types.d.ts +13 -0
- package/dist/sys/index.types.js +1 -0
- package/dist/sys/leyyo-config.d.ts +2 -0
- package/dist/sys/leyyo-config.js +19 -0
- package/dist/sys/package-json.d.ts +3 -0
- package/dist/sys/package-json.js +39 -0
- package/dist/sys/sys-all.d.ts +2 -0
- package/dist/sys/sys-all.js +8 -0
- package/package.json +3 -1
package/dist/function/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './index.types.js';
|
|
2
|
+
export * from './define-loader.js';
|
|
2
3
|
export * from './delay.js';
|
|
3
4
|
export * from './delete-prop.js';
|
|
4
5
|
export * from './empty-fn.js';
|
|
@@ -18,7 +19,6 @@ export * from './is-obj.js';
|
|
|
18
19
|
export * from './is-text.js';
|
|
19
20
|
export * from './is-anonymous-name.js';
|
|
20
21
|
export * from './jitter-interval.js';
|
|
21
|
-
export * from './define-loader.js';
|
|
22
22
|
export * from './stamp-loader.js';
|
|
23
23
|
export * from './one-or-more.js';
|
|
24
24
|
export * from './opt-add.js';
|
package/dist/function/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './index.types.js';
|
|
2
|
+
export * from './define-loader.js';
|
|
2
3
|
export * from './delay.js';
|
|
3
4
|
export * from './delete-prop.js';
|
|
4
5
|
export * from './empty-fn.js';
|
|
@@ -18,7 +19,6 @@ export * from './is-obj.js';
|
|
|
18
19
|
export * from './is-text.js';
|
|
19
20
|
export * from './is-anonymous-name.js';
|
|
20
21
|
export * from './jitter-interval.js';
|
|
21
|
-
export * from './define-loader.js';
|
|
22
22
|
export * from './stamp-loader.js';
|
|
23
23
|
export * from './one-or-more.js';
|
|
24
24
|
export * from './opt-add.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const defLogger: import("./common/index.types.js").Logger;
|
|
2
1
|
export declare const deployCommon: import("./common/index.types.js").DeployCommonLike;
|
|
3
2
|
export declare const enumPool: import("./common/index.types.js").EnumPoolLike;
|
|
4
3
|
export declare const errorCommon: import("./common/index.types.js").ErrorCommonLike;
|
|
@@ -15,5 +14,6 @@ export * from './const/index.js';
|
|
|
15
14
|
export * from './enum/index.js';
|
|
16
15
|
export * from './error/index.js';
|
|
17
16
|
export * from './function/index.js';
|
|
17
|
+
export * from './sys/index.js';
|
|
18
18
|
export * from './index.loader.js';
|
|
19
19
|
export * from './index.foretell.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// noinspection JSUnusedGlobalSymbols
|
|
2
2
|
import { init } from "./init/index.js";
|
|
3
3
|
import { leyyo } from "./base/index.js";
|
|
4
|
+
import { setFqn } from "./function/index.js";
|
|
5
|
+
import { FQN } from "./internal.js";
|
|
6
|
+
import { List } from "./class/index.js";
|
|
7
|
+
import { LoggerInstance } from "./class/logger.instance.js";
|
|
4
8
|
init();
|
|
5
|
-
export const defLogger = leyyo.logger;
|
|
6
9
|
export const deployCommon = leyyo.deployCommon;
|
|
7
10
|
export const enumPool = leyyo.enumPool;
|
|
8
11
|
export const errorCommon = leyyo.errorCommon;
|
|
@@ -12,6 +15,17 @@ export const literalPool = leyyo.literalPool;
|
|
|
12
15
|
export const lifecycleCommon = leyyo.lifecycleCommon;
|
|
13
16
|
export const logCommon = leyyo.logCommon;
|
|
14
17
|
export const repoCommon = leyyo.repoCommon;
|
|
18
|
+
setFqn(deployCommon.constructor, FQN);
|
|
19
|
+
setFqn(enumPool.constructor, FQN);
|
|
20
|
+
setFqn(errorCommon.constructor, FQN);
|
|
21
|
+
setFqn(errorPool.constructor, FQN);
|
|
22
|
+
setFqn(eventCommon.constructor, FQN);
|
|
23
|
+
setFqn(literalPool.constructor, FQN);
|
|
24
|
+
setFqn(lifecycleCommon.constructor, FQN);
|
|
25
|
+
setFqn(logCommon.constructor, FQN);
|
|
26
|
+
setFqn(repoCommon.constructor, FQN);
|
|
27
|
+
setFqn(LoggerInstance, FQN);
|
|
28
|
+
setFqn(List, FQN);
|
|
15
29
|
export * from './base/index.js';
|
|
16
30
|
export * from './class/index.js';
|
|
17
31
|
export * from './common/index.js';
|
|
@@ -19,5 +33,6 @@ export * from './const/index.js';
|
|
|
19
33
|
export * from './enum/index.js';
|
|
20
34
|
export * from './error/index.js';
|
|
21
35
|
export * from './function/index.js';
|
|
36
|
+
export * from './sys/index.js';
|
|
22
37
|
export * from './index.loader.js';
|
|
23
38
|
export * from './index.foretell.js';
|
package/dist/internal.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const FQN
|
|
1
|
+
export declare const NME: string, FQN: string, VER: string, CNF: import("./sys/index.types.js").LeyyoConfig;
|
package/dist/internal.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { sysAll } from "./sys/index.js";
|
|
2
|
+
export const { pck: { name: NME, fqn: FQN, version: VER }, config: CNF } = sysAll(import.meta.url);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface PackageJson {
|
|
2
|
+
fqn: string;
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
[k: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface LeyyoConfig {
|
|
8
|
+
[fqn: string]: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface LeyyoSysAll<C extends LeyyoConfig = LeyyoConfig, P extends PackageJson = PackageJson> {
|
|
11
|
+
config: C;
|
|
12
|
+
pck: P;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { dirname } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import * as yaml from 'js-yaml';
|
|
6
|
+
export function leyyoConfig(url) {
|
|
7
|
+
try {
|
|
8
|
+
const __dirname = dirname(dirname(fileURLToPath(url)));
|
|
9
|
+
const yamlPath = path.normalize(__dirname + '/.leyyo.yaml');
|
|
10
|
+
if (fs.existsSync(yamlPath)) {
|
|
11
|
+
const input = fs.readFileSync(yamlPath, 'utf8');
|
|
12
|
+
return yaml.load(input);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
console.log(`[leyyoConfig] ${e.name} => ${e.message}`);
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { dirname } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
const _empty = { fqn: 'leyyo.unknown', name: '@leyyo/unknown', version: '0.0.0' };
|
|
6
|
+
const _map = new Map();
|
|
7
|
+
export function packageJson(url, full) {
|
|
8
|
+
try {
|
|
9
|
+
const __dirname = dirname(dirname(fileURLToPath(url)));
|
|
10
|
+
const jsonPath = path.normalize(__dirname + '/package.json');
|
|
11
|
+
if (fs.existsSync(jsonPath)) {
|
|
12
|
+
const jsonData = JSON.parse(fs.readFileSync(jsonPath, { encoding: 'utf-8', flag: 'r' }));
|
|
13
|
+
if (jsonData) {
|
|
14
|
+
if (!jsonData?.name) {
|
|
15
|
+
return _empty;
|
|
16
|
+
}
|
|
17
|
+
const name = jsonData.name;
|
|
18
|
+
const version = jsonData.version;
|
|
19
|
+
if (_map.has(name)) {
|
|
20
|
+
console.error(`Same package[${name}] duplicated, versions: ['${_map.get(name)}', '${version}']`);
|
|
21
|
+
}
|
|
22
|
+
_map.set(name, version);
|
|
23
|
+
const fqn = jsonData?.name.split('/').join('.').split('@').join('');
|
|
24
|
+
if (full) {
|
|
25
|
+
return { ...jsonData, fqn };
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
fqn,
|
|
29
|
+
name: jsonData?.name,
|
|
30
|
+
version: jsonData?.version,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
console.log(`[packageJson] ${e.name} => ${e.message}`);
|
|
37
|
+
return _empty;
|
|
38
|
+
}
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leyyo/common",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.12",
|
|
4
4
|
"description": "Leyyo common library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"common"
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@eslint/js": "^9.33.0",
|
|
38
38
|
"@jest/globals": "^29.7.0",
|
|
39
39
|
"@types/jest": "^30.0.0",
|
|
40
|
+
"@types/js-yaml": "^4.0.9",
|
|
40
41
|
"@types/node": "^24.2.1",
|
|
41
42
|
"@typescript-eslint/eslint-plugin": "^8.39.1",
|
|
42
43
|
"@typescript-eslint/parser": "^8.39.1",
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
66
|
+
"js-yaml": "^4.1.1",
|
|
65
67
|
"stacktrace-parser": "^0.1.11"
|
|
66
68
|
}
|
|
67
69
|
}
|