UNPKG

weapp-tailwindcss

Version:

把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!

121 lines (120 loc) 3.5 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); require("./utils-CuKLf1Zv.cjs"); const require_cache_options = require("./cache-options-DavPxrhC.cjs"); let _weapp_core_escape = require("@weapp-core/escape"); let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared"); //#region src/defaults.ts const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/; const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/; const JS_FILE_PATTERN = /.+\.[cm]?js?$/; const alwaysFalse = () => false; const TAILWIND_V4_CSS_PREFLIGHT = { "border": "0 solid", "box-sizing": "border-box", "margin": "0", "padding": "0" }; function getDefaultCssPreflight() { return { ...TAILWIND_V4_CSS_PREFLIGHT }; } function resolveDefaultCssPreflight(cssPreflight, _tailwindcssMajorVersion) { if (cssPreflight === false) return false; return { ...getDefaultCssPreflight(), ...cssPreflight ?? {} }; } function getDefaultOptions() { return { /** * wxss 微信小程序 * acss 支付宝小程序 * jxss 京东小程序 * ttss 头条小程序 * qss QQ小程序 * css 最正常的样式文件 * tyss 涂鸦小程序 */ cssMatcher: (file) => CSS_FILE_PATTERN.test(file), /** * wxml 微信小程序 * axml 支付宝小程序 * jxml 京东小程序 * ksml 快手小程序 * ttml 头条小程序 * qml QQ小程序 * tyml 涂鸦小程序 * xhsml 小红书小程序 * swan 百度小程序 */ htmlMatcher: (file) => HTML_FILE_PATTERN.test(file), jsMatcher: (file) => { if (file.includes("node_modules")) return false; return JS_FILE_PATTERN.test(file); }, transform: { include: [], exclude: [] }, mainCssChunkMatcher: alwaysFalse, wxsMatcher: alwaysFalse, cssPreflight: getDefaultCssPreflight(), disabled: false, onLoad: _weapp_tailwindcss_shared.noop, onStart: _weapp_tailwindcss_shared.noop, onEnd: _weapp_tailwindcss_shared.noop, onUpdate: _weapp_tailwindcss_shared.noop, customAttributes: {}, customReplaceDictionary: _weapp_core_escape.MappingChars2String, appType: void 0, arbitraryValues: { allowDoubleQuotes: false, bareArbitraryValues: false }, unocss: false, cssChildCombinatorReplaceValue: ["view", "text"], inlineWxs: false, injectAdditionalCssVarScope: false, jsPreserveClass: (keyword) => { /** * 默认保留 keyword */ if (keyword === "*") return true; return false; }, disabledDefaultTemplateHandler: false, cssSelectorReplacement: { root: [ "page", ".tw-root", "wx-root-portal-content" ], universal: ["view", "text"] }, babelParserOptions: { sourceType: "unambiguous", cache: true, cacheKey: "st:unambiguous", cacheMaxEntries: 128, cacheMaxSourceLength: require_cache_options.DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH }, postcssOptions: {}, cssRemoveProperty: true, cssRemoveHoverPseudoClass: true, ignoreCallExpressionIdentifiers: [], ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"], replaceRuntimePackages: false, rewriteCssImports: false, generator: {}, cssSourceTrace: false, tailwindcssRuntimeOptions: { filter(className) { return !(0, _weapp_core_escape.isAllowedClassName)(className); } }, logLevel: "info" }; } //#endregion exports.TAILWIND_V4_CSS_PREFLIGHT = TAILWIND_V4_CSS_PREFLIGHT; exports.getDefaultCssPreflight = getDefaultCssPreflight; exports.getDefaultOptions = getDefaultOptions; exports.resolveDefaultCssPreflight = resolveDefaultCssPreflight;