@things-factory/env 9.0.0-beta.52 → 9.0.0-beta.58
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 +4 -4
- package/lib/utils.d.ts +0 -11
- package/lib/utils.js +0 -76
- package/lib/utils.js.map +0 -1
- /package/{lib → dist}/app-package.d.ts +0 -0
- /package/{lib → dist}/app-package.js +0 -0
- /package/{lib → dist}/app-package.js.map +0 -0
- /package/{lib → dist}/app-root-path.d.ts +0 -0
- /package/{lib → dist}/app-root-path.js +0 -0
- /package/{lib → dist}/app-root-path.js.map +0 -0
- /package/{lib → dist}/config.d.ts +0 -0
- /package/{lib → dist}/config.js +0 -0
- /package/{lib → dist}/config.js.map +0 -0
- /package/{lib → dist}/dependency-graph.d.ts +0 -0
- /package/{lib → dist}/dependency-graph.js +0 -0
- /package/{lib → dist}/dependency-graph.js.map +0 -0
- /package/{lib → dist}/dependency-order.d.ts +0 -0
- /package/{lib → dist}/dependency-order.js +0 -0
- /package/{lib → dist}/dependency-order.js.map +0 -0
- /package/{lib → dist}/get-dependencies.d.ts +0 -0
- /package/{lib → dist}/get-dependencies.js +0 -0
- /package/{lib → dist}/get-dependencies.js.map +0 -0
- /package/{lib → dist}/index.d.ts +0 -0
- /package/{lib → dist}/index.js +0 -0
- /package/{lib → dist}/index.js.map +0 -0
- /package/{lib → dist}/logger.d.ts +0 -0
- /package/{lib → dist}/logger.js +0 -0
- /package/{lib → dist}/logger.js.map +0 -0
- /package/{lib → dist}/module-loader.d.ts +0 -0
- /package/{lib → dist}/module-loader.js +0 -0
- /package/{lib → dist}/module-loader.js.map +0 -0
- /package/{lib → dist}/operato-modules.d.ts +0 -0
- /package/{lib → dist}/operato-modules.js +0 -0
- /package/{lib → dist}/operato-modules.js.map +0 -0
- /package/{lib → dist}/scene-modules.d.ts +0 -0
- /package/{lib → dist}/scene-modules.js +0 -0
- /package/{lib → dist}/scene-modules.js.map +0 -0
- /package/{lib → dist}/tsconfig.tsbuildinfo +0 -0
package/package.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/env",
|
3
|
-
"version": "9.0.0-beta.
|
3
|
+
"version": "9.0.0-beta.58",
|
4
4
|
"description": "Things Factory running environment helper library",
|
5
|
-
"main": "
|
5
|
+
"main": "dist/index.js",
|
6
6
|
"author": "heartyoh@hatiolab.com",
|
7
7
|
"license": "MIT",
|
8
8
|
"publishConfig": {
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"build": "tsc --p tsconfig.json",
|
19
19
|
"build:server": "npm run clean:server && tsc",
|
20
20
|
"clean": "npm run clean:server",
|
21
|
-
"clean:server": "rm -rf
|
21
|
+
"clean:server": "rm -rf dist",
|
22
22
|
"test": "NODE_ENV=test jest"
|
23
23
|
},
|
24
24
|
"dependencies": {
|
@@ -29,5 +29,5 @@
|
|
29
29
|
"winston": "^3.2.1",
|
30
30
|
"winston-daily-rotate-file": "^4.2.1"
|
31
31
|
},
|
32
|
-
"gitHead": "
|
32
|
+
"gitHead": "9029a5c2632858e5bf7b2d4d4a22211bb05b07a2"
|
33
33
|
}
|
package/lib/utils.d.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
export declare function fileExists(filePath: any): Promise<boolean>;
|
2
|
-
/**
|
3
|
-
* Resolves the root path of a module by locating its package.json.
|
4
|
-
* Supports both ESM and CommonJS modules.
|
5
|
-
* @param {string} moduleName - The name of the module to locate.
|
6
|
-
* @returns {Promise<string>} The resolved root path of the module.
|
7
|
-
*/
|
8
|
-
export declare function resolveModuleRootPath(moduleName: any): Promise<string>;
|
9
|
-
export declare function readJsonFile(filePath: any): Promise<any>;
|
10
|
-
export declare function resolveModulePackage(moduleName: any): Promise<any>;
|
11
|
-
export declare function resolveModulePackageByPath(modulePath: any): Promise<any>;
|
package/lib/utils.js
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
import path from 'path';
|
2
|
-
import fs from 'fs/promises';
|
3
|
-
import { fileURLToPath } from 'url';
|
4
|
-
import { createRequire } from 'module'; // Import createRequire for CommonJS resolution
|
5
|
-
const require = createRequire(import.meta.url); // Create a require function for CommonJS modules
|
6
|
-
// Helper function to safely check if a file exists
|
7
|
-
export async function fileExists(filePath) {
|
8
|
-
try {
|
9
|
-
const stats = await fs.stat(filePath);
|
10
|
-
return stats.isFile();
|
11
|
-
}
|
12
|
-
catch {
|
13
|
-
return false;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
/**
|
17
|
-
* Resolves the root path of a module by locating its package.json.
|
18
|
-
* Supports both ESM and CommonJS modules.
|
19
|
-
* @param {string} moduleName - The name of the module to locate.
|
20
|
-
* @returns {Promise<string>} The resolved root path of the module.
|
21
|
-
*/
|
22
|
-
export async function resolveModuleRootPath(moduleName) {
|
23
|
-
let moduleFilePath;
|
24
|
-
try {
|
25
|
-
// Try to resolve the module as an ESM module
|
26
|
-
moduleFilePath = fileURLToPath(await import.meta.resolve(moduleName));
|
27
|
-
}
|
28
|
-
catch (esmError) {
|
29
|
-
try {
|
30
|
-
// Fallback to resolve as a CommonJS module
|
31
|
-
moduleFilePath = require.resolve(moduleName);
|
32
|
-
if (moduleFilePath == moduleName) {
|
33
|
-
// console.warn(`CJS Warn: Unable to resolve path from moduleName : ${moduleName}`)
|
34
|
-
throw new Error(`Unable to resolve path from moduleName : ${moduleName}`);
|
35
|
-
}
|
36
|
-
}
|
37
|
-
catch (cjsError) {
|
38
|
-
// console.error(`Failed to resolve module ${moduleName} as ESM or CommonJS`)
|
39
|
-
// console.error(`ESM Error: ${esmError.message}`)
|
40
|
-
// console.error(`CJS Error: ${cjsError.message}`)
|
41
|
-
throw new Error(`Unable to resolve module: ${moduleName}`);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
// Start from the directory containing the module entry point
|
45
|
-
let currentDir = path.dirname(moduleFilePath);
|
46
|
-
while (currentDir !== path.parse(currentDir).root) {
|
47
|
-
const packageJsonPath = path.join(currentDir, 'package.json');
|
48
|
-
if (await fileExists(packageJsonPath)) {
|
49
|
-
return currentDir;
|
50
|
-
}
|
51
|
-
// Move up one directory
|
52
|
-
currentDir = path.dirname(currentDir);
|
53
|
-
}
|
54
|
-
throw new Error(`Unable to locate root for module: ${moduleName}`);
|
55
|
-
}
|
56
|
-
// Helper function to read JSON files
|
57
|
-
export async function readJsonFile(filePath) {
|
58
|
-
try {
|
59
|
-
const data = await fs.readFile(filePath, 'utf-8');
|
60
|
-
return JSON.parse(data);
|
61
|
-
}
|
62
|
-
catch (error) {
|
63
|
-
return null;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
// Helper function to resolve module package.json
|
67
|
-
export async function resolveModulePackage(moduleName) {
|
68
|
-
const modulePath = await resolveModuleRootPath(moduleName);
|
69
|
-
return modulePath && (await readJsonFile(path.join(modulePath, 'package.json')));
|
70
|
-
}
|
71
|
-
// Helper function to resolve module package.json
|
72
|
-
export async function resolveModulePackageByPath(modulePath) {
|
73
|
-
const appPackageJsonPath = path.resolve(modulePath, 'package.json');
|
74
|
-
return appPackageJsonPath && (await readJsonFile(appPackageJsonPath));
|
75
|
-
}
|
76
|
-
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,aAAa,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA,CAAC,+CAA+C;AACtF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAC,iDAAiD;AAEhG,mDAAmD;AACnD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAQ;IACvC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,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AAM,IAAI,KAAK,CAAC,qCAAqC,UAAU,EAAE,CAAC,CAAA;AACpE,CAAC;AAED,qCAAqC;AACrC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAQ;IACzC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACjD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,UAAU;IACnD,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAAC,UAAU,CAAC,CAAA;IAC1D,OAAO,UAAU,IAAI,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,CAAA;AAClF,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,UAAU;IACzD,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;IACnE,OAAO,kBAAkB,IAAI,CAAC,MAAM,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAA;AACvE,CAAC"}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/{lib → dist}/config.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/{lib → dist}/index.d.ts
RENAMED
File without changes
|
/package/{lib → dist}/index.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
/package/{lib → dist}/logger.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|