@latticexyz/config 2.0.13-main-609de113f → 3.0.0-main-560fd6a0c

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.
@@ -1,2 +1,2 @@
1
- import{e as t}from"../chunk-JORWOKR3.js";import{findUp as m}from"find-up";import o from"path";import s from"esbuild";import{rmSync as u}from"fs";import{pathToFileURL as f}from"url";import a from"os";var p=["mud.config.js","mud.config.mjs","mud.config.ts","mud.config.mts"],e="mud.config.temp.mjs";async function x(r){r=await n(r);try{return await s.build({entryPoints:[r],format:"esm",outfile:e,platform:"node",bundle:!0,packages:"external"}),r=await n(e,!0),(await import(r+`?update=${Date.now()}`)).default}finally{u(e,{force:!0})}}async function n(r,i){return r===void 0?r=await d():o.isAbsolute(r)||(r=o.join(process.cwd(),r),r=o.normalize(r)),i&&a.platform()==="win32"?f(r).href:r}async function d(){let r=await m(p);if(r===void 0)throw new t;return r}export{x as loadConfig,n as resolveConfigPath};
1
+ import{findUp as n}from"find-up";import o from"path";import m from"esbuild";import{rmSync as s}from"fs";import{pathToFileURL as u}from"url";import f from"os";var a=["mud.config.js","mud.config.mjs","mud.config.ts","mud.config.mts"],e="mud.config.temp.mjs";async function j(r){r=await t(r);try{return await m.build({entryPoints:[r],format:"esm",outfile:e,platform:"node",bundle:!0,packages:"external"}),r=await t(e,!0),(await import(r+`?update=${Date.now()}`)).default}finally{s(e,{force:!0})}}async function t(r,i){return r===void 0?r=await d():o.isAbsolute(r)||(r=o.join(process.cwd(),r),r=o.normalize(r)),i&&f.platform()==="win32"?u(r).href:r}async function d(){let r=await n(a);if(r===void 0)throw new Error("Did not find a `mud.config.ts` file. Are you inside a MUD project?");return r}export{j as loadConfig,t as resolveConfigPath};
2
2
  //# sourceMappingURL=node.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/deprecated/node/loadConfig.ts"],"sourcesContent":["import { findUp } from \"find-up\";\nimport path from \"path\";\nimport { NotInsideProjectError } from \"../library/errors\";\nimport esbuild from \"esbuild\";\nimport { rmSync } from \"fs\";\nimport { pathToFileURL } from \"url\";\nimport os from \"os\";\n\n// TODO: explore using https://www.npmjs.com/package/ts-import instead\n\n// In order of preference files are checked\n/** @deprecated */\nconst configFiles = [\"mud.config.js\", \"mud.config.mjs\", \"mud.config.ts\", \"mud.config.mts\"];\n/** @deprecated */\nconst TEMP_CONFIG = \"mud.config.temp.mjs\";\n\n/** @deprecated */\nexport async function loadConfig(configPath?: string): Promise<unknown> {\n configPath = await resolveConfigPath(configPath);\n try {\n await esbuild.build({\n entryPoints: [configPath],\n format: \"esm\",\n outfile: TEMP_CONFIG,\n // https://esbuild.github.io/getting-started/#bundling-for-node\n platform: \"node\",\n // bundle local imports (otherwise it may error, js can't import ts)\n bundle: true,\n // avoid bundling external imports (it's unnecessary and esbuild can't handle all node features)\n packages: \"external\",\n });\n configPath = await resolveConfigPath(TEMP_CONFIG, true);\n // Node.js caches dynamic imports, so without appending a cache breaking\n // param like `?update={Date.now()}` this import always returns the same config\n // if called multiple times in a single process, like the `dev-contracts` cli\n return (await import(configPath + `?update=${Date.now()}`)).default;\n } finally {\n rmSync(TEMP_CONFIG, { force: true });\n }\n}\n\n/** @deprecated */\nexport async function resolveConfigPath(configPath?: string, toFileURL?: boolean) {\n if (configPath === undefined) {\n configPath = await getUserConfigPath();\n } else {\n if (!path.isAbsolute(configPath)) {\n configPath = path.join(process.cwd(), configPath);\n configPath = path.normalize(configPath);\n }\n }\n\n // Add `file:///` for Windows support\n // (see https://github.com/nodejs/node/issues/31710)\n return toFileURL && os.platform() === \"win32\" ? pathToFileURL(configPath).href : configPath;\n}\n\n/** @deprecated */\nasync function getUserConfigPath() {\n const tsConfigPath = await findUp(configFiles);\n if (tsConfigPath === undefined) {\n throw new NotInsideProjectError();\n }\n return tsConfigPath;\n}\n"],"mappings":"yCAAA,OAAS,UAAAA,MAAc,UACvB,OAAOC,MAAU,OAEjB,OAAOC,MAAa,UACpB,OAAS,UAAAC,MAAc,KACvB,OAAS,iBAAAC,MAAqB,MAC9B,OAAOC,MAAQ,KAMf,IAAMC,EAAc,CAAC,gBAAiB,iBAAkB,gBAAiB,gBAAgB,EAEnFC,EAAc,sBAGpB,eAAsBC,EAAWC,EAAuC,CACtEA,EAAa,MAAMC,EAAkBD,CAAU,EAC/C,GAAI,CACF,aAAMP,EAAQ,MAAM,CAClB,YAAa,CAACO,CAAU,EACxB,OAAQ,MACR,QAASF,EAET,SAAU,OAEV,OAAQ,GAER,SAAU,UACZ,CAAC,EACDE,EAAa,MAAMC,EAAkBH,EAAa,EAAI,GAI9C,MAAM,OAAOE,EAAa,WAAW,KAAK,IAAI,MAAM,OAC9D,QAAE,CACAN,EAAOI,EAAa,CAAE,MAAO,EAAK,CAAC,CACrC,CACF,CAGA,eAAsBG,EAAkBD,EAAqBE,EAAqB,CAChF,OAAIF,IAAe,OACjBA,EAAa,MAAMG,EAAkB,EAEhCC,EAAK,WAAWJ,CAAU,IAC7BA,EAAaI,EAAK,KAAK,QAAQ,IAAI,EAAGJ,CAAU,EAChDA,EAAaI,EAAK,UAAUJ,CAAU,GAMnCE,GAAaN,EAAG,SAAS,IAAM,QAAUD,EAAcK,CAAU,EAAE,KAAOA,CACnF,CAGA,eAAeG,GAAoB,CACjC,IAAME,EAAe,MAAMC,EAAOT,CAAW,EAC7C,GAAIQ,IAAiB,OACnB,MAAM,IAAIE,EAEZ,OAAOF,CACT","names":["findUp","path","esbuild","rmSync","pathToFileURL","os","configFiles","TEMP_CONFIG","loadConfig","configPath","resolveConfigPath","toFileURL","getUserConfigPath","path","tsConfigPath","findUp","NotInsideProjectError"]}
