weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
33 lines (29 loc) • 1.19 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/bundlers/shared/cache.ts
async function processCachedTask({
cache,
cacheKey,
hashKey = cacheKey,
rawSource,
readCache,
applyResult,
transform,
onCacheHit
}) {
let cacheHit = false;
const result = await cache.process({
key: cacheKey,
hashKey,
rawSource,
resolveCache: readCache,
async onCacheHit(value) {
cacheHit = true;
await applyResult(value);
_optionalChain([onCacheHit, 'optionalCall', _ => _()]);
},
transform
});
if (!cacheHit) {
await applyResult(result);
}
}
exports.processCachedTask = processCachedTask;