UNPKG

esbuild-plugin-vue-iii

Version:
37 lines 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.transformStyle = void 0; const compiler_sfc_1 = require("@vue/compiler-sfc"); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types async function transformStyle(code, descriptor, index, options, pluginContext) { const block = descriptor.styles[index]; // vite already handles pre-processors and CSS module so this is only // applying SFC-specific transforms like scoped mode and CSS vars rewrite (v-bind(var)) const result = await compiler_sfc_1.compileStyleAsync({ ...options.style, filename: descriptor.filename, id: `data-v-${descriptor.id}`, isProd: options.isProduction, source: code, scoped: block.scoped }); if (result.errors.length) { result.errors.forEach((error) => { if (error.line && error.column) { error.loc = { file: descriptor.filename, line: error.line + block.loc.start.line, column: error.column }; } pluginContext.error(error); }); return null; } return { code: result.code, map: result.map || { mappings: '' } }; } exports.transformStyle = transformStyle; //# sourceMappingURL=style.js.map