You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/style-resources-loader/lib/utils/get-resources.js

21 lines
988 B

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getResources = void 0;
const tslib_1 = require("tslib");
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
const util_1 = (0, tslib_1.__importDefault)(require("util"));
const match_files_1 = require("./match-files");
const resolve_import_url_1 = require("./resolve-import-url");
const getResources = async (ctx, options) => {
const { resolveUrl } = options;
const files = await (0, match_files_1.matchFiles)(ctx, options);
files.forEach(file => ctx.dependency(file));
const resources = await Promise.all(files.map(async (file) => {
const content = await util_1.default.promisify(fs_1.default.readFile)(file, 'utf8');
const resource = { file, content };
return resolveUrl ? (0, resolve_import_url_1.resolveImportUrl)(ctx, resource) : resource;
}));
return resources;
};
exports.getResources = getResources;
//# sourceMappingURL=get-resources.js.map