@speed-highlight/core
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -1,8 +0,3 @@ | ||
/** | ||
* Try to find the language the given code belong to | ||
* @param code The code | ||
* @returns The language of the code | ||
*/ | ||
export declare function detectLanguage( | ||
code: string | ||
): Promise<import('.').ShjLanguage> | ||
export function detectLanguage(code: string): ShjLanguage; | ||
export type ShjLanguage = import('./index.js').ShjLanguage; | ||
//# sourceMappingURL=detect.d.ts.map |
@@ -1,59 +0,8 @@ | ||
/////////// typedef.js /////////// | ||
/** | ||
* Supported languages. | ||
*/ | ||
export type ShjLanguage = 'asm'|'bash'|'bf'|'c'|'css'|'csv'|'diff'|'docker'|'git'|'go'|'html'|'http'|'ini'|'java'|'js'|'jsdoc'|'json'|'leanpub-md'|'log'|'lua'|'make'|'md'|'pl'|'plain'|'py'|'regex'|'rs'|'sql'|'todo'|'toml'|'ts'|'uri'|'xml'|'yaml'; | ||
/** | ||
* Themes supported in the browser. | ||
*/ | ||
export type ShjBrowserTheme = 'atom-dark'|'github-dark'|'github-dim'|'dark'|'default'|'github-light'|'visual-studio-dark'; | ||
/** | ||
* Languages supported in the terminal. | ||
*/ | ||
export type ShjTerminalTheme = 'default'|'atom-dark'; | ||
/** | ||
* * `inline` inside `code` element | ||
* * `oneline` inside `div` element and containing only one line | ||
* * `multiline` inside `div` element | ||
*/ | ||
export type ShjDisplayMode = 'inline'|'oneline'|'multiline'; | ||
export type ShjToken = 'deleted'|'err'|'var'|'section'|'kwd'|'class'|'cmnt'|'insert'|'type'|'func'|'bool'|'num'|'oper'|'str'|'esc'; | ||
export interface ShjOptions { | ||
/** | ||
* Indicates whether to hide line numbers. | ||
* @default false | ||
*/ | ||
hideLineNumbers: boolean; | ||
} | ||
/////////// Custom Types /////////// | ||
export type ShjLanguageComponent = | ||
| { type: string; match: RegExp } | ||
| { extand: string } | ||
| { | ||
match: RegExp; | ||
sub: | ||
| string | ||
| ((code: string) => { | ||
type: string; | ||
sub: Array<{ match: RegExp; sub: string | Promise<string> }> | ||
}); | ||
}; | ||
export type ShjLanguageDefinition = Array<ShjLanguageComponent>; | ||
/////////// index.js /////////// | ||
/** | ||
* Find the tokens in the given code and call the callback | ||
* @param src The code | ||
* @param lang The language of the code | ||
* @param callback The callback function | ||
* Find the tokens in the given code and call the given callback | ||
* | ||
* @function tokenize | ||
* @param {String} src The code | ||
* @param {ShjLanguage|Array} lang The language of the code | ||
* @param {function(String, ShjToken=):void} token The callback function | ||
* this function will be given | ||
@@ -63,8 +12,3 @@ * * the text of the token | ||
*/ | ||
export declare function tokenize<T extends string = ShjLanguage>( | ||
src: string, | ||
lang: T, | ||
callback: (value: string, token: ShjToken) => void | ||
): Promise<void>; | ||
export function tokenize(src: string, lang: ShjLanguage | any[], token: (arg0: string, arg1: ShjToken | undefined) => void): Promise<void>; | ||
/** | ||
@@ -74,43 +18,49 @@ * Highlight a string passed as argument and return it | ||
* elm.innerHTML = await highlightText(code, 'js'); | ||
* @param src The code | ||
* @param lang The language of the code | ||
* @param multiline If it is multiline, it will add a wrapper for the line numbering and header | ||
* @param Customization options | ||
* @returns The highlighted string | ||
* | ||
* @async | ||
* @function highlightText | ||
* @param {String} src The code | ||
* @param {ShjLanguage} lang The language of the code | ||
* @param {Boolean} [multiline=true] If it is multiline, it will add a wrapper for the line numbering and header | ||
* @param {ShjOptions} [opt={}] Customization options | ||
* @returns {Promise<String>} The highlighted string | ||
*/ | ||
export declare function highlightText<T extends string = ShjLanguage>( | ||
src: string, | ||
lang: T, | ||
multiline?: boolean, | ||
opt?: ShjOptions | ||
): Promise<string>; | ||
export function highlightText(src: string, lang: ShjLanguage, multiline?: boolean, opt?: ShjOptions): Promise<string>; | ||
/** | ||
* Highlight a DOM element by getting the new innerHTML with highlightText | ||
* @param elm The DOM element | ||
* @param lang The language of the code (seaching by default on `elm` for a 'shj-lang-' class) | ||
* @param mode The display mode (guessed by default) | ||
* @param opt Customization options | ||
* | ||
* @async | ||
* @function highlightElement | ||
* @param {Element} elm The DOM element | ||
* @param {ShjLanguage} [lang] The language of the code (seaching by default on `elm` for a 'shj-lang-' class) | ||
* @param {ShjDisplayMode} [mode] The display mode (guessed by default) | ||
* @param {ShjOptions} [opt={}] Customization options | ||
*/ | ||
export declare function highlightElement<T extends string = ShjLanguage>( | ||
elm: Element, | ||
lang?: T, | ||
mode?: ShjDisplayMode, | ||
opt?: ShjOptions | ||
): Promise<void>; | ||
export function highlightElement(elm: Element, lang?: ShjLanguage, mode?: ShjDisplayMode, opt?: ShjOptions): Promise<void>; | ||
export function highlightAll(opt?: ShjOptions): Promise<any>; | ||
export function loadLanguage(languageName: string, language: ShjLanguage): void; | ||
/** | ||
* Call highlightElement on element with a css class starting with `shj-lang-` | ||
* @param opt Customization options | ||
* Default languages supported | ||
*/ | ||
export declare function highlightAll(opt?: ShjOptions): Promise<void>; | ||
export type ShjLanguage = ('asm' | 'bash' | 'bf' | 'c' | 'css' | 'csv' | 'diff' | 'docker' | 'git' | 'go' | 'html' | 'http' | 'ini' | 'java' | 'js' | 'jsdoc' | 'json' | 'leanpub-md' | 'log' | 'lua' | 'make' | 'md' | 'pl' | 'plain' | 'py' | 'regex' | 'rs' | 'sql' | 'todo' | 'toml' | 'ts' | 'uri' | 'xml' | 'yaml'); | ||
/** | ||
* Load a language and add it to the langs object | ||
* @param name The name of the language | ||
* @param module Module that has the language as the default export | ||
* Themes supported in the browser | ||
*/ | ||
export declare function loadLanguage( | ||
name: string, | ||
module: { default: ShjLanguageDefinition } | ||
): void; | ||
export type ShjBrowserTheme = ('atom-dark' | 'github-dark' | 'github-dim' | 'dark' | 'default' | 'github-light' | 'visual-studio-dark'); | ||
export type ShjOptions = { | ||
/** | ||
* Indicates whether to hide line numbers | ||
*/ | ||
hideLineNumbers?: boolean; | ||
}; | ||
/** | ||
* * `inline` inside `code` element | ||
* * `oneline` inside `div` element and containing only one line | ||
* * `multiline` inside `div` element | ||
*/ | ||
export type ShjDisplayMode = ('inline' | 'oneline' | 'multiline'); | ||
/** | ||
* Token types | ||
*/ | ||
export type ShjToken = ('deleted' | 'err' | 'var' | 'section' | 'kwd' | 'class' | 'cmnt' | 'insert' | 'type' | 'func' | 'bool' | 'num' | 'oper' | 'str' | 'esc'); | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
var t=[{type:"cmnt",match:/;.*/gm},{expand:"str"},{expand:"num"},{type:"kwd",match:/^[a-z]+\s+[a-z.]+/gm,sub:[{type:"func",match:/^[a-z]+/g}]},{type:"kwd",match:/^\t*[a-z]+/gm},{match:/%|\$/g,type:"oper"}];export{t as default}; | ||
var t=[{type:"cmnt",match:/(;|#).*/gm},{expand:"str"},{expand:"num"},{type:"num",match:/\$[\da-fA-F]*\b/g},{type:"kwd",match:/^[a-z]+\s+[a-z.]+\b/gm,sub:[{type:"func",match:/^[a-z]+/g}]},{type:"kwd",match:/^\t*[a-z][a-z\d]*\b/gm},{match:/%|\$/g,type:"oper"}];export{t as default}; |
@@ -1,2 +0,2 @@ | ||
var c=[["bash",[/#!(\/usr)?\/bin\/bash/g,500],[/\b(if|elif|then|fi|echo)\b|\$/g,10]],["html",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^\s+<!DOCTYPE\s+html/g,500]],["http",[/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g,500]],["js",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g,10]],["ts",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g,10]],["py",[/\b(def|print|class|and|or|lambda)\b/g,10]],["sql",[/\b(SELECT|INSERT|FROM)\b/g,50]],["pl",[/#!(\/usr)?\/bin\/perl/g,500],[/\b(use|print)\b|\$/g,10]],["lua",[/#!(\/usr)?\/bin\/lua/g,500]],["make",[/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm,10]],["uri",[/https?:|mailto:|tel:|ftp:/g,30]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["diff",[/^[+><-]/gm,10],[/^@@ ?[-+,0-9 ]+ ?@@/gm,25]],["md",[/^(>|\t\*|\t\d+.)/gm,10],[/\[.*\](.*)/g,10]],["docker",[/^(FROM|ENTRYPOINT|RUN)/gm,500]],["xml",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^<\?xml/g,500]],["c",[/#include\b|\bprintf\s+\(/g,100]],["rs",[/^\s+(use|fn|mut|match)\b/gm,100]],["go",[/\b(func|fmt|package)\b/g,100]],["java",[/^import\s+java/gm,500]],["asm",[/^(section|global main|extern|\t(call|mov|ret))/gm,100]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["json",[/\b(true|false|null|\{})\b|\"[^"]+\":/g,10]],["yaml",[/^(\s+)?[a-z][a-z0-9]*:/gmi,10]]],s=a=>{var m;return((m=c.map(([e,...t])=>[e,t.reduce((g,[n,i])=>g+[...a.matchAll(n)].length*i,0)]).filter(([e,t])=>t>20).sort((e,t)=>t[1]-e[1])[0])==null?void 0:m[0])||"plain"};var p=[{type:"cmnt",match:/^>.*|(=|-)\1+/gm},{type:"class",match:/\*\*((?!\*\*).)*\*\*/g},{match:/```((?!```)[^])*\n```/g,sub:a=>({type:"kwd",sub:[{match:/\n[^]*(?=```)/g,sub:a.split(` | ||
`)[0].slice(3)||s(a)}]})},{type:"str",match:/`[^`]*`/g},{type:"var",match:/~~((?!~~).)*~~/g},{type:"kwd",match:/_[^_]*_|\*[^*]*\*/g},{type:"kwd",match:/^\s*(\*|\d+\.)\s/gm},{type:"oper",match:/\[[^\]]*]/g},{type:"func",match:/\([^)]*\)/g}];export{p as default}; | ||
var c=[["bash",[/#!(\/usr)?\/bin\/bash/g,500],[/\b(if|elif|then|fi|echo)\b|\$/g,10]],["html",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^\s+<!DOCTYPE\s+html/g,500]],["http",[/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g,500]],["js",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g,10]],["ts",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g,10]],["py",[/\b(def|print|class|and|or|lambda)\b/g,10]],["sql",[/\b(SELECT|INSERT|FROM)\b/g,50]],["pl",[/#!(\/usr)?\/bin\/perl/g,500],[/\b(use|print)\b|\$/g,10]],["lua",[/#!(\/usr)?\/bin\/lua/g,500]],["make",[/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm,10]],["uri",[/https?:|mailto:|tel:|ftp:/g,30]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["diff",[/^[+><-]/gm,10],[/^@@ ?[-+,0-9 ]+ ?@@/gm,25]],["md",[/^(>|\t\*|\t\d+.)/gm,10],[/\[.*\](.*)/g,10]],["docker",[/^(FROM|ENTRYPOINT|RUN)/gm,500]],["xml",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^<\?xml/g,500]],["c",[/#include\b|\bprintf\s+\(/g,100]],["rs",[/^\s+(use|fn|mut|match)\b/gm,100]],["go",[/\b(func|fmt|package)\b/g,100]],["java",[/^import\s+java/gm,500]],["asm",[/^(section|global main|extern|\t(call|mov|ret))/gm,100]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["json",[/\b(true|false|null|\{})\b|\"[^"]+\":/g,10]],["yaml",[/^(\s+)?[a-z][a-z0-9]*:/gmi,10]]],m=a=>{var s;return((s=c.map(([e,...t])=>[e,t.reduce((g,[n,i])=>g+[...a.matchAll(n)].length*i,0)]).filter(([e,t])=>t>20).sort((e,t)=>t[1]-e[1])[0])==null?void 0:s[0])||"plain"};var p=[{type:"cmnt",match:/^>.*|(=|-)\1+/gm},{type:"class",match:/\*\*((?!\*\*).)*\*\*/g},{match:/```((?!```)[^])*\n```/g,sub:a=>({type:"kwd",sub:[{match:/\n[^]*(?=```)/g,sub:a.split(` | ||
`)[0].slice(3)||m(a)}]})},{type:"str",match:/`[^`]*`/g},{type:"var",match:/~~((?!~~).)*~~/g},{type:"kwd",match:/_[^_]*_|\*[^*]*\*/g},{type:"kwd",match:/^\s*(\*|\d+\.)\s/gm},{type:"oper",match:/\[[^\]]*]/g},{type:"func",match:/\([^)]*\)/g}];export{p as default}; |
@@ -1,8 +0,3 @@ | ||
/** | ||
* Try to find the language the given code belong to | ||
* @param code The code | ||
* @returns The language of the code | ||
*/ | ||
export declare function detectLanguage( | ||
code: string | ||
): Promise<import('.').ShjLanguage> | ||
export function detectLanguage(code: string): ShjLanguage; | ||
export type ShjLanguage = import('./index.js').ShjLanguage; | ||
//# sourceMappingURL=detect.d.ts.map |
@@ -1,59 +0,8 @@ | ||
/////////// typedef.js /////////// | ||
/** | ||
* Supported languages. | ||
*/ | ||
export type ShjLanguage = 'asm'|'bash'|'bf'|'c'|'css'|'csv'|'diff'|'docker'|'git'|'go'|'html'|'http'|'ini'|'java'|'js'|'jsdoc'|'json'|'leanpub-md'|'log'|'lua'|'make'|'md'|'pl'|'plain'|'py'|'regex'|'rs'|'sql'|'todo'|'toml'|'ts'|'uri'|'xml'|'yaml'; | ||
/** | ||
* Themes supported in the browser. | ||
*/ | ||
export type ShjBrowserTheme = 'atom-dark'|'github-dark'|'github-dim'|'dark'|'default'|'github-light'|'visual-studio-dark'; | ||
/** | ||
* Languages supported in the terminal. | ||
*/ | ||
export type ShjTerminalTheme = 'default'|'atom-dark'; | ||
/** | ||
* * `inline` inside `code` element | ||
* * `oneline` inside `div` element and containing only one line | ||
* * `multiline` inside `div` element | ||
*/ | ||
export type ShjDisplayMode = 'inline'|'oneline'|'multiline'; | ||
export type ShjToken = 'deleted'|'err'|'var'|'section'|'kwd'|'class'|'cmnt'|'insert'|'type'|'func'|'bool'|'num'|'oper'|'str'|'esc'; | ||
export interface ShjOptions { | ||
/** | ||
* Indicates whether to hide line numbers. | ||
* @default false | ||
*/ | ||
hideLineNumbers: boolean; | ||
} | ||
/////////// Custom Types /////////// | ||
export type ShjLanguageComponent = | ||
| { type: string; match: RegExp } | ||
| { extand: string } | ||
| { | ||
match: RegExp; | ||
sub: | ||
| string | ||
| ((code: string) => { | ||
type: string; | ||
sub: Array<{ match: RegExp; sub: string | Promise<string> }> | ||
}); | ||
}; | ||
export type ShjLanguageDefinition = Array<ShjLanguageComponent>; | ||
/////////// index.js /////////// | ||
/** | ||
* Find the tokens in the given code and call the callback | ||
* @param src The code | ||
* @param lang The language of the code | ||
* @param callback The callback function | ||
* Find the tokens in the given code and call the given callback | ||
* | ||
* @function tokenize | ||
* @param {String} src The code | ||
* @param {ShjLanguage|Array} lang The language of the code | ||
* @param {function(String, ShjToken=):void} token The callback function | ||
* this function will be given | ||
@@ -63,8 +12,3 @@ * * the text of the token | ||
*/ | ||
export declare function tokenize<T extends string = ShjLanguage>( | ||
src: string, | ||
lang: T, | ||
callback: (value: string, token: ShjToken) => void | ||
): Promise<void>; | ||
export function tokenize(src: string, lang: ShjLanguage | any[], token: (arg0: string, arg1: ShjToken | undefined) => void): Promise<void>; | ||
/** | ||
@@ -74,43 +18,49 @@ * Highlight a string passed as argument and return it | ||
* elm.innerHTML = await highlightText(code, 'js'); | ||
* @param src The code | ||
* @param lang The language of the code | ||
* @param multiline If it is multiline, it will add a wrapper for the line numbering and header | ||
* @param Customization options | ||
* @returns The highlighted string | ||
* | ||
* @async | ||
* @function highlightText | ||
* @param {String} src The code | ||
* @param {ShjLanguage} lang The language of the code | ||
* @param {Boolean} [multiline=true] If it is multiline, it will add a wrapper for the line numbering and header | ||
* @param {ShjOptions} [opt={}] Customization options | ||
* @returns {Promise<String>} The highlighted string | ||
*/ | ||
export declare function highlightText<T extends string = ShjLanguage>( | ||
src: string, | ||
lang: T, | ||
multiline?: boolean, | ||
opt?: ShjOptions | ||
): Promise<string>; | ||
export function highlightText(src: string, lang: ShjLanguage, multiline?: boolean, opt?: ShjOptions): Promise<string>; | ||
/** | ||
* Highlight a DOM element by getting the new innerHTML with highlightText | ||
* @param elm The DOM element | ||
* @param lang The language of the code (seaching by default on `elm` for a 'shj-lang-' class) | ||
* @param mode The display mode (guessed by default) | ||
* @param opt Customization options | ||
* | ||
* @async | ||
* @function highlightElement | ||
* @param {Element} elm The DOM element | ||
* @param {ShjLanguage} [lang] The language of the code (seaching by default on `elm` for a 'shj-lang-' class) | ||
* @param {ShjDisplayMode} [mode] The display mode (guessed by default) | ||
* @param {ShjOptions} [opt={}] Customization options | ||
*/ | ||
export declare function highlightElement<T extends string = ShjLanguage>( | ||
elm: Element, | ||
lang?: T, | ||
mode?: ShjDisplayMode, | ||
opt?: ShjOptions | ||
): Promise<void>; | ||
export function highlightElement(elm: Element, lang?: ShjLanguage, mode?: ShjDisplayMode, opt?: ShjOptions): Promise<void>; | ||
export function highlightAll(opt?: ShjOptions): Promise<any>; | ||
export function loadLanguage(languageName: string, language: ShjLanguage): void; | ||
/** | ||
* Call highlightElement on element with a css class starting with `shj-lang-` | ||
* @param opt Customization options | ||
* Default languages supported | ||
*/ | ||
export declare function highlightAll(opt?: ShjOptions): Promise<void>; | ||
export type ShjLanguage = ('asm' | 'bash' | 'bf' | 'c' | 'css' | 'csv' | 'diff' | 'docker' | 'git' | 'go' | 'html' | 'http' | 'ini' | 'java' | 'js' | 'jsdoc' | 'json' | 'leanpub-md' | 'log' | 'lua' | 'make' | 'md' | 'pl' | 'plain' | 'py' | 'regex' | 'rs' | 'sql' | 'todo' | 'toml' | 'ts' | 'uri' | 'xml' | 'yaml'); | ||
/** | ||
* Load a language and add it to the langs object | ||
* @param name The name of the language | ||
* @param module Module that has the language as the default export | ||
* Themes supported in the browser | ||
*/ | ||
export declare function loadLanguage( | ||
name: string, | ||
module: { default: ShjLanguageDefinition } | ||
): void; | ||
export type ShjBrowserTheme = ('atom-dark' | 'github-dark' | 'github-dim' | 'dark' | 'default' | 'github-light' | 'visual-studio-dark'); | ||
export type ShjOptions = { | ||
/** | ||
* Indicates whether to hide line numbers | ||
*/ | ||
hideLineNumbers?: boolean; | ||
}; | ||
/** | ||
* * `inline` inside `code` element | ||
* * `oneline` inside `div` element and containing only one line | ||
* * `multiline` inside `div` element | ||
*/ | ||
export type ShjDisplayMode = ('inline' | 'oneline' | 'multiline'); | ||
/** | ||
* Token types | ||
*/ | ||
export type ShjToken = ('deleted' | 'err' | 'var' | 'section' | 'kwd' | 'class' | 'cmnt' | 'insert' | 'type' | 'func' | 'bool' | 'num' | 'oper' | 'str' | 'esc'); | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var n=(a,t)=>{for(var m in t)p(a,m,{get:t[m],enumerable:!0})},y=(a,t,m,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of g(t))!h.call(a,e)&&e!==m&&p(a,e,{get:()=>t[e],enumerable:!(c=d(t,e))||c.enumerable});return a};var u=a=>y(p({},"__esModule",{value:!0}),a);var r={};n(r,{default:()=>z});module.exports=u(r);var z=[{type:"cmnt",match:/;.*/gm},{expand:"str"},{expand:"num"},{type:"kwd",match:/^[a-z]+\s+[a-z.]+/gm,sub:[{type:"func",match:/^[a-z]+/g}]},{type:"kwd",match:/^\t*[a-z]+/gm},{match:/%|\$/g,type:"oper"}];0&&(module.exports={}); | ||
var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var n=(a,t)=>{for(var e in t)p(a,e,{get:t[e],enumerable:!0})},y=(a,t,e,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of g(t))!h.call(a,m)&&m!==e&&p(a,m,{get:()=>t[m],enumerable:!(c=d(t,m))||c.enumerable});return a};var u=a=>y(p({},"__esModule",{value:!0}),a);var b={};n(b,{default:()=>z});module.exports=u(b);var z=[{type:"cmnt",match:/(;|#).*/gm},{expand:"str"},{expand:"num"},{type:"num",match:/\$[\da-fA-F]*\b/g},{type:"kwd",match:/^[a-z]+\s+[a-z.]+\b/gm,sub:[{type:"func",match:/^[a-z]+/g}]},{type:"kwd",match:/^\t*[a-z][a-z\d]*\b/gm},{match:/%|\$/g,type:"oper"}];0&&(module.exports={}); |
@@ -1,2 +0,2 @@ | ||
var g=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var o=(t,a)=>{for(var e in a)g(t,e,{get:a[e],enumerable:!0})},b=(t,a,e,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let s of r(a))!p.call(t,s)&&s!==e&&g(t,s,{get:()=>a[s],enumerable:!(m=l(a,s))||m.enumerable});return t};var u=t=>b(g({},"__esModule",{value:!0}),t);var d={};o(d,{default:()=>h});module.exports=u(d);var f=[["bash",[/#!(\/usr)?\/bin\/bash/g,500],[/\b(if|elif|then|fi|echo)\b|\$/g,10]],["html",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^\s+<!DOCTYPE\s+html/g,500]],["http",[/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g,500]],["js",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g,10]],["ts",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g,10]],["py",[/\b(def|print|class|and|or|lambda)\b/g,10]],["sql",[/\b(SELECT|INSERT|FROM)\b/g,50]],["pl",[/#!(\/usr)?\/bin\/perl/g,500],[/\b(use|print)\b|\$/g,10]],["lua",[/#!(\/usr)?\/bin\/lua/g,500]],["make",[/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm,10]],["uri",[/https?:|mailto:|tel:|ftp:/g,30]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["diff",[/^[+><-]/gm,10],[/^@@ ?[-+,0-9 ]+ ?@@/gm,25]],["md",[/^(>|\t\*|\t\d+.)/gm,10],[/\[.*\](.*)/g,10]],["docker",[/^(FROM|ENTRYPOINT|RUN)/gm,500]],["xml",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^<\?xml/g,500]],["c",[/#include\b|\bprintf\s+\(/g,100]],["rs",[/^\s+(use|fn|mut|match)\b/gm,100]],["go",[/\b(func|fmt|package)\b/g,100]],["java",[/^import\s+java/gm,500]],["asm",[/^(section|global main|extern|\t(call|mov|ret))/gm,100]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["json",[/\b(true|false|null|\{})\b|\"[^"]+\":/g,10]],["yaml",[/^(\s+)?[a-z][a-z0-9]*:/gmi,10]]],n=t=>{var a;return((a=f.map(([e,...m])=>[e,m.reduce((s,[i,c])=>s+[...t.matchAll(i)].length*c,0)]).filter(([e,m])=>m>20).sort((e,m)=>m[1]-e[1])[0])==null?void 0:a[0])||"plain"};var h=[{type:"cmnt",match:/^>.*|(=|-)\1+/gm},{type:"class",match:/\*\*((?!\*\*).)*\*\*/g},{match:/```((?!```)[^])*\n```/g,sub:t=>({type:"kwd",sub:[{match:/\n[^]*(?=```)/g,sub:t.split(` | ||
var g=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var o=(t,a)=>{for(var e in a)g(t,e,{get:a[e],enumerable:!0})},b=(t,a,e,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let m of r(a))!p.call(t,m)&&m!==e&&g(t,m,{get:()=>a[m],enumerable:!(s=l(a,m))||s.enumerable});return t};var u=t=>b(g({},"__esModule",{value:!0}),t);var d={};o(d,{default:()=>h});module.exports=u(d);var f=[["bash",[/#!(\/usr)?\/bin\/bash/g,500],[/\b(if|elif|then|fi|echo)\b|\$/g,10]],["html",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^\s+<!DOCTYPE\s+html/g,500]],["http",[/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g,500]],["js",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g,10]],["ts",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g,10]],["py",[/\b(def|print|class|and|or|lambda)\b/g,10]],["sql",[/\b(SELECT|INSERT|FROM)\b/g,50]],["pl",[/#!(\/usr)?\/bin\/perl/g,500],[/\b(use|print)\b|\$/g,10]],["lua",[/#!(\/usr)?\/bin\/lua/g,500]],["make",[/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm,10]],["uri",[/https?:|mailto:|tel:|ftp:/g,30]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["diff",[/^[+><-]/gm,10],[/^@@ ?[-+,0-9 ]+ ?@@/gm,25]],["md",[/^(>|\t\*|\t\d+.)/gm,10],[/\[.*\](.*)/g,10]],["docker",[/^(FROM|ENTRYPOINT|RUN)/gm,500]],["xml",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^<\?xml/g,500]],["c",[/#include\b|\bprintf\s+\(/g,100]],["rs",[/^\s+(use|fn|mut|match)\b/gm,100]],["go",[/\b(func|fmt|package)\b/g,100]],["java",[/^import\s+java/gm,500]],["asm",[/^(section|global main|extern|\t(call|mov|ret))/gm,100]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["json",[/\b(true|false|null|\{})\b|\"[^"]+\":/g,10]],["yaml",[/^(\s+)?[a-z][a-z0-9]*:/gmi,10]]],n=t=>{var a;return((a=f.map(([e,...s])=>[e,s.reduce((m,[i,c])=>m+[...t.matchAll(i)].length*c,0)]).filter(([e,s])=>s>20).sort((e,s)=>s[1]-e[1])[0])==null?void 0:a[0])||"plain"};var h=[{type:"cmnt",match:/^>.*|(=|-)\1+/gm},{type:"class",match:/\*\*((?!\*\*).)*\*\*/g},{match:/```((?!```)[^])*\n```/g,sub:t=>({type:"kwd",sub:[{match:/\n[^]*(?=```)/g,sub:t.split(` | ||
`)[0].slice(3)||n(t)}]})},{type:"str",match:/`[^`]*`/g},{type:"var",match:/~~((?!~~).)*~~/g},{type:"kwd",match:/_[^_]*_|\*[^*]*\*/g},{type:"kwd",match:/^\s*(\*|\d+\.)\s/gm},{type:"oper",match:/\[[^\]]*]/g},{type:"func",match:/\([^)]*\)/g}];0&&(module.exports={}); |
@@ -0,26 +1,9 @@ | ||
export function highlightText(src: string, lang: ShjLanguage): Promise<string>; | ||
export function printHighlight(src: string, lang: ShjLanguage): Promise<any>; | ||
export function setTheme(name: ShjTerminalTheme): Promise<any>; | ||
export type ShjLanguage = import('./index.js').ShjLanguage; | ||
/** | ||
* Highlight a string passed as argument and return a string that can directly be printed | ||
* @param src The code | ||
* @param ang The language of the code | ||
* @returns The highlighted string | ||
* Languages supported | ||
*/ | ||
export declare function highlightText<T extends string = import('.').ShjLanguage>( | ||
src: string, | ||
lang: T | ||
): Promise<string>; | ||
/** | ||
* Highlight and print a given string | ||
* @param src The code | ||
* @param lang The language of the code | ||
*/ | ||
export declare function printHighlight<T extends string = import('.').ShjLanguage>( | ||
src: string, | ||
lang: T | ||
): Promise<void>; | ||
/** | ||
* Change the current used theme for highlighting | ||
* @param name The name of the theme | ||
*/ | ||
export declare function setTheme(name: import('.').ShjBrowserTheme): Promise<void>; | ||
export type ShjTerminalTheme = ('default' | 'atom-dark'); | ||
//# sourceMappingURL=terminal.d.ts.map |
@@ -1,1 +0,1 @@ | ||
var L=Object.create;var m=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(t&&(e=t(t=0)),e);var y=(t,e)=>{for(var n in e)m(t,n,{get:e[n],enumerable:!0})},b=(t,e,n,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of z(e))!E.call(t,a)&&a!==n&&m(t,a,{get:()=>e[a],enumerable:!(p=T(e,a))||p.enumerable});return t};var o=(t,e,n)=>(n=t!=null?L(D(t)):{},b(e||!t||!t.__esModule?m(n,"default",{value:t,enumerable:!0}):n,t)),N=t=>b(m({},"__esModule",{value:!0}),t);var r,$=g(()=>{r={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",gray:"\x1B[90m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"}});var j={};y(j,{default:()=>C});var C,v=g(()=>{$();C={deleted:r.red,var:r.red,err:r.red,kwd:r.red,num:r.yellow,class:r.yellow,cmnt:r.gray,insert:r.green,str:r.green,bool:r.cyan,type:r.blue,oper:r.blue,section:r.magenta,func:r.magenta}});var S={};y(S,{highlightText:()=>I,printHighlight:()=>H,setTheme:()=>M});module.exports=N(S);var w={num:{type:"num",match:/(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g},str:{type:"str",match:/(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g},strDouble:{type:"str",match:/"((?!")[^\r\n\\]|\\[^])*"?/g}};var u={};async function f(t,e,n){var p;try{let a,s,i={},d,l=[],c=0,x=typeof e=="string"?await((p=u[e])!=null?p:u[e]=Promise.resolve().then(()=>o(require(`./languages/${e}.js`)))):e,h=[...typeof e=="string"?x.default:e.sub];for(;c<t.length;){for(i.index=null,a=h.length;a-- >0;){if(s=h[a].expand?w[h[a].expand]:h[a],l[a]===void 0||l[a].match.index<c){if(s.match.lastIndex=c,d=s.match.exec(t),d===null){h.splice(a,1),l.splice(a,1);continue}l[a]={match:d,lastIndex:s.match.lastIndex}}l[a].match[0]&&(l[a].match.index<=i.index||i.index===null)&&(i={part:s,index:l[a].match.index,match:l[a].match[0],end:l[a].lastIndex})}if(i.index===null)break;n(t.slice(c,i.index),x.type),c=i.end,i.part.sub?await f(i.match,typeof i.part.sub=="string"?i.part.sub:typeof i.part.sub=="function"?i.part.sub(i.match):i.part,n):n(i.match,i.part.type)}n(t.slice(c,t.length),x.type)}catch{n(t)}}var A=Promise.resolve().then(()=>(v(),j)),I=async(t,e)=>{let n="",p=(await A).default;return await f(t,e,(a,s)=>{var i;return n+=s?`${(i=p[s])!=null?i:""}${a}\x1B[0m`:a}),n},H=async(t,e)=>console.log(await I(t,e)),M=async t=>A=Promise.resolve().then(()=>o(require(`./themes/${t}.js`)));0&&(module.exports={highlightText,printHighlight,setTheme}); | ||
var L=Object.create;var d=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(t&&(e=t(t=0)),e);var y=(t,e)=>{for(var i in e)d(t,i,{get:e[i],enumerable:!0})},b=(t,e,i,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of z(e))!E.call(t,a)&&a!==i&&d(t,a,{get:()=>e[a],enumerable:!(c=T(e,a))||c.enumerable});return t};var m=(t,e,i)=>(i=t!=null?L(D(t)):{},b(e||!t||!t.__esModule?d(i,"default",{value:t,enumerable:!0}):i,t)),N=t=>b(d({},"__esModule",{value:!0}),t);var l,$=g(()=>{l={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",gray:"\x1B[90m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"}});var j={};y(j,{default:()=>C});var C,v=g(()=>{$();C={deleted:l.red,var:l.red,err:l.red,kwd:l.red,num:l.yellow,class:l.yellow,cmnt:l.gray,insert:l.green,str:l.green,bool:l.cyan,type:l.blue,oper:l.blue,section:l.magenta,func:l.magenta}});var S={};y(S,{highlightText:()=>I,printHighlight:()=>H,setTheme:()=>M});module.exports=N(S);var w={num:{type:"num",match:/(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g},str:{type:"str",match:/(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g},strDouble:{type:"str",match:/"((?!")[^\r\n\\]|\\[^])*"?/g}};var u={};async function f(t,e,i){var c;try{let a,s,n={},o,r=[],h=0,x=typeof e=="string"?await((c=u[e])!=null?c:u[e]=Promise.resolve().then(()=>m(require(`./languages/${e}.js`)))):e,p=[...typeof e=="string"?x.default:e.sub];for(;h<t.length;){for(n.index=null,a=p.length;a-- >0;){if(s=p[a].expand?w[p[a].expand]:p[a],r[a]===void 0||r[a].match.index<h){if(s.match.lastIndex=h,o=s.match.exec(t),o===null){p.splice(a,1),r.splice(a,1);continue}r[a]={match:o,lastIndex:s.match.lastIndex}}r[a].match[0]&&(r[a].match.index<=n.index||n.index===null)&&(n={part:s,index:r[a].match.index,match:r[a].match[0],end:r[a].lastIndex})}if(n.index===null)break;i(t.slice(h,n.index),x.type),h=n.end,n.part.sub?await f(n.match,typeof n.part.sub=="string"?n.part.sub:typeof n.part.sub=="function"?n.part.sub(n.match):n.part,i):i(n.match,n.part.type)}i(t.slice(h,t.length),x.type)}catch{i(t)}}var A=Promise.resolve().then(()=>(v(),j)),I=async(t,e)=>{let i="",c=(await A).default;return await f(t,e,(a,s)=>{var n;return i+=s?`${(n=c[s])!=null?n:""}${a}\x1B[0m`:a}),i},H=async(t,e)=>console.log(await I(t,e)),M=async t=>A=Promise.resolve().then(()=>m(require(`./themes/${t}.js`)));0&&(module.exports={highlightText,printHighlight,setTheme}); |
@@ -0,26 +1,9 @@ | ||
export function highlightText(src: string, lang: ShjLanguage): Promise<string>; | ||
export function printHighlight(src: string, lang: ShjLanguage): Promise<any>; | ||
export function setTheme(name: ShjTerminalTheme): Promise<any>; | ||
export type ShjLanguage = import('./index.js').ShjLanguage; | ||
/** | ||
* Highlight a string passed as argument and return a string that can directly be printed | ||
* @param src The code | ||
* @param ang The language of the code | ||
* @returns The highlighted string | ||
* Languages supported | ||
*/ | ||
export declare function highlightText<T extends string = import('.').ShjLanguage>( | ||
src: string, | ||
lang: T | ||
): Promise<string>; | ||
/** | ||
* Highlight and print a given string | ||
* @param src The code | ||
* @param lang The language of the code | ||
*/ | ||
export declare function printHighlight<T extends string = import('.').ShjLanguage>( | ||
src: string, | ||
lang: T | ||
): Promise<void>; | ||
/** | ||
* Change the current used theme for highlighting | ||
* @param name The name of the theme | ||
*/ | ||
export declare function setTheme(name: import('.').ShjBrowserTheme): Promise<void>; | ||
export type ShjTerminalTheme = ('default' | 'atom-dark'); | ||
//# sourceMappingURL=terminal.d.ts.map |
@@ -1,1 +0,1 @@ | ||
var $=Object.defineProperty;var u=(e,a)=>()=>(e&&(a=e(e=0)),a);var j=(e,a)=>{for(var r in a)$(e,r,{get:a[r],enumerable:!0})};var n,g=u(()=>{n={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",gray:"\x1B[90m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"}});var y={};j(y,{default:()=>v});var v,b=u(()=>{g();v={deleted:n.red,var:n.red,err:n.red,kwd:n.red,num:n.yellow,class:n.yellow,cmnt:n.gray,insert:n.green,str:n.green,bool:n.cyan,type:n.blue,oper:n.blue,section:n.magenta,func:n.magenta}});var f={num:{type:"num",match:/(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g},str:{type:"str",match:/(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g},strDouble:{type:"str",match:/"((?!")[^\r\n\\]|\\[^])*"?/g}};var d={};async function x(e,a,r){var h;try{let i,s,t={},m,l=[],p=0,o=typeof a=="string"?await((h=d[a])!=null?h:d[a]=import(`./languages/${a}.js`)):a,c=[...typeof a=="string"?o.default:a.sub];for(;p<e.length;){for(t.index=null,i=c.length;i-- >0;){if(s=c[i].expand?f[c[i].expand]:c[i],l[i]===void 0||l[i].match.index<p){if(s.match.lastIndex=p,m=s.match.exec(e),m===null){c.splice(i,1),l.splice(i,1);continue}l[i]={match:m,lastIndex:s.match.lastIndex}}l[i].match[0]&&(l[i].match.index<=t.index||t.index===null)&&(t={part:s,index:l[i].match.index,match:l[i].match[0],end:l[i].lastIndex})}if(t.index===null)break;r(e.slice(p,t.index),o.type),p=t.end,t.part.sub?await x(t.match,typeof t.part.sub=="string"?t.part.sub:typeof t.part.sub=="function"?t.part.sub(t.match):t.part,r):r(t.match,t.part.type)}r(e.slice(p,e.length),o.type)}catch{r(e)}}var w=Promise.resolve().then(()=>(b(),y)),A=async(e,a)=>{let r="",h=(await w).default;return await x(e,a,(i,s)=>{var t;return r+=s?`${(t=h[s])!=null?t:""}${i}\x1B[0m`:i}),r},C=async(e,a)=>console.log(await A(e,a)),H=async e=>w=import(`./themes/${e}.js`);export{A as highlightText,C as printHighlight,H as setTheme}; | ||
var $=Object.defineProperty;var u=(e,a)=>()=>(e&&(a=e(e=0)),a);var j=(e,a)=>{for(var l in a)$(e,l,{get:a[l],enumerable:!0})};var i,g=u(()=>{i={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",gray:"\x1B[90m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"}});var y={};j(y,{default:()=>v});var v,b=u(()=>{g();v={deleted:i.red,var:i.red,err:i.red,kwd:i.red,num:i.yellow,class:i.yellow,cmnt:i.gray,insert:i.green,str:i.green,bool:i.cyan,type:i.blue,oper:i.blue,section:i.magenta,func:i.magenta}});var f={num:{type:"num",match:/(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g},str:{type:"str",match:/(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g},strDouble:{type:"str",match:/"((?!")[^\r\n\\]|\\[^])*"?/g}};var o={};async function x(e,a,l){var p;try{let n,s,t={},d,r=[],c=0,m=typeof a=="string"?await((p=o[a])!=null?p:o[a]=import(`./languages/${a}.js`)):a,h=[...typeof a=="string"?m.default:a.sub];for(;c<e.length;){for(t.index=null,n=h.length;n-- >0;){if(s=h[n].expand?f[h[n].expand]:h[n],r[n]===void 0||r[n].match.index<c){if(s.match.lastIndex=c,d=s.match.exec(e),d===null){h.splice(n,1),r.splice(n,1);continue}r[n]={match:d,lastIndex:s.match.lastIndex}}r[n].match[0]&&(r[n].match.index<=t.index||t.index===null)&&(t={part:s,index:r[n].match.index,match:r[n].match[0],end:r[n].lastIndex})}if(t.index===null)break;l(e.slice(c,t.index),m.type),c=t.end,t.part.sub?await x(t.match,typeof t.part.sub=="string"?t.part.sub:typeof t.part.sub=="function"?t.part.sub(t.match):t.part,l):l(t.match,t.part.type)}l(e.slice(c,e.length),m.type)}catch{l(e)}}var w=Promise.resolve().then(()=>(b(),y)),A=async(e,a)=>{let l="",p=(await w).default;return await x(e,a,(n,s)=>{var t;return l+=s?`${(t=p[s])!=null?t:""}${n}\x1B[0m`:n}),l},C=async(e,a)=>console.log(await A(e,a)),H=async e=>w=import(`./themes/${e}.js`);export{A as highlightText,C as printHighlight,H as setTheme}; |
163
package.json
{ | ||
"name": "@speed-highlight/core", | ||
"version": "1.2.4", | ||
"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", | ||
"./detect.js": "./dist/detect.js", | ||
"./terminal.js": "./dist/terminal.js", | ||
"./cjs/index.js": "./dist/node/index.js", | ||
"./cjs/detect.js": "./dist/node/detect.js", | ||
"./cjs/terminal.js": "./dist/node/terminal.js" | ||
}, | ||
"directories": { | ||
"example": "examples" | ||
}, | ||
"scripts": { | ||
"build": "bash .github/workflows/build.sh" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/speed-highlight/core.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/speed-highlight/core/issues" | ||
}, | ||
"keywords": [ | ||
"javascript", | ||
"syntax-highlighting", | ||
"language", | ||
"fast", | ||
"js", | ||
"simple", | ||
"highlighter", | ||
"regex", | ||
"highlighting", | ||
"highlightjs", | ||
"small", | ||
"deno" | ||
], | ||
"author": "matubu", | ||
"license": "CC0-1.0", | ||
"homepage": "https://github.com/speed-highlight/core#readme", | ||
"devDependencies": { | ||
"semantic-release": "^21.0.7", | ||
"@semantic-release/git": "^10.0.1" | ||
}, | ||
"release": { | ||
"branches": [ | ||
"main" | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/npm", | ||
"@semantic-release/git", | ||
"@semantic-release/github" | ||
] | ||
}, | ||
"private": false, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"dist/*", | ||
"dist" | ||
] | ||
} | ||
}, | ||
"type": "module" | ||
"name": "@speed-highlight/core", | ||
"version": "1.2.5", | ||
"description": "🌈 Light, fast, and easy to use, dependencies free javascript syntax highlighter, with automatic language detection", | ||
"main": "./dist/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/node/index.js", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"./detect": { | ||
"import": "./dist/detect.js", | ||
"require": "./dist/node/detect.js", | ||
"types": "./dist/detect.d.ts" | ||
}, | ||
"./terminal": { | ||
"import": "./dist/terminal.js", | ||
"require": "./dist/node/terminal.js", | ||
"types": "./dist/terminal.d.ts" | ||
}, | ||
"./themes/*.css": "./dist/themes/*.css" | ||
}, | ||
"directories": { | ||
"example": "examples" | ||
}, | ||
"scripts": { | ||
"build": "bash .github/workflows/build.sh" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/speed-highlight/core.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/speed-highlight/core/issues" | ||
}, | ||
"keywords": [ | ||
"javascript", | ||
"syntax-highlighting", | ||
"language", | ||
"fast", | ||
"js", | ||
"simple", | ||
"highlighter", | ||
"regex", | ||
"highlighting", | ||
"highlightjs", | ||
"small", | ||
"deno" | ||
], | ||
"author": "matubu", | ||
"license": "CC0-1.0", | ||
"homepage": "https://github.com/speed-highlight/core#readme", | ||
"devDependencies": { | ||
"@semantic-release/git": "^10.0.1", | ||
"semantic-release": "^21.0.7", | ||
"typescript": "^5.3.3" | ||
}, | ||
"release": { | ||
"branches": [ | ||
"main" | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/npm", | ||
"@semantic-release/git", | ||
"@semantic-release/github" | ||
] | ||
}, | ||
"private": false, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"dist/*", | ||
"dist" | ||
] | ||
} | ||
}, | ||
"type": "module" | ||
} |
@@ -87,3 +87,3 @@ # Speed-highlight JS | ||
```js | ||
const { setTheme, printHighlight } = require('@speed-highlight/core/terminal.js'); | ||
const { setTheme, printHighlight } = require('@speed-highlight/core/terminal'); | ||
@@ -90,0 +90,0 @@ setTheme('[theme-name]') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
158514
263
1899
3