From d58646d5aa3f3a45b79d7850e8dd82d3c23c64d0 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Mon, 3 Dec 2018 11:31:50 +0000 Subject: [PATCH] chore(release): Add 0.3.0-beta.0 release files [ci skip] --- out/index.js | 67 +++++++++++++++++++++++++++++++++++++++++++++++ out/index.js.map | 1 + out/module.js | 60 ++++++++++++++++++++++++++++++++++++++++++ out/module.js.map | 1 + 4 files changed, 129 insertions(+) create mode 100644 out/index.js create mode 100644 out/index.js.map create mode 100644 out/module.js create mode 100644 out/module.js.map diff --git a/out/index.js b/out/index.js new file mode 100644 index 0000000..2d6616f --- /dev/null +++ b/out/index.js @@ -0,0 +1,67 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var lessCompiler = _interopDefault(require('less')); + +/* eslint-disable import/prefer-default-export */ + +function style({ name, all = false, type = true, lang = true } = {}, { attributes } = {}) { + if (all) { + return true; + } + + if (!name) { + throw new Error('Missing \'name\' filter option'); + } + if (!attributes) { + throw new Error('No attributes passed to filter'); + } + + const typeAttributes = [type && attributes.type, lang && attributes.lang]; + + return typeAttributes.includes(name) || typeAttributes.includes(`text/${name}`); +} + +async function preprocessLess(lessOptions = {}, filterOptions = {}, { filename, content, attributes }) { + if (!style(Object.assign({ name: 'less' }, filterOptions), { attributes })) { + return null; + } + + try { + const { css, map } = await lessCompiler.render(content, Object.assign({ + filename, + sourceMap: {} + }, lessOptions)); + + return { code: css, map }; + } catch (err) { + const { line, column, index: character, extract } = err; + if (!(line && column && extract)) throw err; + + const frame = extract.map((l, i) => `${line - 1 + i}:${l}`); + frame.splice(2, 0, '^'.padStart(column + line.toString().length + 2)); + + delete err.line; + delete err.column; + delete err.index; + delete err.extract; + err.frame = frame.join('\n'); + + // The line number only counts from the beginning of the