Skip to content

Commit

Permalink
Remove @module/documents.ts (foundryvtt#9813)
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam committed Sep 3, 2023
1 parent 225511c commit 9560977
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 47 deletions.
4 changes: 3 additions & 1 deletion build/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { ActorPF2e, ItemPF2e, MacroPF2e } from "@module/documents.ts";
import type { ActorPF2e } from "@actor";
import type { ItemPF2e } from "@item";
import type { MacroPF2e } from "@module/macro.ts";

type CompendiumDocumentPF2e = ActorPF2e | ItemPF2e<ActorPF2e | null> | JournalEntry | MacroPF2e | RollTable;
type PackEntry = CompendiumDocumentPF2e["_source"];
Expand Down
3 changes: 2 additions & 1 deletion src/global.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/// <reference types="vite/client" />

import type { ActorPF2e } from "@actor";
import type { AutomaticBonusProgression } from "@actor/character/automatic-bonus-progression.ts";
import type { ElementalBlast } from "@actor/character/elemental-blast.ts";
import type { FeatGroupOptions } from "@actor/character/feats.ts";
import type { CheckModifier, ModifierPF2e, ModifierType, StatisticModifier } from "@actor/modifiers.ts";
import type { ItemPF2e } from "@item";
import type { ConditionSource } from "@item/condition/data.ts";
import type { CoinsPF2e } from "@item/physical/helpers.ts";
import type { ActiveEffectPF2e } from "@module/active-effect.ts";
Expand All @@ -26,7 +28,6 @@ import type { CanvasPF2e, EffectsCanvasGroupPF2e } from "@module/canvas/index.ts
import type { StatusEffects } from "@module/canvas/status-effects.ts";
import type { ChatMessagePF2e } from "@module/chat-message/index.ts";
import type { ActorsPF2e } from "@module/collection/actors.ts";
import type { ActorPF2e, ItemPF2e } from "@module/documents.ts";
import type { MacroPF2e } from "@module/macro.ts";
import type { RuleElementPF2e, RuleElements } from "@module/rules/index.ts";
import type { UserPF2e } from "@module/user/index.ts";
Expand Down
3 changes: 2 additions & 1 deletion src/module/active-effect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ActorPF2e, ItemPF2e } from "./documents.ts";
import type { ActorPF2e } from "@actor";
import type { ItemPF2e } from "@item";

/** Disable Active Effects */
export class ActiveEffectPF2e<TParent extends ActorPF2e | ItemPF2e | null> extends ActiveEffect<TParent> {
Expand Down
3 changes: 2 additions & 1 deletion src/module/actor/actions/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ActorPF2e, ChatMessagePF2e } from "@module/documents.ts";
import type { ActorPF2e } from "@actor";
import type { ChatMessagePF2e } from "@module/chat-message/document.ts";

