svelte-preprocess
Version:
A Svelte preprocessor wrapper with baked-in support for commonly used preprocessors
28 lines (27 loc) • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.babel = void 0;
const utils_1 = require("../modules/utils");
const tagInfo_1 = require("../modules/tagInfo");
const prepareContent_1 = require("../modules/prepareContent");
const babel = (options) => ({
async script(svelteFile) {
const { transformer } = await import('../transformers/babel.js');
let { content, filename, dependencies, attributes } = await (0, tagInfo_1.getTagInfo)(svelteFile);
content = (0, prepareContent_1.prepareContent)({ options, content });
const transformed = await transformer({
content,
filename,
attributes,
options,
});
return {
...transformed,
dependencies: (0, utils_1.concat)(dependencies, transformed.dependencies),
};
},
});
exports.babel = babel;
// 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 = babel;