@latticexyz/world 2.2.18-9fa07c8489f1fbf167d0db01cd9aaa645a29c8e2 → 2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940

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.
Files changed (41) hide show
  1. package/dist/IBaseWorld.abi-SGUPOG6A.js +2 -0
  2. package/dist/{IBaseWorld.abi-S745M2QE.js.map → IBaseWorld.abi-SGUPOG6A.js.map} +1 -1
  3. package/dist/System.abi-D2D3OAI5.js +2 -0
  4. package/dist/{System.abi-UHI2DJK6.js.map → System.abi-D2D3OAI5.js.map} +1 -1
  5. package/dist/chunk-AJUHOWGE.js +2 -0
  6. package/dist/{chunk-S5LARYWY.js.map → chunk-AJUHOWGE.js.map} +1 -1
  7. package/dist/chunk-CGF3NYHC.js +2 -0
  8. package/dist/chunk-CGF3NYHC.js.map +1 -0
  9. package/dist/chunk-DIHBEOC2.js +2 -0
  10. package/dist/{chunk-TL2M3LZH.js.map → chunk-DIHBEOC2.js.map} +1 -1
  11. package/dist/chunk-FW4363Y4.js +2 -0
  12. package/dist/index.js +1 -20
  13. package/dist/index.js.map +1 -1
  14. package/dist/internal.js +3 -318
  15. package/dist/internal.js.map +1 -1
  16. package/dist/mud.config.js +1 -11
  17. package/dist/node.js +102 -7328
  18. package/dist/node.js.map +1 -1
  19. package/package.json +14 -49
  20. package/dist/IBaseWorld.abi-S745M2QE.js +0 -2015
  21. package/dist/System.abi-UHI2DJK6.js +0 -67
  22. package/dist/chunk-AAKXFFCU.js +0 -158
  23. package/dist/chunk-AAKXFFCU.js.map +0 -1
  24. package/dist/chunk-AAWFTQHP.js +0 -35
  25. package/dist/chunk-S5LARYWY.js +0 -136
  26. package/dist/chunk-TL2M3LZH.js +0 -119
  27. package/dist/dynamicResolution-AmVd5Qtd.d.cts +0 -161
  28. package/dist/index.cjs +0 -241
  29. package/dist/index.cjs.map +0 -1
  30. package/dist/index.d.cts +0 -11
  31. package/dist/internal.cjs +0 -656
  32. package/dist/internal.cjs.map +0 -1
  33. package/dist/internal.d.cts +0 -169
  34. package/dist/mud.config.cjs +0 -357
  35. package/dist/mud.config.cjs.map +0 -1
  36. package/dist/mud.config.d.cts +0 -869
  37. package/dist/node.cjs +0 -9599
  38. package/dist/node.cjs.map +0 -1
  39. package/dist/node.d.cts +0 -131
  40. package/dist/world-DUniZQxy.d.cts +0 -266
  41. /package/dist/{chunk-AAWFTQHP.js.map → chunk-FW4363Y4.js.map} +0 -0
