From 9832a69d1cc0ab6cdfa5c0e6975490614e51b054 Mon Sep 17 00:00:00 2001 From: Sean Matheson Date: Mon, 11 Apr 2016 14:35:58 +0100 Subject: [PATCH] chore(Removed babel-plugin-typecheck and updated lib.): Removed babel-plugin-typecheck and updated l Removed babel-plugin-typecheck and updated lib. --- .babelrc | 7 ------- .gitignore | 2 +- lib/react-injectables.js | 2 +- package.json | 1 - 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.babelrc b/.babelrc index b9b4b5d..8c71fe9 100644 --- a/.babelrc +++ b/.babelrc @@ -2,12 +2,5 @@ "presets": [ "es2015", "stage-1", "react" ], "ignore": [ "/node_modules/" - ], - "plugins": [ - ["babel-plugin-typecheck", { - "disable": { - "production": true - } - }] ] } diff --git a/.gitignore b/.gitignore index 58832da..eb18199 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Webpack stats file output used for bundle optimisation. -webpack-stats.json +lib/stats.json #####=== Node ===##### diff --git a/lib/react-injectables.js b/lib/react-injectables.js index 46bfd0a..8c1f482 100644 --- a/lib/react-injectables.js +++ b/lib/react-injectables.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("react-injectables",["react"],t):"object"==typeof exports?exports["react-injectables"]=t(require("react")):e["react-injectables"]=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Injector=t.Injectable=t.Provider=void 0;var i=n(5),o=r(i),c=n(3),u=r(c),a=n(4),f=r(a);t.Provider=o.default,t.Injectable=u.default,t.Injector=f.default},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);e.length>t;t++)n[t]=e[t];return n}return Array.from(e)}function o(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return function(){if(0===t.length)return arguments.length>0?arguments[0]:void 0;var e=t[t.length-1],n=t.slice(0,-1);return n.reduceRight(function(e,t){return t(e)},e.apply(void 0,arguments))}}function c(e){var t=e.children;return a.Children.only(t)}function u(e,t){var n=0;return t.map(function(t){return n++,f.default.createElement(c,{key:e+"_"+n},t)})}Object.defineProperty(t,"__esModule",{value:!0}),t.find=t.map=t.concatAll=t.containsUniq=t.uniqBy=t.withoutAll=t.without=t.all=t.filter=void 0,t.compose=o,t.keyedElements=u;var a=n(1),f=r(a),s=t.filter=function(e){return function(t){return t.filter(e)}},l=t.all=function(e){return function(t){for(var n=0;t.length>n;n++)if(!e(t[n]))return!1;return!0}},p=(t.without=function(e){return function(t){return s(function(t){return!Object.is(t,e)})(t)}},t.withoutAll=function(e){return function(t){return s(function(t){return l(function(e){return!Object.is(t,e)})(e)})(t)}});t.uniqBy=function(e){return function(t){var n=new Set,r=[];return t.forEach(function(t){var i=t[e];n.has(i)||(n.add(i),r.push(t))}),r}},t.containsUniq=function(e){return function(t){return p(e)(t).length>0}},t.concatAll=function(e){return e.reduce(function(e,t){return[].concat(i(e),i(t))},[])},t.map=function(e){return function(t){return t.map(e)}},t.find=function(e){return function(t){return t.find(e)}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=n(1),s=r(f),l=n(2),p=0,j=function(e){p++;var t="injectionId_"+p,n=function(n){function r(){var e,t,n,c;i(this,r);for(var u=arguments.length,a=Array(u),f=0;u>f;f++)a[f]=arguments[f];return t=n=o(this,(e=Object.getPrototypeOf(r)).call.apply(e,[this].concat(a))),n.state={injected:[]},n.consume=function(e){(e.length!==n.state.injected.length||(0,l.containsUniq)(n.state.injected,e))&&n.setState({injected:e})},c=t,o(n,c)}return c(r,n),a(r,[{key:"componentWillMount",value:function(){this.context.registerInjectable({injectionId:t,injectable:this})}},{key:"componentWillUnmount",value:function(){this.context.removeInjectable({injectionId:t,injectable:this})}},{key:"render",value:function(){return s.default.createElement(e,u({injected:(0,l.keyedElements)("injected",this.state.injected)},this.props))}}]),r}(f.Component);return n.injectionId=t,n.contextTypes={registerInjectable:f.PropTypes.func.isRequired,removeInjectable:f.PropTypes.func.isRequired},n};t.default=j},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(1),f=r(a),s=0,l=function(e){var t=e.to,n=e.inject;s++;var r="injector_"+s;return function(e){var s=function(a){function s(){var e,t,r,c;i(this,s);for(var u=arguments.length,a=Array(u),f=0;u>f;f++)a[f]=arguments[f];return t=r=o(this,(e=Object.getPrototypeOf(s)).call.apply(e,[this].concat(a))),r.getInjectElement=function(){return"function"==typeof n?n(r.props):n},c=t,o(r,c)}return c(s,a),u(s,[{key:"componentWillMount",value:function(){this.context.registerInjector({injectionId:t.injectionId,injectorId:r,injector:this})}},{key:"componentWillUnmount",value:function(){this.context.removeInjector({injectionId:t.injectionId,injector:this})}},{key:"render",value:function(){return f.default.createElement(e,this.props)}}]),s}(a.Component);return s.contextTypes={registerInjector:a.PropTypes.func.isRequired,removeInjector:a.PropTypes.func.isRequired},s}};t.default=l},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);e.length>t;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(1),f=n(2),s=function(e){function t(e,n){i(this,t);var r=o(this,Object.getPrototypeOf(t).call(this,e,n));return r.registrations=[],r}return c(t,e),u(t,[{key:"getChildContext",value:function(){var e=this;return{registerInjector:function(t){return e.registerInjector(t)},removeInjector:function(t){return e.removeInjector(t)},registerInjectable:function(t){return e.registerInjectable(t)},removeInjectable:function(t){return e.removeInjectable(t)}}}},{key:"getRegistration",value:function(e){var t=e.injectionId,n=(0,f.find)(function(e){return e.injectionId===t})(this.registrations);return n||(n={injectionId:t,injectables:[],injections:[]},this.registrations.push(n)),n}},{key:"runInjections",value:function(e){var t=e.registration,n=t.injectables,r=t.injections,i=(0,f.compose)((0,f.map)(function(e){return e.injector.getInjectElement()}),(0,f.uniqBy)("injectorId"))(r);n.forEach(function(e){e.consume(i)})}},{key:"removeRegistration",value:function(e){var t=e.registration;this.registrations=(0,f.without)(t)(this.registrations)}},{key:"registerInjectable",value:function(e){var t=e.injectionId,n=e.injectable,i=this.getRegistration({injectionId:t});(0,f.withoutAll)(i.injectables)([n]).length>0&&(i.injectables=[].concat(r(i.injectables),[n]),this.runInjections({registration:i}))}},{key:"removeInjectable",value:function(e){var t=e.injectionId,n=e.injectable,r=this.getRegistration({injectionId:t}),i=(0,f.without)(n)(r.injectables);0===i.length&&0===r.injections.length?this.removeRegistration({registration:r}):r.injectables=i}},{key:"findInjection",value:function(e){var t=e.registration,n=e.injector;return(0,f.find)(function(e){return Object.is(e.injector,n)})(t.injections)}},{key:"registerInjector",value:function(e){var t=e.injectionId,n=e.injectorId,i=e.injector,o=this.getRegistration({injectionId:t}),c=this.findInjection({registration:o,injector:i});if(!c){var u={injector:i,injectorId:n};o.injections=[].concat(r(o.injections),[u]),this.runInjections({registration:o})}}},{key:"removeInjector",value:function(e){var t=e.injectionId,n=e.injector,r=this.getRegistration({injectionId:t}),i=this.findInjection({registration:r,injector:n});i&&(r.injections=(0,f.without)(i)(r.injections),this.runInjections({registration:r}))}},{key:"render",value:function(){return a.Children.only(this.props.children)}}]),t}(a.Component);s.childContextTypes={registerInjector:a.PropTypes.func.isRequired,removeInjector:a.PropTypes.func.isRequired,registerInjectable:a.PropTypes.func.isRequired,removeInjectable:a.PropTypes.func.isRequired},s.propTypes={children:a.PropTypes.element},t.default=s}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("react-injectables",["react"],t):"object"==typeof exports?exports["react-injectables"]=t(require("react")):e["react-injectables"]=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Injector=t.Injectable=t.InjectablesProvider=void 0;var i=n(5),o=r(i),c=n(4),u=r(c),a=n(6),s=r(a);t.InjectablesProvider=o.default,t.Injectable=u.default,t.Injector=s.default},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);e.length>t;t++)n[t]=e[t];return n}return Array.from(e)}function o(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return function(){if(0===t.length)return arguments.length>0?arguments[0]:void 0;var e=t[t.length-1],n=t.slice(0,-1);return n.reduceRight(function(e,t){return t(e)},e.apply(void 0,arguments))}}function c(e){var t=e.children;return a.Children.only(t)}function u(e,t){var n=0;return t.map(function(t){return n++,s.default.createElement(c,{key:e+"_"+n},t)})}Object.defineProperty(t,"__esModule",{value:!0}),t.find=t.map=t.concatAll=t.containsUniq=t.uniqBy=t.withoutAll=t.without=t.all=t.filter=void 0,t.compose=o,t.keyedElements=u;var a=n(1),s=r(a),f=t.filter=function(e){return function(t){return t.filter(e)}},l=t.all=function(e){return function(t){for(var n=0;t.length>n;n++)if(!e(t[n]))return!1;return!0}},j=(t.without=function(e){return function(t){return f(function(t){return!Object.is(t,e)})(t)}},t.withoutAll=function(e){return function(t){return f(function(t){return l(function(e){return!Object.is(t,e)})(e)})(t)}});t.uniqBy=function(e){return function(t){var n=new Set,r=[];return t.forEach(function(t){var i=t[e];n.has(i)||(n.add(i),r.push(t))}),r}},t.containsUniq=function(e){return function(t){return j(e)(t).length>0}},t.concatAll=function(e){return e.reduce(function(e,t){return[].concat(i(e),i(t))},[])},t.map=function(e){return function(t){return t.map(e)}},t.find=function(e){return function(t){return t.find(e)}}},function(e,t,n){"use strict";var r=function(e,t,n,r,i,o,c,u){if(!e){var a;if(void 0===t)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,i,o,c,u],f=0;a=Error(t.replace(/%s/g,function(){return s[f++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(1),f=r(s),l=n(2),j=0,p=function(e){j++;var t="injectionId_"+j,n=function(n){function r(){var e,t,n,c;i(this,r);for(var u=arguments.length,a=Array(u),s=0;u>s;s++)a[s]=arguments[s];return t=n=o(this,(e=Object.getPrototypeOf(r)).call.apply(e,[this].concat(a))),n.state={injections:[]},n.consume=function(e){(e.length!==n.state.injections.length||(0,l.containsUniq)(n.state.injections,e))&&n.setState({injections:e})},c=t,o(n,c)}return c(r,n),a(r,[{key:"componentWillMount",value:function(){var e=this;this.context.registerInjectable({injectionId:t,injectableInstance:this,receive:function(t){return e.consume(t)}})}},{key:"componentWillUnmount",value:function(){this.context.removeInjectable({injectionId:t,injectableInstance:this})}},{key:"render",value:function(){var t=(0,l.keyedElements)("injections",this.state.injections);return f.default.createElement(e,u({injections:t},this.props))}}]),r}(s.Component);return n.injectionId=t,n.contextTypes={registerInjectable:s.PropTypes.func.isRequired,removeInjectable:s.PropTypes.func.isRequired},n};t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);e.length>t;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(1),f=n(2),l=n(3),j=r(l),p=function(e){function t(e,n){o(this,t);var r=c(this,Object.getPrototypeOf(t).call(this,e,n));return r.registrations=[],r}return u(t,e),a(t,[{key:"getChildContext",value:function(){var e=this;return{registerInjector:function(t){return e.registerInjector(t)},removeInjector:function(t){return e.removeInjector(t)},updateInjector:function(t){return e.updateInjector(t)},registerInjectable:function(t){return e.registerInjectable(t)},removeInjectable:function(t){return e.removeInjectable(t)}}}},{key:"getRegistration",value:function(e){var t=e.injectionId,n=(0,f.find)(function(e){return e.injectionId===t})(this.registrations);return n||(n={injectionId:t,injectables:[],injections:[]},this.registrations.push(n)),n}},{key:"runInjections",value:function(e){var t=e.registration,n=t.injectables,r=t.injections,i=(0,f.compose)((0,f.filter)(function(e){return null!==e&&void 0!==e}),(0,f.map)(function(e){return e.inject()}),(0,f.uniqBy)("injectorId"))(r);n.forEach(function(e){e.receive(i)})}},{key:"removeRegistration",value:function(e){var t=e.registration;this.registrations=(0,f.without)(t)(this.registrations)}},{key:"findInjectable",value:function(e){var t=e.registration,n=e.injectableInstance,r=function(e){return Object.is(e.instance,n)};return(0,f.find)(r)(t.injectables)}},{key:"clearRegistrationIfEmpty",value:function(e){var t=e.registration;0===t.injectables.length&&0===t.injections.length&&this.removeRegistration({registration:t})}},{key:"registerInjectable",value:function(e){var t=e.injectionId,n=e.injectableInstance,r=e.receive,o=this.getRegistration({injectionId:t}),c=this.findInjectable({registration:o,injectableInstance:n});if((0,f.withoutAll)(o.injectables)([c]).length>0){var u={instance:n,receive:r};o.injectables=[].concat(i(o.injectables),[u]),this.runInjections({registration:o})}}},{key:"removeInjectable",value:function(e){var t=e.injectionId,n=e.injectableInstance,r=this.getRegistration({injectionId:t}),i=this.findInjectable({registration:r,injectableInstance:n});r.injectables=(0,f.without)(i)(r.injectables),this.clearRegistrationIfEmpty({registration:r})}},{key:"findInjection",value:function(e){var t=e.registration,n=e.injectorInstance,r=function(e){return Object.is(e.instance,n)};return(0,f.find)(r)(t.injections)}},{key:"findInjector",value:function(e){var t=e.registration,n=e.injectorId,r=function(e){return e.injectorId===n};return(0,f.find)(r)(t.injections)}},{key:"registerInjector",value:function(e){var t=e.injectionId,n=e.injectorId,r=e.injectorInstance,o=e.inject,c=this.getRegistration({injectionId:t}),u=this.findInjection({registration:c,injectorInstance:r});(0,j.default)(!u,"An Injector instance is being registered multiple times.");var a={injectorId:n,instance:r,inject:o};c.injections=[].concat(i(c.injections),[a]),this.runInjections({registration:c})}},{key:"updateInjector",value:function(e){var t=e.injectionId,n=e.injectorInstance,r=e.inject,i=this.getRegistration({injectionId:t}),o=this.findInjection({registration:i,injectorInstance:n});(0,j.default)(o,"Trying to update an Injector that is not registered"),o.inject=r,this.runInjections({registration:i})}},{key:"removeInjector",value:function(e){var t=e.injectionId,n=e.injectorInstance,r=this.getRegistration({injectionId:t}),i=this.findInjection({registration:r,injectorInstance:n});(0,j.default)(!!i,"Trying to remove an injector which has not been registered"),r.injections=(0,f.without)(i)(r.injections),this.runInjections({registration:r}),this.clearRegistrationIfEmpty({registration:r})}},{key:"render",value:function(){return s.Children.only(this.props.children)}}]),t}(s.Component);p.childContextTypes={registerInjector:s.PropTypes.func.isRequired,removeInjector:s.PropTypes.func.isRequired,updateInjector:s.PropTypes.func.isRequired,registerInjectable:s.PropTypes.func.isRequired,removeInjectable:s.PropTypes.func.isRequired},p.propTypes={children:s.PropTypes.element},t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(1),s=r(a),f=n(3),l=r(f),j="Invalid Injectable target. Please provide a Component that has been wrapped Injectable wrapped Component.",p="Invalid injection value provided into Injector. You must supply a Component or stateless Component.",d=0,v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.into;(0,l.default)(t&&"function"==typeof t&&t.injectionId&&t.contextTypes&&t.contextTypes.registerInjectable&&t.contextTypes.removeInjectable,j),d++;var n="injector_"+d;return function(e){(0,l.default)(e&&"function"==typeof e,p);var r=function(r){function a(){return i(this,a),o(this,Object.getPrototypeOf(a).apply(this,arguments))}return c(a,r),u(a,[{key:"componentWillMount",value:function(){var r=this;this.context.registerInjector({injectionId:t.injectionId,injectorId:n,injectorInstance:this,inject:function(){return s.default.createElement(e,r.props)}})}},{key:"componentWillUpdate",value:function(r){this.context.updateInjector({injectionId:t.injectionId,injectorId:n,injectorInstance:this,inject:function(){return s.default.createElement(e,r)}})}},{key:"componentWillUnmount",value:function(){this.context.removeInjector({injectionId:t.injectionId,injectorId:n,injectorInstance:this})}},{key:"render",value:function(){return null}}]),a}(a.Component);return r.contextTypes={registerInjector:a.PropTypes.func.isRequired,updateInjector:a.PropTypes.func.isRequired,removeInjector:a.PropTypes.func.isRequired},r}};t.default=v}])}); \ No newline at end of file diff --git a/package.json b/package.json index a82e32c..7993770 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "babel-core": "6.7.6", "babel-eslint": "6.0.2", "babel-loader": "6.2.4", - "babel-plugin-typecheck": "3.8.0", "babel-preset-es2015": "6.6.0", "babel-preset-react": "6.5.0", "babel-preset-stage-1": "6.5.0",