1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.ExportStringRef = void 0;
|
11 | const path_1 = require("path");
|
12 | class ExportStringRef {
|
13 | constructor(ref, parentPath = process.cwd(), inner = true) {
|
14 | const [path, name] = ref.split('#', 2);
|
15 | this._module = path[0] == '.' ? (0, path_1.resolve)(parentPath, path) : path;
|
16 | this._module = require.resolve(this._module);
|
17 | this._path = (0, path_1.dirname)(this._module);
|
18 | if (inner) {
|
19 | this._ref = require(this._module)[name || 'default'];
|
20 | }
|
21 | else {
|
22 | this._ref = require(this._module);
|
23 | }
|
24 | }
|
25 | get ref() {
|
26 | return this._ref;
|
27 | }
|
28 | get module() {
|
29 | return this._module;
|
30 | }
|
31 | get path() {
|
32 | return this._path;
|
33 | }
|
34 | }
|
35 | exports.ExportStringRef = ExportStringRef;
|