const ACTION_COST = ["free", "reaction", 1, 2, 3] as const;
type ActionCost = (typeof ACTION_COST)[number];
Expand Down
3 changes: 2 additions & 1 deletion src/module/actor/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ import { MAGIC_TRADITIONS } from "@item/spell/values.ts";
import { RitualSpellcasting } from "@item/spellcasting-entry/rituals.ts";
import type { ActiveEffectPF2e } from "@module/active-effect.ts";
import type { TokenPF2e } from "@module/canvas/index.ts";
import { ChatMessagePF2e } from "@module/chat-message/document.ts";
import { AppliedDamageFlag } from "@module/chat-message/index.ts";
import { Size } from "@module/data.ts";
import { preImportJSON } from "@module/doc-helpers.ts";
import { ChatMessagePF2e, type UserPF2e } from "@module/documents.ts";
import { CombatantPF2e, EncounterPF2e } from "@module/encounter/index.ts";
import { extractEphemeralEffects, processPreUpdateActorHooks } from "@module/rules/helpers.ts";
import { RuleElementSynthetics } from "@module/rules/index.ts";
import { RuleElementPF2e } from "@module/rules/rule-element/base.ts";
import { RollOptionRuleElement } from "@module/rules/rule-element/roll-option.ts";
import type { UserPF2e } from "@module/user/document.ts";
import type { ScenePF2e } from "@scene/document.ts";
import { TokenDocumentPF2e } from "@scene/token-document/document.ts";
import { IWRApplicationData, applyIWR } from "@system/damage/iwr.ts";
Expand Down
3 changes: 2 additions & 1 deletion src/module/actor/character/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { ActorPF2e } from "@actor";
import { AttackTraitHelpers } from "@actor/creature/helpers.ts";
import { ModifierPF2e } from "@actor/modifiers.ts";
import { AbilityItemPF2e, ArmorPF2e, ConditionPF2e, WeaponPF2e } from "@item";
import { ItemCarryType } from "@item/physical/index.ts";
import { toggleWeaponTrait } from "@item/weapon/helpers.ts";
import { ChatMessagePF2e } from "@module/chat-message/document.ts";
import { ZeroToThree, ZeroToTwo } from "@module/data.ts";
import { ActorPF2e, ChatMessagePF2e } from "@module/documents.ts";
import { extractModifierAdjustments } from "@module/rules/helpers.ts";
import { SheetOptions, createSheetOptions } from "@module/sheet/helpers.ts";
import { DAMAGE_DIE_FACES } from "@system/damage/values.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/module/actor/character/sheet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ActorPF2e } from "@actor";
import { SkillAbbreviation } from "@actor/creature/data.ts";
import { CreatureSheetData } from "@actor/creature/index.ts";
import { isReallyPC } from "@actor/helpers.ts";
Expand Down Expand Up @@ -26,7 +27,6 @@ import { BaseWeaponType, WeaponGroup } from "@item/weapon/types.ts";
import { WEAPON_CATEGORIES } from "@item/weapon/values.ts";
import { DropCanvasItemDataPF2e } from "@module/canvas/drop-canvas-data.ts";
import { PROFICIENCY_RANKS } from "@module/data.ts";
import { ActorPF2e } from "@module/documents.ts";
import { MigrationList, MigrationRunner } from "@module/migration/index.ts";
import { SheetOptions, createSheetTags } from "@module/sheet/helpers.ts";
import { eventToRollParams } from "@scripts/sheet-util.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/module/actor/initiative.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ActorPF2e } from "@actor";
import { createPonderousPenalty } from "@actor/character/helpers.ts";
import { InitiativeData } from "@actor/data/base.ts";
import { ActorPF2e } from "@module/documents.ts";
import { CombatantPF2e, EncounterPF2e } from "@module/encounter/index.ts";
import { CheckRoll } from "@system/check/index.ts";
import { Statistic, StatisticData, StatisticRollParameters, StatisticTraceData } from "@system/statistic/index.ts";
Expand Down
3 changes: 2 additions & 1 deletion src/module/actor/item-transfer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { PhysicalItemPF2e } from "@item";
import type { ActorPF2e, UserPF2e } from "@module/documents.ts";
import type { UserPF2e } from "@module/user/document.ts";
import { SocketMessage } from "@scripts/socket.ts";
import { ErrorPF2e, getActionGlyph, localizer } from "@util";
import type { ActorPF2e } from "./base.ts";
import { TraitViewData } from "./data/base.ts";

