New:Socket for Asana Is Now Available.Learn more
Get Started

@shikijs/primitive

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shikijs/primitive - npm Package Compare versions

Comparing version
4.3.0
to
4.3.1
+6
-5
dist/index.mjs

@@ -620,3 +620,3 @@ import { ShikiError } from "@shikijs/types";

const colorReplacements = resolveColorReplacements(theme, options);
const { tokenizeMaxLineLength = 0, tokenizeTimeLimit = 500 } = options;
const { tokenizeMaxLineLength = 0, tokenizeTimeLimit = 500, includeExplanation = false } = options;
const lines = splitLines(code);

@@ -650,3 +650,3 @@ let stateStack = options.grammarState ? getGrammarStack(options.grammarState, theme.name) ?? INITIAL : options.grammarContextCode != null ? _tokenizeWithTheme(options.grammarContextCode, grammar, theme, colorMap, {

let tokensWithScopesIndex;
if (options.includeExplanation) {
if (includeExplanation && includeExplanation !== "tokenType") {
resultWithScopes = grammar.tokenizeLine(line, stateStack, tokenizeTimeLimit);

@@ -671,5 +671,6 @@ tokensWithScopes = resultWithScopes.tokens;

};
if (options.includeExplanation) {
if (includeExplanation === "tokenType") token.type = EncodedTokenMetadata.getTokenType(metadata);
else if (includeExplanation) {
const themeSettingsSelectors = [];
if (options.includeExplanation !== "scopeName") for (const setting of theme.settings) {
if (includeExplanation !== "scopeName") for (const setting of theme.settings) {
let selectors;

@@ -698,3 +699,3 @@ switch (typeof setting.scope) {

content: tokenWithScopesText,
scopes: options.includeExplanation === "scopeName" ? explainThemeScopesNameOnly(tokenWithScopes.scopes) : explainThemeScopesFull(themeSettingsSelectors, tokenWithScopes.scopes)
scopes: includeExplanation === "scopeName" ? explainThemeScopesNameOnly(tokenWithScopes.scopes) : explainThemeScopesFull(themeSettingsSelectors, tokenWithScopes.scopes)
});

@@ -701,0 +702,0 @@ tokensWithScopesIndex += 1;

{
"name": "@shikijs/primitive",
"type": "module",
"version": "4.3.0",
"version": "4.3.1",
"description": "Tokenizer primitives of Shiki",

@@ -49,3 +49,3 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"@types/hast": "^3.0.4",
"@shikijs/types": "4.3.0"
"@shikijs/types": "4.3.1"
},

@@ -52,0 +52,0 @@ "scripts": {