crankscript 0.10.7 → 0.10.8
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/assets/ImportMap/ImportMap.d.ts +25 -0
- package/assets/ImportMap/ImportMap.js +83 -0
- package/assets/ImportMap/ImportMap.js.map +1 -0
- package/assets/ImportMap/index.d.ts +1 -0
- package/assets/ImportMap/index.js +8 -0
- package/assets/ImportMap/index.js.map +1 -0
- package/assets/beforeEmit/getBeforeEmit.d.ts +2 -0
- package/assets/beforeEmit/getBeforeEmit.js +22 -0
- package/assets/beforeEmit/getBeforeEmit.js.map +1 -0
- package/assets/beforeEmit/index.d.ts +1 -0
- package/assets/beforeEmit/index.js +8 -0
- package/assets/beforeEmit/index.js.map +1 -0
- package/assets/beforeEmit/withAutomaticImportWarning.d.ts +1 -0
- package/assets/beforeEmit/withAutomaticImportWarning.js +15 -0
- package/assets/beforeEmit/withAutomaticImportWarning.js.map +1 -0
- package/assets/index.d.ts +14 -0
- package/assets/index.js +32 -0
- package/assets/index.js.map +1 -0
- package/assets/transformCallExpression/getTransformCallExpression.d.ts +4 -0
- package/assets/transformCallExpression/getTransformCallExpression.js +29 -0
- package/assets/transformCallExpression/getTransformCallExpression.js.map +1 -0
- package/assets/transformCallExpression/index.d.ts +1 -0
- package/assets/transformCallExpression/index.js +8 -0
- package/assets/transformCallExpression/index.js.map +1 -0
- package/assets/transformClassDeclaration/createClasCall.d.ts +3 -0
- package/assets/transformClassDeclaration/createClasCall.js +32 -0
- package/assets/transformClassDeclaration/createClasCall.js.map +1 -0
- package/assets/transformClassDeclaration/getExportedClassDeclarationStatements.d.ts +3 -0
- package/assets/transformClassDeclaration/getExportedClassDeclarationStatements.js +23 -0
- package/assets/transformClassDeclaration/getExportedClassDeclarationStatements.js.map +1 -0
- package/assets/transformClassDeclaration/getTransformClassDeclaration.d.ts +5 -0
- package/assets/transformClassDeclaration/getTransformClassDeclaration.js +72 -0
- package/assets/transformClassDeclaration/getTransformClassDeclaration.js.map +1 -0
- package/assets/transformClassDeclaration/index.d.ts +1 -0
- package/assets/transformClassDeclaration/index.js +8 -0
- package/assets/transformClassDeclaration/index.js.map +1 -0
- package/assets/transformClassDeclaration/transformConstructor.d.ts +4 -0
- package/assets/transformClassDeclaration/transformConstructor.js +51 -0
- package/assets/transformClassDeclaration/transformConstructor.js.map +1 -0
- package/assets/transformClassDeclaration/transformMethodDeclaration.d.ts +4 -0
- package/assets/transformClassDeclaration/transformMethodDeclaration.js +20 -0
- package/assets/transformClassDeclaration/transformMethodDeclaration.js.map +1 -0
- package/assets/transformClassDeclaration/transformPropertyName.d.ts +3 -0
- package/assets/transformClassDeclaration/transformPropertyName.js +26 -0
- package/assets/transformClassDeclaration/transformPropertyName.js.map +1 -0
- package/assets/transformNewExpression/index.d.ts +1 -0
- package/assets/transformNewExpression/index.js +8 -0
- package/assets/transformNewExpression/index.js.map +1 -0
- package/assets/transformNewExpression/transformNewExpression.d.ts +3 -0
- package/assets/transformNewExpression/transformNewExpression.js +24 -0
- package/assets/transformNewExpression/transformNewExpression.js.map +1 -0
- package/assets/transformPropertyAccessExpression/getTransformPropertyAccessExpression.d.ts +3 -0
- package/assets/transformPropertyAccessExpression/getTransformPropertyAccessExpression.js +22 -0
- package/assets/transformPropertyAccessExpression/getTransformPropertyAccessExpression.js.map +1 -0
- package/assets/transformPropertyAccessExpression/index.d.ts +1 -0
- package/assets/transformPropertyAccessExpression/index.js +8 -0
- package/assets/transformPropertyAccessExpression/index.js.map +1 -0
- package/assets/transformSuperExpression/index.d.ts +1 -0
- package/assets/transformSuperExpression/index.js +8 -0
- package/assets/transformSuperExpression/index.js.map +1 -0
- package/assets/transformSuperExpression/transformSuperExpression.d.ts +7 -0
- package/assets/transformSuperExpression/transformSuperExpression.js +24 -0
- package/assets/transformSuperExpression/transformSuperExpression.js.map +1 -0
- package/assets/types.d.ts +6 -0
- package/assets/types.js +6 -0
- package/assets/types.js.map +1 -0
- package/package.json +1 -1
@@ -0,0 +1,25 @@
|
|
1
|
+
export declare class ImportMap {
|
2
|
+
private imports;
|
3
|
+
toArray(): string[];
|
4
|
+
map(callback: Parameters<ReturnType<typeof this.toArray>['map']>[0]): unknown[];
|
5
|
+
add(importName: string): void;
|
6
|
+
processName(name: string): void;
|
7
|
+
static map: {
|
8
|
+
graphics: Set<string>;
|
9
|
+
sprites: Set<string>;
|
10
|
+
crank: Set<string>;
|
11
|
+
object: Set<string>;
|
12
|
+
'utilities/where': Set<string>;
|
13
|
+
easing: Set<string>;
|
14
|
+
nineSlice: Set<string>;
|
15
|
+
qrcode: Set<string>;
|
16
|
+
animation: Set<string>;
|
17
|
+
animator: Set<string>;
|
18
|
+
keyboard: Set<string>;
|
19
|
+
math: Set<string>;
|
20
|
+
string: Set<string>;
|
21
|
+
timer: Set<string>;
|
22
|
+
frameTimer: Set<string>;
|
23
|
+
ui: Set<string>;
|
24
|
+
};
|
25
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "ImportMap", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return ImportMap;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
let ImportMap = class ImportMap {
|
12
|
+
toArray() {
|
13
|
+
return Array.from(this.imports);
|
14
|
+
}
|
15
|
+
map(callback) {
|
16
|
+
return this.toArray().map(callback);
|
17
|
+
}
|
18
|
+
add(importName) {
|
19
|
+
this.imports.add(importName);
|
20
|
+
}
|
21
|
+
processName(name) {
|
22
|
+
for (const [key, value] of Object.entries(this.map)){
|
23
|
+
if (value instanceof Set && value.has(name)) {
|
24
|
+
this.add(key);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
constructor(){
|
29
|
+
this.imports = new Set();
|
30
|
+
}
|
31
|
+
};
|
32
|
+
ImportMap.map = {
|
33
|
+
graphics: new Set([
|
34
|
+
'graphics'
|
35
|
+
]),
|
36
|
+
sprites: new Set([
|
37
|
+
'sprite'
|
38
|
+
]),
|
39
|
+
crank: new Set([
|
40
|
+
'getCrankTicks'
|
41
|
+
]),
|
42
|
+
object: new Set([
|
43
|
+
'printTable'
|
44
|
+
]),
|
45
|
+
'utilities/where': new Set([
|
46
|
+
'where'
|
47
|
+
]),
|
48
|
+
easing: new Set([
|
49
|
+
'easingFunctions'
|
50
|
+
]),
|
51
|
+
nineSlice: new Set([
|
52
|
+
'nineSlice'
|
53
|
+
]),
|
54
|
+
qrcode: new Set([
|
55
|
+
'generateQRCode'
|
56
|
+
]),
|
57
|
+
animation: new Set([
|
58
|
+
'animation'
|
59
|
+
]),
|
60
|
+
animator: new Set([
|
61
|
+
'animator'
|
62
|
+
]),
|
63
|
+
keyboard: new Set([
|
64
|
+
'keyboard'
|
65
|
+
]),
|
66
|
+
math: new Set([
|
67
|
+
'math'
|
68
|
+
]),
|
69
|
+
string: new Set([
|
70
|
+
'string'
|
71
|
+
]),
|
72
|
+
timer: new Set([
|
73
|
+
'timer'
|
74
|
+
]),
|
75
|
+
frameTimer: new Set([
|
76
|
+
'frameTimer'
|
77
|
+
]),
|
78
|
+
ui: new Set([
|
79
|
+
'ui'
|
80
|
+
])
|
81
|
+
};
|
82
|
+
|
83
|
+
//# sourceMappingURL=ImportMap.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/ImportMap/ImportMap.ts"],"sourcesContent":["export class ImportMap {\n private imports = new Set<string>();\n\n toArray() {\n return Array.from(this.imports);\n }\n\n map(callback: Parameters<ReturnType<typeof this.toArray>['map']>[0]) {\n return this.toArray().map(callback);\n }\n\n add(importName: string) {\n this.imports.add(importName);\n }\n\n processName(name: string) {\n for (const [key, value] of Object.entries(this.map)) {\n if (value instanceof Set && value.has(name)) {\n this.add(key);\n }\n }\n }\n\n static map = {\n graphics: new Set(['graphics']),\n sprites: new Set(['sprite']),\n crank: new Set(['getCrankTicks']),\n object: new Set(['printTable']),\n 'utilities/where': new Set(['where']),\n easing: new Set(['easingFunctions']),\n nineSlice: new Set(['nineSlice']),\n qrcode: new Set(['generateQRCode']),\n animation: new Set(['animation']),\n animator: new Set(['animator']),\n keyboard: new Set(['keyboard']),\n math: new Set(['math']),\n string: new Set(['string']),\n timer: new Set(['timer']),\n frameTimer: new Set(['frameTimer']),\n ui: new Set(['ui']),\n };\n}\n"],"names":["ImportMap","toArray","Array","from","imports","map","callback","add","importName","processName","name","key","value","Object","entries","Set","has","graphics","sprites","crank","object","easing","nineSlice","qrcode","animation","animator","keyboard","math","string","timer","frameTimer","ui"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,IAAA,AAAMA,YAAN,MAAMA;IAGTC,UAAU;QACN,OAAOC,MAAMC,IAAI,CAAC,IAAI,CAACC,OAAO;IAClC;IAEAC,IAAIC,QAA+D,EAAE;QACjE,OAAO,IAAI,CAACL,OAAO,GAAGI,GAAG,CAACC;IAC9B;IAEAC,IAAIC,UAAkB,EAAE;QACpB,IAAI,CAACJ,OAAO,CAACG,GAAG,CAACC;IACrB;IAEAC,YAAYC,IAAY,EAAE;QACtB,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAAC,IAAI,CAACT,GAAG,EAAG;YACjD,IAAIO,iBAAiBG,OAAOH,MAAMI,GAAG,CAACN,OAAO;gBACzC,IAAI,CAACH,GAAG,CAACI;YACb;QACJ;IACJ;;aApBQP,UAAU,IAAIW;;AAwC1B;AAzCaf,UAuBFK,MAAM;IACTY,UAAU,IAAIF,IAAI;QAAC;KAAW;IAC9BG,SAAS,IAAIH,IAAI;QAAC;KAAS;IAC3BI,OAAO,IAAIJ,IAAI;QAAC;KAAgB;IAChCK,QAAQ,IAAIL,IAAI;QAAC;KAAa;IAC9B,mBAAmB,IAAIA,IAAI;QAAC;KAAQ;IACpCM,QAAQ,IAAIN,IAAI;QAAC;KAAkB;IACnCO,WAAW,IAAIP,IAAI;QAAC;KAAY;IAChCQ,QAAQ,IAAIR,IAAI;QAAC;KAAiB;IAClCS,WAAW,IAAIT,IAAI;QAAC;KAAY;IAChCU,UAAU,IAAIV,IAAI;QAAC;KAAW;IAC9BW,UAAU,IAAIX,IAAI;QAAC;KAAW;IAC9BY,MAAM,IAAIZ,IAAI;QAAC;KAAO;IACtBa,QAAQ,IAAIb,IAAI;QAAC;KAAS;IAC1Bc,OAAO,IAAId,IAAI;QAAC;KAAQ;IACxBe,YAAY,IAAIf,IAAI;QAAC;KAAa;IAClCgB,IAAI,IAAIhB,IAAI;QAAC;KAAK;AACtB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './ImportMap';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/ImportMap/index.ts"],"sourcesContent":["export * from './ImportMap';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import { ImportMap } from '../ImportMap';
|
2
|
+
export declare const getBeforeEmit: (importMap: ImportMap) => (_: import("typescript").Program, __: import("typescript-to-lua").CompilerOptions, ___: import("typescript-to-lua").EmitHost, result: import("typescript-to-lua").EmitFile[]) => void;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getBeforeEmit", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return getBeforeEmit;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _withAutomaticImportWarning = require("./withAutomaticImportWarning");
|
12
|
+
const getBeforeEmit = (importMap)=>{
|
13
|
+
return (_, __, ___, result)=>{
|
14
|
+
const importsString = importMap.map((importString)=>`import "CoreLibs/${importString}"`).join('\n');
|
15
|
+
if (importsString.trim() === '') {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
result[0].code = (0, _withAutomaticImportWarning.withAutomaticImportWarning)(importsString, result[0].code);
|
19
|
+
};
|
20
|
+
};
|
21
|
+
|
22
|
+
//# sourceMappingURL=getBeforeEmit.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/beforeEmit/getBeforeEmit.ts"],"sourcesContent":["import { Plugin } from 'typescript-to-lua';\nimport { withAutomaticImportWarning } from './withAutomaticImportWarning';\nimport { ImportMap } from '../ImportMap';\n\nexport const getBeforeEmit = (importMap: ImportMap) => {\n return ((_, __, ___, result) => {\n const importsString = importMap\n .map((importString) => `import \"CoreLibs/${importString}\"`)\n .join('\\n');\n\n if (importsString.trim() === '') {\n return;\n }\n\n result[0].code = withAutomaticImportWarning(\n importsString,\n result[0].code\n );\n }) satisfies Plugin['beforeEmit'];\n};\n"],"names":["getBeforeEmit","importMap","_","__","___","result","importsString","map","importString","join","trim","code","withAutomaticImportWarning"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAIaA;;;eAAAA;;;4CAH8B;AAGpC,MAAMA,gBAAgB,CAACC;IAC1B,OAAQ,CAACC,GAAGC,IAAIC,KAAKC;QACjB,MAAMC,gBAAgBL,UACjBM,GAAG,CAAC,CAACC,eAAiB,CAAC,iBAAiB,EAAEA,aAAa,CAAC,CAAC,EACzDC,IAAI,CAAC;QAEV,IAAIH,cAAcI,IAAI,OAAO,IAAI;YAC7B;QACJ;QAEAL,MAAM,CAAC,EAAE,CAACM,IAAI,GAAGC,IAAAA,sDAA0B,EACvCN,eACAD,MAAM,CAAC,EAAE,CAACM,IAAI;IAEtB;AACJ"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './getBeforeEmit';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/beforeEmit/index.ts"],"sourcesContent":["export * from './getBeforeEmit';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const withAutomaticImportWarning: (importsString: string, code: string) => string;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "withAutomaticImportWarning", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return withAutomaticImportWarning;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const withAutomaticImportWarning = (importsString, code)=>{
|
12
|
+
return `-- These imports were added automatically\n\n${importsString}\n\n-- End of automatic imports\n\n${code}`;
|
13
|
+
};
|
14
|
+
|
15
|
+
//# sourceMappingURL=withAutomaticImportWarning.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/beforeEmit/withAutomaticImportWarning.ts"],"sourcesContent":["export const withAutomaticImportWarning = (\n importsString: string,\n code: string\n) => {\n return `-- These imports were added automatically\\n\\n${importsString}\\n\\n-- End of automatic imports\\n\\n${code}`;\n};\n"],"names":["withAutomaticImportWarning","importsString","code"],"rangeMappings":";;;;;;;;;;;;","mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,6BAA6B,CACtCC,eACAC;IAEA,OAAO,CAAC,6CAA6C,EAAED,cAAc,mCAAmC,EAAEC,KAAK,CAAC;AACpH"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import * as ts from 'typescript';
|
2
|
+
declare const _default: {
|
3
|
+
beforeEmit: (_: ts.Program, __: import("typescript-to-lua").CompilerOptions, ___: import("typescript-to-lua").EmitHost, result: import("typescript-to-lua").EmitFile[]) => void;
|
4
|
+
visitors: {
|
5
|
+
263: (declaration: ts.ClassLikeDeclaration, context: import("typescript-to-lua").TransformationContext) => import("typescript-to-lua").Statement[];
|
6
|
+
108: (expression: ts.SuperExpression, context: import("typescript-to-lua").TransformationContext & {
|
7
|
+
classSuperInfos?: import("./types").ClassSuperInfo[];
|
8
|
+
}) => import("typescript-to-lua").Identifier | import("typescript-to-lua").TableIndexExpression;
|
9
|
+
214: (node: ts.NewExpression, context: import("typescript-to-lua").TransformationContext) => import("typescript-to-lua").CallExpression;
|
10
|
+
211: (node: ts.PropertyAccessExpression, context: import("typescript-to-lua").TransformationContext) => import("typescript-to-lua").Expression;
|
11
|
+
213: (node: ts.CallExpression, context: import("typescript-to-lua").TransformationContext) => import("typescript-to-lua").Expression;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
export default _default;
|
package/assets/index.js
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "default", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return _default;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescript = /*#__PURE__*/ _interop_require_wildcard._(require("typescript"));
|
13
|
+
const _beforeEmit = require("./beforeEmit");
|
14
|
+
const _ImportMap = require("./ImportMap");
|
15
|
+
const _transformCallExpression = require("./transformCallExpression");
|
16
|
+
const _transformClassDeclaration = require("./transformClassDeclaration");
|
17
|
+
const _transformNewExpression = require("./transformNewExpression");
|
18
|
+
const _transformPropertyAccessExpression = require("./transformPropertyAccessExpression");
|
19
|
+
const _transformSuperExpression = require("./transformSuperExpression");
|
20
|
+
const importMap = new _ImportMap.ImportMap();
|
21
|
+
const _default = {
|
22
|
+
beforeEmit: (0, _beforeEmit.getBeforeEmit)(importMap),
|
23
|
+
visitors: {
|
24
|
+
[_typescript.SyntaxKind.ClassDeclaration]: (0, _transformClassDeclaration.getTransformClassDeclaration)(importMap),
|
25
|
+
[_typescript.SyntaxKind.SuperKeyword]: _transformSuperExpression.transformSuperExpression,
|
26
|
+
[_typescript.SyntaxKind.NewExpression]: _transformNewExpression.transformNewExpression,
|
27
|
+
[_typescript.SyntaxKind.PropertyAccessExpression]: (0, _transformPropertyAccessExpression.getTransformPropertyAccessExpression)(importMap),
|
28
|
+
[_typescript.SyntaxKind.CallExpression]: (0, _transformCallExpression.getTransformCallExpression)(importMap)
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../libs/tstl-plugin/src/index.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { Plugin } from 'typescript-to-lua';\nimport { getBeforeEmit } from './beforeEmit';\nimport { ImportMap } from './ImportMap';\nimport { getTransformCallExpression } from './transformCallExpression';\nimport { getTransformClassDeclaration } from './transformClassDeclaration';\nimport { transformNewExpression } from './transformNewExpression';\nimport { getTransformPropertyAccessExpression } from './transformPropertyAccessExpression';\nimport { transformSuperExpression } from './transformSuperExpression';\n\nconst importMap = new ImportMap();\n\nexport default {\n beforeEmit: getBeforeEmit(importMap),\n visitors: {\n [ts.SyntaxKind.ClassDeclaration]:\n getTransformClassDeclaration(importMap),\n [ts.SyntaxKind.SuperKeyword]: transformSuperExpression,\n [ts.SyntaxKind.NewExpression]: transformNewExpression,\n [ts.SyntaxKind.PropertyAccessExpression]:\n getTransformPropertyAccessExpression(importMap),\n [ts.SyntaxKind.CallExpression]: getTransformCallExpression(importMap),\n },\n} satisfies Plugin;\n"],"names":["importMap","ImportMap","beforeEmit","getBeforeEmit","visitors","ts","SyntaxKind","ClassDeclaration","getTransformClassDeclaration","SuperKeyword","transformSuperExpression","NewExpression","transformNewExpression","PropertyAccessExpression","getTransformPropertyAccessExpression","CallExpression","getTransformCallExpression"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAYA;;;eAAA;;;;sEAZoB;4BAEU;2BACJ;yCACiB;2CACE;wCACN;mDACc;0CACZ;AAEzC,MAAMA,YAAY,IAAIC,oBAAS;MAE/B,WAAe;IACXC,YAAYC,IAAAA,yBAAa,EAACH;IAC1BI,UAAU;QACN,CAACC,YAAGC,UAAU,CAACC,gBAAgB,CAAC,EAC5BC,IAAAA,uDAA4B,EAACR;QACjC,CAACK,YAAGC,UAAU,CAACG,YAAY,CAAC,EAAEC,kDAAwB;QACtD,CAACL,YAAGC,UAAU,CAACK,aAAa,CAAC,EAAEC,8CAAsB;QACrD,CAACP,YAAGC,UAAU,CAACO,wBAAwB,CAAC,EACpCC,IAAAA,uEAAoC,EAACd;QACzC,CAACK,YAAGC,UAAU,CAACS,cAAc,CAAC,EAAEC,IAAAA,mDAA0B,EAAChB;IAC/D;AACJ"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import * as ts from 'typescript';
|
2
|
+
import { Expression } from 'typescript-to-lua';
|
3
|
+
import { ImportMap } from '../ImportMap';
|
4
|
+
export declare const getTransformCallExpression: (importMap: ImportMap) => (node: ts.CallExpression, context: import("typescript-to-lua").TransformationContext) => Expression;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getTransformCallExpression", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return getTransformCallExpression;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescript = /*#__PURE__*/ _interop_require_wildcard._(require("typescript"));
|
13
|
+
const getTransformCallExpression = (importMap)=>{
|
14
|
+
return (node, context)=>{
|
15
|
+
if (_typescript.isIdentifier(node.expression)) {
|
16
|
+
importMap.processName(node.expression.escapedText.toString());
|
17
|
+
}
|
18
|
+
if (_typescript.isIdentifier(node.expression) && node.expression.escapedText === 'require') {
|
19
|
+
const normalNode = context.superTransformExpression(node);
|
20
|
+
normalNode.expression.text = 'import';
|
21
|
+
normalNode.expression.originalName = 'import';
|
22
|
+
return normalNode;
|
23
|
+
} else {
|
24
|
+
return context.superTransformExpression(node);
|
25
|
+
}
|
26
|
+
};
|
27
|
+
};
|
28
|
+
|
29
|
+
//# sourceMappingURL=getTransformCallExpression.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformCallExpression/getTransformCallExpression.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { Expression, FunctionVisitor } from 'typescript-to-lua';\nimport { ImportMap } from '../ImportMap';\n\nexport const getTransformCallExpression = (importMap: ImportMap) => {\n return ((node, context) => {\n if (ts.isIdentifier(node.expression)) {\n importMap.processName(node.expression.escapedText.toString());\n }\n\n if (\n ts.isIdentifier(node.expression) &&\n node.expression.escapedText === 'require'\n ) {\n const normalNode = context.superTransformExpression(\n node\n ) as unknown as {\n expression: { text: string; originalName: string };\n };\n\n normalNode.expression.text = 'import';\n normalNode.expression.originalName = 'import';\n\n return normalNode as unknown as Expression;\n } else {\n return context.superTransformExpression(node);\n }\n }) satisfies FunctionVisitor<ts.CallExpression>;\n};\n"],"names":["getTransformCallExpression","importMap","node","context","ts","isIdentifier","expression","processName","escapedText","toString","normalNode","superTransformExpression","text","originalName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAIaA;;;eAAAA;;;;sEAJO;AAIb,MAAMA,6BAA6B,CAACC;IACvC,OAAQ,CAACC,MAAMC;QACX,IAAIC,YAAGC,YAAY,CAACH,KAAKI,UAAU,GAAG;YAClCL,UAAUM,WAAW,CAACL,KAAKI,UAAU,CAACE,WAAW,CAACC,QAAQ;QAC9D;QAEA,IACIL,YAAGC,YAAY,CAACH,KAAKI,UAAU,KAC/BJ,KAAKI,UAAU,CAACE,WAAW,KAAK,WAClC;YACE,MAAME,aAAaP,QAAQQ,wBAAwB,CAC/CT;YAKJQ,WAAWJ,UAAU,CAACM,IAAI,GAAG;YAC7BF,WAAWJ,UAAU,CAACO,YAAY,GAAG;YAErC,OAAOH;QACX,OAAO;YACH,OAAOP,QAAQQ,wBAAwB,CAACT;QAC5C;IACJ;AACJ"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './getTransformCallExpression';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformCallExpression/index.ts"],"sourcesContent":["export * from './getTransformCallExpression';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "createClassCall", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return createClassCall;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescripttolua = /*#__PURE__*/ _interop_require_wildcard._(require("typescript-to-lua"));
|
13
|
+
const createClassCall = (context, className, extendsNode)=>{
|
14
|
+
// class('X')
|
15
|
+
const classCall = _typescripttolua.createCallExpression(_typescripttolua.createIdentifier('class'), [
|
16
|
+
_typescripttolua.createStringLiteral(className.text)
|
17
|
+
]);
|
18
|
+
let classCreationExpression;
|
19
|
+
if (extendsNode) {
|
20
|
+
// class('X').extends(Blah)
|
21
|
+
classCreationExpression = _typescripttolua.createCallExpression(_typescripttolua.createTableIndexExpression(classCall, _typescripttolua.createStringLiteral('extends')), [
|
22
|
+
context.transformExpression(extendsNode.expression)
|
23
|
+
]);
|
24
|
+
} else {
|
25
|
+
classCreationExpression = _typescripttolua.createCallExpression(_typescripttolua.createTableIndexExpression(classCall, _typescripttolua.createStringLiteral('extends')), [
|
26
|
+
_typescripttolua.createIdentifier('Object')
|
27
|
+
]);
|
28
|
+
}
|
29
|
+
return _typescripttolua.createExpressionStatement(classCreationExpression);
|
30
|
+
};
|
31
|
+
|
32
|
+
//# sourceMappingURL=createClasCall.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformClassDeclaration/createClasCall.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport * as tstl from 'typescript-to-lua';\n\nexport const createClassCall = (\n context: tstl.TransformationContext,\n className: tstl.Identifier,\n extendsNode?: ts.ExpressionWithTypeArguments\n): tstl.Statement => {\n // class('X')\n const classCall = tstl.createCallExpression(\n tstl.createIdentifier('class'),\n [tstl.createStringLiteral(className.text)]\n );\n let classCreationExpression: tstl.Expression;\n if (extendsNode) {\n // class('X').extends(Blah)\n classCreationExpression = tstl.createCallExpression(\n tstl.createTableIndexExpression(\n classCall,\n tstl.createStringLiteral('extends')\n ),\n [context.transformExpression(extendsNode.expression)]\n );\n } else {\n classCreationExpression = tstl.createCallExpression(\n tstl.createTableIndexExpression(\n classCall,\n tstl.createStringLiteral('extends')\n ),\n [tstl.createIdentifier('Object')]\n );\n }\n return tstl.createExpressionStatement(classCreationExpression);\n};\n"],"names":["createClassCall","context","className","extendsNode","classCall","tstl","createCallExpression","createIdentifier","createStringLiteral","text","classCreationExpression","createTableIndexExpression","transformExpression","expression","createExpressionStatement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGaA;;;eAAAA;;;;2EAFS;AAEf,MAAMA,kBAAkB,CAC3BC,SACAC,WACAC;IAEA,aAAa;IACb,MAAMC,YAAYC,iBAAKC,oBAAoB,CACvCD,iBAAKE,gBAAgB,CAAC,UACtB;QAACF,iBAAKG,mBAAmB,CAACN,UAAUO,IAAI;KAAE;IAE9C,IAAIC;IACJ,IAAIP,aAAa;QACb,2BAA2B;QAC3BO,0BAA0BL,iBAAKC,oBAAoB,CAC/CD,iBAAKM,0BAA0B,CAC3BP,WACAC,iBAAKG,mBAAmB,CAAC,aAE7B;YAACP,QAAQW,mBAAmB,CAACT,YAAYU,UAAU;SAAE;IAE7D,OAAO;QACHH,0BAA0BL,iBAAKC,oBAAoB,CAC/CD,iBAAKM,0BAA0B,CAC3BP,WACAC,iBAAKG,mBAAmB,CAAC,aAE7B;YAACH,iBAAKE,gBAAgB,CAAC;SAAU;IAEzC;IACA,OAAOF,iBAAKS,yBAAyB,CAACJ;AAC1C"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getExportedClassDeclarationStatements", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return getExportedClassDeclarationStatements;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescripttolua = /*#__PURE__*/ _interop_require_wildcard._(require("typescript-to-lua"));
|
13
|
+
const getExportedClassDeclarationStatements = (className, declaration)=>{
|
14
|
+
if ('localSymbol' in declaration && declaration.localSymbol && typeof declaration.localSymbol === 'object' && 'exportSymbol' in declaration.localSymbol && declaration.localSymbol.exportSymbol && typeof declaration.localSymbol.exportSymbol === 'object' && 'escapedName' in declaration.localSymbol.exportSymbol && typeof declaration.localSymbol.exportSymbol.escapedName === 'string') {
|
15
|
+
const escapedName = declaration.localSymbol.exportSymbol.escapedName;
|
16
|
+
return [
|
17
|
+
_typescripttolua.createAssignmentStatement(_typescripttolua.createTableIndexExpression(_typescripttolua.createIdentifier('____exports'), _typescripttolua.createStringLiteral(escapedName)), className)
|
18
|
+
];
|
19
|
+
}
|
20
|
+
return [];
|
21
|
+
};
|
22
|
+
|
23
|
+
//# sourceMappingURL=getExportedClassDeclarationStatements.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformClassDeclaration/getExportedClassDeclarationStatements.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport * as tstl from 'typescript-to-lua';\n\nexport const getExportedClassDeclarationStatements = (\n className: tstl.Identifier,\n declaration: ts.ClassLikeDeclaration\n) => {\n if (\n 'localSymbol' in declaration &&\n declaration.localSymbol &&\n typeof declaration.localSymbol === 'object' &&\n 'exportSymbol' in declaration.localSymbol &&\n declaration.localSymbol.exportSymbol &&\n typeof declaration.localSymbol.exportSymbol === 'object' &&\n 'escapedName' in declaration.localSymbol.exportSymbol &&\n typeof declaration.localSymbol.exportSymbol.escapedName === 'string'\n ) {\n const escapedName = declaration.localSymbol.exportSymbol.escapedName;\n\n return [\n tstl.createAssignmentStatement(\n tstl.createTableIndexExpression(\n tstl.createIdentifier('____exports'),\n tstl.createStringLiteral(escapedName)\n ),\n className\n ),\n ];\n }\n\n return [];\n};\n"],"names":["getExportedClassDeclarationStatements","className","declaration","localSymbol","exportSymbol","escapedName","tstl","createAssignmentStatement","createTableIndexExpression","createIdentifier","createStringLiteral"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGaA;;;eAAAA;;;;2EAFS;AAEf,MAAMA,wCAAwC,CACjDC,WACAC;IAEA,IACI,iBAAiBA,eACjBA,YAAYC,WAAW,IACvB,OAAOD,YAAYC,WAAW,KAAK,YACnC,kBAAkBD,YAAYC,WAAW,IACzCD,YAAYC,WAAW,CAACC,YAAY,IACpC,OAAOF,YAAYC,WAAW,CAACC,YAAY,KAAK,YAChD,iBAAiBF,YAAYC,WAAW,CAACC,YAAY,IACrD,OAAOF,YAAYC,WAAW,CAACC,YAAY,CAACC,WAAW,KAAK,UAC9D;QACE,MAAMA,cAAcH,YAAYC,WAAW,CAACC,YAAY,CAACC,WAAW;QAEpE,OAAO;YACHC,iBAAKC,yBAAyB,CAC1BD,iBAAKE,0BAA0B,CAC3BF,iBAAKG,gBAAgB,CAAC,gBACtBH,iBAAKI,mBAAmB,CAACL,eAE7BJ;SAEP;IACL;IAEA,OAAO,EAAE;AACb"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import * as ts from 'typescript';
|
2
|
+
import { TransformationContext } from 'typescript-to-lua';
|
3
|
+
import * as tstl from 'typescript-to-lua';
|
4
|
+
import { ImportMap } from '../ImportMap';
|
5
|
+
export declare const getTransformClassDeclaration: (importMap: ImportMap) => (declaration: ts.ClassLikeDeclaration, context: TransformationContext) => tstl.Statement[];
|
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getTransformClassDeclaration", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return getTransformClassDeclaration;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescript = /*#__PURE__*/ _interop_require_wildcard._(require("typescript"));
|
13
|
+
const _typescripttolua = /*#__PURE__*/ _interop_require_wildcard._(require("typescript-to-lua"));
|
14
|
+
const _utils = require("typescript-to-lua/dist/transformation/visitors/class/utils");
|
15
|
+
const _getExportedClassDeclarationStatements = require("./getExportedClassDeclarationStatements");
|
16
|
+
const _createClasCall = require("./createClasCall");
|
17
|
+
const _transformConstructor = require("./transformConstructor");
|
18
|
+
const _transformMethodDeclaration = require("./transformMethodDeclaration");
|
19
|
+
const hasSuperInfos = (context)=>{
|
20
|
+
return 'classSuperInfos' in context;
|
21
|
+
};
|
22
|
+
const getTransformClassDeclaration = (importMap)=>{
|
23
|
+
return (declaration, context)=>{
|
24
|
+
importMap.add('object');
|
25
|
+
let className;
|
26
|
+
if (declaration.name) {
|
27
|
+
className = _typescripttolua.createIdentifier(declaration.name.text);
|
28
|
+
} else {
|
29
|
+
className = _typescripttolua.createIdentifier(context.createTempName('class'), declaration);
|
30
|
+
}
|
31
|
+
const extension = (0, _utils.getExtendedNode)(declaration);
|
32
|
+
if (hasSuperInfos(context)) {
|
33
|
+
if (context.classSuperInfos) {
|
34
|
+
context.classSuperInfos.push({
|
35
|
+
className,
|
36
|
+
extendedTypeNode: extension
|
37
|
+
});
|
38
|
+
} else {
|
39
|
+
context.classSuperInfos = [
|
40
|
+
{
|
41
|
+
className,
|
42
|
+
extendedTypeNode: extension
|
43
|
+
}
|
44
|
+
];
|
45
|
+
}
|
46
|
+
}
|
47
|
+
// Get all properties with value
|
48
|
+
const properties = declaration.members.filter(_typescript.isPropertyDeclaration).filter((member)=>member.initializer);
|
49
|
+
// Divide properties into static and non-static
|
50
|
+
const instanceFields = properties.filter((prop)=>!(0, _utils.isStaticNode)(prop));
|
51
|
+
const statements = [];
|
52
|
+
// class('X')
|
53
|
+
statements.push((0, _createClasCall.createClassCall)(context, className, extension));
|
54
|
+
// function X:init()
|
55
|
+
// X.super.init(self)
|
56
|
+
// end
|
57
|
+
const constructor = declaration.members.find((n)=>_typescript.isConstructorDeclaration(n) && n.body !== undefined);
|
58
|
+
if (!constructor) {
|
59
|
+
return [];
|
60
|
+
}
|
61
|
+
const transformedConstructor = (0, _transformConstructor.transformConstructor)(context, className, instanceFields, constructor);
|
62
|
+
if (transformedConstructor) {
|
63
|
+
statements.push(transformedConstructor);
|
64
|
+
}
|
65
|
+
const methods = declaration.members.filter(_typescript.isMethodDeclaration).map((method)=>(0, _transformMethodDeclaration.transformMethodDeclaration)(context, method, className)).filter((method)=>method !== undefined);
|
66
|
+
statements.push(...methods);
|
67
|
+
statements.push(...(0, _getExportedClassDeclarationStatements.getExportedClassDeclarationStatements)(className, declaration));
|
68
|
+
return statements;
|
69
|
+
};
|
70
|
+
};
|
71
|
+
|
72
|
+
//# sourceMappingURL=getTransformClassDeclaration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformClassDeclaration/getTransformClassDeclaration.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { FunctionVisitor, TransformationContext } from 'typescript-to-lua';\nimport * as tstl from 'typescript-to-lua';\nimport {\n getExtendedNode,\n isStaticNode,\n} from 'typescript-to-lua/dist/transformation/visitors/class/utils';\nimport { getExportedClassDeclarationStatements } from './getExportedClassDeclarationStatements';\nimport { ImportMap } from '../ImportMap';\nimport { ClassSuperInfo } from '../types';\nimport { createClassCall } from './createClasCall';\nimport { transformConstructor } from './transformConstructor';\nimport { transformMethodDeclaration } from './transformMethodDeclaration';\n\nconst hasSuperInfos = (\n context: TransformationContext\n): context is TransformationContext & {\n classSuperInfos?: [ClassSuperInfo];\n} => {\n return 'classSuperInfos' in context;\n};\n\nexport const getTransformClassDeclaration = (importMap: ImportMap) => {\n return ((declaration, context: TransformationContext) => {\n importMap.add('object');\n\n let className: tstl.Identifier;\n if (declaration.name) {\n className = tstl.createIdentifier(declaration.name.text);\n } else {\n className = tstl.createIdentifier(\n context.createTempName('class'),\n declaration\n );\n }\n\n const extension = getExtendedNode(declaration);\n\n if (hasSuperInfos(context)) {\n if (context.classSuperInfos) {\n context.classSuperInfos.push({\n className,\n extendedTypeNode: extension,\n });\n } else {\n context.classSuperInfos = [\n { className, extendedTypeNode: extension },\n ];\n }\n }\n\n // Get all properties with value\n const properties = declaration.members\n .filter(ts.isPropertyDeclaration)\n .filter((member) => member.initializer);\n\n // Divide properties into static and non-static\n const instanceFields = properties.filter((prop) => !isStaticNode(prop));\n\n const statements: tstl.Statement[] = [];\n\n // class('X')\n statements.push(createClassCall(context, className, extension));\n\n // function X:init()\n // X.super.init(self)\n // end\n const constructor = declaration.members.find(\n (n): n is ts.ConstructorDeclaration =>\n ts.isConstructorDeclaration(n) && n.body !== undefined\n );\n\n if (!constructor) {\n return [];\n }\n\n const transformedConstructor = transformConstructor(\n context,\n className,\n instanceFields,\n constructor\n );\n if (transformedConstructor) {\n statements.push(transformedConstructor);\n }\n\n const methods = declaration.members\n .filter(ts.isMethodDeclaration)\n .map((method) =>\n transformMethodDeclaration(context, method, className)\n )\n .filter((method): method is tstl.Statement => method !== undefined);\n statements.push(...methods);\n\n statements.push(\n ...getExportedClassDeclarationStatements(className, declaration)\n );\n\n return statements;\n }) satisfies FunctionVisitor<ts.ClassLikeDeclaration>;\n};\n"],"names":["getTransformClassDeclaration","hasSuperInfos","context","importMap","declaration","add","className","name","tstl","createIdentifier","text","createTempName","extension","getExtendedNode","classSuperInfos","push","extendedTypeNode","properties","members","filter","ts","isPropertyDeclaration","member","initializer","instanceFields","prop","isStaticNode","statements","createClassCall","constructor","find","n","isConstructorDeclaration","body","undefined","transformedConstructor","transformConstructor","methods","isMethodDeclaration","map","method","transformMethodDeclaration","getExportedClassDeclarationStatements"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsBaA;;;eAAAA;;;;sEAtBO;2EAEE;uBAIf;uDAC+C;gCAGtB;sCACK;4CACM;AAE3C,MAAMC,gBAAgB,CAClBC;IAIA,OAAO,qBAAqBA;AAChC;AAEO,MAAMF,+BAA+B,CAACG;IACzC,OAAQ,CAACC,aAAaF;QAClBC,UAAUE,GAAG,CAAC;QAEd,IAAIC;QACJ,IAAIF,YAAYG,IAAI,EAAE;YAClBD,YAAYE,iBAAKC,gBAAgB,CAACL,YAAYG,IAAI,CAACG,IAAI;QAC3D,OAAO;YACHJ,YAAYE,iBAAKC,gBAAgB,CAC7BP,QAAQS,cAAc,CAAC,UACvBP;QAER;QAEA,MAAMQ,YAAYC,IAAAA,sBAAe,EAACT;QAElC,IAAIH,cAAcC,UAAU;YACxB,IAAIA,QAAQY,eAAe,EAAE;gBACzBZ,QAAQY,eAAe,CAACC,IAAI,CAAC;oBACzBT;oBACAU,kBAAkBJ;gBACtB;YACJ,OAAO;gBACHV,QAAQY,eAAe,GAAG;oBACtB;wBAAER;wBAAWU,kBAAkBJ;oBAAU;iBAC5C;YACL;QACJ;QAEA,gCAAgC;QAChC,MAAMK,aAAab,YAAYc,OAAO,CACjCC,MAAM,CAACC,YAAGC,qBAAqB,EAC/BF,MAAM,CAAC,CAACG,SAAWA,OAAOC,WAAW;QAE1C,+CAA+C;QAC/C,MAAMC,iBAAiBP,WAAWE,MAAM,CAAC,CAACM,OAAS,CAACC,IAAAA,mBAAY,EAACD;QAEjE,MAAME,aAA+B,EAAE;QAEvC,aAAa;QACbA,WAAWZ,IAAI,CAACa,IAAAA,+BAAe,EAAC1B,SAASI,WAAWM;QAEpD,oBAAoB;QACpB,uBAAuB;QACvB,MAAM;QACN,MAAMiB,cAAczB,YAAYc,OAAO,CAACY,IAAI,CACxC,CAACC,IACGX,YAAGY,wBAAwB,CAACD,MAAMA,EAAEE,IAAI,KAAKC;QAGrD,IAAI,CAACL,aAAa;YACd,OAAO,EAAE;QACb;QAEA,MAAMM,yBAAyBC,IAAAA,0CAAoB,EAC/ClC,SACAI,WACAkB,gBACAK;QAEJ,IAAIM,wBAAwB;YACxBR,WAAWZ,IAAI,CAACoB;QACpB;QAEA,MAAME,UAAUjC,YAAYc,OAAO,CAC9BC,MAAM,CAACC,YAAGkB,mBAAmB,EAC7BC,GAAG,CAAC,CAACC,SACFC,IAAAA,sDAA0B,EAACvC,SAASsC,QAAQlC,YAE/Ca,MAAM,CAAC,CAACqB,SAAqCA,WAAWN;QAC7DP,WAAWZ,IAAI,IAAIsB;QAEnBV,WAAWZ,IAAI,IACR2B,IAAAA,4EAAqC,EAACpC,WAAWF;QAGxD,OAAOuB;IACX;AACJ"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './getTransformClassDeclaration';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformClassDeclaration/index.ts"],"sourcesContent":["export * from './getTransformClassDeclaration';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import * as ts from 'typescript';
|
2
|
+
import { TransformationContext } from 'typescript-to-lua';
|
3
|
+
import * as tstl from 'typescript-to-lua';
|
4
|
+
export declare const transformConstructor: (context: TransformationContext, className: tstl.Identifier, instanceFields: ts.PropertyDeclaration[], constructor: ts.ConstructorDeclaration) => tstl.Statement | undefined;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "transformConstructor", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return transformConstructor;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _extends = require("@swc/helpers/_/_extends");
|
12
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
13
|
+
const _typescripttolua = /*#__PURE__*/ _interop_require_wildcard._(require("typescript-to-lua"));
|
14
|
+
const _scope = require("typescript-to-lua/dist/transformation/utils/scope");
|
15
|
+
const _fields = require("typescript-to-lua/dist/transformation/visitors/class/members/fields");
|
16
|
+
const _function = require("typescript-to-lua/dist/transformation/visitors/function");
|
17
|
+
const transformConstructor = (context, className, instanceFields, constructor)=>{
|
18
|
+
const methodName = 'init';
|
19
|
+
context.pushScope(_scope.ScopeType.Function);
|
20
|
+
let bodyStatements = [];
|
21
|
+
const params = (0, _function.transformParameters)(context, constructor == null ? void 0 : constructor.parameters, _typescripttolua.createIdentifier('self'))[0];
|
22
|
+
const classInstanceFields = (0, _fields.transformClassInstanceFields)(context, instanceFields);
|
23
|
+
bodyStatements.push(...classInstanceFields);
|
24
|
+
if (constructor == null ? void 0 : constructor.body) {
|
25
|
+
const body = (0, _function.transformFunctionBodyContent)(context, constructor.body);
|
26
|
+
bodyStatements.push(...body);
|
27
|
+
bodyStatements = bodyStatements.reduce((previous, current)=>{
|
28
|
+
if (_typescripttolua.isExpressionStatement(current) && _typescripttolua.isCallExpression(current.expression) && _typescripttolua.isTableIndexExpression(current.expression.expression) && _typescripttolua.isStringLiteral(current.expression.expression.index) && current.expression.expression.index.value === '____constructor') {
|
29
|
+
return [
|
30
|
+
_extends._({}, current, {
|
31
|
+
expression: _extends._({}, current.expression, {
|
32
|
+
expression: _extends._({}, current.expression.expression, {
|
33
|
+
index: _typescripttolua.createStringLiteral('init')
|
34
|
+
}),
|
35
|
+
params: current.expression.params.slice(1)
|
36
|
+
})
|
37
|
+
}),
|
38
|
+
...previous
|
39
|
+
];
|
40
|
+
}
|
41
|
+
return [
|
42
|
+
...previous,
|
43
|
+
current
|
44
|
+
];
|
45
|
+
}, []);
|
46
|
+
}
|
47
|
+
context.popScope();
|
48
|
+
return _typescripttolua.createAssignmentStatement(_typescripttolua.createTableIndexExpression(className, _typescripttolua.createStringLiteral(methodName)), _typescripttolua.createFunctionExpression(_typescripttolua.createBlock(bodyStatements), params));
|
49
|
+
};
|
50
|
+
|
51
|
+
//# sourceMappingURL=transformConstructor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformClassDeclaration/transformConstructor.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { TransformationContext } from 'typescript-to-lua';\nimport * as tstl from 'typescript-to-lua';\nimport { ScopeType } from 'typescript-to-lua/dist/transformation/utils/scope';\nimport { transformClassInstanceFields } from 'typescript-to-lua/dist/transformation/visitors/class/members/fields';\nimport {\n transformFunctionBodyContent,\n transformParameters,\n} from 'typescript-to-lua/dist/transformation/visitors/function';\n\nexport const transformConstructor = (\n context: TransformationContext,\n className: tstl.Identifier,\n instanceFields: ts.PropertyDeclaration[],\n constructor: ts.ConstructorDeclaration\n): tstl.Statement | undefined => {\n const methodName = 'init';\n context.pushScope(ScopeType.Function);\n let bodyStatements: tstl.Statement[] = [];\n const params = transformParameters(\n context,\n constructor?.parameters,\n tstl.createIdentifier('self')\n )[0];\n const classInstanceFields = transformClassInstanceFields(\n context,\n instanceFields\n );\n\n bodyStatements.push(...classInstanceFields);\n\n if (constructor?.body) {\n const body = transformFunctionBodyContent(context, constructor.body);\n\n bodyStatements.push(...body);\n bodyStatements = bodyStatements.reduce((previous, current) => {\n if (\n tstl.isExpressionStatement(current) &&\n tstl.isCallExpression(current.expression) &&\n tstl.isTableIndexExpression(current.expression.expression) &&\n tstl.isStringLiteral(current.expression.expression.index) &&\n current.expression.expression.index.value === '____constructor'\n ) {\n return [\n {\n ...current,\n expression: {\n ...current.expression,\n expression: {\n ...current.expression.expression,\n index: tstl.createStringLiteral('init'),\n },\n params: current.expression.params.slice(1),\n },\n },\n ...previous,\n ];\n }\n\n return [...previous, current];\n }, [] as tstl.Statement[]);\n }\n context.popScope();\n return tstl.createAssignmentStatement(\n tstl.createTableIndexExpression(\n className,\n tstl.createStringLiteral(methodName)\n ),\n tstl.createFunctionExpression(tstl.createBlock(bodyStatements), params)\n );\n};\n"],"names":["transformConstructor","context","className","instanceFields","constructor","methodName","pushScope","ScopeType","Function","bodyStatements","params","transformParameters","parameters","tstl","createIdentifier","classInstanceFields","transformClassInstanceFields","push","body","transformFunctionBodyContent","reduce","previous","current","isExpressionStatement","isCallExpression","expression","isTableIndexExpression","isStringLiteral","index","value","createStringLiteral","slice","popScope","createAssignmentStatement","createTableIndexExpression","createFunctionExpression","createBlock"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;;;2EARS;uBACI;wBACmB;0BAItC;AAEA,MAAMA,uBAAuB,CAChCC,SACAC,WACAC,gBACAC;IAEA,MAAMC,aAAa;IACnBJ,QAAQK,SAAS,CAACC,gBAAS,CAACC,QAAQ;IACpC,IAAIC,iBAAmC,EAAE;IACzC,MAAMC,SAASC,IAAAA,6BAAmB,EAC9BV,SACAG,+BAAAA,YAAaQ,UAAU,EACvBC,iBAAKC,gBAAgB,CAAC,QACzB,CAAC,EAAE;IACJ,MAAMC,sBAAsBC,IAAAA,oCAA4B,EACpDf,SACAE;IAGJM,eAAeQ,IAAI,IAAIF;IAEvB,IAAIX,+BAAAA,YAAac,IAAI,EAAE;QACnB,MAAMA,OAAOC,IAAAA,sCAA4B,EAAClB,SAASG,YAAYc,IAAI;QAEnET,eAAeQ,IAAI,IAAIC;QACvBT,iBAAiBA,eAAeW,MAAM,CAAC,CAACC,UAAUC;YAC9C,IACIT,iBAAKU,qBAAqB,CAACD,YAC3BT,iBAAKW,gBAAgB,CAACF,QAAQG,UAAU,KACxCZ,iBAAKa,sBAAsB,CAACJ,QAAQG,UAAU,CAACA,UAAU,KACzDZ,iBAAKc,eAAe,CAACL,QAAQG,UAAU,CAACA,UAAU,CAACG,KAAK,KACxDN,QAAQG,UAAU,CAACA,UAAU,CAACG,KAAK,CAACC,KAAK,KAAK,mBAChD;gBACE,OAAO;oBACH,eACOP;wBACHG,YAAY,eACLH,QAAQG,UAAU;4BACrBA,YAAY,eACLH,QAAQG,UAAU,CAACA,UAAU;gCAChCG,OAAOf,iBAAKiB,mBAAmB,CAAC;;4BAEpCpB,QAAQY,QAAQG,UAAU,CAACf,MAAM,CAACqB,KAAK,CAAC;;;uBAG7CV;iBACN;YACL;YAEA,OAAO;mBAAIA;gBAAUC;aAAQ;QACjC,GAAG,EAAE;IACT;IACArB,QAAQ+B,QAAQ;IAChB,OAAOnB,iBAAKoB,yBAAyB,CACjCpB,iBAAKqB,0BAA0B,CAC3BhC,WACAW,iBAAKiB,mBAAmB,CAACzB,cAE7BQ,iBAAKsB,wBAAwB,CAACtB,iBAAKuB,WAAW,CAAC3B,iBAAiBC;AAExE"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import * as ts from 'typescript';
|
2
|
+
import { TransformationContext } from 'typescript-to-lua';
|
3
|
+
import * as tstl from 'typescript-to-lua';
|
4
|
+
export declare const transformMethodDeclaration: (context: TransformationContext, node: ts.MethodDeclaration, className: tstl.Identifier) => tstl.Statement | undefined;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "transformMethodDeclaration", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return transformMethodDeclaration;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescripttolua = /*#__PURE__*/ _interop_require_wildcard._(require("typescript-to-lua"));
|
13
|
+
const _function = require("typescript-to-lua/dist/transformation/visitors/function");
|
14
|
+
const _transformPropertyName = require("./transformPropertyName");
|
15
|
+
const transformMethodDeclaration = (context, node, className)=>{
|
16
|
+
const [functionExpression] = (0, _function.transformFunctionToExpression)(context, node);
|
17
|
+
return _typescripttolua.createAssignmentStatement(_typescripttolua.createTableIndexExpression(className, (0, _transformPropertyName.transformPropertyName)(context, node.name)), functionExpression);
|
18
|
+
};
|
19
|
+
|
20
|
+
//# sourceMappingURL=transformMethodDeclaration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformClassDeclaration/transformMethodDeclaration.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { TransformationContext } from 'typescript-to-lua';\nimport * as tstl from 'typescript-to-lua';\nimport { transformFunctionToExpression } from 'typescript-to-lua/dist/transformation/visitors/function';\nimport { transformPropertyName } from './transformPropertyName';\n\nexport const transformMethodDeclaration = (\n context: TransformationContext,\n node: ts.MethodDeclaration,\n className: tstl.Identifier\n): tstl.Statement | undefined => {\n const [functionExpression] = transformFunctionToExpression(context, node);\n return tstl.createAssignmentStatement(\n tstl.createTableIndexExpression(\n className,\n transformPropertyName(context, node.name)\n ),\n functionExpression\n );\n};\n"],"names":["transformMethodDeclaration","context","node","className","functionExpression","transformFunctionToExpression","tstl","createAssignmentStatement","createTableIndexExpression","transformPropertyName","name"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":";;;;+BAMaA;;;eAAAA;;;;2EAJS;0BACwB;uCACR;AAE/B,MAAMA,6BAA6B,CACtCC,SACAC,MACAC;IAEA,MAAM,CAACC,mBAAmB,GAAGC,IAAAA,uCAA6B,EAACJ,SAASC;IACpE,OAAOI,iBAAKC,yBAAyB,CACjCD,iBAAKE,0BAA0B,CAC3BL,WACAM,IAAAA,4CAAqB,EAACR,SAASC,KAAKQ,IAAI,IAE5CN;AAER"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "transformPropertyName", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return transformPropertyName;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescript = /*#__PURE__*/ _interop_require_wildcard._(require("typescript"));
|
13
|
+
const _typescripttolua = require("typescript-to-lua");
|
14
|
+
const transformPropertyName = (context, node)=>{
|
15
|
+
if (_typescript.isComputedPropertyName(node)) {
|
16
|
+
return context.transformExpression(node.expression);
|
17
|
+
} else if (_typescript.isIdentifier(node)) {
|
18
|
+
return (0, _typescripttolua.createStringLiteral)(node.text);
|
19
|
+
} else if (_typescript.isPrivateIdentifier(node)) {
|
20
|
+
throw new Error('PrivateIdentifier is not supported');
|
21
|
+
} else {
|
22
|
+
return context.transformExpression(node);
|
23
|
+
}
|
24
|
+
};
|
25
|
+
|
26
|
+
//# sourceMappingURL=transformPropertyName.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformClassDeclaration/transformPropertyName.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { createStringLiteral } from 'typescript-to-lua';\nimport { TransformationContext } from 'typescript-to-lua';\n\nexport const transformPropertyName = (\n context: TransformationContext,\n node: ts.PropertyName\n) => {\n if (ts.isComputedPropertyName(node)) {\n return context.transformExpression(node.expression);\n } else if (ts.isIdentifier(node)) {\n return createStringLiteral(node.text);\n } else if (ts.isPrivateIdentifier(node)) {\n throw new Error('PrivateIdentifier is not supported');\n } else {\n return context.transformExpression(node);\n }\n};\n"],"names":["transformPropertyName","context","node","ts","isComputedPropertyName","transformExpression","expression","isIdentifier","createStringLiteral","text","isPrivateIdentifier","Error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAIaA;;;eAAAA;;;;sEAJO;iCACgB;AAG7B,MAAMA,wBAAwB,CACjCC,SACAC;IAEA,IAAIC,YAAGC,sBAAsB,CAACF,OAAO;QACjC,OAAOD,QAAQI,mBAAmB,CAACH,KAAKI,UAAU;IACtD,OAAO,IAAIH,YAAGI,YAAY,CAACL,OAAO;QAC9B,OAAOM,IAAAA,oCAAmB,EAACN,KAAKO,IAAI;IACxC,OAAO,IAAIN,YAAGO,mBAAmB,CAACR,OAAO;QACrC,MAAM,IAAIS,MAAM;IACpB,OAAO;QACH,OAAOV,QAAQI,mBAAmB,CAACH;IACvC;AACJ"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './transformNewExpression';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformNewExpression/index.ts"],"sourcesContent":["export * from './transformNewExpression';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "transformNewExpression", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return transformNewExpression;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescript = /*#__PURE__*/ _interop_require_wildcard._(require("typescript"));
|
13
|
+
const _typescripttolua = /*#__PURE__*/ _interop_require_wildcard._(require("typescript-to-lua"));
|
14
|
+
const _call = require("typescript-to-lua/dist/transformation/visitors/call");
|
15
|
+
const transformNewExpression = (node, context)=>{
|
16
|
+
const signature = context.checker.getResolvedSignature(node);
|
17
|
+
var _node_arguments;
|
18
|
+
const [name, params] = (0, _call.transformCallAndArguments)(context, node.expression, (_node_arguments = node.arguments) != null ? _node_arguments : [
|
19
|
+
_typescript.factory.createTrue()
|
20
|
+
], signature);
|
21
|
+
return _typescripttolua.createCallExpression(name, params);
|
22
|
+
};
|
23
|
+
|
24
|
+
//# sourceMappingURL=transformNewExpression.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformNewExpression/transformNewExpression.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { FunctionVisitor } from 'typescript-to-lua';\nimport * as tstl from 'typescript-to-lua';\nimport { transformCallAndArguments } from 'typescript-to-lua/dist/transformation/visitors/call';\n\nexport const transformNewExpression = ((node, context) => {\n const signature = context.checker.getResolvedSignature(node);\n const [name, params] = transformCallAndArguments(\n context,\n node.expression,\n node.arguments ?? [ts.factory.createTrue()],\n signature\n );\n return tstl.createCallExpression(name, params);\n}) satisfies FunctionVisitor<ts.NewExpression>;\n"],"names":["transformNewExpression","node","context","signature","checker","getResolvedSignature","name","params","transformCallAndArguments","expression","arguments","ts","factory","createTrue","tstl","createCallExpression"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAKaA;;;eAAAA;;;;sEALO;2EAEE;sBACoB;AAEnC,MAAMA,yBAA0B,CAACC,MAAMC;IAC1C,MAAMC,YAAYD,QAAQE,OAAO,CAACC,oBAAoB,CAACJ;QAInDA;IAHJ,MAAM,CAACK,MAAMC,OAAO,GAAGC,IAAAA,+BAAyB,EAC5CN,SACAD,KAAKQ,UAAU,EACfR,CAAAA,kBAAAA,KAAKS,SAAS,YAAdT,kBAAkB;QAACU,YAAGC,OAAO,CAACC,UAAU;KAAG,EAC3CV;IAEJ,OAAOW,iBAAKC,oBAAoB,CAACT,MAAMC;AAC3C"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import * as ts from 'typescript';
|
2
|
+
import { ImportMap } from '../ImportMap';
|
3
|
+
export declare const getTransformPropertyAccessExpression: (importMap: ImportMap) => (node: ts.PropertyAccessExpression, context: import("typescript-to-lua").TransformationContext) => import("typescript-to-lua").Expression;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getTransformPropertyAccessExpression", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return getTransformPropertyAccessExpression;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _typescript = /*#__PURE__*/ _interop_require_wildcard._(require("typescript"));
|
13
|
+
const getTransformPropertyAccessExpression = (importMap)=>{
|
14
|
+
return (node, context)=>{
|
15
|
+
if (_typescript.isIdentifier(node.expression)) {
|
16
|
+
importMap.processName(node.name.text);
|
17
|
+
}
|
18
|
+
return context.superTransformExpression(node);
|
19
|
+
};
|
20
|
+
};
|
21
|
+
|
22
|
+
//# sourceMappingURL=getTransformPropertyAccessExpression.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformPropertyAccessExpression/getTransformPropertyAccessExpression.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { FunctionVisitor } from 'typescript-to-lua';\nimport { ImportMap } from '../ImportMap';\n\nexport const getTransformPropertyAccessExpression = (importMap: ImportMap) => {\n return ((node, context) => {\n if (ts.isIdentifier(node.expression)) {\n importMap.processName(node.name.text);\n }\n\n return context.superTransformExpression(node);\n }) satisfies FunctionVisitor<ts.PropertyAccessExpression>;\n};\n"],"names":["getTransformPropertyAccessExpression","importMap","node","context","ts","isIdentifier","expression","processName","name","text","superTransformExpression"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAIaA;;;eAAAA;;;;sEAJO;AAIb,MAAMA,uCAAuC,CAACC;IACjD,OAAQ,CAACC,MAAMC;QACX,IAAIC,YAAGC,YAAY,CAACH,KAAKI,UAAU,GAAG;YAClCL,UAAUM,WAAW,CAACL,KAAKM,IAAI,CAACC,IAAI;QACxC;QAEA,OAAON,QAAQO,wBAAwB,CAACR;IAC5C;AACJ"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './getTransformPropertyAccessExpression';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformPropertyAccessExpression/index.ts"],"sourcesContent":["export * from './getTransformPropertyAccessExpression';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './transformSuperExpression';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformSuperExpression/index.ts"],"sourcesContent":["export * from './transformSuperExpression';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import * as ts from 'typescript';
|
2
|
+
import { TransformationContext } from 'typescript-to-lua';
|
3
|
+
import * as lua from 'typescript-to-lua/dist/LuaAST';
|
4
|
+
import { ClassSuperInfo } from '../types';
|
5
|
+
export declare const transformSuperExpression: (expression: ts.SuperExpression, context: TransformationContext & {
|
6
|
+
classSuperInfos?: ClassSuperInfo[];
|
7
|
+
}) => lua.Identifier | lua.TableIndexExpression;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "transformSuperExpression", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return transformSuperExpression;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _LuaAST = /*#__PURE__*/ _interop_require_wildcard._(require("typescript-to-lua/dist/LuaAST"));
|
13
|
+
const transformSuperExpression = (expression, context)=>{
|
14
|
+
const superInfos = context.classSuperInfos;
|
15
|
+
let superInfo = undefined;
|
16
|
+
if (superInfos) {
|
17
|
+
superInfo = superInfos[superInfos.length - 1];
|
18
|
+
}
|
19
|
+
if (!superInfo) return _LuaAST.createAnonymousIdentifier(expression);
|
20
|
+
const { className } = superInfo;
|
21
|
+
return _LuaAST.createTableIndexExpression(className, _LuaAST.createStringLiteral('super'));
|
22
|
+
};
|
23
|
+
|
24
|
+
//# sourceMappingURL=transformSuperExpression.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tstl-plugin/src/transformSuperExpression/transformSuperExpression.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { FunctionVisitor, TransformationContext } from 'typescript-to-lua';\nimport * as lua from 'typescript-to-lua/dist/LuaAST';\nimport { ClassSuperInfo } from '../types';\n\nexport const transformSuperExpression = ((\n expression,\n context: TransformationContext & { classSuperInfos?: ClassSuperInfo[] }\n) => {\n const superInfos = context.classSuperInfos;\n let superInfo: ClassSuperInfo | undefined = undefined;\n if (superInfos) {\n superInfo = superInfos[superInfos.length - 1];\n }\n if (!superInfo) return lua.createAnonymousIdentifier(expression);\n const { className } = superInfo;\n\n return lua.createTableIndexExpression(\n className,\n lua.createStringLiteral('super')\n );\n}) satisfies FunctionVisitor<ts.SuperExpression>;\n"],"names":["transformSuperExpression","expression","context","superInfos","classSuperInfos","superInfo","undefined","length","lua","createAnonymousIdentifier","className","createTableIndexExpression","createStringLiteral"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAKaA;;;eAAAA;;;;kEAHQ;AAGd,MAAMA,2BAA4B,CACrCC,YACAC;IAEA,MAAMC,aAAaD,QAAQE,eAAe;IAC1C,IAAIC,YAAwCC;IAC5C,IAAIH,YAAY;QACZE,YAAYF,UAAU,CAACA,WAAWI,MAAM,GAAG,EAAE;IACjD;IACA,IAAI,CAACF,WAAW,OAAOG,QAAIC,yBAAyB,CAACR;IACrD,MAAM,EAAES,SAAS,EAAE,GAAGL;IAEtB,OAAOG,QAAIG,0BAA0B,CACjCD,WACAF,QAAII,mBAAmB,CAAC;AAEhC"}
|
package/assets/types.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../libs/tstl-plugin/src/types.ts"],"names":[],"rangeMappings":"","mappings":""}
|