babel-plugin-pkg
Advanced tools
Comparing version 1.1.2 to 1.1.3
/*! | ||
*** babel-plugin-pkg 1.1.2 | ||
*** babel-plugin-pkg 1.1.3 | ||
*** Copyright © 2019, Jaid <jaid.jsx@gmail.com> (https://github.com/Jaid) | ||
@@ -7,3 +7,3 @@ *** @license MIT | ||
!*/ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(global,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=require("path")},function(e,t){e.exports=require("read-pkg-up")},function(e,t,n){"use strict";n.r(t);var o=n(0),i=n.n(o),r=n(1);t.default=(({types:e})=>({pre(){this.init=(e=>{this.options||(this.options={cwd:e.cwd,prefix:"_PKG_",nameFallback:!0,...e.opts},this.options.packageJson=Object(r.sync)(this.options.cwd))})},visitor:{ReferencedIdentifier(t,n){if(this.init(n),t.node.name.startsWith(this.options.prefix)){var o,r,s,a,l;const n=t.node.name.slice(this.options.prefix.length);"PATH"===n&&(null===(o=this.options.packageJson)||null==o?void 0:o.path)&&t.replaceWith(e.valueToNode(this.options.packageJson.path)),!this.options.nameFallback||"NAME"!==n||null!==(r=this.options.packageJson)&&null!=r&&null!==(s=r.pkg)&&null!=s&&s.name||t.replaceWith(e.valueToNode(i.a.basename(this.options.cwd))),(null===(a=this.options.packageJson)||null==a||null===(l=a.pkg)||null==l?void 0:l[n.toLowerCase()])&&t.replaceWith(e.valueToNode(this.options.packageJson.pkg[n.toLowerCase()]))}}}}))}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(global,function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t){e.exports=require("path")},function(e,t){e.exports=require("read-pkg-up")},function(e,t,o){"use strict";o.r(t);var n=o(0),i=o.n(n),a=o(1);const r=o(3)("babel-plugin-pkg");t.default=(({types:e})=>({pre(){this.init=(e=>{this.options||(this.options={cwd:e.cwd,prefix:"_PKG_",nameFallback:!0,...e.opts},this.options.packageJson=Object(a.sync)(this.options.cwd),this.options.packageJson.path&&r("Got package data from %s",this.options.packageJson.path),this.options.packageJson.package&&r("Data: %o",this.options.packageJson.package))})},visitor:{ReferencedIdentifier(t,o){if(this.init(o),t.node.name.startsWith(this.options.prefix)){var n,a,r,s,p;const o=t.node.name.slice(this.options.prefix.length);"PATH"===o&&(null===(n=this.options.packageJson)||null==n?void 0:n.path)&&t.replaceWith(e.valueToNode(this.options.packageJson.path)),!this.options.nameFallback||"NAME"!==o||null!==(a=this.options.packageJson)&&null!=a&&null!==(r=a.package)&&null!=r&&r.name||t.replaceWith(e.valueToNode(i.a.basename(this.options.cwd))),(null===(s=this.options.packageJson)||null==s||null===(p=s.package)||null==p?void 0:p[o.toLowerCase()])&&t.replaceWith(e.valueToNode(this.options.packageJson.package[o.toLowerCase()]))}}}}))},function(e,t){e.exports=require("debug")}])}); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
{"author":{"name":"Jaid","email":"jaid.jsx@gmail.com","url":"https://github.com/Jaid"},"bugs":"https://github.com/Jaid/babel-plugin-pkg/issues","dependencies":{"@babel/runtime":"^7.4.4","debug":"^4.1.1","read-pkg-up":"^6.0.0"},"description":"Resolves _PKG_VERSION to version from package.json - also works with any other field!","homepage":"https://github.com/Jaid/babel-plugin-pkg","keywords":["babel","babel-plugin","convert","name","package","package-json","pkg","resolve","resolver","transform","transformation","transpile","transpiler","version"],"license":"MIT","name":"babel-plugin-pkg","repository":"github:Jaid/babel-plugin-pkg","version":"1.1.2"} | ||
{"author":{"name":"Jaid","email":"jaid.jsx@gmail.com","url":"https://github.com/Jaid"},"bugs":"https://github.com/Jaid/babel-plugin-pkg/issues","dependencies":{"@babel/runtime":"^7.4.4","debug":"^4.1.1","read-pkg-up":"^6.0.0"},"description":"Resolves _PKG_VERSION to version from package.json - also works with any other field!","homepage":"https://github.com/Jaid/babel-plugin-pkg","keywords":["babel","babel-plugin","convert","name","package","package-json","pkg","resolve","resolver","transform","transformation","transpile","transpiler","version"],"license":"MIT","name":"babel-plugin-pkg","repository":"github:Jaid/babel-plugin-pkg","version":"1.1.3"} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13126
16