{"_id":"babel-plugin-inline-replace-variables","_rev":"3115134","name":"babel-plugin-inline-replace-variables","description":"babel plugin to inline replace variables","dist-tags":{"latest":"1.3.1"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"time":{"modified":"2023-11-27T05:50:41.000Z","created":"2016-05-24T14:56:53.866Z","1.3.1":"2017-06-01T07:02:53.162Z","1.3.0":"2017-05-16T15:51:11.389Z","1.2.2":"2017-02-27T06:52:40.308Z","1.2.1":"2017-02-24T03:05:30.089Z","1.2.0":"2017-02-21T02:26:47.119Z","1.1.2":"2016-10-11T09:04:21.800Z","1.1.1":"2016-09-29T07:49:30.062Z","1.1.0":"2016-09-29T07:48:17.727Z","1.0.1":"2016-05-24T14:56:53.866Z"},"users":{},"author":{"name":"Ling."},"repository":{"type":"git","url":"git+https://github.com/wssgcg1213/babel-plugin-inline-replace-variables.git"},"versions":{"1.3.1":{"name":"babel-plugin-inline-replace-variables","version":"1.3.1","description":"babel plugin to inline replace variables","main":"index.js","scripts":{"test":"mocha -u bdd"},"repository":{"type":"git","url":"git+https://github.com/wssgcg1213/babel-plugin-inline-replace-variables.git"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{"babylon":"^6.17.0"},"devDependencies":{"babel-core":"^6.8.0","mocha":"^2.4.5","should":"^11.2.0"},"engines":{"node":">= 4"},"gitHead":"463bb5c36bc6e0497b212ef1ef18cbcc676d40c2","bugs":{"url":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables/issues"},"homepage":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables#readme","_id":"babel-plugin-inline-replace-variables@1.3.1","_shasum":"9fbb8dd43229c777695e14ea0d3d781f048fdc0f","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"dist":{"shasum":"9fbb8dd43229c777695e14ea0d3d781f048fdc0f","size":2546,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.3.1.tgz"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-inline-replace-variables-1.3.1.tgz_1496300573082_0.1500689829699695"},"directories":{},"publish_time":1496300573162,"_hasShrinkwrap":false,"_cnpm_publish_time":1496300573162,"_cnpmcore_publish_time":"2021-12-16T16:07:47.323Z"},"1.3.0":{"name":"babel-plugin-inline-replace-variables","version":"1.3.0","description":"babel plugin to inline replace variables","main":"index.js","scripts":{"test":"mocha -u bdd"},"repository":{"type":"git","url":"git+https://github.com/wssgcg1213/babel-plugin-inline-replace-variables.git"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{"babylon":"^6.17.0"},"devDependencies":{"babel-core":"^6.8.0","mocha":"^2.4.5","should":"^11.2.0"},"engines":{"node":">= 4"},"gitHead":"4a302765b6d3ee1eef0da38cc19abc0c101133f8","bugs":{"url":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables/issues"},"homepage":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables#readme","_id":"babel-plugin-inline-replace-variables@1.3.0","_shasum":"c07630d90bf7b3880bd13d6ffcae53d6c718826f","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"dist":{"shasum":"c07630d90bf7b3880bd13d6ffcae53d6c718826f","size":2429,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.3.0.tgz"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/babel-plugin-inline-replace-variables-1.3.0.tgz_1494949871137_0.055415581446141005"},"directories":{},"publish_time":1494949871389,"_hasShrinkwrap":false,"_cnpm_publish_time":1494949871389,"_cnpmcore_publish_time":"2021-12-16T16:07:47.538Z"},"1.2.2":{"name":"babel-plugin-inline-replace-variables","version":"1.2.2","description":"babel plugin to inline replace variables","main":"index.js","scripts":{"test":"mocha -u bdd"},"repository":{"type":"git","url":"git+https://github.com/wssgcg1213/babel-plugin-inline-replace-variables.git"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"^6.8.0","mocha":"^2.4.5","should":"^11.2.0"},"engines":{"node":">= 4"},"gitHead":"ba47e29c50711732d67e0fd98bdec06eaa3900cb","bugs":{"url":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables/issues"},"homepage":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables#readme","_id":"babel-plugin-inline-replace-variables@1.2.2","_shasum":"be3963d8c27d3abb35e20b53122aff13e2ce9a92","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"dist":{"shasum":"be3963d8c27d3abb35e20b53122aff13e2ce9a92","size":1893,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.2.2.tgz"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/babel-plugin-inline-replace-variables-1.2.2.tgz_1488178358584_0.24029612774029374"},"directories":{},"publish_time":1488178360308,"_hasShrinkwrap":false,"_cnpm_publish_time":1488178360308,"_cnpmcore_publish_time":"2021-12-16T16:07:47.767Z"},"1.2.1":{"name":"babel-plugin-inline-replace-variables","version":"1.2.1","description":"babel plugin to inline replace variables","main":"lib/index.js","scripts":{"build":"babel src/ -d lib/","test":"mocha -u bdd --compilers js:babel-core/register"},"repository":{"type":"git","url":"git+https://github.com/wssgcg1213/babel-plugin-inline-replace-variables.git"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"^6.8.0","babel-cli":"^6.8.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","mocha":"^2.4.5","should":"^8.3.1"},"gitHead":"8fa34ad985331cb26f898a307860cdc543cc72e8","bugs":{"url":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables/issues"},"homepage":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables#readme","_id":"babel-plugin-inline-replace-variables@1.2.1","_shasum":"f430f6459ccfaf05f552089bb4bf7e5f81dc8554","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"dist":{"shasum":"f430f6459ccfaf05f552089bb4bf7e5f81dc8554","size":2303,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.2.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/babel-plugin-inline-replace-variables-1.2.1.tgz_1487905529852_0.8056155785452574"},"directories":{},"publish_time":1487905530089,"_hasShrinkwrap":false,"_cnpm_publish_time":1487905530089,"_cnpmcore_publish_time":"2021-12-16T16:07:48.030Z"},"1.2.0":{"name":"babel-plugin-inline-replace-variables","version":"1.2.0","description":"babel plugin to inline replace variables","main":"lib/index.js","scripts":{"build":"babel src/ -d lib/","test":"mocha -u bdd --compilers js:babel-core/register"},"repository":{"type":"git","url":"git+https://github.com/wssgcg1213/babel-plugin-inline-replace-variables.git"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"^6.8.0","babel-cli":"^6.8.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","mocha":"^2.4.5","should":"^8.3.1"},"gitHead":"eeebab746d2c8042ca72889e76c183e876279083","bugs":{"url":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables/issues"},"homepage":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables#readme","_id":"babel-plugin-inline-replace-variables@1.2.0","_shasum":"2c9f33bf7297e406b976b3397809f3a9e8a19a52","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"dist":{"shasum":"2c9f33bf7297e406b976b3397809f3a9e8a19a52","size":2132,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.2.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/babel-plugin-inline-replace-variables-1.2.0.tgz_1487644005442_0.5580809337552637"},"directories":{},"publish_time":1487644007119,"_hasShrinkwrap":false,"_cnpm_publish_time":1487644007119,"_cnpmcore_publish_time":"2021-12-16T16:07:48.581Z"},"1.1.2":{"name":"babel-plugin-inline-replace-variables","version":"1.1.2","description":"babel plugin to inline replace variables","main":"lib/index.js","scripts":{"build":"babel src/ -d lib/","test":"mocha -u bdd --compilers js:babel-core/register"},"repository":{"type":"git","url":"github.com/wssgcg1213/babel-plugin-inline-replace-variables"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"^6.8.0","babel-cli":"^6.8.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","mocha":"^2.4.5","should":"^8.3.1"},"gitHead":"0d1a7dde39278567490605fdac6bf0ab89c70476","_id":"babel-plugin-inline-replace-variables@1.1.2","_shasum":"631eddfade18179041c781388014c96b71520daa","_from":".","_npmVersion":"3.10.5","_nodeVersion":"4.4.5","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"dist":{"shasum":"631eddfade18179041c781388014c96b71520daa","size":2093,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.1.2.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/babel-plugin-inline-replace-variables-1.1.2.tgz_1476176659828_0.7307347166351974"},"directories":{},"publish_time":1476176661800,"_hasShrinkwrap":false,"_cnpm_publish_time":1476176661800,"_cnpmcore_publish_time":"2021-12-16T16:07:48.790Z"},"1.1.1":{"name":"babel-plugin-inline-replace-variables","version":"1.1.1","description":"babel plugin to inline replace variables","main":"lib/index.js","scripts":{"build":"babel src/ -d lib/","test":"mocha -u bdd --compilers js:babel-core/register"},"repository":{"type":"git","url":"github.com/wssgcg1213/babel-plugin-inline-replace-variables"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"^6.8.0","babel-cli":"^6.8.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","mocha":"^2.4.5","should":"^8.3.1"},"gitHead":"0f9029888cd647ccf1980cbfc45de9c3a42398bc","_id":"babel-plugin-inline-replace-variables@1.1.1","_shasum":"ac5e297560e8db0a4b59ff6483aa0eb1170828bf","_from":".","_npmVersion":"3.10.5","_nodeVersion":"4.4.5","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"dist":{"shasum":"ac5e297560e8db0a4b59ff6483aa0eb1170828bf","size":2017,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.1.1.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/babel-plugin-inline-replace-variables-1.1.1.tgz_1475135369285_0.22608321369625628"},"directories":{},"publish_time":1475135370062,"_hasShrinkwrap":false,"_cnpm_publish_time":1475135370062,"_cnpmcore_publish_time":"2021-12-16T16:07:48.966Z"},"1.1.0":{"name":"babel-plugin-inline-replace-variables","version":"1.1.0","description":"babel plugin to inline replace variables","main":"lib/index.js","scripts":{"build":"babel src/ -d lib/","test":"mocha -u bdd --compilers js:babel-core/register"},"repository":{"type":"git","url":"github.com/wssgcg1213/babel-plugin-inline-replace-variables"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"^6.8.0","babel-cli":"^6.8.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","mocha":"^2.4.5","should":"^8.3.1"},"gitHead":"0c1a6d9a1b96641e871719717462f6972116e24d","_id":"babel-plugin-inline-replace-variables@1.1.0","_shasum":"004da27392cf5a1973b10a54fd1a6b147d908591","_from":".","_npmVersion":"3.10.5","_nodeVersion":"4.4.5","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"dist":{"shasum":"004da27392cf5a1973b10a54fd1a6b147d908591","size":1884,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/babel-plugin-inline-replace-variables-1.1.0.tgz_1475135296913_0.15744815627112985"},"directories":{},"publish_time":1475135297727,"_hasShrinkwrap":false,"_cnpm_publish_time":1475135297727,"_cnpmcore_publish_time":"2021-12-16T16:07:49.161Z"},"1.0.1":{"name":"babel-plugin-inline-replace-variables","version":"1.0.1","description":"babel plugin to inline replace variables","main":"lib/index.js","scripts":{"build":"babel src/ -d lib/","test":"mocha -u bdd --compilers js:babel-core/register"},"repository":{"type":"git","url":"github.com/wssgcg1213/babel-plugin-inline-replace-variables"},"keywords":["babel","plugin","inline","replace","variables"],"author":{"name":"Ling."},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"^6.8.0","babel-cli":"^6.8.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","mocha":"^2.4.5","should":"^8.3.1"},"gitHead":"e462c75d938825d6abe93e42b4ca93080173674c","_id":"babel-plugin-inline-replace-variables@1.0.1","_shasum":"7cb126ff07212fca9709f357b0473fa8bf057441","_from":".","_npmVersion":"3.8.5","_nodeVersion":"4.4.2","_npmUser":{"name":"zeroling","email":"wssgcg1213@qq.com"},"maintainers":[{"name":"rtsao","email":""},{"name":"zeroling","email":""}],"dist":{"shasum":"7cb126ff07212fca9709f357b0473fa8bf057441","size":1642,"noattachment":false,"key":"/babel-plugin-inline-replace-variables/-/babel-plugin-inline-replace-variables-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-inline-replace-variables/download/babel-plugin-inline-replace-variables-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/babel-plugin-inline-replace-variables-1.0.1.tgz_1464101811295_0.08273942768573761"},"directories":{},"publish_time":1464101813866,"_hasShrinkwrap":false,"_cnpm_publish_time":1464101813866,"_cnpmcore_publish_time":"2021-12-16T16:07:49.353Z"}},"readme":"\n\n# babel-plugin-inline-replace-variables\n\n[![Build Status](https://travis-ci.org/wssgcg1213/babel-plugin-inline-replace-variables.svg?branch=master)](https://travis-ci.org/wssgcg1213/babel-plugin-inline-replace-variables)\n\nIt replace an Identifier to a literial (LVal), if you want to transfrom a identifier to another identifier, you can see: [babel-plugin-replace-identifiers](https://github.com/wssgcg1213/babel-plugin-replace-identifiers)\n## Usage\n\n```bash\nnpm i babel-plugin-inline-replace-variables --save-dev\n```\n\nconfigure in .babelrc(should transfer to json format) or any babel queries:\n```javascript\n{\n  plugins: [\n    ['inline-replace-variables', {\n      \"__SERVER__\": true,\n      \"__VERSION__\": \"v1.2.3\"\n    }]\n  ]\n}\n```\n\n#### EFFECT:\n\n```javascript\nif (__SERVER__) {\n  console.log('this is server, version: %s', __VERSION__)\n} else {\n  alert('this is browser')\n}\n```\n\nwill be transformed to\n\n```\nif (true) {\n  console.log('this is server, version: %s', \"v1.2.3\")\n} else {\n  alert('this is browser')\n}\n```\n\n### Support Replace With Expression:\n\n```js\n{\n  plugins: [\n    ['inline-replace-variables', {\n      \"__TYPE__\": {\n        type: 'node',\n        replacement: 'process.env.NODE_ENV'\n      }\n    }]\n  ]\n}\n```\n\n#### EFFECT\n```js\nif (__TYPE__) {\n  // code\n}\n```\n\nto\n\n```js\nif (process.env.NODE_ENV) {\n  // code\n}\n```\n\n\n\n### Also support babel AST Node\n\n```js\nconst t = require('babel-types');\nconst nodeEnv = t.memberExpression(t.memberExpression(t.identifier('process'), t.identifier('env')), t.identifier('NODE_ENV'));\n\n{\n  plugins: [\n    ['inline-replace-variables', {\n      \"__TYPE__\": nodeEnv\n    }]\n  ]\n}\n```\n\n#### EFFECT\n\nThe effect is the same above.\n\n\n\n#### tip:\n\nVersion 1.0.1 fix the misspelling of 'varibles' to 'variables'\n\nso `babel-plugin-inline-replace-varibles` is deprecated, you should instead it of `babel-plugin-inline-replace-variables`\n\n\n\nAuthors: https://github.com/wssgcg1213, https://github.com/rtsao\n\n\n","_attachments":{},"homepage":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables#readme","bugs":{"url":"https://github.com/wssgcg1213/babel-plugin-inline-replace-variables/issues"},"license":"MIT"}