@visulima/packem
Version:
A fast and modern bundler for Node.js and TypeScript.
4 lines (3 loc) • 959 B
JavaScript
import{transform as r,browserslistToTargets as a}from"lightningcss";import{n as e}from"../../../../packem_shared/ensure-auto-modules-BU3xWEjl.mjs";const d={name:"lightningCSS",async process({code:t,map:i}){let s=!1;typeof this.options.modules=="boolean"?s=this.options.modules:typeof this.options.modules=="object"&&(s=e(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(s=e(this.autoModules,this.id));const o=r({...this.options,code:Buffer.from(t),cssModules:this.options.modules??s,filename:this.id,inputSourceMap:i,minify:!1,sourceMap:!this.sourceMap,targets:a(this.browserTargets)});return o.warnings.length>0&&this.warn(`warnings when transforming css:
${o.warnings.map(n=>n.message).join(`
`)}`),{code:o.code.toString(),map:o.map?JSON.parse(Buffer.from(o.map).toString()):void 0,moduleSideEffects:s||typeof this.inject=="object"&&this.inject.treeshakeable?!1:"no-treeshake"}},test:/\.css$/i};export{d as default};