{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { OutputBundle, Plugin } from 'rollup';\n\n/**\n * Rollup no emit plugin options.\n */\nexport interface RollupNoEmitOptions {\n /**\n * Set to `true` to invalidate plugin and emit files.\n * @default false\n */\n emit?: boolean;\n /**\n * Return `true` to skip emit for output file.\n * @param fileName The output bundle file name to match.\n * @param output The Rollup output chunk or asset.\n * @returns Determines if the output file will be skipped or not.\n */\n match?(fileName: string, output: OutputBundle[keyof OutputBundle]): boolean;\n}\n\n/**\n * Skip emit for generated bundles.\n * @param options The plugin options.\n * @returns The plugin.\n */\nexport function noEmit(options: RollupNoEmitOptions = {}): Plugin {\n const { emit, match } = options;\n const skipMatch = typeof match !== 'function';\n return {\n name: 'no-emit',\n generateBundle(_, bundle) {\n if (emit) {\n return;\n }\n for (const file in bundle) {\n if (skipMatch || match(file, bundle[file])) {\n delete bundle[file];\n }\n }\n }\n };\n}\n\nexport default noEmit;\n"],"names":[],"mappings":"AAyBgB,SAAA,MAAA,CAAO,OAA+B,GAAA,EAAY,EAAA;AAChE,EAAM,MAAA,EAAE,IAAM,EAAA,KAAA,EAAU,GAAA,OAAA,CAAA;AACxB,EAAM,MAAA,SAAA,GAAY,OAAO,KAAU,KAAA,UAAA,CAAA;AACnC,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,SAAA;AAAA,IACN,cAAA,CAAe,GAAG,MAAQ,EAAA;AACxB,MAAA,IAAI,IAAM,EAAA;AACR,QAAA,OAAA;AAAA,OACF;AACA,MAAA,KAAA,MAAW,QAAQ,MAAQ,EAAA;AACzB,QAAA,IAAI,aAAa,KAAM,CAAA,IAAA,EAAM,MAAO,CAAA,IAAI,CAAC,CAAG,EAAA;AAC1C,UAAA,OAAO,OAAO,IAAI,CAAA,CAAA;AAAA,SACpB;AAAA,OACF;AAAA,KACF;AAAA,GACF,CAAA;AACF;;;;"}