Removed TS Builds in Repo

This commit is contained in:
Josef 2024-08-02 08:26:21 +02:00
parent d252280de5
commit 4f0d293349
70 changed files with 0 additions and 2187 deletions

View File

@ -1,174 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CppClassMember = exports.CppParameter = void 0;
const GodotTypes_1 = require("./GodotTypes");
class CppParameter {
constructor() {
this.name = "";
this.type = "";
}
}
exports.CppParameter = CppParameter;
class CppClassMember {
constructor(accessModifier, nameDefinition, body) {
this.name = "";
this.isMethod = false;
this.isVirtual = false;
this.isStatic = false;
this.isSignal = false;
this.type = "void";
this.initialValue = null;
this.parameters = [];
this.accessModifier = "";
this.parametersDefinition = "";
this.accessModifier = accessModifier;
if (nameDefinition.indexOf("()") != -1) {
this.isMethod = true;
let typeRegex = /\(\)\s*(?:\:\s*(.+)\s*)?$/;
let result = typeRegex.exec(nameDefinition);
if (result[1]) {
this.type = result[1];
}
nameDefinition = nameDefinition.replace(typeRegex, "");
}
let names = nameDefinition.split(/\s+/);
this.name = names[names.length - 1];
for (let i = 0; i < names.length - 1; i++) {
if ("virtual" === names[i]) {
this.isVirtual = true;
}
if ("static" === names[i]) {
this.isStatic = true;
}
if ("signal" === names[i]) {
this.isSignal = true;
}
}
if (this.isMethod) {
this.parseMethodBody(body);
}
else {
this.parseVariableBody(body);
}
}
get isMemberWithInitialValue() {
return !this.isMethod && this.initialValue !== null;
}
getMemberInitializer() {
return `${this.name} = ${this.initialValue};`;
}
parseVariableBody(body) {
if (typeof body === "boolean") {
this.type = "bool";
this.initialValue = body + "";
return;
}
if (typeof body === "number") {
this.type = "float";
this.initialValue = body + "";
return;
}
let regex = /((?:\w|\<|\>)+)(?:\s*\=\s*(.+))?/;
let result = regex.exec(body);
this.type = result[1];
this.initialValue = result[2] || null;
}
parseMethodBody(body) {
if (!body) {
return;
}
if (typeof body === "string") {
this.type = body;
return;
}
for (let it in body) {
if (!body.hasOwnProperty(it)) {
continue;
}
let cppParameter = new CppParameter();
cppParameter.name = it;
cppParameter.type = body[it];
this.parameters.push(cppParameter);
}
}
getMethodBinding(className) {
if (!this.isMethod) {
let type = GodotTypes_1.GodotTypes.stringToVariantType(this.type);
let bindings = [];
bindings.push(`/* ${this.name}: ${this.type} */`);
bindings.push(`ClassDB::bind_method(D_METHOD("get_${this.name}"), &${className}::get_${this.name});`);
bindings.push(`ClassDB::bind_method(D_METHOD("set_${this.name}"), &${className}::set_${this.name});`);
bindings.push(`ADD_PROPERTY(PropertyInfo(Variant::${type}, "${this.name}"), "set_${this.name}", "get_${this.name}");`);
bindings.push(` `);
//ClassDB::bind_method(D_METHOD("set_color", "color"), &GLTFLight::set_color);
//ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); // Color
return bindings.join("\n ");
}
if (this.isSignal) {
//ADD_SIGNAL(MethodInfo("session_supported", PropertyInfo(Variant::STRING, "session_mode"), PropertyInfo(Variant::BOOL, "supported")));
let parameterInfos = "";
for (let i = 0; i < this.parameters.length; i++) {
let type = GodotTypes_1.GodotTypes.stringToVariantType(this.parameters[i].type);
let name = this.parameters[i].name;
let pi = `, PropertyInfo(Variant::${type}, "${name}")`;
parameterInfos += pi;
}
return `ADD_SIGNAL (MethodInfo( "${this.name}" ${parameterInfos}) );`;
}
else if (this.isVirtual) {
let parameterInfos = "";
for (let i = 0; i < this.parameters.length; i++) {
let name = `, "${this.parameters[i].name}"`;
parameterInfos += name;
}
return `GDVIRTUAL_BIND( ${this.name}${parameterInfos} );`;
}
else {
return `ClassDB::bind_method( D_METHOD( "${this.name}" ) , &${className}::${this.name} );`;
}
}
getHeaderDefinition() {
if (this.isSignal) {
return `/* signal ${this.name} */`;
}
else if (this.isMethod) {
return this.getMethodHeaderDefinition();
}
else {
return this.getVariableHeaderDefinition();
}
}
getParametersDefinition() {
return this.parameters.map(p => p.type + " " + p.name).join(", ");
}
getMethodHeaderDefinition() {
if (this.isVirtual) {
let numParameters = this.parameters.length;
let methodReturnType = this.type === "void" ? "" : "R";
let returnTypeDefinition = this.type === "void" ? "" : (this.type + ", ");
let parametersDefinition = "";
if (numParameters > 0) {
parametersDefinition = ", " + this.parameters.map(p => p.type).join(", ");
}
return `GDVIRTUAL${numParameters}${methodReturnType}( ${returnTypeDefinition}${this.name}${parametersDefinition} );`;
}
return `${this.type} ${this.name}(${this.parametersDefinition});`;
}
getVariableHeaderDefinition() {
return `${this.type} get_${this.name}(); void set_${this.name}( ${this.type} p_${this.name} );`;
//return `${this.type} ${this.name};`
}
getPropertyHeaderDefinition() {
return `${this.type} ${this.name};`;
}
getPropertyImplementation(className) {
let bindings = [];
bindings.push(`/* ${this.name}: ${this.type} */`);
bindings.push(`${this.type} ${className}::get_${this.name}() { return ${this.name}; }`);
bindings.push(`void ${className}::set_${this.name}( ${this.type} p_${this.name} ) { ${this.name} = p_${this.name}; }`);
bindings.push(` `);
return bindings.join("\n");
}
}
exports.CppClassMember = CppClassMember;
//# sourceMappingURL=CppClassMember.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,156 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CppCreator = void 0;
const CppClassMember_1 = require("./CppClassMember");
const CppHeaderCreator_1 = require("./CppHeaderCreator");
const CppImplementationCreator_1 = require("./CppImplementationCreator");
const Files_1 = require("./library/Files");
const Texts_1 = require("./library/Texts");
class CppCreator {
static createTypeRegistration(className) {
return `ClassDB::register_class<${className}>();`;
}
static createIncludes(className) {
console.log("Create include", className);
let godotClasses = {
"Node": "scene/main/node.h",
"Node2D": "scene/2d/node_2d.h",
"Node3D": "scene/3d/node_3d.h",
"Resource": "core/io/resource.h"
};
if (godotClasses[className]) {
return `#include "${godotClasses[className]}"`;
}
return `#include "./${className}.h"`;
}
static grabMembers(membersData, accessModifier) {
let members = [];
if (!membersData) {
return members;
}
for (let it in membersData) {
if (!membersData.hasOwnProperty(it)) {
continue;
}
let nameDefinition = it;
let memberData = membersData[it];
let actionRegex = /^\s*action\s+(\w+)\s*$/;
if (actionRegex.test(nameDefinition)) {
let name = actionRegex.exec(nameDefinition)[1];
let upperCaseName = name[0].toUpperCase() + name.substring(1);
let actionName = `on${upperCaseName}`;
let signal = `signal ${name}()`;
let actionGetter = `virtual get_${actionName}():Ref<RJAction>`;
let actionSetter = `virtual set_${actionName}()`;
members.push(new CppClassMember_1.CppClassMember(accessModifier, signal, {}));
members.push(new CppClassMember_1.CppClassMember("protected", "m_" + name, {}));
members.push(new CppClassMember_1.CppClassMember(accessModifier, actionGetter, {}));
members.push(new CppClassMember_1.CppClassMember(accessModifier, actionSetter, { "action": "Ref<RJAction>" }));
}
else {
let classMember = new CppClassMember_1.CppClassMember(accessModifier, nameDefinition, memberData);
members.push(classMember);
}
}
return members;
}
static getHeaderDefine(className) {
className = className.replace(/^RJ/, "");
let output = [className[0]];
for (let i = 1; i < className.length; i++) {
let character = className[i];
let upperCaseCharacter = character.toUpperCase();
if (character === upperCaseCharacter) {
output.push("_");
}
output.push(upperCaseCharacter);
}
className = output.join("");
return "ROKOJORI__" + className + "_H";
}
static getRegistratedTypes(text) {
let matches = Texts_1.Texts.getMatches(text, CppCreator.classRegistrationRegex);
let types = matches.map(m => {
return { match: m.match, index: m.index, type: CppCreator.classRegistrationRegex.exec(m.match)[1] };
});
return types;
}
static createCppFiles(definitionPath, types, missingTypes) {
return __awaiter(this, void 0, void 0, function* () {
console.log("Creating: ", definitionPath);
let jsonPath = definitionPath;
// path.join( definitionsPath, definitionPath );
let isDir = yield Files_1.Files.isDirectory(jsonPath);
if (isDir) {
let files = yield Files_1.Files.getFiles(jsonPath);
for (let file of files) {
yield CppCreator.createCppFiles(Texts_1.Texts.joinPaths(jsonPath, file), types, missingTypes);
}
return Promise.resolve();
}
let data = yield Files_1.Files.loadJSON(jsonPath);
//console.log( "data:", jsonPath, data );
let classNameResult = /(\w+)(?:\:(\w+))?/.exec(data.class);
let className = classNameResult[1];
let extendingClass = classNameResult[2];
let headerDefine = CppCreator.getHeaderDefine(className);
let fromProtectedMembers = CppCreator.grabMembers(data.protected, "protected");
let fromPublicMembers = CppCreator.grabMembers(data.public, "public");
let protectedMembers = [];
let publicMembers = [];
let insertMember = (m) => {
let container = m.accessModifier === "public" ? publicMembers : protectedMembers;
container.push(m);
};
fromProtectedMembers.forEach(m => insertMember(m));
fromPublicMembers.forEach(m => insertMember(m));
let allMembers = [].concat(protectedMembers).concat(publicMembers);
let protectedHeader = protectedMembers.map(m => m.getHeaderDefinition()).join("\n ");
let publicHeader = publicMembers.map(m => m.getHeaderDefinition()).join("\n ");
let properties = publicMembers.filter(m => !m.isMethod);
let propertyDefinitions = properties.map(p => p.getPropertyHeaderDefinition()).join("\n ");
protectedHeader += "\n\n " + propertyDefinitions;
let methodBindings = allMembers.map(m => m.getMethodBinding(className)).join("\n ");
let initializers = allMembers.filter(m => m.isMemberWithInitialValue).map(m => m.getMemberInitializer()).join("\n ");
let includes = "";
if (data.includes) {
let mappedIncludes = data.includes.map((inc) => `#include "${inc}"`);
includes = mappedIncludes.join("\n");
}
let extendingClassInclude = CppCreator.createIncludes(extendingClass);
includes += "\n" + extendingClassInclude;
let header = CppHeaderCreator_1.CppHeaderCreator.create(className, extendingClass, headerDefine, protectedHeader, publicHeader, includes);
let constructorExpressions = initializers;
let destructorExpressions = "";
let methodImplementations = "";
let propertyImplementations = properties.map(p => p.getPropertyImplementation(className)).join("\n");
methodImplementations += propertyImplementations;
let implementation = CppImplementationCreator_1.CppImplementationCreator.craete(className, methodBindings, constructorExpressions, destructorExpressions, methodImplementations);
//console.log( header );
//console.log( implementation );
let hasType = types.find(t => t.type === className);
if (!hasType) {
missingTypes.push(className);
}
let rawFilePath = Texts_1.Texts.joinPaths(CppCreator.outputPath, className);
yield Files_1.Files.saveUTF8(rawFilePath + ".h", header);
yield Files_1.Files.saveUTF8(rawFilePath + ".cpp", implementation);
return Promise.resolve();
});
}
}
exports.CppCreator = CppCreator;
CppCreator.definitionsPath = __dirname + "/../../rokojori-action-library-definitions";
CppCreator.outputPath = __dirname + "/../../rokojori-action-library";
CppCreator.registerTypesPath = CppCreator.outputPath + "/register_types.cpp";
CppCreator.classRegistrationRegex = /ClassDB\:\:register_class\<(\w+)\>\(\)\;/;
//# sourceMappingURL=CppCreator.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,39 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CppHeaderCreator = void 0;
class CppHeaderCreator {
static create(className, extendingClassName, headerDefine, protectedMembers, publicMembers, includes) {
let cppHeader = `
/* ${className}.h */
#ifndef ${headerDefine}
#define ${headerDefine}
${includes}
class ${className} : public ${extendingClassName}
{
GDCLASS(${className}, ${extendingClassName});
protected:
static void _bind_methods();
${protectedMembers}
public:
${publicMembers}
${className}();
~${className}();
};
#endif // ${headerDefine}
`;
return cppHeader;
}
}
exports.CppHeaderCreator = CppHeaderCreator;
//# sourceMappingURL=CppHeaderCreator.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"CppHeaderCreator.js","sourceRoot":"","sources":["../source/CppHeaderCreator.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IAE3B,MAAM,CAAC,MAAM,CAAE,SAAgB,EAAE,kBAAyB,EACzC,YAAmB,EAAE,gBAAuB,EAC5C,aAAoB,EAAE,QAAe;QAGpD,IAAI,SAAS,GAEjB;KACK,SAAS;;UAEJ,YAAY;UACZ,YAAY;;EAEpB,QAAQ;;;QAGF,SAAS,aAAa,kBAAkB;;YAEpC,SAAS,KAAK,kBAAkB;;;;IAIxC,gBAAgB;;;;IAIhB,aAAa;;IAEb,SAAS;;KAER,SAAS;;;;YAIF,YAAY;CACvB,CAAA;QAEG,OAAO,SAAS,CAAC;IAGnB,CAAC;CAEF;AA5CD,4CA4CC"}

View File

