/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular_devkit/schematics/tools/export-ref.ts
38 строк
945 B
Charles Lyding
refactor(@angular-devkit/schematics): update type usage to support isolated declarations
13 дек 2025, 03:29
13 дек 2025, 03:29
fd8b4c8
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { dirname, resolve } from 'node:path'; export class ExportStringRef<T> { private _ref?: T; private _module: string; private _path: string; constructor(ref: string, parentPath: string = process.cwd(), inner = true) { const [path, name] = ref.split('#', 2); this._module = path[0] == '.' ? resolve(parentPath, path) : path; this._module = require.resolve(this._module); this._path = dirname(this._module); if (inner) { this._ref = require(this._module)[name || 'default']; } else { this._ref = require(this._module); } } get ref(): T | undefined { return this._ref; } get module(): string { return this._module; } get path(): string { return this._path; } }