{"name":"rollup-plugin-re","version":"1.0.5","description":"rollup replace plugin","main":"dist/rollup-plugin-re.cjs.js","jsnext":"dist/rollup-plugin-re.es.js","scripts":{"build":"rollup -c -f cjs -o dist/rollup-plugin-re.cjs.js && rollup -c -o dist/rollup-plugin-re.es.js","dev":"rollup -cw -f cjs -o dist/rollup-plugin-re.cjs.js","test":"npm run lint && npm run build && npm run unit","lint":"standard rollup.config.js test/test.js src/**","format":"standard --fix test/** src/**","unit":"cross-env NODE_ENV=production ava test/test.js","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/jetiny/rollup-plugin-re.git"},"author":{"name":"jetiny","email":"86287344@qq.com"},"keywords":["rollup-plugin","regexp","replace"],"license":"MIT","bugs":{"url":"https://github.com/jetiny/rollup-plugin-re/issues"},"homepage":"https://github.com/jetiny/rollup-plugin-re#readme","dependencies":{"magic-string":"^0.16.0","rollup-pluginutils":"^2.0.1"},"devDependencies":{"ava":"^0.16.0","cross-env":"^3.1.3","eslint-plugin-standard":"^2.0.1","rollup":"^0.36.3","rollup-plugin-buble":"^0.14.0","standard":"^8.5.0"},"gitHead":"47908fcd711df20042c59bceb951773abe682d9a","_id":"rollup-plugin-re@1.0.5","_shasum":"f341eadcf31a31117dd48babb14e219f1d7041cc","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"jetiny","email":"86287344@qq.com"},"dist":{"shasum":"f341eadcf31a31117dd48babb14e219f1d7041cc","tarball":"http://registry-npm.ywwl.com/rollup-plugin-re/download/rollup-plugin-re-1.0.5.tgz","integrity":"sha512-uePhduTCtF7D/hl9NEdF4pbX7NUuRdqaLDa6wGbJv9fFduyNo0KlQW2DFQQJtCnSyUNzKDtWe/8qvIZwFi12vg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAJ3w05ue+LJCQe2V5z79f3RO9P6kDRbkx34dZn82T3KAiEAppcE7/ywPGkSAyljdbN/yg5sL2gd3unNpMzfXYrKSvk="}],"size":5593,"noattachment":false,"key":"/rollup-plugin-re/-/rollup-plugin-re-1.0.5.tgz"},"maintainers":[{"name":"jetiny","email":"86287344@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rollup-plugin-re-1.0.5.tgz_1497074834040_0.6946581862866879"},"directories":{},"readme":"[![Build Status](https://travis-ci.org/jetiny/rollup-plugin-re.svg?branch=master)](https://travis-ci.org/jetiny/rollup-plugin-re)\n\n# rollup-plugin-re\n\nPower rollup content transform plugin.\n\n## Installation\n\n```\nnpm install --save-dev rollup-plugin-re\n```\n\n## Usage\n```js\nimport { rollup } from 'rollup'\nimport replace from 'rollup-plugin-re'\nimport commonjs from 'rollup-plugin-commonjs'\nrollup({\n  entry: 'main.js',\n  plugins: [\n    replace({\n      // ... do replace before commonjs\n      patterns: [\n        {\n          // regexp match with resolved path\n          match: /formidable(\\/|\\\\)lib/, \n          // string or regexp\n          test: 'if (global.GENTLY) require = GENTLY.hijack(require);', \n          // string or function to replaced with\n          replace: '',\n        }\n      ]\n    }),\n    commonjs(),\n    replace({\n       // ... do replace after commonjs\n    })\n  ]\n}).then(...)\n```\n\n## Define macro pre-processor \n\nuse `defines` options to remove macro blocks\n\n### Options\n```javascript\n{\n  defines: {\n    IS_SKIP: false,\n    IS_REMOVE: true,\n  }\n}\n```\n\n### input\n```javascript\n// #if IS_SKIP\n  console.log('!Skip!')\n// #endif\n// #if IS_REMOVE\nconsole.log('!Remove!')\n// #endif\n```\n\n### output\n```javascript\n// #if IS_SKIP\n  console.log('!Skip!')\n// #endif\n```\n\n\n## Replace\n\nuse `replaces` options to quick replace text\n\n### Options\n```javascript\n{\n  replaces: {\n    $version: \"1.0.1\"\n  }\n}\n```\n\n### input\n```javascript\n  console.log('$version')\n```\n\n### output\n```javascript\n  console.log('1.0.1')\n```\n\n\n## Options\n\n```javascript\n{\n  // a minimatch pattern, or array of patterns, of files that\n  // should be processed by this plugin (if omitted, all files\n  // are included by default)...\n  include: 'config.js',\n\n  // ...and those that shouldn't, if `include` is otherwise\n  // too permissive\n  exclude: 'node_modules/**',\n  defines: {\n    IS_SKIP: false,\n    IS_REMOVE: true,\n  },\n  replaces: {\n    $version: \"1.0.1\"\n  },\n  patterns: [\n    {\n      include: [], // same as above\n      exclude: [], // same as above\n      // regexp match with resolved path\n      match: /formidable(\\/|\\\\)lib/, \n      // string or regexp\n      test: 'if (global.GENTLY) require = GENTLY.hijack(require);', \n      // string or function\n      replace: '',\n    },\n    // replace whole file content\n    {\n      text: 'exports = \"content\"', // replace content with given text\n    },\n    {\n      file: './replace.js', // replace with given relative file\n    },\n    {\n      transform (code, id) { // replace by function\n        return `'use strict';\\n${code}`\n      }\n    }\n  ]\n}\n```\n","publish_time":1497074834926,"_cnpm_publish_time":1497074834926,"dist-tags":{"latest":"1.0.7"}}