From e33caa58991cadcebe9c08b9a43fcbc8d6e8d350 Mon Sep 17 00:00:00 2001 From: BearToCode Date: Sun, 30 Jul 2023 19:10:20 +0200 Subject: [PATCH] fix types exports and minor fixes --- package.json | 6 ++++++ src/index.d.ts | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cee9f88..3df4643 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.1.9", "description": "🌈 Light, fast, and easy to use, dependencies free javascript syntax highlighter, with automatic language detection", "main": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { ".": "./dist/index.js", "./index.js": "./dist/index.js", @@ -55,5 +56,10 @@ "@rollup/plugin-terser": "^0.4.3", "rollup": "^2.75.7", "rollup-plugin-copy": "^3.4.0" + }, + "typesVersions": { + "*": { + "*": ["dist/*", "dist"] + } } } diff --git a/src/index.d.ts b/src/index.d.ts index ac7b594..de41041 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -41,7 +41,10 @@ export type ShjLanguageComponent = match: RegExp; sub: | string - | ((code: string) => { type: string; sub: Array<{ match: RegExp; sub: string }> }); + | ((code: string) => { + type: string; + sub: Array<{ match: RegExp; sub: string | Promise }> + }); }; export type ShjLanguageDefinition = Array; @@ -98,7 +101,7 @@ export declare function highlightElement( * Call highlightElement on element with a css class starting with `shj-lang-` * @param opt Customization options */ -export declare function HighlightAll(opt?: ShjOptions): Promise; +export declare function highlightAll(opt?: ShjOptions): Promise; /** * Load a language and add it to the langs object