weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
30 lines (29 loc) • 862 B
JavaScript
import { MappingChars2String, escape, isAllowedClassName, unescape } from "@weapp-core/escape";
//#region src/utils/object.ts
function definedEntries(value) {
return Object.entries(value).filter(([, item]) => item !== void 0);
}
function omitUndefined(value) {
return Object.fromEntries(definedEntries(value));
}
//#endregion
//#region src/wxml/shared.ts
const NEWLINE_RE = /[\n\r]+/g;
function replaceWxml(original, options = {
keepEOL: false,
escapeMap: MappingChars2String
}) {
const { keepEOL, escapeMap, ignoreHead } = options;
let res = original;
if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
res = escape(res, omitUndefined({
map: escapeMap,
ignoreHead
}));
return res;
}
//#endregion
//#region src/escape.ts
const weappTwIgnore = String.raw;
//#endregion
export { replaceWxml as escape, isAllowedClassName, unescape, weappTwIgnore };