Skip to content

Commit d32b0a1

Browse files
committed
refactor(entity): organize imports and clean up code
1 parent 1886fd0 commit d32b0a1

File tree

11 files changed

+28
-33
lines changed

11 files changed

+28
-33
lines changed

src/archetype.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { EntityId, RelationId, WildcardRelationId } from "./entity";
1+
import type { EntityId, WildcardRelationId } from "./entity";
22
import {
33
getComponentIdFromRelationId,
44
getDetailedIdType,

src/changeset.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from "bun:test";
2-
import { component } from "./entity";
32
import { ComponentChangeset } from "./changeset";
3+
import { component } from "./entity";
44

55
describe("ComponentChangeset", () => {
66
const PositionId = component<{ x: number; y: number }>();

src/entity.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
import { describe, expect, it } from "bun:test";
22
import type { ComponentId, EntityId } from "./entity";
33
import {
4+
component,
45
COMPONENT_ID_MAX,
56
ComponentIdAllocator,
67
createComponentId,
78
createEntityId,
8-
relation,
99
decodeRelationId,
1010
ENTITY_ID_START,
1111
EntityIdManager,
12+
getComponentIdByName,
13+
getComponentNameById,
14+
getComponentOptions,
1215
getDetailedIdType,
1316
getIdType,
1417
inspectEntityId,
1518
INVALID_COMPONENT_ID,
19+
isCascadeDeleteComponent,
1620
isComponentId,
21+
isDontFragmentComponent,
1722
isEntityId,
23+
isExclusiveComponent,
1824
isRelationId,
1925
isWildcardRelationId,
20-
component,
21-
getComponentOptions,
22-
isExclusiveComponent,
23-
isCascadeDeleteComponent,
24-
isDontFragmentComponent,
25-
getComponentNameById,
26-
getComponentIdByName,
26+
relation,
2727
} from "./entity";
2828

2929
describe("Entity ID System", () => {

src/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
// Entity ID types and utilities
44
export type {
5-
EntityId,
65
ComponentId,
7-
EntityRelationId,
6+
ComponentOptions,
87
ComponentRelationId,
9-
WildcardRelationId,
8+
EntityId,
9+
EntityRelationId,
1010
RelationId,
11-
ComponentOptions,
11+
WildcardRelationId,
1212
} from "./entity";
1313

1414
export {
1515
component,
16-
relation,
16+
decodeRelationId,
17+
getComponentIdByName,
18+
getComponentNameById,
1719
isComponentId,
1820
isEntityId,
1921
isRelationId,
2022
isWildcardRelationId,
21-
getComponentIdByName,
22-
getComponentNameById,
23-
decodeRelationId,
23+
relation,
2424
} from "./entity";
2525

2626
// World class
@@ -34,4 +34,4 @@ export { Query } from "./query";
3434
export type { System } from "./system";
3535

3636
// Type utilities
37-
export type { LifecycleHook, ComponentType, ComponentTuple } from "./types";
37+
export type { ComponentTuple, ComponentType, LifecycleHook } from "./types";

src/multi-map.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect, describe } from "bun:test";
1+
import { describe, expect, test } from "bun:test";
22
import { MultiMap } from "./multi-map";
33

44
describe("MultiMap", () => {

src/system-scheduler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from "bun:test";
2-
import { SystemScheduler } from "./system-scheduler";
32
import type { System } from "./system";
3+
import { SystemScheduler } from "./system-scheduler";
44

55
describe("SystemScheduler", () => {
66
it("should add systems correctly", () => {

src/system.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { World } from "./world";
2-
31
/**
42
* Base System interface
53
*/

src/world.perf.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { describe, it, expect } from "bun:test";
2-
import { World } from "./world";
1+
import { describe, expect, it } from "bun:test";
32
import { component } from "./entity";
3+
import { World } from "./world";
44

55
describe("World Performance", () => {
66
it("should handle archetype creation efficiently", () => {

src/world.serialize.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "bun:test";
2-
import { component, relation, createEntityId, type EntityId } from "./entity";
2+
import { component, relation, type EntityId } from "./entity";
33
import { World } from "./world";
44

55
describe("World serialization", () => {

src/world.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, it, mock } from "bun:test";
1+
import { describe, expect, it } from "bun:test";
22
import { component, createEntityId, relation, type EntityId } from "./entity";
33
import { World } from "./world";
44

0 commit comments

Comments
 (0)