refactor: break circular deps in equipment and golems data modules
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m20s

This commit is contained in:
2026-05-20 12:00:46 +02:00
parent 7d56fc368f
commit 56ac50f465
10 changed files with 85 additions and 46 deletions
@@ -0,0 +1,26 @@
// ─── Equipment Types Data ───────────────────────────
// Combined equipment types from all category modules.
// Extracted to a standalone module to avoid circular dependencies
// between index.ts and utils.ts.
import { ACCESSORIES_EQUIPMENT } from './accessories';
import { BODY_EQUIPMENT } from './body';
import { CASTER_EQUIPMENT } from './casters';
import { CATALYST_EQUIPMENT } from './catalysts';
import { FEET_EQUIPMENT } from './feet';
import { HANDS_EQUIPMENT } from './hands';
import { HEAD_EQUIPMENT } from './head';
import { SHIELD_EQUIPMENT } from './shields';
import { SWORD_EQUIPMENT } from './swords';
export const EQUIPMENT_TYPES = {
...ACCESSORIES_EQUIPMENT,
...BODY_EQUIPMENT,
...CASTER_EQUIPMENT,
...CATALYST_EQUIPMENT,
...FEET_EQUIPMENT,
...HANDS_EQUIPMENT,
...HEAD_EQUIPMENT,
...SHIELD_EQUIPMENT,
...SWORD_EQUIPMENT,
};
+20 -30
View File
@@ -2,40 +2,19 @@
// Re-exports from all equipment type modules
// Re-export types
export type {
EquipmentSlot,
EquipmentCategory,
EquipmentType
export type {
EquipmentSlot,
EquipmentCategory,
EquipmentType
} from './types';
export {
EQUIPMENT_SLOTS,
SLOT_NAMES
export {
EQUIPMENT_SLOTS,
SLOT_NAMES
} from './types';
// Import all equipment type groups
import { ACCESSORIES_EQUIPMENT } from './accessories';
import { BODY_EQUIPMENT } from './body';
import { CASTER_EQUIPMENT } from './casters';
import { CATALYST_EQUIPMENT } from './catalysts';
import { FEET_EQUIPMENT } from './feet';
import { HANDS_EQUIPMENT } from './hands';
import { HEAD_EQUIPMENT } from './head';
import { SHIELD_EQUIPMENT } from './shields';
import { SWORD_EQUIPMENT } from './swords';
// Combine all equipment types into EQUIPMENT_TYPES
export const EQUIPMENT_TYPES = {
...ACCESSORIES_EQUIPMENT,
...BODY_EQUIPMENT,
...CASTER_EQUIPMENT,
...CATALYST_EQUIPMENT,
...FEET_EQUIPMENT,
...HANDS_EQUIPMENT,
...HEAD_EQUIPMENT,
...SHIELD_EQUIPMENT,
...SWORD_EQUIPMENT,
};
// Re-export combined equipment types data (extracted to avoid circular deps)
export { EQUIPMENT_TYPES } from './equipment-types-data';
// Re-export utility functions
export {
@@ -47,3 +26,14 @@ export {
getValidSlotsForEquipmentType,
canEquipInSlot,
} from './utils';
// Re-export individual equipment groups for direct access
export { ACCESSORIES_EQUIPMENT } from './accessories';
export { BODY_EQUIPMENT } from './body';
export { CASTER_EQUIPMENT } from './casters';
export { CATALYST_EQUIPMENT } from './catalysts';
export { FEET_EQUIPMENT } from './feet';
export { HANDS_EQUIPMENT } from './hands';
export { HEAD_EQUIPMENT } from './head';
export { SHIELD_EQUIPMENT } from './shields';
export { SWORD_EQUIPMENT } from './swords';
+1 -1
View File
@@ -1,7 +1,7 @@
// ─── Equipment Helper Functions ─────────────────────────
import type { EquipmentType, EquipmentSlot, EquipmentCategory } from './types';
import { EQUIPMENT_TYPES } from './index';
import { EQUIPMENT_TYPES } from './equipment-types-data';
export function getEquipmentType(id: string): EquipmentType | undefined {
return EQUIPMENT_TYPES[id];
+14
View File
@@ -0,0 +1,14 @@
// ─── Golem Definitions Data ─────────────────────────
// Combined golem definitions from all golem modules.
// Extracted to a standalone module to avoid circular dependencies
// between index.ts and utils.ts.
import { BASE_GOLEMS } from './base-golems';
import { ELEMENTAL_GOLEMS } from './elemental-golems';
import { HYBRID_GOLEMS } from './hybrid-golems';
export const GOLEMS_DEF = {
...BASE_GOLEMS,
...ELEMENTAL_GOLEMS,
...HYBRID_GOLEMS,
};
+2 -11
View File
@@ -4,17 +4,8 @@
// Re-export types
export type { GolemDef, GolemManaCost } from './types';
// Import all golem groups
import { BASE_GOLEMS } from './base-golems';
import { ELEMENTAL_GOLEMS } from './elemental-golems';
import { HYBRID_GOLEMS } from './hybrid-golems';
// Combine all golems into GOLEMS_DEF
export const GOLEMS_DEF = {
...BASE_GOLEMS,
...ELEMENTAL_GOLEMS,
...HYBRID_GOLEMS,
};
// Re-export combined golems data (extracted to avoid circular deps)
export { GOLEMS_DEF } from './golems-data';
// Re-export utility functions
export {
+1 -1
View File
@@ -1,7 +1,7 @@
// ─── Golem Helper Functions ─────────────────────────
import type { GolemDef, GolemManaCost } from './types';
import { GOLEMS_DEF } from './index';
import { GOLEMS_DEF } from './golems-data';
// Get golem slots based on Fabricator attunement level
// Level 2 = 1, Level 4 = 2, Level 6 = 3, Level 8 = 4, Level 10 = 5