{"name":"rollup-plugin-re","version":"1.0.1","description":"rollup replace plugin","main":"dist/rollup-plugin-re.common.js","jsnext":"dist/rollup-plugin-re.es.js","scripts":{"build":"rollup -c -f cjs -o dist/rollup-plugin-re.common.js && rollup -c -o dist/rollup-plugin-re.es.js","dev":"rollup -cw -f cjs -o dist/rollup-plugin-re.common.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":"^1.5.2"},"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":"e3d18980b147af5300710d998c3c09954c3c1acb","_id":"rollup-plugin-re@1.0.1","_shasum":"68cc5745fff039bf832ea204266828e75e901e69","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.6.0","_npmUser":{"name":"jetiny","email":"86287344@qq.com"},"maintainers":[{"name":"jetiny","email":"86287344@qq.com"}],"dist":{"shasum":"68cc5745fff039bf832ea204266828e75e901e69","tarball":"http://registry-npm.ywwl.com/rollup-plugin-re/download/rollup-plugin-re-1.0.1.tgz","integrity":"sha512-/SzGInV5qNtBJlKzIsnHFNIyIIq/uQiSVT9+M6aZDZLdi4+oEDvmyEklVktgW3YEEL3DezROKIl+f4QQccVKIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPfWQ6yPVOL3AbTAVJR1vuO5hjBYyaCe06awgaM7Yn4gIhAKfM3sc9n3xZuoVV949BgKP57jbuwscN86gRzFRfkDbn"}],"size":3276,"noattachment":false,"key":"/rollup-plugin-re/-/rollup-plugin-re-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/rollup-plugin-re-1.0.1.tgz_1478909452140_0.3075271868146956"},"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":1478909452689,"_cnpm_publish_time":1478909452689,"dist-tags":{"latest":"1.0.7"}}