@ -1,34 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CppImplementationCreator = void 0;
class CppImplementationCreator {
static craete(className, boundMethods, constructorExpressions, destructorExpressions, methodImplementations) {
let cppImplementation = `
/* ${className}.cpp */
#include "${className}.h"
void ${className}::_bind_methods()
{
${boundMethods}
}
${className}::${className}()
{
${constructorExpressions}
}
${className}::~${className}()
{
${destructorExpressions}
}
${methodImplementations}
`;
return cppImplementation;
}
}
exports.CppImplementationCreator = CppImplementationCreator;
//# sourceMappingURL=CppImplementationCreator.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"CppImplementationCreator.js","sourceRoot":"","sources":["../source/CppImplementationCreator.ts"],"names":[],"mappings":";;;AACA,MAAa,wBAAwB;IAGnC,MAAM,CAAC,MAAM,CAAE,SAAgB,EAAE,YAAmB,EACrC,sBAA6B,EAAE,qBAA4B,EAC3D,qBAA4B;QAGzC,IAAI,iBAAiB,GACzB;KACK,SAAS;;YAEF,SAAS;;;OAGd,SAAS;;IAEZ,YAAY;;;EAGd,SAAS,KAAK,SAAS;;IAErB,sBAAsB;;;EAGxB,SAAS,MAAM,SAAS;;IAEtB,qBAAqB;;;EAGvB,qBAAqB;;CAEtB,CAAA;QAEG,OAAO,iBAAiB,CAAC;IAE3B,CAAC;CAEF;AAtCD,4DAsCC"}

View File

@ -1,56 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GodotTypes = void 0;
class GodotTypes {
static stringToVariantType(stringType) {
if (/^TypedArray\<.+\>$/.test(stringType)) {
return "ARRAY";
}
switch (stringType) {
case "bool": return "BOOL";
case "int": return "INT";
case "float": return "FLOAT";
case "String": return "STRING";
// Math
case "Vector2": return "VECTOR2";
case "Vector2i": return "VECTOR2I";
case "Rect2": return "RECT2";
case "Rect2i": return "RECT2I";
case "Transform2D": return "TRANSFORM2D";
case "Vector3": return "VECTOR3";
case "Vector3i": return "VECTOR3I";
case "Vector4": return "VECTOR4";
case "Vector4i": return "VECTOR4I";
case "Plane": return "PLANE";
case "AABB": return "AABB";
case "Quaternion": return "QUATERNION";
case "Basis": return "BASIS";
case "Transform3D": return "TRANSFORM3D";
case "Projection": return "PROJECTION";
// Miscellaneous
case "Color": return "COLOR";
case "RID": return "RID";
case "Object": return "OBJECT";
case "Callable": return "CALLABLE";
case "Signal": return "SIGNAL";
case "StringName": return "STRING_NAME";
case "NodePath": return "NODE_PATH";
case "Dictionary": return "DICTIONARY";
case "Array": return "ARRAY";
// Arrays
case "PackedByteArray": return "PACKED_BYTE_ARRAY";
case "PackedInt32Array": return "PACKED_INT32_ARRAY";
case "PackedInt64Array": return "PACKED_INT64_ARRAY";
case "PackedFloat32Array": return "PACKED_FLOAT32_ARRAY";
case "PackedFloat64Array": return "PACKED_FLOAT64_ARRAY";
case "PackedStringArray": return "PACKED_STRING_ARRAY";
case "PackedVector2Array": return "PACKED_VECTOR2_ARRAY";
case "PackedVector3Array": return "PACKED_VECTOR3_ARRAY";
case "PackedColorArray": return "PACKED_COLOR_ARRAY";
}
console.error("Type could not be mapped: ", stringType);
return "OBJECT";
}
}
exports.GodotTypes = GodotTypes;
//# sourceMappingURL=GodotTypes.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"GodotTypes.js","sourceRoot":"","sources":["../source/GodotTypes.ts"],"names":[],"mappings":";;;AACA,MAAa,UAAU;IAErB,MAAM,CAAC,mBAAmB,CAAE,UAAiB;QAE3C,IAAK,oBAAoB,CAAC,IAAI,CAAE,UAAU,CAAE,EAC5C,CAAC;YACC,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,QAAQ,UAAU,EAClB,CAAC;YACC,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,CAAC;YAC3B,KAAK,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC;YAC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AAO,YAAY,CAAC;YACvC,KAAK,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC;YAE7B,SAAS;YACT,KAAK,iBAAiB,CAAC,CAAC,OAAO,mBAAmB,CAAC;YACnD,KAAK,kBAAkB,CAAC,CAAC,OAAO,oBAAoB,CAAC;YACrD,KAAK,kBAAkB,CAAC,CAAC,OAAO,oBAAoB,CAAC;YACrD,KAAK,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC;YACzD,KAAK,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC;YACzD,KAAK,mBAAmB,CAAC,CAAC,OAAO,qBAAqB,CAAC;YACvD,KAAK,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC;YACzD,KAAK,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC;YACzD,KAAK,kBAAkB,CAAC,CAAC,OAAO,oBAAoB,CAAC;QACvD,CAAC;QAED,OAAO,CAAC,KAAK,CAAE,4BAA4B,EAAE,UAAU,CAAE,CAAC;QAE1D,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA5DD,gCA4DC"}

View File

@ -1,43 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const RJLog_1 = require("./library/RJLog");
const fs = require("node:fs/promises");
let from = __dirname + "/../../rokojori-action-library";
let to = __dirname + "/../../godot/modules/rokojori_action_library";
function main() {
return __awaiter(this, void 0, void 0, function* () {
RJLog_1.RJLog.log("Copying C++ source");
yield deleteOldDirectory();
yield copyToModules();
// await runBuild();
RJLog_1.RJLog.log("Copying C++ source");
});
}
function deleteOldDirectory() {
return __awaiter(this, void 0, void 0, function* () {
let stats = yield fs.stat(to);
if (stats) {
RJLog_1.RJLog.log(`deleting previous directory: "${to}"`);
yield fs.rm(to, { recursive: true });
}
return Promise.resolve();
});
}
function copyToModules() {
return __awaiter(this, void 0, void 0, function* () {
RJLog_1.RJLog.log("copying:", `"${from}" >> "${to}"`);
yield fs.cp(from, to, { recursive: true });
return Promise.resolve();
});
}
main();
//# sourceMappingURL=copy-cpp-source.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"copy-cpp-source.js","sourceRoot":"","sources":["../source/copy-cpp-source.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,2CAAwC;AAExC,MAAM,EAAE,GAAG,OAAO,CAAE,kBAAkB,CAAE,CAAC;AAEzC,IAAI,IAAI,GAAG,SAAS,GAAG,gCAAgC,CAAC;AACxD,IAAI,EAAE,GAAK,SAAS,GAAG,8CAA8C,CAAA;AAErE,SAAe,IAAI;;QAEjB,aAAK,CAAC,GAAG,CAAE,oBAAoB,CAAE,CAAC;QAElC,MAAM,kBAAkB,EAAE,CAAC;QAC3B,MAAM,aAAa,EAAE,CAAC;QACtB,oBAAoB;QAEpB,aAAK,CAAC,GAAG,CAAE,oBAAoB,CAAE,CAAC;IACpC,CAAC;CAAA;AAED,SAAe,kBAAkB;;QAE/B,IAAI,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,CAAE,EAAE,CAAE,CAAC;QAEhC,IAAK,KAAK,EACV,CAAC;YACC,aAAK,CAAC,GAAG,CAAE,iCAAiC,EAAE,GAAG,CAAE,CAAC;YACpD,MAAM,EAAE,CAAC,EAAE,CAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAE,CAAC;QACzC,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CAAA;AAED,SAAe,aAAa;;QAE1B,aAAK,CAAC,GAAG,CAAE,UAAU,EAAE,IAAI,IAAI,SAAS,EAAE,GAAG,CAAE,CAAC;QAChD,MAAM,EAAE,CAAC,EAAE,CAAE,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAG,IAAI,EAAE,CAAE,CAAC;QAE9C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CAAA;AAID,IAAI,EAAE,CAAC"}

View File

@ -1,149 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CppCreator = void 0;
const Header_1 = require("./Header");
const Implementation_1 = require("./Implementation");
const Files_1 = require("../library/Files");
const Texts_1 = require("../library/Texts");
const MemberType_1 = require("./MemberType");
const CppDefinition_1 = require("./CppDefinition");
const Variations_1 = require("./Variations");
const VariationTemplates_1 = require("./VariationTemplates");
const MemberFactory_1 = require("./factories/MemberFactory");
class CppCreator {
static createIncludes(className) {
// RJLog.log( "Create include", className );
let godotClasses = {
"Node": "scene/main/node.h",
"Node2D": "scene/2d/node_2d.h",
"Node3D": "scene/3d/node_3d.h",
"Resource": "core/io/resource.h"
};
if (godotClasses[className]) {
return `#include "${godotClasses[className]}"`;
}
return `#include "./${className}.h"`;
}
static getHeaderDefine(className) {
className = className.replace(/^RJ/, "");
let output = [className[0]];
for (let i = 1; i < className.length; i++) {
let character = className[i];
let upperCaseCharacter = character.toUpperCase();
if (character === upperCaseCharacter) {
output.push("_");
}
output.push(upperCaseCharacter);
}
className = output.join("");
return "ROKOJORI__" + className + "_H";
}
static createCppFiles(definitionPath) {
return __awaiter(this, void 0, void 0, function* () {
let jsonPath = definitionPath;
// path.join( definitionsPath, definitionPath );
let isDir = yield Files_1.Files.isDirectory(jsonPath);
if (isDir) {
let files = yield Files_1.Files.getFiles(jsonPath);
for (let file of files) {
if (file.startsWith("_")) {
continue;
}
yield CppCreator.createCppFiles(Texts_1.Texts.joinPaths(jsonPath, file));
}
return Promise.resolve();
}
return this.createCppFile(jsonPath);
});
}
static createCppFile(jsonPath) {
return __awaiter(this, void 0, void 0, function* () {
let data = yield Files_1.Files.loadJSON(jsonPath);
if (data.variations) {
let variationsData = data.variations;
if (typeof variationsData == "string") {
variationsData = VariationTemplates_1.VariationTemplates[variationsData];
}
let variations = new Variations_1.Variations(variationsData);
console.log(variations.items, variations.counter, variations.hasItems);
while (variations.hasItems) {
let newData = CppDefinition_1.CppDefinition.createVariation(data, variations.currentMap);
yield this.createCppFileWith(newData);
variations.nextItem();
}
}
else {
yield CppCreator.createCppFileWith(data);
}
return Promise.resolve();
});
}
static createCppFileWith(data) {
return __awaiter(this, void 0, void 0, function* () {
let classNameResult = /(\w+)(?:\:(\w+))?/.exec(data.class);
let className = classNameResult[1];
let extendingClass = classNameResult[2];
let headerDefine = CppCreator.getHeaderDefine(className);
let fromProtectedMembers = MemberFactory_1.MemberFactory.grabMembers(data.protected, "protected");
let fromPublicMembers = MemberFactory_1.MemberFactory.grabMembers(data.public, "public");
let protectedMembers = [];
let publicMembers = [];
let insertMember = (m) => {
let container = m.accessModifier === "public" ? publicMembers : protectedMembers;
container.push(m);
};
fromProtectedMembers.forEach(m => insertMember(m));
fromPublicMembers.forEach(m => insertMember(m));
let allMembers = [].concat(protectedMembers).concat(publicMembers);
let protectedHeader = protectedMembers.map(m => m.getHeaderDefinition()).join("\n ");
let publicHeader = publicMembers.map(m => m.getHeaderDefinition()).join("\n ");
let fields = allMembers.filter(m => m.memberType === MemberType_1.MemberType.Field);
let methods = allMembers.filter(m => m.memberType === MemberType_1.MemberType.Method);
let fieldDeclarations = fields.map(f => f.getFieldDeclaration()).join("\n ");
protectedHeader += "\n\n " + fieldDeclarations;
let methodBindings = allMembers.map(m => m.getBindings(className)).join("\n ");
let initializers = fields.filter(m => m.hasInitializer).map(m => m.getInitializer()).join("\n ");
let includes = `#include "./RJGodotHeaders.h"`;
if (data.includes) {
let mappedIncludes = data.includes.map((inc) => `#include "${inc}"`);
includes += "\n" + mappedIncludes.join("\n");
}
let extendingClassInclude = CppCreator.createIncludes(extendingClass);
includes += "\n" + extendingClassInclude;
let forwards = "";
if (data.forwards) {
let forwardDeclarations = data.forwards;
forwards = forwardDeclarations.join("\n");
}
let header = Header_1.Header.create(className, extendingClass, headerDefine, protectedHeader, publicHeader, includes, forwards);
let constructorExpressions = initializers;
let destructorExpressions = "";
let implementations = "";
let fieldImplementations = fields.map(f => f.getFieldImplementation(className));
implementations += fieldImplementations.join("\n") + "\n";
let methodsWithImplementation = methods.filter(m => m.hasMethodImplementation);
let methodImplementations = methodsWithImplementation.map(m => m.getMethodImplementation(className));
implementations += methodImplementations.join("\n");
let implementation = Implementation_1.Implementation.craete(className, methodBindings, constructorExpressions, destructorExpressions, implementations);
let rawFilePath = Texts_1.Texts.joinPaths(CppCreator.outputPath, className);
yield Files_1.Files.saveUTF8(rawFilePath + ".h", header);
yield Files_1.Files.saveUTF8(rawFilePath + ".cpp", implementation);
});
}
}
exports.CppCreator = CppCreator;
CppCreator.definitionsPath = __dirname + "/../../../rokojori-action-library-definitions";
CppCreator.outputPath = __dirname + "/../../../rokojori-action-library";
CppCreator.rawPath = CppCreator.definitionsPath + "/_raw";
CppCreator.registerTypesPath = CppCreator.rawPath + "/register_types.cpp";
CppCreator.registerTypesPathOutput = CppCreator.outputPath + "/register_types.cpp";
//# sourceMappingURL=CppCreator.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,25 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CppDefinition = void 0;
const Texts_1 = require("../library/Texts");
class CppDefinition {
static createVariation(cppDefinition, map) {
let variation = new CppDefinition();
variation.class = Texts_1.Texts.replaceAll(cppDefinition.class, map);
variation.includes = Texts_1.Texts.replaceAllIn(cppDefinition.includes, map);
variation.forwards = Texts_1.Texts.replaceAllIn(cppDefinition.forwards, map);
variation.public = CppDefinition.applyVariationOnAll(cppDefinition.public, map);
variation.protected = CppDefinition.applyVariationOnAll(cppDefinition.protected, map);
return variation;
}
static applyVariationOnAll(obj, map) {
if (obj === null || obj === undefined) {
return obj;
}
let jsonValue = JSON.stringify(obj);
jsonValue = Texts_1.Texts.replaceAll(jsonValue, map);
return JSON.parse(jsonValue);
}
}
exports.CppDefinition = CppDefinition;
//# sourceMappingURL=CppDefinition.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"CppDefinition.js","sourceRoot":"","sources":["../../source/cpp-creation/CppDefinition.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAIzC,MAAa,aAAa;IAYxB,MAAM,CAAC,eAAe,CAAE,aAA2B,EAAE,GAAsB;QAEzE,IAAI,SAAS,GAAG,IAAI,aAAa,EAAE,CAAC;QAEpC,SAAS,CAAC,KAAK,GAAG,aAAK,CAAC,UAAU,CAAE,aAAa,CAAC,KAAK,EAAE,GAAG,CAAE,CAAC;QAE/D,SAAS,CAAC,QAAQ,GAAG,aAAK,CAAC,YAAY,CAAE,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAE,CAAC;QACvE,SAAS,CAAC,QAAQ,GAAG,aAAK,CAAC,YAAY,CAAE,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAE,CAAC;QAEvE,SAAS,CAAC,MAAM,GAAG,aAAa,CAAC,mBAAmB,CAAE,aAAa,CAAC,MAAM,EAAE,GAAG,CAAE,CAAC;QAClF,SAAS,CAAC,SAAS,GAAG,aAAa,CAAC,mBAAmB,CAAE,aAAa,CAAC,SAAS,EAAE,GAAG,CAAE,CAAC;QAExF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,mBAAmB,CAAK,GAAK,EAAE,GAAsB;QAE1D,IAAK,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EACtC,CAAC;YACC,OAAO,GAAG,CAAC;QACb,CAAC;QAED,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAE,GAAG,CAAE,CAAC;QACtC,SAAS,GAAG,aAAK,CAAC,UAAU,CAAE,SAAS,EAAE,GAAG,CAAE,CAAC;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAE,SAAS,CAAO,CAAC;IACtC,CAAC;CACF;AAtCD,sCAsCC"}

