weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
39 lines (37 loc) • 1.09 kB
JavaScript
import {
getCompilerContext
} from "./chunk-XRPBGBW5.mjs";
import "./chunk-Q67IXIAH.mjs";
import "./chunk-WKGE3KUO.mjs";
import "./chunk-JXBLHLFR.mjs";
import "./chunk-IM4NUFIU.mjs";
// src/core.ts
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
function createContext(options = {}) {
const opts = getCompilerContext(options);
const { templateHandler, styleHandler, jsHandler, twPatcher } = opts;
let runtimeSet = /* @__PURE__ */ new Set();
twPatcher.patch();
function transformWxss(rawCss, options2) {
return styleHandler(rawCss, defuOverrideArray(options2, {
isMainChunk: true
}));
}
async function transformJs(rawJs, options2 = {}) {
runtimeSet = options2 && options2.runtimeSet ? options2.runtimeSet : await twPatcher.getClassSet();
return await jsHandler(rawJs, runtimeSet, options2);
}
function transformWxml(rawWxml, options2) {
return templateHandler(rawWxml, defuOverrideArray(options2, {
runtimeSet
}));
}
return {
transformWxss,
transformWxml,
transformJs
};
}
export {
createContext
};