xray16 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/package.json +7 -4
- package/plugins/built_at_info.js +14 -0
- package/plugins/from_cast_utils.js +29 -0
- package/plugins/global_declarations_transform.js +20 -0
- package/plugins/inject_filename.js +20 -0
- package/plugins/plugins/built_at_info.js +12 -0
- package/plugins/plugins/from_cast_utils.js +27 -0
- package/plugins/plugins/global_declarations_transform.js +18 -0
- package/plugins/plugins/inject_filename.js +18 -0
- package/plugins/plugins/strip_lua_logger.js +51 -0
- package/plugins/plugins/transform_luabind_class/plugin.js +34 -0
- package/plugins/plugins/transform_luabind_class/transformation/class_declaration.js +141 -0
- package/plugins/plugins/transform_luabind_class/transformation/constants.js +4 -0
- package/plugins/plugins/transform_luabind_class/transformation/decorators.js +12 -0
- package/plugins/plugins/transform_luabind_class/transformation/errors.js +25 -0
- package/plugins/{transform_luabind_class/transformation/index.ts → plugins/transform_luabind_class/transformation/index.js} +5 -5
- package/plugins/plugins/transform_luabind_class/transformation/members/accessors.js +35 -0
- package/plugins/plugins/transform_luabind_class/transformation/members/constructor.js +56 -0
- package/plugins/plugins/transform_luabind_class/transformation/members/fields.js +36 -0
- package/plugins/plugins/transform_luabind_class/transformation/members/method.js +49 -0
- package/plugins/plugins/transform_luabind_class/transformation/new.js +8 -0
- package/plugins/plugins/transform_luabind_class/transformation/setup.js +76 -0
- package/plugins/plugins/transform_luabind_class/transformation/super.js +65 -0
- package/plugins/plugins/transform_luabind_class/transformation/utils.js +67 -0
- package/plugins/plugins/utils/diagnostics.js +17 -0
- package/plugins/strip_lua_logger.js +53 -0
- package/plugins/transform_luabind_class/plugin.js +36 -0
- package/plugins/transform_luabind_class/transformation/class_declaration.js +147 -0
- package/plugins/transform_luabind_class/transformation/constants.js +7 -0
- package/plugins/transform_luabind_class/transformation/decorators.js +16 -0
- package/plugins/transform_luabind_class/transformation/errors.js +28 -0
- package/plugins/transform_luabind_class/transformation/index.js +21 -0
- package/plugins/transform_luabind_class/transformation/members/accessors.js +39 -0
- package/plugins/transform_luabind_class/transformation/members/constructor.js +61 -0
- package/plugins/transform_luabind_class/transformation/members/fields.js +41 -0
- package/plugins/transform_luabind_class/transformation/members/method.js +56 -0
- package/plugins/transform_luabind_class/transformation/new.js +12 -0
- package/plugins/transform_luabind_class/transformation/setup.js +81 -0
- package/plugins/transform_luabind_class/transformation/super.js +72 -0
- package/plugins/transform_luabind_class/transformation/utils.js +77 -0
- package/plugins/utils/diagnostics.js +22 -0
- package/types/index.d.ts +63 -0
- package/{src → types}/xr_object/xr_client_object.d.ts +4 -1
- package/plugins/built_at_info.ts +0 -18
- package/plugins/from_cast_utils.ts +0 -34
- package/plugins/global_declarations_transform.ts +0 -24
- package/plugins/inject_filename.ts +0 -22
- package/plugins/strip_lua_logger.ts +0 -73
- package/plugins/transform_luabind_class/plugin.ts +0 -51
- package/plugins/transform_luabind_class/transformation/class_declaration.ts +0 -226
- package/plugins/transform_luabind_class/transformation/constants.ts +0 -4
- package/plugins/transform_luabind_class/transformation/decorators.ts +0 -16
- package/plugins/transform_luabind_class/transformation/errors.ts +0 -31
- package/plugins/transform_luabind_class/transformation/members/accessors.ts +0 -48
- package/plugins/transform_luabind_class/transformation/members/constructor.ts +0 -107
- package/plugins/transform_luabind_class/transformation/members/fields.ts +0 -53
- package/plugins/transform_luabind_class/transformation/members/method.ts +0 -70
- package/plugins/transform_luabind_class/transformation/new.ts +0 -14
- package/plugins/transform_luabind_class/transformation/setup.ts +0 -128
- package/plugins/transform_luabind_class/transformation/super.ts +0 -92
- package/plugins/transform_luabind_class/transformation/utils.ts +0 -90
- package/plugins/utils/diagnostics.ts +0 -24
- package/src/index.d.ts +0 -63
- /package/{src → types}/xr_constant.d.ts +0 -0
- /package/{src → types}/xr_core.d.ts +0 -0
- /package/{src → types}/xr_global.d.ts +0 -0
- /package/{src → types}/xr_lib/xr_fs.d.ts +0 -0
- /package/{src → types}/xr_lib/xr_math.d.ts +0 -0
- /package/{src → types}/xr_lib/xr_utils.d.ts +0 -0
- /package/{src → types}/xr_luabind.d.ts +0 -0
- /package/{src → types}/xr_map/xr_map.d.ts +0 -0
- /package/{src → types}/xr_object/xr_action.d.ts +0 -0
- /package/{src → types}/xr_object/xr_alife.d.ts +0 -0
- /package/{src → types}/xr_object/xr_anomaly.d.ts +0 -0
- /package/{src → types}/xr_object/xr_artefact.d.ts +0 -0
- /package/{src → types}/xr_object/xr_creature.d.ts +0 -0
- /package/{src → types}/xr_object/xr_dialog.d.ts +0 -0
- /package/{src → types}/xr_object/xr_item.d.ts +0 -0
- /package/{src → types}/xr_object/xr_level.d.ts +0 -0
- /package/{src → types}/xr_object/xr_physic.d.ts +0 -0
- /package/{src → types}/xr_object/xr_quest.d.ts +0 -0
- /package/{src → types}/xr_object/xr_server_object.d.ts +0 -0
- /package/{src → types}/xr_online/xr_multiplayer.d.ts +0 -0
- /package/{src → types}/xr_sound/xr_sound.d.ts +0 -0
- /package/{src → types}/xr_type/xr_enums.d.ts +0 -0
- /package/{src → types}/xr_type/xr_type.d.ts +0 -0
- /package/{src → types}/xr_ui/README.md +0 -0
- /package/{src → types}/xr_ui/demo/CServerList.png +0 -0
- /package/{src → types}/xr_ui/demo/CUI3tButton.png +0 -0
- /package/{src → types}/xr_ui/demo/CUICheckButton.png +0 -0
- /package/{src → types}/xr_ui/demo/CUIComboBox.png +0 -0
- /package/{src → types}/xr_ui/demo/CUICustomEdit.png +0 -0
- /package/{src → types}/xr_ui/demo/CUIStatic.png +0 -0
- /package/{src → types}/xr_ui/demo/CUITrackBar.png +0 -0
- /package/{src → types}/xr_ui/xr_ui_core.d.ts +0 -0
- /package/{src → types}/xr_ui/xr_ui_interface.d.ts +0 -0
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ITransformationContext } from "./index";
|
|
2
|
-
import { NewExpression } from "typescript";
|
|
3
|
-
import * as tstl from "typescript-to-lua";
|
|
4
|
-
import { transformArguments } from "typescript-to-lua/dist/transformation/visitors/call";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Transform new call for luabind class as ClassConstructor() instead of TS_NEW from tstl.
|
|
8
|
-
*/
|
|
9
|
-
export function transformNewCallExpression(expression: NewExpression, context: ITransformationContext) {
|
|
10
|
-
return tstl.createCallExpression(
|
|
11
|
-
context.transformExpression(expression.expression),
|
|
12
|
-
transformArguments(context, expression.arguments ?? [])
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { LUABIND_NAME_FIELD } from "./constants";
|
|
2
|
-
import { ClassLikeDeclarationBase, isIdentifier, isVariableDeclaration } from "typescript";
|
|
3
|
-
import * as tstl from "typescript-to-lua";
|
|
4
|
-
import { TransformationContext } from "typescript-to-lua";
|
|
5
|
-
import {
|
|
6
|
-
createDefaultExportStringLiteral,
|
|
7
|
-
createExportedIdentifier,
|
|
8
|
-
getIdentifierExportScope,
|
|
9
|
-
hasDefaultExportModifier,
|
|
10
|
-
} from "typescript-to-lua/dist/transformation/utils/export";
|
|
11
|
-
import {
|
|
12
|
-
createExportsIdentifier,
|
|
13
|
-
createLocalOrExportedOrGlobalDeclaration,
|
|
14
|
-
} from "typescript-to-lua/dist/transformation/utils/lua-ast";
|
|
15
|
-
import { getExtendedNode } from "./utils";
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Create full class setup statement with name/super calls/methods/declaration/fields etc.
|
|
19
|
-
*/
|
|
20
|
-
export function createClassSetup(
|
|
21
|
-
context: TransformationContext,
|
|
22
|
-
statement: ClassLikeDeclarationBase,
|
|
23
|
-
className: tstl.Identifier,
|
|
24
|
-
localClassName: tstl.Identifier
|
|
25
|
-
) {
|
|
26
|
-
const result: tstl.Statement[] = [];
|
|
27
|
-
|
|
28
|
-
// class("name")(base)
|
|
29
|
-
const classInitializer = createLuabindClassStatement(statement, context, localClassName);
|
|
30
|
-
|
|
31
|
-
result.push(tstl.createExpressionStatement(classInitializer));
|
|
32
|
-
|
|
33
|
-
const classReference = createLuabindClassGlobalClassRef(statement, context, localClassName);
|
|
34
|
-
|
|
35
|
-
const defaultExportLeftHandSide = hasDefaultExportModifier(statement)
|
|
36
|
-
? tstl.createTableIndexExpression(createExportsIdentifier(), createDefaultExportStringLiteral(statement))
|
|
37
|
-
: undefined;
|
|
38
|
-
|
|
39
|
-
// [____exports.]className = class()
|
|
40
|
-
if (defaultExportLeftHandSide) {
|
|
41
|
-
result.push(tstl.createAssignmentStatement(defaultExportLeftHandSide, classReference, statement));
|
|
42
|
-
} else {
|
|
43
|
-
result.push(...createLocalOrExportedOrGlobalDeclaration(context, className, classReference, statement));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (defaultExportLeftHandSide) {
|
|
47
|
-
// local localClassName = ____exports.default
|
|
48
|
-
result.push(tstl.createVariableDeclarationStatement(localClassName, defaultExportLeftHandSide));
|
|
49
|
-
} else {
|
|
50
|
-
const exportScope = getIdentifierExportScope(context, className);
|
|
51
|
-
if (exportScope) {
|
|
52
|
-
// local localClassName = ____exports.className
|
|
53
|
-
result.push(
|
|
54
|
-
tstl.createVariableDeclarationStatement(
|
|
55
|
-
localClassName,
|
|
56
|
-
createExportedIdentifier(context, tstl.cloneIdentifier(className), exportScope)
|
|
57
|
-
)
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// localClassName.__name = className
|
|
63
|
-
result.push(
|
|
64
|
-
tstl.createAssignmentStatement(
|
|
65
|
-
tstl.createTableIndexExpression(
|
|
66
|
-
tstl.cloneIdentifier(localClassName),
|
|
67
|
-
tstl.createStringLiteral(LUABIND_NAME_FIELD)
|
|
68
|
-
),
|
|
69
|
-
getReflectionClassName(statement, className),
|
|
70
|
-
statement
|
|
71
|
-
)
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function getReflectionClassName(
|
|
78
|
-
declaration: ClassLikeDeclarationBase,
|
|
79
|
-
className: tstl.Identifier
|
|
80
|
-
): tstl.Expression {
|
|
81
|
-
if (declaration.name) {
|
|
82
|
-
return tstl.createStringLiteral(declaration.name.text);
|
|
83
|
-
} else if (isVariableDeclaration(declaration.parent) && isIdentifier(declaration.parent.name)) {
|
|
84
|
-
return tstl.createStringLiteral(declaration.parent.name.text);
|
|
85
|
-
} else if (hasDefaultExportModifier(declaration)) {
|
|
86
|
-
return tstl.createStringLiteral("default");
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (getExtendedNode(declaration)) {
|
|
90
|
-
return tstl.createTableIndexExpression(className, tstl.createStringLiteral("name"));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return tstl.createStringLiteral("");
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Creates class("Name")(base) expression for luabind classes.
|
|
98
|
-
*/
|
|
99
|
-
function createLuabindClassStatement(
|
|
100
|
-
declaration: ClassLikeDeclarationBase,
|
|
101
|
-
context: TransformationContext,
|
|
102
|
-
className: tstl.Identifier
|
|
103
|
-
) {
|
|
104
|
-
const extendedNode = getExtendedNode(declaration);
|
|
105
|
-
|
|
106
|
-
let classDeclaration = tstl.createCallExpression(tstl.createIdentifier("class"), [
|
|
107
|
-
getReflectionClassName(declaration, className),
|
|
108
|
-
]);
|
|
109
|
-
|
|
110
|
-
if (extendedNode) {
|
|
111
|
-
classDeclaration = tstl.createCallExpression(classDeclaration, [
|
|
112
|
-
context.transformExpression(extendedNode.expression),
|
|
113
|
-
]);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return classDeclaration;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Creates name expression for luabind classes.
|
|
121
|
-
*/
|
|
122
|
-
function createLuabindClassGlobalClassRef(
|
|
123
|
-
declaration: ClassLikeDeclarationBase,
|
|
124
|
-
context: TransformationContext,
|
|
125
|
-
className: tstl.Identifier
|
|
126
|
-
) {
|
|
127
|
-
return className;
|
|
128
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { CallExpression, Expression, factory, isIdentifier, SuperExpression, SyntaxKind } from "typescript";
|
|
2
|
-
import * as tstl from "typescript-to-lua";
|
|
3
|
-
import { isSymbolExported } from "typescript-to-lua/dist/transformation/utils/export";
|
|
4
|
-
import { getCalledExpression, transformArguments } from "typescript-to-lua/dist/transformation/visitors/call";
|
|
5
|
-
import { transformIdentifier } from "typescript-to-lua/dist/transformation/visitors/identifier";
|
|
6
|
-
import { ITransformationContext } from "./class_declaration";
|
|
7
|
-
import { LUABIND_CONSTRUCTOR_METHOD } from "./constants";
|
|
8
|
-
import { isLuabindClassType } from "./utils";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Transform generic methods super calls.
|
|
12
|
-
* Example: super.parentMethod(first, second).
|
|
13
|
-
*/
|
|
14
|
-
export function transformClassSuperMethodExpression(expression: Expression, context: ITransformationContext) {
|
|
15
|
-
const superInfos = context.classSuperInfos;
|
|
16
|
-
const superInfo = superInfos[superInfos.length - 1];
|
|
17
|
-
|
|
18
|
-
if (!superInfo.classDeclaration || !isLuabindClassType(superInfo.classDeclaration, context)) {
|
|
19
|
-
return context.superTransformExpression(expression);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const { extendedTypeNode } = superInfo;
|
|
23
|
-
|
|
24
|
-
// Using `super` without extended type node is a TypeScript error
|
|
25
|
-
const extendsExpression = extendedTypeNode?.expression;
|
|
26
|
-
let baseClassName: tstl.AssignmentLeftHandSideExpression | undefined;
|
|
27
|
-
|
|
28
|
-
if (extendsExpression && isIdentifier(extendsExpression)) {
|
|
29
|
-
const symbol = context.checker.getSymbolAtLocation(extendsExpression);
|
|
30
|
-
if (symbol && !isSymbolExported(context, symbol)) {
|
|
31
|
-
// Use "baseClassName" if base is a simple identifier
|
|
32
|
-
baseClassName = transformIdentifier(context, extendsExpression);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (!baseClassName) {
|
|
37
|
-
throw new Error("Super without identifier - not supported with luabind.");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return baseClassName;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Check if super() call is in luabind class target.
|
|
45
|
-
*/
|
|
46
|
-
export function isLuabindClassSuperCall(
|
|
47
|
-
expression: CallExpression | SuperExpression,
|
|
48
|
-
context: ITransformationContext
|
|
49
|
-
): boolean {
|
|
50
|
-
const calledExpression: Expression = getCalledExpression(expression as CallExpression);
|
|
51
|
-
|
|
52
|
-
if (calledExpression.kind !== SyntaxKind.SuperKeyword) {
|
|
53
|
-
return false;
|
|
54
|
-
} else {
|
|
55
|
-
const superInfos = context.classSuperInfos;
|
|
56
|
-
const superInfo = superInfos[superInfos.length - 1];
|
|
57
|
-
|
|
58
|
-
// Handle super calls properly for luabind classes.
|
|
59
|
-
return superInfo?.classDeclaration ? isLuabindClassType(superInfo.classDeclaration, context) : false;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Check if super.method() call is in luabind class target.
|
|
65
|
-
*/
|
|
66
|
-
export function isLuabindClassSuperMethodCall(
|
|
67
|
-
expression: CallExpression | SuperExpression,
|
|
68
|
-
context: ITransformationContext
|
|
69
|
-
): boolean {
|
|
70
|
-
const superInfos = context.classSuperInfos;
|
|
71
|
-
const superInfo = superInfos[superInfos.length - 1];
|
|
72
|
-
|
|
73
|
-
// Handle super calls properly for luabind classes.
|
|
74
|
-
return superInfo?.classDeclaration ? isLuabindClassType(superInfo.classDeclaration, context) : false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Transform super() call in luabind classes to base_class.__init(self, param).
|
|
79
|
-
*/
|
|
80
|
-
export function transformLuabindConstructorSuperCall(expression: CallExpression, context: ITransformationContext) {
|
|
81
|
-
const signature = context.checker.getResolvedSignature(expression);
|
|
82
|
-
const parameters = transformArguments(context, expression.arguments, signature, factory.createThis());
|
|
83
|
-
|
|
84
|
-
return tstl.createCallExpression(
|
|
85
|
-
tstl.createTableIndexExpression(
|
|
86
|
-
context.transformExpression(factory.createSuper()),
|
|
87
|
-
tstl.createStringLiteral(LUABIND_CONSTRUCTOR_METHOD)
|
|
88
|
-
),
|
|
89
|
-
parameters,
|
|
90
|
-
expression
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { LUABIND_DECORATOR, LUABIND_SYMBOL } from "./constants";
|
|
2
|
-
import {
|
|
3
|
-
ClassLikeDeclaration,
|
|
4
|
-
ClassLikeDeclarationBase,
|
|
5
|
-
Expression,
|
|
6
|
-
ExpressionWithTypeArguments,
|
|
7
|
-
getDecorators,
|
|
8
|
-
HasModifiers,
|
|
9
|
-
HeritageClause,
|
|
10
|
-
SyntaxKind,
|
|
11
|
-
Type,
|
|
12
|
-
} from "typescript";
|
|
13
|
-
import { TransformationContext } from "typescript-to-lua";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Whether method / field is static.
|
|
17
|
-
*/
|
|
18
|
-
export function isStaticNode(node: HasModifiers): boolean {
|
|
19
|
-
return node.modifiers?.some((m) => m.kind === SyntaxKind.StaticKeyword) === true;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get class extends node.
|
|
24
|
-
*/
|
|
25
|
-
export function getExtendsClause(node: ClassLikeDeclarationBase): HeritageClause | undefined {
|
|
26
|
-
return node.heritageClauses?.find((clause) => clause.token === SyntaxKind.ExtendsKeyword);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get class extended node.
|
|
31
|
-
*/
|
|
32
|
-
export function getExtendedNode(node: ClassLikeDeclarationBase): ExpressionWithTypeArguments | undefined {
|
|
33
|
-
const extendsClause = getExtendsClause(node);
|
|
34
|
-
if (!extendsClause) return;
|
|
35
|
-
|
|
36
|
-
return extendsClause.types[0];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Get class extended node.
|
|
41
|
-
*/
|
|
42
|
-
export function getExtendedType(context: TransformationContext, node: ClassLikeDeclarationBase): Type | undefined {
|
|
43
|
-
const extendedNode = getExtendedNode(node);
|
|
44
|
-
return extendedNode && context.checker.getTypeAtLocation(extendedNode);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Check if class is decorated with provided decorator name.
|
|
49
|
-
*/
|
|
50
|
-
export function isLuabindDecoratedClass(declaration: ClassLikeDeclaration): boolean {
|
|
51
|
-
const decorators = getDecorators(declaration);
|
|
52
|
-
|
|
53
|
-
if (!decorators) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return decorators.some((it) => (it.expression as unknown as any).expression?.escapedText === LUABIND_DECORATOR);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Mark provided class as Luabind target.
|
|
62
|
-
*/
|
|
63
|
-
export function markTypeAsLuabind(declaration: ClassLikeDeclaration, context: TransformationContext): void {
|
|
64
|
-
const typeAtLocation = context.checker.getTypeAtLocation(declaration);
|
|
65
|
-
const typeSymbol = typeAtLocation.symbol || typeAtLocation.aliasSymbol;
|
|
66
|
-
|
|
67
|
-
(typeSymbol as {})[LUABIND_SYMBOL] = true;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Check if provided class is specified as LuaBind.
|
|
72
|
-
*/
|
|
73
|
-
export function isLuabindClassType(
|
|
74
|
-
declaration: Expression | ClassLikeDeclaration,
|
|
75
|
-
context: TransformationContext
|
|
76
|
-
): boolean {
|
|
77
|
-
const typeAtLocation = context.checker.getTypeAtLocation(declaration);
|
|
78
|
-
const typeSymbol = typeAtLocation.symbol || typeAtLocation.aliasSymbol;
|
|
79
|
-
|
|
80
|
-
if (typeSymbol) {
|
|
81
|
-
const isMarked = (typeSymbol as {})[LUABIND_SYMBOL] === true;
|
|
82
|
-
if (isMarked) {
|
|
83
|
-
return true;
|
|
84
|
-
} else {
|
|
85
|
-
return isLuabindDecoratedClass(typeSymbol.declarations[0] as ClassLikeDeclaration);
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { DiagnosticCategory, getOriginalNode, Node } from "typescript";
|
|
2
|
-
import { createSerialDiagnosticFactory } from "typescript-to-lua/dist/utils";
|
|
3
|
-
|
|
4
|
-
type MessageProvider<TArgs extends any[]> = string | ((...args: TArgs) => string);
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Create diagnostics factory to push errors when transpile lua to typescript.
|
|
8
|
-
*/
|
|
9
|
-
export function createDiagnosticFactory<TArgs extends any[]>(
|
|
10
|
-
category: DiagnosticCategory,
|
|
11
|
-
message: MessageProvider<TArgs>
|
|
12
|
-
) {
|
|
13
|
-
return createSerialDiagnosticFactory((node: Node, ...args: TArgs) => ({
|
|
14
|
-
file: getOriginalNode(node).getSourceFile(),
|
|
15
|
-
start: getOriginalNode(node).getStart(),
|
|
16
|
-
length: getOriginalNode(node).getWidth(),
|
|
17
|
-
messageText: typeof message === "string" ? message : message(...args),
|
|
18
|
-
category,
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function createErrorDiagnosticFactory<TArgs extends any[]>(message: MessageProvider<TArgs>) {
|
|
23
|
-
return createDiagnosticFactory(DiagnosticCategory.Error, message);
|
|
24
|
-
}
|
package/src/index.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/// <reference path="./xr_lib/xr_fs.d.ts" />
|
|
2
|
-
/// <reference path="./xr_lib/xr_math.d.ts" />
|
|
3
|
-
/// <reference path="./xr_lib/xr_utils.d.ts" />
|
|
4
|
-
/// <reference path="./xr_map/xr_map.d.ts" />
|
|
5
|
-
/// <reference path="./xr_object/xr_action.d.ts" />
|
|
6
|
-
/// <reference path="./xr_object/xr_alife.d.ts" />
|
|
7
|
-
/// <reference path="./xr_object/xr_anomaly.d.ts" />
|
|
8
|
-
/// <reference path="./xr_object/xr_artefact.d.ts" />
|
|
9
|
-
/// <reference path="./xr_object/xr_client_object.d.ts" />
|
|
10
|
-
/// <reference path="./xr_object/xr_creature.d.ts" />
|
|
11
|
-
/// <reference path="./xr_object/xr_dialog.d.ts" />
|
|
12
|
-
/// <reference path="./xr_object/xr_item.d.ts" />
|
|
13
|
-
/// <reference path="./xr_object/xr_level.d.ts" />
|
|
14
|
-
/// <reference path="./xr_object/xr_physic.d.ts" />
|
|
15
|
-
/// <reference path="./xr_object/xr_quest.d.ts" />
|
|
16
|
-
/// <reference path="./xr_object/xr_server_object.d.ts" />
|
|
17
|
-
/// <reference path="./xr_online/xr_multiplayer.d.ts" />
|
|
18
|
-
/// <reference path="./xr_sound/xr_sound.d.ts" />
|
|
19
|
-
/// <reference path="./xr_type/xr_enums.d.ts" />
|
|
20
|
-
/// <reference path="./xr_type/xr_type.d.ts" />
|
|
21
|
-
/// <reference path="./xr_ui/xr_ui_core.d.ts" />
|
|
22
|
-
/// <reference path="./xr_ui/xr_ui_interface.d.ts" />
|
|
23
|
-
/// <reference path="./xr_constant.d.ts" />
|
|
24
|
-
/// <reference path="./xr_core.d.ts" />
|
|
25
|
-
/// <reference path="./xr_global.d.ts" />
|
|
26
|
-
/// <reference path="./xr_luabind.d.ts" />
|
|
27
|
-
|
|
28
|
-
declare module "xray16" {
|
|
29
|
-
/**
|
|
30
|
-
* @group export
|
|
31
|
-
*/
|
|
32
|
-
export const actor_stats: IXR_actor_stats;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @group export
|
|
36
|
-
*/
|
|
37
|
-
export const ActorMenu: IXR_ActorMenu;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @group export
|
|
41
|
-
*/
|
|
42
|
-
export const game: IXR_game;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @group export
|
|
46
|
-
*/
|
|
47
|
-
export const level: IXR_level;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @group export
|
|
51
|
-
*/
|
|
52
|
-
export const main_menu: IXR_main_menu;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @group export
|
|
56
|
-
*/
|
|
57
|
-
export const object: typeof XR_object;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @group export
|
|
61
|
-
*/
|
|
62
|
-
export const relation_registry: IXR_relation_registry;
|
|
63
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|