-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresolve-assets.js
34 lines (34 loc) · 1.37 KB
/
resolve-assets.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"use strict";
/**
* @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
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveAssets = resolveAssets;
const node_path_1 = __importDefault(require("node:path"));
const tinyglobby_1 = require("tinyglobby");
async function resolveAssets(entries, root) {
const defaultIgnore = ['.gitkeep', '**/.DS_Store', '**/Thumbs.db'];
const outputFiles = [];
for (const entry of entries) {
const cwd = node_path_1.default.resolve(root, entry.input);
const files = await (0, tinyglobby_1.glob)(entry.glob, {
cwd,
dot: true,
ignore: entry.ignore ? defaultIgnore.concat(entry.ignore) : defaultIgnore,
followSymbolicLinks: entry.followSymlinks,
});
for (const file of files) {
const src = node_path_1.default.join(cwd, file);
const filePath = entry.flatten ? node_path_1.default.basename(file) : file;
outputFiles.push({ source: src, destination: node_path_1.default.join(entry.output, filePath) });
}
}
return outputFiles;
}