View File

@ -1,68 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GodotTypes = void 0;
const RJLog_1 = require("../library/RJLog");
class GodotTypes {
static stringToPropertyHint(stringType) {
switch (stringType) {
case "Node":
case "Ref<Node>":
return "PROPERTY_HINT_NODE_TYPE";
case "Resource":
case "Ref<Resource>":
return "PROPERTY_HINT_RESOURCE_TYPE";
}
RJLog_1.RJLog.error("No property hint found for", `"${stringType}"`);
}
static stringToVariantType(stringType) {
if (/^TypedArray\<.+\>$/.test(stringType)) {
return "ARRAY";
}
switch (stringType) {
case "bool": return "BOOL";
case "int": return "INT";
case "float": return "FLOAT";
case "String": return "STRING";
// Math
case "Vector2": return "VECTOR2";
case "Vector2i": return "VECTOR2I";
case "Rect2": return "RECT2";
case "Rect2i": return "RECT2I";
case "Transform2D": return "TRANSFORM2D";
case "Vector3": return "VECTOR3";
case "Vector3i": return "VECTOR3I";
case "Vector4": return "VECTOR4";
case "Vector4i": return "VECTOR4I";
case "Plane": return "PLANE";
case "AABB": return "AABB";
case "Quaternion": return "QUATERNION";
case "Basis": return "BASIS";
case "Transform3D": return "TRANSFORM3D";
case "Projection": return "PROJECTION";
// Miscellaneous
case "Color": return "COLOR";
case "RID": return "RID";
case "Object": return "OBJECT";
case "Callable": return "CALLABLE";
case "Signal": return "SIGNAL";
case "StringName": return "STRING_NAME";
case "NodePath": return "NODE_PATH";
case "Dictionary": return "DICTIONARY";
case "Array": return "ARRAY";
// Arrays
case "PackedByteArray": return "PACKED_BYTE_ARRAY";
case "PackedInt32Array": return "PACKED_INT32_ARRAY";
case "PackedInt64Array": return "PACKED_INT64_ARRAY";
case "PackedFloat32Array": return "PACKED_FLOAT32_ARRAY";
case "PackedFloat64Array": return "PACKED_FLOAT64_ARRAY";
case "PackedStringArray": return "PACKED_STRING_ARRAY";
case "PackedVector2Array": return "PACKED_VECTOR2_ARRAY";
case "PackedVector3Array": return "PACKED_VECTOR3_ARRAY";
case "PackedColorArray": return "PACKED_COLOR_ARRAY";
}
RJLog_1.RJLog.error("Type could not be mapped: ", stringType);
return "OBJECT";
}
}
exports.GodotTypes = GodotTypes;
//# sourceMappingURL=GodotTypes.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"GodotTypes.js","sourceRoot":"","sources":["../../source/cpp-creation/GodotTypes.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAEzC,MAAa,UAAU;IAErB,MAAM,CAAC,oBAAoB,CAAE,UAAiB;QAE5C,QAAS,UAAU,EACnB,CAAC;YACC,KAAK,MAAM,CAAC;YAAC,KAAK,WAAW;gBAC7B,OAAO,yBAAyB,CAAC;YAEjC,KAAK,UAAU,CAAC;YAAC,KAAK,eAAe;gBACrC,OAAO,6BAA6B,CAAC;QACvC,CAAC;QAED,aAAK,CAAC,KAAK,CAAE,4BAA4B,EAAE,IAAI,UAAU,GAAG,CAAG,CAAC;IAClE,CAAC;IAED,MAAM,CAAC,mBAAmB,CAAE,UAAiB;QAE3C,IAAK,oBAAoB,CAAC,IAAI,CAAE,UAAU,CAAE,EAC5C,CAAC;YACC,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,QAAQ,UAAU,EAClB,CAAC;YACC,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,CAAC;YAC3B,KAAK,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC;YACzB,KAAK,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC;YAC7B,KAAK,Q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AAC;YAE7B,SAAS;YACT,KAAK,iBAAiB,CAAC,CAAC,OAAO,mBAAmB,CAAC;YACnD,KAAK,kBAAkB,CAAC,CAAC,OAAO,oBAAoB,CAAC;YACrD,KAAK,kBAAkB,CAAC,CAAC,OAAO,oBAAoB,CAAC;YACrD,KAAK,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC;YACzD,KAAK,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC;YACzD,KAAK,mBAAmB,CAAC,CAAC,OAAO,qBAAqB,CAAC;YACvD,KAAK,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC;YACzD,KAAK,oBAAoB,CAAC,CAAC,OAAO,sBAAsB,CAAC;YACzD,KAAK,kBAAkB,CAAC,CAAC,OAAO,oBAAoB,CAAC;QACvD,CAAC;QAED,aAAK,CAAC,KAAK,CAAE,4BAA4B,EAAE,UAAU,CAAE,CAAC;QAExD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA1ED,gCA0EC"}

View File

@ -1,43 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Header = void 0;
class Header {
static create(className, extendingClassName, headerDefine, protectedMembers, publicMembers, includes, forwardDeclarations) {
let cppHeader = `
/* ${className}.h */
#ifndef ${headerDefine}
#define ${headerDefine}
${includes}
${forwardDeclarations}
class ${className} : public ${extendingClassName}
{
GDCLASS( ${className}, ${extendingClassName} );
protected:
static void _bind_methods();
${protectedMembers}
public:
${publicMembers}
// Constructor
${className}();
// Destructor
~${className}();
};
#endif // ${headerDefine}
`;
return cppHeader;
}
}
exports.Header = Header;
//# sourceMappingURL=Header.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../source/cpp-creation/Header.ts"],"names":[],"mappings":";;;AAAA,MAAa,MAAM;IAEjB,MAAM,CAAC,MAAM,CAAE,SAAgB,EAAE,kBAAyB,EACzC,YAAmB,EAAE,gBAAuB,EAC5C,aAAoB,EAAE,QAAe,EACrC,mBAA0B;QAGzC,IAAI,SAAS,GAEjB;KACK,SAAS;;UAEJ,YAAY;UACZ,YAAY;;EAEpB,QAAQ;;EAER,mBAAmB;;;QAGb,SAAS,aAAa,kBAAkB;;aAEnC,SAAS,KAAK,kBAAkB;;;;IAIzC,gBAAgB;;;;IAIhB,aAAa;;;IAGb,SAAS;;;KAGR,SAAS;;;;YAIF,YAAY;CACvB,CAAA;QAEG,OAAO,SAAS,CAAC;IAGnB,CAAC;CAEF;AAjDD,wBAiDC"}

View File

@ -1,36 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Implementation = void 0;
class Implementation {
static craete(className, boundMethods, constructorExpressions, destructorExpressions, methodImplementations) {
let cppImplementation = `
/* ${className}.cpp */
#include "${className}.h"
// Registers fields, signals and methods for Godot
void ${className}::_bind_methods()
{
${boundMethods}
}
// Constructor
${className}::${className}()
{
${constructorExpressions}
}
// Destructor
${className}::~${className}()
{
${destructorExpressions}
}
${methodImplementations}
`;
return cppImplementation;
}
}
exports.Implementation = Implementation;
//# sourceMappingURL=Implementation.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Implementation.js","sourceRoot":"","sources":["../../source/cpp-creation/Implementation.ts"],"names":[],"mappings":";;;AACA,MAAa,cAAc;IAGzB,MAAM,CAAC,MAAM,CAAE,SAAgB,EAAE,YAAmB,EACrC,sBAA6B,EAAE,qBAA4B,EAC3D,qBAA4B;QAGzC,IAAI,iBAAiB,GACzB;KACK,SAAS;;YAEF,SAAS;;;OAGd,SAAS;;IAEZ,YAAY;;;;EAId,SAAS,KAAK,SAAS;;IAErB,sBAAsB;;;;EAIxB,SAAS,MAAM,SAAS;;IAEtB,qBAAqB;;;EAGvB,qBAAqB;;CAEtB,CAAA;QAEG,OAAO,iBAAiB,CAAC;IAE3B,CAAC;CAEF;AAxCD,wCAwCC"}

View File

@ -1,98 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemberFactory = void 0;
const MemberInitializer_1 = require("./MemberInitializer");
const Method_1 = require("./members/Method");
const Field_1 = require("./members/Field");
const Signal_1 = require("./members/Signal");
class MemberFactory {
static grabMembers(membersData, accessModifier) {
let members = [];
if (!membersData) {
return members;
}
for (let it in membersData) {
if (!membersData.hasOwnProperty(it)) {
continue;
}
let nameDefinition = it;
let memberData = membersData[it];
if (MemberFactory.actionRegex.test(nameDefinition)) {
let name = MemberFactory.actionRegex.exec(nameDefinition)[1];
let upperCaseName = name[0].toUpperCase() + name.substring(1);
let actionName = `on${upperCaseName}`;
let signal = `signal ${name}()`;
members.push(MemberFactory.create(accessModifier, signal, {}));
members.push(MemberFactory.create(accessModifier, actionName, "Node<RJAction>"));
}
else if (MemberFactory.propertyRegex.test(nameDefinition)) {
let result = MemberFactory.propertyRegex.exec(nameDefinition);
let signalName = result[1];
let fieldName = result[2];
signalName = signalName || `${fieldName}Changed`;
let upperCaseName = signalName[0].toUpperCase() + signalName.substring(1);
let actionName = `on${upperCaseName}`;
let signal = `signal ${signalName}()`;
if (!result[1]) {
members.push(MemberFactory.create(accessModifier, signal, {}));
members.push(MemberFactory.create(accessModifier, actionName, "Node<RJAction>"));
}
let field = MemberFactory.create(accessModifier, fieldName, memberData);
field.isProperty = true;
field.propertySignalName = signalName;
field.propertyActionName = actionName;
members.push(field);
}
else {
let classMember = MemberFactory.create(accessModifier, nameDefinition, memberData);
members.push(classMember);
}
}
return members;
}
static create(accessModifier, nameDefinition, body) {
let memberInitializer = new MemberInitializer_1.MemberInitializer();
if (nameDefinition.indexOf("()") != -1) {
memberInitializer.isMethod = true;
memberInitializer.isVirtual = true;
let typeRegex = /\(\)\s*(?:\:\s*(.+)\s*)?$/;
let result = typeRegex.exec(nameDefinition);
if (result[1]) {
memberInitializer.type = result[1];
}
nameDefinition = nameDefinition.replace(typeRegex, "");
}
let names = nameDefinition.split(/\s+/);
memberInitializer.name = names[names.length - 1];
for (let i = 0; i < names.length - 1; i++) {
if ("final" === names[i]) {
memberInitializer.isVirtual = false;
}
if ("static" === names[i]) {
memberInitializer.isStatic = true;
}
if ("signal" === names[i]) {
memberInitializer.isSignal = true;
}
}
let member = null;
if (memberInitializer.isMethod) {
if (memberInitializer.isSignal) {
member = new Signal_1.Signal(memberInitializer);
}
else {
member = new Method_1.Method(memberInitializer);
}
}
else {
member = new Field_1.Field(memberInitializer);
}
member.accessModifier = accessModifier;
member.parseBody(body);
return member;
}
}
exports.MemberFactory = MemberFactory;
MemberFactory.actionRegex = /^\s*action\s+(\w+)\s*$/;
MemberFactory.propertyRegex = /^\s*property(?:\s*\@\s*(\w+))?\s+(\w+)\s*$/;
//# sourceMappingURL=MemberFactory.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"MemberFactory.js","sourceRoot":"","sources":["../../source/cpp-creation/MemberFactory.ts"],"names":[],"mappings":";;;AACA,2DAAwD;AACxD,6CAA0C;AAC1C,2CAAwC;AACxC,6CAA0C;AAG1C,MAAa,aAAa;IAKxB,MAAM,CAAC,WAAW,CAAE,WAAe,EAAE,cAAqB;QAExD,IAAI,OAAO,GAAY,EAAE,CAAC;QAE1B,IAAK,CAAE,WAAW,EAClB,CAAC;YACC,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,KAAM,IAAI,EAAE,IAAI,WAAW,EAC3B,CAAC;YACC,IAAK,CAAE,WAAW,CAAC,cAAc,CAAE,EAAE,CAAE,EACvC,CAAC;gBACC,SAAS;YACX,CAAC;YAED,IAAI,cAAc,GAAG,EAAE,CAAC;YACxB,IAAI,UAAU,GAAG,WAAW,CAAE,EAAE,CAAE,CAAC;YAGnC,IAAK,aAAa,CAAC,WAAW,CAAC,IAAI,CAAE,cAAc,CAAE,EACrD,CAAC;gBACC,IAAI,IAAI,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,CAAE,cAAc,CAAE,CAAE,CAAC,CAAE,CAAC;gBACjE,IAAI,aAAa,GAAG,IAAI,CAAE,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,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,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAC1C,CAAC;YACC,IAAK,OAAO,KAAK,KAAK,CAAE,CAAC,CAAE,EAC3B,CAAC;gBACC,iBAAiB,CAAC,SAAS,GAAG,KAAK,CAAC;YACtC,CAAC;YAED,IAAK,QAAQ,KAAK,KAAK,CAAE,CAAC,CAAE,EAC5B,CAAC;gBACC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC;YACpC,CAAC;YAED,IAAK,QAAQ,KAAK,KAAK,CAAE,CAAC,CAAE,EAC5B,CAAC;gBACC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC;YACpC,CAAC;QAEH,CAAC;QAED,IAAI,MAAM,GAAU,IAAI,CAAC;QAEzB,IAAK,iBAAiB,CAAC,QAAQ,EAC/B,CAAC;YACC,IAAK,iBAAiB,CAAC,QAAQ,EAC/B,CAAC;gBACC,MAAM,GAAG,IAAI,eAAM,CAAE,iBAAiB,CAAE,CAAC;YAC3C,CAAC;iBAED,CAAC;gBACC,MAAM,GAAG,IAAI,eAAM,CAAE,iBAAiB,CAAE,CAAC;YAC3C,CAAC;QAEH,CAAC;aAED,CAAC;YACC,MAAM,GAAG,IAAI,aAAK,CAAE,iBAAiB,CAAE,CAAC;QAC1C,CAAC;QAED,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;QACvC,MAAM,CAAC,SAAS,CAAE,IAAI,CAAE,CAAC;QAEzB,OAAO,MAAM,CAAC;IAChB,CAAC;;AA/IH,sCAgJC;AA9IiB,yBAAW,GAAG,wBAAwB,CAAC;AACvC,2BAAa,GAAG,4CAA4C,CAAC"}

