UNPKG

svelte-preprocess

Version:

A Svelte preprocessor wrapper with baked-in support for commonly used preprocessors

37 lines (36 loc) 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stylus = void 0; const tagInfo_1 = require("../modules/tagInfo"); const utils_1 = require("../modules/utils"); const prepareContent_1 = require("../modules/prepareContent"); const stylus = (options) => ({ async style(svelteFile) { const { transformer } = await import('../transformers/stylus.js'); let { content, filename, attributes, lang, dependencies } = await (0, tagInfo_1.getTagInfo)(svelteFile); if (lang !== 'stylus') { return { code: content }; } content = (0, prepareContent_1.prepareContent)({ options: { ...options, stripIndent: true, }, content, }); const transformed = await transformer({ content, filename, attributes, options, }); return { ...transformed, dependencies: (0, utils_1.concat)(dependencies, transformed.dependencies), }; }, }); exports.stylus = stylus; // both for backwards compat with old svelte-preprocess versions // (was only default export once, now is named export because of transpilation causing node not to detect the named exports of 'svelte-preprocess' otherwise) exports.default = stylus;