/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/build/src/utils/resolve-project.ts
23 строки
922 B
Charles Lyding
fix(@angular/build): scope createRequire module resolution using paths to prevent parent paths
30 июн 2026, 10:16
30 июн 2026, 10:16
0010b92
Код
Авторство
О чём код?
/** * @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 { createRequire } from 'node:module'; import { join } from 'node:path'; /** * Creates a module resolver function that is strictly scoped to the project root. * This prevents module resolution from leaking the parent module context when executing inside virtual stores (like pnpm). * * @param projectRoot The root directory of the project. * @returns A resolver function that takes a package name/path and returns its resolved path. */ export function createProjectResolver(projectRoot: string): (packageName: string) => string { const projectRequire = createRequire(join(projectRoot, 'package.json')); return (packageName: string) => projectRequire.resolve(packageName, { paths: [projectRoot] }); }