{"_id":"babel-plugin-transform-new-target","_rev":"89020","name":"babel-plugin-transform-new-target","description":"Transforms new.target meta property","dist-tags":{"latest":"7.0.0-alpha.14","next":"7.0.0-beta.3"},"maintainers":[{"name":"hzoo","email":""}],"time":{"modified":"2021-06-03T10:29:00.000Z","created":"2017-07-12T02:53:32.444Z","7.0.0-beta.3":"2017-10-15T13:11:34.559Z","7.0.0-beta.2":"2017-09-26T15:15:06.864Z","7.0.0-beta.1":"2017-09-19T20:09:15.818Z","7.0.0-beta.0":"2017-09-12T03:02:07.613Z","7.0.0-alpha.20":"2017-08-30T18:52:04.035Z","7.0.0-alpha.19":"2017-08-07T22:21:32.299Z","7.0.0-alpha.18":"2017-08-03T22:20:54.076Z","7.0.0-alpha.17":"2017-07-26T12:39:09.084Z","7.0.0-alpha.16":"2017-07-25T21:17:41.065Z","7.0.0-alpha.15":"2017-07-12T03:35:46.117Z","7.0.0-alpha.14":"2017-07-12T02:53:32.444Z"},"users":{},"repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"versions":{"7.0.0-beta.3":{"name":"babel-plugin-transform-new-target","version":"7.0.0-beta.3","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-beta.3","babel-plugin-transform-class-properties":"7.0.0-beta.3","babel-plugin-transform-es2015-arrow-functions":"7.0.0-beta.3"},"_id":"babel-plugin-transform-new-target@7.0.0-beta.3","_npmVersion":"5.5.1","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"de2855f8422a9d07a85cc8d65a0bfc7f9c9c37b3","size":1648,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-beta.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-beta.3.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-beta.3.tgz_1508073093624_0.6865926682949066"},"directories":{},"publish_time":1508073094559,"_hasShrinkwrap":false,"_cnpm_publish_time":1508073094559},"7.0.0-beta.2":{"name":"babel-plugin-transform-new-target","version":"7.0.0-beta.2","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-beta.2","babel-plugin-transform-class-properties":"7.0.0-beta.2","babel-plugin-transform-es2015-arrow-functions":"7.0.0-beta.2"},"_id":"babel-plugin-transform-new-target@7.0.0-beta.2","_npmVersion":"5.4.1","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"cf8f1a6d068dfdf1d10bc57ac6596c34f1d96bcd","size":1642,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-beta.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-beta.2.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-beta.2.tgz_1506438905932_0.7214976539835334"},"directories":{},"publish_time":1506438906864,"_cnpm_publish_time":1506438906864,"_hasShrinkwrap":false},"7.0.0-beta.1":{"name":"babel-plugin-transform-new-target","version":"7.0.0-beta.1","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-beta.1","babel-plugin-transform-class-properties":"7.0.0-beta.1","babel-plugin-transform-es2015-arrow-functions":"7.0.0-beta.1"},"_id":"babel-plugin-transform-new-target@7.0.0-beta.1","_npmVersion":"5.4.1","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"d14c8f20a9ddf27a0a0d8a5d36241168687c83ef","size":1639,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-beta.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-beta.1.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-beta.1.tgz_1505851755738_0.514946614857763"},"directories":{},"publish_time":1505851755818,"_cnpm_publish_time":1505851755818,"_hasShrinkwrap":false},"7.0.0-beta.0":{"name":"babel-plugin-transform-new-target","version":"7.0.0-beta.0","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-beta.0","babel-plugin-transform-class-properties":"7.0.0-beta.0","babel-plugin-transform-es2015-arrow-functions":"7.0.0-beta.0"},"_id":"babel-plugin-transform-new-target@7.0.0-beta.0","_npmVersion":"5.3.0","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"0ded2d30b0e889a2916384d4955de96ddd2c2764","size":1696,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-beta.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-beta.0.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-beta.0.tgz_1505185326646_0.33937080577015877"},"directories":{},"publish_time":1505185327613,"_hasShrinkwrap":false,"_cnpm_publish_time":1505185327613},"7.0.0-alpha.20":{"name":"babel-plugin-transform-new-target","version":"7.0.0-alpha.20","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.20","babel-plugin-transform-class-properties":"7.0.0-alpha.20","babel-plugin-transform-es2015-arrow-functions":"7.0.0-alpha.20"},"_id":"babel-plugin-transform-new-target@7.0.0-alpha.20","_npmVersion":"5.3.0","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"4106eaace1ccd9df6121a3a6a9d73085c94efd6f","size":1693,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-alpha.20.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-alpha.20.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-alpha.20.tgz_1504119123922_0.1559072092641145"},"directories":{},"publish_time":1504119124035,"_cnpm_publish_time":1504119124035,"_hasShrinkwrap":false},"7.0.0-alpha.19":{"name":"babel-plugin-transform-new-target","version":"7.0.0-alpha.19","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.19","babel-plugin-transform-class-properties":"7.0.0-alpha.19","babel-plugin-transform-es2015-arrow-functions":"7.0.0-alpha.19"},"_id":"babel-plugin-transform-new-target@7.0.0-alpha.19","_npmVersion":"5.3.0","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"3220b4d95b35236b66c68d538f7cd5cbda89a543","size":1695,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-alpha.19.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-alpha.19.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-alpha.19.tgz_1502144492227_0.5960425480734557"},"directories":{},"publish_time":1502144492299,"_cnpm_publish_time":1502144492299,"_hasShrinkwrap":false},"7.0.0-alpha.18":{"name":"babel-plugin-transform-new-target","version":"7.0.0-alpha.18","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.18","babel-plugin-transform-class-properties":"7.0.0-alpha.18","babel-plugin-transform-es2015-arrow-functions":"7.0.0-alpha.18"},"_id":"babel-plugin-transform-new-target@7.0.0-alpha.18","_npmVersion":"5.3.0","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"2000b6b15e9dad67623d418b11bf0b225c07da5f","size":1701,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-alpha.18.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-alpha.18.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-alpha.18.tgz_1501798853985_0.9246566328220069"},"directories":{},"publish_time":1501798854076,"_cnpm_publish_time":1501798854076,"_hasShrinkwrap":false},"7.0.0-alpha.17":{"name":"babel-plugin-transform-new-target","version":"7.0.0-alpha.17","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.17","babel-plugin-transform-class-properties":"7.0.0-alpha.17","babel-plugin-transform-es2015-arrow-functions":"7.0.0-alpha.17"},"_id":"babel-plugin-transform-new-target@7.0.0-alpha.17","scripts":{},"_shasum":"69e62b7bc60a43201af0cfec5a3fea142a399897","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.9.0","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"69e62b7bc60a43201af0cfec5a3fea142a399897","size":1700,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-alpha.17.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-alpha.17.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-alpha.17.tgz_1501072747933_0.21590719535015523"},"directories":{},"publish_time":1501072749084,"_hasShrinkwrap":false,"_cnpm_publish_time":1501072749084},"7.0.0-alpha.16":{"name":"babel-plugin-transform-new-target","version":"7.0.0-alpha.16","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.16","babel-plugin-transform-class-properties":"7.0.0-alpha.16","babel-plugin-transform-es2015-arrow-functions":"7.0.0-alpha.16"},"_id":"babel-plugin-transform-new-target@7.0.0-alpha.16","scripts":{},"_shasum":"49cd65848a1fa9cdd84202380c8cfd6c80300a30","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.9.0","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"49cd65848a1fa9cdd84202380c8cfd6c80300a30","size":1700,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-alpha.16.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-alpha.16.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-alpha.16.tgz_1501017460128_0.8497658891137689"},"directories":{},"publish_time":1501017461065,"_cnpm_publish_time":1501017461065,"_hasShrinkwrap":false},"7.0.0-alpha.15":{"name":"babel-plugin-transform-new-target","version":"7.0.0-alpha.15","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.15","babel-plugin-transform-class-properties":"7.0.0-alpha.15","babel-plugin-transform-es2015-arrow-functions":"7.0.0-alpha.15"},"_id":"babel-plugin-transform-new-target@7.0.0-alpha.15","scripts":{},"_shasum":"bfbaea79865f1826bef7cad13270d5142b5cc72e","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.9.0","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"bfbaea79865f1826bef7cad13270d5142b5cc72e","size":1694,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-alpha.15.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-alpha.15.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-alpha.15.tgz_1499830545171_0.7242225480731577"},"directories":{},"publish_time":1499830546117,"_hasShrinkwrap":false,"_cnpm_publish_time":1499830546117},"7.0.0-alpha.14":{"name":"babel-plugin-transform-new-target","version":"7.0.0-alpha.14","description":"Transforms new.target meta property","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.14","babel-plugin-transform-class-properties":"7.0.0-alpha.14","babel-plugin-transform-es2015-arrow-functions":"7.0.0-alpha.14"},"_id":"babel-plugin-transform-new-target@7.0.0-alpha.14","scripts":{},"_shasum":"0db30a8a07f9d6103a8e86b8f7d1461f9eca8e70","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.9.0","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"0db30a8a07f9d6103a8e86b8f7d1461f9eca8e70","size":1694,"noattachment":false,"key":"/babel-plugin-transform-new-target/-/babel-plugin-transform-new-target-7.0.0-alpha.14.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-new-target/download/babel-plugin-transform-new-target-7.0.0-alpha.14.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-new-target-7.0.0-alpha.14.tgz_1499828011472_0.6155840551946312"},"directories":{},"publish_time":1499828012444,"_hasShrinkwrap":false,"_cnpm_publish_time":1499828012444}},"readme":"# babel-plugin-transform-new-target\n\nThis plugins allows babel to transform `new.target` meta property into a\n(correct in most cases) `this.constructor` expression.\n\n## Example\n\n```js\nfunction Foo() {\n  console.log(new.target);\n}\n\nFoo(); // => undefined\nnew Foo(); // => Foo\n```\n\n```js\nclass Foo {\n  constructor() {\n    console.log(new.target);\n  }\n}\n\nclass Bar extends Foo {\n}\n\nnew Foo(); // => Foo\nnew Bar(); // => Bar\n```\n\n### Caveats\n\nThis plugin relies on `this.constructor`, which means `super` must\nalready have been called when using untransformed classes.\n\n```js\nclass Foo {}\n\nclass Bar extends Foo {\n  constructor() {\n    // This will be a problem if classes aren't transformed to ES5\n    new.target;\n    super();\n  }\n}\n```\n\nAdditionally, this plugin cannot transform all `Reflect.construct` cases\nwhen using `newTarget` with ES5 function classes (transformed ES6 classes).\n\n```js\nfunction Foo() {\n  console.log(new.target);\n}\n\n// Bar extends Foo in ES5\nfunction Bar() {\n  Foo.call(this);\n}\nBar.prototype = Object.create(Foo.prototype);\nBar.prototype.constructor = Bar;\n\n// Baz does not extend Foo\nfunction Baz() {}\n\nReflect.construct(Foo, []); // => Foo (correct)\nReflect.construct(Foo, [], Bar); // => Bar (correct)\n\nReflect.construct(Bar, []); // => Bar (incorrect, though this is how ES5\n                            // inheritience is commonly implemented.)\nReflect.construct(Foo, [], Baz); // => undefined (incorrect)\n```\n\n## Installation\n\n```sh\nnpm install --save-dev babel-plugin-transform-new-target\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"transform-new-target\"]\n}\n```\n\n### Via CLI\n\n```sh\nbabel --plugins transform-new-target script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"transform-new-target\"]\n});\n```\n","_attachments":{},"license":"MIT"}