View File

@ -1,16 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemberInitializer = void 0;
class MemberInitializer {
constructor() {
this.accessModifier = "";
this.type = "void";
this.name = "";
this.isVirtual = true;
this.isSignal = false;
this.isMethod = false;
this.isStatic = false;
}
}
exports.MemberInitializer = MemberInitializer;
//# sourceMappingURL=MemberInitializer.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"MemberInitializer.js","sourceRoot":"","sources":["../../source/cpp-creation/MemberInitializer.ts"],"names":[],"mappings":";;;AACA,MAAa,iBAAiB;IAA9B;QAEE,mBAAc,GAAG,EAAE,CAAC;QACpB,SAAI,GAAG,MAAM,CAAC;QACd,SAAI,GAAG,EAAE,CAAC;QAEV,cAAS,GAAG,IAAI,CAAC;QACjB,aAAQ,GAAI,KAAK,CAAC;QAClB,aAAQ,GAAI,KAAK,CAAC;QAClB,aAAQ,GAAI,KAAK,CAAC;IACpB,CAAC;CAAA;AAVD,8CAUC"}

View File

@ -1,10 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemberType = void 0;
var MemberType;
(function (MemberType) {
MemberType[MemberType["Field"] = 0] = "Field";
MemberType[MemberType["Method"] = 1] = "Method";
MemberType[MemberType["Signal"] = 2] = "Signal";
})(MemberType || (exports.MemberType = MemberType = {}));
//# sourceMappingURL=MemberType.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"MemberType.js","sourceRoot":"","sources":["../../source/cpp-creation/MemberType.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAKX;AALD,WAAY,UAAU;IAEpB,6CAAK,CAAA;IACL,+CAAM,CAAA;IACN,+CAAM,CAAA;AACR,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB"}

View File

@ -1,14 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parameter = void 0;
class Parameter {
constructor() {
this.name = "";
this.type = "";
}
get() {
return `${this.type} ${this.name}`;
}
}
exports.Parameter = Parameter;
//# sourceMappingURL=Parameter.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Parameter.js","sourceRoot":"","sources":["../../source/cpp-creation/Parameter.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAAtB;QAEE,SAAI,GAAG,EAAE,CAAC;QACV,SAAI,GAAG,EAAE,CAAC;IAMZ,CAAC;IAJC,GAAG;QAED,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IACrC,CAAC;CACF;AATD,8BASC"}

View File

@ -1,46 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeRegistration = void 0;
const Files_1 = require("../library/Files");
const CppCreator_1 = require("./CppCreator");
class TypeRegistration {
static createRegistrations() {
return __awaiter(this, void 0, void 0, function* () {
let registrationImplementation = yield Files_1.Files.loadUTF8(CppCreator_1.CppCreator.registerTypesPath);
let allFiles = yield Files_1.Files.getFiles(CppCreator_1.CppCreator.outputPath);
let filter = (file) => {
if (TypeRegistration.exceptions.indexOf(file) !== -1) {
return false;
}
return file.endsWith(".h") && file != "register_types.h";
};
let headers = allFiles.filter(file => filter(file));
let includeStatements = headers.map(h => `#include "./${h}"`);
let includes = includeStatements.join("\n");
registrationImplementation =
registrationImplementation.replace(TypeRegistration.includesRegex, includes);
let classNames = headers.map(h => h.replace(/\.h$/, ""));
let registrators = classNames.map(cn => `ClassDB::register_class<${cn}>();`);
let registrations = registrators.join("\n ");
registrationImplementation =
registrationImplementation.replace(TypeRegistration.classDBRegistrationsRegex, registrations);
yield Files_1.Files.saveUTF8(CppCreator_1.CppCreator.registerTypesPathOutput, registrationImplementation);
});
}
}
exports.TypeRegistration = TypeRegistration;
TypeRegistration.includesRegex = /\/\*INCLUDES\*\//;
TypeRegistration.classDBRegistrationsRegex = /\/\*CLASS-DB-REGISTRATIONS\*\//;
TypeRegistration.exceptions = [
"RJGodotHeaders.h"
];
//# sourceMappingURL=TypeRegistration.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"TypeRegistration.js","sourceRoot":"","sources":["../../source/cpp-creation/TypeRegistration.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyC;AACzC,6CAA0C;AAE1C,MAAa,gBAAgB;IAU3B,MAAM,CAAO,mBAAmB;;YAE9B,IAAI,0BAA0B,GAAG,MAAM,aAAK,CAAC,QAAQ,CAAE,uBAAU,CAAC,iBAAiB,CAAE,CAAC;YACtF,IAAI,QAAQ,GAAG,MAAM,aAAK,CAAC,QAAQ,CAAE,uBAAU,CAAC,UAAU,CAAE,CAAC;YAC7D,IAAI,MAAM,GAAG,CAAE,IAAW,EAAG,EAAE;gBAE7B,IAAK,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAE,IAAI,CAAE,KAAK,CAAC,CAAC,EACvD,CAAC;oBACC,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,OAAO,IAAI,CAAC,QAAQ,CAAE,IAAI,CAAE,IAAI,IAAI,IAAI,kBAAkB,CAAC;YAC7D,CAAC,CAAC;YAEF,IAAI,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAE,IAAI,CAAE,CAAE,CAAC;YAExD,IAAI,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAC/D,IAAI,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;YAE9C,0BAA0B;gBACxB,0BAA0B,CAAC,OAAO,CAAE,gBAAgB,CAAC,aAAa,EAAE,QAAQ,CAAE,CAAC;YAEjF,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAE,MAAM,EAAE,EAAE,CAAE,CAAE,CAAC;YAC7D,IAAI,YAAY,GAAG,UAAU,CAAC,GAAG,CAAE,EAAE,CAAC,EAAE,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAA;YAE7E,IAAI,aAAa,GAAG,YAAY,CAAC,IAAI,CAAE,MAAM,CAAE,CAAC;YAChD,0BAA0B;gBACxB,0BAA0B,CAAC,OAAO,CAAE,gBAAgB,CAAC,yBAAyB,EAAE,aAAa,CAAE,CAAC;YAElG,MAAM,aAAK,CAAC,QAAQ,CAAE,uBAAU,CAAC,uBAAuB,EAAE,0BAA0B,CAAE,CAAC;QAEzF,CAAC;KAAA;;AAzCH,4CA0CC;AAxCQ,8BAAa,GAAG,kBAAkB,CAAC;AACnC,0CAAyB,GAAG,gCAAgC,CAAC;AAE7D,2BAAU,GACjB;IACE,kBAAkB;CACnB,CAAC"}

View File

@ -1,25 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VariationTemplates = void 0;
class VariationTemplates {
}
exports.VariationTemplates = VariationTemplates;
VariationTemplates.genericOnlyIntNode = [
{
"{DataTypeName}": ["Int"],
"{DataType}": ["int"],
"{Extension}": [""],
"{ParentClass}": ["Node"]
}
];
VariationTemplates.generic = [
{
"{DataTypeName}": ["Bool", "Float", "Int", "Color", "Vector2", "Vector3", "Quaternion", "String", "Node", "Resource"],
"{DataType}": ["bool", "float", "int", "Color", "Vector2", "Vector3", "Quaternion", "String", "Ref<Node>", "Ref<Resource>"]
},
{
"{Extension}": ["", "Global"],
"{ParentClass}": ["Node", "Resource"]
}
];
//# sourceMappingURL=VariationTemplates.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"VariationTemplates.js","sourceRoot":"","sources":["../../source/cpp-creation/VariationTemplates.ts"],"names":[],"mappings":";;;AAKA,MAAa,kBAAkB;;AAA/B,gDAyBC;AAvBiB,qCAAkB,GAClC;IACE;QACE,gBAAgB,EAAC,CAAE,KAAK,CAAE;QAC1B,YAAY,EAAK,CAAE,KAAK,CAAE;QAC1B,aAAa,EAAI,CAAE,EAAE,CAAE;QACvB,eAAe,EAAI,CAAE,MAAM,CAAE;KAE9B;CACF,CAAC;AAEc,0BAAO,GACvB;IACE;QACE,gBAAgB,EAAC,CAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAE;QACtH,YAAY,EAAK,CAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAE;KACjI;IAED;QACE,aAAa,EAAI,CAAM,EAAE,EAAE,QAAQ,CAAE;QACrC,eAAe,EAAE,CAAE,MAAM,EAAE,UAAU,CAAE;KACxC;CACF,CAAC"}

View File

@ -1,77 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Variations = void 0;
class Variations {
constructor(vds) {
this._indicies = [];
this._lengths = [];
this._items = 1;
this._counter = 0;
this._map = new Map();
this._variationDefinitions = vds;
this._items = 1;
vds.forEach(vd => {
this._indicies.push(0);
let length = -1;
for (let it in vd) {
if (length != -1 || !vd.hasOwnProperty(it)) {
continue;
}
length = vd[it].length;
}
this._lengths.push(length);
this._items *= length;
});
console.log("Found items:", this._items);
this._grabCurrentMap();
}
_grabCurrentMap() {
this._map.clear();
for (let i = 0; i < this._indicies.length; i++) {
this._grabItems(i);
}
}
get hasItems() {
return this._counter <= this._items;
}
get items() {
return this._items;
}
get counter() {
return this._counter;
}
nextItem() {
this._counter++;
this._incrementCounter(0);
this._grabCurrentMap();
// RJLog.log( this._counter, this._indicies, this.currentMap );
}
_incrementCounter(position) {
let value = this._indicies[position];
if (value == (this._lengths[position] - 1)) {
this._indicies[position] = 0;
this._incrementCounter(position + 1);
}
else {
this._indicies[position]++;
}
}
_grabItems(index) {
let counter = this._indicies[index];
let vd = this._variationDefinitions[index];
let map = this._map;
for (let it in vd) {
if (!vd.hasOwnProperty(it)) {
continue;
}
let key = it;
let values = vd[it];
map.set(key, values[counter]);
}
}
get currentMap() {
return this._map;
}
}
exports.Variations = Variations;
//# sourceMappingURL=Variations.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Variations.js","sourceRoot":"","sources":["../../source/cpp-creation/Variations.ts"],"names":[],"mappings":";;;AAIA,MAAa,UAAU;IASrB,YAAa,GAAwB;QANrC,cAAS,GAAY,EAAE,CAAC;QACxB,aAAQ,GAAY,EAAE,CAAC;QACvB,WAAM,GAAG,CAAC,CAAC;QACX,aAAQ,GAAG,CAAC,CAAC;QACb,SAAI,GAAG,IAAI,GAAG,EAAiB,CAAC;QAI9B,IAAI,CAAC,qBAAqB,GAAG,GAAG,CAAC;QAEjC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAEhB,GAAG,CAAC,OAAO,CACT,EAAE,CAAC,EAAE;YAEH,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE,CAAC,CAAE,CAAC;YAEzB,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;YAEhB,KAAM,IAAI,EAAE,IAAI,EAAE,EAClB,CAAC;gBACC,IAAK,MAAM,IAAG,CAAC,CAAC,IAAI,CAAE,EAAE,CAAC,cAAc,CAAE,EAAE,CAAE,EAC7C,CAAC;oBACC,SAAS;gBACX,CAAC;gBAED,MAAM,GAAG,EAAE,CAAE,EAAE,CAAE,CAAC,MAAM,CAAC;YAC3B,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAE,MAAM,CAAE,CAAC;YAE7B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC;QACxB,CAAC,CAEF,CAAC;QAEF,OAAO,CAAC,GAAG,CAAE,cAAc,EAAE,IAAI,CAAC,MAAM,CAAE,CAAC;QAE3C,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED,eAAe;QAEb,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;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EAAE,EAClB,CAAC;YACC,IAAK,CAAE,EAAE,CAAC,cAAc,CAAE,EAAE,CAAE,EAC9B,CAAC;gBACC,SAAS;YACX,CAAC;YAED,IAAI,GAAG,GAAG,EAAE,CAAC;YACb,IAAI,MAAM,GAAG,EAAE,CAAE,EAAE,CAAE,CAAC;YAEtB,GAAG,CAAC,GAAG,CAAE,GAAG,EAAE,MAAM,CAAE,OAAO,CAAE,CAAE,CAAC;QACpC,CAAC;IACH,CAAC;IAED,IAAI,UAAU;QAEZ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAvHD,gCAuHC"}

View File

@ -1,18 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionFactory = void 0;
const BaseFactory_1 = require("./BaseFactory");
class ActionFactory extends BaseFactory_1.BaseFactory {
constructor() { super(ActionFactory.regex); }
create(accessModifier, nameDefinition, memberData, members) {
let name = ActionFactory.regex.exec(nameDefinition)[1];
let upperCaseName = name[0].toUpperCase() + name.substring(1);
let actionName = `on${upperCaseName}`;
let signal = `signal ${name}()`;
members.push(this.createMember(accessModifier, signal, {}));
members.push(this.createMember(accessModifier, actionName, "Node<RJAction>"));
}
}
exports.ActionFactory = ActionFactory;
ActionFactory.regex = /^\s*action\s+(\w+)\s*$/;
//# sourceMappingURL=ActionFactory.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"ActionFactory.js","sourceRoot":"","sources":["../../../source/cpp-creation/factories/ActionFactory.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C,MAAa,aAAc,SAAQ,yBAAW;IAI5C,gBAAe,KAAK,CAAE,aAAa,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC;IAE9C,MAAM,CAAE,cAAqB,EAAE,cAAqB,EAAE,UAAc,EAAE,OAAgB;QAEpF,IAAI,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAE,cAAc,CAAE,CAAE,CAAC,CAAE,CAAC;QAC3D,IAAI,aAAa,GAAG,IAAI,CAAE,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAE,CAAC,CAAE,CAAC;QAClE,IAAI,UAAU,GAAG,KAAK,aAAa,EAAE,CAAC;QAEtC,IAAI,MAAM,GAAG,UAAU,IAAI,IAAI,CAAC;QAEhC,OAAO,CAAC,IAAI,CAAE,IAAI,CAAC,YAAY,CAAE,cAAc,EAAE,MAAM,EAAE,EAAE,CAAE,CAAE,CAAC;QAChE,OAAO,CAAC,IAAI,CAAE,IAAI,CAAC,YAAY,CAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,CAAE,CAAE,CAAC;IACpF,CAAC;;AAhBH,sCAiBC;AAfiB,mBAAK,GAAG,wBAAwB,CAAC"}

