diff --git a/README.md b/README.md index 87e1efc..fbe3355 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,8 @@ To get the most basic functionality, add `RichText.astro` Storyblok component to ```js --- -import RichTextRenderer, { type RichTextType } from "storyblok-rich-text-astro-renderer/RichTextRenderer.astro"; +import RichTextRenderer from "storyblok-rich-text-astro-renderer/RichTextRenderer.astro"; +import type { RichTextType } from "storyblok-rich-text-astro-renderer" import { storyblokEditable } from "@storyblok/astro"; export interface Props { diff --git a/demo/src/pages/index.astro b/demo/src/pages/index.astro index 9a7eb13..cda75c2 100644 --- a/demo/src/pages/index.astro +++ b/demo/src/pages/index.astro @@ -1,5 +1,5 @@ --- -import type { RichTextType } from "storyblok-rich-text-astro-renderer/RichTextRenderer.astro"; +import type { RichTextType } from "storyblok-rich-text-astro-renderer"; import Layout from "../layouts/Layout.astro"; import StoryblokComponent from "@storyblok/astro/StoryblokComponent.astro"; diff --git a/lib/RichTextRenderer.astro b/lib/RichTextRenderer.astro index 9117d5f..4fce1ce 100644 --- a/lib/RichTextRenderer.astro +++ b/lib/RichTextRenderer.astro @@ -1,8 +1,6 @@ --- import { resolveRichTextToNodes } from "./dist/index.mjs"; -import { ComponentNode, Options, RichTextType } from "./dist/types"; - -export type { RichTextType }; +import type { ComponentNode, Options, RichTextType } from "./dist/types"; export type Props = { content: RichTextType; diff --git a/lib/RichTextRenderer.ts b/lib/RichTextRenderer.ts new file mode 100644 index 0000000..7000f20 --- /dev/null +++ b/lib/RichTextRenderer.ts @@ -0,0 +1,2 @@ +import RichTextRenderer from "./RichTextRenderer.astro"; +export default RichTextRenderer; diff --git a/lib/package.json b/lib/package.json index ee2d92d..a918a6b 100644 --- a/lib/package.json +++ b/lib/package.json @@ -22,16 +22,21 @@ "exports": { ".": { "import": "./dist/index.mjs", - "require": "./dist/index.js" + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" }, - "./RichTextRenderer.astro": "./RichTextRenderer.astro" + "./RichTextRenderer.astro": { + "import": "./RichTextRenderer.astro", + "types": "./RichTextRenderer.ts" + } }, "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "files": [ "dist", - "RichTextRenderer.astro" + "RichTextRenderer.astro", + "RichTextRenderer.ts" ], "scripts": { "build": "vite build", diff --git a/lib/tsconfig.json b/lib/tsconfig.json index b49ca02..ddcc882 100644 --- a/lib/tsconfig.json +++ b/lib/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "ESNext", "target": "ESNext", - "strict": false + "strict": false, + "jsx": "preserve" }, "extends": "astro/tsconfigs/base", "$schema": "https://json.schemastore.org/tsconfig",