@bikky/compiler 0.0.8 → 0.0.10

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.
Files changed (44) hide show
  1. package/Libraries/BiscuitLibraries.d.ts +2 -2
  2. package/Libraries/BiscuitLibraries.js +2 -2
  3. package/Libraries/MixinCode.d.ts +13 -13
  4. package/Libraries/MixinCode.js +92 -92
  5. package/Source/ASTBuilder.d.ts +36 -0
  6. package/Source/ASTBuilder.d.ts.map +1 -0
  7. package/Source/ASTBuilder.js +180 -0
  8. package/Source/ASTHelper.d.ts +67 -73
  9. package/Source/ASTHelper.d.ts.map +1 -1
  10. package/Source/ASTHelper.js +320 -343
  11. package/Source/ASTInterface/Class.d.ts +38 -0
  12. package/Source/ASTInterface/Class.d.ts.map +1 -0
  13. package/Source/ASTInterface/Class.js +256 -0
  14. package/Source/ASTInterface/Crawler.d.ts +8 -0
  15. package/Source/ASTInterface/Crawler.d.ts.map +1 -0
  16. package/Source/ASTInterface/Crawler.js +55 -0
  17. package/Source/ASTInterface/Tokens.d.ts +78 -0
  18. package/Source/ASTInterface/Tokens.d.ts.map +1 -0
  19. package/Source/ASTInterface/Tokens.js +49 -0
  20. package/Source/ASTSearcher.d.ts +20 -0
  21. package/Source/ASTSearcher.d.ts.map +1 -0
  22. package/Source/ASTSearcher.js +116 -0
  23. package/Source/ASTTraverser.d.ts +10 -0
  24. package/Source/ASTTraverser.d.ts.map +1 -0
  25. package/Source/ASTTraverser.js +74 -0
  26. package/Source/TSPatchTypes.d.ts +17 -0
  27. package/Transformers/CompilerInsertions.js +23 -23
  28. package/Transformers/MacroTransformer.d.ts +2 -2
  29. package/Transformers/MacroTransformer.d.ts.map +1 -1
  30. package/Transformers/MacroTransformer.js +282 -281
  31. package/Transformers/MixinTransformer.d.ts +2 -3
  32. package/Transformers/MixinTransformer.d.ts.map +1 -1
  33. package/Transformers/MixinTransformer.js +320 -124
  34. package/Transformers/SuperTransformer.d.ts +2 -2
  35. package/Transformers/SuperTransformer.d.ts.map +1 -1
  36. package/Transformers/SuperTransformer.js +138 -117
  37. package/obj/Debug/BiscuitCompiler.njsproj.AssemblyReference.cache +0 -0
  38. package/package.json +6 -5
  39. package/tsconfig.build.libs.json +1 -1
  40. package/tsconfig.build.libs.tsbuildinfo +1 -1
  41. package/tsconfig.build.src.json +1 -1
  42. package/tsconfig.build.src.tsbuildinfo +1 -1
  43. package/tsconfig.json +10 -11
  44. package/tsconfig.tsbuildinfo +1 -0
