lix-website/themes/lix/assets/bootstrap/node_modules/rollup-plugin-istanbul/dist/rollup-plugin-istanbul.cjs
2024-04-26 22:49:34 -06:00

38 lines
1 KiB
JavaScript

'use strict';
var pluginutils = require('@rollup/pluginutils');
var istanbul = require('istanbul-lib-instrument');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var istanbul__default = /*#__PURE__*/_interopDefaultLegacy(istanbul);
function index (options = {}) {
const filter = pluginutils.createFilter(options.include, options.exclude);
return {
name: 'istanbul',
transform (code, id) {
if (!filter(id)) return;
let instrumenter;
const instrumenterConfig = Object.assign({
esModules: true,
compact: true,
produceSourceMap: true,
autoWrap: true,
preserveComments: true
}, options.instrumenterConfig);
instrumenter = new (options.instrumenter || istanbul__default['default']).createInstrumenter(instrumenterConfig);
code = instrumenter.instrumentSync(code, id);
const map = instrumenter.lastSourceMap();
return { code, map };
}
};
}
module.exports = index;