@latticexyz/world 2.0.0-main-07e12ea2 → 2.0.0-main-20ffc95f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ type System = {
42
42
  type Systems = {
43
43
  readonly [key: string]: System;
44
44
  };
45
- type Deployment = {
45
+ type Deploy = {
46
46
  /** The name of a custom World contract to deploy. If no name is provided, a default MUD World is deployed */
47
47
  readonly customWorldContract: string | undefined;
48
48
  /**
@@ -69,8 +69,8 @@ type World = Store & {
69
69
  readonly excludeSystems: readonly string[];
70
70
  /** Modules to in the World */
71
71
  readonly modules: readonly Module[];
72
- /** Deployment config */
73
- readonly deployment: Deployment;
72
+ /** Deploy config */
73
+ readonly deploy: Deploy;
74
74
  /** Codegen config */
75
75
  readonly codegen: Codegen;
76
76
  };
@@ -94,7 +94,7 @@ type SystemInput = {
94
94
  type SystemsInput = {
95
95
  [key: string]: SystemInput;
96
96
  };
97
- type DeploymentInput = {
97
+ type DeployInput = {
98
98
  /**
99
99
  * Script to execute after the deployment is complete (Default "PostDeploy").
100
100
  * Script must be placed in the forge scripts directory (see foundry.toml) and have a ".s.sol" extension.
@@ -127,8 +127,8 @@ type WorldInput = evaluate<StoreInput & {
127
127
  excludeSystems?: string[];
128
128
  /** Modules to in the World */
129
129
  modules?: Module[];
130
- /** Deployment config */
131
- deployment?: DeploymentInput;
130
+ /** Deploy config */
131
+ deploy?: DeployInput;
132
132
  /** Codegen config */
133
133
  codegen?: CodegenInput;
134
134
  }>;
@@ -142,7 +142,7 @@ declare const CODEGEN_DEFAULTS: {
142
142
  readonly worldgenDirectory: "world";
143
143
  readonly worldImportPath: "@latticexyz/world/src/";
144
144
  };
145
- declare const DEPLOYMENT_DEFAULTS: {
145
+ declare const DEPLOY_DEFAULTS: {
146
146
  readonly customWorldContract: undefined;
147
147
  readonly postDeployScript: "PostDeploy";
148
148
  readonly deploysDirectory: "./deploys";
@@ -158,7 +158,7 @@ declare const CONFIG_DEFAULTS: {
158
158
  readonly worldgenDirectory: "world";
159
159
  readonly worldImportPath: "@latticexyz/world/src/";
160
160
  };
161
- readonly deployment: {
161
+ readonly deploy: {
162
162
  readonly customWorldContract: undefined;
163
163
  readonly postDeployScript: "PostDeploy";
164
164
  readonly deploysDirectory: "./deploys";
@@ -188,8 +188,8 @@ type resolveNamespacedTables<world> = "namespaces" extends keyof world ? {
188
188
  type resolveCodegen<codegen> = codegen extends {} ? mergeIfUndefined<codegen, typeof CODEGEN_DEFAULTS> : typeof CODEGEN_DEFAULTS;
189
189
  declare function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen>;
190
190
 
191
- type resolveDeployment<deployment> = deployment extends {} ? mergeIfUndefined<deployment, typeof DEPLOYMENT_DEFAULTS> : typeof DEPLOYMENT_DEFAULTS;
192
- declare function resolveDeployment<deployment>(deployment: deployment): resolveDeployment<deployment>;
191
+ type resolveDeploy<deploy> = deploy extends {} ? mergeIfUndefined<deploy, typeof DEPLOY_DEFAULTS> : typeof DEPLOY_DEFAULTS;
192
+ declare function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy>;
193
193
 
194
194
  type validateWorld<world> = {
195
195
  readonly [key in keyof world]: key extends "tables" ? validateTables<world[key], extendedScope<world>> : key extends "userTypes" ? UserTypes : key extends "enums" ? narrow<world[key]> : key extends "namespaces" ? validateNamespaces<world[key], extendedScope<world>> : key extends keyof WorldInput ? conform<world[key], WorldInput[key]> : world[key];
@@ -198,9 +198,9 @@ declare function validateWorld(world: unknown): asserts world is WorldInput;
198
198
  type resolveWorld<world> = evaluate<resolveStore<world> & mergeIfUndefined<{
199
199
  tables: resolveNamespacedTables<world>;
200
200
  } & Omit<{
201
- [key in keyof world]: key extends "systems" ? resolveSystems<world[key] & SystemsInput> : key extends "deployment" ? resolveDeployment<world[key]> : key extends "codegen" ? resolveCodegen<world[key]> : world[key];
201
+ [key in keyof world]: key extends "systems" ? resolveSystems<world[key] & SystemsInput> : key extends "deploy" ? resolveDeploy<world[key]> : key extends "codegen" ? resolveCodegen<world[key]> : world[key];
202
202
  }, "namespaces" | keyof Store>, typeof CONFIG_DEFAULTS>>;
203
203
  declare function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world>;
204
204
  declare function defineWorld<const world>(world: validateWorld<world>): resolveWorld<world>;
205
205
 
206
- export { Codegen, Deployment, Module, System, Systems, World, defineWorld, resolveWorld, validateWorld };
206
+ export { Codegen, Deploy, Module, System, Systems, World, defineWorld, resolveWorld, validateWorld };
@@ -1,2 +1,2 @@
1
- import{a as y}from"../../../chunk-RF4HOV37.js";import{extendedScope as v,get as I,resolveTable as U,validateTable as b,mergeIfUndefined as l,validateTables as O,resolveStore as F,hasOwnKey as S,validateStore as L,isObject as N}from"@latticexyz/store/config/v2";var t={worldInterfaceName:"IWorld",worldgenDirectory:"world",worldImportPath:"@latticexyz/world/src/"},r={customWorldContract:void 0,postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json"},d={systems:{},tables:{},excludeSystems:[],modules:[],codegen:t,deployment:r};import{mapObject as E}from"@latticexyz/common/utils";import{mergeIfUndefined as T}from"@latticexyz/store/config/v2";function c(e){return E(e,o=>T(o,y))}import{isObject as D,mergeIfUndefined as g}from"@latticexyz/store/config/v2";function i(e){return D(e)?g(e,t):t}import{mergeIfUndefined as k,isObject as w}from"@latticexyz/store/config/v2";function f(e){return w(e)?k(e,r):r}function W(e){let o=v(e);if(L(e),S(e,"namespaces")){if(!N(e.namespaces))throw new Error(`Expected namespaces, received ${JSON.stringify(e.namespaces)}`);for(let s of Object.values(e.namespaces))S(s,"tables")&&O(s.tables,o)}}function _(e){let o=v(e),s=e.namespaces??{},u=Object.fromEntries(Object.entries(s).map(([m,x])=>Object.entries(x.tables).map(([p,a])=>(b(a,o),[`${m}__${p}`,U(l(a,{namespace:m,name:p}),o)]))).flat()),n=F(e);return l({...n,tables:{...n.tables,...u},codegen:l(n.codegen,i(e.codegen)),deployment:f(e.deployment),systems:c(e.systems??d.systems),excludeSystems:I(e,"excludeSystems"),modules:e.modules},d)}function Z(e){return W(e),_(e)}export{Z as defineWorld,_ as resolveWorld,W as validateWorld};
1
+ import{a as y}from"../../../chunk-RF4HOV37.js";import{extendedScope as v,get as I,resolveTable as U,validateTable as b,mergeIfUndefined as l,validateTables as O,resolveStore as F,hasOwnKey as S,validateStore as L,isObject as W}from"@latticexyz/store/config/v2";var t={worldInterfaceName:"IWorld",worldgenDirectory:"world",worldImportPath:"@latticexyz/world/src/"},r={customWorldContract:void 0,postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json"},d={systems:{},tables:{},excludeSystems:[],modules:[],codegen:t,deploy:r};import{mapObject as D}from"@latticexyz/common/utils";import{mergeIfUndefined as E}from"@latticexyz/store/config/v2";function c(e){return D(e,o=>E(o,y))}import{isObject as g,mergeIfUndefined as T}from"@latticexyz/store/config/v2";function i(e){return g(e)?T(e,t):t}import{mergeIfUndefined as k,isObject as w}from"@latticexyz/store/config/v2";function f(e){return w(e)?k(e,r):r}function _(e){let o=v(e);if(L(e),S(e,"namespaces")){if(!W(e.namespaces))throw new Error(`Expected namespaces, received ${JSON.stringify(e.namespaces)}`);for(let s of Object.values(e.namespaces))S(s,"tables")&&O(s.tables,o)}}function A(e){let o=v(e),s=e.namespaces??{},u=Object.fromEntries(Object.entries(s).map(([p,x])=>Object.entries(x.tables??{}).map(([m,a])=>(b(a,o),[`${p}__${m}`,U(l(a,{namespace:p,name:m}),o)]))).flat()),n=F(e);return l({...n,tables:{...n.tables,...u},codegen:l(n.codegen,i(e.codegen)),deploy:f(e.deploy),systems:c(e.systems??d.systems),excludeSystems:I(e,"excludeSystems"),modules:e.modules},d)}function Z(e){return _(e),A(e)}export{Z as defineWorld,A as resolveWorld,_ as validateWorld};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../ts/config/v2/world.ts","../../../../ts/config/v2/defaults.ts","../../../../ts/config/v2/systems.ts","../../../../ts/config/v2/codegen.ts","../../../../ts/config/v2/deployment.ts"],"sourcesContent":["import { conform, evaluate, narrow } from \"@arktype/util\";\nimport {\n UserTypes,\n extendedScope,\n get,\n resolveTable,\n validateTable,\n mergeIfUndefined,\n validateTables,\n resolveStore,\n Store,\n hasOwnKey,\n validateStore,\n isObject,\n} from \"@latticexyz/store/config/v2\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS } from \"./defaults\";\nimport { Tables } from \"@latticexyz/store\";\nimport { resolveSystems } from \"./systems\";\nimport { resolveNamespacedTables, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeployment } from \"./deployment\";\n\nexport type validateWorld<world> = {\n readonly [key in keyof world]: key extends \"tables\"\n ? validateTables<world[key], extendedScope<world>>\n : key extends \"userTypes\"\n ? UserTypes\n : key extends \"enums\"\n ? narrow<world[key]>\n : key extends \"namespaces\"\n ? validateNamespaces<world[key], extendedScope<world>>\n : key extends keyof WorldInput\n ? conform<world[key], WorldInput[key]>\n : world[key];\n};\n\nexport function validateWorld(world: unknown): asserts world is WorldInput {\n const scope = extendedScope(world);\n validateStore(world);\n\n if (hasOwnKey(world, \"namespaces\")) {\n if (!isObject(world.namespaces)) {\n throw new Error(`Expected namespaces, received ${JSON.stringify(world.namespaces)}`);\n }\n for (const namespace of Object.values(world.namespaces)) {\n if (hasOwnKey(namespace, \"tables\")) {\n validateTables(namespace.tables, scope);\n }\n }\n }\n}\n\nexport type resolveWorld<world> = evaluate<\n resolveStore<world> &\n mergeIfUndefined<\n { tables: resolveNamespacedTables<world> } & Omit<\n {\n [key in keyof world]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput>\n : key extends \"deployment\"\n ? resolveDeployment<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n \"namespaces\" | keyof Store\n >,\n typeof CONFIG_DEFAULTS\n >\n>;\n\nexport function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world> {\n const scope = extendedScope(world);\n const namespaces = world.namespaces ?? {};\n\n const resolvedNamespacedTables = Object.fromEntries(\n Object.entries(namespaces)\n .map(([namespaceKey, namespace]) =>\n Object.entries(namespace.tables).map(([tableKey, table]) => {\n validateTable(table, scope);\n return [\n `${namespaceKey}__${tableKey}`,\n resolveTable(mergeIfUndefined(table, { namespace: namespaceKey, name: tableKey }), scope),\n ];\n }),\n )\n .flat(),\n ) as Tables;\n\n const resolvedStore = resolveStore(world);\n\n return mergeIfUndefined(\n {\n ...resolvedStore,\n tables: { ...resolvedStore.tables, ...resolvedNamespacedTables },\n codegen: mergeIfUndefined(resolvedStore.codegen, resolveCodegen(world.codegen)),\n deployment: resolveDeployment(world.deployment),\n systems: resolveSystems(world.systems ?? CONFIG_DEFAULTS.systems),\n excludeSystems: get(world, \"excludeSystems\"),\n modules: world.modules,\n },\n CONFIG_DEFAULTS,\n ) as unknown as resolveWorld<world>;\n}\n\nexport function defineWorld<const world>(world: validateWorld<world>): resolveWorld<world> {\n validateWorld(world);\n return resolveWorld(world) as unknown as resolveWorld<world>;\n}\n","export const SYSTEM_DEFAULTS = {\n registerFunctionSelectors: true,\n openAccess: true,\n accessList: [] as string[],\n} as const;\n\nexport const CODEGEN_DEFAULTS = {\n worldInterfaceName: \"IWorld\",\n worldgenDirectory: \"world\",\n worldImportPath: \"@latticexyz/world/src/\",\n} as const;\n\nexport const DEPLOYMENT_DEFAULTS = {\n customWorldContract: undefined,\n postDeployScript: \"PostDeploy\",\n deploysDirectory: \"./deploys\",\n worldsFile: \"./worlds.json\",\n} as const;\n\nexport const CONFIG_DEFAULTS = {\n systems: {},\n tables: {},\n excludeSystems: [] as string[],\n modules: [],\n codegen: CODEGEN_DEFAULTS,\n deployment: DEPLOYMENT_DEFAULTS,\n} as const;\n","import { mapObject } from \"@latticexyz/common/utils\";\nimport { SYSTEM_DEFAULTS } from \"../defaults\";\nimport { SystemsInput } from \"./input\";\nimport { mergeIfUndefined } from \"@latticexyz/store/config/v2\";\n\nexport type resolveSystems<systems extends SystemsInput> = {\n [system in keyof systems]: mergeIfUndefined<systems[system], typeof SYSTEM_DEFAULTS>;\n};\n\nexport function resolveSystems<systems extends SystemsInput>(systems: systems): resolveSystems<systems> {\n return mapObject(systems, (system) => mergeIfUndefined(system, SYSTEM_DEFAULTS));\n}\n","import { isObject, mergeIfUndefined } from \"@latticexyz/store/config/v2\";\nimport { CODEGEN_DEFAULTS } from \"./defaults\";\n\nexport type resolveCodegen<codegen> = codegen extends {}\n ? mergeIfUndefined<codegen, typeof CODEGEN_DEFAULTS>\n : typeof CODEGEN_DEFAULTS;\n\nexport function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen> {\n return (\n isObject(codegen) ? mergeIfUndefined(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS\n ) as resolveCodegen<codegen>;\n}\n","import { mergeIfUndefined, isObject } from \"@latticexyz/store/config/v2\";\nimport { DEPLOYMENT_DEFAULTS } from \"./defaults\";\n\nexport type resolveDeployment<deployment> = deployment extends {}\n ? mergeIfUndefined<deployment, typeof DEPLOYMENT_DEFAULTS>\n : typeof DEPLOYMENT_DEFAULTS;\n\nexport function resolveDeployment<deployment>(deployment: deployment): resolveDeployment<deployment> {\n return (\n isObject(deployment) ? mergeIfUndefined(deployment, DEPLOYMENT_DEFAULTS) : DEPLOYMENT_DEFAULTS\n ) as resolveDeployment<deployment>;\n}\n"],"mappings":"+CACA,OAEE,iBAAAA,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,gBAAAC,EAEA,aAAAC,EACA,iBAAAC,EACA,YAAAC,MACK,8BCRA,IAAMC,EAAmB,CAC9B,mBAAoB,SACpB,kBAAmB,QACnB,gBAAiB,wBACnB,EAEaC,EAAsB,CACjC,oBAAqB,OACrB,iBAAkB,aAClB,iBAAkB,YAClB,WAAY,eACd,EAEaC,EAAkB,CAC7B,QAAS,CAAC,EACV,OAAQ,CAAC,EACT,eAAgB,CAAC,EACjB,QAAS,CAAC,EACV,QAASF,EACT,WAAYC,CACd,EC1BA,OAAS,aAAAE,MAAiB,2BAG1B,OAAS,oBAAAC,MAAwB,8BAM1B,SAASC,EAA6CC,EAA2C,CACtG,OAAOC,EAAUD,EAAUE,GAAWJ,EAAiBI,EAAQC,CAAe,CAAC,CACjF,CCXA,OAAS,YAAAC,EAAU,oBAAAC,MAAwB,8BAOpC,SAASC,EAAwBC,EAA2C,CACjF,OACEC,EAASD,CAAO,EAAIE,EAAiBF,EAASG,CAAgB,EAAIA,CAEtE,CCXA,OAAS,oBAAAC,EAAkB,YAAAC,MAAgB,8BAOpC,SAASC,EAA8BC,EAAuD,CACnG,OACEC,EAASD,CAAU,EAAIE,EAAiBF,EAAYG,CAAmB,EAAIA,CAE/E,CJ0BO,SAASC,EAAcC,EAA6C,CACzE,IAAMC,EAAQC,EAAcF,CAAK,EAGjC,GAFAG,EAAcH,CAAK,EAEfI,EAAUJ,EAAO,YAAY,EAAG,CAClC,GAAI,CAACK,EAASL,EAAM,UAAU,EAC5B,MAAM,IAAI,MAAM,iCAAiC,KAAK,UAAUA,EAAM,UAAU,GAAG,EAErF,QAAWM,KAAa,OAAO,OAAON,EAAM,UAAU,EAChDI,EAAUE,EAAW,QAAQ,GAC/BC,EAAeD,EAAU,OAAQL,CAAK,EAI9C,CAqBO,SAASO,EAA6CR,EAAmC,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAC3BS,EAAaT,EAAM,YAAc,CAAC,EAElCU,EAA2B,OAAO,YACtC,OAAO,QAAQD,CAAU,EACtB,IAAI,CAAC,CAACE,EAAcL,CAAS,IAC5B,OAAO,QAAQA,EAAU,MAAM,EAAE,IAAI,CAAC,CAACM,EAAUC,CAAK,KACpDC,EAAcD,EAAOZ,CAAK,EACnB,CACL,GAAGU,MAAiBC,IACpBG,EAAaC,EAAiBH,EAAO,CAAE,UAAWF,EAAc,KAAMC,CAAS,CAAC,EAAGX,CAAK,CAC1F,EACD,CACH,EACC,KAAK,CACV,EAEMgB,EAAgBC,EAAalB,CAAK,EAExC,OAAOgB,EACL,CACE,GAAGC,EACH,OAAQ,CAAE,GAAGA,EAAc,OAAQ,GAAGP,CAAyB,EAC/D,QAASM,EAAiBC,EAAc,QAASE,EAAenB,EAAM,OAAO,CAAC,EAC9E,WAAYoB,EAAkBpB,EAAM,UAAU,EAC9C,QAASqB,EAAerB,EAAM,SAAWsB,EAAgB,OAAO,EAChE,eAAgBC,EAAIvB,EAAO,gBAAgB,EAC3C,QAASA,EAAM,OACjB,EACAsB,CACF,CACF,CAEO,SAASE,EAAyBxB,EAAkD,CACzF,OAAAD,EAAcC,CAAK,EACZQ,EAAaR,CAAK,CAC3B","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","validateTables","resolveStore","hasOwnKey","validateStore","isObject","CODEGEN_DEFAULTS","DEPLOYMENT_DEFAULTS","CONFIG_DEFAULTS","mapObject","mergeIfUndefined","resolveSystems","systems","mapObject","system","SYSTEM_DEFAULTS","isObject","mergeIfUndefined","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","mergeIfUndefined","isObject","resolveDeployment","deployment","isObject","mergeIfUndefined","DEPLOYMENT_DEFAULTS","validateWorld","world","scope","extendedScope","validateStore","hasOwnKey","isObject","namespace","validateTables","resolveWorld","namespaces","resolvedNamespacedTables","namespaceKey","tableKey","table","validateTable","resolveTable","mergeIfUndefined","resolvedStore","resolveStore","resolveCodegen","resolveDeployment","resolveSystems","CONFIG_DEFAULTS","get","defineWorld"]}
1
+ {"version":3,"sources":["../../../../ts/config/v2/world.ts","../../../../ts/config/v2/defaults.ts","../../../../ts/config/v2/systems.ts","../../../../ts/config/v2/codegen.ts","../../../../ts/config/v2/deploy.ts"],"sourcesContent":["import { conform, evaluate, narrow } from \"@arktype/util\";\nimport {\n UserTypes,\n extendedScope,\n get,\n resolveTable,\n validateTable,\n mergeIfUndefined,\n validateTables,\n resolveStore,\n Store,\n hasOwnKey,\n validateStore,\n isObject,\n} from \"@latticexyz/store/config/v2\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS } from \"./defaults\";\nimport { Tables } from \"@latticexyz/store\";\nimport { resolveSystems } from \"./systems\";\nimport { resolveNamespacedTables, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\n\nexport type validateWorld<world> = {\n readonly [key in keyof world]: key extends \"tables\"\n ? validateTables<world[key], extendedScope<world>>\n : key extends \"userTypes\"\n ? UserTypes\n : key extends \"enums\"\n ? narrow<world[key]>\n : key extends \"namespaces\"\n ? validateNamespaces<world[key], extendedScope<world>>\n : key extends keyof WorldInput\n ? conform<world[key], WorldInput[key]>\n : world[key];\n};\n\nexport function validateWorld(world: unknown): asserts world is WorldInput {\n const scope = extendedScope(world);\n validateStore(world);\n\n if (hasOwnKey(world, \"namespaces\")) {\n if (!isObject(world.namespaces)) {\n throw new Error(`Expected namespaces, received ${JSON.stringify(world.namespaces)}`);\n }\n for (const namespace of Object.values(world.namespaces)) {\n if (hasOwnKey(namespace, \"tables\")) {\n validateTables(namespace.tables, scope);\n }\n }\n }\n}\n\nexport type resolveWorld<world> = evaluate<\n resolveStore<world> &\n mergeIfUndefined<\n { tables: resolveNamespacedTables<world> } & Omit<\n {\n [key in keyof world]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput>\n : key extends \"deploy\"\n ? resolveDeploy<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n \"namespaces\" | keyof Store\n >,\n typeof CONFIG_DEFAULTS\n >\n>;\n\nexport function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world> {\n const scope = extendedScope(world);\n const namespaces = world.namespaces ?? {};\n\n const resolvedNamespacedTables = Object.fromEntries(\n Object.entries(namespaces)\n .map(([namespaceKey, namespace]) =>\n Object.entries(namespace.tables ?? {}).map(([tableKey, table]) => {\n validateTable(table, scope);\n return [\n `${namespaceKey}__${tableKey}`,\n resolveTable(mergeIfUndefined(table, { namespace: namespaceKey, name: tableKey }), scope),\n ];\n }),\n )\n .flat(),\n ) as Tables;\n\n const resolvedStore = resolveStore(world);\n\n return mergeIfUndefined(\n {\n ...resolvedStore,\n tables: { ...resolvedStore.tables, ...resolvedNamespacedTables },\n codegen: mergeIfUndefined(resolvedStore.codegen, resolveCodegen(world.codegen)),\n deploy: resolveDeploy(world.deploy),\n systems: resolveSystems(world.systems ?? CONFIG_DEFAULTS.systems),\n excludeSystems: get(world, \"excludeSystems\"),\n modules: world.modules,\n },\n CONFIG_DEFAULTS,\n ) as unknown as resolveWorld<world>;\n}\n\nexport function defineWorld<const world>(world: validateWorld<world>): resolveWorld<world> {\n validateWorld(world);\n return resolveWorld(world) as unknown as resolveWorld<world>;\n}\n","export const SYSTEM_DEFAULTS = {\n registerFunctionSelectors: true,\n openAccess: true,\n accessList: [] as string[],\n} as const;\n\nexport const CODEGEN_DEFAULTS = {\n worldInterfaceName: \"IWorld\",\n worldgenDirectory: \"world\",\n worldImportPath: \"@latticexyz/world/src/\",\n} as const;\n\nexport const DEPLOY_DEFAULTS = {\n customWorldContract: undefined,\n postDeployScript: \"PostDeploy\",\n deploysDirectory: \"./deploys\",\n worldsFile: \"./worlds.json\",\n} as const;\n\nexport const CONFIG_DEFAULTS = {\n systems: {},\n tables: {},\n excludeSystems: [] as string[],\n modules: [],\n codegen: CODEGEN_DEFAULTS,\n deploy: DEPLOY_DEFAULTS,\n} as const;\n","import { mapObject } from \"@latticexyz/common/utils\";\nimport { SYSTEM_DEFAULTS } from \"../defaults\";\nimport { SystemsInput } from \"./input\";\nimport { mergeIfUndefined } from \"@latticexyz/store/config/v2\";\n\nexport type resolveSystems<systems extends SystemsInput> = {\n [system in keyof systems]: mergeIfUndefined<systems[system], typeof SYSTEM_DEFAULTS>;\n};\n\nexport function resolveSystems<systems extends SystemsInput>(systems: systems): resolveSystems<systems> {\n return mapObject(systems, (system) => mergeIfUndefined(system, SYSTEM_DEFAULTS));\n}\n","import { isObject, mergeIfUndefined } from \"@latticexyz/store/config/v2\";\nimport { CODEGEN_DEFAULTS } from \"./defaults\";\n\nexport type resolveCodegen<codegen> = codegen extends {}\n ? mergeIfUndefined<codegen, typeof CODEGEN_DEFAULTS>\n : typeof CODEGEN_DEFAULTS;\n\nexport function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen> {\n return (\n isObject(codegen) ? mergeIfUndefined(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS\n ) as resolveCodegen<codegen>;\n}\n","import { mergeIfUndefined, isObject } from \"@latticexyz/store/config/v2\";\nimport { DEPLOY_DEFAULTS } from \"./defaults\";\n\nexport type resolveDeploy<deploy> = deploy extends {}\n ? mergeIfUndefined<deploy, typeof DEPLOY_DEFAULTS>\n : typeof DEPLOY_DEFAULTS;\n\nexport function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy> {\n return (isObject(deploy) ? mergeIfUndefined(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS) as resolveDeploy<deploy>;\n}\n"],"mappings":"+CACA,OAEE,iBAAAA,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,gBAAAC,EAEA,aAAAC,EACA,iBAAAC,EACA,YAAAC,MACK,8BCRA,IAAMC,EAAmB,CAC9B,mBAAoB,SACpB,kBAAmB,QACnB,gBAAiB,wBACnB,EAEaC,EAAkB,CAC7B,oBAAqB,OACrB,iBAAkB,aAClB,iBAAkB,YAClB,WAAY,eACd,EAEaC,EAAkB,CAC7B,QAAS,CAAC,EACV,OAAQ,CAAC,EACT,eAAgB,CAAC,EACjB,QAAS,CAAC,EACV,QAASF,EACT,OAAQC,CACV,EC1BA,OAAS,aAAAE,MAAiB,2BAG1B,OAAS,oBAAAC,MAAwB,8BAM1B,SAASC,EAA6CC,EAA2C,CACtG,OAAOC,EAAUD,EAAUE,GAAWJ,EAAiBI,EAAQC,CAAe,CAAC,CACjF,CCXA,OAAS,YAAAC,EAAU,oBAAAC,MAAwB,8BAOpC,SAASC,EAAwBC,EAA2C,CACjF,OACEC,EAASD,CAAO,EAAIE,EAAiBF,EAASG,CAAgB,EAAIA,CAEtE,CCXA,OAAS,oBAAAC,EAAkB,YAAAC,MAAgB,8BAOpC,SAASC,EAAsBC,EAAuC,CAC3E,OAAQC,EAASD,CAAM,EAAIE,EAAiBF,EAAQG,CAAe,EAAIA,CACzE,CJ4BO,SAASC,EAAcC,EAA6C,CACzE,IAAMC,EAAQC,EAAcF,CAAK,EAGjC,GAFAG,EAAcH,CAAK,EAEfI,EAAUJ,EAAO,YAAY,EAAG,CAClC,GAAI,CAACK,EAASL,EAAM,UAAU,EAC5B,MAAM,IAAI,MAAM,iCAAiC,KAAK,UAAUA,EAAM,UAAU,GAAG,EAErF,QAAWM,KAAa,OAAO,OAAON,EAAM,UAAU,EAChDI,EAAUE,EAAW,QAAQ,GAC/BC,EAAeD,EAAU,OAAQL,CAAK,EAI9C,CAqBO,SAASO,EAA6CR,EAAmC,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAC3BS,EAAaT,EAAM,YAAc,CAAC,EAElCU,EAA2B,OAAO,YACtC,OAAO,QAAQD,CAAU,EACtB,IAAI,CAAC,CAACE,EAAcL,CAAS,IAC5B,OAAO,QAAQA,EAAU,QAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAACM,EAAUC,CAAK,KAC1DC,EAAcD,EAAOZ,CAAK,EACnB,CACL,GAAGU,MAAiBC,IACpBG,EAAaC,EAAiBH,EAAO,CAAE,UAAWF,EAAc,KAAMC,CAAS,CAAC,EAAGX,CAAK,CAC1F,EACD,CACH,EACC,KAAK,CACV,EAEMgB,EAAgBC,EAAalB,CAAK,EAExC,OAAOgB,EACL,CACE,GAAGC,EACH,OAAQ,CAAE,GAAGA,EAAc,OAAQ,GAAGP,CAAyB,EAC/D,QAASM,EAAiBC,EAAc,QAASE,EAAenB,EAAM,OAAO,CAAC,EAC9E,OAAQoB,EAAcpB,EAAM,MAAM,EAClC,QAASqB,EAAerB,EAAM,SAAWsB,EAAgB,OAAO,EAChE,eAAgBC,EAAIvB,EAAO,gBAAgB,EAC3C,QAASA,EAAM,OACjB,EACAsB,CACF,CACF,CAEO,SAASE,EAAyBxB,EAAkD,CACzF,OAAAD,EAAcC,CAAK,EACZQ,EAAaR,CAAK,CAC3B","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","validateTables","resolveStore","hasOwnKey","validateStore","isObject","CODEGEN_DEFAULTS","DEPLOY_DEFAULTS","CONFIG_DEFAULTS","mapObject","mergeIfUndefined","resolveSystems","systems","mapObject","system","SYSTEM_DEFAULTS","isObject","mergeIfUndefined","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","mergeIfUndefined","isObject","resolveDeploy","deploy","isObject","mergeIfUndefined","DEPLOY_DEFAULTS","validateWorld","world","scope","extendedScope","validateStore","hasOwnKey","isObject","namespace","validateTables","resolveWorld","namespaces","resolvedNamespacedTables","namespaceKey","tableKey","table","validateTable","resolveTable","mergeIfUndefined","resolvedStore","resolveStore","resolveCodegen","resolveDeploy","resolveSystems","CONFIG_DEFAULTS","get","defineWorld"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/world",
3
- "version": "2.0.0-main-07e12ea2",
3
+ "version": "2.0.0-main-20ffc95f",
4
4
  "description": "World framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,10 +39,10 @@
39
39
  "arktype": "1.0.29-alpha",
40
40
  "viem": "2.7.12",
41
41
  "zod": "^3.21.4",
42
- "@latticexyz/common": "2.0.0-main-07e12ea2",
43
- "@latticexyz/schema-type": "2.0.0-main-07e12ea2",
44
- "@latticexyz/config": "2.0.0-main-07e12ea2",
45
- "@latticexyz/store": "2.0.0-main-07e12ea2"
42
+ "@latticexyz/common": "2.0.0-main-20ffc95f",
43
+ "@latticexyz/config": "2.0.0-main-20ffc95f",
44
+ "@latticexyz/schema-type": "2.0.0-main-20ffc95f",
45
+ "@latticexyz/store": "2.0.0-main-20ffc95f"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/ejs": "^3.1.1",
@@ -57,8 +57,8 @@
57
57
  "tsup": "^6.7.0",
58
58
  "tsx": "^3.12.6",
59
59
  "vitest": "0.34.6",
60
- "@latticexyz/abi-ts": "2.0.0-main-07e12ea2",
61
- "@latticexyz/gas-report": "2.0.0-main-07e12ea2"
60
+ "@latticexyz/abi-ts": "2.0.0-main-20ffc95f",
61
+ "@latticexyz/gas-report": "2.0.0-main-20ffc95f"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js",
@@ -10,8 +10,8 @@ import { defineWorld } from "./world";
10
10
  describe("configToV1", () => {
11
11
  it("should transform the broad v2 output to the broad v1 output", () => {
12
12
  // Making the `worldContractName` prop required here since it is required on the output of `mudConfig`
13
- attest<WorldConfigV1 & StoreConfigV1 & { worldContractName: string | undefined }, worldToV1<World>>();
14
- attest<worldToV1<World>, WorldConfigV1 & StoreConfigV1 & { worldContractName: string | undefined }>();
13
+ attest<WorldConfigV1 & StoreConfigV1 & { worldContractName: string | undefined }, Omit<worldToV1<World>, "v2">>();
14
+ attest<Omit<worldToV1<World>, "v2">, WorldConfigV1 & StoreConfigV1 & { worldContractName: string | undefined }>();
15
15
  });
16
16
 
17
17
  it("should transform a v2 store config output to the v1 config output", () => {
@@ -90,7 +90,10 @@ describe("configToV1", () => {
90
90
  },
91
91
  });
92
92
 
93
- attest<typeof configV1>(worldToV1(configV2)).equals(configV1);
94
- attest<worldToV1<typeof configV2>>(configV1);
93
+ const { v2, ...v1FromV2 } = worldToV1(configV2);
94
+
95
+ attest<typeof configV1>(v1FromV2).equals(configV1);
96
+ attest<typeof v1FromV2>(configV1).equals(v1FromV2);
97
+ attest<typeof v2>(configV2).equals(v2);
95
98
  });
96
99
  });
@@ -26,17 +26,18 @@ function systemsToV1<systems extends Systems>(systems: systems): systemsToV1<sys
26
26
  }
27
27
 
28
28
  export type worldToV1<world> = world extends World
29
- ? storeToV1<world> & {
29
+ ? Omit<storeToV1<world>, "v2"> & {
30
30
  systems: systemsToV1<world["systems"]>;
31
31
  excludeSystems: mutable<world["excludeSystems"]>;
32
32
  modules: modulesToV1<world["modules"]>;
33
- worldContractName: world["deployment"]["customWorldContract"];
34
- postDeployScript: world["deployment"]["postDeployScript"];
35
- deploysDirectory: world["deployment"]["deploysDirectory"];
36
- worldsFile: world["deployment"]["worldsFile"];
33
+ worldContractName: world["deploy"]["customWorldContract"];
34
+ postDeployScript: world["deploy"]["postDeployScript"];
35
+ deploysDirectory: world["deploy"]["deploysDirectory"];
36
+ worldsFile: world["deploy"]["worldsFile"];
37
37
  worldInterfaceName: world["codegen"]["worldInterfaceName"];
38
38
  worldgenDirectory: world["codegen"]["worldgenDirectory"];
39
39
  worldImportPath: world["codegen"]["worldImportPath"];
40
+ v2: world;
40
41
  }
41
42
  : never;
42
43
 
@@ -45,14 +46,14 @@ export function worldToV1<world>(world: conform<world, World>): worldToV1<world>
45
46
  systems: systemsToV1(world.systems),
46
47
  excludeSystems: world.excludeSystems,
47
48
  modules: modulesToV1(world.modules),
48
- worldContractName: world.deployment.customWorldContract,
49
- postDeployScript: world.deployment.postDeployScript,
50
- deploysDirectory: world.deployment.deploysDirectory,
51
- worldsFile: world.deployment.worldsFile,
49
+ worldContractName: world.deploy.customWorldContract,
50
+ postDeployScript: world.deploy.postDeployScript,
51
+ deploysDirectory: world.deploy.deploysDirectory,
52
+ worldsFile: world.deploy.worldsFile,
52
53
  worldInterfaceName: world.codegen.worldInterfaceName,
53
54
  worldgenDirectory: world.codegen.worldgenDirectory,
54
55
  worldImportPath: world.codegen.worldImportPath,
55
56
  };
56
57
 
57
- return { ...storeToV1(world as Store), ...v1WorldConfig } as worldToV1<world>;
58
+ return { ...storeToV1(world as Store), ...v1WorldConfig, v2: world } as worldToV1<world>;
58
59
  }
@@ -10,7 +10,7 @@ export const CODEGEN_DEFAULTS = {
10
10
  worldImportPath: "@latticexyz/world/src/",
11
11
  } as const;
12
12
 
13
- export const DEPLOYMENT_DEFAULTS = {
13
+ export const DEPLOY_DEFAULTS = {
14
14
  customWorldContract: undefined,
15
15
  postDeployScript: "PostDeploy",
16
16
  deploysDirectory: "./deploys",
@@ -23,5 +23,5 @@ export const CONFIG_DEFAULTS = {
23
23
  excludeSystems: [] as string[],
24
24
  modules: [],
25
25
  codegen: CODEGEN_DEFAULTS,
26
- deployment: DEPLOYMENT_DEFAULTS,
26
+ deploy: DEPLOY_DEFAULTS,
27
27
  } as const;
@@ -0,0 +1,10 @@
1
+ import { mergeIfUndefined, isObject } from "@latticexyz/store/config/v2";
2
+ import { DEPLOY_DEFAULTS } from "./defaults";
3
+
4
+ export type resolveDeploy<deploy> = deploy extends {}
5
+ ? mergeIfUndefined<deploy, typeof DEPLOY_DEFAULTS>
6
+ : typeof DEPLOY_DEFAULTS;
7
+
8
+ export function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy> {
9
+ return (isObject(deploy) ? mergeIfUndefined(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS) as resolveDeploy<deploy>;
10
+ }
@@ -21,7 +21,7 @@ export type SystemInput = {
21
21
 
22
22
  export type SystemsInput = { [key: string]: SystemInput };
23
23
 
24
- export type DeploymentInput = {
24
+ export type DeployInput = {
25
25
  /**
26
26
  * Script to execute after the deployment is complete (Default "PostDeploy").
27
27
  * Script must be placed in the forge scripts directory (see foundry.toml) and have a ".s.sol" extension.
@@ -57,8 +57,8 @@ export type WorldInput = evaluate<
57
57
  excludeSystems?: string[];
58
58
  /** Modules to in the World */
59
59
  modules?: Module[];
60
- /** Deployment config */
61
- deployment?: DeploymentInput;
60
+ /** Deploy config */
61
+ deploy?: DeployInput;
62
62
  /** Codegen config */
63
63
  codegen?: CodegenInput;
64
64
  }
@@ -29,7 +29,7 @@ export type System = {
29
29
 
30
30
  export type Systems = { readonly [key: string]: System };
31
31
 
32
- export type Deployment = {
32
+ export type Deploy = {
33
33
  /** The name of a custom World contract to deploy. If no name is provided, a default MUD World is deployed */
34
34
  readonly customWorldContract: string | undefined;
35
35
  /**
@@ -58,8 +58,8 @@ export type World = Store & {
58
58
  readonly excludeSystems: readonly string[];
59
59
  /** Modules to in the World */
60
60
  readonly modules: readonly Module[];
61
- /** Deployment config */
62
- readonly deployment: Deployment;
61
+ /** Deploy config */
62
+ readonly deploy: Deploy;
63
63
  /** Codegen config */
64
64
  readonly codegen: Codegen;
65
65
  };
@@ -2,8 +2,12 @@ import { describe, it } from "vitest";
2
2
  import { defineWorld } from "./world";
3
3
  import { attest } from "@arktype/attest";
4
4
  import { resourceToHex } from "@latticexyz/common";
5
- import { TABLE_CODEGEN_DEFAULTS, CODEGEN_DEFAULTS as STORE_CODEGEN_DEFAULTS } from "@latticexyz/store/config/v2";
6
- import { CODEGEN_DEFAULTS as WORLD_CODEGEN_DEFAULTS, DEPLOYMENT_DEFAULTS, CONFIG_DEFAULTS } from "./defaults";
5
+ import {
6
+ TABLE_CODEGEN_DEFAULTS,
7
+ CODEGEN_DEFAULTS as STORE_CODEGEN_DEFAULTS,
8
+ TABLE_DEPLOY_DEFAULTS,
9
+ } from "@latticexyz/store/config/v2";
10
+ import { CODEGEN_DEFAULTS as WORLD_CODEGEN_DEFAULTS, DEPLOY_DEFAULTS, CONFIG_DEFAULTS } from "./defaults";
7
11
  import { World } from "./output";
8
12
  const CODEGEN_DEFAULTS = { ...STORE_CODEGEN_DEFAULTS, ...WORLD_CODEGEN_DEFAULTS };
9
13
 
@@ -51,6 +55,7 @@ describe("defineWorld", () => {
51
55
  namespace: "ExampleNamespace",
52
56
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: true as boolean },
53
57
  type: "table",
58
+ deploy: TABLE_DEPLOY_DEFAULTS,
54
59
  },
55
60
  },
56
61
  userTypes: {},
@@ -111,6 +116,7 @@ describe("defineWorld", () => {
111
116
  namespace: "ExampleNamespace",
112
117
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: true as boolean },
113
118
  type: "table",
119
+ deploy: TABLE_DEPLOY_DEFAULTS,
114
120
  },
115
121
  },
116
122
  userTypes: {
@@ -212,6 +218,7 @@ describe("defineWorld", () => {
212
218
  namespace: "",
213
219
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: true as boolean },
214
220
  type: "table",
221
+ deploy: TABLE_DEPLOY_DEFAULTS,
215
222
  },
216
223
  },
217
224
  userTypes: {},
@@ -260,6 +267,7 @@ describe("defineWorld", () => {
260
267
  namespace: "",
261
268
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: true as boolean },
262
269
  type: "table",
270
+ deploy: TABLE_DEPLOY_DEFAULTS,
263
271
  },
264
272
  },
265
273
  userTypes: {
@@ -307,12 +315,13 @@ describe("defineWorld", () => {
307
315
  namespace: "",
308
316
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: false as boolean },
309
317
  type: "table",
318
+ deploy: TABLE_DEPLOY_DEFAULTS,
310
319
  },
311
320
  },
312
321
  userTypes: {},
313
322
  enums: {},
314
323
  namespace: "",
315
- deployment: DEPLOYMENT_DEFAULTS,
324
+ deploy: DEPLOY_DEFAULTS,
316
325
  } as const;
317
326
 
318
327
  attest<typeof expected>(config).equals(expected);
@@ -356,6 +365,7 @@ describe("defineWorld", () => {
356
365
  namespace: "",
357
366
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: false as boolean },
358
367
  type: "table",
368
+ deploy: TABLE_DEPLOY_DEFAULTS,
359
369
  },
360
370
  Second: {
361
371
  tableId: resourceToHex({ type: "table", namespace: "", name: "Second" }),
@@ -378,6 +388,7 @@ describe("defineWorld", () => {
378
388
  namespace: "",
379
389
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: false as boolean },
380
390
  type: "table",
391
+ deploy: TABLE_DEPLOY_DEFAULTS,
381
392
  },
382
393
  },
383
394
  userTypes: {},
@@ -431,6 +442,7 @@ describe("defineWorld", () => {
431
442
  namespace: "",
432
443
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: false as boolean },
433
444
  type: "table",
445
+ deploy: TABLE_DEPLOY_DEFAULTS,
434
446
  },
435
447
  Second: {
436
448
  tableId: resourceToHex({ type: "table", namespace: "", name: "Second" }),
@@ -453,6 +465,7 @@ describe("defineWorld", () => {
453
465
  namespace: "",
454
466
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: false as boolean },
455
467
  type: "table",
468
+ deploy: TABLE_DEPLOY_DEFAULTS,
456
469
  },
457
470
  },
458
471
  userTypes: {
@@ -562,6 +575,7 @@ describe("defineWorld", () => {
562
575
  namespace: "",
563
576
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: true as boolean },
564
577
  type: "table",
578
+ deploy: TABLE_DEPLOY_DEFAULTS,
565
579
  },
566
580
  },
567
581
  userTypes: {
@@ -19,7 +19,7 @@ import { Tables } from "@latticexyz/store";
19
19
  import { resolveSystems } from "./systems";
20
20
  import { resolveNamespacedTables, validateNamespaces } from "./namespaces";
21
21
  import { resolveCodegen } from "./codegen";
22
- import { resolveDeployment } from "./deployment";
22
+ import { resolveDeploy } from "./deploy";
23
23
 
24
24
  export type validateWorld<world> = {
25
25
  readonly [key in keyof world]: key extends "tables"
@@ -58,8 +58,8 @@ export type resolveWorld<world> = evaluate<
58
58
  {
59
59
  [key in keyof world]: key extends "systems"
60
60
  ? resolveSystems<world[key] & SystemsInput>
61
- : key extends "deployment"
62
- ? resolveDeployment<world[key]>
61
+ : key extends "deploy"
62
+ ? resolveDeploy<world[key]>
63
63
  : key extends "codegen"
64
64
  ? resolveCodegen<world[key]>
65
65
  : world[key];
@@ -77,7 +77,7 @@ export function resolveWorld<const world extends WorldInput>(world: world): reso
77
77
  const resolvedNamespacedTables = Object.fromEntries(
78
78
  Object.entries(namespaces)
79
79
  .map(([namespaceKey, namespace]) =>
80
- Object.entries(namespace.tables).map(([tableKey, table]) => {
80
+ Object.entries(namespace.tables ?? {}).map(([tableKey, table]) => {
81
81
  validateTable(table, scope);
82
82
  return [
83
83
  `${namespaceKey}__${tableKey}`,
@@ -95,7 +95,7 @@ export function resolveWorld<const world extends WorldInput>(world: world): reso
95
95
  ...resolvedStore,
96
96
  tables: { ...resolvedStore.tables, ...resolvedNamespacedTables },
97
97
  codegen: mergeIfUndefined(resolvedStore.codegen, resolveCodegen(world.codegen)),
98
- deployment: resolveDeployment(world.deployment),
98
+ deploy: resolveDeploy(world.deploy),
99
99
  systems: resolveSystems(world.systems ?? CONFIG_DEFAULTS.systems),
100
100
  excludeSystems: get(world, "excludeSystems"),
101
101
  modules: world.modules,
@@ -2,7 +2,11 @@ import { describe, it } from "vitest";
2
2
  import { defineWorldWithShorthands } from "./worldWithShorthands";
3
3
  import { attest } from "@arktype/attest";
4
4
  import { resourceToHex } from "@latticexyz/common";
5
- import { TABLE_CODEGEN_DEFAULTS, CODEGEN_DEFAULTS as STORE_CODEGEN_DEFAULTS } from "@latticexyz/store/config/v2";
5
+ import {
6
+ TABLE_CODEGEN_DEFAULTS,
7
+ CODEGEN_DEFAULTS as STORE_CODEGEN_DEFAULTS,
8
+ TABLE_DEPLOY_DEFAULTS,
9
+ } from "@latticexyz/store/config/v2";
6
10
  import { CODEGEN_DEFAULTS as WORLD_CODEGEN_DEFAULTS, CONFIG_DEFAULTS } from "./defaults";
7
11
  const CODEGEN_DEFAULTS = { ...STORE_CODEGEN_DEFAULTS, ...WORLD_CODEGEN_DEFAULTS };
8
12
 
@@ -46,6 +50,7 @@ describe("defineWorldWithShorthands", () => {
46
50
  namespace: "ExampleNamespace",
47
51
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: false as boolean },
48
52
  type: "table",
53
+ deploy: TABLE_DEPLOY_DEFAULTS,
49
54
  },
50
55
  },
51
56
  userTypes: {
@@ -108,6 +113,7 @@ describe("defineWorldWithShorthands", () => {
108
113
  namespace: "ExampleNamespace",
109
114
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: true as boolean },
110
115
  type: "table",
116
+ deploy: TABLE_DEPLOY_DEFAULTS,
111
117
  },
112
118
  },
113
119
  userTypes: {
@@ -147,6 +153,7 @@ describe("defineWorldWithShorthands", () => {
147
153
  namespace: "",
148
154
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: false as boolean },
149
155
  type: "table",
156
+ deploy: TABLE_DEPLOY_DEFAULTS,
150
157
  },
151
158
  },
152
159
  userTypes: {},
@@ -184,6 +191,7 @@ describe("defineWorldWithShorthands", () => {
184
191
  namespace: "",
185
192
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: false as boolean },
186
193
  type: "table",
194
+ deploy: TABLE_DEPLOY_DEFAULTS,
187
195
  },
188
196
  },
189
197
  userTypes: { CustomType: { type: "address", filePath: "path/to/file" as string } },
@@ -223,6 +231,7 @@ describe("defineWorldWithShorthands", () => {
223
231
  namespace: "",
224
232
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: true as boolean },
225
233
  type: "table",
234
+ deploy: TABLE_DEPLOY_DEFAULTS,
226
235
  },
227
236
  },
228
237
  userTypes: {},
@@ -262,6 +271,7 @@ describe("defineWorldWithShorthands", () => {
262
271
  namespace: "",
263
272
  codegen: { ...TABLE_CODEGEN_DEFAULTS, dataStruct: true as boolean },
264
273
  type: "table",
274
+ deploy: TABLE_DEPLOY_DEFAULTS,
265
275
  },
266
276
  },
267
277
  userTypes: {},
@@ -1,12 +0,0 @@
1
- import { mergeIfUndefined, isObject } from "@latticexyz/store/config/v2";
2
- import { DEPLOYMENT_DEFAULTS } from "./defaults";
3
-
4
- export type resolveDeployment<deployment> = deployment extends {}
5
- ? mergeIfUndefined<deployment, typeof DEPLOYMENT_DEFAULTS>
6
- : typeof DEPLOYMENT_DEFAULTS;
7
-
8
- export function resolveDeployment<deployment>(deployment: deployment): resolveDeployment<deployment> {
9
- return (
10
- isObject(deployment) ? mergeIfUndefined(deployment, DEPLOYMENT_DEFAULTS) : DEPLOYMENT_DEFAULTS
11
- ) as resolveDeployment<deployment>;
12
- }