UNPKG

@intlayer/chokidar

Version:

Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.

24 lines 741 B
import { deepTransformNode } from "@intlayer/core"; const passTypedNodePlugin = { id: "pass-typed-node-plugin", canHandle: (node) => typeof node === "object" && typeof node?.nodeType === "string", transform: (node, props, deepTransformNode2) => deepTransformNode2(node[node.nodeType], props) }; const buildMaskPlugin = { id: "build-mask-plugin", canHandle: (node) => typeof node === "string" || typeof node === "number", transform: () => true }; const buildMask = (source) => ({ ...source, content: deepTransformNode(source.content, { dictionaryKey: source.key, keyPath: [], plugins: [passTypedNodePlugin, buildMaskPlugin] }) }); export { buildMask, buildMaskPlugin }; //# sourceMappingURL=buildMask.mjs.map