UNPKG

1.39 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.assetGlobsToFiles = void 0;
4const glob = require("glob");
5const path_1 = require("path");
6function assetGlobsToFiles(assets, rootDir, outDir) {
7 const files = [];
8 const globbedFiles = (pattern, input = '', ignore = [], dot = false) => {
9 return glob.sync(pattern, {
10 cwd: input,
11 nodir: true,
12 dot,
13 ignore,
14 });
15 };
16 assets.forEach((asset) => {
17 var _a;
18 if (typeof asset === 'string') {
19 globbedFiles(asset, rootDir).forEach((globbedFile) => {
20 files.push({
21 input: (0, path_1.join)(rootDir, globbedFile),
22 output: (0, path_1.join)(outDir, (0, path_1.basename)(globbedFile)),
23 });
24 });
25 }
26 else {
27 globbedFiles(asset.glob, (0, path_1.join)(rootDir, asset.input), asset.ignore, (_a = asset.dot) !== null && _a !== void 0 ? _a : false).forEach((globbedFile) => {
28 files.push({
29 input: (0, path_1.join)(rootDir, asset.input, globbedFile),
30 output: (0, path_1.join)(outDir, asset.output, globbedFile),
31 });
32 });
33 }
34 });
35 return files;
36}
37exports.assetGlobsToFiles = assetGlobsToFiles;
38//# sourceMappingURL=assets.js.map
\No newline at end of file