Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 | /**
|
---|
| 3 | * @license
|
---|
| 4 | * Copyright Google LLC All Rights Reserved.
|
---|
| 5 | *
|
---|
| 6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 7 | * found in the LICENSE file at https://angular.io/license
|
---|
| 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] == '.' ? path_1.resolve(parentPath, path) : path;
|
---|
| 16 | this._module = require.resolve(this._module);
|
---|
| 17 | this._path = 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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.