/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/build/src/utils/resolve-assets.ts
51 строка
1 KB
Alan Agius
fix(@angular/build): assert that asset input paths are within workspace root
21 май 2026, 16:57
21 май 2026, 16:57
163a032
Код
Авторство
О чём код?
/** * @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 path from 'node:path'; import { glob } from 'tinyglobby'; import { isSubDirectory } from './path'; export async function resolveAssets( entries: { glob: string; ignore?: string[]; input: string; output: string; flatten?: boolean; followSymlinks?: boolean; }[], root: string, ): Promise<{ source: string; destination: string }[]> { const defaultIgnore = ['.gitkeep', '**/.DS_Store', '**/Thumbs.db']; const outputFiles: { source: string; destination: string }[] = []; for (const entry of entries) { if (!isSubDirectory(root, entry.input)) { throw new Error(`The ${entry.input} asset path must be within the workspace root.`); } const cwd = path.resolve(root, entry.input); const files = await glob(entry.glob, { cwd, dot: true, ignore: entry.ignore ? defaultIgnore.concat(entry.ignore) : defaultIgnore, followSymbolicLinks: entry.followSymlinks, }); for (const file of files) { const src = path.join(cwd, file); const filePath = entry.flatten ? path.basename(file) : file; outputFiles.push({ source: src, destination: path.join(entry.output, filePath) }); } } return outputFiles; }