From bb218aa33a67e094ca06400eadc01dbca9e2301d Mon Sep 17 00:00:00 2001 From: oedotme Date: Sun, 2 Apr 2023 15:46:14 +0200 Subject: [PATCH] feat: export core from bundled integrations --- packages/generouted/package.json | 1 + plugins/react-router/package.json | 7 +++++++ plugins/react-router/src/core.ts | 1 + plugins/react-router/tsup.config.ts | 13 ++++++++++--- plugins/solid-router/package.json | 7 +++++++ plugins/solid-router/src/core.ts | 1 + plugins/solid-router/tsup.config.ts | 13 ++++++++++--- 7 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 plugins/react-router/src/core.ts create mode 100644 plugins/solid-router/src/core.ts diff --git a/packages/generouted/package.json b/packages/generouted/package.json index ddceec1..8322135 100644 --- a/packages/generouted/package.json +++ b/packages/generouted/package.json @@ -82,6 +82,7 @@ "src" ], "scripts": { + "build": "tsc --emitDeclarationOnly --noEmit false --outDir dist", "type-check": "tsc --noEmit" }, "devDependencies": { diff --git a/plugins/react-router/package.json b/plugins/react-router/package.json index 1a85712..59b7c55 100644 --- a/plugins/react-router/package.json +++ b/plugins/react-router/package.json @@ -35,6 +35,10 @@ "types": "./dist/index.d.ts", "import": "./dist/index.js" }, + "./core": { + "types": "./dist/core.d.ts", + "import": "./dist/core.js" + }, "./lazy": { "types": "./dist/index-lazy.d.ts", "import": "./dist/index-lazy.js" @@ -54,6 +58,9 @@ "*": [ "./dist/index.d.ts" ], + "core": [ + "./dist/core.d.ts" + ], "lazy": [ "./dist/index-lazy.d.ts" ], diff --git a/plugins/react-router/src/core.ts b/plugins/react-router/src/core.ts new file mode 100644 index 0000000..5ad9b54 --- /dev/null +++ b/plugins/react-router/src/core.ts @@ -0,0 +1 @@ +export * from 'generouted/core' diff --git a/plugins/react-router/tsup.config.ts b/plugins/react-router/tsup.config.ts index 7a40041..83425b4 100644 --- a/plugins/react-router/tsup.config.ts +++ b/plugins/react-router/tsup.config.ts @@ -2,9 +2,16 @@ import { defineConfig } from 'tsup' export default defineConfig([ { - entry: ['src/index*', 'src/client'], + entry: ['src/core.ts', 'src/index*', 'src/client'], format: ['esm'], - dts: true, + dts: { + entry: { + core: './node_modules/generouted/dist/core.d.ts', + index: './node_modules/generouted/dist/react-router.d.ts', + 'index-lazy': './node_modules/generouted/dist/react-router-lazy.d.ts', + 'client/index': 'src/client/index.ts', + }, + }, external: ['react', 'react-router-dom'], noExternal: ['generouted'], inject: ['./src/react.js'], @@ -13,6 +20,6 @@ export default defineConfig([ entry: ['src/plugin'], outDir: 'dist/plugin', format: ['cjs', 'esm'], - dts: true, + dts: { entry: 'src/plugin/index.ts' }, }, ]) diff --git a/plugins/solid-router/package.json b/plugins/solid-router/package.json index f01e18e..828f5dc 100644 --- a/plugins/solid-router/package.json +++ b/plugins/solid-router/package.json @@ -35,6 +35,10 @@ "types": "./dist/index.d.ts", "import": "./dist/index.js" }, + "./core": { + "types": "./dist/core.d.ts", + "import": "./dist/core.js" + }, "./lazy": { "types": "./dist/index-lazy.d.ts", "import": "./dist/index-lazy.js" @@ -54,6 +58,9 @@ "*": [ "./dist/index.d.ts" ], + "core": [ + "./dist/core.d.ts" + ], "lazy": [ "./dist/index-lazy.d.ts" ], diff --git a/plugins/solid-router/src/core.ts b/plugins/solid-router/src/core.ts new file mode 100644 index 0000000..5ad9b54 --- /dev/null +++ b/plugins/solid-router/src/core.ts @@ -0,0 +1 @@ +export * from 'generouted/core' diff --git a/plugins/solid-router/tsup.config.ts b/plugins/solid-router/tsup.config.ts index 55b9d38..6c86e6c 100644 --- a/plugins/solid-router/tsup.config.ts +++ b/plugins/solid-router/tsup.config.ts @@ -3,9 +3,16 @@ import { solidPlugin as solid } from 'esbuild-plugin-solid' export default defineConfig([ { - entry: ['src/index*', 'src/client'], + entry: ['src/core.ts', 'src/index*', 'src/client'], format: ['esm'], - dts: true, + dts: { + entry: { + core: './node_modules/generouted/dist/core.d.ts', + index: './node_modules/generouted/dist/solid-router.d.ts', + 'index-lazy': './node_modules/generouted/dist/solid-router-lazy.d.ts', + 'client/index': 'src/client/index.ts', + }, + }, external: ['solid-js', 'solid-js/web', '@solidjs/router'], noExternal: ['generouted'], esbuildPlugins: [solid()], @@ -14,6 +21,6 @@ export default defineConfig([ entry: ['src/plugin'], outDir: 'dist/plugin', format: ['cjs', 'esm'], - dts: true, + dts: { entry: 'src/plugin/index.ts' }, }, ])