dependency-inject
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -1,1 +0,1 @@ | ||
!function(root,factory){if("object"==typeof exports&&"object"==typeof module)module.exports=factory();else if("function"==typeof define&&define.amd)define([],factory);else{var a=factory();for(var i in a)("object"==typeof exports?exports:root)[i]=a[i]}}(this,function(){return function(modules){function hotDisposeChunk(chunkId){delete installedChunks[chunkId]}function hotDownloadUpdateChunk(chunkId){var head=document.getElementsByTagName("head")[0],script=document.createElement("script");script.type="text/javascript",script.charset="utf-8",script.src=__webpack_require__.p+""+chunkId+"."+hotCurrentHash+".hot-update.js",head.appendChild(script)}function hotDownloadManifest(){return new Promise(function(resolve,reject){if("undefined"==typeof XMLHttpRequest)return reject(new Error("No browser support"));try{var request=new XMLHttpRequest,requestPath=__webpack_require__.p+""+hotCurrentHash+".hot-update.json";request.open("GET",requestPath,!0),request.timeout=1e4,request.send(null)}catch(err){return reject(err)}request.onreadystatechange=function(){if(4===request.readyState)if(0===request.status)reject(new Error("Manifest request to "+requestPath+" timed out."));else if(404===request.status)resolve();else if(200!==request.status&&304!==request.status)reject(new Error("Manifest request to "+requestPath+" failed."));else{try{var update=JSON.parse(request.responseText)}catch(e){return void reject(e)}resolve(update)}}})}function hotCreateRequire(moduleId){var me=installedModules[moduleId];if(!me)return __webpack_require__;var fn=function(request){return me.hot.active?(installedModules[request]?installedModules[request].parents.indexOf(moduleId)<0&&installedModules[request].parents.push(moduleId):(hotCurrentParents=[moduleId],hotCurrentChildModule=request),me.children.indexOf(request)<0&&me.children.push(request)):(console.warn("[HMR] unexpected require("+request+") from disposed module "+moduleId),hotCurrentParents=[]),__webpack_require__(request)};for(var name in __webpack_require__)Object.prototype.hasOwnProperty.call(__webpack_require__,name)&&"e"!==name&&Object.defineProperty(fn,name,function(name){return{configurable:!0,enumerable:!0,get:function(){return __webpack_require__[name]},set:function(value){__webpack_require__[name]=value}}}(name));return fn.e=function(chunkId){function finishChunkLoading(){hotChunksLoading--,"prepare"===hotStatus&&(hotWaitingFilesMap[chunkId]||hotEnsureUpdateChunk(chunkId),0===hotChunksLoading&&0===hotWaitingFiles&&hotUpdateDownloaded())}return"ready"===hotStatus&&hotSetStatus("prepare"),hotChunksLoading++,__webpack_require__.e(chunkId).then(finishChunkLoading,function(err){throw finishChunkLoading(),err})},fn}function hotCreateModule(moduleId){var hot={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:hotCurrentChildModule!==moduleId,active:!0,accept:function(dep,callback){if(void 0===dep)hot._selfAccepted=!0;else if("function"==typeof dep)hot._selfAccepted=dep;else if("object"==typeof dep)for(var i=0;i<dep.length;i++)hot._acceptedDependencies[dep[i]]=callback||function(){};else hot._acceptedDependencies[dep]=callback||function(){}},decline:function(dep){if(void 0===dep)hot._selfDeclined=!0;else if("object"==typeof dep)for(var i=0;i<dep.length;i++)hot._declinedDependencies[dep[i]]=!0;else hot._declinedDependencies[dep]=!0},dispose:function(callback){hot._disposeHandlers.push(callback)},addDisposeHandler:function(callback){hot._disposeHandlers.push(callback)},removeDisposeHandler:function(callback){var idx=hot._disposeHandlers.indexOf(callback);idx>=0&&hot._disposeHandlers.splice(idx,1)},check:hotCheck,apply:hotApply,status:function(l){if(!l)return hotStatus;hotStatusHandlers.push(l)},addStatusHandler:function(l){hotStatusHandlers.push(l)},removeStatusHandler:function(l){var idx=hotStatusHandlers.indexOf(l);idx>=0&&hotStatusHandlers.splice(idx,1)},data:hotCurrentModuleData[moduleId]};return hotCurrentChildModule=void 0,hot}function hotSetStatus(newStatus){hotStatus=newStatus;for(var i=0;i<hotStatusHandlers.length;i++)hotStatusHandlers[i].call(null,newStatus)}function toModuleId(id){return+id+""===id?+id:id}function hotCheck(apply){if("idle"!==hotStatus)throw new Error("check() is only allowed in idle status");return hotApplyOnUpdate=apply,hotSetStatus("check"),hotDownloadManifest().then(function(update){if(!update)return hotSetStatus("idle"),null;hotRequestedFilesMap={},hotWaitingFilesMap={},hotAvailableFilesMap=update.c,hotUpdateNewHash=update.h,hotSetStatus("prepare");var promise=new Promise(function(resolve,reject){hotDeferred={resolve:resolve,reject:reject}});hotUpdate={};return hotEnsureUpdateChunk(0),"prepare"===hotStatus&&0===hotChunksLoading&&0===hotWaitingFiles&&hotUpdateDownloaded(),promise})}function hotAddUpdateChunk(chunkId,moreModules){if(hotAvailableFilesMap[chunkId]&&hotRequestedFilesMap[chunkId]){hotRequestedFilesMap[chunkId]=!1;for(var moduleId in moreModules)Object.prototype.hasOwnProperty.call(moreModules,moduleId)&&(hotUpdate[moduleId]=moreModules[moduleId]);0==--hotWaitingFiles&&0===hotChunksLoading&&hotUpdateDownloaded()}}function hotEnsureUpdateChunk(chunkId){hotAvailableFilesMap[chunkId]?(hotRequestedFilesMap[chunkId]=!0,hotWaitingFiles++,hotDownloadUpdateChunk(chunkId)):hotWaitingFilesMap[chunkId]=!0}function hotUpdateDownloaded(){hotSetStatus("ready");var deferred=hotDeferred;if(hotDeferred=null,deferred)if(hotApplyOnUpdate)hotApply(hotApplyOnUpdate).then(function(result){deferred.resolve(result)},function(err){deferred.reject(err)});else{var outdatedModules=[];for(var id in hotUpdate)Object.prototype.hasOwnProperty.call(hotUpdate,id)&&outdatedModules.push(toModuleId(id));deferred.resolve(outdatedModules)}}function hotApply(options){function addAllToSet(a,b){for(var i=0;i<b.length;i++){var item=b[i];a.indexOf(item)<0&&a.push(item)}}if("ready"!==hotStatus)throw new Error("apply() is only allowed in ready status");options=options||{};var cb,i,j,module,moduleId,outdatedDependencies={},outdatedModules=[],appliedUpdate={},warnUnexpectedRequire=function(){console.warn("[HMR] unexpected require("+result.moduleId+") to disposed module")};for(var id in hotUpdate)if(Object.prototype.hasOwnProperty.call(hotUpdate,id)){moduleId=toModuleId(id);var result;result=hotUpdate[id]?function(updateModuleId){for(var outdatedModules=[updateModuleId],outdatedDependencies={},queue=outdatedModules.slice().map(function(id){return{chain:[id],id:id}});queue.length>0;){var queueItem=queue.pop(),moduleId=queueItem.id,chain=queueItem.chain;if((module=installedModules[moduleId])&&!module.hot._selfAccepted){if(module.hot._selfDeclined)return{type:"self-declined",chain:chain,moduleId:moduleId};if(module.hot._main)return{type:"unaccepted",chain:chain,moduleId:moduleId};for(var i=0;i<module.parents.length;i++){var parentId=module.parents[i],parent=installedModules[parentId];if(parent){if(parent.hot._declinedDependencies[moduleId])return{type:"declined",chain:chain.concat([parentId]),moduleId:moduleId,parentId:parentId};outdatedModules.indexOf(parentId)>=0||(parent.hot._acceptedDependencies[moduleId]?(outdatedDependencies[parentId]||(outdatedDependencies[parentId]=[]),addAllToSet(outdatedDependencies[parentId],[moduleId])):(delete outdatedDependencies[parentId],outdatedModules.push(parentId),queue.push({chain:chain.concat([parentId]),id:parentId})))}}}}return{type:"accepted",moduleId:updateModuleId,outdatedModules:outdatedModules,outdatedDependencies:outdatedDependencies}}(moduleId):{type:"disposed",moduleId:id};var abortError=!1,doApply=!1,doDispose=!1,chainInfo="";switch(result.chain&&(chainInfo="\nUpdate propagation: "+result.chain.join(" -> ")),result.type){case"self-declined":options.onDeclined&&options.onDeclined(result),options.ignoreDeclined||(abortError=new Error("Aborted because of self decline: "+result.moduleId+chainInfo));break;case"declined":options.onDeclined&&options.onDeclined(result),options.ignoreDeclined||(abortError=new Error("Aborted because of declined dependency: "+result.moduleId+" in "+result.parentId+chainInfo));break;case"unaccepted":options.onUnaccepted&&options.onUnaccepted(result),options.ignoreUnaccepted||(abortError=new Error("Aborted because "+moduleId+" is not accepted"+chainInfo));break;case"accepted":options.onAccepted&&options.onAccepted(result),doApply=!0;break;case"disposed":options.onDisposed&&options.onDisposed(result),doDispose=!0;break;default:throw new Error("Unexception type "+result.type)}if(abortError)return hotSetStatus("abort"),Promise.reject(abortError);if(doApply){appliedUpdate[moduleId]=hotUpdate[moduleId],addAllToSet(outdatedModules,result.outdatedModules);for(moduleId in result.outdatedDependencies)Object.prototype.hasOwnProperty.call(result.outdatedDependencies,moduleId)&&(outdatedDependencies[moduleId]||(outdatedDependencies[moduleId]=[]),addAllToSet(outdatedDependencies[moduleId],result.outdatedDependencies[moduleId]))}doDispose&&(addAllToSet(outdatedModules,[result.moduleId]),appliedUpdate[moduleId]=warnUnexpectedRequire)}var outdatedSelfAcceptedModules=[];for(i=0;i<outdatedModules.length;i++)moduleId=outdatedModules[i],installedModules[moduleId]&&installedModules[moduleId].hot._selfAccepted&&outdatedSelfAcceptedModules.push({module:moduleId,errorHandler:installedModules[moduleId].hot._selfAccepted});hotSetStatus("dispose"),Object.keys(hotAvailableFilesMap).forEach(function(chunkId){!1===hotAvailableFilesMap[chunkId]&&hotDisposeChunk(chunkId)});for(var idx,queue=outdatedModules.slice();queue.length>0;)if(moduleId=queue.pop(),module=installedModules[moduleId]){var data={},disposeHandlers=module.hot._disposeHandlers;for(j=0;j<disposeHandlers.length;j++)(cb=disposeHandlers[j])(data);for(hotCurrentModuleData[moduleId]=data,module.hot.active=!1,delete installedModules[moduleId],j=0;j<module.children.length;j++){var child=installedModules[module.children[j]];child&&((idx=child.parents.indexOf(moduleId))>=0&&child.parents.splice(idx,1))}}var dependency,moduleOutdatedDependencies;for(moduleId in outdatedDependencies)if(Object.prototype.hasOwnProperty.call(outdatedDependencies,moduleId)&&(module=installedModules[moduleId]))for(moduleOutdatedDependencies=outdatedDependencies[moduleId],j=0;j<moduleOutdatedDependencies.length;j++)dependency=moduleOutdatedDependencies[j],(idx=module.children.indexOf(dependency))>=0&&module.children.splice(idx,1);hotSetStatus("apply"),hotCurrentHash=hotUpdateNewHash;for(moduleId in appliedUpdate)Object.prototype.hasOwnProperty.call(appliedUpdate,moduleId)&&(modules[moduleId]=appliedUpdate[moduleId]);var error=null;for(moduleId in outdatedDependencies)if(Object.prototype.hasOwnProperty.call(outdatedDependencies,moduleId)){module=installedModules[moduleId],moduleOutdatedDependencies=outdatedDependencies[moduleId];var callbacks=[];for(i=0;i<moduleOutdatedDependencies.length;i++)dependency=moduleOutdatedDependencies[i],cb=module.hot._acceptedDependencies[dependency],callbacks.indexOf(cb)>=0||callbacks.push(cb);for(i=0;i<callbacks.length;i++){cb=callbacks[i];try{cb(moduleOutdatedDependencies)}catch(err){options.onErrored&&options.onErrored({type:"accept-errored",moduleId:moduleId,dependencyId:moduleOutdatedDependencies[i],error:err}),options.ignoreErrored||error||(error=err)}}}for(i=0;i<outdatedSelfAcceptedModules.length;i++){var item=outdatedSelfAcceptedModules[i];moduleId=item.module,hotCurrentParents=[moduleId];try{__webpack_require__(moduleId)}catch(err){if("function"==typeof item.errorHandler)try{item.errorHandler(err)}catch(err2){options.onErrored&&options.onErrored({type:"self-accept-error-handler-errored",moduleId:moduleId,error:err2,orginalError:err}),options.ignoreErrored||error||(error=err2),error||(error=err)}else options.onErrored&&options.onErrored({type:"self-accept-errored",moduleId:moduleId,error:err}),options.ignoreErrored||error||(error=err)}}return error?(hotSetStatus("fail"),Promise.reject(error)):(hotSetStatus("idle"),new Promise(function(resolve){resolve(outdatedModules)}))}function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{},hot:hotCreateModule(moduleId),parents:(hotCurrentParentsTemp=hotCurrentParents,hotCurrentParents=[],hotCurrentParentsTemp),children:[]};return modules[moduleId].call(module.exports,module,module.exports,hotCreateRequire(moduleId)),module.l=!0,module.exports}var parentHotUpdateCallback=this.webpackHotUpdate;this.webpackHotUpdate=function(chunkId,moreModules){hotAddUpdateChunk(chunkId,moreModules),parentHotUpdateCallback&&parentHotUpdateCallback(chunkId,moreModules)};var hotCurrentChildModule,hotDeferred,hotUpdate,hotUpdateNewHash,hotApplyOnUpdate=!0,hotCurrentHash="abf804c7b7ed568c663f",hotCurrentModuleData={},hotCurrentParents=[],hotCurrentParentsTemp=[],hotStatusHandlers=[],hotStatus="idle",hotWaitingFiles=0,hotChunksLoading=0,hotWaitingFilesMap={},hotRequestedFilesMap={},hotAvailableFilesMap={},installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.i=function(value){return value},__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__.h=function(){return hotCurrentHash},hotCreateRequire(3)(__webpack_require__.s=3)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.injectSymbol=Symbol()},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i.return&&_i.return()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}();Object.defineProperty(exports,"__esModule",{value:!0});var handlers_1=__webpack_require__(0),Container=function(){function Container(){_classCallCheck(this,Container),this.instances=new WeakMap}return _createClass(Container,[{key:"set",value:function(setClass,instance){this.instances.has(setClass)||this.instances.set(setClass,instance)}},{key:"get",value:function(getClass){var _this=this;if(!this.instances.has(getClass))throw new Error(getClass.name+" 未注册。先使用 set 方法注册,再使用 get 获取");var instance=this.instances.get(getClass);if(!instance[handlers_1.injectSymbol])return instance;var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=instance[handlers_1.injectSymbol][Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0)!function(){var _step$value=_slicedToArray(_step.value,2),propertyKey=_step$value[0],injectClass=_step$value[1];Object.defineProperty(instance,propertyKey,{enumerable:!0,configurable:!0,get:function(){return _this.instances.get(injectClass)},set:function(newValue){instance.propertyKey=newValue}})}()}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{!_iteratorNormalCompletion&&_iterator.return&&_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}return instance}}]),Container}();exports.default=Container},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var handlers_1=__webpack_require__(0);exports.default=function(injectClass){return function(target,propertyKey,descriptor){descriptor.enumerable=!0,descriptor.configurable=!0,descriptor.writable=!0,target[handlers_1.injectSymbol]||Object.defineProperty(target,handlers_1.injectSymbol,{enumerable:!0,configurable:!0,value:new Map}),target[handlers_1.injectSymbol].set(propertyKey,injectClass)}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var container_1=__webpack_require__(1);exports.Container=container_1.default;var decorators_1=__webpack_require__(2);exports.inject=decorators_1.default}])}); | ||
!function(root,factory){if("object"==typeof exports&&"object"==typeof module)module.exports=factory();else if("function"==typeof define&&define.amd)define([],factory);else{var a=factory();for(var i in a)("object"==typeof exports?exports:root)[i]=a[i]}}(this,function(){return function(modules){function hotDisposeChunk(chunkId){delete installedChunks[chunkId]}function hotDownloadUpdateChunk(chunkId){var head=document.getElementsByTagName("head")[0],script=document.createElement("script");script.type="text/javascript",script.charset="utf-8",script.src=__webpack_require__.p+""+chunkId+"."+hotCurrentHash+".hot-update.js",head.appendChild(script)}function hotDownloadManifest(){return new Promise(function(resolve,reject){if("undefined"==typeof XMLHttpRequest)return reject(new Error("No browser support"));try{var request=new XMLHttpRequest,requestPath=__webpack_require__.p+""+hotCurrentHash+".hot-update.json";request.open("GET",requestPath,!0),request.timeout=1e4,request.send(null)}catch(err){return reject(err)}request.onreadystatechange=function(){if(4===request.readyState)if(0===request.status)reject(new Error("Manifest request to "+requestPath+" timed out."));else if(404===request.status)resolve();else if(200!==request.status&&304!==request.status)reject(new Error("Manifest request to "+requestPath+" failed."));else{try{var update=JSON.parse(request.responseText)}catch(e){return void reject(e)}resolve(update)}}})}function hotCreateRequire(moduleId){var me=installedModules[moduleId];if(!me)return __webpack_require__;var fn=function(request){return me.hot.active?(installedModules[request]?installedModules[request].parents.indexOf(moduleId)<0&&installedModules[request].parents.push(moduleId):(hotCurrentParents=[moduleId],hotCurrentChildModule=request),me.children.indexOf(request)<0&&me.children.push(request)):(console.warn("[HMR] unexpected require("+request+") from disposed module "+moduleId),hotCurrentParents=[]),__webpack_require__(request)};for(var name in __webpack_require__)Object.prototype.hasOwnProperty.call(__webpack_require__,name)&&"e"!==name&&Object.defineProperty(fn,name,function(name){return{configurable:!0,enumerable:!0,get:function(){return __webpack_require__[name]},set:function(value){__webpack_require__[name]=value}}}(name));return fn.e=function(chunkId){function finishChunkLoading(){hotChunksLoading--,"prepare"===hotStatus&&(hotWaitingFilesMap[chunkId]||hotEnsureUpdateChunk(chunkId),0===hotChunksLoading&&0===hotWaitingFiles&&hotUpdateDownloaded())}return"ready"===hotStatus&&hotSetStatus("prepare"),hotChunksLoading++,__webpack_require__.e(chunkId).then(finishChunkLoading,function(err){throw finishChunkLoading(),err})},fn}function hotCreateModule(moduleId){var hot={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:hotCurrentChildModule!==moduleId,active:!0,accept:function(dep,callback){if(void 0===dep)hot._selfAccepted=!0;else if("function"==typeof dep)hot._selfAccepted=dep;else if("object"==typeof dep)for(var i=0;i<dep.length;i++)hot._acceptedDependencies[dep[i]]=callback||function(){};else hot._acceptedDependencies[dep]=callback||function(){}},decline:function(dep){if(void 0===dep)hot._selfDeclined=!0;else if("object"==typeof dep)for(var i=0;i<dep.length;i++)hot._declinedDependencies[dep[i]]=!0;else hot._declinedDependencies[dep]=!0},dispose:function(callback){hot._disposeHandlers.push(callback)},addDisposeHandler:function(callback){hot._disposeHandlers.push(callback)},removeDisposeHandler:function(callback){var idx=hot._disposeHandlers.indexOf(callback);idx>=0&&hot._disposeHandlers.splice(idx,1)},check:hotCheck,apply:hotApply,status:function(l){if(!l)return hotStatus;hotStatusHandlers.push(l)},addStatusHandler:function(l){hotStatusHandlers.push(l)},removeStatusHandler:function(l){var idx=hotStatusHandlers.indexOf(l);idx>=0&&hotStatusHandlers.splice(idx,1)},data:hotCurrentModuleData[moduleId]};return hotCurrentChildModule=void 0,hot}function hotSetStatus(newStatus){hotStatus=newStatus;for(var i=0;i<hotStatusHandlers.length;i++)hotStatusHandlers[i].call(null,newStatus)}function toModuleId(id){return+id+""===id?+id:id}function hotCheck(apply){if("idle"!==hotStatus)throw new Error("check() is only allowed in idle status");return hotApplyOnUpdate=apply,hotSetStatus("check"),hotDownloadManifest().then(function(update){if(!update)return hotSetStatus("idle"),null;hotRequestedFilesMap={},hotWaitingFilesMap={},hotAvailableFilesMap=update.c,hotUpdateNewHash=update.h,hotSetStatus("prepare");var promise=new Promise(function(resolve,reject){hotDeferred={resolve:resolve,reject:reject}});hotUpdate={};return hotEnsureUpdateChunk(0),"prepare"===hotStatus&&0===hotChunksLoading&&0===hotWaitingFiles&&hotUpdateDownloaded(),promise})}function hotAddUpdateChunk(chunkId,moreModules){if(hotAvailableFilesMap[chunkId]&&hotRequestedFilesMap[chunkId]){hotRequestedFilesMap[chunkId]=!1;for(var moduleId in moreModules)Object.prototype.hasOwnProperty.call(moreModules,moduleId)&&(hotUpdate[moduleId]=moreModules[moduleId]);0==--hotWaitingFiles&&0===hotChunksLoading&&hotUpdateDownloaded()}}function hotEnsureUpdateChunk(chunkId){hotAvailableFilesMap[chunkId]?(hotRequestedFilesMap[chunkId]=!0,hotWaitingFiles++,hotDownloadUpdateChunk(chunkId)):hotWaitingFilesMap[chunkId]=!0}function hotUpdateDownloaded(){hotSetStatus("ready");var deferred=hotDeferred;if(hotDeferred=null,deferred)if(hotApplyOnUpdate)hotApply(hotApplyOnUpdate).then(function(result){deferred.resolve(result)},function(err){deferred.reject(err)});else{var outdatedModules=[];for(var id in hotUpdate)Object.prototype.hasOwnProperty.call(hotUpdate,id)&&outdatedModules.push(toModuleId(id));deferred.resolve(outdatedModules)}}function hotApply(options){function addAllToSet(a,b){for(var i=0;i<b.length;i++){var item=b[i];a.indexOf(item)<0&&a.push(item)}}if("ready"!==hotStatus)throw new Error("apply() is only allowed in ready status");options=options||{};var cb,i,j,module,moduleId,outdatedDependencies={},outdatedModules=[],appliedUpdate={},warnUnexpectedRequire=function(){console.warn("[HMR] unexpected require("+result.moduleId+") to disposed module")};for(var id in hotUpdate)if(Object.prototype.hasOwnProperty.call(hotUpdate,id)){moduleId=toModuleId(id);var result;result=hotUpdate[id]?function(updateModuleId){for(var outdatedModules=[updateModuleId],outdatedDependencies={},queue=outdatedModules.slice().map(function(id){return{chain:[id],id:id}});queue.length>0;){var queueItem=queue.pop(),moduleId=queueItem.id,chain=queueItem.chain;if((module=installedModules[moduleId])&&!module.hot._selfAccepted){if(module.hot._selfDeclined)return{type:"self-declined",chain:chain,moduleId:moduleId};if(module.hot._main)return{type:"unaccepted",chain:chain,moduleId:moduleId};for(var i=0;i<module.parents.length;i++){var parentId=module.parents[i],parent=installedModules[parentId];if(parent){if(parent.hot._declinedDependencies[moduleId])return{type:"declined",chain:chain.concat([parentId]),moduleId:moduleId,parentId:parentId};outdatedModules.indexOf(parentId)>=0||(parent.hot._acceptedDependencies[moduleId]?(outdatedDependencies[parentId]||(outdatedDependencies[parentId]=[]),addAllToSet(outdatedDependencies[parentId],[moduleId])):(delete outdatedDependencies[parentId],outdatedModules.push(parentId),queue.push({chain:chain.concat([parentId]),id:parentId})))}}}}return{type:"accepted",moduleId:updateModuleId,outdatedModules:outdatedModules,outdatedDependencies:outdatedDependencies}}(moduleId):{type:"disposed",moduleId:id};var abortError=!1,doApply=!1,doDispose=!1,chainInfo="";switch(result.chain&&(chainInfo="\nUpdate propagation: "+result.chain.join(" -> ")),result.type){case"self-declined":options.onDeclined&&options.onDeclined(result),options.ignoreDeclined||(abortError=new Error("Aborted because of self decline: "+result.moduleId+chainInfo));break;case"declined":options.onDeclined&&options.onDeclined(result),options.ignoreDeclined||(abortError=new Error("Aborted because of declined dependency: "+result.moduleId+" in "+result.parentId+chainInfo));break;case"unaccepted":options.onUnaccepted&&options.onUnaccepted(result),options.ignoreUnaccepted||(abortError=new Error("Aborted because "+moduleId+" is not accepted"+chainInfo));break;case"accepted":options.onAccepted&&options.onAccepted(result),doApply=!0;break;case"disposed":options.onDisposed&&options.onDisposed(result),doDispose=!0;break;default:throw new Error("Unexception type "+result.type)}if(abortError)return hotSetStatus("abort"),Promise.reject(abortError);if(doApply){appliedUpdate[moduleId]=hotUpdate[moduleId],addAllToSet(outdatedModules,result.outdatedModules);for(moduleId in result.outdatedDependencies)Object.prototype.hasOwnProperty.call(result.outdatedDependencies,moduleId)&&(outdatedDependencies[moduleId]||(outdatedDependencies[moduleId]=[]),addAllToSet(outdatedDependencies[moduleId],result.outdatedDependencies[moduleId]))}doDispose&&(addAllToSet(outdatedModules,[result.moduleId]),appliedUpdate[moduleId]=warnUnexpectedRequire)}var outdatedSelfAcceptedModules=[];for(i=0;i<outdatedModules.length;i++)moduleId=outdatedModules[i],installedModules[moduleId]&&installedModules[moduleId].hot._selfAccepted&&outdatedSelfAcceptedModules.push({module:moduleId,errorHandler:installedModules[moduleId].hot._selfAccepted});hotSetStatus("dispose"),Object.keys(hotAvailableFilesMap).forEach(function(chunkId){!1===hotAvailableFilesMap[chunkId]&&hotDisposeChunk(chunkId)});for(var idx,queue=outdatedModules.slice();queue.length>0;)if(moduleId=queue.pop(),module=installedModules[moduleId]){var data={},disposeHandlers=module.hot._disposeHandlers;for(j=0;j<disposeHandlers.length;j++)(cb=disposeHandlers[j])(data);for(hotCurrentModuleData[moduleId]=data,module.hot.active=!1,delete installedModules[moduleId],j=0;j<module.children.length;j++){var child=installedModules[module.children[j]];child&&((idx=child.parents.indexOf(moduleId))>=0&&child.parents.splice(idx,1))}}var dependency,moduleOutdatedDependencies;for(moduleId in outdatedDependencies)if(Object.prototype.hasOwnProperty.call(outdatedDependencies,moduleId)&&(module=installedModules[moduleId]))for(moduleOutdatedDependencies=outdatedDependencies[moduleId],j=0;j<moduleOutdatedDependencies.length;j++)dependency=moduleOutdatedDependencies[j],(idx=module.children.indexOf(dependency))>=0&&module.children.splice(idx,1);hotSetStatus("apply"),hotCurrentHash=hotUpdateNewHash;for(moduleId in appliedUpdate)Object.prototype.hasOwnProperty.call(appliedUpdate,moduleId)&&(modules[moduleId]=appliedUpdate[moduleId]);var error=null;for(moduleId in outdatedDependencies)if(Object.prototype.hasOwnProperty.call(outdatedDependencies,moduleId)){module=installedModules[moduleId],moduleOutdatedDependencies=outdatedDependencies[moduleId];var callbacks=[];for(i=0;i<moduleOutdatedDependencies.length;i++)dependency=moduleOutdatedDependencies[i],cb=module.hot._acceptedDependencies[dependency],callbacks.indexOf(cb)>=0||callbacks.push(cb);for(i=0;i<callbacks.length;i++){cb=callbacks[i];try{cb(moduleOutdatedDependencies)}catch(err){options.onErrored&&options.onErrored({type:"accept-errored",moduleId:moduleId,dependencyId:moduleOutdatedDependencies[i],error:err}),options.ignoreErrored||error||(error=err)}}}for(i=0;i<outdatedSelfAcceptedModules.length;i++){var item=outdatedSelfAcceptedModules[i];moduleId=item.module,hotCurrentParents=[moduleId];try{__webpack_require__(moduleId)}catch(err){if("function"==typeof item.errorHandler)try{item.errorHandler(err)}catch(err2){options.onErrored&&options.onErrored({type:"self-accept-error-handler-errored",moduleId:moduleId,error:err2,orginalError:err}),options.ignoreErrored||error||(error=err2),error||(error=err)}else options.onErrored&&options.onErrored({type:"self-accept-errored",moduleId:moduleId,error:err}),options.ignoreErrored||error||(error=err)}}return error?(hotSetStatus("fail"),Promise.reject(error)):(hotSetStatus("idle"),new Promise(function(resolve){resolve(outdatedModules)}))}function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{},hot:hotCreateModule(moduleId),parents:(hotCurrentParentsTemp=hotCurrentParents,hotCurrentParents=[],hotCurrentParentsTemp),children:[]};return modules[moduleId].call(module.exports,module,module.exports,hotCreateRequire(moduleId)),module.l=!0,module.exports}var parentHotUpdateCallback=this.webpackHotUpdate;this.webpackHotUpdate=function(chunkId,moreModules){hotAddUpdateChunk(chunkId,moreModules),parentHotUpdateCallback&&parentHotUpdateCallback(chunkId,moreModules)};var hotCurrentChildModule,hotDeferred,hotUpdate,hotUpdateNewHash,hotApplyOnUpdate=!0,hotCurrentHash="b72fa1f32c1db094bc26",hotCurrentModuleData={},hotCurrentParents=[],hotCurrentParentsTemp=[],hotStatusHandlers=[],hotStatus="idle",hotWaitingFiles=0,hotChunksLoading=0,hotWaitingFilesMap={},hotRequestedFilesMap={},hotAvailableFilesMap={},installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.i=function(value){return value},__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__.h=function(){return hotCurrentHash},hotCreateRequire(3)(__webpack_require__.s=3)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.injectSymbol=Symbol()},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i.return&&_i.return()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}();Object.defineProperty(exports,"__esModule",{value:!0});var handlers_1=__webpack_require__(0),Container=function(){function Container(){_classCallCheck(this,Container),this.instances=new WeakMap}return _createClass(Container,[{key:"set",value:function(setClass,instance){this.instances.has(setClass)||this.instances.set(setClass,instance)}},{key:"get",value:function(getClass){var _this=this;if(!this.instances.has(getClass))throw new Error(getClass.name+" 未注册。先使用 set 方法注册,再使用 get 获取");var instance=this.instances.get(getClass);if(!instance[handlers_1.injectSymbol])return instance;var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=instance[handlers_1.injectSymbol][Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0)!function(){var _step$value=_slicedToArray(_step.value,2),propertyKey=_step$value[0],injectClass=_step$value[1];Object.defineProperty(instance,propertyKey,{enumerable:!0,configurable:!0,get:function(){return _this.instances.get(injectClass)},set:function(newValue){instance.propertyKey=newValue}})}()}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{!_iteratorNormalCompletion&&_iterator.return&&_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}return instance}}]),Container}();exports.default=Container},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var handlers_1=__webpack_require__(0);exports.default=function(injectClass){return function(target,propertyKey,descriptor){descriptor&&(descriptor.enumerable=!0,descriptor.configurable=!0,descriptor.writable=!0),target[handlers_1.injectSymbol]||Object.defineProperty(target,handlers_1.injectSymbol,{enumerable:!0,configurable:!0,value:new Map}),target[handlers_1.injectSymbol].set(propertyKey,injectClass)}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var container_1=__webpack_require__(1);exports.Container=container_1.default;var decorators_1=__webpack_require__(2);exports.inject=decorators_1.default}])}); |
@@ -7,5 +7,7 @@ "use strict"; | ||
return function (target, propertyKey, descriptor) { | ||
descriptor.enumerable = true; | ||
descriptor.configurable = true; | ||
descriptor.writable = true; | ||
if (descriptor) { | ||
descriptor.enumerable = true; | ||
descriptor.configurable = true; | ||
descriptor.writable = true; | ||
} | ||
if (!target[handlers_1.injectSymbol]) { | ||
@@ -12,0 +14,0 @@ Object.defineProperty(target, handlers_1.injectSymbol, { |
{ | ||
"name": "dependency-inject", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "built/index.js", |
import { injectSymbol } from './handlers' | ||
export default <T>(injectClass: T) => (target: any, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => { | ||
descriptor.enumerable = true | ||
descriptor.configurable = true | ||
descriptor.writable = true | ||
// fix babel 无法 definePropery 的问题 | ||
if (descriptor) { | ||
descriptor.enumerable = true | ||
descriptor.configurable = true | ||
descriptor.writable = true | ||
} | ||
@@ -8,0 +11,0 @@ // 这个字段用来存储所有可能从注入中获取的数据 |
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
177223
346