@bikky/compiler 0.0.42 → 0.0.43
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BiscuitLibraries.mjs","sourceRoot":"","sources":["BiscuitLibraries.mts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"BiscuitLibraries.mjs","sourceRoot":"","sources":["BiscuitLibraries.mts"],"names":[],"mappings":";;AAAA,2CAA2C;AAC3C,2BAAyB"}
|
package/Libraries/MixinCode.mjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MixableClass = exports.makeMixerFoo = void 0;
|
|
1
4
|
//Propertydescriptor is needed to preserve getters and setters, otherwise we trigger them.
|
|
2
5
|
// We assign functions directly though to preserve the prototype chain when using super() [it's not working].
|
|
3
6
|
function duplicatePrototype(prototype, parent) {
|
|
4
7
|
var names = Array.from(Object.getOwnPropertyNames(prototype));
|
|
5
|
-
names.push(
|
|
8
|
+
names.push.apply(names, Object.getOwnPropertySymbols(prototype));
|
|
6
9
|
var result = { __proto__: parent };
|
|
7
|
-
for (
|
|
8
|
-
|
|
10
|
+
for (var i = names.length - 1; i >= 0; i--) {
|
|
11
|
+
var name = names[i];
|
|
9
12
|
var descriptor = Object.getOwnPropertyDescriptor(prototype, name);
|
|
10
13
|
Object.defineProperty(result, name, descriptor);
|
|
11
14
|
}
|
|
@@ -15,38 +18,25 @@ var mixingObject = [];
|
|
|
15
18
|
var mixingBases = [];
|
|
16
19
|
var mixingBaseProtos = [];
|
|
17
20
|
//The following parameter type allows abstract classes, where as new () => Core doesn't.
|
|
18
|
-
|
|
21
|
+
function makeMixerFoo(mixin, common) {
|
|
22
|
+
var constraints = [];
|
|
23
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
24
|
+
constraints[_i - 2] = arguments[_i];
|
|
25
|
+
}
|
|
19
26
|
if (typeof mixin !== "function" || !mixin.prototype)
|
|
20
27
|
throw new Error("Can only mix classes into other classes.");
|
|
21
28
|
//Allow static functions on the parent class to be accessible in the child.
|
|
22
|
-
|
|
29
|
+
var AllGeneratedClasses = [];
|
|
23
30
|
Object.defineProperty(mixin, Symbol.hasInstance, {
|
|
24
|
-
value: (other)
|
|
25
|
-
return AllGeneratedClasses.some((e)
|
|
31
|
+
value: function (other) {
|
|
32
|
+
return AllGeneratedClasses.some(function (e) { return other instanceof e; }) && other instanceof common;
|
|
26
33
|
},
|
|
27
34
|
configurable: true,
|
|
28
35
|
writable: false,
|
|
29
36
|
enumerable: false
|
|
30
37
|
});
|
|
31
38
|
return function mix(core) {
|
|
32
|
-
var newClass = eval(
|
|
33
|
-
function Mixin_${mixin.name}(...args) {
|
|
34
|
-
//This allows us to change the prototype which the constructor uses for creating
|
|
35
|
-
// the object, forcing it to use the prototype of the child class rather than
|
|
36
|
-
// the prototype of the core.
|
|
37
|
-
var object = Reflect.construct(core, args, this.__proto__.constructor);
|
|
38
|
-
mixingObject.push(object);
|
|
39
|
-
|
|
40
|
-
//Mixins extend from Mixbase, which assigns the this object to the object created
|
|
41
|
-
// by core (above).
|
|
42
|
-
new (mixin)(...args);
|
|
43
|
-
mixingObject.shift();
|
|
44
|
-
|
|
45
|
-
return object;
|
|
46
|
-
};
|
|
47
|
-
Mixin_${mixin.name}.__proto__ = core;
|
|
48
|
-
Mixin_${mixin.name}
|
|
49
|
-
`);
|
|
39
|
+
var newClass = eval("\n\t\tfunction Mixin_".concat(mixin.name, "(...args) {\n\t\t\t//This allows us to change the prototype which the constructor uses for creating\n\t\t\t// the object, forcing it to use the prototype of the child class rather than\n\t\t\t// the prototype of the core.\n\t\t\tvar object = Reflect.construct(core, args, this.__proto__.constructor);\n\t\t\tmixingObject.push(object);\n\n\t\t\t//Mixins extend from Mixbase, which assigns the this object to the object created\n\t\t\t// by core (above).\n\t\t\tnew (mixin)(...args);\n\t\t\tmixingObject.shift();\n\n\t\t\treturn object;\n\t\t};\n\t\tMixin_").concat(mixin.name, ".__proto__ = core;\n\t\tMixin_").concat(mixin.name, "\n\t\t"));
|
|
50
40
|
var originalPrototypes = [];
|
|
51
41
|
var current = mixin;
|
|
52
42
|
originalPrototypes.push(current.prototype);
|
|
@@ -58,20 +48,21 @@ export function makeMixerFoo(mixin, common, ...constraints) {
|
|
|
58
48
|
var newPrototypes = [];
|
|
59
49
|
while (originalPrototypes.length > 0) {
|
|
60
50
|
current = originalPrototypes.pop();
|
|
61
|
-
|
|
51
|
+
var originalClass = current;
|
|
62
52
|
var prototype = newPrototypes.length == 0 ? core.prototype : newPrototypes[0];
|
|
63
|
-
|
|
53
|
+
var newmix = duplicatePrototype(current, prototype);
|
|
64
54
|
var edits = {
|
|
65
55
|
//We override the original isA so that this class appears to be both
|
|
66
56
|
// the mixin as well as the core types. We don't care about the prototype
|
|
67
57
|
// because mixins already in the core will have their own versions of this
|
|
68
58
|
// function.
|
|
69
|
-
isA(other) {
|
|
59
|
+
isA: function (other) {
|
|
60
|
+
var _a;
|
|
70
61
|
if (other == mixin || other == core) {
|
|
71
62
|
return true;
|
|
72
63
|
}
|
|
73
64
|
else {
|
|
74
|
-
return mixin.prototype.isA
|
|
65
|
+
return ((_a = mixin.prototype.isA) === null || _a === void 0 ? void 0 : _a.call(this, other)) || core.prototype.isA.call(this, other);
|
|
75
66
|
}
|
|
76
67
|
},
|
|
77
68
|
};
|
|
@@ -96,22 +87,29 @@ export function makeMixerFoo(mixin, common, ...constraints) {
|
|
|
96
87
|
return newClass;
|
|
97
88
|
};
|
|
98
89
|
}
|
|
99
|
-
|
|
90
|
+
exports.makeMixerFoo = makeMixerFoo;
|
|
91
|
+
function MixableClass(param) {
|
|
100
92
|
//This is done to preserve super calls in mixins.
|
|
101
|
-
|
|
93
|
+
var Mixbase = /** @class */ (function () {
|
|
102
94
|
//@ts-ignore we don't need to call super in this child class.
|
|
103
|
-
|
|
95
|
+
function Mixbase() {
|
|
96
|
+
var args = [];
|
|
97
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
98
|
+
args[_i] = arguments[_i];
|
|
99
|
+
}
|
|
104
100
|
//We can't override the class' object using .call or .apply, but we can override it in the base class.
|
|
105
101
|
var object = mixingObject[0];
|
|
106
102
|
return object;
|
|
107
103
|
}
|
|
108
|
-
|
|
104
|
+
return Mixbase;
|
|
105
|
+
}());
|
|
109
106
|
Mixbase.__proto__ = param;
|
|
110
107
|
Mixbase.prototype.__proto__ = param.prototype;
|
|
111
108
|
mixingBases.push(Mixbase);
|
|
112
109
|
mixingBaseProtos.push(Mixbase.prototype);
|
|
113
110
|
return Mixbase;
|
|
114
111
|
}
|
|
112
|
+
exports.MixableClass = MixableClass;
|
|
115
113
|
if (typeof global !== "undefined") {
|
|
116
114
|
global.Mixable = MixableClass;
|
|
117
115
|
global.makeMixer = makeMixerFoo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MixinCode.mjs","sourceRoot":"","sources":["MixinCode.mts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,6GAA6G;AAC7G,SAAS,kBAAkB,CAAC,SAAc,EAAE,MAAW;IACtD,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAwB,CAAC;IACrF,KAAK,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"MixinCode.mjs","sourceRoot":"","sources":["MixinCode.mts"],"names":[],"mappings":";;;AAEA,0FAA0F;AAC1F,6GAA6G;AAC7G,SAAS,kBAAkB,CAAC,SAAc,EAAE,MAAW;IACtD,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAwB,CAAC;IACrF,KAAK,CAAC,IAAI,OAAV,KAAK,EAAS,MAAM,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE;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AAe,CAAC,SAAS,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IACvD,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,OAAO,OAAsB,CAAC;AAC/B,CAAC;AAfD,oCAeC;AAMD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,MAAc,CAAC,OAAO,GAAG,YAAY,CAAC;IACtC,MAAc,CAAC,SAAS,GAAG,YAAY,CAAC;AAC1C,CAAC;KACI,CAAC;IACL,OAAO,GAAG,YAAY,CAAC;IACvB,SAAS,GAAG,YAAY,CAAC;IACxB,MAAc,CAAC,OAAO,GAAG,YAAY,CAAC;IACtC,MAAc,CAAC,SAAS,GAAG,YAAY,CAAC;AAC1C,CAAC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bikky/compiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.43",
|
|
4
4
|
"description": "Typescript modified for compiling space squad",
|
|
5
|
-
"main": "./Libraries/BiscuitLibraries.
|
|
5
|
+
"main": "./Libraries/BiscuitLibraries.mjs",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "slbre"
|