View File

@ -1,61 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseFactory = void 0;
const MemberInitializer_1 = require("../MemberInitializer");
const Field_1 = require("../members/Field");
const Method_1 = require("../members/Method");
const Signal_1 = require("../members/Signal");
class BaseFactory {
constructor(regex) {
this._regex = regex;
}
handles(nameDefinition) {
return this._regex.test(nameDefinition);
}
createMember(accessModifier, nameDefinition, body) {
return BaseFactory.createMemberFrom(accessModifier, nameDefinition, body);
}
static createMemberFrom(accessModifier, nameDefinition, body) {
let memberInitializer = new MemberInitializer_1.MemberInitializer();
if (nameDefinition.indexOf("()") != -1) {
memberInitializer.isMethod = true;
memberInitializer.isVirtual = true;
let typeRegex = /\(\)\s*(?:\:\s*(.+)\s*)?$/;
let result = typeRegex.exec(nameDefinition);
if (result[1]) {
memberInitializer.type = result[1];
}
nameDefinition = nameDefinition.replace(typeRegex, "");
}
let names = nameDefinition.split(/\s+/);
memberInitializer.name = names[names.length - 1];
for (let i = 0; i < names.length - 1; i++) {
if ("final" === names[i]) {
memberInitializer.isVirtual = false;
}
if ("static" === names[i]) {
memberInitializer.isStatic = true;
}
if ("signal" === names[i]) {
memberInitializer.isSignal = true;
}
}
let member = null;
if (memberInitializer.isMethod) {
if (memberInitializer.isSignal) {
member = new Signal_1.Signal(memberInitializer);
}
else {
member = new Method_1.Method(memberInitializer);
}
}
else {
member = new Field_1.Field(memberInitializer);
}
member.accessModifier = accessModifier;
member.parseBody(body);
return member;
}
}
exports.BaseFactory = BaseFactory;
//# sourceMappingURL=BaseFactory.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"BaseFactory.js","sourceRoot":"","sources":["../../../source/cpp-creation/factories/BaseFactory.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,4CAAyC;AAEzC,8CAA2C;AAC3C,8CAA2C;AAE3C,MAAsB,WAAW;IAI/B,YAAa,KAAY;QAEvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,OAAO,CAAE,cAAqB;QAE5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAE,cAAc,CAAE,CAAC;IAC5C,CAAC;IAID,YAAY,CAAoB,cAAqB,EAAE,cAAqB,EAAE,IAAQ;QAEpF,OAAO,WAAW,CAAC,gBAAgB,CAAE,cAAc,EAAE,cAAc,EAAE,IAAI,CAAO,CAAC;IACnF,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAE,cAAqB,EAAE,cAAqB,EAAE,IAAQ;QAG7E,IAAI,iBAAiB,GAAG,IAAI,qCAAiB,EAAE,CAAC;QAGhD,IAAK,cAAc,CAAC,OAAO,CAAE,IAAI,CAAE,IAAI,CAAC,CAAC,EACzC,CAAC;YACC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC;YAClC,iBAAiB,CAAC,SAAS,GAAG,IAAI,CAAC;YAEnC,IAAI,SAAS,GAAG,2BAA2B,CAAC;YAC5C,IAAI,MAAM,GAAG,SAAS,CAAC,IAAI,CAAE,cAAc,CAAE,CAAC;YAE9C,IAAK,MAAM,CAAE,CAAC,CAAE,EAChB,CAAC;gBACC,iBAAiB,CAAC,IAAI,GAAG,MAAM,CAAE,CAAC,CAAE,CAAC;YACvC,CA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,kCAyFC"}

View File

@ -1,84 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemberFactory = void 0;
const ActionFactory_1 = require("./ActionFactory");
const PropertyFactory_1 = require("./PropertyFactory");
const BaseFactory_1 = require("./BaseFactory");
class MemberFactory {
static grabMembers(membersData, accessModifier) {
let members = [];
if (!membersData) {
return members;
}
for (let it in membersData) {
if (!membersData.hasOwnProperty(it)) {
continue;
}
let nameDefinition = it;
let memberData = membersData[it];
let factory = this.factories.find(f => f.handles(nameDefinition));
if (factory) {
factory.create(accessModifier, nameDefinition, memberData, members);
}
else {
members.push(BaseFactory_1.BaseFactory.createMemberFrom(accessModifier, nameDefinition, memberData));
}
/*
if ( MemberFactory.actionRegex.test( nameDefinition ) )
{
let name = MemberFactory.actionRegex.exec( nameDefinition )[ 1 ];
let upperCaseName = name[ 0 ].toUpperCase() + name.substring( 1 );
let actionName = `on${upperCaseName}`;
let signal = `signal ${name}()`;
members.push( MemberFactory.create( accessModifier, signal, {} ) );
members.push( MemberFactory.create( accessModifier, actionName, "Node<RJAction>" ) );
}
else if ( MemberFactory.propertyRegex.test( nameDefinition ) )
{
let result = MemberFactory.propertyRegex.exec( nameDefinition );
let signalName = result[ 1 ];
let fieldName = result[ 2 ];
signalName = signalName || `${fieldName}Changed`;
let upperCaseName = signalName[ 0 ].toUpperCase() + signalName.substring( 1 );
let actionName = `on${upperCaseName}`;
let signal = `signal ${signalName}()`;
if ( ! result[ 1 ] )
{
members.push( MemberFactory.create( accessModifier, signal, {} ) );
members.push( MemberFactory.create( accessModifier, actionName, "Node<RJAction>" ) );
}
let field = MemberFactory.create( accessModifier, fieldName, memberData ) as Field;
field.isProperty = true;
field.propertySignalName = signalName;
field.propertyActionName = actionName;
members.push( field );
}
else
{
let classMember = MemberFactory.create( accessModifier, nameDefinition, memberData );
members.push( classMember );
}
*/
}
return members;
}
}
exports.MemberFactory = MemberFactory;
MemberFactory.actionRegex = /^\s*action\s+(\w+)\s*$/;
MemberFactory.propertyRegex = /^\s*property(?:\s*\@\s*(\w+))?\s+(\w+)\s*$/;
MemberFactory.factories = [
new ActionFactory_1.ActionFactory(),
new PropertyFactory_1.PropertyFactory()
];
//# sourceMappingURL=MemberFactory.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"MemberFactory.js","sourceRoot":"","sources":["../../../source/cpp-creation/factories/MemberFactory.ts"],"names":[],"mappings":";;;AAKA,mDAAgD;AAChD,uDAAoD;AACpD,+CAA4C;AAG5C,MAAa,aAAa;IAWxB,MAAM,CAAC,WAAW,CAAE,WAAe,EAAE,cAAqB;QAExD,IAAI,OAAO,GAAY,EAAE,CAAC;QAE1B,IAAK,CAAE,WAAW,EAClB,CAAC;YACC,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,KAAM,IAAI,EAAE,IAAI,WAAW,EAC3B,CAAC;YACC,IAAK,CAAE,WAAW,CAAC,cAAc,CAAE,EAAE,CAAE,EACvC,CAAC;gBACC,SAAS;YACX,CAAC;YAED,IAAI,cAAc,GAAG,EAAE,CAAC;YACxB,IAAI,UAAU,GAAG,WAAW,CAAE,EAAE,CAAE,CAAC;YAEnC,IAAI,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAE,cAAc,CAAE,CAAE,CAAC;YAEtE,IAAK,OAAO,EACZ,CAAC;gBACC,OAAO,CAAC,MAAM,CAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,CAAE,CAAC;YACxE,CAAC;iBAED,CAAC;gBACC,OAAO,CAAC,IAAI,CAAE,yBAAW,CAAC,gBAAgB,CAAG,cAAc,EAAE,cAAc,EAAE,UAAU,CAAE,CAAE,CAAC;YAC9F,CAAC;YAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8CE;QAEJ,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AA5FH,sCAoKC;AAlKiB,yBAAW,GAAG,wBAAwB,CAAC;AACvC,2BAAa,GAAG,4CAA4C,CAAC;AAEtE,uBAAS,GAChB;IACE,IAAI,6BAAa,EAAE;IACnB,IAAI,iCAAe,EAAE;CACtB,CAAA"}

View File

@ -1,43 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyFactory = void 0;
const BaseFactory_1 = require("./BaseFactory");
class PropertyFactory extends BaseFactory_1.BaseFactory {
constructor() { super(PropertyFactory.regex); }
create(accessModifier, nameDefinition, memberData, members) {
let result = PropertyFactory.regex.exec(nameDefinition);
let fieldName = result[1];
let upperCaseName = fieldName[0].toUpperCase() + fieldName.substring(1);
let signalName = `${fieldName}Changed`;
let upperCaseSignalName = signalName[0].toUpperCase() + signalName.substring(1);
let actionName = `on${upperCaseSignalName}`;
let signalMethodDefinition = `signal ${signalName}()`;
let field = this.createMember(accessModifier, fieldName, memberData);
field.isProperty = true;
field.propertySignalName = signalName;
field.propertyActionName = actionName;
members.push(field);
members.push(this.createMember(accessModifier, signalMethodDefinition, {}));
members.push(this.createMember(accessModifier, actionName, "Node<RJAction>"));
let dispatchChanged = this.createMember(accessModifier, `final dispatch${upperCaseName}Changed()`, [{},
[
`emit_signal( SNAME( "${signalName}" ) );`,
"",
`if ( ${actionName} != NULL )`,
"{",
` ${actionName}->trigger();`,
"}"
]
]);
members.push(dispatchChanged);
let setSilent = this.createMember(accessModifier, `final set${upperCaseName}Silent()`, [{ "p_value": memberData },
[
"value = p_value;"
]
]);
members.push(setSilent);
}
}
exports.PropertyFactory = PropertyFactory;
PropertyFactory.regex = /^\s*property\s+(\w+)\s*$/;
//# sourceMappingURL=PropertyFactory.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"PropertyFactory.js","sourceRoot":"","sources":["../../../source/cpp-creation/factories/PropertyFactory.ts"],"names":[],"mappings":";;;AAEA,+CAA4C;AAE5C,MAAa,eAAgB,SAAQ,yBAAW;IAI9C,gBAAe,KAAK,CAAE,eAAe,CA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Q;gBAC1C,EAAE;gBACF,QAAQ,UAAU,YAAY;gBAC9B,GAAG;gBACH,KAAK,UAAU,cAAc;gBAC7B,GAAG;aACJ;SACF,CACF,CAAC;QAGF,OAAO,CAAC,IAAI,CAAE,eAAe,CAAE,CAAC;QAIhC,IAAI,SAAS,GAAG,IAAI,CAAC,YAAY,CAAE,cAAc,EAE/C,YAAY,aAAa,UAAU,EAAE,CAAE,EAAE,SAAS,EAAE,UAAU,EAAC;YAC7D;gBACA,kBAAkB;aACjB;SACH,CACD,CAAC;QAEF,OAAO,CAAC,IAAI,CAAE,SAAS,CAAE,CAAC;IAE5B,CAAC;;AAnEH,0CAoEC;AAlEiB,qBAAK,GAAG,0BAA0B,CAAC"}

View File

