@cabloy/module-info 1.0.9 → 1.0.10
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/index.d.ts +0 -3
- package/dist/index.js +1 -21
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { IModuleInfo, TypeProjectEntityType, TypeProjectMode } from './interface.js';
|
|
2
2
|
export * from './interface.js';
|
|
3
|
-
export declare const ParseModuleNameLevelInit = 1;
|
|
4
|
-
export declare function parseModuleName(level?: number): string | undefined;
|
|
5
|
-
export declare function parseModuleInfo(level?: number): IModuleInfo | undefined;
|
|
6
3
|
export declare function parseInfoFromPath(pathName?: string | null): IModuleInfo | undefined;
|
|
7
4
|
export declare function parseInfo(moduleName: string | undefined): IModuleInfo | undefined;
|
|
8
5
|
export declare function parseInfoPro(moduleName: string | undefined, projectMode: TypeProjectMode, projectEntityType: TypeProjectEntityType): IModuleInfo | undefined;
|
package/dist/index.js
CHANGED
|
@@ -13,29 +13,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.parseName = exports.parseInfoPro = exports.parseInfo = exports.parseInfoFromPath =
|
|
21
|
-
const stack_utils_1 = __importDefault(require("stack-utils"));
|
|
17
|
+
exports.parseName = exports.parseInfoPro = exports.parseInfo = exports.parseInfoFromPath = void 0;
|
|
22
18
|
__exportStar(require("./interface.js"), exports);
|
|
23
|
-
exports.ParseModuleNameLevelInit = 1;
|
|
24
|
-
function parseModuleName(level = exports.ParseModuleNameLevelInit) {
|
|
25
|
-
const info = parseModuleInfo(level + 1);
|
|
26
|
-
if (!info)
|
|
27
|
-
return;
|
|
28
|
-
return info.relativeName;
|
|
29
|
-
}
|
|
30
|
-
exports.parseModuleName = parseModuleName;
|
|
31
|
-
function parseModuleInfo(level = exports.ParseModuleNameLevelInit) {
|
|
32
|
-
const stackUtils = new stack_utils_1.default();
|
|
33
|
-
const traces = stackUtils.capture(level);
|
|
34
|
-
const trace = traces[level - 1];
|
|
35
|
-
const fileName = trace.getFileName();
|
|
36
|
-
return parseInfoFromPath(fileName);
|
|
37
|
-
}
|
|
38
|
-
exports.parseModuleInfo = parseModuleInfo;
|
|
39
19
|
function parseInfoFromPath(pathName) {
|
|
40
20
|
if (!pathName)
|
|
41
21
|
return;
|