JSPM

leapond-rollup-plugin-replace

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q36777F
  • License MIT

Rollup replace plugin with mixed finder support(String, RegExp).

Package Exports

  • leapond-rollup-plugin-replace

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (leapond-rollup-plugin-replace) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

leapond-rollup-plugin-replace

Rollup replace plugin with mixed finder support(String, RegExp).

Installation

NPM

# for node(bundled)
npm i leapond-rollup-plugin-replace -D
# for web(esm)
npm i leapond-rollup-plugin-replace

Yarn

# for node(bundled)
yarn add leapond-rollup-plugin-replace -D
# for web
yarn add leapond-rollup-plugin-replace

Usage

import leapondReplace from "leapond-rollup-plugin-replace";

{
  //...
  plugins: [leapondReplace(options)]
  //... 
}
finder = 'abc'
finder = /a(b|d)c/, replacer = 'x$1x'

/*
Overloads:
leapondReplace(finder, replacer)
leapondReplace({rules: [[finder1, replacer2], [finder2, replacer2]...]})
 */

Poison

leapondReplace({
  LEAPOND: true,    // poison here
  rules: [[f1, r1]]
})

This poison will find & clean all Leapond's DEV comments:

// removed sample 1
/*<DEV*/alert('some inline DEV code')/*DEV>*/

// removed sample 2
/*<DEV*/
/**
 * T
 * @param a
 * @param b
 * @return {*}
 */
function t(a, b) {
  return a + b
}

console.log(t(1, 2))
/*DEV>*/