Comparing version 0.2.0 to 0.2.1
@@ -9,2 +9,6 @@ # Changelog | ||
## 0.2.1 | ||
* `FIX`: correctly parse annotations in async closures | ||
## 0.2.0 | ||
@@ -11,0 +15,0 @@ |
@@ -46,3 +46,3 @@ (function (global, factory) { | ||
var CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARGS = /^(?:async )?function\s*[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARGS = /^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARG = /\/\*([^*]*)\*\//m; | ||
@@ -49,0 +49,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).AsyncDidi={})}(this,function(t){"use strict";var n=/^class /;function e(){var t,n=Array.prototype.slice.call(arguments);1===n.length&&(t=n[0],"[object Array]"===Object.prototype.toString.call(t))&&(n=n[0]);var e=n.pop();return e.$inject=n,e}var r=/constructor\s*[^(]*\(\s*([^)]*)\)/m,o=/^(?:async )?function\s*[^(]*\(\s*([^)]*)\)/m,i=/\/\*([^*]*)\*\//m;function c(t){if("function"!=typeof t)throw new Error('Cannot annotate "'+t+'". Expected a function!');var e=t.toString().match(function(t){return n.test(t.toString())}(t)?r:o);return e&&e[1]&&e[1].split(",").map(function(t){return(e=t.match(i))?e[1].trim():t.trim()})||[]}function a(){var t=[];this.factory=function(n,e){return t.push([n,"factory",e]),this},this.value=function(n,e){return t.push([n,"value",e]),this},this.type=function(n,e){return t.push([n,"type",e]),this},this.forEach=function(n){t.forEach(n)}}function u(t){return"[object Array]"===Object.prototype.toString.call(t)}function f(t,n){return Object.prototype.hasOwnProperty.call(t,n)}t.AsyncInjector=function(t){var n={get:function(t,n){if(r.push(t),!1===n)return null;throw p('No provider for "'+t+'"!')}},r=[],o=this._providers=Object.create(null),i=this._instances=Object.create(null),s=this._loadingInstances=Object.create(null);function p(t){var n=r.join(" -> ");return r.length=0,new Error(n?t+" (Resolving: "+n+")":t)}async function l(t,e){if(!o[t]&&-1!==t.indexOf(".")){for(var c=t.split("."),a=await l(c.shift());c.length;)a=a[c.shift()];return a}if(f(i,t))return i[t];if(f(s,t))return s[t];if(f(o,t)){if(-1!==r.indexOf(t))throw r.push(t),p("Cannot resolve circular dependency!");return r.push(t),s[t]=o[t][0](o[t][1]),i[t]=await s[t],r.pop(),i[t]}return n.get(t,e)}async function h(t,n){if(void 0===n&&(n={}),"function"!=typeof t){if(!u(t))throw new Error('Cannot invoke "'+t+'". Expected a function!');t=e(t.slice())}var r=t.$inject||c(t);return{fn:t,dependencies:await Promise.all(r.map(function(t){return f(n,t)?n[t]:l(t)}))}}async function d(t){var n=await h(t),e=n.fn,r=n.dependencies;return new(Function.prototype.bind.apply(e,[null].concat(r)))}async function y(t,n,e){var r=await h(t,e),o=r.fn,i=r.dependencies;return o.apply(n,i)}i.injector=this;var v={factory:y,type:d,value:function(t){return t}};t.forEach(function(t){function n(t,n){return"value"!==t&&u(n)&&(n=e(n.slice())),n}if(t instanceof a)t.forEach(function(t){var e=t[0],r=t[1],i=t[2];o[e]=[v[r],n(r,i),r]});else if("object"==typeof t){if(t.__exports__)throw new Error("private modules are not supported");Object.keys(t).forEach(function(e){var r=t[e][0],i=t[e][1];o[e]=[v[r],n(r,i),r]})}}),this.get=l,this.invoke=y,this.instantiate=d,this.createChild=function(){throw p("child injectors are not supported")}},t.Module=a,t.annotate=e,t.parseAnnotations=c,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).AsyncDidi={})}(this,function(t){"use strict";var n=/^class /;function e(){var t,n=Array.prototype.slice.call(arguments);1===n.length&&(t=n[0],"[object Array]"===Object.prototype.toString.call(t))&&(n=n[0]);var e=n.pop();return e.$inject=n,e}var r=/constructor\s*[^(]*\(\s*([^)]*)\)/m,o=/^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m,i=/\/\*([^*]*)\*\//m;function c(t){if("function"!=typeof t)throw new Error('Cannot annotate "'+t+'". Expected a function!');var e=t.toString().match(function(t){return n.test(t.toString())}(t)?r:o);return e&&e[1]&&e[1].split(",").map(function(t){return(e=t.match(i))?e[1].trim():t.trim()})||[]}function a(){var t=[];this.factory=function(n,e){return t.push([n,"factory",e]),this},this.value=function(n,e){return t.push([n,"value",e]),this},this.type=function(n,e){return t.push([n,"type",e]),this},this.forEach=function(n){t.forEach(n)}}function u(t){return"[object Array]"===Object.prototype.toString.call(t)}function f(t,n){return Object.prototype.hasOwnProperty.call(t,n)}t.AsyncInjector=function(t){var n={get:function(t,n){if(r.push(t),!1===n)return null;throw p('No provider for "'+t+'"!')}},r=[],o=this._providers=Object.create(null),i=this._instances=Object.create(null),s=this._loadingInstances=Object.create(null);function p(t){var n=r.join(" -> ");return r.length=0,new Error(n?t+" (Resolving: "+n+")":t)}async function l(t,e){if(!o[t]&&-1!==t.indexOf(".")){for(var c=t.split("."),a=await l(c.shift());c.length;)a=a[c.shift()];return a}if(f(i,t))return i[t];if(f(s,t))return s[t];if(f(o,t)){if(-1!==r.indexOf(t))throw r.push(t),p("Cannot resolve circular dependency!");return r.push(t),s[t]=o[t][0](o[t][1]),i[t]=await s[t],r.pop(),i[t]}return n.get(t,e)}async function h(t,n){if(void 0===n&&(n={}),"function"!=typeof t){if(!u(t))throw new Error('Cannot invoke "'+t+'". Expected a function!');t=e(t.slice())}var r=t.$inject||c(t);return{fn:t,dependencies:await Promise.all(r.map(function(t){return f(n,t)?n[t]:l(t)}))}}async function d(t){var n=await h(t),e=n.fn,r=n.dependencies;return new(Function.prototype.bind.apply(e,[null].concat(r)))}async function y(t,n,e){var r=await h(t,e),o=r.fn,i=r.dependencies;return o.apply(n,i)}i.injector=this;var v={factory:y,type:d,value:function(t){return t}};t.forEach(function(t){function n(t,n){return"value"!==t&&u(n)&&(n=e(n.slice())),n}if(t instanceof a)t.forEach(function(t){var e=t[0],r=t[1],i=t[2];o[e]=[v[r],n(r,i),r]});else if("object"==typeof t){if(t.__exports__)throw new Error("private modules are not supported");Object.keys(t).forEach(function(e){var r=t[e][0],i=t[e][1];o[e]=[v[r],n(r,i),r]})}}),this.get=l,this.invoke=y,this.instantiate=d,this.createChild=function(){throw p("child injectors are not supported")}},t.Module=a,t.annotate=e,t.parseAnnotations=c,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -40,3 +40,3 @@ var CLASS_PATTERN = /^class /; | ||
var CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARGS = /^(?:async )?function\s*[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARGS = /^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARG = /\/\*([^*]*)\*\//m; | ||
@@ -43,0 +43,0 @@ |
@@ -44,3 +44,3 @@ 'use strict'; | ||
var CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARGS = /^(?:async )?function\s*[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARGS = /^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m; | ||
var FN_ARG = /\/\*([^*]*)\*\//m; | ||
@@ -47,0 +47,0 @@ |
{ | ||
"name": "async-didi", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Async Dependency Injection for JavaScript", | ||
@@ -32,3 +32,3 @@ "main": "dist/index.js", | ||
"chai": "^4.1.2", | ||
"didi": "^5.2.0", | ||
"didi": "^5.2.1", | ||
"eslint": "^5.6.1", | ||
@@ -35,0 +35,0 @@ "eslint-plugin-bpmn-io": "^0.6.0", |
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
40715