@@ -1,67 +0,0 @@
1
- import "./chunk-AAWFTQHP.js";
2
-
3
- // out/System.sol/System.abi.json
4
- var System_abi_default = [
5
- {
6
- type: "function",
7
- name: "_msgSender",
8
- inputs: [],
9
- outputs: [
10
- {
11
- name: "sender",
12
- type: "address",
13
- internalType: "address"
14
- }
15
- ],
16
- stateMutability: "view"
17
- },
18
- {
19
- type: "function",
20
- name: "_msgValue",
21
- inputs: [],
22
- outputs: [
23
- {
24
- name: "value",
25
- type: "uint256",
26
- internalType: "uint256"
27
- }
28
- ],
29
- stateMutability: "pure"
30
- },
31
- {
32
- type: "function",
33
- name: "_world",
34
- inputs: [],
35
- outputs: [
36
- {
37
- name: "",
38
- type: "address",
39
- internalType: "address"
40
- }
41
- ],
42
- stateMutability: "view"
43
- },
44
- {
45
- type: "function",
46
- name: "supportsInterface",
47
- inputs: [
48
- {
49
- name: "interfaceId",
50
- type: "bytes4",
51
- internalType: "bytes4"
52
- }
53
- ],
54
- outputs: [
55
- {
56
- name: "",
57
- type: "bool",
58
- internalType: "bool"
59
- }
60
- ],
61
- stateMutability: "pure"
62
- }
63
- ];
64
- export {
65
- System_abi_default as default
66
- };
67
- //# sourceMappingURL=System.abi-UHI2DJK6.js.map
@@ -1,158 +0,0 @@
1
- import {
2
- __esm
3
- } from "./chunk-AAWFTQHP.js";
4
-
5
- // ../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.7_@types+node@20.17.16__jiti@1.21.6_postcss@8.5.1_ts_rihtmhm6tp3cagz6w7ivhbdyn4/node_modules/tsup/assets/esm_shims.js
6
- var init_esm_shims = __esm({
7
- "../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.7_@types+node@20.17.16__jiti@1.21.6_postcss@8.5.1_ts_rihtmhm6tp3cagz6w7ivhbdyn4/node_modules/tsup/assets/esm_shims.js"() {
8
- "use strict";
9
- }
10
- });
11
-
12
- // ts/config/v2/defaults.ts
13
- init_esm_shims();
14
- var SYSTEM_DEPLOY_DEFAULTS = {
15
- disabled: false,
16
- registerWorldFunctions: true
17
- };
18
- var SYSTEM_DEFAULTS = {
19
- namespaceLabel: "",
20
- openAccess: true,
21
- accessList: []
22
- };
23
- var MODULE_DEFAULTS = {
24
- root: false,
25
- args: [],
26
- artifactPath: void 0
27
- };
28
- var CODEGEN_DEFAULTS = {
29
- worldInterfaceName: "IWorld",
30
- worldgenDirectory: "world",
31
- systemLibrariesDirectory: "systems",
32
- generateSystemLibraries: false,
33
- worldImportPath: "@latticexyz/world/src"
34
- };
35
- var DEPLOY_DEFAULTS = {
36
- postDeployScript: "PostDeploy",
37
- deploysDirectory: "./deploys",
38
- worldsFile: "./worlds.json",
39
- upgradeableWorldImplementation: false
40
- };
41
- var CONFIG_DEFAULTS = {
42
- systems: {},
43
- tables: {},
44
- excludeSystems: [],
45
- modules: [],
46
- codegen: CODEGEN_DEFAULTS,
47
- deploy: DEPLOY_DEFAULTS
48
- };
49
-
50
- // ts/config/v2/system.ts
51
- init_esm_shims();
52
- import { hasOwnKey, mergeIfUndefined } from "@latticexyz/store/internal";
53
- import { resourceToHex } from "@latticexyz/common";
54
- function validateSystem(input, options = {}) {
55
- if (typeof input !== "object" || input == null) {
56
- throw new Error(`Expected full system config, got \`${JSON.stringify(input)}\``);
57
- }
58
- if (options.inNamespace && (hasOwnKey(input, "label") || hasOwnKey(input, "namespaceLabel") || hasOwnKey(input, "namespace"))) {
59
- throw new Error(
60
- "Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context."
61
- );
62
- }
63
- if (hasOwnKey(input, "namespaceLabel") && typeof input.namespaceLabel === "string" && (!hasOwnKey(input, "namespace") || typeof input.namespace !== "string") && input.namespaceLabel.length > 14) {
64
- throw new Error(
65
- `System \`namespace\` defaults to \`namespaceLabel\`, but must fit into a \`bytes14\` and "${input.namespaceLabel}" is too long. Provide explicit \`namespace\` override.`
66
- );
67
- }
68
- if (hasOwnKey(input, "namespace") && typeof input.namespace === "string" && input.namespace.length > 14) {
69
- throw new Error(`System \`namespace\` must fit into a \`bytes14\`, but "${input.namespace}" is too long.`);
70
- }
71
- if (hasOwnKey(input, "name") && typeof input.name === "string" && input.name.length > 16) {
72
- throw new Error(`System \`name\` must fit into a \`bytes16\`, but "${input.name}" is too long.`);
73
- }
74
- }
75
- function resolveSystem(input) {
76
- const namespaceLabel = input.namespaceLabel ?? SYSTEM_DEFAULTS.namespaceLabel;
77
- const namespace = input.namespace ?? namespaceLabel;
78
- const label = input.label;
79
- const name = input.name ?? label.slice(0, 16);
80
- const systemId = resourceToHex({ type: "system", namespace, name });
81
- return mergeIfUndefined(
82
- {
83
- ...input,
84
- label,
85
- namespaceLabel,
86
- namespace,
87
- name,
88
- systemId,
89
- deploy: mergeIfUndefined(input.deploy ?? {}, SYSTEM_DEPLOY_DEFAULTS)
90
- },
91
- SYSTEM_DEFAULTS
92
- );
93
- }
94
- function defineSystem(input) {
95
- validateSystem(input);
96
- return resolveSystem(input);
97
- }
98
-
99
- // ts/config/v2/systems.ts
100
- init_esm_shims();
101
- import { isObject } from "@latticexyz/store/internal";
102
- function validateSystems(input) {
103
- if (isObject(input)) {
104
- for (const system of Object.values(input)) {
105
- validateSystem(system, { inNamespace: true });
106
- }
107
- return;
108
- }
109
- throw new Error(`Expected system config, received ${JSON.stringify(input)}`);
110
- }
111
- function resolveSystems(systems, namespaceLabel, namespace) {
112
- return Object.fromEntries(
113
- Object.entries(systems).map(([label, system]) => {
114
- return [label, resolveSystem({ ...system, label, namespaceLabel, namespace })];
115
- })
116
- );
117
- }
118
-
119
- // ts/config/v2/namespace.ts
120
- init_esm_shims();
121
- import {
122
- hasOwnKey as hasOwnKey2,
123
- validateNamespace as validateStoreNamespace,
124
- resolveNamespace as resolveStoreNamespace,
125
- AbiTypeScope
126
- } from "@latticexyz/store/internal";
127
- function validateNamespace(input, scope) {
128
- if (hasOwnKey2(input, "systems")) {
129
- validateSystems(input.systems);
130
- }
131
- validateStoreNamespace(input, scope);
132
- }
133
- function resolveNamespace(input, scope = AbiTypeScope) {
134
- const namespace = resolveStoreNamespace(input, scope);
135
- const systems = resolveSystems(input.systems ?? {}, namespace.label, namespace.namespace);
136
- return {
137
- ...namespace,
138
- systems
139
- };
140
- }
141
-
142
- export {
143
- init_esm_shims,
144
- SYSTEM_DEPLOY_DEFAULTS,
145
- SYSTEM_DEFAULTS,
146
- MODULE_DEFAULTS,
147
- CODEGEN_DEFAULTS,
148
- DEPLOY_DEFAULTS,
149
- CONFIG_DEFAULTS,
150
- validateSystem,
151
- resolveSystem,
152
- defineSystem,
153
- validateSystems,
154
- resolveSystems,
155
- validateNamespace,
156
- resolveNamespace
157
- };
158
- //# sourceMappingURL=chunk-AAKXFFCU.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.7_@types+node@20.17.16__jiti@1.21.6_postcss@8.5.1_ts_rihtmhm6tp3cagz6w7ivhbdyn4/node_modules/tsup/assets/esm_shims.js","../ts/config/v2/defaults.ts","../ts/config/v2/system.ts","../ts/config/v2/systems.ts","../ts/config/v2/namespace.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import { CodegenInput, DeployInput, ModuleInput, SystemDeployInput, SystemInput, WorldInput } from \"./input\";\n\nexport const SYSTEM_DEPLOY_DEFAULTS = {\n disabled: false,\n registerWorldFunctions: true,\n} as const satisfies Required<SystemDeployInput>;\n\nexport type SYSTEM_DEPLOY_DEFAULTS = typeof SYSTEM_DEPLOY_DEFAULTS;\n\nexport const SYSTEM_DEFAULTS = {\n namespaceLabel: \"\",\n openAccess: true,\n accessList: [],\n} as const satisfies Omit<Required<SystemInput>, \"label\" | \"namespace\" | \"name\" | \"deploy\">;\n\nexport type SYSTEM_DEFAULTS = typeof SYSTEM_DEFAULTS;\n\nexport const MODULE_DEFAULTS = {\n root: false,\n args: [],\n artifactPath: undefined,\n} as const satisfies Pick<ModuleInput, \"root\" | \"args\" | \"artifactPath\">;\n\nexport type MODULE_DEFAULTS = typeof MODULE_DEFAULTS;\n\nexport const CODEGEN_DEFAULTS = {\n worldInterfaceName: \"IWorld\",\n worldgenDirectory: \"world\",\n systemLibrariesDirectory: \"systems\",\n generateSystemLibraries: false,\n worldImportPath: \"@latticexyz/world/src\",\n} as const satisfies CodegenInput;\n\nexport type CODEGEN_DEFAULTS = typeof CODEGEN_DEFAULTS;\n\nexport const DEPLOY_DEFAULTS = {\n postDeployScript: \"PostDeploy\",\n deploysDirectory: \"./deploys\",\n worldsFile: \"./worlds.json\",\n upgradeableWorldImplementation: false,\n} as const satisfies DeployInput;\n\nexport type DEPLOY_DEFAULTS = typeof DEPLOY_DEFAULTS;\n\nexport const CONFIG_DEFAULTS = {\n systems: {},\n tables: {},\n excludeSystems: [],\n modules: [],\n codegen: CODEGEN_DEFAULTS,\n deploy: DEPLOY_DEFAULTS,\n} as const satisfies WorldInput;\n\nexport type CONFIG_DEFAULTS = typeof CONFIG_DEFAULTS;\n","import { SYSTEM_DEFAULTS, SYSTEM_DEPLOY_DEFAULTS } from \"./defaults\";\nimport { SystemInput } from \"./input\";\nimport { hasOwnKey, mergeIfUndefined } from \"@latticexyz/store/internal\";\nimport { ErrorMessage, narrow, requiredKeyOf, show } from \"@ark/util\";\nimport { Hex } from \"viem\";\nimport { resourceToHex } from \"@latticexyz/common\";\n\nexport type ValidateSystemOptions = { readonly inNamespace?: true };\n\nexport type requiredSystemKey<inNamespace extends true | undefined> = Exclude<\n requiredKeyOf<SystemInput>,\n inNamespace extends true ? \"label\" | \"namespaceLabel\" | \"namespace\" : never\n>;\n\nexport type validateSystem<input, options extends ValidateSystemOptions = {}> = {\n [key in keyof input | requiredSystemKey<options[\"inNamespace\"]>]: key extends keyof SystemInput\n ? key extends \"label\" | \"namespaceLabel\" | \"namespace\"\n ? options[\"inNamespace\"] extends true\n ? ErrorMessage<\"Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context.\">\n : key extends keyof input\n ? narrow<input[key]>\n : never\n : SystemInput[key]\n : ErrorMessage<`Key \\`${key & string}\\` does not exist in SystemInput`>;\n};\n\nexport function validateSystem<input>(\n input: input,\n options: ValidateSystemOptions = {},\n): asserts input is SystemInput & input {\n if (typeof input !== \"object\" || input == null) {\n throw new Error(`Expected full system config, got \\`${JSON.stringify(input)}\\``);\n }\n\n if (\n options.inNamespace &&\n (hasOwnKey(input, \"label\") || hasOwnKey(input, \"namespaceLabel\") || hasOwnKey(input, \"namespace\"))\n ) {\n throw new Error(\n \"Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context.\",\n );\n }\n\n if (\n hasOwnKey(input, \"namespaceLabel\") &&\n typeof input.namespaceLabel === \"string\" &&\n (!hasOwnKey(input, \"namespace\") || typeof input.namespace !== \"string\") &&\n input.namespaceLabel.length > 14\n ) {\n throw new Error(\n `System \\`namespace\\` defaults to \\`namespaceLabel\\`, but must fit into a \\`bytes14\\` and \"${input.namespaceLabel}\" is too long. Provide explicit \\`namespace\\` override.`,\n );\n }\n\n if (hasOwnKey(input, \"namespace\") && typeof input.namespace === \"string\" && input.namespace.length > 14) {\n throw new Error(`System \\`namespace\\` must fit into a \\`bytes14\\`, but \"${input.namespace}\" is too long.`);\n }\n if (hasOwnKey(input, \"name\") && typeof input.name === \"string\" && input.name.length > 16) {\n throw new Error(`System \\`name\\` must fit into a \\`bytes16\\`, but \"${input.name}\" is too long.`);\n }\n}\n\nexport type resolveSystem<input> = input extends SystemInput\n ? {\n readonly label: input[\"label\"];\n readonly namespaceLabel: undefined extends input[\"namespaceLabel\"]\n ? typeof SYSTEM_DEFAULTS.namespaceLabel\n : input[\"namespaceLabel\"];\n readonly namespace: string;\n readonly name: string;\n readonly systemId: Hex;\n readonly openAccess: undefined extends input[\"openAccess\"] ? SYSTEM_DEFAULTS[\"openAccess\"] : input[\"openAccess\"];\n readonly accessList: undefined extends input[\"accessList\"] ? SYSTEM_DEFAULTS[\"accessList\"] : input[\"accessList\"];\n readonly deploy: show<\n mergeIfUndefined<undefined extends input[\"deploy\"] ? {} : input[\"deploy\"], SYSTEM_DEPLOY_DEFAULTS>\n >;\n }\n : never;\n\nexport function resolveSystem<input extends SystemInput>(input: input): resolveSystem<input> {\n const namespaceLabel = input.namespaceLabel ?? SYSTEM_DEFAULTS.namespaceLabel;\n // validate ensures this is length constrained\n const namespace = input.namespace ?? namespaceLabel;\n\n const label = input.label;\n const name = input.name ?? label.slice(0, 16);\n const systemId = resourceToHex({ type: \"system\", namespace, name });\n\n return mergeIfUndefined(\n {\n ...input,\n label,\n namespaceLabel,\n namespace,\n name,\n systemId,\n deploy: mergeIfUndefined(input.deploy ?? {}, SYSTEM_DEPLOY_DEFAULTS),\n },\n SYSTEM_DEFAULTS,\n ) as never;\n}\n\nexport function defineSystem<input>(input: validateSystem<input>): resolveSystem<input> {\n validateSystem(input);\n return resolveSystem(input) as never;\n}\n","import { ErrorMessage } from \"@ark/util\";\nimport { isObject } from \"@latticexyz/store/internal\";\nimport { SystemsInput } from \"./input\";\nimport { resolveSystem, validateSystem } from \"./system\";\n\n// TODO: add nuance between \"in namespace\" (namespace provided in context) and \"in systems\" (label provided in context)\n\nexport type validateSystems<input> = {\n [label in keyof input]: input[label] extends object\n ? validateSystem<input[label], { inNamespace: true }>\n : ErrorMessage<`Expected a system config for ${label & string}.`>;\n};\n\nexport function validateSystems(input: unknown): asserts input is SystemsInput {\n if (isObject(input)) {\n for (const system of Object.values(input)) {\n validateSystem(system, { inNamespace: true });\n }\n return;\n }\n throw new Error(`Expected system config, received ${JSON.stringify(input)}`);\n}\n\nexport type resolveSystems<systems extends SystemsInput, namespaceLabel extends string> = {\n [label in keyof systems]: resolveSystem<\n systems[label] & { label: label; namespaceLabel: namespaceLabel; namespace: string }\n >;\n};\n\nexport function resolveSystems<systems extends SystemsInput, namespaceLabel extends string>(\n systems: systems,\n namespaceLabel: namespaceLabel,\n namespace: string,\n): resolveSystems<systems, namespaceLabel> {\n return Object.fromEntries(\n Object.entries(systems).map(([label, system]) => {\n return [label, resolveSystem({ ...system, label, namespaceLabel, namespace })];\n }),\n ) as never;\n}\n","import { NamespaceInput, SystemsInput } from \"./input\";\nimport {\n hasOwnKey,\n validateNamespace as validateStoreNamespace,\n resolveNamespace as resolveStoreNamespace,\n Scope,\n AbiTypeScope,\n} from \"@latticexyz/store/internal\";\nimport { resolveSystems, validateSystems } from \"./systems\";\nimport { show } from \"@ark/util\";\n\nexport type validateNamespace<input, scope extends Scope = AbiTypeScope> = {\n [key in keyof input]: key extends \"systems\" ? validateSystems<input[key]> : validateStoreNamespace<input, scope>[key];\n};\n\nexport function validateNamespace<scope extends Scope = AbiTypeScope>(\n input: unknown,\n scope: scope,\n): asserts input is NamespaceInput {\n if (hasOwnKey(input, \"systems\")) {\n validateSystems(input.systems);\n }\n validateStoreNamespace(input, scope);\n}\n\nexport type resolveNamespace<input, scope extends Scope = AbiTypeScope> = input extends NamespaceInput\n ? show<\n resolveStoreNamespace<input, scope> & {\n readonly systems: input[\"systems\"] extends SystemsInput\n ? show<resolveSystems<input[\"systems\"], resolveStoreNamespace<input, scope>[\"label\"]>>\n : {};\n }\n >\n : never;\n\nexport function resolveNamespace<const input extends NamespaceInput, scope extends Scope = AbiTypeScope>(\n input: input,\n scope: scope = AbiTypeScope as never,\n): resolveNamespace<input, scope> {\n const namespace = resolveStoreNamespace(input, scope);\n const systems = resolveSystems(input.systems ?? {}, namespace.label, namespace.namespace);\n return {\n ...namespace,\n systems,\n } as never;\n}\n"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAEO,IAAM,yBAAyB;AAAA,EACpC,UAAU;AAAA,EACV,wBAAwB;AAC1B;AAIO,IAAM,kBAAkB;AAAA,EAC7B,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,YAAY,CAAC;AACf;AAIO,IAAM,kBAAkB;AAAA,EAC7B,MAAM;AAAA,EACN,MAAM,CAAC;AAAA,EACP,cAAc;AAChB;AAIO,IAAM,mBAAmB;AAAA,EAC9B,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,0BAA0B;AAAA,EAC1B,yBAAyB;AAAA,EACzB,iBAAiB;AACnB;AAIO,IAAM,kBAAkB;AAAA,EAC7B,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,gCAAgC;AAClC;AAIO,IAAM,kBAAkB;AAAA,EAC7B,SAAS,CAAC;AAAA,EACV,QAAQ,CAAC;AAAA,EACT,gBAAgB,CAAC;AAAA,EACjB,SAAS,CAAC;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AACV;;;ACnDA;AAEA,SAAS,WAAW,wBAAwB;AAG5C,SAAS,qBAAqB;AAqBvB,SAAS,eACd,OACA,UAAiC,CAAC,GACI;AACtC,MAAI,OAAO,UAAU,YAAY,SAAS,MAAM;AAC9C,UAAM,IAAI,MAAM,sCAAsC,KAAK,UAAU,KAAK,CAAC,IAAI;AAAA,EACjF;AAEA,MACE,QAAQ,gBACP,UAAU,OAAO,OAAO,KAAK,UAAU,OAAO,gBAAgB,KAAK,UAAU,OAAO,WAAW,IAChG;AACA,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MACE,UAAU,OAAO,gBAAgB,KACjC,OAAO,MAAM,mBAAmB,aAC/B,CAAC,UAAU,OAAO,WAAW,KAAK,OAAO,MAAM,cAAc,aAC9D,MAAM,eAAe,SAAS,IAC9B;AACA,UAAM,IAAI;AAAA,MACR,6FAA6F,MAAM,cAAc;AAAA,IACnH;AAAA,EACF;AAEA,MAAI,UAAU,OAAO,WAAW,KAAK,OAAO,MAAM,cAAc,YAAY,MAAM,UAAU,SAAS,IAAI;AACvG,UAAM,IAAI,MAAM,0DAA0D,MAAM,SAAS,gBAAgB;AAAA,EAC3G;AACA,MAAI,UAAU,OAAO,MAAM,KAAK,OAAO,MAAM,SAAS,YAAY,MAAM,KAAK,SAAS,IAAI;AACxF,UAAM,IAAI,MAAM,qDAAqD,MAAM,IAAI,gBAAgB;AAAA,EACjG;AACF;AAmBO,SAAS,cAAyC,OAAoC;AAC3F,QAAM,iBAAiB,MAAM,kBAAkB,gBAAgB;AAE/D,QAAM,YAAY,MAAM,aAAa;AAErC,QAAM,QAAQ,MAAM;AACpB,QAAM,OAAO,MAAM,QAAQ,MAAM,MAAM,GAAG,EAAE;AAC5C,QAAM,WAAW,cAAc,EAAE,MAAM,UAAU,WAAW,KAAK,CAAC;AAElE,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,iBAAiB,MAAM,UAAU,CAAC,GAAG,sBAAsB;AAAA,IACrE;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,aAAoB,OAAoD;AACtF,iBAAe,KAAK;AACpB,SAAO,cAAc,KAAK;AAC5B;;;ACzGA;AACA,SAAS,gBAAgB;AAYlB,SAAS,gBAAgB,OAA+C;AAC7E,MAAI,SAAS,KAAK,GAAG;AACnB,eAAW,UAAU,OAAO,OAAO,KAAK,GAAG;AACzC,qBAAe,QAAQ,EAAE,aAAa,KAAK,CAAC;AAAA,IAC9C;AACA;AAAA,EACF;AACA,QAAM,IAAI,MAAM,oCAAoC,KAAK,UAAU,KAAK,CAAC,EAAE;AAC7E;AAQO,SAAS,eACd,SACA,gBACA,WACyC;AACzC,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,MAAM,MAAM;AAC/C,aAAO,CAAC,OAAO,cAAc,EAAE,GAAG,QAAQ,OAAO,gBAAgB,UAAU,CAAC,CAAC;AAAA,IAC/E,CAAC;AAAA,EACH;AACF;;;ACvCA;AACA;AAAA,EACE,aAAAA;AAAA,EACA,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EAEpB;AAAA,OACK;AAQA,SAAS,kBACd,OACA,OACiC;AACjC,MAAIC,WAAU,OAAO,SAAS,GAAG;AAC/B,oBAAgB,MAAM,OAAO;AAAA,EAC/B;AACA,yBAAuB,OAAO,KAAK;AACrC;AAYO,SAAS,iBACd,OACA,QAAe,cACiB;AAChC,QAAM,YAAY,sBAAsB,OAAO,KAAK;AACpD,QAAM,UAAU,eAAe,MAAM,WAAW,CAAC,GAAG,UAAU,OAAO,UAAU,SAAS;AACxF,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF;AACF;","names":["hasOwnKey","hasOwnKey"]}
@@ -1,35 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __esm = (fn, res) => function __init() {
8
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
- };
10
- var __commonJS = (cb, mod) => function __require() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
-
30
- export {
31
- __esm,
32
- __commonJS,
33
- __toESM
34
- };
35
- //# sourceMappingURL=chunk-AAWFTQHP.js.map
@@ -1,136 +0,0 @@
1
- import {
2
- defineWorld
3
- } from "./chunk-TL2M3LZH.js";
4
- import {
5
- init_esm_shims
6
- } from "./chunk-AAKXFFCU.js";
7
-
8
- // mud.config.ts
9
- init_esm_shims();
10
- var configInput = {
11
- namespace: "world",
12
- // NOTE: this namespace is only used for tables, the core system is deployed in the root namespace.
13
- codegen: {
14
- worldImportPath: "./src",
15
- worldgenDirectory: "interfaces",
16
- worldInterfaceName: "IBaseWorld"
17
- },
18
- userTypes: {
19
- ResourceId: { filePath: "@latticexyz/store/src/ResourceId.sol", type: "bytes32" }
20
- },
21
- tables: {
22
- NamespaceOwner: {
23
- schema: {
24
- namespaceId: "ResourceId",
25
- owner: "address"
26
- },
27
- key: ["namespaceId"]
28
- },
29
- ResourceAccess: {
30
- schema: {
31
- resourceId: "ResourceId",
32
- caller: "address",
33
- access: "bool"
34
- },
35
- key: ["resourceId", "caller"]
36
- },
37
- InstalledModules: {
38
- schema: {
39
- moduleAddress: "address",
40
- argumentsHash: "bytes32",
41
- // Hash of the params passed to the `install` function
42
- isInstalled: "bool"
43
- },
44
- key: ["moduleAddress", "argumentsHash"]
45
- },
46
- UserDelegationControl: {
47
- schema: {
48
- delegator: "address",
49
- delegatee: "address",
50
- delegationControlId: "ResourceId"
51
- },
52
- key: ["delegator", "delegatee"]
53
- },
54
- NamespaceDelegationControl: {
55
- schema: {
56
- namespaceId: "ResourceId",
57
- delegationControlId: "ResourceId"
58
- },
59
- key: ["namespaceId"]
60
- },
61
- Balances: {
62
- schema: {
63
- namespaceId: "ResourceId",
64
- balance: "uint256"
65
- },
66
- key: ["namespaceId"]
67
- },
68
- Systems: {
69
- schema: {
70
- systemId: "ResourceId",
71
- system: "address",
72
- publicAccess: "bool"
73
- },
74
- key: ["systemId"],
75
- codegen: {
76
- dataStruct: false
77
- }
78
- },
79
- SystemRegistry: {
80
- schema: {
81
- system: "address",
82
- systemId: "ResourceId"
83
- },
84
- key: ["system"]
85
- },
86
- SystemHooks: {
87
- schema: {
88
- systemId: "ResourceId",
89
- value: "bytes21[]"
90
- },
91
- key: ["systemId"]
92
- },
93
- FunctionSelectors: {
94
- schema: {
95
- worldFunctionSelector: "bytes4",
96
- systemId: "ResourceId",
97
- systemFunctionSelector: "bytes4"
98
- },
99
- key: ["worldFunctionSelector"],
100
- codegen: {
101
- dataStruct: false
102
- }
103
- },
104
- FunctionSignatures: {
105
- type: "offchainTable",
106
- schema: {
107
- functionSelector: "bytes4",
108
- functionSignature: "string"
109
- },
110
- key: ["functionSelector"]
111
- },
112
- InitModuleAddress: {
113
- schema: {
114
- value: "address"
115
- },
116
- key: []
117
- }
118
- },
119
- excludeSystems: [
120
- // Worldgen currently does not support systems inheriting logic
121
- // from other contracts, so all parts of RegistrationSystem are named
122
- // System too to be included in the IBaseWorld interface.
123
- // However, IStoreRegistrationSystem overlaps with IStore if
124
- // included in IBaseWorld, so it needs to be excluded from worldgen.
125
- // TODO: add support for inheritance to worldgen
126
- // (see: https://github.com/latticexyz/mud/issues/631)
127
- "StoreRegistrationSystem"
128
- ]
129
- };
130
- var mud_config_default = defineWorld(configInput);
131
-
132
- export {
133
- configInput,
134
- mud_config_default
135
- };
136
- //# sourceMappingURL=chunk-S5LARYWY.js.map
@@ -1,119 +0,0 @@
1
- import {
2
- CODEGEN_DEFAULTS,
3
- CONFIG_DEFAULTS,
4
- DEPLOY_DEFAULTS,
5
- MODULE_DEFAULTS,
6
- init_esm_shims,
7
- resolveNamespace,
8
- resolveSystems,
9
- validateNamespace,
10
- validateSystems
11
- } from "./chunk-AAKXFFCU.js";
12
-
13
- // ts/config/v2/namespaces.ts
14
- init_esm_shims();
15
- import { flatMorph } from "@ark/util";
16
- import { groupBy } from "@latticexyz/common/utils";
17
- import { AbiTypeScope, isObject, mergeIfUndefined } from "@latticexyz/store/internal";
18
- function validateNamespaces(namespaces, scope) {
19
- if (!isObject(namespaces)) {
20
- throw new Error(`Expected namespaces, received ${JSON.stringify(namespaces)}`);
21
- }
22
- for (const namespace of Object.values(namespaces)) {
23
- validateNamespace(namespace, scope);
24
- }
25
- }
26
- function resolveNamespaces(input, scope) {
27
- if (!isObject(input)) {
28
- throw new Error(`Expected namespaces config, received ${JSON.stringify(input)}`);
29
- }
30
- const namespaces = flatMorph(input, (label, namespace) => [
31
- label,
32
- resolveNamespace(mergeIfUndefined(namespace, { label }), scope)
33
- ]);
34
- const duplicates = Array.from(groupBy(Object.values(namespaces), (namespace) => namespace.namespace).entries()).filter(([, entries]) => entries.length > 1).map(([namespace]) => namespace);
35
- if (duplicates.length > 0) {
36
- throw new Error(`Found namespaces defined more than once in config: ${duplicates.join(", ")}`);
37
- }
38
- return namespaces;
39
- }
40
- function defineNamespaces(input, scope = AbiTypeScope) {
41
- validateNamespaces(input, scope);
42
- return resolveNamespaces(input, scope);
43
- }
44
-
45
- // ts/config/v2/codegen.ts
46
- init_esm_shims();
47
- import { isObject as isObject2, mergeIfUndefined as mergeIfUndefined2 } from "@latticexyz/store/internal";
48
- function resolveCodegen(codegen) {
49
- return isObject2(codegen) ? mergeIfUndefined2(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS;
50
- }
51
-
52
- // ts/config/v2/deploy.ts
53
- init_esm_shims();
54
- import { mergeIfUndefined as mergeIfUndefined3, isObject as isObject3 } from "@latticexyz/store/internal";
55
- function resolveDeploy(deploy) {
56
- return isObject3(deploy) ? mergeIfUndefined3(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS;
57
- }
58
-
59
- // ts/config/v2/world.ts
60
- init_esm_shims();
61
- import {
62
- extendedScope,
63
- get,
64
- mergeIfUndefined as mergeIfUndefined4,
65
- resolveStore,
66
- hasOwnKey,
67
- validateStore,
68
- flattenNamespacedTables
69
- } from "@latticexyz/store/internal";
70
- function validateWorld(input) {
71
- const scope = extendedScope(input);
72
- if (hasOwnKey(input, "namespaces")) {
73
- if (hasOwnKey(input, "namespace") || hasOwnKey(input, "tables") || hasOwnKey(input, "systems")) {
74
- throw new Error("Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.");
75
- }
76
- validateNamespaces(input.namespaces, scope);
77
- }
78
- if (hasOwnKey(input, "systems")) {
79
- validateSystems(input.systems);
80
- }
81
- validateStore(input);
82
- }
83
- function resolveWorld(input) {
84
- const scope = extendedScope(input);
85
- const store = resolveStore(input);
86
- const namespaces = input.namespaces ? resolveNamespaces(input.namespaces, scope) : resolveNamespaces({ [store.namespace]: input }, scope);
87
- const tables = flattenNamespacedTables({ namespaces });
88
- const modules = (input.modules ?? CONFIG_DEFAULTS.modules).map((mod) => mergeIfUndefined4(mod, MODULE_DEFAULTS));
89
- return mergeIfUndefined4(
90
- {
91
- ...store,
92
- namespaces,
93
- tables,
94
- // TODO: flatten systems from namespaces
95
- systems: !store.multipleNamespaces && input.systems ? resolveSystems(input.systems, store.namespace, store.namespace) : CONFIG_DEFAULTS.systems,
96
- excludeSystems: get(input, "excludeSystems"),
97
- codegen: mergeIfUndefined4(store.codegen, resolveCodegen(input.codegen)),
98
- deploy: resolveDeploy(input.deploy),
99
- modules
100
- },
101
- CONFIG_DEFAULTS
102
- );
103
- }
104
- function defineWorld(input) {
105
- validateWorld(input);
106
- return resolveWorld(input);
107
- }
108
-
109
- export {
110
- validateNamespaces,
111
- resolveNamespaces,
112
- defineNamespaces,
113
- resolveCodegen,
114
- resolveDeploy,
115
- validateWorld,
116
- resolveWorld,
117
- defineWorld
118
- };
119
- //# sourceMappingURL=chunk-TL2M3LZH.js.map