feat: integrate ts2lua-unreal v0.2.1 and UnLua TypeScript (.d.ts) generator
This commit is contained in:
1 parent
ebce41f347
commit
ee2e62bb34
282 files changed
+141794
-261
No files matched your search
@@ -32,11 +32,18 @@ public:
|
||||
// Update all Blueprints from command
|
||||
void UpdateAll();
|
||||
|
||||
// Update all Lua IntelliSense and TypeScript (.d.ts) declarations
|
||||
void UpdateAllWithTS();
|
||||
|
||||
void Initialize();
|
||||
|
||||
private:
|
||||
static TSharedPtr<FUnLuaIntelliSenseGenerator> Singleton;
|
||||
|
||||
void UpdateAllInternal(bool bGenerateTS);
|
||||
|
||||
void ExportStaticallyExports();
|
||||
|
||||
static bool IsBlueprint(const FAssetData& AssetData);
|
||||
|
||||
static bool ShouldExport(const FAssetData& AssetData, bool bLoad = false);
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// Tencent is pleased to support the open source community by making UnLua available.
|
||||
//
|
||||
// Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
//
|
||||
// Licensed under the MIT License (the "License");
|
||||
// you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://opensource.org/licenses/MIT
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreUObject.h"
|
||||
|
||||
class UBlueprint;
|
||||
|
||||
/**
|
||||
* Generates TypeScript (.d.ts) declaration files for UE reflected types, Blueprints,
|
||||
* and UnLua statically exported types (excluding runtime declarations owned by unlua.d.ts).
|
||||
*/
|
||||
class UNLUAEDITOR_API FUnLuaTypeScriptGenerator
|
||||
{
|
||||
public:
|
||||
static TSharedRef<FUnLuaTypeScriptGenerator> Get();
|
||||
|
||||
/** Collect all reflected types & Blueprints and generate .d.ts files. */
|
||||
void GenerateAll();
|
||||
|
||||
/** Generate .d.ts files using already-collected native types & loaded Blueprints. */
|
||||
void GenerateAll(const TArray<const UField*>& NativeTypes, const TArray<const UBlueprint*>& Blueprints);
|
||||
|
||||
/** Incrementally regenerate the .d.ts file for the package directory containing a Blueprint (if output dir exists). */
|
||||
void UpdateBlueprint(const UBlueprint* Blueprint);
|
||||
|
||||
/** Incrementally refresh/clean the .d.ts file for a Blueprint's package path after deletion or rename. */
|
||||
void OnBlueprintPackageChanged(const FString& PackagePath);
|
||||
|
||||
/** Resolve target output directory for generated .d.ts files. */
|
||||
FString GetOutputDir() const;
|
||||
|
||||
private:
|
||||
static TSharedPtr<FUnLuaTypeScriptGenerator> Singleton;
|
||||
|
||||
bool SaveDtsFile(const FString& OutputDir, const FString& RelativeFilePath, const FString& Content, TSet<FString>& OutWrittenFiles);
|
||||
void CleanStaleDtsFiles(const FString& OutputDir, const TSet<FString>& WrittenFiles);
|
||||
void RegenerateBlueprintDirectory(const FString& PackageDir);
|
||||
};
|
||||
Reference in new issue
Block a user