corebasic 1.0.236 → 1.0.238
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/libs/schemas.js +3 -2
- package/dist/libs/utils.js +3 -1
- package/libs/schemas.ts +4 -2
- package/libs/utils.ts +3 -1
- package/package.json +1 -1
package/dist/libs/schemas.js
CHANGED
|
@@ -8,11 +8,12 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
8
8
|
};
|
|
9
9
|
import { readdir } from "node:fs/promises";
|
|
10
10
|
import * as Utils from './utils.js';
|
|
11
|
+
const SCHEMAS_DIR = `${Utils.PROJECT_ROOT_PATH}/schemas`;
|
|
11
12
|
const g_this = globalThis;
|
|
12
13
|
g_this.Schemas ??= {};
|
|
13
|
-
for (const file of await readdir(
|
|
14
|
+
for (const file of await readdir(SCHEMAS_DIR)) {
|
|
14
15
|
if (file.endsWith(".ts") && file !== "index.ts") {
|
|
15
|
-
const schema = await import(__rewriteRelativeImportExtension(`${
|
|
16
|
+
const schema = await import(__rewriteRelativeImportExtension(`${SCHEMAS_DIR}/${file}`));
|
|
16
17
|
Object.assign(g_this.Schemas, schema.Schemas);
|
|
17
18
|
}
|
|
18
19
|
}
|
package/dist/libs/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Mobile from './mobilecodes.js';
|
|
2
2
|
import crypto from "node:crypto";
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
3
4
|
// Parse JSON file: fileToJson
|
|
4
5
|
import { readFile, writeFile } from 'fs/promises';
|
|
5
6
|
export let pipeline = { execute: execute };
|
|
@@ -10,7 +11,8 @@ export function log(...args) {
|
|
|
10
11
|
let PROJECT_ROOT_URL = new URL('../../..', import.meta.url);
|
|
11
12
|
if (String(PROJECT_ROOT_URL).endsWith('node_modules/'))
|
|
12
13
|
PROJECT_ROOT_URL = new URL('..', PROJECT_ROOT_URL);
|
|
13
|
-
|
|
14
|
+
const rootPath = fileURLToPath(PROJECT_ROOT_URL);
|
|
15
|
+
export const PROJECT_ROOT_PATH = rootPath.endsWith('/') ? rootPath.slice(0, -1) : rootPath;
|
|
14
16
|
let UID_COUNTER = crypto.randomBytes(3).readUIntBE(0, 3);
|
|
15
17
|
const UID_PROCESS = crypto.randomBytes(5);
|
|
16
18
|
export function uid() {
|
package/libs/schemas.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { readdir } from "node:fs/promises"
|
|
2
2
|
import * as Utils from './utils.ts'
|
|
3
3
|
|
|
4
|
+
const SCHEMAS_DIR = `${Utils.PROJECT_ROOT_PATH}/schemas`
|
|
5
|
+
|
|
4
6
|
const g_this: any = globalThis as any
|
|
5
7
|
g_this.Schemas ??= {};
|
|
6
8
|
|
|
7
|
-
for (const file of await readdir(
|
|
9
|
+
for (const file of await readdir(SCHEMAS_DIR)) {
|
|
8
10
|
if (file.endsWith(".ts") && file !== "index.ts") {
|
|
9
|
-
const schema = await import(`${
|
|
11
|
+
const schema = await import(`${SCHEMAS_DIR}/${file}`)
|
|
10
12
|
Object.assign(g_this.Schemas, schema.Schemas)
|
|
11
13
|
}
|
|
12
14
|
}
|
package/libs/utils.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Mobile from './mobilecodes.ts'
|
|
2
2
|
import crypto from "node:crypto";
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
3
4
|
|
|
4
5
|
// Parse JSON file: fileToJson
|
|
5
6
|
import {readFile,writeFile} from 'fs/promises';
|
|
@@ -14,7 +15,8 @@ export function log(...args: unknown[]): void {
|
|
|
14
15
|
let PROJECT_ROOT_URL = new URL('../../..', import.meta.url)
|
|
15
16
|
if (String(PROJECT_ROOT_URL).endsWith('node_modules/'))
|
|
16
17
|
PROJECT_ROOT_URL = new URL('..', PROJECT_ROOT_URL)
|
|
17
|
-
|
|
18
|
+
const rootPath: string = fileURLToPath(PROJECT_ROOT_URL);
|
|
19
|
+
export const PROJECT_ROOT_PATH: string = rootPath.endsWith('/') ? rootPath.slice(0, -1) : rootPath;
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
let UID_COUNTER = crypto.randomBytes(3).readUIntBE(0, 3);
|