@ -1,129 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Field = void 0;
const GodotTypes_1 = require("../GodotTypes");
const MemberType_1 = require("../MemberType");
const Member_1 = require("./Member");
class Field extends Member_1.Member {
constructor(memberInitializer) {
super(MemberType_1.MemberType.Field, memberInitializer);
this.isReference = false;
this.referenceType = "";
this.isProperty = false;
this.propertySignalName = "";
this.propertyActionName = "";
}
parseBody(body) {
if (typeof body === "boolean") {
this.type = "bool";
this.initialValue = body + "";
return;
}
if (typeof body === "number") {
this.type = "float";
this.initialValue = body + "";
return;
}
let regex = /((?:\w|\<|\>)+)(?:\s*\=\s*(.+))?/;
let result = regex.exec(body);
let typeOrRefRegex = /^(Ref|Resource|Node)</;
let refRegex = /^Ref<(\w+)>/;
let typeResult = result[1];
this.isReference = typeOrRefRegex.test(typeResult);
// RJLog.log( "Is Reference", this.name, this.isReference, typeResult );
if (this.isReference) {
this.referenceType = refRegex.test(typeResult) ? refRegex.exec(typeResult)[1] :
typeOrRefRegex.exec(typeResult)[1];
// RJLog.log( "referenceType", body, `"${this.referenceType}"`, typeResult );
if (Field.Node === this.referenceType) {
typeResult = typeResult.replace(typeOrRefRegex, "").replace(/>$/, "");
typeResult = typeResult + "*";
}
else {
typeResult = typeResult.replace(typeOrRefRegex, "Ref<");
if (result.length >= 2) {
this.initialValue = result[2];
}
}
}
this.type = typeResult;
this.initialValue = result[2] || null;
}
getFieldDeclaration() {
let fieldInfo = "\n " + this.info() + "\n ";
if (Field.Node === this.referenceType) {
return `${fieldInfo}${this.type} ${this.name} = nullptr;`;
}
return `${fieldInfo}${this.type} ${this.name};`;
}
getHeaderDefinition() {
let fieldInfo = "\n " + this.info() + "\n ";
if (Field.Node === this.referenceType) {
return `${fieldInfo}${this.type} get_${this.name}() const; void set_${this.name}( ${this.type} p_${this.name} );`;
}
if (Field.Resource === this.referenceType) {
return `${fieldInfo}${this.type} get_${this.name}() const; void set_${this.name}( const ${this.type} &p_${this.name} );`;
}
return `${fieldInfo}${this.type} get_${this.name}(); void set_${this.name}( ${this.type} p_${this.name} );`;
}
getBindings(className) {
let bindings = [];
bindings.push(`// ${this.name}: ${this.type}`);
bindings.push(`ClassDB::bind_method( D_METHOD( "set_${this.name}", "${this.name}" ), &${className}::set_${this.name} );`);
bindings.push(`ClassDB::bind_method( D_METHOD( "get_${this.name}"), &${className}::get_${this.name});`);
if (this.isReference) {
// ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "reference_property", PROPERTY_HINT_NODE_TYPE), "set_reference_property", "get_reference_property");
// RJLog.log( "Searching propertyHint:", this.name, this.type, this.referenceType );
let propertyHint = GodotTypes_1.GodotTypes.stringToPropertyHint(this.referenceType);
bindings.push(`ADD_PROPERTY( PropertyInfo(Variant::OBJECT, "${this.name}", ${propertyHint} ), "set_${this.name}", "get_${this.name}" );`);
}
else {
let type = GodotTypes_1.GodotTypes.stringToVariantType(this.type);
bindings.push(`ADD_PROPERTY(PropertyInfo( Variant::${type}, "${this.name}" ), "set_${this.name}", "get_${this.name}" );`);
}
bindings.push(` `);
//ClassDB::bind_method(D_METHOD("set_color", "color"), &GLTFLight::set_color);
//ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); // Color
return bindings.join("\n ");
}
getFieldImplementation(className) {
let implementations = [];
implementations.push(`// ${this.name}: ${this.type}`);
let eventCallbacks = "";
if (this.isProperty) {
eventCallbacks += `\n`;
eventCallbacks += `\n emit_signal( SNAME( "${this.propertySignalName}" ) );`;
eventCallbacks += `\n`;
eventCallbacks += `\n if ( ${this.propertyActionName} != NULL )`;
eventCallbacks += `\n {`;
eventCallbacks += `\n ${this.propertyActionName}->trigger();`;
eventCallbacks += `\n }`;
}
let n = this.isProperty ? "\n" : "";
let n2 = this.isProperty ? "\n " : "";
if (Field.Node === this.referenceType) {
implementations.push(`${this.type} ${className}::get_${this.name}() const { return ${this.name}; }`);
implementations.push(`void ${className}::set_${this.name}( ${this.type} p_${this.name} ) ${n}{${n2} ${this.name} = p_${this.name};${eventCallbacks} ${n}}`);
}
else if (Field.Resource === this.referenceType) {
implementations.push(`${this.type} ${className}::get_${this.name}() const { return ${this.name}; }`);
implementations.push(`void ${className}::set_${this.name}( const ${this.type} &p_${this.name} ) ${n}{${n2} ${this.name} = p_${this.name};${eventCallbacks} ${n}}`);
}
else {
implementations.push(`${this.type} ${className}::get_${this.name}() { return ${this.name}; }`);
implementations.push(`void ${className}::set_${this.name}( ${this.type} p_${this.name} ) ${n}{${n2} ${this.name} = p_${this.name};${eventCallbacks} ${n}}`);
}
implementations.push(` `);
return implementations.join("\n");
}
get hasInitializer() {
return this.initialValue !== null;
}
getInitializer() {
return `${this.name} = ${this.initialValue};`;
}
}
exports.Field = Field;
Field.Node = "Node";
Field.Resource = "Resource";
//# sourceMappingURL=Field.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,67 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Member = void 0;
const Parameter_1 = require("../Parameter");
class Member {
constructor(memberType, memberInitializer) {
this.name = "";
this.isMethod = false;
this.isVirtual = true;
this.isStatic = false;
this.isSignal = false;
this.type = "void";
this.initialValue = null;
this.parameters = [];
this.accessModifier = "";
this.parametersDefinition = "";
this.memberType = memberType;
this.accessModifier = memberInitializer.accessModifier;
this.name = memberInitializer.name;
this.type = memberInitializer.type || this.type;
this.isMethod = memberInitializer.isMethod;
this.isSignal = memberInitializer.isSignal;
this.isStatic = memberInitializer.isStatic;
this.isVirtual = memberInitializer.isVirtual;
}
info() {
let methodBrackets = this.isMethod ? "()" : "";
if (methodBrackets === "()" && this.parameters.length > 0) {
methodBrackets = "( " + this.parametersDefinition + " )";
}
if (this.isSignal) {
}
return `// ${this.isSignal ? "[signal] " : ""}${this.name}${methodBrackets} : ${this.type}`;
}
setPublic() {
this.accessModifier = "public";
return this;
}
setProtected() {
this.accessModifier = "protected";
return this;
}
parseMethodParameters(body) {
if (!body) {
return;
}
if (typeof body === "string") {
this.type = body;
return;
}
for (let it in body) {
if (!body.hasOwnProperty(it)) {
continue;
}
let cppParameter = new Parameter_1.Parameter();
cppParameter.name = it;
cppParameter.type = body[it];
this.parameters.push(cppParameter);
}
this.parametersDefinition = this.parameters.map(p => p.get()).join(", ");
}
getParametersDefinition() {
return this.parameters.map(p => p.type + " " + p.name).join(", ");
}
}
exports.Member = Member;
//# sourceMappingURL=Member.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../../source/cpp-creation/members/Member.ts"],"names":[],"mappings":";;;AAGA,4CAAyC;AAGzC,MAAsB,MAAM;IAc1B,YAAa,UAAqB,EAAE,iBAAmC;QAXvE,SAAI,GAAG,EAAE,CAAC;QACV,aAAQ,GAAI,KAAK,CAAC;QAClB,cAAS,GAAG,IAAI,CAAC;QACjB,aAAQ,GAAI,KAAK,CAAC;QAClB,aAAQ,GAAI,KAAK,CAAC;QAClB,SAAI,GAAG,MAAM,CAAC;QACd,iBAAY,GAAU,IAAI,CAAC;QAC3B,eAAU,GAAe,EAAE,CAAC;QAC5B,mBAAc,GAAG,EAAE,CAAC;QACpB,yBAAoB,GAAG,EAAE,CAAC;QAIxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,IAAI,CAAC,c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C7B,CAAC;YACC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YAEjB,OAAO;QACT,CAAC;QAED,KAAM,IAAI,EAAE,IAAI,IAAI,EACpB,CAAC;YACC,IAAK,CAAE,IAAI,CAAC,cAAc,CAAE,EAAE,CAAE,EAChC,CAAC;gBACC,SAAS;YACX,CAAC;YAED,IAAI,YAAY,GAAG,IAAI,qBAAS,EAAE,CAAC;YACnC,YAAY,CAAC,IAAI,GAAG,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,GAAG,IAAI,CAAE,EAAE,CAAE,CAAC;YAE/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAE,YAAY,CAAE,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAE,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;IAE/E,CAAC;IAMD,uBAAuB;QAErB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,CAAE,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;IACxE,CAAC;CAsBF;AA3HD,wBA2HC"}

View File

@ -1,69 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Method = void 0;
const MemberType_1 = require("../MemberType");
const Member_1 = require("./Member");
class Method extends Member_1.Member {
constructor(memberInitializer) {
super(MemberType_1.MemberType.Method, memberInitializer);
this.implementation = null;
}
get hasMethodImplementation() {
return this.implementation != null;
}
getMethodImplementation(className) {
let lines = [];
lines.push(this.info());
lines.push(`${this.type} ${className}::${this.name}${this.parameterWithBrackets}`);
lines.push("{");
this.implementation.forEach(l => lines.push(" " + l));
lines.push("}");
return lines.join("\n") + "\n";
}
parseBody(body) {
if (Array.isArray(body)) {
let parameters = body[0];
let lines = body[1];
this.parseMethodParameters(parameters);
this.implementation = lines;
}
else {
return this.parseMethodParameters(body);
}
}
get parameterWithBrackets() {
let parameters = this.parametersDefinition === "" ? "()" :
`( ${this.parametersDefinition} )`;
return parameters;
}
getHeaderDefinition() {
let methodInfo = "\n " + this.info() + "\n ";
if (this.isVirtual) {
let numParameters = this.parameters.length;
let methodReturnType = this.type === "void" ? "" : "R";
let returnTypeDefinition = this.type === "void" ? "" : (this.type + ", ");
let parametersDefinition = "";
if (numParameters > 0) {
parametersDefinition = ", " + this.parameters.map(p => p.type).join(", ");
}
return `${methodInfo}GDVIRTUAL${numParameters}${methodReturnType}( ${returnTypeDefinition}${this.name}${parametersDefinition} );`;
}
let parameters = this.parameterWithBrackets;
return `${methodInfo}${this.type} ${this.name}${parameters};`;
}
getBindings(className) {
if (this.isVirtual) {
let parameterInfos = "";
for (let i = 0; i < this.parameters.length; i++) {
let name = `, "${this.parameters[i].name}"`;
parameterInfos += name;
}
return `GDVIRTUAL_BIND( ${this.name}${parameterInfos} );`;
}
else {
return `ClassDB::bind_method( D_METHOD( "${this.name}" ) , &${className}::${this.name} );`;
}
}
}
exports.Method = Method;
//# sourceMappingURL=Method.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Method.js","sourceRoot":"","sources":["../../../source/cpp-creation/members/Method.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC3C,qCAAkC;AAElC,MAAa,MAAO,SAAQ,eAAM;IAEhC,YAAa,iBAAmC;QAE9C,KAAK,CAAE,uBAAU,CAAC,MAAM,EAAE,iBAAiB,CAAE,CAAC;QAGhD,mBAAc,GAAY,IAAI,CAAC;IAF/B,CAAC;IAID,IAAI,uBAAuB;QAEzB,OAAO,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC;IACrC,CAAC;IAED,uBAAuB,CAAE,SAAgB;QAEvC,IAAI,KAAK,GAAG,EAAE,CAAC;QAEf,KAAK,CAAC,IAAI,CAAE,IAAI,CAAC,IAAI,EAAE,CAAE,C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AAO,oCAAoC,IAAI,CAAC,IAAI,UAAU,SAAS,KAAK,IAAI,CAAC,IAAI,KAAK,CAAA;QAC5F,CAAC;IACH,CAAC;CACF;AArGD,wBAqGC"}

View File

@ -1,30 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Signal = void 0;
const GodotTypes_1 = require("../GodotTypes");
const MemberType_1 = require("../MemberType");
const Member_1 = require("./Member");
class Signal extends Member_1.Member {
constructor(memberInitializer) {
super(MemberType_1.MemberType.Signal, memberInitializer);
}
parseBody(body) {
return this.parseMethodParameters(body);
}
getHeaderDefinition() {
return "\n " + this.info();
}
getBindings(className) {
//ADD_SIGNAL(MethodInfo("session_supported", PropertyInfo(Variant::STRING, "session_mode"), PropertyInfo(Variant::BOOL, "supported")));
let parameterInfos = "";
for (let i = 0; i < this.parameters.length; i++) {
let type = GodotTypes_1.GodotTypes.stringToVariantType(this.parameters[i].type);
let name = this.parameters[i].name;
let pi = `, PropertyInfo(Variant::${type}, "${name}")`;
parameterInfos += pi;
}
return `ADD_SIGNAL (MethodInfo( "${this.name}" ${parameterInfos}) );`;
}
}
exports.Signal = Signal;
//# sourceMappingURL=Signal.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Signal.js","sourceRoot":"","sources":["../../../source/cpp-creation/members/Signal.ts"],"names":[],"mappings":";;;AACA,8CAA2C;AAE3C,8CAA2C;AAC3C,qCAAkC;AAElC,MAAa,MAAO,SAAQ,eAAM;IAEhC,YAAa,iBAAmC;QAE9C,KAAK,CAAE,uBAAU,CAAC,MAAM,EAAE,iBAAiB,CAAE,CAAC;IAChD,CAAC;IAED,SAAS,CAAE,IAAQ;QAEjB,OAAO,IAAI,CAAC,qBAAqB,CAAE,IAAI,CAAE,CAAC;IAC5C,CAAC;IAGD,mBAAmB;QAEjB,OAAO,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,WAAW,CAAE,SAAgB;QAE3B,uIAAuI;QACvI,IAAI,cAAc,GAAG,EAAE,CAAC;QAExB,KAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAChD,CAAC;YACC,IAAI,IAAI,GAAG,uBAAU,CAAC,mBAAmB,CAAE,IAAI,CAAC,UAAU,CAAE,CAAC,CAAE,CAAC,IAAI,CAAE,CAAC;YACvE,IAAI,IAAI,GAAG,IAAI,CAAC,UAAU,CAAE,CAAC,CAAE,CAAC,IAAI,CAAC;YAErC,IAAI,EAAE,GAAG,2BAA2B,IAAI,MAAM,IAAI,IAAI,CAAC;YAEvD,cAAc,IAAI,EAAE,CAAC;QACvB,CAAC;QAED,OAAO,4BAA4B,IAAI,CAAC,IAAI,KAAK,cAAc,MAAM,CAAC;IACxE,CAAC;CACF;AAnCD,wBAmCC"}

View File

@ -1,75 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const CppCreator_1 = require("./cpp-creation/CppCreator");
const TypeRegistration_1 = require("./cpp-creation/TypeRegistration");
const Files_1 = require("./library/Files");
const RJLog_1 = require("./library/RJLog");
const Texts_1 = require("./library/Texts");
class CreateCpp {
static main() {
return __awaiter(this, void 0, void 0, function* () {
RJLog_1.RJLog.log("Clear old cpp files");
yield this.clearCppFiles();
RJLog_1.RJLog.log("Generate cpp files from definitions");
let files = yield this.getCppFiles();
for (let file of files) {
var cppFilePath = Texts_1.Texts.joinPaths(CppCreator_1.CppCreator.definitionsPath, file);
yield CppCreator_1.CppCreator.createCppFiles(cppFilePath);
}
RJLog_1.RJLog.log("Copy raw cpp files");
yield this.copyRaw();
RJLog_1.RJLog.log("Register types");
yield TypeRegistration_1.TypeRegistration.createRegistrations();
});
}
;
static clearCppFiles() {
return __awaiter(this, void 0, void 0, function* () {
let allFiles = yield Files_1.Files.getFiles(CppCreator_1.CppCreator.outputPath);
let cppFiles = allFiles.filter(file => CreateCpp.cppExtensionRegex.test(file));
for (let cppFile of cppFiles) {
let fullPath = Texts_1.Texts.joinPaths(CppCreator_1.CppCreator.outputPath, cppFile);
//RJLog.log( "deleting", fullPath );
yield Files_1.Files.delete(fullPath);
}
});
}
static getCppFiles() {
return __awaiter(this, void 0, void 0, function* () {
let files = yield Files_1.Files.getFiles(CppCreator_1.CppCreator.definitionsPath);
files = files.filter(f => !f.startsWith("_"));
return Promise.resolve(files);
});
}
static copyRaw() {
return __awaiter(this, void 0, void 0, function* () {
let files = yield Files_1.Files.getFilesRecursive(CppCreator_1.CppCreator.rawPath);
for (let i = 0; i < files.length; i++) {
let fileName = Texts_1.Texts.fileName(files[i]);
if (fileName.startsWith("_") || !CreateCpp.cppExtensionRegex.test(fileName)) {
continue;
}
let fullPath = Texts_1.Texts.joinPaths(CppCreator_1.CppCreator.rawPath, files[i]);
let isDirectory = yield Files_1.Files.isDirectory(fullPath);
if (isDirectory) {
continue;
}
let outputFullPath = Texts_1.Texts.joinPaths(CppCreator_1.CppCreator.outputPath, fileName);
// RJLog.log( "copying:", fileName, "\n" + fullPath, "\n", outputFullPath );
yield Files_1.Files.copy(fullPath, outputFullPath);
}
});
}
}
CreateCpp.cppExtensionRegex = /\.(h|cpp)$/;
CreateCpp.main();
//# sourceMappingURL=create-cpp.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"create-cpp.js","sourceRoot":"","sources":["../source/create-cpp.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0DAAuD;AACvD,sEAAmE;AACnE,2CAAwC;AAExC,2CAAwC;AACxC,2CA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"}

