GFExtensionUsageAudit¶
API Reference / Kernel / 类索引
- 路径:
addons/gf/kernel/extension/gf_extension_usage_audit.gd - 模块:
Kernel - 继承:
RefCounted - API:
public - 类别:编辑器 API (
editor_api) - 首次版本:
3.17.0
检查禁用扩展是否仍被项目文件直接引用。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 常量 | REFERENCE_STRENGTH_VERIFIED |
const REFERENCE_STRENGTH_VERIFIED: StringName = &"verified" |
| 常量 | REFERENCE_STRENGTH_STRONG |
const REFERENCE_STRENGTH_STRONG: StringName = &"strong" |
| 常量 | REFERENCE_STRENGTH_WEAK |
const REFERENCE_STRENGTH_WEAK: StringName = &"weak" |
| 常量 | REFERENCE_SOURCE_GDSCRIPT_LOAD |
const REFERENCE_SOURCE_GDSCRIPT_LOAD: StringName = &"gdscript_load" |
| 常量 | REFERENCE_SOURCE_GDSCRIPT_SYMBOL |
const REFERENCE_SOURCE_GDSCRIPT_SYMBOL: StringName = &"gdscript_symbol" |
| 常量 | REFERENCE_SOURCE_RESOURCE_TEXT |
const REFERENCE_SOURCE_RESOURCE_TEXT: StringName = &"resource_text" |
| 常量 | REFERENCE_SOURCE_GODOT_DEPENDENCY |
const REFERENCE_SOURCE_GODOT_DEPENDENCY: StringName = &"godot_dependency" |
| 常量 | REFERENCE_SOURCE_TEXT_FALLBACK |
const REFERENCE_SOURCE_TEXT_FALLBACK: StringName = &"text_fallback" |
| 常量 | DEFAULT_SCAN_ROOTS |
const DEFAULT_SCAN_ROOTS: Array[String] = ["res://"] |
| 常量 | DEFAULT_MAX_SCAN_DEPTH |
const DEFAULT_MAX_SCAN_DEPTH: int = 32 |
| 常量 | DEFAULT_MAX_SCANNED_FILES |
const DEFAULT_MAX_SCANNED_FILES: int = 10000 |
| 常量 | DEFAULT_MAX_FILE_BYTES |
const DEFAULT_MAX_FILE_BYTES: int = 4 * 1024 * 1024 |
| 常量 | DEFAULT_MAX_TOTAL_BYTES |
const DEFAULT_MAX_TOTAL_BYTES: int = 64 * 1024 * 1024 |
| 常量 | DEFAULT_IGNORED_ROOTS |
const DEFAULT_IGNORED_ROOTS: Array[String] = [ |
| 常量 | TEXT_FILE_EXTENSIONS |
const TEXT_FILE_EXTENSIONS: Array[String] = [ |
| 方法 | audit_disabled_extensions |
static func audit_disabled_extensions( manifests: Array[GFExtensionManifest], options: Dictionary = {} ) -> Dictionary: |
| 方法 | find_references_to_root |
static func find_references_to_root(root_path: String, options: Dictionary = {}) -> Array[Dictionary]: |
常量¶
REFERENCE_STRENGTH_VERIFIED¶
- API:
public - 首次版本:
8.0.0
Godot 依赖图确认的资源引用。
REFERENCE_STRENGTH_STRONG¶
- API:
public - 首次版本:
8.0.0
静态语义扫描确认的资源或 class_name 引用。
REFERENCE_STRENGTH_WEAK¶
- API:
public - 首次版本:
8.0.0
仅文本命中的弱引用提示,不会让禁用扩展审计失败。
REFERENCE_SOURCE_GDSCRIPT_LOAD¶
- API:
public - 首次版本:
8.0.0
GDScript load/preload 等加载表达式来源。
REFERENCE_SOURCE_GDSCRIPT_SYMBOL¶
- API:
public - 首次版本:
8.0.0
GDScript class_name 标识符来源。
REFERENCE_SOURCE_RESOURCE_TEXT¶
- API:
public - 首次版本:
8.0.0
Godot 文本资源依赖字段来源。
REFERENCE_SOURCE_GODOT_DEPENDENCY¶
- API:
public - 首次版本:
8.0.0
Godot ResourceLoader 依赖图来源。
REFERENCE_SOURCE_TEXT_FALLBACK¶
- API:
public - 首次版本:
8.0.0
无法确认语义的文本命中来源。
DEFAULT_SCAN_ROOTS¶
- API:
public - 首次版本:
3.17.0
默认扫描根目录。
DEFAULT_MAX_SCAN_DEPTH¶
- API:
public - 首次版本:
3.17.0
默认最大扫描深度。
DEFAULT_MAX_SCANNED_FILES¶
- API:
public - 首次版本:
3.17.0
默认最大扫描文件数。
DEFAULT_MAX_FILE_BYTES¶
- API:
public - 首次版本:
8.0.0
默认单文件读取字节上限。
DEFAULT_MAX_TOTAL_BYTES¶
- API:
public - 首次版本:
8.0.0
默认单次扫描总读取字节上限。
DEFAULT_IGNORED_ROOTS¶
- API:
public - 首次版本:
3.17.0
默认忽略的根目录。
TEXT_FILE_EXTENSIONS¶
- API:
public - 首次版本:
3.17.0
作为文本扫描的资源扩展名。
方法¶
audit_disabled_extensions¶
- API:
public - 首次版本:
3.17.0
static func audit_disabled_extensions( manifests: Array[GFExtensionManifest], options: Dictionary = {} ) -> Dictionary:
检查一组禁用扩展是否仍被项目文件直接引用。
参数:
| 名称 | 说明 |
|---|---|
manifests |
要检查的禁用扩展 manifest 列表。 |
options |
可选参数,支持 scan_roots、ignored_roots、max_references_per_extension、max_weak_references_per_extension、max_scan_depth、max_scanned_files、max_file_bytes、max_total_bytes、include_weak_references 和 use_resource_dependencies。 |
返回:引用审计报告。
结构:
options: Dictionary controlling scan roots, ignored roots, strong and weak reference limits, depth, scanned file count, file byte budget, total byte budget, weak text reporting, and Godot dependency graph usage.return: Dictionary containing ok, partial_scan, budget_exceeded, extension_count, reference_count, weak_reference_count, extensions, weak_extensions, references, weak_references, scanned_file_count, scanned_bytes, skipped_files, and scan_warnings. references only contains strong or verified blocking references.
find_references_to_root¶
- API:
public - 首次版本:
3.17.0
static func find_references_to_root(root_path: String, options: Dictionary = {}) -> Array[Dictionary]:
查找项目文件中对指定扩展根目录的直接路径引用。
参数:
| 名称 | 说明 |
|---|---|
root_path |
扩展根目录。 |
options |
可选参数,支持 scan_roots、ignored_roots、max_references_per_extension、max_weak_references_per_extension、max_scan_depth、max_scanned_files、max_file_bytes、max_total_bytes、include_weak_references 和 use_resource_dependencies。 |
返回:引用列表。
结构:
options: Dictionary controlling scan roots, ignored roots, strong and weak reference limits, depth, scanned file count, file byte budget, total byte budget, weak text reporting, and Godot dependency graph usage.return: Array of Dictionary file reference records. By default only strong or verified blocking references are returned; include_weak_references appends weak text matches.