diff --git a/packages/world/ts/config/v2/output.ts b/packages/world/ts/config/v2/output.ts index 0e1a816eee..72f2354019 100644 --- a/packages/world/ts/config/v2/output.ts +++ b/packages/world/ts/config/v2/output.ts @@ -80,15 +80,4 @@ export type World = Store & { readonly deploy: Deploy; /** Codegen config */ readonly codegen: Codegen; - - /** @internal */ - readonly internal: { - /** - * Whether or not the MUD project is using multiple namespaces. - * This is used to determine where to generate table libraries, find system contracts, etc. - * We use a separate boolean here because we may also populate a `namespaces` output key for single-namespace projects. - * @internal - */ - readonly multipleNamespaces: boolean; - }; }; diff --git a/packages/world/ts/config/v2/world.ts b/packages/world/ts/config/v2/world.ts index 1b01619eef..a04d90ed42 100644 --- a/packages/world/ts/config/v2/world.ts +++ b/packages/world/ts/config/v2/world.ts @@ -65,10 +65,10 @@ export type resolveWorld = evaluate< export function resolveWorld(world: world): resolveWorld { const scope = extendedScope(world); - const multipleNamespaces = world.namespaces != null; + const namespaces = world.namespaces ?? {}; const resolvedNamespacedTables = Object.fromEntries( - Object.entries(world.namespaces ?? {}) + Object.entries(namespaces) .map(([namespaceKey, namespace]) => Object.entries(namespace.tables ?? {}).map(([tableKey, table]) => { validateTable(table, scope); @@ -94,9 +94,6 @@ export function resolveWorld(world: world): reso systems: resolveSystems(world.systems ?? CONFIG_DEFAULTS.systems), excludeSystems: get(world, "excludeSystems"), modules, - internal: { - multipleNamespaces, - }, }, CONFIG_DEFAULTS, ) as never; diff --git a/packages/world/ts/config/v2/worldWithShorthands.ts b/packages/world/ts/config/v2/worldWithShorthands.ts index 0aa50846eb..948331da67 100644 --- a/packages/world/ts/config/v2/worldWithShorthands.ts +++ b/packages/world/ts/config/v2/worldWithShorthands.ts @@ -62,32 +62,17 @@ export function resolveWorldWithShorthands { const scope = extendedScope(world); + const tables = mapObject(world.tables ?? {}, (table) => { + return isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table; + }); + const namespaces = mapObject(world.namespaces ?? {}, (namespace) => ({ + ...namespace, + tables: mapObject(namespace.tables ?? {}, (table) => { + return isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table; + }), + })); - const fullConfig = { - ...world, - ...(world.tables - ? { - tables: mapObject(world.tables, (table) => - isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table, - ), - } - : null), - ...(world.namespaces - ? { - namespaces: mapObject(world.namespaces, (namespace) => ({ - ...namespace, - ...(namespace.tables - ? { - tables: mapObject(namespace.tables, (table) => - isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table, - ), - } - : null), - })), - } - : null), - }; - + const fullConfig = { ...world, tables, namespaces }; validateWorld(fullConfig); return resolveWorld(fullConfig) as never;