export interface ItemTransferData {
Expand Down
5 changes: 3 additions & 2 deletions src/module/actor/loot/document.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { ActorPF2e } from "@actor";
import type { ItemPF2e } from "@item";
import { ItemType } from "@item/data/index.ts";
import { PhysicalItemPF2e } from "@item/physical/document.ts";
import { CoinsPF2e } from "@item/physical/helpers.ts";
import { ActiveEffectPF2e } from "@module/active-effect.ts";
import { ActorPF2e, ItemPF2e } from "@module/documents.ts";
import { UserPF2e } from "@module/user/document.ts";
import { ScenePF2e, TokenDocumentPF2e } from "@scene/index.ts";
import type { ScenePF2e, TokenDocumentPF2e } from "@scene/index.ts";
import { ErrorPF2e } from "@util";
import { LootSource, LootSystemData } from "./data.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/module/actor/loot/sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LootNPCsPopup } from "../sheet/loot/loot-npcs-popup.ts";
import { DropCanvasItemDataPF2e } from "@module/canvas/drop-canvas-data.ts";
import { ActorSheetDataPF2e } from "@actor/sheet/data-types.ts";
import { ItemPF2e } from "@item";
import { ActorPF2e } from "@module/documents.ts";
import type { ActorPF2e } from "@actor";

export class LootSheetPF2e<TActor extends LootPF2e> extends ActorSheetPF2e<TActor> {
static override get defaultOptions(): ActorSheetOptions {
Expand Down
14 changes: 7 additions & 7 deletions src/module/actor/party/document.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { ActorPF2e, CreaturePF2e } from "@actor";
import { ActorPF2e, type CreaturePF2e } from "@actor";
import { resetActors } from "@actor/helpers.ts";
import { ItemType } from "@item/data/index.ts";
import { UserPF2e } from "@module/documents.ts";
import { CombatantPF2e, EncounterPF2e } from "@module/encounter/index.ts";
import { TokenDocumentPF2e } from "@scene/index.ts";
import { Statistic } from "@system/statistic/index.ts";
import { RuleElementPF2e } from "@module/rules/index.ts";
import { RuleElementSchema } from "@module/rules/rule-element/data.ts";
import type { UserPF2e } from "@module/user/document.ts";
import type { TokenDocumentPF2e } from "@scene/index.ts";
import type { Statistic } from "@system/statistic/index.ts";
import { sortBy, tupleHasValue } from "@util";
import { DataModelValidationOptions } from "types/foundry/common/abstract/data.js";
import { MemberData, PartySource, PartySystemData } from "./data.ts";
import { InvalidCampaign } from "./invalid-campaign.ts";
import { Kingdom } from "./kingdom/index.ts";
import { PartySheetRenderOptions } from "./sheet.ts";
import { PartyCampaign, PartyUpdateContext } from "./types.ts";
import { resetActors } from "@actor/helpers.ts";
import { RuleElementPF2e } from "@module/rules/index.ts";
import { RuleElementSchema } from "@module/rules/rule-element/data.ts";

class PartyPF2e<TParent extends TokenDocumentPF2e | null = TokenDocumentPF2e | null> extends ActorPF2e<TParent> {
override armorClass = null;
Expand Down
5 changes: 3 additions & 2 deletions src/module/actor/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as ActorInstance from "@actor";
import type * as ActorInstance from "@actor";
import type { ActorPF2e } from "@actor";
import type { ItemPF2e } from "@item";
import { EffectTrait } from "@item/abstract-effect/index.ts";
import { ItemInstances } from "@item/types.ts";
import { TokenPF2e } from "@module/canvas/index.ts";
import { ActorPF2e, ItemPF2e } from "@module/documents.ts";
import { TokenDocumentPF2e } from "@scene/index.ts";
import { immunityTypes, resistanceTypes, weaknessTypes } from "@scripts/config/iwr.ts";
import { DamageRoll } from "@system/damage/roll.ts";
Expand Down
3 changes: 2 additions & 1 deletion src/module/data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ActorPF2e, ItemPF2e } from "@module/documents.ts";
import type { ActorPF2e } from "@actor";
import type { ItemPF2e } from "@item";

/** The size property of creatures and equipment */
const SIZES = ["tiny", "sm", "med", "lg", "huge", "grg"] as const;
Expand Down
12 changes: 0 additions & 12 deletions src/module/documents.ts

This file was deleted.

4 changes: 3 additions & 1 deletion src/module/item/abstract-effect/document.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ActorPF2e } from "@actor";
import { ItemPF2e } from "@item";
import { AfflictionSource, AfflictionSystemData } from "@item/affliction/data.ts";
import { ConditionSource, ConditionSystemData } from "@item/condition/data.ts";
import { EffectSource, EffectSystemData } from "@item/effect/data.ts";
import { ShowFloatyEffectParams } from "@module/canvas/token/object.ts";
import { ActorPF2e, ItemPF2e, UserPF2e } from "@module/documents.ts";
import { TokenDocumentPF2e } from "@scene/index.ts";
import { ErrorPF2e, sluggify } from "@util";
import { EffectBadge } from "./data.ts";
import type { UserPF2e } from "@module/user/document.ts";

/** Base effect type for all PF2e effects including conditions and afflictions */
abstract class AbstractEffectPF2e<TParent extends ActorPF2e | null = ActorPF2e | null> extends ItemPF2e<TParent> {
Expand Down
4 changes: 2 additions & 2 deletions src/module/item/equipment/document.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ActorPF2e } from "@actor";
import type { ActorPF2e } from "@actor";
import { ItemSummaryData } from "@item/data/index.ts";
import { PhysicalItemPF2e } from "@item/physical/index.ts";
import { UserPF2e } from "@module/documents.ts";
import type { UserPF2e } from "@module/user/document.ts";
import { objectHasKey } from "@util";
import { EquipmentSource, EquipmentSystemData, EquipmentTrait } from "./data.ts";
import { OtherEquipmentTag } from "./types.ts";
Expand Down
4 changes: 2 additions & 2 deletions src/module/item/melee/document.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ActorPF2e } from "@actor";
import type { ActorPF2e } from "@actor";
import { SIZE_TO_REACH } from "@actor/creature/values.ts";
import { ItemPF2e, WeaponPF2e } from "@item";
import { RangeData } from "@item/types.ts";
import { BaseWeaponType, WeaponCategory, WeaponGroup } from "@item/weapon/types.ts";
import { ChatMessagePF2e } from "@module/documents.ts";
import type { ChatMessagePF2e } from "@module/chat-message/document.ts";
import { simplifyFormula } from "@scripts/dice.ts";
import { DamageCategorization } from "@system/damage/helpers.ts";
import { ConvertedNPCDamage, WeaponDamagePF2e } from "@system/damage/weapon.ts";
Expand Down
3 changes: 2 additions & 1 deletion src/module/rules/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ActorPF2e } from "@actor";
import {
DamageDicePF2e,
DeferredValueParams,
Expand All @@ -6,8 +7,8 @@ import {
StatisticModifier,
TestableDeferredValueParams,
} from "@actor/modifiers.ts";
import { ItemPF2e } from "@item";
import { ConditionSource, EffectSource, ItemSourcePF2e } from "@item/data/index.ts";
import { ActorPF2e, ItemPF2e } from "@module/documents.ts";
import { RollNotePF2e } from "@module/notes.ts";
import { DegreeOfSuccessAdjustment } from "@system/degree-of-success.ts";
import { RollTwiceOption } from "@system/rolls.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/module/rules/rule-element/item-alteration/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ItemPF2e } from "@item";
import type { ItemSourcePF2e, ItemType } from "@item/data/index.ts";
import { itemIsOfType } from "@item/helpers.ts";
import { PHYSICAL_ITEM_TYPES } from "@item/physical/values.ts";
import { RARITIES } from "@module/data.ts";
import { ItemPF2e } from "@module/documents.ts";
import { DamageRoll } from "@system/damage/roll.ts";
import type { DamageType } from "@system/damage/types.ts";
import type { DataField, DataFieldOptions, NumberField, StringField } from "types/foundry/common/data/fields.d.ts";
Expand Down
6 changes: 3 additions & 3 deletions src/module/scene/measured-template-document.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ActorPF2e } from "@actor";
import type { ActorPF2e } from "@actor";
import { ItemPF2e } from "@item";
import { MeasuredTemplatePF2e } from "@module/canvas/measured-template.ts";
import type { MeasuredTemplatePF2e } from "@module/canvas/measured-template.ts";
import { ItemOriginFlag } from "@module/chat-message/data.ts";
import type { ChatMessagePF2e } from "@module/chat-message/document.ts";
import { toggleClearTemplatesButton } from "@module/chat-message/helpers.ts";
import { ChatMessagePF2e } from "@module/documents.ts";
import { ScenePF2e } from "./document.ts";

