File size: 934 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformer = void 0;
const path_1 = require("path");
const less_1 = __importDefault(require("less"));
const utils_1 = require("../modules/utils");
const transformer = async ({ content, filename, options = {}, }) => {
    options = {
        paths: (0, utils_1.getIncludePaths)(filename, options.paths),
        ...options,
    };
    const { css, map, imports } = await less_1.default.render(content, {
        sourceMap: {},
        filename,
        ...options,
    });
    const dependencies = imports.map((path) => (0, path_1.isAbsolute)(path) ? path : (0, path_1.join)(process.cwd(), path));
    return {
        code: css,
        map,
        dependencies,
    };
};
exports.transformer = transformer;