From 2e701f63f285a1b77d5f860a39ff7d55c1d40977 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:32:28 +0100 Subject: [PATCH] Improve package layout (#3148) --- packages/toolpad-components/package.json | 8 +++++-- packages/toolpad-core/package.json | 7 ++++--- .../{src => public}/serverModules.d.ts | 0 packages/toolpad-core/src/server.ts | 2 +- packages/toolpad-core/tsconfig.json | 2 +- packages/toolpad-utils/package.json | 21 ++++++++++++------- 6 files changed, 25 insertions(+), 15 deletions(-) rename packages/toolpad-core/{src => public}/serverModules.d.ts (100%) diff --git a/packages/toolpad-components/package.json b/packages/toolpad-components/package.json index 2aeb2c64b64..8d37c2dd59e 100644 --- a/packages/toolpad-components/package.json +++ b/packages/toolpad-components/package.json @@ -12,11 +12,15 @@ "./package.json": "./package.json", ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.js" + "default": "./dist/index.js" + }, + "./Button": { + "types": "./dist/Button.d.ts", + "default": "./dist/Button.js" }, "./*": { "types": "./dist/*.d.ts", - "import": "./dist/*.js" + "default": "./dist/*.js" } }, "files": [ diff --git a/packages/toolpad-core/package.json b/packages/toolpad-core/package.json index 84e7fbc146f..781cd68f631 100644 --- a/packages/toolpad-core/package.json +++ b/packages/toolpad-core/package.json @@ -12,19 +12,20 @@ "./package.json": "./package.json", ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.js" + "default": "./dist/index.js" }, "./*": { "types": "./dist/*.d.ts", - "import": "./dist/*.js" + "default": "./dist/*.js" }, "./server": { "types": "./dist/server.d.ts", - "import": "./dist/server.js" + "default": "./dist/server.js" } }, "files": [ "dist", + "public", "server", "browser" ], diff --git a/packages/toolpad-core/src/serverModules.d.ts b/packages/toolpad-core/public/serverModules.d.ts similarity index 100% rename from packages/toolpad-core/src/serverModules.d.ts rename to packages/toolpad-core/public/serverModules.d.ts diff --git a/packages/toolpad-core/src/server.ts b/packages/toolpad-core/src/server.ts index 6aa0905ac3a..d42189caaf3 100644 --- a/packages/toolpad-core/src/server.ts +++ b/packages/toolpad-core/src/server.ts @@ -1,4 +1,4 @@ -/// +/// import { TOOLPAD_FUNCTION } from './constants'; import { diff --git a/packages/toolpad-core/tsconfig.json b/packages/toolpad-core/tsconfig.json index c27c70b76e2..048b93c6e52 100644 --- a/packages/toolpad-core/tsconfig.json +++ b/packages/toolpad-core/tsconfig.json @@ -12,5 +12,5 @@ "pretty": true, "preserveWatchOutput": true }, - "include": ["src/**/*.ts", "src/**/*.tsx"] + "include": ["src/**/*.ts", "src/**/*.tsx", "public/serverModules.d.ts"] } diff --git a/packages/toolpad-utils/package.json b/packages/toolpad-utils/package.json index 2b96a75f955..f7007cac275 100644 --- a/packages/toolpad-utils/package.json +++ b/packages/toolpad-utils/package.json @@ -11,20 +11,25 @@ "type": "module", "exports": { "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/index.cjs" + "./events": { + "types": "./dist/events.d.ts", + "require": "./dist/events.cjs", + "default": "./dist/events.js" }, "./*": { "types": "./dist/*.d.ts", - "import": "./dist/*.js", - "require": "./dist/*.cjs" + "require": "./dist/*.cjs", + "default": "./dist/*.js" + }, + "./hooks/useBoolean": { + "types": "./dist/hooks/useBoolean.d.ts", + "require": "./dist/hooks/useBoolean.cjs", + "default": "./dist/hooks/useBoolean.js" }, "./hooks/*": { "types": "./dist/hooks/*.d.ts", - "import": "./dist/hooks/*.js", - "require": "./dist/hooks/*.cjs" + "require": "./dist/hooks/*.cjs", + "default": "./dist/hooks/*.js" } }, "files": [