View File

@ -1,77 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const RJLog_1 = require("./library/RJLog");
const { argv } = require("process");
const path = require("path");
const fs = require("node:fs/promises");
const { exists } = require("./library.js");
let targetDirectory = "outputs";
let godotName = "godot-4.3-dev-rokojori";
let platform = "argv[ 2 ]";
let godotPlatformName = godotName + "-" + "argv[ 2 ]";
let platformTargetDirectory = path.join(targetDirectory, godotPlatformName);
function main() {
return __awaiter(this, void 0, void 0, function* () {
if (argv.length !== 3) {
let platforms = ["windows"];
console.error("Platform missing in the command. Add one of these to the command line:", platforms.join(", "));
return;
}
platform = argv[2];
godotPlatformName = godotName + "-" + argv[2];
platformTargetDirectory = path.join(targetDirectory, godotPlatformName);
RJLog_1.RJLog.log("Creating output");
yield deleteOldDirectory();
yield createDirectory();
RJLog_1.RJLog.log("Output done");
});
}
function deleteOldDirectory() {
return __awaiter(this, void 0, void 0, function* () {
let directoryExists = yield exists(platformTargetDirectory);
RJLog_1.RJLog.log("checking if old directory exists", directoryExists);
if (directoryExists) {
RJLog_1.RJLog.log(`deleting previous directory: "${platformTargetDirectory}"`);
yield fs.rm(platformTargetDirectory, { recursive: true });
}
return Promise.resolve();
});
}
function createDirectory() {
return __awaiter(this, void 0, void 0, function* () {
RJLog_1.RJLog.log(`creating directory: "${platformTargetDirectory}"`);
yield fs.mkdir(platformTargetDirectory, { recursive: true });
let godotFrom = "godot/bin";
let godotTo = path.join(platformTargetDirectory, "godot");
RJLog_1.RJLog.log(`copying godot: "${godotFrom}" >> "${godotTo}"`);
yield fs.cp(godotFrom, godotTo, { recursive: true });
let npFrom = "godot-rj-nuget-package";
let npTo = path.join(platformTargetDirectory, npFrom);
RJLog_1.RJLog.log(`copying nupkg: "${npFrom}" >> "${npTo}"`);
yield fs.cp(npFrom, npTo, { recursive: true });
let installerFiles = {
"windows": [
"install-godot-windows.bat",
"install-godot-windows-readme.txt"
]
};
let installers = installerFiles[platform];
for (let installer of installers) {
let installFrom = "install-scripts/" + installer;
let installTo = path.join(platformTargetDirectory, installer);
RJLog_1.RJLog.log(`copying installer: "${installFrom}" >> "${installTo}"`);
yield fs.cp(installFrom, installTo, { recursive: true });
}
});
}
main();
//# sourceMappingURL=create-output.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"create-output.js","sourceRoot":"","sources":["../source/create-output.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAAwC;AAExC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACpC,MAAM,IAAI,GAAG,OAAO,CAAE,MAAM,CAAE,CAAC;AAC/B,MAAM,EAAE,GAAG,OAAO,CAAE,kBAAkB,CAAE,CAAC;AACzC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAE,cAAc,CAAE,CAAC;AAG7C,IAAI,eAAe,GAAG,SAAS,CAAC;AAChC,IAAI,SAAS,GAAG,wBAAwB,CAAC;AACzC,IAAI,QAAQ,GAAG,WAAW,CAAC;AAC3B,IAAI,iBAAiB,GAAG,SAAS,GAAG,GAAG,GAAG,WAAW,CAAC;AACtD,IAAI,uBAAuB,GAAG,IAAI,CAAC,IAAI,CAAE,eAAe,EAAE,iBAAiB,CAAE,CAAC;AAE9E,SAAe,IAAI;;QAGjB,IAAK,IAAI,CAAC,MAAM,KAAK,CAAC,EACtB,CAAC;YACC,IAAI,SAAS,GAAG,CAAE,SAAS,CAAE,CAAC;YAE9B,OAAO,CAAC,KAAK,CAAE,wEAAwE,EAAE,S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AAC;QAE7D,MAAM,EAAE,CAAC,EAAE,CAAE,SAAS,EAAE,OAAO,EAAE,EAAE,SAAS,EAAG,IAAI,EAAE,CAAE,CAAC;QAIxD,IAAI,MAAM,GAAG,wBAAwB,CAAC;QACtC,IAAI,IAAI,GAAK,IAAI,CAAC,IAAI,CAAE,uBAAuB,EAAE,MAAM,CAAE,CAAC;QAE1D,aAAK,CAAC,GAAG,CAAE,mBAAmB,MAAM,SAAS,IAAI,GAAG,CAAE,CAAC;QAEvD,MAAM,EAAE,CAAC,EAAE,CAAE,MAAM,EAAE,IAAI,EAAE,EAAE,SAAS,EAAG,IAAI,EAAE,CAAE,CAAC;QAGlD,IAAI,cAAc,GAClB;YACE,SAAS,EACT;gBACE,2BAA2B;gBAC3B,kCAAkC;aACnC;SACF,CAAC;QAEF,IAAI,UAAU,GAAK,cAAc,CAAE,QAAQ,CAAE,CAAC;QAE9C,KAAM,IAAI,SAAS,IAAI,UAAU,EACjC,CAAC;YACC,IAAI,WAAW,GAAG,kBAAkB,GAAG,SAAS,CAAC;YAEjD,IAAI,SAAS,GAAK,IAAI,CAAC,IAAI,CAAE,uBAAuB,EAAE,SAAS,CAAE,CAAC;YAElE,aAAK,CAAC,GAAG,CAAE,uBAAuB,WAAW,SAAS,SAAS,GAAG,CAAE,CAAC;YAErE,MAAM,EAAE,CAAC,EAAE,CAAE,WAAW,EAAE,SAAS,EAAE,EAAE,SAAS,EAAG,IAAI,EAAE,CAAE,CAAC;QAC9D,CAAC;IAEH,CAAC;CAAA;AAGD,IAAI,EAAE,CAAC"}

View File

@ -1,102 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Files = void 0;
const fs_1 = require("fs");
const RJLog_1 = require("./RJLog");
class Files {
static getFiles(filePath) {
return __awaiter(this, void 0, void 0, function* () {
return yield fs_1.promises.readdir(filePath);
});
}
static copy(from, to) {
return __awaiter(this, void 0, void 0, function* () {
return yield fs_1.promises.copyFile(from, to);
});
}
static getFilesRecursive(filePath) {
return __awaiter(this, void 0, void 0, function* () {
let files = yield fs_1.promises.readdir(filePath, { recursive: true });
return files;
});
}
static delete(filePath) {
return __awaiter(this, void 0, void 0, function* () {
yield fs_1.promises.unlink(filePath);
return Promise.resolve();
});
}
static isDirectory(filePath) {
return __awaiter(this, void 0, void 0, function* () {
let stats = yield fs_1.promises.stat(filePath);
return stats.isDirectory();
});
}
static exists(filePath) {
return __awaiter(this, void 0, void 0, function* () {
try {
let stats = yield fs_1.promises.stat(filePath);
let exists = stats !== undefined && stats !== null;
return Promise.resolve(exists);
}
catch (e) {
}
return Promise.resolve(false);
});
}
static loadUTF8(filePath) {
return __awaiter(this, void 0, void 0, function* () {
try {
let data = yield fs_1.promises.readFile(filePath);
let stringData = data.toString();
return Promise.resolve(stringData);
}
catch (exception) {
RJLog_1.RJLog.warn("loadUTF8: ", filePath);
RJLog_1.RJLog.warn(exception);
}
return Promise.resolve(null);
});
}
static saveUTF8(filePath, data) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield fs_1.promises.writeFile(filePath, data);
return Promise.resolve(true);
}
catch (exception) {
RJLog_1.RJLog.warn("saveUTF8: ", filePath);
RJLog_1.RJLog.warn(exception);
}
return Promise.resolve(false);
});
}
static loadJSON(filePath) {
return __awaiter(this, void 0, void 0, function* () {
let text = yield this.loadUTF8(filePath);
if (text === null) {
return Promise.resolve(null);
}
try {
let jsonObject = JSON.parse(text);
return Promise.resolve(jsonObject);
}
catch (exception) {
RJLog_1.RJLog.warn("LoadJSON: ", filePath);
RJLog_1.RJLog.warn(exception);
}
return Promise.resolve(null);
});
}
}
exports.Files = Files;
//# sourceMappingURL=Files.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Files.js","sourceRoot":"","sources":["../../source/library/Files.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAoC;AACpC,mCAAgC;AAEhC,MAAa,KAAK;IAEhB,MAAM,CAAO,QAAQ,CAAE,QAAe;;YAEpC,OAAO,MAAM,aAAE,CAAC,OAAO,CAAE,QAAQ,CAAE,CAAC;QACtC,CAAC;KAAA;IAED,MAAM,CAAO,IAAI,CAAE,IAAW,EAAE,EAAS;;YAEvC,OAAO,MAAM,aAAE,CAAC,QAAQ,CAAE,IAAI,EAAE,EAAE,CAAE,CAAC;QACvC,CAAC;KAAA;IAGD,MAAM,CAAO,iBAAiB,CAAE,QAAe;;YAE7C,IAAI,KAAK,GAAG,MAAM,aAAE,CAAC,OAAO,CAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAE,CAAC;YAC9D,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;IAGD,MAAM,CAAO,MAAM,CAAE,QAAe;;YAElC,MAAM,aAAE,CAAC,MAAM,CAAE,QAAQ,CAAE,CAAC;YAC5B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;KAAA;IAED,MAAM,CAAO,WAAW,CAAE,QAAe;;YAEvC,IAAI,KAAK,GAAG,MAAM,aAAE,CAAC,IAAI,CAAE,QAAQ,CAAE,CAAC;YAEtC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC;KAAA;IAED,MAAM,CAAO,MAAM,CAAE,QAAe;;YAElC,IACA,CAAC;gBACC,IAAI,KAAK,GAAG,MAAM,aAAE,CAAC,IAAI,CAAE,QAAQ,CAAE,CAAC;gBACtC,IAAI,MAAM,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;gBACnD,OAAO,OAAO,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,OAAO,CAAC,OAAO,CAAE,IAAI,CAAO,CAAC;YACtC,CAAC;YAED,IACA,CAAC;gBACC,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAE,IAAI,CAAE,CAAC;gBAEpC,OAAO,OAAO,CAAC,OAAO,CAAE,UAAU,CAAE,CAAC;YACvC,CAAC;YACD,OAAQ,SAAS,EACjB,CAAC;gBACC,aAAK,CAAC,IAAI,CAAE,YAAY,EAAE,QAAQ,CAAE,CAAC;gBACrC,aAAK,CAAC,IAAI,CAAE,SAAS,CAAE,CAAC;YAC1B,CAAC;YAED,OAAO,OAAO,CAAC,OAAO,CAAE,IAAI,CAAE,CAAC;QACjC,CAAC;KAAA;CAGF;AA/GD,sBA+GC"}

View File

@ -1,32 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogColors = void 0;
class LogColors {
}
exports.LogColors = LogColors;
LogColors.reset = "\x1b[0m";
LogColors.bright = "\x1b[1m";
LogColors.dim = "\x1b[2m";
LogColors.underscore = "\x1b[4m";
LogColors.blink = "\x1b[5m";
LogColors.reverse = "\x1b[7m";
LogColors.hidden = "\x1b[8m";
LogColors.black_Foreground = "\x1b[30m";
LogColors.red_Foreground = "\x1b[31m";
LogColors.green_Foreground = "\x1b[32m";
LogColors.yellow_Foreground = "\x1b[33m";
LogColors.blue_Foreground = "\x1b[34m";
LogColors.magenta_Foreground = "\x1b[35m";
LogColors.cyan_Foreground = "\x1b[36m";
LogColors.white_Foreground = "\x1b[37m";
LogColors.gray_Foreground = "\x1b[90m";
LogColors.black_Background = "\x1b[40m";
LogColors.red_Background = "\x1b[41m";
LogColors.green_Background = "\x1b[42m";
LogColors.yellow_Background = "\x1b[43m";
LogColors.blue_Background = "\x1b[44m";
LogColors.magenta_Background = "\x1b[45m";
LogColors.cyan_Background = "\x1b[46m";
LogColors.white_Background = "\x1b[47m";
LogColors.gray_Background = "\x1b[100m";
//# sourceMappingURL=LogColors.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"LogColors.js","sourceRoot":"","sources":["../../source/library/LogColors.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;;AAAtB,8BA8BC;AA5BiB,eAAK,GAAG,SAAS,CAAC;AAClB,gBAAM,GAAG,SAAS,CAAC;AACnB,aAAG,GAAG,SAAS,CAAC;AAChB,oBAAU,GAAG,SAAS,CAAC;AACvB,eAAK,GAAG,SAAS,CAAC;AAClB,iBAAO,GAAG,SAAS,CAAC;AACpB,gBAAM,GAAG,SAAS,CAAC;AAEnB,0BAAgB,GAAG,UAAU,CAAC;AAC9B,wBAAc,GAAG,UAAU,CAAC;AAC5B,0BAAgB,GAAG,UAAU,CAAC;AAC9B,2BAAiB,GAAG,UAAU,CAAC;AAC/B,yBAAe,GAAG,UAAU,CAAC;AAC7B,4BAAkB,GAAG,UAAU,CAAC;AAChC,yBAAe,GAAG,UAAU,CAAC;AAC7B,0BAAgB,GAAG,UAAU,CAAC;AAC9B,yBAAe,GAAG,UAAU,CAAC;AAE7B,0BAAgB,GAAG,UAAU,CAAC;AAC9B,wBAAc,GAAG,UAAU,CAAC;AAC5B,0BAAgB,GAAG,UAAU,CAAC;AAC9B,2BAAiB,GAAG,UAAU,CAAC;AAC/B,yBAAe,GAAG,UAAU,CAAC;AAC7B,4BAAkB,GAAG,UAAU,CAAC;AAChC,yBAAe,GAAG,UAAU,CAAC;AAC7B,0BAAgB,GAAG,UAAU,CAAC;AAC9B,yBAAe,GAAG,WAAW,CAAC"}