1
+ {"version":3,"sources":["../../src/deprecated/node/loadConfig.ts"],"sourcesContent":["import { findUp } from \"find-up\";\nimport path from \"path\";\nimport esbuild from \"esbuild\";\nimport { rmSync } from \"fs\";\nimport { pathToFileURL } from \"url\";\nimport os from \"os\";\n\n// TODO: explore using https://www.npmjs.com/package/ts-import instead\n\n// In order of preference files are checked\n/** @deprecated */\nconst configFiles = [\"mud.config.js\", \"mud.config.mjs\", \"mud.config.ts\", \"mud.config.mts\"];\n/** @deprecated */\nconst TEMP_CONFIG = \"mud.config.temp.mjs\";\n\n/** @deprecated */\nexport async function loadConfig(configPath?: string): Promise<unknown> {\n configPath = await resolveConfigPath(configPath);\n try {\n await esbuild.build({\n entryPoints: [configPath],\n format: \"esm\",\n outfile: TEMP_CONFIG,\n // https://esbuild.github.io/getting-started/#bundling-for-node\n platform: \"node\",\n // bundle local imports (otherwise it may error, js can't import ts)\n bundle: true,\n // avoid bundling external imports (it's unnecessary and esbuild can't handle all node features)\n packages: \"external\",\n });\n configPath = await resolveConfigPath(TEMP_CONFIG, true);\n // Node.js caches dynamic imports, so without appending a cache breaking\n // param like `?update={Date.now()}` this import always returns the same config\n // if called multiple times in a single process, like the `dev-contracts` cli\n return (await import(configPath + `?update=${Date.now()}`)).default;\n } finally {\n rmSync(TEMP_CONFIG, { force: true });\n }\n}\n\n/** @deprecated */\nexport async function resolveConfigPath(configPath?: string, toFileURL?: boolean) {\n if (configPath === undefined) {\n configPath = await getUserConfigPath();\n } else {\n if (!path.isAbsolute(configPath)) {\n configPath = path.join(process.cwd(), configPath);\n configPath = path.normalize(configPath);\n }\n }\n\n // Add `file:///` for Windows support\n // (see https://github.com/nodejs/node/issues/31710)\n return toFileURL && os.platform() === \"win32\" ? pathToFileURL(configPath).href : configPath;\n}\n\n/** @deprecated */\nasync function getUserConfigPath() {\n const tsConfigPath = await findUp(configFiles);\n if (tsConfigPath === undefined) {\n throw new Error(\"Did not find a `mud.config.ts` file. Are you inside a MUD project?\");\n }\n return tsConfigPath;\n}\n"],"mappings":"AAAA,OAAS,UAAAA,MAAc,UACvB,OAAOC,MAAU,OACjB,OAAOC,MAAa,UACpB,OAAS,UAAAC,MAAc,KACvB,OAAS,iBAAAC,MAAqB,MAC9B,OAAOC,MAAQ,KAMf,IAAMC,EAAc,CAAC,gBAAiB,iBAAkB,gBAAiB,gBAAgB,EAEnFC,EAAc,sBAGpB,eAAsBC,EAAWC,EAAuC,CACtEA,EAAa,MAAMC,EAAkBD,CAAU,EAC/C,GAAI,CACF,aAAMP,EAAQ,MAAM,CAClB,YAAa,CAACO,CAAU,EACxB,OAAQ,MACR,QAASF,EAET,SAAU,OAEV,OAAQ,GAER,SAAU,UACZ,CAAC,EACDE,EAAa,MAAMC,EAAkBH,EAAa,EAAI,GAI9C,MAAM,OAAOE,EAAa,WAAW,KAAK,IAAI,MAAM,OAC9D,QAAE,CACAN,EAAOI,EAAa,CAAE,MAAO,EAAK,CAAC,CACrC,CACF,CAGA,eAAsBG,EAAkBD,EAAqBE,EAAqB,CAChF,OAAIF,IAAe,OACjBA,EAAa,MAAMG,EAAkB,EAEhCX,EAAK,WAAWQ,CAAU,IAC7BA,EAAaR,EAAK,KAAK,QAAQ,IAAI,EAAGQ,CAAU,EAChDA,EAAaR,EAAK,UAAUQ,CAAU,GAMnCE,GAAaN,EAAG,SAAS,IAAM,QAAUD,EAAcK,CAAU,EAAE,KAAOA,CACnF,CAGA,eAAeG,GAAoB,CACjC,IAAMC,EAAe,MAAMb,EAAOM,CAAW,EAC7C,GAAIO,IAAiB,OACnB,MAAM,IAAI,MAAM,oEAAoE,EAEtF,OAAOA,CACT","names":["findUp","path","esbuild","rmSync","pathToFileURL","os","configFiles","TEMP_CONFIG","loadConfig","configPath","resolveConfigPath","toFileURL","getUserConfigPath","tsConfigPath"]}
package/dist/index.d.ts CHANGED
@@ -18,9 +18,10 @@ type Schema = {
18
18
  };
