@shikijs/vitepress-twoslash 2.5.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/vitepress-twoslash",
3
3
  "type": "module",
4
- "version": "2.5.0",
4
+ "version": "3.1.0",
5
5
  "description": "Enable Twoslash support in VitePress",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -19,34 +19,15 @@
19
19
  ],
20
20
  "sideEffects": false,
21
21
  "exports": {
22
- ".": {
23
- "types": "./dist/index.d.mts",
24
- "default": "./dist/index.mjs"
25
- },
26
- "./client": {
27
- "types": "./dist/client.d.mts",
28
- "default": "./dist/client.mjs"
29
- },
30
- "./cache-fs": {
31
- "types": "./dist/cache-fs.d.mts",
32
- "default": "./dist/cache-fs.mjs"
33
- },
22
+ ".": "./dist/index.mjs",
23
+ "./client": "./dist/client.mjs",
24
+ "./cache-fs": "./dist/cache-fs.mjs",
34
25
  "./style.css": "./style.css",
35
26
  "./style-core.css": "./style-core.css"
36
27
  },
37
28
  "main": "./dist/index.mjs",
38
29
  "module": "./dist/index.mjs",
39
30
  "types": "./dist/index.d.mts",
40
- "typesVersions": {
41
- "*": {
42
- "client": [
43
- "./dist/client.d.mts"
44
- ],
45
- "*": [
46
- "./dist/index.d.mts"
47
- ]
48
- }
49
- },
50
31
  "files": [
51
32
  "*.css",
52
33
  "dist"
@@ -57,10 +38,10 @@
57
38
  "mdast-util-from-markdown": "^2.0.2",
58
39
  "mdast-util-gfm": "^3.1.0",
59
40
  "mdast-util-to-hast": "^13.2.0",
60
- "twoslash": "^0.2.12",
61
- "twoslash-vue": "^0.2.12",
41
+ "twoslash": "^0.3.1",
42
+ "twoslash-vue": "^0.3.1",
62
43
  "vue": "^3.5.13",
63
- "shiki": "2.5.0"
44
+ "shiki": "3.1.0"
64
45
  },
65
46
  "scripts": {
66
47
  "build": "unbuild",
@@ -1,17 +0,0 @@
1
- import { b as TwoslashTypesCache } from './shared/vitepress-twoslash.D0M9n6iV.js';
2
- import '@shikijs/twoslash/core';
3
- import 'twoslash';
4
- import 'twoslash-vue';
5
- import '@shikijs/twoslash';
6
-
7
- interface FileSystemTypeResultCacheOptions {
8
- /**
9
- * The directory to store the cache files.
10
- *
11
- * @default '.vitepress/cache/twoslash'
12
- */
13
- dir?: string;
14
- }
15
- declare function createFileSystemTypesCache(options?: FileSystemTypeResultCacheOptions): TwoslashTypesCache;
16
-
17
- export { type FileSystemTypeResultCacheOptions, createFileSystemTypesCache };
package/dist/client.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { App } from 'vue';
2
- import FloatingVue from 'floating-vue';
3
-
4
- type FloatingVueConfig = Parameters<(typeof FloatingVue)['install']>[1];
5
- /**
6
- * Vue plugin to install FloatingVue with styles.
7
- *
8
- * Import this function in `.vitepress/theme/index.ts` and use `app.use(TwoslashFloatingVue)` inside the `enhanceApp` hook.
9
- */
10
- declare const TwoslashFloatingVue: {
11
- install: (app: App, options?: FloatingVueConfig) => void;
12
- };
13
-
14
- export { type FloatingVueConfig, TwoslashFloatingVue as default };
package/dist/index.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { ShikiTransformer } from 'shiki';
2
- import { V as VitePressPluginTwoslashOptions } from './shared/vitepress-twoslash.D0M9n6iV.js';
3
- export { T as TwoslashFloatingVueOptions, a as TwoslashFloatingVueRendererOptions, b as TwoslashTypesCache, r as rendererFloatingVue } from './shared/vitepress-twoslash.D0M9n6iV.js';
4
- export { defaultHoverInfoProcessor } from '@shikijs/twoslash';
5
- import '@shikijs/twoslash/core';
6
- import 'twoslash';
7
- import 'twoslash-vue';
8
-
9
- /**
10
- * Create a Shiki transformer for VitePress to enable twoslash integration
11
- *
12
- * Add this to `markdown.codeTransformers` in `.vitepress/config.ts`
13
- */
14
- declare function transformerTwoslash(options?: VitePressPluginTwoslashOptions): ShikiTransformer;
15
-
16
- export { VitePressPluginTwoslashOptions, transformerTwoslash };
@@ -1,69 +0,0 @@
1
- import { TransformerTwoslashOptions } from '@shikijs/twoslash/core';
2
- import { TwoslashReturn } from 'twoslash';
3
- import { VueSpecificOptions } from 'twoslash-vue';
4
- import { RendererRichOptions, TwoslashRenderer } from '@shikijs/twoslash';
5
-
6
- interface TwoslashFloatingVueOptions {
7
- classCopyIgnore?: string;
8
- classFloatingPanel?: string;
9
- classCode?: string;
10
- classMarkdown?: string;
11
- floatingVueTheme?: string;
12
- floatingVueThemeQuery?: string;
13
- floatingVueThemeCompletion?: string;
14
- }
15
- interface TwoslashFloatingVueRendererOptions extends RendererRichOptions {
16
- /**
17
- * Class and themes for floating-vue specific nodes
18
- */
19
- floatingVue?: TwoslashFloatingVueOptions;
20
- }
21
- declare function rendererFloatingVue(options?: TwoslashFloatingVueRendererOptions): TwoslashRenderer;
22
-
23
- interface TransformerTwoslashVueOptions extends TransformerTwoslashOptions {
24
- twoslashOptions?: TransformerTwoslashOptions['twoslashOptions'] & VueSpecificOptions;
25
- }
26
- interface VitePressPluginTwoslashOptions extends TransformerTwoslashVueOptions, TwoslashFloatingVueRendererOptions {
27
- /**
28
- * Requires adding `twoslash` to the code block explicitly to run twoslash
29
- * @default true
30
- */
31
- explicitTrigger?: TransformerTwoslashOptions['explicitTrigger'];
32
- /**
33
- * The options for caching resolved types
34
- *
35
- * @example
36
- * ```ts
37
- * import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
38
- * import { createFileSystemTypesCache } from '@shikijs/vitepress-twoslash/cache-fs'
39
- *
40
- * transformerTwoslash({
41
- * typesCache: createFileSystemTypesCache({
42
- * dir: './my-cache-dir'
43
- * })
44
- * })
45
- * ```
46
- */
47
- typesCache?: TwoslashTypesCache;
48
- }
49
- interface TwoslashTypesCache {
50
- /**
51
- * Read cached result
52
- *
53
- * @param code Source code
54
- */
55
- read: (code: string) => TwoslashReturn | null;
56
- /**
57
- * Save result to cache
58
- *
59
- * @param code Source code
60
- * @param data Twoslash data
61
- */
62
- write: (code: string, data: TwoslashReturn) => void;
63
- /**
64
- * On initialization
65
- */
66
- init?: () => void;
67
- }
68
-
69
- export { type TwoslashFloatingVueOptions as T, type VitePressPluginTwoslashOptions as V, type TwoslashFloatingVueRendererOptions as a, type TwoslashTypesCache as b, rendererFloatingVue as r };