Skip to content

Commit

Permalink
move world exports, update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Mar 20, 2024
1 parent 14562ef commit 839d175
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ethers } from "ethers";
import { loadConfig } from "@latticexyz/config/node";
import { MUDError } from "@latticexyz/common/errors";
import { cast, getRpcUrl, getSrcDirectory } from "@latticexyz/common/foundry";
import { resolveWorldConfig } from "@latticexyz/world";
import { resolveWorldConfig } from "@latticexyz/world/internal";
import IBaseWorldAbi from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json" assert { type: "json" };
import worldConfig from "@latticexyz/world/mud.config";
import { resourceToHex } from "@latticexyz/common";
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/deploy/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import IModuleAbi from "@latticexyz/world-modules/out/IModule.sol/IModule.abi.js
import { Tables, configToTables } from "./configToTables";
import { helloStoreEvent } from "@latticexyz/store";
import { StoreConfig } from "@latticexyz/store/internal";
import { WorldConfig, helloWorldEvent } from "@latticexyz/world";
import { helloWorldEvent } from "@latticexyz/world";
import { WorldConfig } from "@latticexyz/world/internal";
import { storeToV1 } from "@latticexyz/store/config/v2";
import { worldToV1 } from "@latticexyz/world/config/v2";

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/deploy/resolveConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from "path";
import { resolveWorldConfig } from "@latticexyz/world";
import { resolveWorldConfig } from "@latticexyz/world/internal";
import { Config, ConfigInput, Library, Module, System, WorldFunction } from "./common";
import { resourceToHex } from "@latticexyz/common";
import { resolveWithContext } from "@latticexyz/config/library";
Expand Down
14 changes: 9 additions & 5 deletions packages/world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/ts/index.js",
".": "./dist/index.js",
"./internal": "./dist/internal.js",
"./mud.config": "./dist/mud.config.js",
"./config/v2": "./dist/ts/config/v2/index.js",
"./register": "./dist/ts/register/index.js",
"./node": "./dist/ts/node/index.js",
"./config/v2": "./dist/config/v2.js",
"./register": "./dist/register.js",
"./node": "./dist/node.js",
"./out/*": "./out/*"
},
"typesVersions": {
"*": {
"index": [
"./ts/index.ts"
"./ts/exports/index.ts"
],
"internal": [
"./ts/exports/internal.ts"
],
"config/v2": [
"./ts/config/v2/index.ts"
Expand Down
10 changes: 10 additions & 0 deletions packages/world/ts/exports/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* External exports.
*
* Be sure we're ready to commit to these being supported and changes made backward compatible!
*/

export { helloWorldEvent, worldDeployedEvent } from "../worldEvents";

export { defineWorld } from "../config/v2/world";
export type { World } from "../config/v2/output";
9 changes: 9 additions & 0 deletions packages/world/ts/exports/internal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export * from "../config/defaults";
export * from "../config/resolveWorldConfig";
export * from "../config/types";
export * from "../config/worldConfig";

export * from "../encodeSystemCall";
export * from "../encodeSystemCallFrom";
export * from "../encodeSystemCalls";
export * from "../encodeSystemCallsFrom";
10 changes: 0 additions & 10 deletions packages/world/ts/index.ts

This file was deleted.

9 changes: 8 additions & 1 deletion packages/world/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["mud.config.ts", "ts/index.ts", "ts/register/index.ts", "ts/config/v2/index.ts", "ts/node/index.ts"],
entry: {
"mud.config": "mud.config.ts",
index: "ts/exports/index.ts",
internal: "ts/exports/internal.ts",
register: "ts/register/index.ts",
"config/v2": "ts/config/v2/index.ts",
node: "ts/node/index.ts",
},
target: "esnext",
format: ["esm"],
dts: true,
Expand Down

0 comments on commit 839d175

Please sign in to comment.