aboutsummaryrefslogtreecommitdiff
path: root/utils/index.ts
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-04-22 07:04:29 +0530
committerBobby <[email protected]>2026-04-22 07:04:29 +0530
commit9f0c3b0341d3ad29f3201d56fff5f19662a6f0b6 (patch)
treee53e1adb1a87b8a0faa4ee9a808155c21c0ab83c /utils/index.ts
parent4dfbf7a13120b3b64521fce6de7d5d3f76cd2084 (diff)
downloadhollowdark-9f0c3b0341d3ad29f3201d56fff5f19662a6f0b6.tar.xz
hollowdark-9f0c3b0341d3ad29f3201d56fff5f19662a6f0b6.zip
Use relative imports for same-directory siblings; split utils into folders
Two related cleanups landed together because they touch the same pattern: 1. Intra-module imports now use relative paths rather than the module's own path alias. rng/seeded.ts imports from './derive', not 'rng/derive'; time/gameTime.ts from './calendar', not 'time/calendar'; the utils barrel from './result' etc. This matches rules/01-code-style.md: "Relative imports only for same-directory siblings." The alias form is reserved for imports *between* modules — how external callers refer to a module's public surface. (The TS language server in the IDE had trouble resolving the self- aliased form even though svelte-check accepted it; this change removes the ambiguity.) 2. utils/ is now folder-per-concept. Each utility owns a directory with its files broken up into small pieces: utils/result/ types, constructors, predicates, map, unwrap utils/assert/ assert, assert-never, assert-defined utils/equal/ deep utils/types/ brand, deep-readonly, element-of, json, non-empty-array utils/log/ log utils/index.ts re-exports from each subfolder via the barrel. External callers import from 'utils' unchanged; internal references are relative. One reason to prefer folders over flat files here is headroom — when a concept grows, new files sit alongside their siblings inside the concept's folder rather than crowding the utils/ root. No API changes. All 128 tests still green.
Diffstat (limited to 'utils/index.ts')
-rw-r--r--utils/index.ts26
1 files changed, 5 insertions, 21 deletions
diff --git a/utils/index.ts b/utils/index.ts
index 4449e3e..436365f 100644
--- a/utils/index.ts
+++ b/utils/index.ts
@@ -1,21 +1,5 @@
-export {
- err,
- isErr,
- isOk,
- mapErr,
- mapResult,
- ok,
- unwrap,
- unwrapOr,
- type Err,
- type Ok,
- type Result
-} from 'utils/result'
-
-export { assert, assertDefined, assertNever } from 'utils/assert'
-
-export { deepEqual } from 'utils/equal'
-
-export type { Brand, DeepReadonly, ElementOf, JsonValue, NonEmptyArray } from 'utils/types'
-
-export { log } from 'utils/log'
+export * from './assert'
+export * from './equal'
+export * from './log'
+export * from './result'
+export * from './types'