@shikijs/twoslash 1.0.0-beta.2 → 1.0.0-beta.3
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/dist/core.mjs +7 -13
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +2 -2
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { splitTokens } from '@shikijs/core';
|
|
2
2
|
|
|
3
3
|
const module = {
|
|
4
4
|
type: "element",
|
|
@@ -928,7 +928,6 @@ function createTransformerFactory(defaultTwoslasher, defaultRenderer) {
|
|
|
928
928
|
if (lang in langAlias)
|
|
929
929
|
lang = langAlias[this.options.lang];
|
|
930
930
|
if (filter(lang, code, this.options)) {
|
|
931
|
-
this.options.mergeWhitespaces = "never";
|
|
932
931
|
const twoslash = twoslasher(code, lang, twoslashOptions);
|
|
933
932
|
this.meta.twoslash = twoslash;
|
|
934
933
|
this.options.lang = twoslash.meta.extension || lang;
|
|
@@ -938,17 +937,12 @@ function createTransformerFactory(defaultTwoslasher, defaultRenderer) {
|
|
|
938
937
|
tokens(tokens) {
|
|
939
938
|
if (!this.meta.twoslash)
|
|
940
939
|
return;
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
if (!breakpointsInToken.length)
|
|
948
|
-
return token;
|
|
949
|
-
return splitToken(token, breakpointsInToken);
|
|
950
|
-
});
|
|
951
|
-
});
|
|
940
|
+
return splitTokens(
|
|
941
|
+
tokens,
|
|
942
|
+
this.meta.twoslash.nodes.flatMap(
|
|
943
|
+
(i) => ["hover", "error", "query", "highlight", "completion"].includes(i.type) ? [i.start, i.start + i.length] : []
|
|
944
|
+
)
|
|
945
|
+
);
|
|
952
946
|
},
|
|
953
947
|
pre(pre) {
|
|
954
948
|
if (this.meta.twoslash)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _shikijs_core_dist_chunk_tokens_mjs from '@shikijs/core/dist/chunk-tokens.mjs';
|
|
2
2
|
import { CreateTwoslashOptions } from 'twoslash';
|
|
3
3
|
import { TransformerTwoslashOptions, RendererRichOptions } from './core.mjs';
|
|
4
4
|
export { CompletionItem, HastExtension, TwoslashRenderer, createTransformerFactory, defaultCompletionIcons, defaultCustomTagIcons, defaultHoverInfoProcessor, defaultTwoslashOptions, rendererClassic, rendererRich } from './core.mjs';
|
|
@@ -16,6 +16,6 @@ interface TransformerTwoslashIndexOptions extends TransformerTwoslashOptions, Pi
|
|
|
16
16
|
/**
|
|
17
17
|
* Factory function to create a Shiki transformer for twoslash integrations.
|
|
18
18
|
*/
|
|
19
|
-
declare function transformerTwoslash(options?: TransformerTwoslashIndexOptions):
|
|
19
|
+
declare function transformerTwoslash(options?: TransformerTwoslashIndexOptions): _shikijs_core_dist_chunk_tokens_mjs.y;
|
|
20
20
|
|
|
21
21
|
export { RendererRichOptions, type TransformerTwoslashIndexOptions, TransformerTwoslashOptions, transformerTwoslash };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _shikijs_core_dist_chunk_tokens_mjs from '@shikijs/core/dist/chunk-tokens.mjs';
|
|
2
2
|
import { CreateTwoslashOptions } from 'twoslash';
|
|
3
3
|
import { TransformerTwoslashOptions, RendererRichOptions } from './core.js';
|
|
4
4
|
export { CompletionItem, HastExtension, TwoslashRenderer, createTransformerFactory, defaultCompletionIcons, defaultCustomTagIcons, defaultHoverInfoProcessor, defaultTwoslashOptions, rendererClassic, rendererRich } from './core.js';
|
|
@@ -16,6 +16,6 @@ interface TransformerTwoslashIndexOptions extends TransformerTwoslashOptions, Pi
|
|
|
16
16
|
/**
|
|
17
17
|
* Factory function to create a Shiki transformer for twoslash integrations.
|
|
18
18
|
*/
|
|
19
|
-
declare function transformerTwoslash(options?: TransformerTwoslashIndexOptions):
|
|
19
|
+
declare function transformerTwoslash(options?: TransformerTwoslashIndexOptions): _shikijs_core_dist_chunk_tokens_mjs.y;
|
|
20
20
|
|
|
21
21
|
export { RendererRichOptions, type TransformerTwoslashIndexOptions, TransformerTwoslashOptions, transformerTwoslash };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/twoslash",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.3",
|
|
5
5
|
"description": "Shiki transformer for twoslash",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"twoslash": "^0.1.0",
|
|
53
|
-
"@shikijs/core": "1.0.0-beta.
|
|
53
|
+
"@shikijs/core": "1.0.0-beta.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@iconify-json/carbon": "^1.1.28",
|