@prostojs/mate 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mate.cjs.prod.js
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
function getConstructor(instance) {
|
|
6
|
+
return isConstructor(instance) ?
|
|
7
|
+
instance : instance.constructor ?
|
|
8
|
+
instance.constructor : Object.getPrototypeOf(instance).constructor;
|
|
9
|
+
}
|
|
10
|
+
function isConstructor(v) {
|
|
11
|
+
return typeof v === 'function' && Object.getOwnPropertyNames(v).includes('prototype') && !Object.getOwnPropertyNames(v).includes('caller') && !!v.name;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
const banner = () => `[prostojs/mate][${new Date().toISOString().replace('T', ' ').replace(/\.\d{3}z$/i, '')}] `;
|
|
6
15
|
|
|
7
16
|
function logError(error) {
|
|
@@ -13,16 +22,6 @@ function panic(error) {
|
|
|
13
22
|
return new Error(error);
|
|
14
23
|
}
|
|
15
24
|
|
|
16
|
-
function getConstructor(instance) {
|
|
17
|
-
return isConstructor(instance) ?
|
|
18
|
-
instance : instance.constructor ?
|
|
19
|
-
instance.constructor : Object.getPrototypeOf(instance).constructor;
|
|
20
|
-
}
|
|
21
|
-
function isConstructor(v) {
|
|
22
|
-
return typeof v === 'function' && Object.getOwnPropertyNames(v).includes('prototype') && !Object.getOwnPropertyNames(v).includes('caller') && !!v.name;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
require('./reflect');
|
|
26
25
|
class Mate {
|
|
27
26
|
constructor(workspace, options = {}) {
|
|
28
27
|
this.workspace = workspace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t){
|
|
1
|
+
function t(t){return e(t)?t:t.constructor?t.constructor:Object.getPrototypeOf(t).constructor}function e(t){return"function"==typeof t&&Object.getOwnPropertyNames(t).includes("prototype")&&!Object.getOwnPropertyNames(t).includes("caller")&&!!t.name}function r(t){console.error(`[91m[1m[prostojs/mate][${(new Date).toISOString().replace("T"," ").replace(/\.\d{3}z$/i,"")}] `+t+"[0m")}class o{constructor(t,e={}){this.workspace=t,this.options=e}set(t,e,o,a){var n;let p=Reflect.getOwnMetadata(this.workspace,t.target,t.propKey)||{};t.propKey&&this.options.readReturnType&&!p.returnType&&(p.returnType=Reflect.getOwnMetadata("design:returntype",t.target,t.propKey)),t.propKey&&this.options.readType&&!p.type&&(p.type=Reflect.getOwnMetadata("design:type",t.target,t.propKey));const{index:s}=t,i="function"==typeof e?e:void 0;let c=p;if(c.params||(c.params=null===(n=Reflect.getOwnMetadata("design:paramtypes",t.target,t.propKey))||void 0===n?void 0:n.map((t=>({type:t})))),"number"==typeof s&&(c.params=c.params||[],c.params[s]=c.params[s]||{type:void 0},i?c.params[s]=i(c.params[s]):c=c.params[s]),"function"!=typeof e)if(a){const t=c[e]||[];Array.isArray(t)||(r(y="Mate.add (isArray=true) called for non-array metadata"),new Error(y)),t.unshift(o),c[e]=t}else c[e]=o;else i&&"number"!=typeof s&&(p=i(c));var y;Reflect.defineMetadata(this.workspace,p,t.target,t.propKey)}read(r,o){const n=e(r)?r:t(r);let p=Reflect.getOwnMetadata(this.workspace,"string"==typeof o?n.prototype:n,o);if(this.options.inherit){const t="function"==typeof this.options.inherit?this.options.inherit:void 0;let e=this.options.inherit;if(t)if("string"==typeof o){e=t(Reflect.getOwnMetadata(this.workspace,n),o,p)}else e=t(p);if(e){const t=Object.getPrototypeOf(n);if("function"==typeof t&&t!==a&&t!==n){p={...this.read(t,o),...p,params:null==p?void 0:p.params}}}}return p}apply(...t){return(e,r,o)=>{for(const a of t)a(e,r,o)}}decorate(t,e,r){return(o,a,n)=>{this.set({target:o,propKey:a,descriptor:"number"==typeof n?void 0:n,index:"number"==typeof n?n:void 0},t,e,r)}}}const a=Object.getPrototypeOf(Function);export{o as Mate,t as getConstructor,e as isConstructor};
|
package/dist/mate.esm-bundler.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
function getConstructor(instance) {
|
|
2
|
+
return isConstructor(instance) ?
|
|
3
|
+
instance : instance.constructor ?
|
|
4
|
+
instance.constructor : Object.getPrototypeOf(instance).constructor;
|
|
5
|
+
}
|
|
6
|
+
function isConstructor(v) {
|
|
7
|
+
return typeof v === 'function' && Object.getOwnPropertyNames(v).includes('prototype') && !Object.getOwnPropertyNames(v).includes('caller') && !!v.name;
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
const banner = () => `[prostojs/mate][${new Date().toISOString().replace('T', ' ').replace(/\.\d{3}z$/i, '')}] `;
|
|
2
11
|
|
|
3
12
|
function logError(error) {
|
|
@@ -9,16 +18,6 @@ function panic(error) {
|
|
|
9
18
|
return new Error(error);
|
|
10
19
|
}
|
|
11
20
|
|
|
12
|
-
function getConstructor(instance) {
|
|
13
|
-
return isConstructor(instance) ?
|
|
14
|
-
instance : instance.constructor ?
|
|
15
|
-
instance.constructor : Object.getPrototypeOf(instance).constructor;
|
|
16
|
-
}
|
|
17
|
-
function isConstructor(v) {
|
|
18
|
-
return typeof v === 'function' && Object.getOwnPropertyNames(v).includes('prototype') && !Object.getOwnPropertyNames(v).includes('caller') && !!v.name;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
require('./reflect');
|
|
22
21
|
class Mate {
|
|
23
22
|
constructor(workspace, options = {}) {
|
|
24
23
|
this.workspace = workspace;
|
package/dist/mate.global.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ProstoMate=function(t){"use strict";function e(t){
|
|
1
|
+
var ProstoMate=function(t){"use strict";function e(t){return r(t)?t:t.constructor?t.constructor:Object.getPrototypeOf(t).constructor}function r(t){return"function"==typeof t&&Object.getOwnPropertyNames(t).includes("prototype")&&!Object.getOwnPropertyNames(t).includes("caller")&&!!t.name}function o(t){console.error(`[91m[1m[prostojs/mate][${(new Date).toISOString().replace("T"," ").replace(/\.\d{3}z$/i,"")}] `+t+"[0m")}const a=Object.getPrototypeOf(Function);return t.Mate=class{constructor(t,e={}){this.workspace=t,this.options=e}set(t,e,r,a){var n;let p=Reflect.getOwnMetadata(this.workspace,t.target,t.propKey)||{};t.propKey&&this.options.readReturnType&&!p.returnType&&(p.returnType=Reflect.getOwnMetadata("design:returntype",t.target,t.propKey)),t.propKey&&this.options.readType&&!p.type&&(p.type=Reflect.getOwnMetadata("design:type",t.target,t.propKey));const{index:s}=t,i="function"==typeof e?e:void 0;let c=p;if(c.params||(c.params=null===(n=Reflect.getOwnMetadata("design:paramtypes",t.target,t.propKey))||void 0===n?void 0:n.map((t=>({type:t})))),"number"==typeof s&&(c.params=c.params||[],c.params[s]=c.params[s]||{type:void 0},i?c.params[s]=i(c.params[s]):c=c.params[s]),"function"!=typeof e)if(a){const t=c[e]||[];Array.isArray(t)||(o(f="Mate.add (isArray=true) called for non-array metadata"),new Error(f)),t.unshift(r),c[e]=t}else c[e]=r;else i&&"number"!=typeof s&&(p=i(c));var f;Reflect.defineMetadata(this.workspace,p,t.target,t.propKey)}read(t,o){const n=r(t)?t:e(t);let p=Reflect.getOwnMetadata(this.workspace,"string"==typeof o?n.prototype:n,o);if(this.options.inherit){const t="function"==typeof this.options.inherit?this.options.inherit:void 0;let e=this.options.inherit;if(t)if("string"==typeof o){e=t(Reflect.getOwnMetadata(this.workspace,n),o,p)}else e=t(p);if(e){const t=Object.getPrototypeOf(n);if("function"==typeof t&&t!==a&&t!==n){p={...this.read(t,o),...p,params:null==p?void 0:p.params}}}}return p}apply(...t){return(e,r,o)=>{for(const a of t)a(e,r,o)}}decorate(t,e,r){return(o,a,n)=>{this.set({target:o,propKey:a,descriptor:"number"==typeof n?void 0:n,index:"number"==typeof n?n:void 0},t,e,r)}}},t.getConstructor=e,t.isConstructor=r,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
package/dist/src/mate.d.ts
CHANGED
package/dist/src/mate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mate.d.ts","sourceRoot":"","sources":["../../src/mate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mate.d.ts","sourceRoot":"","sources":["../../src/mate.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAElB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAK,SAAS,CAAA;AAGjD,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,uBAAuB,CAAC,IAAI,CAAC,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe,CAAC,OAAO,SAAS,qBAAqB,GAAG,qBAAqB;IAC1F,MAAM,EAAE,OAAO,EAAE,CAAA;IACjB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;CACzB;AAED,MAAM,WAAW,qBAAqB;IAClC,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IACrE,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,KAAO,OAAO,CAAC,CAAA;CACtF;AAED,qBAAa,IAAI,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC7C,SAAS,CAAC,SAAS,EAAE,MAAM;IAAE,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;gBAArD,SAAS,EAAE,MAAM,EAAY,OAAO,GAAE,YAAY,CAAC,CAAC,CAAM;IAEhF,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