@intlayer/core
Version:
Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.
1 lines • 1.5 kB
Source Map (JSON)
{"version":3,"file":"getMaskContent.cjs","names":["passTypedNodePlugin: Plugins","deepTransformNode","buildMaskPlugin: Plugins"],"sources":["../../../src/deepTransformPlugins/getMaskContent.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types';\nimport { deepTransformNode, type Plugins } from '../interpreter';\n\nconst passTypedNodePlugin: Plugins = {\n id: 'pass-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof node?.nodeType === 'string',\n transform: (node, props, deepTransformNode) =>\n deepTransformNode(node[node.nodeType], props),\n};\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const buildMaskPlugin: Plugins = {\n id: 'build-mask-plugin',\n canHandle: (node) => typeof node === 'string' || typeof node === 'number',\n transform: () => true,\n};\n\nexport const getMaskContent = (source: Dictionary): any => ({\n ...source,\n content: deepTransformNode(source.content, {\n dictionaryKey: source.key,\n keyPath: [],\n plugins: [passTypedNodePlugin, buildMaskPlugin],\n }),\n});\n"],"mappings":";;;AAGA,MAAMA,sBAA+B;CACnC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAO,MAAM,aAAa;CACxD,YAAY,MAAM,OAAO,wBACvBC,oBAAkB,KAAK,KAAK,WAAW,MAAM;CAChD;;AAGD,MAAaC,kBAA2B;CACtC,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS;CACjE,iBAAiB;CAClB;AAED,MAAa,kBAAkB,YAA6B;CAC1D,GAAG;CACH,SAASD,+DAAkB,OAAO,SAAS;EACzC,eAAe,OAAO;EACtB,SAAS,EAAE;EACX,SAAS,CAAC,qBAAqB,gBAAgB;EAChD,CAAC;CACH"}