19
19
  };
20
20
  type Table = {
21
+ readonly label: string;
21
22
  readonly type: satisfy<ResourceType, "table" | "offchainTable">;
22
- readonly name: string;
23
23
  readonly namespace: string;
24
+ readonly name: string;
24
25
  readonly tableId: Hex;
25
26
  readonly schema: Schema;
26
27
  readonly key: readonly string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/config",
3
- "version": "2.0.13-main-609de113f",
3
+ "version": "3.0.0-main-560fd6a0c",
4
4
  "description": "Config for Store and World",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,8 +12,6 @@
12
12
  "exports": {
13
13
  ".": "./dist/index.js",
14
14
  "./internal": "./dist/internal.js",
15
- "./library": "./dist/deprecated/library.js",
16
- "./register": "./dist/deprecated/register.js",
17
15
  "./node": "./dist/deprecated/node.js"
18
16
  },
19
17
  "typesVersions": {
@@ -24,12 +22,6 @@
24
22
  "internal": [
25
23
  "./dist/internal.d.ts"
26
24
  ],
27
- "library": [
28
- "./dist/deprecated/library.d.ts"
29
- ],
30
- "register": [
31
- "./dist/deprecated/register.d.ts"
32
- ],
33
25
  "node": [
34
26
  "./dist/deprecated/node.d.ts"
35
27
  ]
@@ -43,10 +35,8 @@
43
35
  "esbuild": "^0.17.15",
44
36
  "find-up": "^6.3.0",
45
37
  "viem": "2.9.20",
46
- "zod": "^3.22.2",
47
- "zod-validation-error": "^1.3.0",
48
- "@latticexyz/common": "2.0.13-main-609de113f",
49
- "@latticexyz/schema-type": "2.0.13-main-609de113f"
38
+ "@latticexyz/common": "3.0.0-main-560fd6a0c",
39
+ "@latticexyz/schema-type": "3.0.0-main-560fd6a0c"
50
40
  },
51
41
  "devDependencies": {
52
42
  "tsup": "^6.7.0"
@@ -1,2 +0,0 @@
1
- import{a as m,b as f,c as p}from"./chunk-JORWOKR3.js";import{z as r}from"zod";import{ZodIssueCode as n}from"zod";import{isAddress as E}from"viem";var I=16,g=14;function d(t,e){/^\w+$/.test(t)||e.addIssue({code:n.custom,message:"Name must contain only alphanumeric & underscore characters"})}function C(t,e){d(t,e),/^[A-Z]/.test(t)||e.addIssue({code:n.custom,message:"Name must start with a capital letter"})}function x(t,e){d(t,e),/^[a-z]/.test(t)||e.addIssue({code:n.custom,message:"Name must start with a lowercase letter"})}function h(t,e){t.length===0&&e.addIssue({code:n.custom,message:"Enum must not be empty"}),t.length>=256&&e.addIssue({code:n.custom,message:"Length of enum must be < 256"});let o=D(t);o.length>0&&e.addIssue({code:n.custom,message:`Enum must not have duplicate names for: ${o.join(", ")}`})}function c(t,e){return(o,s)=>{if(o===""){t&&s.addIssue({code:n.custom,message:"Route must not be empty"});return}o[0]!=="/"&&s.addIssue({code:n.custom,message:'Route must start with "/"'}),o[o.length-1]==="/"&&s.addIssue({code:n.custom,message:'Route must not end with "/"'});let i=o.split("/");e&&i.length>2&&s.addIssue({code:n.custom,message:'Route must only have one level (e.g. "/foo")'});for(let u=1;u<i.length;u++)i[u]===""&&s.addIssue({code:n.custom,message:'Route must not contain empty route fragments (e.g. "//")'}),/^\w+$/.test(i[u])||s.addIssue({code:n.custom,message:"Route must contain only alphanumeric & underscore characters"})}}var R=c(!0,!1),b=c(!1,!1),U=c(!0,!0);function M(t,e){E(t)||e.addIssue({code:n.custom,message:"Address must be a valid Ethereum address"})}function D(t){let e=new Set,o=new Set;for(let s of t)e.has(s)&&o.add(s),e.add(s);return[...o]}function v(t,e){t.length>g&&e.addIssue({code:n.custom,message:`Namespace must be <= ${g} characters`}),/^\w*$/.test(t)||e.addIssue({code:n.custom,message:"Selector must contain only alphanumeric & underscore characters"})}function z(t){let e=t.match(/^(\w+)\[(\d+)\]$/);return e?{elementType:e[1],staticLength:Number.parseInt(e[2])}:null}var N=r.string().superRefine(C),W=r.string().superRefine(x),L=r.string().superRefine(d),G=r.string().superRefine(v),$=r.array(N).superRefine(h),O=r.string().superRefine(R),B=r.string().superRefine(U),j=r.string().superRefine(b),k=r.string().superRefine(M);var l=class{static isCreated(){return this._global.__mudCoreContext!==void 0}static createContext(){if(this.isCreated())throw new f;let e=this._global,o=new l;return e.__mudCoreContext=o,o}static getContext(){let o=this._global.__mudCoreContext;if(o===void 0)throw new p;return o}configExtenders=[]},a=l;m(a,"_global",typeof global>"u"?window.global??{}:global);function P(t){let e=t,o=a.getContext();for(let s of o.configExtenders)e=s(e);return e}function q(t){a.getContext().configExtenders.push(t)}export{I as a,g as b,d as c,C as d,x as e,h as f,R as g,b as h,U as i,M as j,D as k,v as l,z as m,N as n,W as o,L as p,G as q,$ as r,O as s,B as t,j as u,k as v,a as w,P as x,q as y};
2
- //# sourceMappingURL=chunk-A6KUSP7R.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/deprecated/library/commonSchemas.ts","../src/deprecated/library/validation.ts","../src/deprecated/library/context.ts","../src/deprecated/library/core.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n validateBaseRoute,\n validateCapitalizedName,\n validateEthereumAddress,\n validateEnum,\n validateName,\n validateRoute,\n validateSingleLevelRoute,\n validateUncapitalizedName,\n validateNamespace,\n} from \"./validation\";\n\n/**\n * Capitalized names of objects, like tables and systems\n * @deprecated\n */\nexport const zObjectName = z.string().superRefine(validateCapitalizedName);\n/**\n * Uncapitalized names of values, like keys and columns\n * @deprecated\n */\nexport const zValueName = z.string().superRefine(validateUncapitalizedName);\n/** Name that can start with any case\n * @deprecated\n */\nexport const zName = z.string().superRefine(validateName);\n/** A namespace\n * @deprecated\n */\nexport const zNamespace = z.string().superRefine(validateNamespace);\n\n/** List of unique enum member names and 0 < length < 256\n * @deprecated\n */\nexport const zUserEnum = z.array(zObjectName).superRefine(validateEnum);\n\n/** Ordinary routes\n * @deprecated\n */\nexport const zOrdinaryRoute = z.string().superRefine(validateRoute);\n/** Routes with exactly 1 non-empty level\n * @deprecated\n */\nexport const zSingleLevelRoute = z.string().superRefine(validateSingleLevelRoute);\n/** Base routes (can be an empty string)\n * @deprecated\n */\nexport const zBaseRoute = z.string().superRefine(validateBaseRoute);\n\n/** A valid Ethereum address\n * @deprecated\n */\nexport const zEthereumAddress = z.string().superRefine(validateEthereumAddress);\n","import { ZodIssueCode, RefinementCtx } from \"zod\";\nimport { isAddress } from \"viem\";\n\n/** @deprecated */\nexport const STORE_NAME_MAX_LENGTH = 16;\n/** @deprecated */\nexport const STORE_NAMESPACE_MAX_LENGTH = 14;\n\n/** @deprecated */\nexport function validateName(name: string, ctx: RefinementCtx) {\n if (!/^\\w+$/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must contain only alphanumeric & underscore characters`,\n });\n }\n}\n\n/** @deprecated */\nexport function validateCapitalizedName(name: string, ctx: RefinementCtx) {\n validateName(name, ctx);\n\n if (!/^[A-Z]/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must start with a capital letter`,\n });\n }\n}\n\n/** @deprecated */\nexport function validateUncapitalizedName(name: string, ctx: RefinementCtx) {\n validateName(name, ctx);\n\n if (!/^[a-z]/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must start with a lowercase letter`,\n });\n }\n}\n\n/**\n * validates only the enum array, not the names of enum members\n * @deprecated\n */\nexport function validateEnum(members: string[], ctx: RefinementCtx) {\n if (members.length === 0) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Enum must not be empty`,\n });\n }\n if (members.length >= 256) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Length of enum must be < 256`,\n });\n }\n\n const duplicates = getDuplicates(members);\n if (duplicates.length > 0) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Enum must not have duplicate names for: ${duplicates.join(\", \")}`,\n });\n }\n}\n\n/** @deprecated */\nfunction _factoryForValidateRoute(requireNonEmpty: boolean, requireSingleLevel: boolean) {\n return (route: string, ctx: RefinementCtx) => {\n if (route === \"\") {\n if (requireNonEmpty) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not be empty`,\n });\n }\n // we can skip further validation for empty routes\n return;\n }\n\n if (route[0] !== \"/\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must start with \"/\"`,\n });\n }\n\n if (route[route.length - 1] === \"/\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not end with \"/\"`,\n });\n }\n\n const parts = route.split(\"/\");\n if (requireSingleLevel && parts.length > 2) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must only have one level (e.g. \"/foo\")`,\n });\n }\n\n // start at 1 to skip the first empty part\n for (let i = 1; i < parts.length; i++) {\n if (parts[i] === \"\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not contain empty route fragments (e.g. \"//\")`,\n });\n }\n\n if (!/^\\w+$/.test(parts[i])) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must contain only alphanumeric & underscore characters`,\n });\n }\n }\n };\n}\n\n/** @deprecated */\nexport const validateRoute = _factoryForValidateRoute(true, false);\n\n/** @deprecated */\nexport const validateBaseRoute = _factoryForValidateRoute(false, false);\n\n/** @deprecated */\nexport const validateSingleLevelRoute = _factoryForValidateRoute(true, true);\n\n/** @deprecated */\nexport function validateEthereumAddress(address: string, ctx: RefinementCtx) {\n if (!isAddress(address)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Address must be a valid Ethereum address`,\n });\n }\n}\n\n/** @deprecated */\nexport function getDuplicates<T>(array: T[]) {\n const checked = new Set<T>();\n const duplicates = new Set<T>();\n for (const element of array) {\n if (checked.has(element)) {\n duplicates.add(element);\n }\n checked.add(element);\n }\n return [...duplicates];\n}\n\n/** @deprecated */\nexport function validateNamespace(name: string, ctx: RefinementCtx) {\n if (name.length > STORE_NAMESPACE_MAX_LENGTH) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Namespace must be <= ${STORE_NAMESPACE_MAX_LENGTH} characters`,\n });\n }\n if (!/^\\w*$/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Selector must contain only alphanumeric & underscore characters`,\n });\n }\n}\n\n/**\n * Returns null if the type does not look like a static array, otherwise element and length data\n * @deprecated\n */\nexport function parseStaticArray(abiType: string) {\n const matches = abiType.match(/^(\\w+)\\[(\\d+)\\]$/);\n if (!matches) return null;\n return {\n elementType: matches[1],\n staticLength: Number.parseInt(matches[2]),\n };\n}\n","import { MUDConfigExtender } from \"./core\";\nimport { MUDContextAlreadyCreatedError, MUDContextNotCreatedError } from \"./errors\";\n\n/** @deprecated */\nexport type GlobalWithMUDCoreContext = typeof global & {\n __mudCoreContext: MUDCoreContext;\n};\n\n/** @deprecated */\nexport class MUDCoreContext {\n /** @deprecated */\n static _global = typeof global === \"undefined\" ? window.global ?? {} : global;\n\n /** @deprecated */\n public static isCreated(): boolean {\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n return globalWithMUDCoreContext.__mudCoreContext !== undefined;\n }\n\n /** @deprecated */\n public static createContext(): MUDCoreContext {\n if (this.isCreated()) {\n throw new MUDContextAlreadyCreatedError();\n }\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n const context = new MUDCoreContext();\n globalWithMUDCoreContext.__mudCoreContext = context;\n return context;\n }\n\n /** @deprecated */\n public static getContext(): MUDCoreContext {\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n const context = globalWithMUDCoreContext.__mudCoreContext;\n if (context === undefined) {\n throw new MUDContextNotCreatedError();\n }\n return context;\n }\n\n /** @deprecated */\n public readonly configExtenders: MUDConfigExtender[] = [];\n}\n","import { MUDCoreContext } from \"./context\";\n\n/** @deprecated */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MUDCoreUserConfig {}\n\n/** @deprecated */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MUDCoreConfig {}\n\n/** @deprecated */\nexport type MUDConfigExtender = (config: MUDCoreConfig) => Record<string, unknown>;\n\n/**\n * Resolver that sequentially passes the config through all the plugins\n * @deprecated\n */\nexport function mudCoreConfig(config: MUDCoreUserConfig): MUDCoreConfig {\n // config types can change with plugins, `any` helps avoid errors when typechecking dependencies\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let configAsAny = config as any;\n const context = MUDCoreContext.getContext();\n for (const extender of context.configExtenders) {\n configAsAny = extender(configAsAny);\n }\n return configAsAny;\n}\n\n/**\n * Utility for plugin developers to extend the core config\n * @deprecated\n */\nexport function extendMUDCoreConfig(extender: MUDConfigExtender) {\n const context = MUDCoreContext.getContext();\n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ueCode","isAddress","STORE_NAME_MAX_LENGTH","STORE_NAMESPACE_MAX_LENGTH","validateName","name","ctx","validateCapitalizedName","validateUncapitalizedName","validateEnum","members","duplicates","getDuplicates","_factoryForValidateRoute","requireNonEmpty","requireSingleLevel","route","parts","i","validateRoute","validateBaseRoute","validateSingleLevelRoute","validateEthereumAddress","address","array","checked","element","validateNamespace","parseStaticArray","abiType","matches","zObjectName","z","validateCapitalizedName","zValueName","validateUncapitalizedName","zName","validateName","zNamespace","validateNamespace","zUserEnum","validateEnum","zOrdinaryRoute","validateRoute","zSingleLevelRoute","validateSingleLevelRoute","zBaseRoute","validateBaseRoute","zEthereumAddress","validateEthereumAddress","_MUDCoreContext","MUDContextAlreadyCreatedError","globalWithMUDCoreContext","context","MUDContextNotCreatedError","MUDCoreContext","__publicField","mudCoreConfig","config","configAsAny","context","MUDCoreContext","extender","extendMUDCoreConfig"]}
@@ -1,4 +0,0 @@
1
- var a=Object.defineProperty;var d=(r,e,o)=>e in r?a(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var p=(r,e,o)=>(d(r,typeof e!="symbol"?e+"":e,o),o);import{z as m,ZodIssueCode as c}from"zod";import{fromZodError as i}from"zod-validation-error";var t=class extends Error{name="MUDContextAlreadyCreatedError";message="MUD context was already created"},s=class extends Error{name="MUDContextNotCreatedError";message="MUD context has not been created"};function f(r,e){return i(r,{prefix:e,prefixSeparator:`
2
- - `,issueSeparator:`
3
- - `})}var n=class extends Error{name="NotInsideProjectError";message="You are not inside a MUD project"};function Z(r,e){return new m.ZodError([{code:c.custom,path:r,message:`Unrecognized system: "${e}"`}])}export{p as a,t as b,s as c,f as d,n as e,Z as f};
4
- //# sourceMappingURL=chunk-JORWOKR3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/deprecated/library/errors.ts"],"sourcesContent":["import { z, ZodError, ZodIssueCode } from \"zod\";\nimport { fromZodError } from \"zod-validation-error\";\n\n/** @deprecated */\nexport class MUDContextAlreadyCreatedError extends Error {\n name = \"MUDContextAlreadyCreatedError\";\n message = \"MUD context was already created\";\n}\n\n/** @deprecated */\nexport class MUDContextNotCreatedError extends Error {\n name = \"MUDContextNotCreatedError\";\n message = \"MUD context has not been created\";\n}\n\n/**\n * Wrapper with preset styles, only requires a `prefix`\n * @deprecated\n */\nexport function fromZodErrorCustom(error: ZodError, prefix: string) {\n return fromZodError(error, {\n prefix: prefix,\n prefixSeparator: \"\\n- \",\n issueSeparator: \"\\n- \",\n });\n}\n\n/** @deprecated */\nexport class NotInsideProjectError extends Error {\n name = \"NotInsideProjectError\";\n message = \"You are not inside a MUD project\";\n}\n\n/** @deprecated */\nexport function UnrecognizedSystemErrorFactory(path: string[], systemName: string) {\n return new z.ZodError([{ code: ZodIssueCode.custom, path: path, message: `Unrecognized system: \"${systemName}\"` }]);\n}\n"],"mappings":"wKAAA,OAAS,KAAAA,EAAa,gBAAAC,MAAoB,MAC1C,OAAS,gBAAAC,MAAoB,uBAGtB,IAAMC,EAAN,cAA4C,KAAM,CACvD,KAAO,gCACP,QAAU,iCACZ,EAGaC,EAAN,cAAwC,KAAM,CACnD,KAAO,4BACP,QAAU,kCACZ,EAMO,SAASC,EAAmBC,EAAiBC,EAAgB,CAClE,OAAOL,EAAaI,EAAO,CACzB,OAAQC,EACR,gBAAiB;AAAA,IACjB,eAAgB;AAAA,GAClB,CAAC,CACH,CAGO,IAAMC,EAAN,cAAoC,KAAM,CAC/C,KAAO,wBACP,QAAU,kCACZ,EAGO,SAASC,EAA+BC,EAAgBC,EAAoB,CACjF,OAAO,IAAIX,EAAE,SAAS,CAAC,CAAE,KAAMC,EAAa,OAAQ,KAAMS,EAAM,QAAS,yBAAyBC,IAAc,CAAC,CAAC,CACpH","names":["z","ZodIssueCode","fromZodError","MUDContextAlreadyCreatedError","MUDContextNotCreatedError","fromZodErrorCustom","error","prefix","NotInsideProjectError","UnrecognizedSystemErrorFactory","path","systemName"]}
@@ -1,20 +0,0 @@
1
- /** @deprecated */
2
- interface MUDCoreUserConfig {
3
- }
4
- /** @deprecated */
5
- interface MUDCoreConfig {
6
- }
7
- /** @deprecated */
8
- type MUDConfigExtender = (config: MUDCoreConfig) => Record<string, unknown>;
9
- /**
10
- * Resolver that sequentially passes the config through all the plugins
11
- * @deprecated
12
- */
13
- declare function mudCoreConfig(config: MUDCoreUserConfig): MUDCoreConfig;
14
- /**
15
- * Utility for plugin developers to extend the core config
16
- * @deprecated
17
- */
18
- declare function extendMUDCoreConfig(extender: MUDConfigExtender): void;
19
-
20
- export { MUDConfigExtender as M, MUDCoreUserConfig as a, MUDCoreConfig as b, extendMUDCoreConfig as e, mudCoreConfig as m };
@@ -1,122 +0,0 @@
1
- import { z, ZodError, RefinementCtx } from 'zod';
2
- import { M as MUDConfigExtender } from '../core-cd251f25.js';
3
- export { b as MUDCoreConfig, a as MUDCoreUserConfig, e as extendMUDCoreConfig, m as mudCoreConfig } from '../core-cd251f25.js';
4
- import * as zod_validation_error from 'zod-validation-error';
5
-
6
- /**
7
- * Capitalized names of objects, like tables and systems
8
- * @deprecated
9
- */
10
- declare const zObjectName: z.ZodEffects<z.ZodString, string, string>;
11
- /**
12
- * Uncapitalized names of values, like keys and columns
13
- * @deprecated
14
- */
15
- declare const zValueName: z.ZodEffects<z.ZodString, string, string>;
16
- /** Name that can start with any case
17
- * @deprecated
18
- */
19
- declare const zName: z.ZodEffects<z.ZodString, string, string>;
20
- /** A namespace
21
- * @deprecated
22
- */
23
- declare const zNamespace: z.ZodEffects<z.ZodString, string, string>;
24
- /** List of unique enum member names and 0 < length < 256
25
- * @deprecated
26
- */
27
- declare const zUserEnum: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">, string[], string[]>;
28
- /** Ordinary routes
29
- * @deprecated
30
- */
31
- declare const zOrdinaryRoute: z.ZodEffects<z.ZodString, string, string>;
32
- /** Routes with exactly 1 non-empty level
33
- * @deprecated
34
- */
35
- declare const zSingleLevelRoute: z.ZodEffects<z.ZodString, string, string>;
36
- /** Base routes (can be an empty string)
37
- * @deprecated
38
- */
39
- declare const zBaseRoute: z.ZodEffects<z.ZodString, string, string>;
40
- /** A valid Ethereum address
41
- * @deprecated
42
- */
43
- declare const zEthereumAddress: z.ZodEffects<z.ZodString, string, string>;
44
-
45
- /** @deprecated */
46
- type GlobalWithMUDCoreContext = typeof global & {
47
- __mudCoreContext: MUDCoreContext;
48
- };
49
- /** @deprecated */
50
- declare class MUDCoreContext {
51
- /** @deprecated */
52
- static _global: typeof globalThis;
53
- /** @deprecated */
54
- static isCreated(): boolean;
55
- /** @deprecated */
56
- static createContext(): MUDCoreContext;
57
- /** @deprecated */
58
- static getContext(): MUDCoreContext;
59
- /** @deprecated */
60
- readonly configExtenders: MUDConfigExtender[];
61
- }
62
-
63
- /** @deprecated */
64
- declare class MUDContextAlreadyCreatedError extends Error {
65
- name: string;
66
- message: string;
67
- }
68
- /** @deprecated */
69
- declare class MUDContextNotCreatedError extends Error {
70
- name: string;
71
- message: string;
72
- }
73
- /**
74
- * Wrapper with preset styles, only requires a `prefix`
75
- * @deprecated
76
- */
77
- declare function fromZodErrorCustom(error: ZodError, prefix: string): zod_validation_error.ValidationError;
78
- /** @deprecated */
79
- declare class NotInsideProjectError extends Error {
80
- name: string;
81
- message: string;
82
- }
83
- /** @deprecated */
84
- declare function UnrecognizedSystemErrorFactory(path: string[], systemName: string): z.ZodError<any>;
85
-
86
- /** @deprecated */
87
- declare const STORE_NAME_MAX_LENGTH = 16;
88
- /** @deprecated */
89
- declare const STORE_NAMESPACE_MAX_LENGTH = 14;
90
- /** @deprecated */
91
- declare function validateName(name: string, ctx: RefinementCtx): void;
92
- /** @deprecated */
93
- declare function validateCapitalizedName(name: string, ctx: RefinementCtx): void;
94
- /** @deprecated */
95
- declare function validateUncapitalizedName(name: string, ctx: RefinementCtx): void;
96
- /**
97
- * validates only the enum array, not the names of enum members
98
- * @deprecated
99
- */
100
- declare function validateEnum(members: string[], ctx: RefinementCtx): void;
101
- /** @deprecated */
102
- declare const validateRoute: (route: string, ctx: RefinementCtx) => void;
103
- /** @deprecated */
104
- declare const validateBaseRoute: (route: string, ctx: RefinementCtx) => void;
105
- /** @deprecated */
106
- declare const validateSingleLevelRoute: (route: string, ctx: RefinementCtx) => void;
107
- /** @deprecated */
108
- declare function validateEthereumAddress(address: string, ctx: RefinementCtx): void;
109
- /** @deprecated */
110
- declare function getDuplicates<T>(array: T[]): T[];
111
- /** @deprecated */
112
- declare function validateNamespace(name: string, ctx: RefinementCtx): void;
113
- /**
114
- * Returns null if the type does not look like a static array, otherwise element and length data
115
- * @deprecated
116
- */
117
- declare function parseStaticArray(abiType: string): {
118
- elementType: string;
119
- staticLength: number;
120
- } | null;
121
-
122
- export { GlobalWithMUDCoreContext, MUDConfigExtender, MUDContextAlreadyCreatedError, MUDContextNotCreatedError, MUDCoreContext, NotInsideProjectError, STORE_NAMESPACE_MAX_LENGTH, STORE_NAME_MAX_LENGTH, UnrecognizedSystemErrorFactory, fromZodErrorCustom, getDuplicates, parseStaticArray, validateBaseRoute, validateCapitalizedName, validateEnum, validateEthereumAddress, validateName, validateNamespace, validateRoute, validateSingleLevelRoute, validateUncapitalizedName, zBaseRoute, zEthereumAddress, zName, zNamespace, zObjectName, zOrdinaryRoute, zSingleLevelRoute, zUserEnum, zValueName };
@@ -1,2 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w as B,x as C,y as D}from"../chunk-A6KUSP7R.js";import{b as w,c as x,d as y,e as z,f as A}from"../chunk-JORWOKR3.js";export{w as MUDContextAlreadyCreatedError,x as MUDContextNotCreatedError,B as MUDCoreContext,z as NotInsideProjectError,b as STORE_NAMESPACE_MAX_LENGTH,a as STORE_NAME_MAX_LENGTH,A as UnrecognizedSystemErrorFactory,D as extendMUDCoreConfig,y as fromZodErrorCustom,k as getDuplicates,C as mudCoreConfig,m as parseStaticArray,h as validateBaseRoute,d as validateCapitalizedName,f as validateEnum,j as validateEthereumAddress,c as validateName,l as validateNamespace,g as validateRoute,i as validateSingleLevelRoute,e as validateUncapitalizedName,u as zBaseRoute,v as zEthereumAddress,p as zName,q as zNamespace,n as zObjectName,s as zOrdinaryRoute,t as zSingleLevelRoute,r as zUserEnum,o as zValueName};
2
- //# sourceMappingURL=library.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- export { m as mudCoreConfig } from '../core-cd251f25.js';
@@ -1,2 +0,0 @@
1
- import{w as o,x as e}from"../chunk-A6KUSP7R.js";import"../chunk-JORWOKR3.js";o.isCreated()||o.createContext();export{e as mudCoreConfig};
2
- //# sourceMappingURL=register.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/deprecated/register/index.ts"],"sourcesContent":["import { mudCoreConfig } from \"../library\";\nimport { MUDCoreContext } from \"../library/context\";\n\nexport { mudCoreConfig };\n\n// Importing this file has side-effects, and it should always be imported before MUD plugins.\n// Use this import for defining a MUD config.\n// Use the library endpoint instead when writing MUD-based libraries or plugins.\nif (!MUDCoreContext.isCreated()) {\n MUDCoreContext.createContext();\n}\n"],"mappings":"6EAQKA,EAAe,UAAU,GAC5BA,EAAe,cAAc","names":["MUDCoreContext"]}