UNPKG

@liip/esbuild-plugin-ast-vue

Version:

Esbuild plugin to parse Vue AST

33 lines 1.02 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.setDescriptorCache = setDescriptorCache; exports.getDescriptorCache = getDescriptorCache; exports.setId = setId; exports.getId = getId; const hash_sum_1 = __importDefault(require("hash-sum")); const descriptorCache = {}; function setDescriptorCache(filename, descriptor) { descriptorCache[filename] = descriptor; } function getDescriptorCache(filename) { const cache = descriptorCache[filename]; if (!cache) { throw new Error('no descriptor cache'); } return cache; } const idCache = {}; function setId(filename) { return (idCache[filename] = `data-v-${(0, hash_sum_1.default)(filename)}`); } function getId(filename) { const id = idCache[filename]; if (!id) { throw new Error('no scope id'); } return id; } //# sourceMappingURL=cache.js.map