View File

@ -1,7 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MatchResult = void 0;
class MatchResult {
}
exports.MatchResult = MatchResult;
//# sourceMappingURL=MatchResult.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"MatchResult.js","sourceRoot":"","sources":["../../source/library/MatchResult.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;CAKvB;AALD,kCAKC"}

View File

@ -1,11 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Objects = void 0;
class Objects {
static jsonClone(obj) {
let jsonData = JSON.stringify(obj);
return JSON.parse(jsonData);
}
}
exports.Objects = Objects;
//# sourceMappingURL=Objects.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Objects.js","sourceRoot":"","sources":["../../source/library/Objects.ts"],"names":[],"mappings":";;;AAAA,MAAa,OAAO;IAElB,MAAM,CAAC,SAAS,CAAK,GAAK;QAExB,IAAI,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAE,GAAG,CAAE,CAAC;QACrC,OAAO,IAAI,CAAC,KAAK,CAAE,QAAQ,CAAO,CAAC;IACrC,CAAC;CACF;AAPD,0BAOC"}

View File

@ -1,83 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RJLog = void 0;
const LogColors_1 = require("./LogColors");
const Texts_1 = require("./Texts");
class RJLog {
static _parseLineResult(line) {
let result = RJLog.matcherWithFunction.exec(line) ||
RJLog.matcherFile.exec(line) ||
RJLog.matcherAnonymous.exec(line);
return result;
}
static _parseLine(line) {
let result = RJLog._parseLineResult(line);
if (result) {
return " " + result[1] + "(" + result[2] + ") ";
}
return line;
}
static logError(e) {
console.log("\n" + RJLog._formatErrorMessage(e.stack));
}
static _formatErrorMessage(stackTrace, color = RJLog.errorMessageColor) {
let lines = Texts_1.Texts.splitLines(stackTrace);
let output = [color];
lines.forEach((line, index) => {
let lineInfo = RJLog._parseLine(line);
output.push(lineInfo);
if (index !== lines.length - 1) {
output.push("\n");
}
});
output.push(RJLog.resetColor);
return output.join("");
}
static getLineInfo(color = RJLog.logColor, stackTrace, lineIndex = 3) {
stackTrace = stackTrace || (new Error().stack + "");
let lines = Texts_1.Texts.splitLines(stackTrace);
let result = null;
while (!result && lineIndex < lines.length) {
let line = lines[lineIndex];
result = RJLog._parseLineResult(line);
lineIndex++;
}
if (!result) {
console.log(stackTrace);
return color + " <Unknown> " + RJLog.resetColor;
}
return color + " " + result[1] + "(" + result[2] + ") " + RJLog.resetColor;
}
static error(...params) {
if (RJLog.logAlwaysLineInfo || typeof process === "object") {
let lineInfo = RJLog.getLineInfo(RJLog.errorColor);
console.log("\n" + lineInfo);
}
console.error.apply(console, params);
}
static warn(...params) {
if (RJLog.logAlwaysLineInfo || typeof process === "object") {
let lineInfo = RJLog.getLineInfo(RJLog.warnColor);
console.log("\n" + lineInfo);
}
console.warn.apply(console, params);
}
static log(...params) {
if (RJLog.logAlwaysLineInfo || typeof process === "object") {
let lineInfo = RJLog.getLineInfo();
console.log("\n" + lineInfo);
}
console.log.apply(console, params);
}
}
exports.RJLog = RJLog;
RJLog.errorColor = LogColors_1.LogColors.red_Background;
RJLog.errorMessageColor = LogColors_1.LogColors.red_Foreground;
RJLog.warnColor = LogColors_1.LogColors.yellow_Background;
RJLog.logColor = LogColors_1.LogColors.gray_Background;
RJLog.resetColor = LogColors_1.LogColors.reset;
RJLog.matcherWithFunction = /^\s+at\s(.+)\s\(.+?:(\d+:\d+)\)/;
RJLog.matcherFile = /\(.+?\\(\w+)\.js:(\d+:\d+)\)/;
RJLog.matcherAnonymous = /^\s+at\s(.+)\s\((.+)\)/;
RJLog.logAlwaysLineInfo = true;
//# sourceMappingURL=RJLog.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"RJLog.js","sourceRoot":"","sources":["../../source/library/RJLog.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,mCAAgC;AAEhC,MAAa,KAAK;IAehB,MAAM,CAAC,gBAAgB,CAAE,IAAW;QAElC,IAAI,MAAM,GAAG,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAE,IAAI,CAAE;YACtC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAE,IAAI,CAAE;YAC9B,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;QAEjD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,UAAU,CAAE,IAAW;QAE5B,IAAI,MAAM,GAAG,KAAK,CAAC,gBAAgB,CA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AAO,CAAC,IAAI,CAAC,KAAK,CAAE,OAAO,EAAE,MAAM,CAAE,CAAC;IACxC,CAAC;IAGD,MAAM,CAAC,GAAG,CAAE,GAAG,MAAY;QAEzB,IAAK,KAAK,CAAC,iBAAiB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAC3D,CAAC;YACC,IAAI,QAAQ,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;YACnC,OAAO,CAAC,GAAG,CAAE,IAAI,GAAG,QAAQ,CAAE,CAAC;QACjC,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAE,OAAO,EAAE,MAAM,CAAE,CAAC;IACvC,CAAC;;AA/HH,sBAgIC;AA9HiB,gBAAU,GAAG,qBAAS,CAAC,cAAc,CAAC;AACtC,uBAAiB,GAAG,qBAAS,CAAC,cAAc,CAAC;AAC7C,eAAS,GAAI,qBAAS,CAAC,iBAAiB,CAAC;AACzC,cAAQ,GAAK,qBAAS,CAAC,eAAe,CAAA;AACtC,gBAAU,GAAG,qBAAS,CAAC,KAAK,CAAC;AAE7B,yBAAmB,GAAG,iCAAiC,CAAC;AACxD,iBAAW,GAAW,8BAA8B,CAAC;AACrD,sBAAgB,GAAM,wBAAwB,CAAC;AAE/C,uBAAiB,GAAG,IAAI,CAAC"}

View File

@ -1,50 +0,0 @@
export class MatchResult {
}
export class Text {
static makeSticky(regexp) {
if (regexp.sticky) {
return regexp;
}
var source = regexp.source;
var flags = regexp.flags;
if (flags.indexOf("y") === -1) {
flags += "y";
}
return new RegExp(source, flags);
}
static makeGlobal(regexp) {
if (regexp.global) {
return regexp;
}
var source = regexp.source;
var flags = regexp.flags;
if (flags.indexOf("g") === -1) {
flags += "g";
}
return new RegExp(source, flags);
}
static getMatches(source, regex) {
regex = this.makeGlobal(regex);
let offset = 0;
let matches = [];
while (offset < source.length) {
regex.lastIndex = offset;
let result = regex.exec(source);
let match = result ? result[0] : null;
if (result && result.index != offset && match.length > 0) {
offset = result.index + match.length;
matches.push({ match: match, index: result.index });
}
else {
return matches;
}
}
return matches;
}
static insertText(sourceText, insertText, insertPosition) {
let before = sourceText.substring(0, insertPosition);
let after = sourceText.substring(insertPosition, sourceText.length);
return before + insertText + after;
}
}
//# sourceMappingURL=Text.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../source/library/Text.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;CAIvB;AAED,MAAM,OAAO,IAAI;IAEf,MAAM,CAAC,UAAU,CAAE,MAAa;QAE9B,IAAK,MAAM,CAAC,MAAM,EAClB,CAAC;YACC,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC3B,IAAI,KAAK,GAAI,MAAM,CAAC,KAAK,CAAC;QAE1B,IAAK,KAAK,CAAC,OAAO,CAAE,GAAG,CAAE,KAAK,CAAC,CAAC,EAChC,CAAC;YACC,KAAK,IAAI,GAAG,CAAC;QACf,CAAC;QAED,OAAO,IAAI,MAAM,CAAE,MAAM,EAAE,KAAK,CAAE,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,UAAU,CAAE,MAAa;QAE9B,IAAK,MAAM,CAAC,MAAM,EAClB,CAAC;YACC,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC3B,IAAI,KAAK,GAAI,MAAM,CAAC,KAAK,CAAC;QAE1B,IAAK,KAAK,CAAC,OAAO,CAAE,GAAG,CAAE,KAAK,CAAC,CAAC,EAChC,CAAC;YACC,KAAK,IAAI,GAAG,CAAC;QACf,CAAC;QAED,OAAO,IAAI,MAAM,CAAE,MAAM,EAAE,KAAK,CAAE,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,UAAU,CAAE,MAAa,EAAE,KAAY;QAE5C,KAAK,GAAG,IAAI,CAAC,UAAU,CAAE,KAAK,CAAE,CAAC;QAEjC,IAAI,MAAM,GAAG,CAAC,CAAC;QAEf,IAAI,OAAO,GAAiB,EAAE,CAAC;QAE/B,OAAQ,MAAM,GAAG,MAAM,CAAC,MAAM,EAC9B,CAAC;YACC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;YACzB,IAAI,MAAM,GAAG,KAAK,CAAC,IAAI,CAAE,MAAM,CAAE,CAAC;YAElC,IAAI,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAE,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAExC,IAAK,MAAM,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EACzD,CAAC;gBACC,MAAM,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAE,EAAE,KAAK,EAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAE,CAAC;YACvD,CAAC;iBAED,CAAC;gBACC,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,UAAU,CAAE,UAAiB,EAAE,UAAiB,EAAE,cAAqB;QAE5E,IAAI,MAAM,GAAG,UAAU,CAAC,SAAS,CAAE,CAAC,EAAE,cAAc,CAAE,CAAC;QACvD,IAAI,KAAK,GAAI,UAAU,CAAC,SAAS,CAAE,cAAc,EAAE,UAAU,CAAC,MAAM,CAAE,CAAC;QAEvE,OAAO,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;IACrC,CAAC;CACF"}

View File

@ -1,105 +0,0 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Texts = void 0;
const path_1 = __importDefault(require("path"));
class Texts {
static joinPaths(...paths) {
return path_1.default.join.apply(null, paths);
}
static makeSticky(regexp) {
if (regexp.sticky) {
return regexp;
}
var source = regexp.source;
var flags = regexp.flags;
if (flags.indexOf("y") === -1) {
flags += "y";
}
return new RegExp(source, flags);
}
static splitLines(text) {
return text.split(/(?:\r\n)|\n|\r/g);
}
static fileName(fullPath) {
return path_1.default.basename(fullPath);
}
static splitLinesCaptureBreaks(text) {
return text.split(/((?:\r\n)|\n|\r)/g);
}
static makeGlobal(regexp) {
if (regexp.global) {
return regexp;
}
var source = regexp.source;
var flags = regexp.flags;
if (flags.indexOf("g") === -1) {
flags += "g";
}
return new RegExp(source, flags);
}
static replaceAllIn(texts, replacements) {
if (texts === undefined || texts === null) {
return texts;
}
let outputTexts = [];
for (let i = 0; i < texts.length; i++) {
outputTexts.push(Texts.replaceAll(texts[i], replacements));
}
return outputTexts;
}
static replaceAll(text, replacements) {
if (text === undefined || text === null) {
return text;
}
for (let [variable, replacement] of replacements) {
let replacementRegexSource = Texts.toRegexSource(variable);
let regex = new RegExp(replacementRegexSource, "g");
text = text.replace(regex, replacement);
}
return text;
}
static toRegexSource(source) {
source = source.replace(/\./g, "\\.");
source = source.replace(/\(/g, "\\(");
source = source.replace(/\)/g, "\\)");
source = source.replace(/\[/g, "\\[");
source = source.replace(/\]/g, "\\]");
source = source.replace(/\^/g, "\\^");
source = source.replace(/\$/g, "\\$");
source = source.replace(/\*/g, "\\*");
source = source.replace(/\+/g, "\\+");
source = source.replace(/\-/g, "\\-");
source = source.replace(/\?/g, "\\?");
source = source.replace(/\//g, "\\/");
source = source.replace(/\|/g, "\\|");
return source;
}
static getMatches(source, regex, type = null) {
regex = this.makeGlobal(regex);
let offset = 0;
let matches = [];
while (offset < source.length) {
regex.lastIndex = offset;
let result = regex.exec(source);
let match = result ? result[0] : null;
if (result && result.index != offset && match.length > 0) {
offset = result.index + match.length;
matches.push({ match: match, index: result.index, type: type });
}
else {
return matches;
}
}
return matches;
}
static insertText(sourceText, insertText, insertPosition) {
let before = sourceText.substring(0, insertPosition);
let after = sourceText.substring(insertPosition, sourceText.length);
return before + insertText + after;
}
}
exports.Texts = Texts;
//# sourceMappingURL=Texts.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Texts.js","sourceRoot":"","sources":["../../source/library/Texts.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAMxB,MAAa,KAAK;IAEhB,MAAM,CAAC,SAAS,CAAE,GAAG,KAAc;QAEjC,OAAO,cAAI,CAAC,IAAI,CAAC,KAAK,CAAE,IAAI,EAAE,KAAK,CAAE,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,UAAU,CAAE,MAAa;QAE9B,IAAK,MAAM,CAAC,MAAM,EAClB,CAAC;YACC,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC3B,IAAI,KAAK,GAAI,MAAM,CAAC,KAAK,CAAC;QAE1B,IAAK,KAAK,CAAC,OAAO,CAAE,GAAG,CAAE,KAAK,CAAC,CAAC,EAChC,CAAC;YACC,KAAK,IAAI,GAAG,CAAC;QACf,CAAC;QAED,OAAO,IAAI,MAAM,CAAE,MAAM,EAAE,KAAK,CAAE,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,UAAU,CAAE,IAAW;QAE5B,OAAO,IAAI,CAAC,KAAK,CAAE,iBAAiB,CAAE,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,QAAQ,CAAE,QAAe;QAE9B,OAAO,cAAI,CAAC,QAAQ,CAAE,QAAQ,CAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,uBAAuB,CAAE,IAAW;QAEzC,OAAO,IAAI,CAAC,KAAK,CAAE,mBAAmB,CAAE,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,UAAU,CAAE,MAAa;QAE9B,IAAK,MAAM,CAAC,MAAM,EAClB,CAAC;YACC,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC3B,IAAI,KAAK,GAAI,MAAM,CAAC,KAAK,CAAC;QAE1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