UNPKG

@lyrasearch/plugin-match-highlight

Version:
1 lines 2.62 kB
{"version":3,"sources":["../src/commonjs.cts"],"sourcesContent":["// @ts-expect-error Ignore broken resolution - This errors when using tsconfig.cjs.json\nimport type { Lyra, PropertiesSchema } from '@lyrasearch/lyra'\n\nimport type {\n afterInsert as esmAfterInsert,\n LyraWithHighlight,\n searchWithHighlight as esmSearchWithHighlight\n // @ts-expect-error Ignore broken resolution - This errors when using tsconfig.cjs.json\n} from './index.js'\n\nexport interface LyraPluginMatchHighlight {\n afterInsert: typeof esmAfterInsert\n searchWithHighlight: typeof esmSearchWithHighlight\n}\n\nexport type RequireCallback = (err: Error | undefined, lyra?: LyraPluginMatchHighlight) => void\n\nlet _esmAfterInsert: typeof esmAfterInsert\nlet _esmSearchWithHighlight: typeof esmSearchWithHighlight\n\nexport async function afterInsert<S extends PropertiesSchema>(\n this: Lyra<S> | LyraWithHighlight<S>,\n ...args: Parameters<typeof esmAfterInsert>\n): ReturnType<typeof esmAfterInsert> {\n if (!_esmAfterInsert) {\n const imported = await import('./index.js')\n _esmAfterInsert = imported.afterInsert\n }\n\n return _esmAfterInsert.apply(this, args)\n}\n\nexport async function searchWithHighlight(\n ...args: Parameters<typeof esmSearchWithHighlight>\n): ReturnType<typeof esmSearchWithHighlight> {\n if (!_esmSearchWithHighlight) {\n const imported = await import('./index.js')\n _esmSearchWithHighlight = imported.searchWithHighlight\n }\n\n return _esmSearchWithHighlight(...args)\n}\n\nexport function requireLyraPluginMatchHighlight(callback: RequireCallback): void {\n import('./index.js')\n .then((loaded: LyraPluginMatchHighlight) => setTimeout(() => callback(undefined, loaded), 1))\n .catch((error: Error) => setTimeout(() => callback(error), 1))\n}\n"],"names":["afterInsert","searchWithHighlight","requireLyraPluginMatchHighlight","_esmAfterInsert","_esmSearchWithHighlight","args","imported","apply","callback","then","loaded","setTimeout","undefined","catch","error"],"mappings":"AAAA,uFAAuF;;;;;;;;;;;;IAoBjEA,WAAW,MAAXA;IAYAC,mBAAmB,MAAnBA;IAWNC,+BAA+B,MAA/BA;;AA1BhB,IAAIC;AACJ,IAAIC;AAEG,eAAeJ,YAEpB,GAAGK,IAAuC,EACP;IACnC,IAAI,CAACF,iBAAiB;QACpB,MAAMG,WAAW,MAAM,MAAM,CAAC;QAC9BH,kBAAkBG,SAASN,WAAW;IACxC,CAAC;IAED,OAAOG,gBAAgBI,KAAK,CAAC,IAAI,EAAEF;AACrC;AAEO,eAAeJ,oBACpB,GAAGI,IAA+C,EACP;IAC3C,IAAI,CAACD,yBAAyB;QAC5B,MAAME,WAAW,MAAM,MAAM,CAAC;QAC9BF,0BAA0BE,SAASL,mBAAmB;IACxD,CAAC;IAED,OAAOG,2BAA2BC;AACpC;AAEO,SAASH,gCAAgCM,QAAyB,EAAQ;IAC/E,MAAM,CAAC,cACJC,IAAI,CAAC,CAACC,SAAqCC,WAAW,IAAMH,SAASI,WAAWF,SAAS,IACzFG,KAAK,CAAC,CAACC,QAAiBH,WAAW,IAAMH,SAASM,QAAQ;AAC/D"}