diff --git a/packages/next-drupal/package.json b/packages/next-drupal/package.json index 0b83511f..2f5e626b 100644 --- a/packages/next-drupal/package.json +++ b/packages/next-drupal/package.json @@ -3,7 +3,10 @@ "description": "Helpers for Next.js + Drupal.", "version": "1.6.0", "sideEffects": false, - "source": "src/index.ts", + "source": [ + "src/index.ts", + "src/navigation.ts" + ], "type": "module", "main": "dist/index.cjs", "module": "dist/index.js", @@ -18,6 +21,16 @@ "types": "./dist/index.d.cts", "default": "./dist/index.cjs" } + }, + "./navigation": { + "import": { + "types": "./dist/navigation.d.ts", + "default": "./dist/navigation.modern.js" + }, + "require": { + "types": "./dist/navigation.d.cts", + "default": "./dist/navigation.cjs" + } } }, "license": "MIT", diff --git a/packages/next-drupal/src/index.ts b/packages/next-drupal/src/index.ts index bc107a47..fb7c2513 100644 --- a/packages/next-drupal/src/index.ts +++ b/packages/next-drupal/src/index.ts @@ -8,7 +8,6 @@ export * from "./get-resource" export * from "./get-search-index" export * from "./get-view" export * from "./types" -export * from "./use-menu" export * from "./translate-path" export { deserialize, diff --git a/packages/next-drupal/src/navigation.ts b/packages/next-drupal/src/navigation.ts new file mode 100644 index 00000000..33d5f232 --- /dev/null +++ b/packages/next-drupal/src/navigation.ts @@ -0,0 +1 @@ +export { useMenu } from "./navigation/use-menu" diff --git a/packages/next-drupal/src/use-menu.tsx b/packages/next-drupal/src/navigation/use-menu.ts similarity index 90% rename from packages/next-drupal/src/use-menu.tsx rename to packages/next-drupal/src/navigation/use-menu.ts index 441a2a43..cbc4b3f6 100644 --- a/packages/next-drupal/src/use-menu.tsx +++ b/packages/next-drupal/src/navigation/use-menu.ts @@ -1,7 +1,7 @@ import { useRouter } from "next/router" import { useEffect, useState } from "react" -import { getMenu } from "./get-menu" -import type { DrupalMenuLinkContent } from "./types" +import { getMenu } from "../get-menu" +import type { DrupalMenuLinkContent } from "../types" export function useMenu( name: string diff --git a/packages/next-drupal/tsup.config.ts b/packages/next-drupal/tsup.config.ts index 2562b07f..0690563c 100644 --- a/packages/next-drupal/tsup.config.ts +++ b/packages/next-drupal/tsup.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from "tsup" export const tsup = defineConfig({ - entry: ["src/index.ts"], + entry: ["src/index.ts", "src/navigation.ts"], // Enable experimental code splitting support in CommonJS. // splitting: true, // Use Rollup for tree shaking.