export class MeasuredTemplateDocumentPF2e<
Expand Down
5 changes: 4 additions & 1 deletion tests/mocks/actor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type { ActorPF2e } from "@actor";
import { ActorSystemSource } from "@actor/data/base.ts";
import { ActorSourcePF2e } from "@actor/data/index.ts";
import type { ItemPF2e } from "@item";
import { ItemSourcePF2e } from "@item/data/index.ts";
import type { ActiveEffectPF2e, ActorPF2e, ItemPF2e, ScenePF2e } from "@module/documents.ts";
import type { ActiveEffectPF2e } from "@module/active-effect.ts";
import type { ScenePF2e } from "@scene";
import type { TokenDocumentPF2e } from "@scene/token-document/document.ts";
import { MockCollection } from "./collection.ts";
import { MockItem } from "./item.ts";
Expand Down
3 changes: 2 additions & 1 deletion tests/mocks/collection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ActorPF2e, ItemPF2e } from "@module/documents.ts";
import type { ActorPF2e } from "@actor";
import type { ItemPF2e } from "@item";
import { MockActor } from "./actor.ts";
import { MockItem } from "./item.ts";

Expand Down
3 changes: 2 additions & 1 deletion tests/mocks/token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ActorPF2e, ScenePF2e } from "@module/documents.ts";
import type { ActorPF2e } from "@actor";
import type { ScenePF2e } from "@scene";
import type { TokenDocumentPF2e } from "@scene/token-document/document.ts";

export class MockToken {
Expand Down

0 comments on commit 9560977

Please sign in to comment.