@@ -1,125 +1,321 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ts = require("typescript");
4
- const ASTHelper_js_1 = require("../Source/ASTHelper.js");
5
- //This transform replaces super. usage with this.parent.
6
- // - this is to make sure macros work properly.
7
- var mixMakerName = "Mixable";
8
- var MixinMagicNumbers = {
9
- decoratorEditExport: ts.SyntaxKind.ExtendsKeyword,
10
- identifier: ts.SyntaxKind.Identifier,
11
- mixinDescriptionKind: ts.SyntaxKind.PropertySignature,
12
- };
13
- /**
14
- * This is a multi-process thing:
15
- * 2) Remove the @mixin decorator.
16
- * 3) Add var Super = Symbol("super") at the top of the file.
17
- * 4) Add this[super] = prototype and static Super = Super to class.
18
- * 5) Change all super.function references to this[super].function.
19
- */
20
- function MixClass(context, RawClass, symbolName) {
21
- //Add symbol definition to the top of the file.
22
- var computedSymbolName = context.factory.createComputedPropertyName(symbolName);
23
- var Class = ASTHelper_js_1.ClassDeclaration.from(RawClass);
24
- if (!Class.hasExtends()) {
25
- (0, ASTHelper_js_1.logError)(RawClass, "Mixins need to extend from something");
26
- return RawClass;
27
- }
28
- //Remove Decorator.
29
- Class.removeDecorator("mixin");
30
- //Store the symbol statically on the class so we can access it in the mixin maker.
31
- var declareStaticSymbol = (new ASTHelper_js_1.PropertyDeclaration((0, ASTHelper_js_1.Identifier)(context, "Super"))
32
- .addModifier((0, ASTHelper_js_1.StaticModifier)(context))
33
- .setValue(symbolName));
34
- Class.addMemberAtStart(declareStaticSymbol.make(context));
35
- //Can't add prototype manually because it will override the prototype provided by MixinCode.ts (because the constructor
36
- // runs after the mixin code, and class variables are assigned in the constructor).
37
- //var declareSuperPrototype = (new PropertyDeclaration(computedSymbolName))
38
- // .setValue(Class.getExtends()!);
39
- //Class.addMemberAtStart(declareSuperPrototype.make(context));
40
- Class.setExtends((new ASTHelper_js_1.CallExpression((0, ASTHelper_js_1.Identifier)(context, mixMakerName))
41
- .addArgument(Class.getExtends())).make(context));
42
- var newRawClass = Class.update(context);
43
- newRawClass = ts.visitNode(newRawClass, ReplaceSuper(Class.getName(), symbolName, context));
44
- return newRawClass;
45
- }
46
- //Change all references in member functions of super. to this[Super].
47
- function ReplaceSuper(classID, computedSuperID, context) {
48
- var className = classID.text;
49
- return (node) => {
50
- return ASTHelper_js_1.ClassDeclaration.eachContextualNode(node, (node) => {
51
- //check to see if node chain represents this.method().
52
- if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.expression.kind === ts.SyntaxKind.SuperKeyword) {
53
- var f = context.factory;
54
- var access = (new ASTHelper_js_1.AccessExpression(context)).this().access(computedSuperID)
55
- /*.access(f.createIdentifier("prototype"))*/ .access(f.createIdentifier(node.expression.name.text)).access((new ASTHelper_js_1.CallExpression(f.createIdentifier("call")))
56
- .addArgument(f.createThis())
57
- .addArgument(...Array.from(node.arguments)).make(context));
58
- //this[super].prototype.method.call(this, arguments);
59
- return access.make();
60
- }
61
- else {
62
- return node;
63
- }
64
- }, context);
65
- };
66
- }
67
- /**
68
- *
69
- * Searching stuff!
70
- * 1) Find classes defined with the @mixin decorator.
71
- *
72
- */
73
- class MixinSource {
74
- constructor(sourceFile) {
75
- this.sourceFile = sourceFile;
76
- }
77
- //Look for a class with the @mixin decorator!
78
- update(context) {
79
- var _a;
80
- this.context = context;
81
- var declarations = [];
82
- var crawl = (node) => {
83
- if (node.kind === ts.SyntaxKind.ClassDeclaration) {
84
- var Class = ASTHelper_js_1.ClassDeclaration.from(node);
85
- if (Class.hasDecorator("mixin")) {
86
- var name = Class.getName().text;
87
- var symbolName = (0, ASTHelper_js_1.Identifier)(context, "Super_" + declarations.length);
88
- var declareSuperSymbol = (new ASTHelper_js_1.VariableDeclaration(symbolName))
89
- .setValue((new ASTHelper_js_1.CallExpression((0, ASTHelper_js_1.Identifier)(context, "Symbol")))
90
- .addArgument((0, ASTHelper_js_1.StringLiteral)(context, "super_" + name))
91
- .make(context)).make(context);
92
- declarations.push(declareSuperSymbol);
93
- var test = MixClass(this.context, node, symbolName);
94
- return test;
95
- }
96
- }
97
- return ts.visitEachChild(node, crawl, this.context);
98
- };
99
- var source = ts.visitNode(this.sourceFile, crawl);
100
- var file = ASTHelper_js_1.SourceFile.from(source);
101
- for (var declaration of declarations) {
102
- file.insertUnderImports(declaration);
103
- }
104
- var result = file.update(context);
105
- this.sourceFile = result;
106
- if (declarations.length > 0) {
107
- console.log("Updated file", (_a = file.original) === null || _a === void 0 ? void 0 : _a.fileName, "with mixin data");
108
- // console.log("~~~~~~~~~~~");
109
- // console.log(Printer.printNode(result, this.sourceFile));
110
- // console.log("~~~~~~~~~~~");
111
- }
112
- return result;
113
- }
114
- }
115
- console.log("MIXINS ENABLED");
116
- function default_1(program, pluginOptions) {
117
- return (context) => {
118
- return (sourceFile) => {
119
- return (new MixinSource(sourceFile)).update(context);
120
- //return sourceFile;
121
- };
122
- };
123
- }
124
- exports.default = default_1;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ts = require("typescript");
4
+ const ASTHelper_js_1 = require("../Source/ASTHelper.js");
5
+ const ASTBuilder_1 = require("../Source/ASTBuilder");
6
+ const Class_1 = require("../Source/ASTInterface/Class");
7
+ const ASTSearcher_1 = require("../Source/ASTSearcher");
8
+ const Crawler_1 = require("../Source/ASTInterface/Crawler");
9
+ //This transform replaces super. usage with this.parent.
10
+ // - this is to make sure macros work properly.
11
+ const mixMakerName = "Mixable";
12
+ const superName = "Super";
13
+ var MixinMagicNumbers = {
14
+ decoratorEditExport: ts.SyntaxKind.ExtendsKeyword,
15
+ identifier: ts.SyntaxKind.Identifier,
16
+ mixinDescriptionKind: ts.SyntaxKind.PropertySignature,
17
+ };
18
+ /**
19
+ * This is a multi-process thing:
20
+ * 2) Remove the @mixin decorator.
21
+ * 3) Add var Super = Symbol("super") at the top of the file.
22
+ * 4) Add this[super] = prototype and static Super = Super to class.
23
+ * 5) Change all super.function references to this[super].function.
24
+ */
25
+ let source;
26
+ let numDeclarations = 0;
27
+ Class_1.Class.onClass((mixClass) => {
28
+ let isMixin = false;
29
+ ts.SyntaxKind.ClassDeclaration;
30
+ console.log(`Found class: ${mixClass.name.text}, decorators: ${mixClass.decorators.map((e) => e.name.text)}`);
31
+ // console.log(mixClass.base);
32
+ // console.log(`${((mixClass.base as any).decorators ?? []).map((e: any)=>e.getText())}`);
33
+ //Find out if the class has the @mixin decorator. If it does, remove it (by returning null).
34
+ mixClass.decorator("mixin", (dec) => {
35
+ if (dec == null)
36
+ return null;
37
+ console.log(`Found class with mixin decorator! ${mixClass.name.text}, ${dec.name.text}`);
38
+ isMixin = true;
39
+ return null;
40
+ });
41
+ if (!isMixin)
42
+ return mixClass;
43
+ let name = mixClass.name.text;
44
+ let symbolName = (0, ASTBuilder_1.ID)("Super_" + numDeclarations++).toAST();
45
+ //Create symbol named Super_0 at the top of the file.
46
+ let declareSuperSymbol = (new ASTHelper_js_1.VariableDeclaration(symbolName))
47
+ .setValue((0, ASTBuilder_1.CALL)((0, ASTBuilder_1.ID)("Symbol"), (0, ASTBuilder_1.LITERAL)("super_" + name)).toAST()).make(Crawler_1.Crawler.getContext());
48
+ //Add Symbol = Super_0 to the class.
49
+ mixClass.unshift(ts.factory.createPropertyDeclaration([], (0, ASTBuilder_1.ID)(superName).toAST(), undefined, undefined, symbolName));
50
+ let getSuperClass = () => ts.factory.createElementAccessExpression(ts.factory.createThis(), symbolName);
51
+ let isSuperCall = (node) => ts.isElementAccessExpression(node) && node.expression.kind === ts.SyntaxKind.ThisKeyword
52
+ && ts.isIdentifier(node.argumentExpression) /*&& node.expression.argumentExpression.text === symbolName.text*/;
53
+ mixClass.extends = ts.factory.updateHeritageClause(mixClass.extends, [ts.factory.createExpressionWithTypeArguments(ts.factory.createIdentifier(mixMakerName), undefined)]);
54
+ mixClass.method((method) => {
55
+ if (!method)
56
+ return null;
57
+ if (method.body) {
58
+ let newBody = Crawler_1.Crawler.Crawl(method.body, (node) => {
59
+ //Replace all `super` instances with `this[SuperSymbol_0]`;
60
+ if (node.kind === ts.SyntaxKind.SuperKeyword) {
61
+ console.log(`Found super! ${node}`);
62
+ return getSuperClass();
63
+ }
64
+ //Replace all instances of [_super.stuff(), value;] with [(this[SuperSymbol].stuff) ? (this[SuperSymbol].stuff()) : (value)];
65
+ //First find a binary expression with comma (A, B) where _super occurs somewhere in A.
66
+ if ((0, ASTSearcher_1.FROM)(node).MATCH.BINARY((0, ASTSearcher_1.HAS_ID_IN_STATEMENT)("_super"), ",", undefined)) {
67
+ console.log(`Found _super! ${node}`);
68
+ let bin = node;
69
+ //Step one, replace all instances of _super with this[Super_0]
70
+ //Step two, find `this[Super_0].stuff` (without the function call and extra stuff).
71
+ let superAccessExpression = (0, ASTSearcher_1.FIND_IN_STATEMENT)(node, (node) => {
72
+ while (ts.isPropertyAccessExpression(node)) {
73
+ if (ts.isIdentifier(node.expression) && node.expression.text == "_super") {
74
+ return true;
75
+ }
76
+ node = node.expression;
77
+ }
78
+ return false;
79
+ });
80
+ if (!superAccessExpression)
81
+ throw new Error(`Something went wrong finding _super. ${node.getText()}`);
82
+ let replace_Super = (node) => {
83
+ if (ts.isIdentifier(node) && node.text == "_super") {
84
+ return getSuperClass();
85
+ }
86
+ return node;
87
+ };
88
+ bin = Crawler_1.Crawler.Crawl(bin, replace_Super);
89
+ superAccessExpression = Crawler_1.Crawler.Crawl(superAccessExpression, replace_Super);
90
+ // Finally, create (this[Super_0].stuff) ? (this[Super_0].stuff()) : (value) syntax.
91
+ return ts.factory.createConditionalExpression(ts.factory.createParenthesizedExpression(superAccessExpression), ts.factory.createToken(ts.SyntaxKind.QuestionToken), ts.factory.createParenthesizedExpression(bin.left), ts.factory.createToken(ts.SyntaxKind.ColonToken), ts.factory.createParenthesizedExpression(bin.right));
92
+ }
93
+ return node;
94
+ });
95
+ // console.log(newBody.getText(source));
96
+ method = ts.factory.updateMethodDeclaration(method, method.modifiers, method.asteriskToken, method.name, method.questionToken, method.typeParameters, method.parameters, method.type, newBody);
97
+ return method;
98
+ }
99
+ return method;
100
+ });
101
+ return [declareSuperSymbol, mixClass.update()];
102
+ });
103
+ /*
104
+
105
+ var crawl = (node: ts.Node): ts.Node => {
106
+ if (ts.canHaveDecorators(node)) {
107
+ console.log("DECORATOR?");
108
+ let text = getNodeText(node, this.sourceFile).split("\n")[0].replace("\r", "");
109
+ console.log(node.kind, text);
110
+ if (text.includes("implements")) {
111
+ console.log(node);
112
+ }
113
+ console.log(ts.getDecorators(node));
114
+ }
115
+ // if (node.pos > 0 && node.end < this.sourceFile.end) {
116
+ // console.log(node.getText(this.sourceFile));
117
+ // }
118
+ if (ts.isDecorator(node)) {
119
+ // console.log("FOUND DECORATOR");
120
+ // console.log(getNodeText(node, this.sourceFile));
121
+ }
122
+ else if (ts.isClassDeclaration(node) || ts.isClassExpression(node)) {
123
+ var Class = ClassDeclaration.from(<ts.ClassDeclaration>node);
124
+ // console.log("FOUND CLASS");
125
+ // console.log(getNodeText(node, this.sourceFile).split("\n")[0].replace("\r", ""));
126
+ // if (ts.isClassExpression(node)) {
127
+ // console.log(node);
128
+ // console.log(ts.getModifiers(node));
129
+ // console.log(node.modifiers);
130
+ // }
131
+ if (Class.hasDecorator("mixin")) {
132
+ console.log("FOUND ONE", Class.name);
133
+ var name = Class.getName().text;
134
+ var symbolName = ID("Super_" + declarations.length).toAST();
135
+ var declareSuperSymbol = (new VariableDeclaration(symbolName))
136
+ .setValue(
137
+ CALL(ID("Symbol"), LITERAL("super_"+name)).toAST()
138
+ ).make(context);
139
+ declarations.push(<ts.Statement>declareSuperSymbol);
140
+ var test = MixClass(this.context, <ts.ClassDeclaration>node, symbolName);
141
+ return test;
142
+ }
143
+ }
144
+ else {
145
+ // let text = getNodeText(node, this.sourceFile).substring(0, 50);
146
+ // if (text.includes("class")) {
147
+ // console.log("FOUND OTHER", node.kind);
148
+ // console.log(getNodeText(node, this.sourceFile).substring(0, 50));
149
+ // console.log(node);
150
+ // }
151
+ }
152
+ return ts.visitEachChild(node, crawl, this.context);
153
+ }
154
+
155
+ */
156
+ // function MixClass(context: ts.TransformationContext, RawClass: ts.ClassDeclaration, symbolName: ts.Identifier): ts.ClassDeclaration {
157
+ // //Add symbol definition to the top of the file.
158
+ // var computedSymbolName = context.factory.createComputedPropertyName(symbolName);
159
+ //
160
+ // var Class = ClassDeclaration.from(RawClass);
161
+ // if (!Class.hasExtends()) {
162
+ // logError(RawClass, "Mixins need to extend from something");
163
+ // return RawClass;
164
+ // }
165
+ // //Remove Decorator.
166
+ // Class.removeDecorator("mixin");
167
+ // console.log("FOUND MIXIN CLASS", Class.getName());
168
+ //
169
+ // //Store the symbol statically on the class so we can access it in the mixin maker.
170
+ // var declareStaticSymbol = (new PropertyDeclaration(ID("Super").toAST())
171
+ // .addModifier(ts.factory.createModifier(ts.SyntaxKind.StaticKeyword))
172
+ // .setValue(symbolName)
173
+ // );
174
+ // Class.addMemberAtStart(declareStaticSymbol.make(context));
175
+ //
176
+ // //Can't add prototype manually because it will override the prototype provided by MixinCode.ts (because the constructor
177
+ // // runs after the mixin code, and class variables are assigned in the constructor).
178
+ // //var declareSuperPrototype = (new PropertyDeclaration(computedSymbolName))
179
+ // // .setValue(Class.getExtends()!);
180
+ // //Class.addMemberAtStart(declareSuperPrototype.make(context));
181
+ //
182
+ // Class.setExtends(CALL(ID(mixMakerName), Class.getExtends()!).toAST());
183
+ //
184
+ // var newRawClass = Class.update(context)!;
185
+ //
186
+ // newRawClass = ts.visitNode(newRawClass, ReplaceSuper(Class.getName(), symbolName, context)) as ts.ClassDeclaration;
187
+ //
188
+ // return newRawClass;
189
+ // }
190
+ //
191
+ // //Change all references in member functions of super. to this[Super].
192
+ // function ReplaceSuper(classID: ts.Identifier, computedSuperID: ts.Identifier, context: ts.TransformationContext) {
193
+ // var className = classID.text;
194
+ // return (node: ts.Node) => {
195
+ // return ClassDeclaration.eachContextualNode(<ts.ClassDeclaration>node, (node: ts.Node) => {
196
+ // //check to see if node chain represents this.method().
197
+ // if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.expression.kind === ts.SyntaxKind.SuperKeyword) {
198
+ // var f = context.factory;
199
+ // var access = METHOD_CALL(THIS().LOOKUP(computedSuperID), ID(node.expression.name.text), THIS(), ...Array.from(node.arguments));
200
+ // //DOT(ID(node.expression.name.text))
201
+ // // .DOT(CALL(ID("call"), THIS(), ...Array.from(node.arguments)));
202
+ // // var access = (new AccessExpression(context)).this().access(computedSuperID)
203
+ // // /*.access(f.createIdentifier("prototype"))*/.access(f.createIdentifier(node.expression.name.text)).access(
204
+ // // (new CallExpression(f.createIdentifier("call")))
205
+ // // .addArgument(f.createThis())
206
+ // // .addArgument(...Array.from(node.arguments)
207
+ // // ).make(context)
208
+ // // );
209
+ // //this[super].prototype.method.call(this, arguments);
210
+ // // return access.make();
211
+ // return access.toAST();
212
+ // }
213
+ // else {
214
+ // return node;
215
+ // }
216
+ // }, context);
217
+ // }
218
+ // }
219
+ //
220
+ // /**
221
+ // *
222
+ // * Searching stuff!
223
+ // * 1) Find classes defined with the @mixin decorator.
224
+ // *
225
+ // */
226
+ //
227
+ // class MixinSource {
228
+ // sourceFile: ts.SourceFile;
229
+ // context!: ts.TransformationContext;
230
+ // constructor(sourceFile: ts.SourceFile) {
231
+ // this.sourceFile = sourceFile;
232
+ // }
233
+ //
234
+ // //Look for a class with the @mixin decorator!
235
+ // update(context: ts.TransformationContext) {
236
+ // this.context = context;
237
+ // var declarations = <ts.Statement[]>[];
238
+ //
239
+ // var crawl = (node: ts.Node): ts.Node => {
240
+ // if (ts.canHaveDecorators(node)) {
241
+ // console.log("DECORATOR?");
242
+ // let text = getNodeText(node, this.sourceFile).split("\n")[0].replace("\r", "");
243
+ // console.log(node.kind, text);
244
+ // if (text.includes("implements")) {
245
+ // console.log(node);
246
+ // }
247
+ // console.log(ts.getDecorators(node));
248
+ // }
249
+ // // if (node.pos > 0 && node.end < this.sourceFile.end) {
250
+ // // console.log(node.getText(this.sourceFile));
251
+ // // }
252
+ // if (ts.isDecorator(node)) {
253
+ // // console.log("FOUND DECORATOR");
254
+ // // console.log(getNodeText(node, this.sourceFile));
255
+ // }
256
+ // else if (ts.isClassDeclaration(node) || ts.isClassExpression(node)) {
257
+ // var Class = ClassDeclaration.from(<ts.ClassDeclaration>node);
258
+ // // console.log("FOUND CLASS");
259
+ // // console.log(getNodeText(node, this.sourceFile).split("\n")[0].replace("\r", ""));
260
+ // // if (ts.isClassExpression(node)) {
261
+ // // console.log(node);
262
+ // // console.log(ts.getModifiers(node));
263
+ // // console.log(node.modifiers);
264
+ // // }
265
+ // if (Class.hasDecorator("mixin")) {
266
+ // console.log("FOUND ONE", Class.name);
267
+ // var name = Class.getName().text;
268
+ // var symbolName = ID("Super_" + declarations.length).toAST();
269
+ // var declareSuperSymbol = (new VariableDeclaration(symbolName))
270
+ // .setValue(
271
+ // CALL(ID("Symbol"), LITERAL("super_"+name)).toAST()
272
+ // ).make(context);
273
+ // declarations.push(<ts.Statement>declareSuperSymbol);
274
+ // var test = MixClass(this.context, <ts.ClassDeclaration>node, symbolName);
275
+ // return test;
276
+ // }
277
+ // }
278
+ // else {
279
+ // // let text = getNodeText(node, this.sourceFile).substring(0, 50);
280
+ // // if (text.includes("class")) {
281
+ // // console.log("FOUND OTHER", node.kind);
282
+ // // console.log(getNodeText(node, this.sourceFile).substring(0, 50));
283
+ // // console.log(node);
284
+ // // }
285
+ // }
286
+ // return ts.visitEachChild(node, crawl, this.context);
287
+ // }
288
+ //
289
+ // var source = ts.visitNode(this.sourceFile, crawl);
290
+ //
291
+ // var file = SourceFile.from(source as ts.SourceFile);
292
+ // for (var declaration of declarations) {
293
+ // file.insertUnderImports(declaration);
294
+ // }
295
+ // var result = file.update(context);
296
+ // this.sourceFile = result;
297
+ // if (declarations.length > 0) {
298
+ // console.log("Updated file", file.original?.fileName, "with mixin data");
299
+ // // console.log("~~~~~~~~~~~");
300
+ // // console.log(Printer.printNode(result, this.sourceFile));
301
+ // // console.log("~~~~~~~~~~~");
302
+ // }
303
+ // return result;
304
+ // }
305
+ // }
306
+ //
307
+ // console.log("MIXINS ENABLED lalala");
308
+ function default_1(program, pluginOptions) {
309
+ return (context) => {
310
+ Crawler_1.Crawler.setContext(context);
311
+ return (sourceFile) => {
312
+ numDeclarations = 0;
313
+ return Crawler_1.Crawler.Crawl(sourceFile);
314
+ // console.log(sourceFile.fileName);
315
+ // return (new MixinSource(sourceFile)).update(context);
316
+ //return sourceFile;
317
+ };
318
+ };
319
+ }
320
+ exports.default = default_1;
125
321
  //# sourceMappingURL=MixinTransformer.js.map
@@ -1,3 +1,3 @@
1
- import * as ts from "typescript";
2
- export default function (program: ts.Program, pluginOptions: {}): (context: ts.TransformationContext) => (sourceFile: ts.SourceFile) => ts.SourceFile;
1
+ import * as ts from "typescript";
2
+ export default function (program: ts.Program, pluginOptions: {}): (context: ts.TransformationContext) => (sourceFile: ts.SourceFile) => ts.Node;
3
3
  //# sourceMappingURL=SuperTransformer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SuperTransformer.d.ts","sourceRoot":"","sources":["SuperTransformer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AA8DjC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,aAC7C,GAAG,qBAAqB,kBACpB,GAAG,UAAU,mBA2DlC"}
1
+ {"version":3,"file":"SuperTransformer.d.ts","sourceRoot":"","sources":["SuperTransformer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAsEjC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,aAE7C,GAAG,qBAAqB,kBAEpB,GAAG,UAAU,aA0ElC"}