UNPKG

@matheo/ng-packagr

Version:

Compile and package Angular libraries in Angular Package Format (APF)

36 lines 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StylesheetProcessor = exports.CssUrl = void 0; const browserslist = require("browserslist"); const path_1 = require("path"); const rpc = require("sync-rpc"); const log = require("../utils/log"); var CssUrl; (function (CssUrl) { CssUrl["inline"] = "inline"; CssUrl["none"] = "none"; })(CssUrl = exports.CssUrl || (exports.CssUrl = {})); class StylesheetProcessor { constructor(basePath, cssUrl, styleIncludePaths) { this.basePath = basePath; this.cssUrl = cssUrl; this.styleIncludePaths = styleIncludePaths; this.styleSheetProcessorWorker = rpc(path_1.join(__dirname, './stylesheet-processor-worker.js'), StylesheetProcessor.name); log.debug(`determine browserslist for ${basePath}`); this.browserslistData = browserslist(undefined, { path: basePath }); } process(filePath) { const workerOptions = { filePath, basePath: this.basePath, cssUrl: this.cssUrl, styleIncludePaths: this.styleIncludePaths, browserslistData: this.browserslistData, }; const { css, warnings } = this.styleSheetProcessorWorker(workerOptions); warnings.forEach(msg => log.warn(msg)); return css; } } exports.StylesheetProcessor = StylesheetProcessor; //# sourceMappingURL=stylesheet-processor.js.map