pax_global_header00006660000000000000000000000064126221733550014520gustar00rootroot0000000000000052 comment=fdfa23d4d3f192d602e500e330a02ac71210c7e4 babel-plugin-version-inline-1.0.0/000077500000000000000000000000001262217335500170165ustar00rootroot00000000000000babel-plugin-version-inline-1.0.0/.babelrc000066400000000000000000000000341262217335500204060ustar00rootroot00000000000000{ "presets": ["es2015"] } babel-plugin-version-inline-1.0.0/.gitignore000066400000000000000000000000231262217335500210010ustar00rootroot00000000000000node_modules/ lib/ babel-plugin-version-inline-1.0.0/.npmignore000066400000000000000000000000051262217335500210100ustar00rootroot00000000000000src/ babel-plugin-version-inline-1.0.0/LICENSE000066400000000000000000000020731262217335500200250ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 Gabriel Andretta Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. babel-plugin-version-inline-1.0.0/README.md000066400000000000000000000012061262217335500202740ustar00rootroot00000000000000# babel-plugin-version-inline Turn `__VERSION__` into the package's version string. ## Example Given the following _package.json_. ```json { "name": "package-using-babel-plugin-version-inline", "version": "1.0.0" } ``` #### in ```js __VERSION__ ``` #### out ```js "1.0.0" ``` ## Installation ```sh $ npm install babel-plugin-version-inline ``` ## Usage ### Via `.babelrc` (Recommended) **.babelrc** ```json { "plugins": ["version-inline"] } ``` ### Via CLI ```sh $ babel --plugins version-inline script.js ``` ### Via Node API ```javascript require("babel-core").transform("code", { plugins: ["version-inline"] }); ``` babel-plugin-version-inline-1.0.0/package.json000066400000000000000000000014311262217335500213030ustar00rootroot00000000000000{ "name": "babel-plugin-version-inline", "version": "1.0.0", "description": "Babel plugin for turning __VERSION__ into a package version string", "main": "lib/index.js", "scripts": { "build": "babel src --out-dir lib --copy-files", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", "url": "git+https://github.com/gnandretta/babel-plugin-version-inline.git" }, "keywords": [ "babel-plugin" ], "author": "Gabriel Andretta", "license": "MIT", "bugs": { "url": "https://github.com/gnandretta/babel-plugin-version-inline/issues" }, "homepage": "https://github.com/gnandretta/babel-plugin-version-inline#readme", "devDependencies": { "babel-cli": "^6.1.18", "babel-preset-es2015": "^6.1.18" } } babel-plugin-version-inline-1.0.0/src/000077500000000000000000000000001262217335500176055ustar00rootroot00000000000000babel-plugin-version-inline-1.0.0/src/index.js000066400000000000000000000005151262217335500212530ustar00rootroot00000000000000import fs from 'fs'; const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version; export default function ({ types: t }) { return { visitor: { ReferencedIdentifier(path) { if (path.node.name === "__VERSION__") { path.replaceWith(t.valueToNode(version)); } } } }; }