commit
This commit is contained in:
parent
68f4b60012
commit
41ae7ff4bd
1010 changed files with 38622 additions and 17071 deletions
9
node_modules/ts-mixer/CHANGELOG.md
generated
vendored
9
node_modules/ts-mixer/CHANGELOG.md
generated
vendored
|
@ -2,6 +2,15 @@
|
|||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [6.0.3](https://github.com/tannerntannern/ts-mixer/compare/v6.0.2...v6.0.3) (2023-02-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allow abstract constructor signature for hasMixin ([f82e27b](https://github.com/tannerntannern/ts-mixer/commit/f82e27b96d142cfdec6446930a1db354167e88d2)), closes [tannerntannern/ts-mixer#56](https://github.com/tannerntannern/ts-mixer/issues/56)
|
||||
* allow abstract constructor signatures for hasMixin ([8964b59](https://github.com/tannerntannern/ts-mixer/commit/8964b59e062854fde52424497930ca3e8bb98e87)), closes [#57](https://github.com/tannerntannern/ts-mixer/issues/57)
|
||||
* simplify signature ([8a79197](https://github.com/tannerntannern/ts-mixer/commit/8a79197cc6bca5757d7c06560d7b26e73491b11f))
|
||||
|
||||
### [6.0.2](https://github.com/tannerntannern/ts-mixer/compare/v6.0.1...v6.0.2) (2022-11-10)
|
||||
|
||||
|
||||
|
|
2
node_modules/ts-mixer/LICENSE
generated
vendored
2
node_modules/ts-mixer/LICENSE
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 Tanner Nielsen
|
||||
Copyright (c) 2023 Tanner Nielsen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
6
node_modules/ts-mixer/README.md
generated
vendored
6
node_modules/ts-mixer/README.md
generated
vendored
|
@ -1,12 +1,10 @@
|
|||
# ts-mixer
|
||||
[version-badge]: https://badgen.net/npm/v/ts-mixer
|
||||
[version-link]: https://npmjs.com/package/ts-mixer
|
||||
[build-badge]: https://img.shields.io/github/workflow/status/tannerntannern/ts-mixer/ts-mixer%20CI
|
||||
[build-link]: https://github.com/tannerntannern/ts-mixer/actions
|
||||
[ts-versions]: https://badgen.net/badge/icon/4.2,4.3?icon=typescript&label&list=|
|
||||
[node-versions]: https://badgen.net/badge/node/10%2C12%2C14/blue/?list=|
|
||||
[ts-versions]: https://badgen.net/badge/icon/4.2,4.4,4.6,4.8?icon=typescript&label&list=|
|
||||
[node-versions]: https://badgen.net/badge/node/12%2C14%2C16%2C18/blue/?list=|
|
||||
[![npm version][version-badge]][version-link]
|
||||
[![github actions][build-badge]][build-link]
|
||||
[![TS Versions][ts-versions]][build-link]
|
||||
[![Node.js Versions][node-versions]][build-link]
|
||||
[](https://bundlephobia.com/result?p=ts-mixer)
|
||||
|
|
39
node_modules/ts-mixer/dist/cjs/decorator.js
generated
vendored
39
node_modules/ts-mixer/dist/cjs/decorator.js
generated
vendored
|
@ -5,10 +5,10 @@ const util_1 = require("./util");
|
|||
const mixin_tracking_1 = require("./mixin-tracking");
|
||||
const mergeObjectsOfDecorators = (o1, o2) => {
|
||||
var _a, _b;
|
||||
const allKeys = util_1.unique([...Object.getOwnPropertyNames(o1), ...Object.getOwnPropertyNames(o2)]);
|
||||
const allKeys = (0, util_1.unique)([...Object.getOwnPropertyNames(o1), ...Object.getOwnPropertyNames(o2)]);
|
||||
const mergedObject = {};
|
||||
for (let key of allKeys)
|
||||
mergedObject[key] = util_1.unique([...((_a = o1 === null || o1 === void 0 ? void 0 : o1[key]) !== null && _a !== void 0 ? _a : []), ...((_b = o2 === null || o2 === void 0 ? void 0 : o2[key]) !== null && _b !== void 0 ? _b : [])]);
|
||||
mergedObject[key] = (0, util_1.unique)([...((_a = o1 === null || o1 === void 0 ? void 0 : o1[key]) !== null && _a !== void 0 ? _a : []), ...((_b = o2 === null || o2 === void 0 ? void 0 : o2[key]) !== null && _b !== void 0 ? _b : [])]);
|
||||
return mergedObject;
|
||||
};
|
||||
const mergePropertyAndMethodDecorators = (d1, d2) => {
|
||||
|
@ -21,7 +21,7 @@ const mergePropertyAndMethodDecorators = (d1, d2) => {
|
|||
const mergeDecorators = (d1, d2) => {
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
return ({
|
||||
class: util_1.unique([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
|
||||
class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
|
||||
static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.static) !== null && _d !== void 0 ? _d : {}),
|
||||
instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {}),
|
||||
});
|
||||
|
@ -33,8 +33,8 @@ const findAllConstituentClasses = (...classes) => {
|
|||
const frontier = new Set([...classes]);
|
||||
while (frontier.size > 0) {
|
||||
for (let clazz of frontier) {
|
||||
const protoChainClasses = util_1.protoChain(clazz.prototype).map(proto => proto.constructor);
|
||||
const mixinClasses = (_a = mixin_tracking_1.getMixinsForClass(clazz)) !== null && _a !== void 0 ? _a : [];
|
||||
const protoChainClasses = (0, util_1.protoChain)(clazz.prototype).map(proto => proto.constructor);
|
||||
const mixinClasses = (_a = (0, mixin_tracking_1.getMixinsForClass)(clazz)) !== null && _a !== void 0 ? _a : [];
|
||||
const potentiallyNewClasses = [...protoChainClasses, ...mixinClasses];
|
||||
const newClasses = potentiallyNewClasses.filter(c => !allClasses.has(c));
|
||||
for (let newClass of newClasses)
|
||||
|
@ -57,7 +57,7 @@ const deepDecoratorSearch = (...classes) => {
|
|||
};
|
||||
exports.deepDecoratorSearch = deepDecoratorSearch;
|
||||
const directDecoratorSearch = (...classes) => {
|
||||
const classDecorators = classes.map(clazz => exports.getDecoratorsForClass(clazz));
|
||||
const classDecorators = classes.map(clazz => (0, exports.getDecoratorsForClass)(clazz));
|
||||
if (classDecorators.length === 0)
|
||||
return {};
|
||||
if (classDecorators.length === 1)
|
||||
|
@ -75,7 +75,7 @@ const getDecoratorsForClass = (clazz) => {
|
|||
};
|
||||
exports.getDecoratorsForClass = getDecoratorsForClass;
|
||||
const decorateClass = (decorator) => ((clazz) => {
|
||||
const decoratorsForClass = exports.getDecoratorsForClass(clazz);
|
||||
const decoratorsForClass = (0, exports.getDecoratorsForClass)(clazz);
|
||||
let classDecorators = decoratorsForClass.class;
|
||||
if (!classDecorators) {
|
||||
classDecorators = [];
|
||||
|
@ -85,25 +85,18 @@ const decorateClass = (decorator) => ((clazz) => {
|
|||
return decorator(clazz);
|
||||
});
|
||||
const decorateMember = (decorator) => ((object, key, ...otherArgs) => {
|
||||
var _a, _b, _c;
|
||||
const decoratorTargetType = typeof object === 'function' ? 'static' : 'instance';
|
||||
const decoratorType = typeof object[key] === 'function' ? 'method' : 'property';
|
||||
const clazz = decoratorTargetType === 'static' ? object : object.constructor;
|
||||
const decoratorsForClass = exports.getDecoratorsForClass(clazz);
|
||||
let decoratorsForTargetType = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType];
|
||||
if (!decoratorsForTargetType) {
|
||||
decoratorsForTargetType = {};
|
||||
decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
|
||||
}
|
||||
let decoratorsForType = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType];
|
||||
if (!decoratorsForType) {
|
||||
decoratorsForType = {};
|
||||
decoratorsForTargetType[decoratorType] = decoratorsForType;
|
||||
}
|
||||
let decoratorsForKey = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key];
|
||||
if (!decoratorsForKey) {
|
||||
decoratorsForKey = [];
|
||||
decoratorsForType[key] = decoratorsForKey;
|
||||
}
|
||||
const decoratorsForClass = (0, exports.getDecoratorsForClass)(clazz);
|
||||
const decoratorsForTargetType = (_a = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType]) !== null && _a !== void 0 ? _a : {};
|
||||
decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
|
||||
let decoratorsForType = (_b = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType]) !== null && _b !== void 0 ? _b : {};
|
||||
decoratorsForTargetType[decoratorType] = decoratorsForType;
|
||||
let decoratorsForKey = (_c = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key]) !== null && _c !== void 0 ? _c : [];
|
||||
decoratorsForType[key] = decoratorsForKey;
|
||||
// @ts-ignore: array is type `A[] | B[]` and item is type `A | B`, so technically a type error, but it's fine
|
||||
decoratorsForKey.push(decorator);
|
||||
// @ts-ignore
|
||||
return decorator(object, key, ...otherArgs);
|
||||
|
|
2
node_modules/ts-mixer/dist/cjs/mixin-tracking.js
generated
vendored
2
node_modules/ts-mixer/dist/cjs/mixin-tracking.js
generated
vendored
|
@ -24,7 +24,7 @@ const hasMixin = (instance, mixin) => {
|
|||
const newFrontier = new Set();
|
||||
frontier.forEach(item => {
|
||||
var _a;
|
||||
const itemConstituents = (_a = mixins.get(item)) !== null && _a !== void 0 ? _a : util_1.protoChain(item.prototype).map(proto => proto.constructor).filter(item => item !== null);
|
||||
const itemConstituents = (_a = mixins.get(item)) !== null && _a !== void 0 ? _a : (0, util_1.protoChain)(item.prototype).map(proto => proto.constructor).filter(item => item !== null);
|
||||
if (itemConstituents)
|
||||
itemConstituents.forEach(constituent => {
|
||||
if (!visited.has(constituent) && !frontier.has(constituent))
|
||||
|
|
16
node_modules/ts-mixer/dist/cjs/mixins.js
generated
vendored
16
node_modules/ts-mixer/dist/cjs/mixins.js
generated
vendored
|
@ -27,21 +27,21 @@ function Mixin(...constructors) {
|
|||
function MixedClass(...args) {
|
||||
for (const constructor of constructors)
|
||||
// @ts-ignore: potentially abstract class
|
||||
util_1.copyProps(this, new constructor(...args));
|
||||
(0, util_1.copyProps)(this, new constructor(...args));
|
||||
if (initFunctionName !== null && typeof this[initFunctionName] === 'function')
|
||||
this[initFunctionName].apply(this, args);
|
||||
}
|
||||
MixedClass.prototype = settings_1.settings.prototypeStrategy === 'copy'
|
||||
? util_1.hardMixProtos(prototypes, MixedClass)
|
||||
: proxy_1.softMixProtos(prototypes, MixedClass);
|
||||
? (0, util_1.hardMixProtos)(prototypes, MixedClass)
|
||||
: (0, proxy_1.softMixProtos)(prototypes, MixedClass);
|
||||
Object.setPrototypeOf(MixedClass, settings_1.settings.staticsStrategy === 'copy'
|
||||
? util_1.hardMixProtos(constructors, null, ['prototype'])
|
||||
: proxy_1.proxyMix(constructors, Function.prototype));
|
||||
? (0, util_1.hardMixProtos)(constructors, null, ['prototype'])
|
||||
: (0, proxy_1.proxyMix)(constructors, Function.prototype));
|
||||
let DecoratedMixedClass = MixedClass;
|
||||
if (settings_1.settings.decoratorInheritance !== 'none') {
|
||||
const classDecorators = settings_1.settings.decoratorInheritance === 'deep'
|
||||
? decorator_1.deepDecoratorSearch(...constructors)
|
||||
: decorator_1.directDecoratorSearch(...constructors);
|
||||
? (0, decorator_1.deepDecoratorSearch)(...constructors)
|
||||
: (0, decorator_1.directDecoratorSearch)(...constructors);
|
||||
for (let decorator of (_a = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.class) !== null && _a !== void 0 ? _a : []) {
|
||||
const result = decorator(DecoratedMixedClass);
|
||||
if (result) {
|
||||
|
@ -51,7 +51,7 @@ function Mixin(...constructors) {
|
|||
applyPropAndMethodDecorators((_b = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.static) !== null && _b !== void 0 ? _b : {}, DecoratedMixedClass);
|
||||
applyPropAndMethodDecorators((_c = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.instance) !== null && _c !== void 0 ? _c : {}, DecoratedMixedClass.prototype);
|
||||
}
|
||||
mixin_tracking_1.registerMixins(DecoratedMixedClass, constructors);
|
||||
(0, mixin_tracking_1.registerMixins)(DecoratedMixedClass, constructors);
|
||||
return DecoratedMixedClass;
|
||||
}
|
||||
exports.Mixin = Mixin;
|
||||
|
|
12
node_modules/ts-mixer/dist/cjs/proxy.js
generated
vendored
12
node_modules/ts-mixer/dist/cjs/proxy.js
generated
vendored
|
@ -7,7 +7,7 @@ const util_1 = require("./util");
|
|||
* prototypes is required.
|
||||
*/
|
||||
const getIngredientWithProp = (prop, ingredients) => {
|
||||
const protoChains = ingredients.map(ingredient => util_1.protoChain(ingredient));
|
||||
const protoChains = ingredients.map(ingredient => (0, util_1.protoChain)(ingredient));
|
||||
// since we search breadth-first, we need to keep track of our depth in the prototype chains
|
||||
let protoDepth = 0;
|
||||
// not all prototype chains are the same depth, so this remains true as long as at least one of the ingredients'
|
||||
|
@ -45,19 +45,19 @@ const proxyMix = (ingredients, prototype = Object.prototype) => new Proxy({}, {
|
|||
throw Error('Cannot set prototype of Proxies created by ts-mixer');
|
||||
},
|
||||
getOwnPropertyDescriptor(_, prop) {
|
||||
return Object.getOwnPropertyDescriptor(exports.getIngredientWithProp(prop, ingredients) || {}, prop);
|
||||
return Object.getOwnPropertyDescriptor((0, exports.getIngredientWithProp)(prop, ingredients) || {}, prop);
|
||||
},
|
||||
defineProperty() {
|
||||
throw new Error('Cannot define new properties on Proxies created by ts-mixer');
|
||||
},
|
||||
has(_, prop) {
|
||||
return exports.getIngredientWithProp(prop, ingredients) !== undefined || prototype[prop] !== undefined;
|
||||
return (0, exports.getIngredientWithProp)(prop, ingredients) !== undefined || prototype[prop] !== undefined;
|
||||
},
|
||||
get(_, prop) {
|
||||
return (exports.getIngredientWithProp(prop, ingredients) || prototype)[prop];
|
||||
return ((0, exports.getIngredientWithProp)(prop, ingredients) || prototype)[prop];
|
||||
},
|
||||
set(_, prop, val) {
|
||||
const ingredientWithProp = exports.getIngredientWithProp(prop, ingredients);
|
||||
const ingredientWithProp = (0, exports.getIngredientWithProp)(prop, ingredients);
|
||||
if (ingredientWithProp === undefined)
|
||||
throw new Error('Cannot set new properties on Proxies created by ts-mixer');
|
||||
ingredientWithProp[prop] = val;
|
||||
|
@ -78,5 +78,5 @@ exports.proxyMix = proxyMix;
|
|||
* proxying all property access to the ingredients. This is not ES5 compatible and less performant. However, any
|
||||
* changes made to the source prototypes will be reflected in the proxy-prototype, which may be desirable.
|
||||
*/
|
||||
const softMixProtos = (ingredients, constructor) => exports.proxyMix([...ingredients, { constructor }]);
|
||||
const softMixProtos = (ingredients, constructor) => (0, exports.proxyMix)([...ingredients, { constructor }]);
|
||||
exports.softMixProtos = softMixProtos;
|
||||
|
|
12
node_modules/ts-mixer/dist/cjs/util.js
generated
vendored
12
node_modules/ts-mixer/dist/cjs/util.js
generated
vendored
|
@ -20,7 +20,7 @@ const protoChain = (obj, currentChain = [obj]) => {
|
|||
const proto = Object.getPrototypeOf(obj);
|
||||
if (proto === null)
|
||||
return currentChain;
|
||||
return exports.protoChain(proto, [...currentChain, proto]);
|
||||
return (0, exports.protoChain)(proto, [...currentChain, proto]);
|
||||
};
|
||||
exports.protoChain = protoChain;
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ const nearestCommonProto = (...objs) => {
|
|||
if (objs.length === 0)
|
||||
return undefined;
|
||||
let commonProto = undefined;
|
||||
const protoChains = objs.map(obj => exports.protoChain(obj));
|
||||
const protoChains = objs.map(obj => (0, exports.protoChain)(obj));
|
||||
while (protoChains.every(protoChain => protoChain.length > 0)) {
|
||||
const protos = protoChains.map(protoChain => protoChain.pop());
|
||||
const potentialCommonProto = protos[0];
|
||||
|
@ -54,19 +54,19 @@ exports.nearestCommonProto = nearestCommonProto;
|
|||
*/
|
||||
const hardMixProtos = (ingredients, constructor, exclude = []) => {
|
||||
var _a;
|
||||
const base = (_a = exports.nearestCommonProto(...ingredients)) !== null && _a !== void 0 ? _a : Object.prototype;
|
||||
const base = (_a = (0, exports.nearestCommonProto)(...ingredients)) !== null && _a !== void 0 ? _a : Object.prototype;
|
||||
const mixedProto = Object.create(base);
|
||||
// Keeps track of prototypes we've already visited to avoid copying the same properties multiple times. We init the
|
||||
// list with the proto chain below the nearest common ancestor because we don't want any of those methods mixed in
|
||||
// when they will already be accessible via prototype access.
|
||||
const visitedProtos = exports.protoChain(base);
|
||||
const visitedProtos = (0, exports.protoChain)(base);
|
||||
for (let prototype of ingredients) {
|
||||
let protos = exports.protoChain(prototype);
|
||||
let protos = (0, exports.protoChain)(prototype);
|
||||
// Apply the prototype chain in reverse order so that old methods don't override newer ones.
|
||||
for (let i = protos.length - 1; i >= 0; i--) {
|
||||
let newProto = protos[i];
|
||||
if (visitedProtos.indexOf(newProto) === -1) {
|
||||
exports.copyProps(mixedProto, newProto, ['constructor', ...exclude]);
|
||||
(0, exports.copyProps)(mixedProto, newProto, ['constructor', ...exclude]);
|
||||
visitedProtos.push(newProto);
|
||||
}
|
||||
}
|
||||
|
|
18
node_modules/ts-mixer/dist/esm/decorator.d.ts
generated
vendored
Normal file
18
node_modules/ts-mixer/dist/esm/decorator.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { Class } from './types';
|
||||
type ObjectOfDecorators<T extends PropertyDecorator | MethodDecorator> = {
|
||||
[key: string]: T[];
|
||||
};
|
||||
export type PropertyAndMethodDecorators = {
|
||||
property?: ObjectOfDecorators<PropertyDecorator>;
|
||||
method?: ObjectOfDecorators<MethodDecorator>;
|
||||
};
|
||||
type Decorators = {
|
||||
class?: ClassDecorator[];
|
||||
static?: PropertyAndMethodDecorators;
|
||||
instance?: PropertyAndMethodDecorators;
|
||||
};
|
||||
export declare const deepDecoratorSearch: (...classes: Class[]) => Decorators;
|
||||
export declare const directDecoratorSearch: (...classes: Class[]) => Decorators;
|
||||
export declare const getDecoratorsForClass: (clazz: Class) => Decorators;
|
||||
export declare const decorate: <T extends PropertyDecorator | MethodDecorator | ClassDecorator>(decorator: T) => T;
|
||||
export {};
|
4
node_modules/ts-mixer/dist/esm/index.d.ts
generated
vendored
Normal file
4
node_modules/ts-mixer/dist/esm/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
export { Mixin, mix } from './mixins';
|
||||
export { settings } from './settings';
|
||||
export { decorate } from './decorator';
|
||||
export { hasMixin } from './mixin-tracking';
|
23
node_modules/ts-mixer/dist/esm/index.js
generated
vendored
23
node_modules/ts-mixer/dist/esm/index.js
generated
vendored
|
@ -266,25 +266,18 @@ const decorateClass = (decorator) => ((clazz) => {
|
|||
return decorator(clazz);
|
||||
});
|
||||
const decorateMember = (decorator) => ((object, key, ...otherArgs) => {
|
||||
var _a, _b, _c;
|
||||
const decoratorTargetType = typeof object === 'function' ? 'static' : 'instance';
|
||||
const decoratorType = typeof object[key] === 'function' ? 'method' : 'property';
|
||||
const clazz = decoratorTargetType === 'static' ? object : object.constructor;
|
||||
const decoratorsForClass = getDecoratorsForClass(clazz);
|
||||
let decoratorsForTargetType = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType];
|
||||
if (!decoratorsForTargetType) {
|
||||
decoratorsForTargetType = {};
|
||||
decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
|
||||
}
|
||||
let decoratorsForType = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType];
|
||||
if (!decoratorsForType) {
|
||||
decoratorsForType = {};
|
||||
decoratorsForTargetType[decoratorType] = decoratorsForType;
|
||||
}
|
||||
let decoratorsForKey = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key];
|
||||
if (!decoratorsForKey) {
|
||||
decoratorsForKey = [];
|
||||
decoratorsForType[key] = decoratorsForKey;
|
||||
}
|
||||
const decoratorsForTargetType = (_a = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType]) !== null && _a !== void 0 ? _a : {};
|
||||
decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
|
||||
let decoratorsForType = (_b = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType]) !== null && _b !== void 0 ? _b : {};
|
||||
decoratorsForTargetType[decoratorType] = decoratorsForType;
|
||||
let decoratorsForKey = (_c = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key]) !== null && _c !== void 0 ? _c : [];
|
||||
decoratorsForType[key] = decoratorsForKey;
|
||||
// @ts-ignore: array is type `A[] | B[]` and item is type `A | B`, so technically a type error, but it's fine
|
||||
decoratorsForKey.push(decorator);
|
||||
// @ts-ignore
|
||||
return decorator(object, key, ...otherArgs);
|
||||
|
|
2
node_modules/ts-mixer/dist/esm/index.min.js
generated
vendored
2
node_modules/ts-mixer/dist/esm/index.min.js
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/ts-mixer/dist/esm/mixin-tracking.d.ts
generated
vendored
Normal file
4
node_modules/ts-mixer/dist/esm/mixin-tracking.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
import { Class } from './types';
|
||||
export declare const getMixinsForClass: (clazz: Class) => Function[] | undefined;
|
||||
export declare const registerMixins: (mixedClass: any, constituents: Function[]) => Map<any, Function[]>;
|
||||
export declare const hasMixin: <M>(instance: any, mixin: abstract new (...args: any[]) => M) => instance is M;
|
16
node_modules/ts-mixer/dist/esm/mixins.d.ts
generated
vendored
Normal file
16
node_modules/ts-mixer/dist/esm/mixins.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { Class, Longest } from './types';
|
||||
declare function Mixin<A extends any[], I1, S1>(c1: Class<A, I1, S1>): Class<A, I1, S1>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>): Class<Longest<A1, A2>, I1 & I2, S1 & S2>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2, A3 extends any[], I3, S3>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>, c3: Class<A3, I3, S3>): Class<Longest<A1, A2, A3>, I1 & I2 & I3, S1 & S2 & S3>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2, A3 extends any[], I3, S3, A4 extends any[], I4, S4>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>, c3: Class<A3, I3, S3>, c4: Class<A4, I4, S4>): Class<Longest<A1, A2, A3, A4>, I1 & I2 & I3 & I4, S1 & S2 & S3 & S4>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2, A3 extends any[], I3, S3, A4 extends any[], I4, S4, A5 extends any[], I5, S5>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>, c3: Class<A3, I3, S3>, c4: Class<A4, I4, S4>, c5: Class<A5, I5, S5>): Class<Longest<A1, A2, A3, A4, A5>, I1 & I2 & I3 & I4 & I5, S1 & S2 & S3 & S4 & S5>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2, A3 extends any[], I3, S3, A4 extends any[], I4, S4, A5 extends any[], I5, S5, A6 extends any[], I6, S6>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>, c3: Class<A3, I3, S3>, c4: Class<A4, I4, S4>, c5: Class<A5, I5, S5>, c6: Class<A6, I6, S6>): Class<Longest<A1, A2, A3, A4, A5, A6>, I1 & I2 & I3 & I4 & I5 & I6, S1 & S2 & S3 & S4 & S5 & S6>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2, A3 extends any[], I3, S3, A4 extends any[], I4, S4, A5 extends any[], I5, S5, A6 extends any[], I6, S6, A7 extends any[], I7, S7>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>, c3: Class<A3, I3, S3>, c4: Class<A4, I4, S4>, c5: Class<A5, I5, S5>, c6: Class<A6, I6, S6>, c7: Class<A7, I7, S7>): Class<Longest<A1, A2, A3, A4, A5, A6, A7>, I1 & I2 & I3 & I4 & I5 & I6 & I7, S1 & S2 & S3 & S4 & S5 & S6 & S7>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2, A3 extends any[], I3, S3, A4 extends any[], I4, S4, A5 extends any[], I5, S5, A6 extends any[], I6, S6, A7 extends any[], I7, S7, A8 extends any[], I8, S8>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>, c3: Class<A3, I3, S3>, c4: Class<A4, I4, S4>, c5: Class<A5, I5, S5>, c6: Class<A6, I6, S6>, c7: Class<A7, I7, S7>, c8: Class<A8, I8, S8>): Class<Longest<A1, A2, A3, A4, A5, A6, A7, A8>, I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8, S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2, A3 extends any[], I3, S3, A4 extends any[], I4, S4, A5 extends any[], I5, S5, A6 extends any[], I6, S6, A7 extends any[], I7, S7, A8 extends any[], I8, S8, A9 extends any[], I9, S9>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>, c3: Class<A3, I3, S3>, c4: Class<A4, I4, S4>, c5: Class<A5, I5, S5>, c6: Class<A6, I6, S6>, c7: Class<A7, I7, S7>, c8: Class<A8, I8, S8>, c9: Class<A9, I9, S9>): Class<Longest<A1, A2, A3, A4, A5, A6, A7, A8, A9>, I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8 & S9>;
|
||||
declare function Mixin<A1 extends any[], I1, S1, A2 extends any[], I2, S2, A3 extends any[], I3, S3, A4 extends any[], I4, S4, A5 extends any[], I5, S5, A6 extends any[], I6, S6, A7 extends any[], I7, S7, A8 extends any[], I8, S8, A9 extends any[], I9, S9, A10 extends any[], I10, S10>(c1: Class<A1, I1, S1>, c2: Class<A2, I2, S2>, c3: Class<A3, I3, S3>, c4: Class<A4, I4, S4>, c5: Class<A5, I5, S5>, c6: Class<A6, I6, S6>, c7: Class<A7, I7, S7>, c8: Class<A8, I8, S8>, c9: Class<A9, I9, S9>, c10: Class<A10, I10, S10>): Class<Longest<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>, I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9 & I10, S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8 & S9 & S10>;
|
||||
/**
|
||||
* A decorator version of the `Mixin` function. You'll want to use this instead of `Mixin` for mixing generic classes.
|
||||
*/
|
||||
declare const mix: (...ingredients: Class[]) => (decoratedClass: any) => any;
|
||||
export { Mixin, mix };
|
16
node_modules/ts-mixer/dist/esm/proxy.d.ts
generated
vendored
Normal file
16
node_modules/ts-mixer/dist/esm/proxy.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Finds the ingredient with the given prop, searching in reverse order and breadth-first if searching ingredient
|
||||
* prototypes is required.
|
||||
*/
|
||||
export declare const getIngredientWithProp: (prop: string | number | symbol, ingredients: any[]) => object | undefined;
|
||||
/**
|
||||
* "Mixes" ingredients by wrapping them in a Proxy. The optional prototype argument allows the mixed object to sit
|
||||
* downstream of an existing prototype chain. Note that "properties" cannot be added, deleted, or modified.
|
||||
*/
|
||||
export declare const proxyMix: (ingredients: any[], prototype?: Object) => {};
|
||||
/**
|
||||
* Creates a new proxy-prototype object that is a "soft" mixture of the given prototypes. The mixing is achieved by
|
||||
* proxying all property access to the ingredients. This is not ES5 compatible and less performant. However, any
|
||||
* changes made to the source prototypes will be reflected in the proxy-prototype, which may be desirable.
|
||||
*/
|
||||
export declare const softMixProtos: (ingredients: any[], constructor: Function) => object;
|
7
node_modules/ts-mixer/dist/esm/settings.d.ts
generated
vendored
Normal file
7
node_modules/ts-mixer/dist/esm/settings.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
export type Settings = {
|
||||
initFunction: string | null;
|
||||
staticsStrategy: 'copy' | 'proxy';
|
||||
prototypeStrategy: 'copy' | 'proxy';
|
||||
decoratorInheritance: 'deep' | 'direct' | 'none';
|
||||
};
|
||||
export declare const settings: Settings;
|
13
node_modules/ts-mixer/dist/esm/types.d.ts
generated
vendored
Normal file
13
node_modules/ts-mixer/dist/esm/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Returns the longer of the two tuples. Indefinite tuples will always be considered longest.
|
||||
*/
|
||||
type _Longest<T1 extends any[], T2 extends any[]> = any[] extends T1 ? T1 : any[] extends T2 ? T2 : Exclude<keyof T1, keyof T2> extends never ? T2 : T1;
|
||||
/**
|
||||
* Returns the longest of up to 10 different tuples.
|
||||
*/
|
||||
export type Longest<T1 extends any[], T2 extends any[] = [], T3 extends any[] = [], T4 extends any[] = [], T5 extends any[] = [], T6 extends any[] = [], T7 extends any[] = [], T8 extends any[] = [], T9 extends any[] = [], T10 extends any[] = []> = _Longest<_Longest<_Longest<_Longest<T1, T2>, _Longest<T3, T4>>, _Longest<_Longest<T5, T6>, _Longest<T7, T8>>>, _Longest<T9, T10>>;
|
||||
/**
|
||||
* A rigorous type alias for a class.
|
||||
*/
|
||||
export type Class<CtorArgs extends any[] = any[], InstanceType = {}, StaticType = {}, IsAbstract = false> = (abstract new (...args: any[]) => InstanceType) & StaticType;
|
||||
export {};
|
27
node_modules/ts-mixer/dist/esm/util.d.ts
generated
vendored
Normal file
27
node_modules/ts-mixer/dist/esm/util.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Utility function that works like `Object.apply`, but copies getters and setters properly as well. Additionally gives
|
||||
* the option to exclude properties by name.
|
||||
*/
|
||||
export declare const copyProps: (dest: object, src: object, exclude?: string[]) => void;
|
||||
/**
|
||||
* Returns the full chain of prototypes up until Object.prototype given a starting object. The order of prototypes will
|
||||
* be closest to farthest in the chain.
|
||||
*/
|
||||
export declare const protoChain: (obj: object, currentChain?: object[]) => object[];
|
||||
/**
|
||||
* Identifies the nearest ancestor common to all the given objects in their prototype chains. For most unrelated
|
||||
* objects, this function should return Object.prototype.
|
||||
*/
|
||||
export declare const nearestCommonProto: (...objs: object[]) => object | undefined;
|
||||
/**
|
||||
* Creates a new prototype object that is a mixture of the given prototypes. The mixing is achieved by first
|
||||
* identifying the nearest common ancestor and using it as the prototype for a new object. Then all properties/methods
|
||||
* downstream of this prototype (ONLY downstream) are copied into the new object.
|
||||
*
|
||||
* The resulting prototype is more performant than softMixProtos(...), as well as ES5 compatible. However, it's not as
|
||||
* flexible as updates to the source prototypes aren't captured by the mixed result. See softMixProtos for why you may
|
||||
* want to use that instead.
|
||||
*/
|
||||
export declare const hardMixProtos: (ingredients: any[], constructor: Function | null, exclude?: string[]) => object;
|
||||
export declare const unique: <T>(arr: T[]) => T[];
|
||||
export declare const flatten: <T>(arr: T[][]) => T[];
|
6
node_modules/ts-mixer/dist/types/decorator.d.ts
generated
vendored
6
node_modules/ts-mixer/dist/types/decorator.d.ts
generated
vendored
|
@ -1,12 +1,12 @@
|
|||
import { Class } from './types';
|
||||
declare type ObjectOfDecorators<T extends PropertyDecorator | MethodDecorator> = {
|
||||
type ObjectOfDecorators<T extends PropertyDecorator | MethodDecorator> = {
|
||||
[key: string]: T[];
|
||||
};
|
||||
export declare type PropertyAndMethodDecorators = {
|
||||
export type PropertyAndMethodDecorators = {
|
||||
property?: ObjectOfDecorators<PropertyDecorator>;
|
||||
method?: ObjectOfDecorators<MethodDecorator>;
|
||||
};
|
||||
declare type Decorators = {
|
||||
type Decorators = {
|
||||
class?: ClassDecorator[];
|
||||
static?: PropertyAndMethodDecorators;
|
||||
instance?: PropertyAndMethodDecorators;
|
||||
|
|
2
node_modules/ts-mixer/dist/types/mixin-tracking.d.ts
generated
vendored
2
node_modules/ts-mixer/dist/types/mixin-tracking.d.ts
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
import { Class } from './types';
|
||||
export declare const getMixinsForClass: (clazz: Class) => Function[] | undefined;
|
||||
export declare const registerMixins: (mixedClass: any, constituents: Function[]) => Map<any, Function[]>;
|
||||
export declare const hasMixin: <M>(instance: any, mixin: new (...args: any[]) => M) => instance is M;
|
||||
export declare const hasMixin: <M>(instance: any, mixin: abstract new (...args: any[]) => M) => instance is M;
|
||||
|
|
2
node_modules/ts-mixer/dist/types/settings.d.ts
generated
vendored
2
node_modules/ts-mixer/dist/types/settings.d.ts
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
export declare type Settings = {
|
||||
export type Settings = {
|
||||
initFunction: string | null;
|
||||
staticsStrategy: 'copy' | 'proxy';
|
||||
prototypeStrategy: 'copy' | 'proxy';
|
||||
|
|
6
node_modules/ts-mixer/dist/types/types.d.ts
generated
vendored
6
node_modules/ts-mixer/dist/types/types.d.ts
generated
vendored
|
@ -1,13 +1,13 @@
|
|||
/**
|
||||
* Returns the longer of the two tuples. Indefinite tuples will always be considered longest.
|
||||
*/
|
||||
declare type _Longest<T1 extends any[], T2 extends any[]> = any[] extends T1 ? T1 : any[] extends T2 ? T2 : Exclude<keyof T1, keyof T2> extends never ? T2 : T1;
|
||||
type _Longest<T1 extends any[], T2 extends any[]> = any[] extends T1 ? T1 : any[] extends T2 ? T2 : Exclude<keyof T1, keyof T2> extends never ? T2 : T1;
|
||||
/**
|
||||
* Returns the longest of up to 10 different tuples.
|
||||
*/
|
||||
export declare type Longest<T1 extends any[], T2 extends any[] = [], T3 extends any[] = [], T4 extends any[] = [], T5 extends any[] = [], T6 extends any[] = [], T7 extends any[] = [], T8 extends any[] = [], T9 extends any[] = [], T10 extends any[] = []> = _Longest<_Longest<_Longest<_Longest<T1, T2>, _Longest<T3, T4>>, _Longest<_Longest<T5, T6>, _Longest<T7, T8>>>, _Longest<T9, T10>>;
|
||||
export type Longest<T1 extends any[], T2 extends any[] = [], T3 extends any[] = [], T4 extends any[] = [], T5 extends any[] = [], T6 extends any[] = [], T7 extends any[] = [], T8 extends any[] = [], T9 extends any[] = [], T10 extends any[] = []> = _Longest<_Longest<_Longest<_Longest<T1, T2>, _Longest<T3, T4>>, _Longest<_Longest<T5, T6>, _Longest<T7, T8>>>, _Longest<T9, T10>>;
|
||||
/**
|
||||
* A rigorous type alias for a class.
|
||||
*/
|
||||
export declare type Class<CtorArgs extends any[] = any[], InstanceType = {}, StaticType = {}, IsAbstract = false> = (abstract new (...args: any[]) => InstanceType) & StaticType;
|
||||
export type Class<CtorArgs extends any[] = any[], InstanceType = {}, StaticType = {}, IsAbstract = false> = (abstract new (...args: any[]) => InstanceType) & StaticType;
|
||||
export {};
|
||||
|
|
2
node_modules/ts-mixer/package.json
generated
vendored
2
node_modules/ts-mixer/package.json
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ts-mixer",
|
||||
"version": "6.0.2",
|
||||
"version": "6.0.3",
|
||||
"description": "A very small TypeScript library that provides tolerable Mixin functionality.",
|
||||
"main": "dist/cjs/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue