@latticexyz/world 3.0.0-main-e85dc5349 → 3.0.0-main-8f6fa588d
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.
- package/dist/chunk-DK3XOTC2.js +2 -0
- package/dist/chunk-DK3XOTC2.js.map +1 -0
- package/dist/chunk-OM2LE2WB.js +2 -0
- package/dist/chunk-OM2LE2WB.js.map +1 -0
- package/dist/{chunk-G7TYEQQ6.js → chunk-Z53LAQKB.js} +2 -2
- package/dist/config/v2.d.ts +3 -3
- package/dist/config/v2.js +1 -1
- package/dist/{dynamicResolution-e56fd658.d.ts → dynamicResolution-34391fca.d.ts} +18 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -5
- package/dist/internal.js +2 -2
- package/dist/internal.js.map +1 -1
- package/dist/mud.config.d.ts +24 -24
- package/dist/mud.config.js +1 -1
- package/dist/node.d.ts +2 -5
- package/dist/node.js +3 -3
- package/dist/node.js.map +1 -1
- package/dist/{world-75040f95.d.ts → world-ef5ac077.d.ts} +81 -33
- package/package.json +8 -13
- package/dist/chunk-5UFRBM64.js +0 -2
- package/dist/chunk-5UFRBM64.js.map +0 -1
- package/dist/chunk-E5NQ4W4F.js +0 -2
- package/dist/chunk-E5NQ4W4F.js.map +0 -1
- package/dist/chunk-H5QPQRXY.js +0 -2
- package/dist/chunk-H5QPQRXY.js.map +0 -1
- package/dist/chunk-KOZM4MYS.js +0 -2
- package/dist/chunk-KOZM4MYS.js.map +0 -1
- package/dist/chunk-NXAGBVBE.js +0 -2
- package/dist/chunk-NXAGBVBE.js.map +0 -1
- package/dist/defaults-1be1ffd2.d.ts +0 -20
- package/dist/register.d.ts +0 -20
- package/dist/register.js +0 -2
- package/dist/register.js.map +0 -1
- package/dist/types-971c9ea5.d.ts +0 -254
- /package/dist/{chunk-G7TYEQQ6.js.map → chunk-Z53LAQKB.js.map} +0 -0
@@ -1,11 +1,24 @@
|
|
1
|
-
import { show, conform, ErrorMessage, narrow, withJsDoc } from '@arktype/util';
|
1
|
+
import { show, conform, ErrorMessage, narrow, requiredKeyOf, withJsDoc } from '@arktype/util';
|
2
2
|
import { StoreInput, StoreWithShorthandsInput, resolveTable, mergeIfUndefined, getPath, extendedScope, Scope, AbiTypeScope, validateTables, UserTypes, resolveStore, Store } from '@latticexyz/store/config/v2';
|
3
|
-
import { V as ValueWithType,
|
4
|
-
import {
|
3
|
+
import { V as ValueWithType, c as DynamicResolution, W as World } from './dynamicResolution-34391fca.js';
|
4
|
+
import { Hex } from 'viem';
|
5
5
|
|
6
6
|
type SystemInput = {
|
7
|
-
/**
|
8
|
-
|
7
|
+
/**
|
8
|
+
* Human-readable system label. Used as config keys, interface names, and filenames.
|
9
|
+
* Labels are not length constrained like resource names, but special characters should be avoided to be compatible with the filesystem, Solidity compiler, etc.
|
10
|
+
*/
|
11
|
+
readonly label: string;
|
12
|
+
/**
|
13
|
+
* System namespace used in systems's resource ID and determines access control.
|
14
|
+
* Defaults to the nearest namespace in the config or root namespace if not set.
|
15
|
+
*/
|
16
|
+
readonly namespace?: string;
|
17
|
+
/**
|
18
|
+
* System name used in systems's resource ID.
|
19
|
+
* Defaults to the first 16 characters of `label` if not set.
|
20
|
+
*/
|
21
|
+
readonly name?: string;
|
9
22
|
/**
|
10
23
|
* Register function selectors for the system in the World.
|
11
24
|
* Defaults to true.
|
@@ -13,14 +26,14 @@ type SystemInput = {
|
|
13
26
|
* - For root systems all World function selectors will correspond to the system's function selectors.
|
14
27
|
* - For non-root systems, the World function selectors will be <namespace>__<function>.
|
15
28
|
*/
|
16
|
-
registerFunctionSelectors?: boolean;
|
29
|
+
readonly registerFunctionSelectors?: boolean;
|
17
30
|
/** If openAccess is true, any address can call the system */
|
18
|
-
openAccess?: boolean;
|
31
|
+
readonly openAccess?: boolean;
|
19
32
|
/** An array of addresses or system names that can access the system */
|
20
|
-
accessList?: readonly string[];
|
33
|
+
readonly accessList?: readonly string[];
|
21
34
|
};
|
22
35
|
type SystemsInput = {
|
23
|
-
[
|
36
|
+
readonly [label: string]: Omit<SystemInput, "label" | "namespace">;
|
24
37
|
};
|
25
38
|
type ModuleInputArtifactPath = {
|
26
39
|
/**
|
@@ -51,29 +64,29 @@ type ModuleInput = ModuleInputArtifactPath & {
|
|
51
64
|
};
|
52
65
|
type DeployInput = {
|
53
66
|
/** The name of a custom World contract to deploy. If no name is provided, a default MUD World is deployed. */
|
54
|
-
customWorldContract?: never;
|
67
|
+
readonly customWorldContract?: never;
|
55
68
|
/**
|
56
69
|
* Script to execute after the deployment is complete (Default "PostDeploy").
|
57
70
|
* Script must be placed in the forge scripts directory (see foundry.toml) and have a ".s.sol" extension.
|
58
71
|
*/
|
59
|
-
postDeployScript?: string;
|
72
|
+
readonly postDeployScript?: string;
|
60
73
|
/** Directory to write the deployment info to (Default "./deploys") */
|
61
|
-
deploysDirectory?: string;
|
74
|
+
readonly deploysDirectory?: string;
|
62
75
|
/** JSON file to write to with chain -> latest world deploy address (Default "./worlds.json") */
|
63
|
-
worldsFile?: string;
|
76
|
+
readonly worldsFile?: string;
|
64
77
|
/** Deploy the World as an upgradeable proxy */
|
65
|
-
upgradeableWorldImplementation?: boolean;
|
78
|
+
readonly upgradeableWorldImplementation?: boolean;
|
66
79
|
};
|
67
80
|
type CodegenInput = {
|
68
81
|
/** The name of the World interface to generate. (Default `IWorld`) */
|
69
|
-
worldInterfaceName?: string;
|
82
|
+
readonly worldInterfaceName?: string;
|
70
83
|
/** Directory to output system and world interfaces of `worldgen` (Default "world") */
|
71
|
-
worldgenDirectory?: string;
|
84
|
+
readonly worldgenDirectory?: string;
|
72
85
|
/** Path for world package imports. Default is "@latticexyz/world/src/" */
|
73
|
-
worldImportPath?: string;
|
86
|
+
readonly worldImportPath?: string;
|
74
87
|
};
|
75
88
|
type WorldInput = show<StoreInput & {
|
76
|
-
namespaces?: NamespacesInput;
|
89
|
+
readonly namespaces?: NamespacesInput;
|
77
90
|
/**
|
78
91
|
* Contracts named *System will be deployed by default
|
79
92
|
* as public systems at `namespace/ContractName`, unless overridden
|
@@ -81,18 +94,18 @@ type WorldInput = show<StoreInput & {
|
|
81
94
|
* The key is the system name (capitalized).
|
82
95
|
* The value is a SystemConfig object.
|
83
96
|
*/
|
84
|
-
systems?: SystemsInput;
|
97
|
+
readonly systems?: SystemsInput;
|
85
98
|
/** System names to exclude from codegen and deployment */
|
86
|
-
excludeSystems?: readonly string[];
|
99
|
+
readonly excludeSystems?: readonly string[];
|
87
100
|
/** Modules to install in the World */
|
88
|
-
modules?: readonly ModuleInput[];
|
101
|
+
readonly modules?: readonly ModuleInput[];
|
89
102
|
/** Deploy config */
|
90
|
-
deploy?: DeployInput;
|
103
|
+
readonly deploy?: DeployInput;
|
91
104
|
/** Codegen config */
|
92
|
-
codegen?: CodegenInput;
|
105
|
+
readonly codegen?: CodegenInput;
|
93
106
|
}>;
|
94
107
|
type NamespacesInput = {
|
95
|
-
[label: string]: NamespaceInput;
|
108
|
+
readonly [label: string]: NamespaceInput;
|
96
109
|
};
|
97
110
|
type NamespaceInput = Pick<StoreInput, "tables">;
|
98
111
|
/******** Variations with shorthands ********/
|
@@ -116,6 +129,13 @@ type resolveNamespacedTables<world> = "namespaces" extends keyof world ? {
|
|
116
129
|
}>, extendedScope<world>> : never;
|
117
130
|
} : {};
|
118
131
|
|
132
|
+
declare const SYSTEM_DEFAULTS: {
|
133
|
+
readonly namespace: "";
|
134
|
+
readonly registerFunctionSelectors: true;
|
135
|
+
readonly openAccess: true;
|
136
|
+
readonly accessList: readonly [];
|
137
|
+
};
|
138
|
+
type SYSTEM_DEFAULTS = typeof SYSTEM_DEFAULTS;
|
119
139
|
declare const CODEGEN_DEFAULTS: {
|
120
140
|
readonly worldInterfaceName: "IWorld";
|
121
141
|
readonly worldgenDirectory: "world";
|
@@ -150,10 +170,38 @@ declare const CONFIG_DEFAULTS: {
|
|
150
170
|
};
|
151
171
|
type CONFIG_DEFAULTS = typeof CONFIG_DEFAULTS;
|
152
172
|
|
153
|
-
type
|
154
|
-
|
173
|
+
type ValidateSystemOptions = {
|
174
|
+
readonly inNamespace?: true;
|
175
|
+
};
|
176
|
+
type requiredSystemKey<inNamespace extends true | undefined> = Exclude<requiredKeyOf<SystemInput>, inNamespace extends true ? "label" | "namespace" : never>;
|
177
|
+
type validateSystem<input, options extends ValidateSystemOptions = {}> = {
|
178
|
+
[key in keyof input | requiredSystemKey<options["inNamespace"]>]: key extends keyof SystemInput ? key extends "label" | "namespace" ? options["inNamespace"] extends true ? ErrorMessage<"Overrides of `label` and `namespace` are not allowed for systems in this context."> : key extends keyof input ? narrow<input[key]> : never : SystemInput[key] : ErrorMessage<`Key \`${key & string}\` does not exist in SystemInput`>;
|
179
|
+
};
|
180
|
+
declare function validateSystem<input>(input: input, options?: ValidateSystemOptions): asserts input is SystemInput & input;
|
181
|
+
type resolveSystem<input> = input extends SystemInput ? {
|
182
|
+
readonly label: input["label"];
|
183
|
+
readonly namespace: undefined extends input["namespace"] ? SYSTEM_DEFAULTS["namespace"] : input["namespace"];
|
184
|
+
readonly name: string;
|
185
|
+
readonly systemId: Hex;
|
186
|
+
readonly registerFunctionSelectors: undefined extends input["registerFunctionSelectors"] ? SYSTEM_DEFAULTS["registerFunctionSelectors"] : input["registerFunctionSelectors"];
|
187
|
+
readonly openAccess: undefined extends input["openAccess"] ? SYSTEM_DEFAULTS["openAccess"] : input["openAccess"];
|
188
|
+
readonly accessList: undefined extends input["accessList"] ? SYSTEM_DEFAULTS["accessList"] : input["accessList"];
|
189
|
+
} : never;
|
190
|
+
declare function resolveSystem<input extends SystemInput>(input: input): resolveSystem<input>;
|
191
|
+
|
192
|
+
type validateSystems<input> = {
|
193
|
+
[label in keyof input]: input[label] extends object ? validateSystem<input[label], {
|
194
|
+
inNamespace: true;
|
195
|
+
}> : ErrorMessage<`Expected a system config for ${label & string}.`>;
|
196
|
+
};
|
197
|
+
declare function validateSystems(input: unknown): asserts input is SystemsInput;
|
198
|
+
type resolveSystems<systems extends SystemsInput, namespace extends string> = {
|
199
|
+
[label in keyof systems]: resolveSystem<systems[label] & {
|
200
|
+
label: label;
|
201
|
+
namespace: namespace;
|
202
|
+
}>;
|
155
203
|
};
|
156
|
-
declare function resolveSystems<systems extends SystemsInput>(systems: systems): resolveSystems<systems>;
|
204
|
+
declare function resolveSystems<systems extends SystemsInput, namespace extends string>(systems: systems, namespace: namespace): resolveSystems<systems, namespace>;
|
157
205
|
|
158
206
|
type resolveCodegen<codegen> = codegen extends {} ? mergeIfUndefined<codegen, CODEGEN_DEFAULTS> : CODEGEN_DEFAULTS;
|
159
207
|
declare function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen>;
|
@@ -162,14 +210,14 @@ type resolveDeploy<deploy> = deploy extends {} ? mergeIfUndefined<deploy, DEPLOY
|
|
162
210
|
declare function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy>;
|
163
211
|
|
164
212
|
type validateWorld<world> = {
|
165
|
-
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" ? ErrorMessage<`Namespaces config will be enabled soon.`> : key extends keyof WorldInput ? conform<world[key], WorldInput[key]> : ErrorMessage<`\`${key & string}\` is not a valid World config option.`>;
|
213
|
+
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 "systems" ? validateSystems<world[key]> : key extends "namespaces" ? ErrorMessage<`Namespaces config will be enabled soon.`> : key extends keyof WorldInput ? conform<world[key], WorldInput[key]> : ErrorMessage<`\`${key & string}\` is not a valid World config option.`>;
|
166
214
|
};
|
167
215
|
declare function validateWorld(world: unknown): asserts world is WorldInput;
|
168
|
-
type resolveWorld<world> = withJsDoc<resolveStore<world> & mergeIfUndefined<{
|
169
|
-
tables: resolveNamespacedTables<world>;
|
170
|
-
} &
|
171
|
-
[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];
|
172
|
-
},
|
216
|
+
type resolveWorld<world, namespace = resolveStore<world>["namespace"]> = withJsDoc<resolveStore<world> & mergeIfUndefined<{
|
217
|
+
readonly tables: resolveNamespacedTables<world>;
|
218
|
+
} & {
|
219
|
+
[key in Exclude<keyof world, "namespaces" | keyof Store>]: key extends "systems" ? resolveSystems<world[key] & SystemsInput, namespace & string> : key extends "deploy" ? resolveDeploy<world[key]> : key extends "codegen" ? resolveCodegen<world[key]> : world[key];
|
220
|
+
}, CONFIG_DEFAULTS>, World>;
|
173
221
|
declare function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world>;
|
174
222
|
declare function defineWorld<const input>(input: validateWorld<input>): resolveWorld<input>;
|
175
223
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@latticexyz/world",
|
3
|
-
"version": "3.0.0-main-
|
3
|
+
"version": "3.0.0-main-8f6fa588d",
|
4
4
|
"description": "World framework",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -14,7 +14,6 @@
|
|
14
14
|
"./internal": "./dist/internal.js",
|
15
15
|
"./mud.config": "./dist/mud.config.js",
|
16
16
|
"./config/v2": "./dist/config/v2.js",
|
17
|
-
"./register": "./dist/register.js",
|
18
17
|
"./node": "./dist/node.js",
|
19
18
|
"./out/*": "./out/*"
|
20
19
|
},
|
@@ -32,9 +31,6 @@
|
|
32
31
|
"config/v2": [
|
33
32
|
"./dist/config/v2.d.ts"
|
34
33
|
],
|
35
|
-
"register": [
|
36
|
-
"./dist/register.d.ts"
|
37
|
-
],
|
38
34
|
"node": [
|
39
35
|
"./dist/node.d.ts"
|
40
36
|
]
|
@@ -51,12 +47,11 @@
|
|
51
47
|
"abitype": "1.0.0",
|
52
48
|
"arktype": "1.0.29-alpha",
|
53
49
|
"viem": "2.9.20",
|
54
|
-
"
|
55
|
-
"@latticexyz/
|
56
|
-
"@latticexyz/
|
57
|
-
"@latticexyz/
|
58
|
-
"@latticexyz/
|
59
|
-
"@latticexyz/store": "3.0.0-main-e85dc5349"
|
50
|
+
"@latticexyz/common": "3.0.0-main-8f6fa588d",
|
51
|
+
"@latticexyz/config": "3.0.0-main-8f6fa588d",
|
52
|
+
"@latticexyz/protocol-parser": "3.0.0-main-8f6fa588d",
|
53
|
+
"@latticexyz/schema-type": "3.0.0-main-8f6fa588d",
|
54
|
+
"@latticexyz/store": "3.0.0-main-8f6fa588d"
|
60
55
|
},
|
61
56
|
"devDependencies": {
|
62
57
|
"@arktype/attest": "0.7.5",
|
@@ -71,8 +66,8 @@
|
|
71
66
|
"tsup": "^6.7.0",
|
72
67
|
"tsx": "^3.12.6",
|
73
68
|
"vitest": "0.34.6",
|
74
|
-
"@latticexyz/abi-ts": "3.0.0-main-
|
75
|
-
"@latticexyz/gas-report": "3.0.0-main-
|
69
|
+
"@latticexyz/abi-ts": "3.0.0-main-8f6fa588d",
|
70
|
+
"@latticexyz/gas-report": "3.0.0-main-8f6fa588d"
|
76
71
|
},
|
77
72
|
"scripts": {
|
78
73
|
"build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js",
|
package/dist/chunk-5UFRBM64.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
var o={registerFunctionSelectors:!0,openAccess:!0,accessList:[]},s={root:!1,args:[],artifactPath:void 0},t={worldInterfaceName:"IWorld",worldgenDirectory:"world",worldImportPath:"@latticexyz/world/src/"},e={customWorldContract:void 0,postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json",upgradeableWorldImplementation:!1},r={systems:{},tables:{},excludeSystems:[],modules:[],codegen:t,deploy:e};export{o as a,s as b,t as c,e as d,r as e};
|
2
|
-
//# sourceMappingURL=chunk-5UFRBM64.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../ts/config/v2/defaults.ts"],"sourcesContent":["import { CodegenInput, DeployInput, ModuleInput, SystemInput, WorldInput } from \"./input\";\n\nexport const SYSTEM_DEFAULTS = {\n registerFunctionSelectors: true,\n openAccess: true,\n accessList: [],\n} as const satisfies SystemInput;\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 worldImportPath: \"@latticexyz/world/src/\",\n} as const satisfies CodegenInput;\n\nexport type CODEGEN_DEFAULTS = typeof CODEGEN_DEFAULTS;\n\nexport const DEPLOY_DEFAULTS = {\n customWorldContract: undefined,\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"],"mappings":"AAEO,IAAMA,EAAkB,CAC7B,0BAA2B,GAC3B,WAAY,GACZ,WAAY,CAAC,CACf,EAIaC,EAAkB,CAC7B,KAAM,GACN,KAAM,CAAC,EACP,aAAc,MAChB,EAIaC,EAAmB,CAC9B,mBAAoB,SACpB,kBAAmB,QACnB,gBAAiB,wBACnB,EAIaC,EAAkB,CAC7B,oBAAqB,OACrB,iBAAkB,aAClB,iBAAkB,YAClB,WAAY,gBACZ,+BAAgC,EAClC,EAIaC,EAAkB,CAC7B,QAAS,CAAC,EACV,OAAQ,CAAC,EACT,eAAgB,CAAC,EACjB,QAAS,CAAC,EACV,QAASF,EACT,OAAQC,CACV","names":["SYSTEM_DEFAULTS","MODULE_DEFAULTS","CODEGEN_DEFAULTS","DEPLOY_DEFAULTS","CONFIG_DEFAULTS"]}
|
package/dist/chunk-E5NQ4W4F.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
var e={registerFunctionSelector:!0,openAccess:!0,accessList:[]},o={worldContractName:void 0,worldInterfaceName:"IWorld",systems:{},excludeSystems:[],postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json",worldgenDirectory:"world",worldImportPath:"@latticexyz/world/src/"};export{e as a,o as b};
|
2
|
-
//# sourceMappingURL=chunk-E5NQ4W4F.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../ts/config/defaults.ts"],"sourcesContent":["export const SYSTEM_DEFAULTS = {\n registerFunctionSelector: true,\n openAccess: true,\n accessList: [],\n} as const;\n\nexport type SYSTEM_DEFAULTS = typeof SYSTEM_DEFAULTS;\n\nexport const WORLD_DEFAULTS = {\n worldContractName: undefined,\n worldInterfaceName: \"IWorld\",\n systems: {},\n excludeSystems: [],\n postDeployScript: \"PostDeploy\",\n deploysDirectory: \"./deploys\",\n worldsFile: \"./worlds.json\",\n worldgenDirectory: \"world\",\n worldImportPath: \"@latticexyz/world/src/\",\n} as const;\n\nexport type WORLD_DEFAULTS = typeof WORLD_DEFAULTS;\n"],"mappings":"AAAO,IAAMA,EAAkB,CAC7B,yBAA0B,GAC1B,WAAY,GACZ,WAAY,CAAC,CACf,EAIaC,EAAiB,CAC5B,kBAAmB,OACnB,mBAAoB,SACpB,QAAS,CAAC,EACV,eAAgB,CAAC,EACjB,iBAAkB,aAClB,iBAAkB,YAClB,WAAY,gBACZ,kBAAmB,QACnB,gBAAiB,wBACnB","names":["SYSTEM_DEFAULTS","WORLD_DEFAULTS"]}
|
package/dist/chunk-H5QPQRXY.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
var h=Object.create;var f=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var m=(b,a,c)=>a in b?f(b,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):b[a]=c;var o=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var n=(b,a,c,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of j(a))!l.call(b,e)&&e!==c&&f(b,e,{get:()=>a[e],enumerable:!(d=i(a,e))||d.enumerable});return b};var p=(b,a,c)=>(c=b!=null?h(k(b)):{},n(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));var q=(b,a,c)=>(m(b,typeof a!="symbol"?a+"":a,c),c),g=(b,a,c)=>{if(!a.has(b))throw TypeError("Cannot "+c)};var r=(b,a,c)=>(g(b,a,"read from private field"),c?c.call(b):a.get(b)),s=(b,a,c)=>{if(a.has(b))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(b):a.set(b,c)},t=(b,a,c,d)=>(g(b,a,"write to private field"),d?d.call(b,c):a.set(b,c),c);var u=(b,a,c)=>(g(b,a,"access private method"),c);export{o as a,p as b,q as c,r as d,s as e,t as f,u as g};
|
2
|
-
//# sourceMappingURL=chunk-H5QPQRXY.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/chunk-KOZM4MYS.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
import{a as i}from"./chunk-E5NQ4W4F.js";import{b as c,c as p,d,e as t}from"./chunk-5UFRBM64.js";import{extendedScope as S,get as A,resolveTable as W,validateTable as L,mergeIfUndefined as r,resolveStore as F,hasOwnKey as C,validateStore as j}from"@latticexyz/store/config/v2";import{mapObject as g}from"@latticexyz/common/utils";import{mergeIfUndefined as T}from"@latticexyz/store/config/v2";function y(e){return g(e,s=>T(s,i))}import{validateTables as E,isObject as I,hasOwnKey as w}from"@latticexyz/store/config/v2";function D(e,s){w(e,"tables")&&E(e.tables,s)}function f(e,s){if(!I(e))throw new Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let n of Object.values(e))D(n,s)}import{isObject as U,mergeIfUndefined as N}from"@latticexyz/store/config/v2";function v(e){return U(e)?N(e,p):p}import{mergeIfUndefined as O,isObject as _}from"@latticexyz/store/config/v2";function b(e){return _(e)?O(e,d):d}function $(e){let s=S(e);j(e),C(e,"namespaces")&&f(e.namespaces,s)}function M(e){let s=S(e),n=e.namespaces??{},x=Object.fromEntries(Object.entries(n).map(([o,u])=>Object.entries(u.tables??{}).map(([l,m])=>(L(m,s),[`${o}__${l}`,W(r(m,{namespace:o,name:l}),s)]))).flat()),a=F(e),k=(e.modules??t.modules).map(o=>r(o,c));return r({...a,tables:{...a.tables,...x},codegen:r(a.codegen,v(e.codegen)),deploy:b(e.deploy),systems:y(e.systems??t.systems),excludeSystems:A(e,"excludeSystems"),modules:k},t)}function ye(e){return $(e),M(e)}export{$ as a,M as b,ye as c};
|
2
|
-
//# sourceMappingURL=chunk-KOZM4MYS.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../ts/config/v2/world.ts","../ts/config/v2/systems.ts","../ts/config/v2/namespaces.ts","../ts/config/v2/codegen.ts","../ts/config/v2/deploy.ts"],"sourcesContent":["import { ErrorMessage, conform, narrow, type withJsDoc } 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} from \"@latticexyz/store/config/v2\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS, MODULE_DEFAULTS } from \"./defaults\";\nimport { Tables } from \"@latticexyz/store/internal\";\nimport { resolveSystems } from \"./systems\";\nimport { resolveNamespacedTables, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\nimport type { World } from \"./output.js\";\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 ErrorMessage<`Namespaces config will be enabled soon.`>\n : key extends keyof WorldInput\n ? conform<world[key], WorldInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid World config option.`>;\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 validateNamespaces(world.namespaces, scope);\n }\n}\n\nexport type resolveWorld<world> = withJsDoc<\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 CONFIG_DEFAULTS\n >,\n World\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 const modules = (world.modules ?? CONFIG_DEFAULTS.modules).map((mod) => mergeIfUndefined(mod, MODULE_DEFAULTS));\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,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const input>(input: validateWorld<input>): resolveWorld<input> {\n validateWorld(input);\n return resolveWorld(input) as never;\n}\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 [label in keyof systems]: mergeIfUndefined<systems[label], 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 {\n Scope,\n AbiTypeScope,\n validateTables,\n isObject,\n hasOwnKey,\n resolveTable,\n mergeIfUndefined,\n extendedScope,\n getPath,\n} from \"@latticexyz/store/config/v2\";\nimport { NamespaceInput, NamespacesInput } from \"./input\";\nimport { ErrorMessage, conform } from \"@arktype/util\";\n\nexport type namespacedTableKeys<world> = world extends { namespaces: infer namespaces }\n ? {\n [k in keyof namespaces]: namespaces[k] extends { tables: infer tables }\n ? `${k & string}__${keyof tables & string}`\n : never;\n }[keyof namespaces]\n : never;\n\nexport type validateNamespace<namespace, scope extends Scope = AbiTypeScope> = {\n readonly [key in keyof namespace]: key extends \"tables\"\n ? validateTables<namespace[key], scope>\n : key extends keyof NamespaceInput\n ? conform<namespace[key], NamespaceInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid namespace config option.`>;\n};\n\nexport function validateNamespace<scope extends Scope = AbiTypeScope>(\n namespace: unknown,\n scope: scope,\n): asserts namespace is NamespaceInput {\n if (hasOwnKey(namespace, \"tables\")) {\n validateTables(namespace.tables, scope);\n }\n}\n\nexport type validateNamespaces<namespaces, scope extends Scope = AbiTypeScope> = {\n [label in keyof namespaces]: validateNamespace<namespaces[label], scope>;\n};\n\nexport function validateNamespaces<scope extends Scope = AbiTypeScope>(\n namespaces: unknown,\n scope: scope,\n): asserts namespaces is NamespacesInput {\n if (!isObject(namespaces)) {\n throw new Error(`Expected namespaces, received ${JSON.stringify(namespaces)}`);\n }\n for (const namespace of Object.values(namespaces)) {\n validateNamespace(namespace, scope);\n }\n}\n\nexport type resolveNamespacedTables<world> = \"namespaces\" extends keyof world\n ? {\n readonly [key in namespacedTableKeys<world>]: key extends `${infer namespace}__${infer table}`\n ? resolveTable<\n mergeIfUndefined<\n getPath<world, [\"namespaces\", namespace, \"tables\", table]>,\n { name: table; namespace: namespace }\n >,\n extendedScope<world>\n >\n : never;\n }\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, CODEGEN_DEFAULTS>\n : CODEGEN_DEFAULTS;\n\nexport function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen> {\n return (isObject(codegen) ? mergeIfUndefined(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS) as never;\n}\n","import { mergeIfUndefined, isObject } from \"@latticexyz/store/config/v2\";\nimport { DEPLOY_DEFAULTS } from \"./defaults\";\n\nexport type resolveDeploy<deploy> = deploy extends {} ? mergeIfUndefined<deploy, DEPLOY_DEFAULTS> : DEPLOY_DEFAULTS;\n\nexport function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy> {\n return (isObject(deploy) ? mergeIfUndefined(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS) as never;\n}\n"],"mappings":"gGACA,OAEE,iBAAAA,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,oBAAAC,EAEA,gBAAAC,EAEA,aAAAC,EACA,iBAAAC,MACK,8BCbP,OAAS,aAAAC,MAAiB,2BAG1B,OAAS,oBAAAC,MAAwB,8BAM1B,SAASC,EAA6CC,EAA2C,CACtG,OAAOC,EAAUD,EAAUE,GAAWJ,EAAiBI,EAAQC,CAAe,CAAC,CACjF,CCXA,OAGE,kBAAAC,EACA,YAAAC,EACA,aAAAC,MAKK,8BAoBA,SAASC,EACdC,EACAC,EACqC,CACjCH,EAAUE,EAAW,QAAQ,GAC/BJ,EAAeI,EAAU,OAAQC,CAAK,CAE1C,CAMO,SAASC,EACdC,EACAF,EACuC,CACvC,GAAI,CAACJ,EAASM,CAAU,EACtB,MAAM,IAAI,MAAM,iCAAiC,KAAK,UAAUA,CAAU,GAAG,EAE/E,QAAWH,KAAa,OAAO,OAAOG,CAAU,EAC9CJ,EAAkBC,EAAWC,CAAK,CAEtC,CCrDA,OAAS,YAAAG,EAAU,oBAAAC,MAAwB,8BAOpC,SAASC,EAAwBC,EAA2C,CACjF,OAAQC,EAASD,CAAO,EAAIE,EAAiBF,EAASG,CAAgB,EAAIA,CAC5E,CCTA,OAAS,oBAAAC,EAAkB,YAAAC,MAAgB,8BAKpC,SAASC,EAAsBC,EAAuC,CAC3E,OAAQC,EAASD,CAAM,EAAIE,EAAiBF,EAAQG,CAAe,EAAIA,CACzE,CJ+BO,SAASC,EAAcC,EAA6C,CACzE,IAAMC,EAAQC,EAAcF,CAAK,EACjCG,EAAcH,CAAK,EAEfI,EAAUJ,EAAO,YAAY,GAC/BK,EAAmBL,EAAM,WAAYC,CAAK,CAE9C,CAsBO,SAASK,EAA6CN,EAAmC,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAC3BO,EAAaP,EAAM,YAAc,CAAC,EAElCQ,EAA2B,OAAO,YACtC,OAAO,QAAQD,CAAU,EACtB,IAAI,CAAC,CAACE,EAAcC,CAAS,IAC5B,OAAO,QAAQA,EAAU,QAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAACC,EAAUC,CAAK,KAC1DC,EAAcD,EAAOX,CAAK,EACnB,CACL,GAAGQ,MAAiBE,IACpBG,EAAaC,EAAiBH,EAAO,CAAE,UAAWH,EAAc,KAAME,CAAS,CAAC,EAAGV,CAAK,CAC1F,EACD,CACH,EACC,KAAK,CACV,EAEMe,EAAgBC,EAAajB,CAAK,EAElCkB,GAAWlB,EAAM,SAAWmB,EAAgB,SAAS,IAAKC,GAAQL,EAAiBK,EAAKC,CAAe,CAAC,EAE9G,OAAON,EACL,CACE,GAAGC,EACH,OAAQ,CAAE,GAAGA,EAAc,OAAQ,GAAGR,CAAyB,EAC/D,QAASO,EAAiBC,EAAc,QAASM,EAAetB,EAAM,OAAO,CAAC,EAC9E,OAAQuB,EAAcvB,EAAM,MAAM,EAClC,QAASwB,EAAexB,EAAM,SAAWmB,EAAgB,OAAO,EAChE,eAAgBM,EAAIzB,EAAO,gBAAgB,EAC3C,QAAAkB,CACF,EACAC,CACF,CACF,CAEO,SAASO,GAAyBC,EAAkD,CACzF,OAAA5B,EAAc4B,CAAK,EACZrB,EAAaqB,CAAK,CAC3B","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","resolveStore","hasOwnKey","validateStore","mapObject","mergeIfUndefined","resolveSystems","systems","mapObject","system","SYSTEM_DEFAULTS","validateTables","isObject","hasOwnKey","validateNamespace","namespace","scope","validateNamespaces","namespaces","isObject","mergeIfUndefined","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","mergeIfUndefined","isObject","resolveDeploy","deploy","isObject","mergeIfUndefined","DEPLOY_DEFAULTS","validateWorld","world","scope","extendedScope","validateStore","hasOwnKey","validateNamespaces","resolveWorld","namespaces","resolvedNamespacedTables","namespaceKey","namespace","tableKey","table","validateTable","resolveTable","mergeIfUndefined","resolvedStore","resolveStore","modules","CONFIG_DEFAULTS","mod","MODULE_DEFAULTS","resolveCodegen","resolveDeploy","resolveSystems","get","defineWorld","input"]}
|
package/dist/chunk-NXAGBVBE.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
import{a as o,b as t}from"./chunk-E5NQ4W4F.js";import{z as e}from"zod";import{zEthereumAddress as s,zName as l,zObjectName as c}from"@latticexyz/config/library";var r=c,a=e.array(r.or(s)).readonly().default(o.accessList),n=e.intersection(e.object({name:l.optional(),registerFunctionSelectors:e.boolean().default(o.registerFunctionSelector)}),e.discriminatedUnion("openAccess",[e.object({openAccess:e.literal(!0).default(o.openAccess)}),e.object({openAccess:e.literal(!1),accessList:a})])),i=e.object({worldContractName:e.string().optional(),worldInterfaceName:e.string().default(t.worldInterfaceName),systems:e.record(r,n).default(t.systems),excludeSystems:e.array(r).readonly().default(t.excludeSystems),postDeployScript:e.string().default(t.postDeployScript),deploysDirectory:e.string().default(t.deploysDirectory),worldsFile:e.string().default(t.worldsFile),worldgenDirectory:e.string().default(t.worldgenDirectory),worldImportPath:e.string().default(t.worldImportPath)}),f=i.catchall(e.any());export{i as a,f as b};
|
2
|
-
//# sourceMappingURL=chunk-NXAGBVBE.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../ts/config/worldConfig.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { zEthereumAddress, zName, zObjectName } from \"@latticexyz/config/library\";\nimport { SYSTEM_DEFAULTS, WORLD_DEFAULTS } from \"./defaults\";\n\nconst zSystemName = zObjectName;\nconst zSystemAccessList = z.array(zSystemName.or(zEthereumAddress)).readonly().default(SYSTEM_DEFAULTS.accessList);\n\n// The system config is a combination of a name config and access config\nconst zSystemConfig = z.intersection(\n z.object({\n name: zName.optional(),\n registerFunctionSelectors: z.boolean().default(SYSTEM_DEFAULTS.registerFunctionSelector),\n }),\n z.discriminatedUnion(\"openAccess\", [\n z.object({\n openAccess: z.literal(true).default(SYSTEM_DEFAULTS.openAccess),\n }),\n z.object({\n openAccess: z.literal(false),\n accessList: zSystemAccessList,\n }),\n ]),\n);\n\n// The parsed world config is the result of parsing the user config\nexport const zWorldConfig = z.object({\n worldContractName: z.string().optional(),\n worldInterfaceName: z.string().default(WORLD_DEFAULTS.worldInterfaceName),\n systems: z.record(zSystemName, zSystemConfig).default(WORLD_DEFAULTS.systems),\n excludeSystems: z.array(zSystemName).readonly().default(WORLD_DEFAULTS.excludeSystems),\n postDeployScript: z.string().default(WORLD_DEFAULTS.postDeployScript),\n deploysDirectory: z.string().default(WORLD_DEFAULTS.deploysDirectory),\n worldsFile: z.string().default(WORLD_DEFAULTS.worldsFile),\n worldgenDirectory: z.string().default(WORLD_DEFAULTS.worldgenDirectory),\n worldImportPath: z.string().default(WORLD_DEFAULTS.worldImportPath),\n});\n\n// Catchall preserves other plugins' options\nexport const zPluginWorldConfig = zWorldConfig.catchall(z.any());\n"],"mappings":"+CAAA,OAAS,KAAAA,MAAS,MAClB,OAAS,oBAAAC,EAAkB,SAAAC,EAAO,eAAAC,MAAmB,6BAGrD,IAAMC,EAAcC,EACdC,EAAoBC,EAAE,MAAMH,EAAY,GAAGI,CAAgB,CAAC,EAAE,SAAS,EAAE,QAAQC,EAAgB,UAAU,EAG3GC,EAAgBH,EAAE,aACtBA,EAAE,OAAO,CACP,KAAMI,EAAM,SAAS,EACrB,0BAA2BJ,EAAE,QAAQ,EAAE,QAAQE,EAAgB,wBAAwB,CACzF,CAAC,EACDF,EAAE,mBAAmB,aAAc,CACjCA,EAAE,OAAO,CACP,WAAYA,EAAE,QAAQ,EAAI,EAAE,QAAQE,EAAgB,UAAU,CAChE,CAAC,EACDF,EAAE,OAAO,CACP,WAAYA,EAAE,QAAQ,EAAK,EAC3B,WAAYD,CACd,CAAC,CACH,CAAC,CACH,EAGaM,EAAeL,EAAE,OAAO,CACnC,kBAAmBA,EAAE,OAAO,EAAE,SAAS,EACvC,mBAAoBA,EAAE,OAAO,EAAE,QAAQM,EAAe,kBAAkB,EACxE,QAASN,EAAE,OAAOH,EAAaM,CAAa,EAAE,QAAQG,EAAe,OAAO,EAC5E,eAAgBN,EAAE,MAAMH,CAAW,EAAE,SAAS,EAAE,QAAQS,EAAe,cAAc,EACrF,iBAAkBN,EAAE,OAAO,EAAE,QAAQM,EAAe,gBAAgB,EACpE,iBAAkBN,EAAE,OAAO,EAAE,QAAQM,EAAe,gBAAgB,EACpE,WAAYN,EAAE,OAAO,EAAE,QAAQM,EAAe,UAAU,EACxD,kBAAmBN,EAAE,OAAO,EAAE,QAAQM,EAAe,iBAAiB,EACtE,gBAAiBN,EAAE,OAAO,EAAE,QAAQM,EAAe,eAAe,CACpE,CAAC,EAGYC,EAAqBF,EAAa,SAASL,EAAE,IAAI,CAAC","names":["z","zEthereumAddress","zName","zObjectName","zSystemName","zObjectName","zSystemAccessList","z","zEthereumAddress","SYSTEM_DEFAULTS","zSystemConfig","zName","zWorldConfig","WORLD_DEFAULTS","zPluginWorldConfig"]}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
declare const SYSTEM_DEFAULTS: {
|
2
|
-
readonly registerFunctionSelector: true;
|
3
|
-
readonly openAccess: true;
|
4
|
-
readonly accessList: readonly [];
|
5
|
-
};
|
6
|
-
type SYSTEM_DEFAULTS = typeof SYSTEM_DEFAULTS;
|
7
|
-
declare const WORLD_DEFAULTS: {
|
8
|
-
readonly worldContractName: undefined;
|
9
|
-
readonly worldInterfaceName: "IWorld";
|
10
|
-
readonly systems: {};
|
11
|
-
readonly excludeSystems: readonly [];
|
12
|
-
readonly postDeployScript: "PostDeploy";
|
13
|
-
readonly deploysDirectory: "./deploys";
|
14
|
-
readonly worldsFile: "./worlds.json";
|
15
|
-
readonly worldgenDirectory: "world";
|
16
|
-
readonly worldImportPath: "@latticexyz/world/src/";
|
17
|
-
};
|
18
|
-
type WORLD_DEFAULTS = typeof WORLD_DEFAULTS;
|
19
|
-
|
20
|
-
export { SYSTEM_DEFAULTS as S, WORLD_DEFAULTS as W };
|
package/dist/register.d.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
export { mudConfig, mudCoreConfig } from '@latticexyz/store/register';
|
2
|
-
import { OrDefaults } from '@latticexyz/common/type-utils';
|
3
|
-
import { MUDCoreUserConfig } from '@latticexyz/config/library';
|
4
|
-
import { W as WORLD_DEFAULTS } from './defaults-1be1ffd2.js';
|
5
|
-
import { W as WorldUserConfig, c as WorldConfig, b as ExpandSystemsConfig } from './types-971c9ea5.js';
|
6
|
-
import 'zod';
|
7
|
-
import './dynamicResolution-e56fd658.js';
|
8
|
-
import '@latticexyz/store';
|
9
|
-
|
10
|
-
declare module "@latticexyz/config/library" {
|
11
|
-
interface MUDCoreUserConfig extends WorldUserConfig {
|
12
|
-
}
|
13
|
-
interface MUDCoreConfig extends WorldConfig {
|
14
|
-
}
|
15
|
-
}
|
16
|
-
declare module "@latticexyz/store/register" {
|
17
|
-
interface ExpandMUDUserConfig<T extends MUDCoreUserConfig> extends OrDefaults<T, WORLD_DEFAULTS> {
|
18
|
-
systems: ExpandSystemsConfig<T["systems"] extends Record<string, unknown> ? T["systems"] : Record<string, never>>;
|
19
|
-
}
|
20
|
-
}
|
package/dist/register.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
import{b as o}from"./chunk-NXAGBVBE.js";import"./chunk-E5NQ4W4F.js";import"./chunk-H5QPQRXY.js";import"@latticexyz/store/register";import{mudConfig as x,mudCoreConfig as U}from"@latticexyz/store/register";import{extendMUDCoreConfig as t,fromZodErrorCustom as i}from"@latticexyz/config/library";import{ZodError as n}from"zod";t(e=>{try{return o.parse(e)}catch(r){throw r instanceof n?i(r,"WorldConfig Validation Error"):r}});import"@latticexyz/store/register";export{x as mudConfig,U as mudCoreConfig};
|
2
|
-
//# sourceMappingURL=register.js.map
|
package/dist/register.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../ts/register/index.ts","../ts/register/configExtensions.ts","../ts/register/typeExtensions.ts"],"sourcesContent":["// Importing this file has side-effects for MUD config,\n// and the order of imports is important in relation to other plugins\n// (store should usually be the first plugin, followed by world)\n\n// For convenience register and reexport store (which does the same for core config),\n// to reduce the number of needed imports for users\nimport \"@latticexyz/store/register\";\nexport { mudConfig, mudCoreConfig } from \"@latticexyz/store/register\";\n// Extend core config and types\nimport \"./configExtensions\";\nimport \"./typeExtensions\";\n","import { extendMUDCoreConfig, fromZodErrorCustom } from \"@latticexyz/config/library\";\nimport { ZodError } from \"zod\";\nimport { zPluginWorldConfig } from \"../config/worldConfig\";\n\nextendMUDCoreConfig((config) => {\n // This function gets called within mudConfig.\n // The call order of config extenders depends on the order of their imports.\n // Any config validation and transformation should be placed here.\n try {\n return zPluginWorldConfig.parse(config);\n } catch (error) {\n if (error instanceof ZodError) {\n throw fromZodErrorCustom(error, \"WorldConfig Validation Error\");\n } else {\n throw error;\n }\n }\n});\n","import { OrDefaults } from \"@latticexyz/common/type-utils\";\nimport { MUDCoreUserConfig } from \"@latticexyz/config/library\";\n\nimport \"@latticexyz/store/register\";\nimport { WORLD_DEFAULTS } from \"../config/defaults\";\nimport { WorldUserConfig, WorldConfig, ExpandSystemsConfig } from \"../config/types\";\n\n// Inject the plugin options into the core config.\n// Re-exporting an interface of an existing module merges them, adding new options to the interface.\n// (typescript has no way to override types)\ndeclare module \"@latticexyz/config/library\" {\n // Extend the user config type, which represents the config as written by the users.\n // Most things are optional here.\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n export interface MUDCoreUserConfig extends WorldUserConfig {}\n\n // Also extend the config type, which represents the configuration after it has been resolved.\n // It should not have any optional properties, with the default values applied instead.\n // Other plugins may receive this resolved config as their input.\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n export interface MUDCoreConfig extends WorldConfig {}\n}\n\ndeclare module \"@latticexyz/store/register\" {\n export interface ExpandMUDUserConfig<T extends MUDCoreUserConfig> extends OrDefaults<T, WORLD_DEFAULTS> {\n systems: ExpandSystemsConfig<T[\"systems\"] extends Record<string, unknown> ? T[\"systems\"] : Record<string, never>>;\n }\n}\n"],"mappings":"gGAMA,MAAO,6BACP,OAAS,aAAAA,EAAW,iBAAAC,MAAqB,6BCPzC,OAAS,uBAAAC,EAAqB,sBAAAC,MAA0B,6BACxD,OAAS,YAAAC,MAAgB,MAGzBC,EAAqBC,GAAW,CAI9B,GAAI,CACF,OAAOC,EAAmB,MAAMD,CAAM,CACxC,OAASE,EAAP,CACA,MAAIA,aAAiBC,EACbC,EAAmBF,EAAO,8BAA8B,EAExDA,CAEV,CACF,CAAC,ECdD,MAAO","names":["mudConfig","mudCoreConfig","extendMUDCoreConfig","fromZodErrorCustom","ZodError","extendMUDCoreConfig","config","zPluginWorldConfig","error","ZodError","fromZodErrorCustom"]}
|
package/dist/types-971c9ea5.d.ts
DELETED
@@ -1,254 +0,0 @@
|
|
1
|
-
import { z } from 'zod';
|
2
|
-
import { OrDefaults } from '@latticexyz/common/type-utils';
|
3
|
-
import { S as SYSTEM_DEFAULTS } from './defaults-1be1ffd2.js';
|
4
|
-
import { V as ValueWithType, D as DynamicResolution } from './dynamicResolution-e56fd658.js';
|
5
|
-
|
6
|
-
declare const zWorldConfig: z.ZodObject<{
|
7
|
-
worldContractName: z.ZodOptional<z.ZodString>;
|
8
|
-
worldInterfaceName: z.ZodDefault<z.ZodString>;
|
9
|
-
systems: z.ZodDefault<z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodIntersection<z.ZodObject<{
|
10
|
-
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
11
|
-
registerFunctionSelectors: z.ZodDefault<z.ZodBoolean>;
|
12
|
-
}, "strip", z.ZodTypeAny, {
|
13
|
-
registerFunctionSelectors: boolean;
|
14
|
-
name?: string | undefined;
|
15
|
-
}, {
|
16
|
-
name?: string | undefined;
|
17
|
-
registerFunctionSelectors?: boolean | undefined;
|
18
|
-
}>, z.ZodDiscriminatedUnion<"openAccess", [z.ZodObject<{
|
19
|
-
openAccess: z.ZodDefault<z.ZodLiteral<true>>;
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
21
|
-
openAccess: true;
|
22
|
-
}, {
|
23
|
-
openAccess?: true | undefined;
|
24
|
-
}>, z.ZodObject<{
|
25
|
-
openAccess: z.ZodLiteral<false>;
|
26
|
-
accessList: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, "many">>>;
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
28
|
-
openAccess: false;
|
29
|
-
accessList: readonly string[];
|
30
|
-
}, {
|
31
|
-
openAccess: false;
|
32
|
-
accessList?: readonly string[] | undefined;
|
33
|
-
}>]>>>>;
|
34
|
-
excludeSystems: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>>;
|
35
|
-
postDeployScript: z.ZodDefault<z.ZodString>;
|
36
|
-
deploysDirectory: z.ZodDefault<z.ZodString>;
|
37
|
-
worldsFile: z.ZodDefault<z.ZodString>;
|
38
|
-
worldgenDirectory: z.ZodDefault<z.ZodString>;
|
39
|
-
worldImportPath: z.ZodDefault<z.ZodString>;
|
40
|
-
}, "strip", z.ZodTypeAny, {
|
41
|
-
systems: Record<string, {
|
42
|
-
registerFunctionSelectors: boolean;
|
43
|
-
name?: string | undefined;
|
44
|
-
} & ({
|
45
|
-
openAccess: true;
|
46
|
-
} | {
|
47
|
-
openAccess: false;
|
48
|
-
accessList: readonly string[];
|
49
|
-
})>;
|
50
|
-
excludeSystems: readonly string[];
|
51
|
-
worldInterfaceName: string;
|
52
|
-
worldgenDirectory: string;
|
53
|
-
worldImportPath: string;
|
54
|
-
postDeployScript: string;
|
55
|
-
deploysDirectory: string;
|
56
|
-
worldsFile: string;
|
57
|
-
worldContractName?: string | undefined;
|
58
|
-
}, {
|
59
|
-
systems?: Record<string, {
|
60
|
-
name?: string | undefined;
|
61
|
-
registerFunctionSelectors?: boolean | undefined;
|
62
|
-
} & ({
|
63
|
-
openAccess?: true | undefined;
|
64
|
-
} | {
|
65
|
-
openAccess: false;
|
66
|
-
accessList?: readonly string[] | undefined;
|
67
|
-
})> | undefined;
|
68
|
-
excludeSystems?: readonly string[] | undefined;
|
69
|
-
worldInterfaceName?: string | undefined;
|
70
|
-
worldgenDirectory?: string | undefined;
|
71
|
-
worldImportPath?: string | undefined;
|
72
|
-
postDeployScript?: string | undefined;
|
73
|
-
deploysDirectory?: string | undefined;
|
74
|
-
worldsFile?: string | undefined;
|
75
|
-
worldContractName?: string | undefined;
|
76
|
-
}>;
|
77
|
-
declare const zPluginWorldConfig: z.ZodObject<{
|
78
|
-
worldContractName: z.ZodOptional<z.ZodString>;
|
79
|
-
worldInterfaceName: z.ZodDefault<z.ZodString>;
|
80
|
-
systems: z.ZodDefault<z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodIntersection<z.ZodObject<{
|
81
|
-
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
82
|
-
registerFunctionSelectors: z.ZodDefault<z.ZodBoolean>;
|
83
|
-
}, "strip", z.ZodTypeAny, {
|
84
|
-
registerFunctionSelectors: boolean;
|
85
|
-
name?: string | undefined;
|
86
|
-
}, {
|
87
|
-
name?: string | undefined;
|
88
|
-
registerFunctionSelectors?: boolean | undefined;
|
89
|
-
}>, z.ZodDiscriminatedUnion<"openAccess", [z.ZodObject<{
|
90
|
-
openAccess: z.ZodDefault<z.ZodLiteral<true>>;
|
91
|
-
}, "strip", z.ZodTypeAny, {
|
92
|
-
openAccess: true;
|
93
|
-
}, {
|
94
|
-
openAccess?: true | undefined;
|
95
|
-
}>, z.ZodObject<{
|
96
|
-
openAccess: z.ZodLiteral<false>;
|
97
|
-
accessList: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, "many">>>;
|
98
|
-
}, "strip", z.ZodTypeAny, {
|
99
|
-
openAccess: false;
|
100
|
-
accessList: readonly string[];
|
101
|
-
}, {
|
102
|
-
openAccess: false;
|
103
|
-
accessList?: readonly string[] | undefined;
|
104
|
-
}>]>>>>;
|
105
|
-
excludeSystems: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>>;
|
106
|
-
postDeployScript: z.ZodDefault<z.ZodString>;
|
107
|
-
deploysDirectory: z.ZodDefault<z.ZodString>;
|
108
|
-
worldsFile: z.ZodDefault<z.ZodString>;
|
109
|
-
worldgenDirectory: z.ZodDefault<z.ZodString>;
|
110
|
-
worldImportPath: z.ZodDefault<z.ZodString>;
|
111
|
-
}, "strip", z.ZodAny, z.objectOutputType<{
|
112
|
-
worldContractName: z.ZodOptional<z.ZodString>;
|
113
|
-
worldInterfaceName: z.ZodDefault<z.ZodString>;
|
114
|
-
systems: z.ZodDefault<z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodIntersection<z.ZodObject<{
|
115
|
-
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
116
|
-
registerFunctionSelectors: z.ZodDefault<z.ZodBoolean>;
|
117
|
-
}, "strip", z.ZodTypeAny, {
|
118
|
-
registerFunctionSelectors: boolean;
|
119
|
-
name?: string | undefined;
|
120
|
-
}, {
|
121
|
-
name?: string | undefined;
|
122
|
-
registerFunctionSelectors?: boolean | undefined;
|
123
|
-
}>, z.ZodDiscriminatedUnion<"openAccess", [z.ZodObject<{
|
124
|
-
openAccess: z.ZodDefault<z.ZodLiteral<true>>;
|
125
|
-
}, "strip", z.ZodTypeAny, {
|
126
|
-
openAccess: true;
|
127
|
-
}, {
|
128
|
-
openAccess?: true | undefined;
|
129
|
-
}>, z.ZodObject<{
|
130
|
-
openAccess: z.ZodLiteral<false>;
|
131
|
-
accessList: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, "many">>>;
|
132
|
-
}, "strip", z.ZodTypeAny, {
|
133
|
-
openAccess: false;
|
134
|
-
accessList: readonly string[];
|
135
|
-
}, {
|
136
|
-
openAccess: false;
|
137
|
-
accessList?: readonly string[] | undefined;
|
138
|
-
}>]>>>>;
|
139
|
-
excludeSystems: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>>;
|
140
|
-
postDeployScript: z.ZodDefault<z.ZodString>;
|
141
|
-
deploysDirectory: z.ZodDefault<z.ZodString>;
|
142
|
-
worldsFile: z.ZodDefault<z.ZodString>;
|
143
|
-
worldgenDirectory: z.ZodDefault<z.ZodString>;
|
144
|
-
worldImportPath: z.ZodDefault<z.ZodString>;
|
145
|
-
}, z.ZodAny, "strip">, z.objectInputType<{
|
146
|
-
worldContractName: z.ZodOptional<z.ZodString>;
|
147
|
-
worldInterfaceName: z.ZodDefault<z.ZodString>;
|
148
|
-
systems: z.ZodDefault<z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodIntersection<z.ZodObject<{
|
149
|
-
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
150
|
-
registerFunctionSelectors: z.ZodDefault<z.ZodBoolean>;
|
151
|
-
}, "strip", z.ZodTypeAny, {
|
152
|
-
registerFunctionSelectors: boolean;
|
153
|
-
name?: string | undefined;
|
154
|
-
}, {
|
155
|
-
name?: string | undefined;
|
156
|
-
registerFunctionSelectors?: boolean | undefined;
|
157
|
-
}>, z.ZodDiscriminatedUnion<"openAccess", [z.ZodObject<{
|
158
|
-
openAccess: z.ZodDefault<z.ZodLiteral<true>>;
|
159
|
-
}, "strip", z.ZodTypeAny, {
|
160
|
-
openAccess: true;
|
161
|
-
}, {
|
162
|
-
openAccess?: true | undefined;
|
163
|
-
}>, z.ZodObject<{
|
164
|
-
openAccess: z.ZodLiteral<false>;
|
165
|
-
accessList: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, "many">>>;
|
166
|
-
}, "strip", z.ZodTypeAny, {
|
167
|
-
openAccess: false;
|
168
|
-
accessList: readonly string[];
|
169
|
-
}, {
|
170
|
-
openAccess: false;
|
171
|
-
accessList?: readonly string[] | undefined;
|
172
|
-
}>]>>>>;
|
173
|
-
excludeSystems: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>>;
|
174
|
-
postDeployScript: z.ZodDefault<z.ZodString>;
|
175
|
-
deploysDirectory: z.ZodDefault<z.ZodString>;
|
176
|
-
worldsFile: z.ZodDefault<z.ZodString>;
|
177
|
-
worldgenDirectory: z.ZodDefault<z.ZodString>;
|
178
|
-
worldImportPath: z.ZodDefault<z.ZodString>;
|
179
|
-
}, z.ZodAny, "strip">>;
|
180
|
-
|
181
|
-
type SystemUserConfig = {
|
182
|
-
/** The full resource selector consists of namespace and name */
|
183
|
-
name?: string;
|
184
|
-
/**
|
185
|
-
* Register function selectors for the system in the World.
|
186
|
-
* Defaults to true.
|
187
|
-
* Note:
|
188
|
-
* - For root systems all World function selectors will correspond to the system's function selectors.
|
189
|
-
* - For non-root systems, the World function selectors will be <namespace>_<system>_<function>.
|
190
|
-
*/
|
191
|
-
registerFunctionSelectors?: boolean;
|
192
|
-
} & ({
|
193
|
-
/** If openAccess is true, any address can call the system */
|
194
|
-
openAccess?: true;
|
195
|
-
} | {
|
196
|
-
/** If openAccess is false, only the addresses or systems in `access` can call the system */
|
197
|
-
openAccess: false;
|
198
|
-
/** An array of addresses or system names that can access the system */
|
199
|
-
accessList: readonly string[];
|
200
|
-
});
|
201
|
-
interface ExpandSystemConfig<T extends SystemUserConfig, SystemName extends string> extends OrDefaults<T, {
|
202
|
-
name: SystemName;
|
203
|
-
registerFunctionSelectors: SYSTEM_DEFAULTS["registerFunctionSelector"];
|
204
|
-
openAccess: SYSTEM_DEFAULTS["openAccess"];
|
205
|
-
}> {
|
206
|
-
accessList: T extends {
|
207
|
-
accessList: readonly string[];
|
208
|
-
} ? T["accessList"] : SYSTEM_DEFAULTS["accessList"];
|
209
|
-
}
|
210
|
-
type SystemsUserConfig = Record<string, SystemUserConfig>;
|
211
|
-
type ExpandSystemsConfig<T extends SystemsUserConfig> = {
|
212
|
-
[SystemName in keyof T]: ExpandSystemConfig<T[SystemName], SystemName extends string ? SystemName : never>;
|
213
|
-
};
|
214
|
-
type ModuleConfig = {
|
215
|
-
/** The name of the module */
|
216
|
-
name: string;
|
217
|
-
/** Should this module be installed as a root module? */
|
218
|
-
root?: boolean;
|
219
|
-
/** Arguments to be passed to the module's install method */
|
220
|
-
args?: readonly (ValueWithType | DynamicResolution)[];
|
221
|
-
};
|
222
|
-
interface WorldUserConfig {
|
223
|
-
/** The name of the World contract to deploy. If no name is provided, a vanilla World is deployed */
|
224
|
-
worldContractName?: string;
|
225
|
-
/** The name of the World interface to generate. (Default `IWorld`) */
|
226
|
-
worldInterfaceName?: string;
|
227
|
-
/**
|
228
|
-
* Contracts named *System will be deployed by default
|
229
|
-
* as public systems at `namespace/ContractName`, unless overridden
|
230
|
-
*
|
231
|
-
* The key is the system name (capitalized).
|
232
|
-
* The value is a SystemConfig object.
|
233
|
-
*/
|
234
|
-
systems?: SystemsUserConfig;
|
235
|
-
/** Systems to exclude from automatic deployment */
|
236
|
-
excludeSystems?: readonly string[];
|
237
|
-
/**
|
238
|
-
* Script to execute after the deployment is complete (Default "PostDeploy").
|
239
|
-
* Script must be placed in the forge scripts directory (see foundry.toml) and have a ".s.sol" extension.
|
240
|
-
*/
|
241
|
-
postDeployScript?: string;
|
242
|
-
/** Directory to write the deployment info to (Default "./deploys") */
|
243
|
-
deploysDirectory?: string;
|
244
|
-
/** JSON file to write to with chain -> latest world deploy address (Default "./worlds.json") */
|
245
|
-
worldsFile?: string;
|
246
|
-
/** Directory to output system and world interfaces of `worldgen` (Default "world") */
|
247
|
-
worldgenDirectory?: string;
|
248
|
-
/** Path for world package imports. Default is "@latticexyz/world/src/" */
|
249
|
-
worldImportPath?: string;
|
250
|
-
}
|
251
|
-
type WorldConfig = z.output<typeof zWorldConfig>;
|
252
|
-
type SystemConfig = WorldConfig["systems"][string];
|
253
|
-
|
254
|
-
export { ExpandSystemConfig as E, ModuleConfig as M, SystemUserConfig as S, WorldUserConfig as W, SystemsUserConfig as a, ExpandSystemsConfig as b, WorldConfig as c, SystemConfig as d, zPluginWorldConfig as e, zWorldConfig as z };
|