fix: resolve TypeScript errors in frontend build
This commit is contained in:
8
node_modules/lowlight/lib/all.d.ts
generated
vendored
Normal file
8
node_modules/lowlight/lib/all.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Map of grammars.
|
||||
*
|
||||
* @type {Record<string, LanguageFn>}
|
||||
*/
|
||||
export const grammars: Record<string, LanguageFn>;
|
||||
import type { LanguageFn } from 'highlight.js';
|
||||
//# sourceMappingURL=all.d.ts.map
|
||||
1
node_modules/lowlight/lib/all.d.ts.map
generated
vendored
Normal file
1
node_modules/lowlight/lib/all.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["all.js"],"names":[],"mappings":"AAkKA;;;;GAIG;AACH,uBAFU,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CA+JnC;gCAnU4B,cAAc"}
|
||||
324
node_modules/lowlight/lib/all.js
generated
vendored
Normal file
324
node_modules/lowlight/lib/all.js
generated
vendored
Normal file
@@ -0,0 +1,324 @@
|
||||
/**
|
||||
* @import {LanguageFn} from 'highlight.js'
|
||||
*/
|
||||
|
||||
import $1c from 'highlight.js/lib/languages/1c'
|
||||
import abnf from 'highlight.js/lib/languages/abnf'
|
||||
import accesslog from 'highlight.js/lib/languages/accesslog'
|
||||
import actionscript from 'highlight.js/lib/languages/actionscript'
|
||||
import ada from 'highlight.js/lib/languages/ada'
|
||||
import angelscript from 'highlight.js/lib/languages/angelscript'
|
||||
import apache from 'highlight.js/lib/languages/apache'
|
||||
import applescript from 'highlight.js/lib/languages/applescript'
|
||||
import arcade from 'highlight.js/lib/languages/arcade'
|
||||
import armasm from 'highlight.js/lib/languages/armasm'
|
||||
import asciidoc from 'highlight.js/lib/languages/asciidoc'
|
||||
import aspectj from 'highlight.js/lib/languages/aspectj'
|
||||
import autohotkey from 'highlight.js/lib/languages/autohotkey'
|
||||
import autoit from 'highlight.js/lib/languages/autoit'
|
||||
import avrasm from 'highlight.js/lib/languages/avrasm'
|
||||
import awk from 'highlight.js/lib/languages/awk'
|
||||
import axapta from 'highlight.js/lib/languages/axapta'
|
||||
import basic from 'highlight.js/lib/languages/basic'
|
||||
import bnf from 'highlight.js/lib/languages/bnf'
|
||||
import brainfuck from 'highlight.js/lib/languages/brainfuck'
|
||||
import cal from 'highlight.js/lib/languages/cal'
|
||||
import capnproto from 'highlight.js/lib/languages/capnproto'
|
||||
import ceylon from 'highlight.js/lib/languages/ceylon'
|
||||
import clean from 'highlight.js/lib/languages/clean'
|
||||
import clojure from 'highlight.js/lib/languages/clojure'
|
||||
import clojureRepl from 'highlight.js/lib/languages/clojure-repl'
|
||||
import cmake from 'highlight.js/lib/languages/cmake'
|
||||
import coffeescript from 'highlight.js/lib/languages/coffeescript'
|
||||
import coq from 'highlight.js/lib/languages/coq'
|
||||
import cos from 'highlight.js/lib/languages/cos'
|
||||
import crmsh from 'highlight.js/lib/languages/crmsh'
|
||||
import crystal from 'highlight.js/lib/languages/crystal'
|
||||
import csp from 'highlight.js/lib/languages/csp'
|
||||
import d from 'highlight.js/lib/languages/d'
|
||||
import dart from 'highlight.js/lib/languages/dart'
|
||||
import delphi from 'highlight.js/lib/languages/delphi'
|
||||
import django from 'highlight.js/lib/languages/django'
|
||||
import dns from 'highlight.js/lib/languages/dns'
|
||||
import dockerfile from 'highlight.js/lib/languages/dockerfile'
|
||||
import dos from 'highlight.js/lib/languages/dos'
|
||||
import dsconfig from 'highlight.js/lib/languages/dsconfig'
|
||||
import dts from 'highlight.js/lib/languages/dts'
|
||||
import dust from 'highlight.js/lib/languages/dust'
|
||||
import ebnf from 'highlight.js/lib/languages/ebnf'
|
||||
import elixir from 'highlight.js/lib/languages/elixir'
|
||||
import elm from 'highlight.js/lib/languages/elm'
|
||||
import erb from 'highlight.js/lib/languages/erb'
|
||||
import erlang from 'highlight.js/lib/languages/erlang'
|
||||
import erlangRepl from 'highlight.js/lib/languages/erlang-repl'
|
||||
import excel from 'highlight.js/lib/languages/excel'
|
||||
import fix from 'highlight.js/lib/languages/fix'
|
||||
import flix from 'highlight.js/lib/languages/flix'
|
||||
import fortran from 'highlight.js/lib/languages/fortran'
|
||||
import fsharp from 'highlight.js/lib/languages/fsharp'
|
||||
import gams from 'highlight.js/lib/languages/gams'
|
||||
import gauss from 'highlight.js/lib/languages/gauss'
|
||||
import gcode from 'highlight.js/lib/languages/gcode'
|
||||
import gherkin from 'highlight.js/lib/languages/gherkin'
|
||||
import glsl from 'highlight.js/lib/languages/glsl'
|
||||
import gml from 'highlight.js/lib/languages/gml'
|
||||
import golo from 'highlight.js/lib/languages/golo'
|
||||
import gradle from 'highlight.js/lib/languages/gradle'
|
||||
import groovy from 'highlight.js/lib/languages/groovy'
|
||||
import haml from 'highlight.js/lib/languages/haml'
|
||||
import handlebars from 'highlight.js/lib/languages/handlebars'
|
||||
import haskell from 'highlight.js/lib/languages/haskell'
|
||||
import haxe from 'highlight.js/lib/languages/haxe'
|
||||
import hsp from 'highlight.js/lib/languages/hsp'
|
||||
import http from 'highlight.js/lib/languages/http'
|
||||
import hy from 'highlight.js/lib/languages/hy'
|
||||
import inform7 from 'highlight.js/lib/languages/inform7'
|
||||
import irpf90 from 'highlight.js/lib/languages/irpf90'
|
||||
import isbl from 'highlight.js/lib/languages/isbl'
|
||||
import jbossCli from 'highlight.js/lib/languages/jboss-cli'
|
||||
import julia from 'highlight.js/lib/languages/julia'
|
||||
import juliaRepl from 'highlight.js/lib/languages/julia-repl'
|
||||
import lasso from 'highlight.js/lib/languages/lasso'
|
||||
import latex from 'highlight.js/lib/languages/latex'
|
||||
import ldif from 'highlight.js/lib/languages/ldif'
|
||||
import leaf from 'highlight.js/lib/languages/leaf'
|
||||
import lisp from 'highlight.js/lib/languages/lisp'
|
||||
import livecodeserver from 'highlight.js/lib/languages/livecodeserver'
|
||||
import livescript from 'highlight.js/lib/languages/livescript'
|
||||
import llvm from 'highlight.js/lib/languages/llvm'
|
||||
import lsl from 'highlight.js/lib/languages/lsl'
|
||||
import mathematica from 'highlight.js/lib/languages/mathematica'
|
||||
import matlab from 'highlight.js/lib/languages/matlab'
|
||||
import maxima from 'highlight.js/lib/languages/maxima'
|
||||
import mel from 'highlight.js/lib/languages/mel'
|
||||
import mercury from 'highlight.js/lib/languages/mercury'
|
||||
import mipsasm from 'highlight.js/lib/languages/mipsasm'
|
||||
import mizar from 'highlight.js/lib/languages/mizar'
|
||||
import mojolicious from 'highlight.js/lib/languages/mojolicious'
|
||||
import monkey from 'highlight.js/lib/languages/monkey'
|
||||
import moonscript from 'highlight.js/lib/languages/moonscript'
|
||||
import n1ql from 'highlight.js/lib/languages/n1ql'
|
||||
import nestedtext from 'highlight.js/lib/languages/nestedtext'
|
||||
import nginx from 'highlight.js/lib/languages/nginx'
|
||||
import nim from 'highlight.js/lib/languages/nim'
|
||||
import nix from 'highlight.js/lib/languages/nix'
|
||||
import nodeRepl from 'highlight.js/lib/languages/node-repl'
|
||||
import nsis from 'highlight.js/lib/languages/nsis'
|
||||
import ocaml from 'highlight.js/lib/languages/ocaml'
|
||||
import openscad from 'highlight.js/lib/languages/openscad'
|
||||
import oxygene from 'highlight.js/lib/languages/oxygene'
|
||||
import parser3 from 'highlight.js/lib/languages/parser3'
|
||||
import pf from 'highlight.js/lib/languages/pf'
|
||||
import pgsql from 'highlight.js/lib/languages/pgsql'
|
||||
import pony from 'highlight.js/lib/languages/pony'
|
||||
import powershell from 'highlight.js/lib/languages/powershell'
|
||||
import processing from 'highlight.js/lib/languages/processing'
|
||||
import profile from 'highlight.js/lib/languages/profile'
|
||||
import prolog from 'highlight.js/lib/languages/prolog'
|
||||
import properties from 'highlight.js/lib/languages/properties'
|
||||
import protobuf from 'highlight.js/lib/languages/protobuf'
|
||||
import puppet from 'highlight.js/lib/languages/puppet'
|
||||
import purebasic from 'highlight.js/lib/languages/purebasic'
|
||||
import q from 'highlight.js/lib/languages/q'
|
||||
import qml from 'highlight.js/lib/languages/qml'
|
||||
import reasonml from 'highlight.js/lib/languages/reasonml'
|
||||
import rib from 'highlight.js/lib/languages/rib'
|
||||
import roboconf from 'highlight.js/lib/languages/roboconf'
|
||||
import routeros from 'highlight.js/lib/languages/routeros'
|
||||
import rsl from 'highlight.js/lib/languages/rsl'
|
||||
import ruleslanguage from 'highlight.js/lib/languages/ruleslanguage'
|
||||
import sas from 'highlight.js/lib/languages/sas'
|
||||
import scala from 'highlight.js/lib/languages/scala'
|
||||
import scheme from 'highlight.js/lib/languages/scheme'
|
||||
import scilab from 'highlight.js/lib/languages/scilab'
|
||||
import smali from 'highlight.js/lib/languages/smali'
|
||||
import smalltalk from 'highlight.js/lib/languages/smalltalk'
|
||||
import sml from 'highlight.js/lib/languages/sml'
|
||||
import sqf from 'highlight.js/lib/languages/sqf'
|
||||
import stan from 'highlight.js/lib/languages/stan'
|
||||
import stata from 'highlight.js/lib/languages/stata'
|
||||
import step21 from 'highlight.js/lib/languages/step21'
|
||||
import stylus from 'highlight.js/lib/languages/stylus'
|
||||
import subunit from 'highlight.js/lib/languages/subunit'
|
||||
import taggerscript from 'highlight.js/lib/languages/taggerscript'
|
||||
import tap from 'highlight.js/lib/languages/tap'
|
||||
import tcl from 'highlight.js/lib/languages/tcl'
|
||||
import thrift from 'highlight.js/lib/languages/thrift'
|
||||
import tp from 'highlight.js/lib/languages/tp'
|
||||
import twig from 'highlight.js/lib/languages/twig'
|
||||
import vala from 'highlight.js/lib/languages/vala'
|
||||
import vbscript from 'highlight.js/lib/languages/vbscript'
|
||||
import vbscriptHtml from 'highlight.js/lib/languages/vbscript-html'
|
||||
import verilog from 'highlight.js/lib/languages/verilog'
|
||||
import vhdl from 'highlight.js/lib/languages/vhdl'
|
||||
import vim from 'highlight.js/lib/languages/vim'
|
||||
import wren from 'highlight.js/lib/languages/wren'
|
||||
import x86asm from 'highlight.js/lib/languages/x86asm'
|
||||
import xl from 'highlight.js/lib/languages/xl'
|
||||
import xquery from 'highlight.js/lib/languages/xquery'
|
||||
import zephir from 'highlight.js/lib/languages/zephir'
|
||||
import {grammars as base} from './common.js'
|
||||
|
||||
/**
|
||||
* Map of grammars.
|
||||
*
|
||||
* @type {Record<string, LanguageFn>}
|
||||
*/
|
||||
export const grammars = {
|
||||
...base,
|
||||
'1c': $1c,
|
||||
abnf,
|
||||
accesslog,
|
||||
actionscript,
|
||||
ada,
|
||||
angelscript,
|
||||
apache,
|
||||
applescript,
|
||||
arcade,
|
||||
armasm,
|
||||
asciidoc,
|
||||
aspectj,
|
||||
autohotkey,
|
||||
autoit,
|
||||
avrasm,
|
||||
awk,
|
||||
axapta,
|
||||
basic,
|
||||
bnf,
|
||||
brainfuck,
|
||||
cal,
|
||||
capnproto,
|
||||
ceylon,
|
||||
clean,
|
||||
clojure,
|
||||
'clojure-repl': clojureRepl,
|
||||
cmake,
|
||||
coffeescript,
|
||||
coq,
|
||||
cos,
|
||||
crmsh,
|
||||
crystal,
|
||||
csp,
|
||||
d,
|
||||
dart,
|
||||
delphi,
|
||||
django,
|
||||
dns,
|
||||
dockerfile,
|
||||
dos,
|
||||
dsconfig,
|
||||
dts,
|
||||
dust,
|
||||
ebnf,
|
||||
elixir,
|
||||
elm,
|
||||
erb,
|
||||
erlang,
|
||||
'erlang-repl': erlangRepl,
|
||||
excel,
|
||||
fix,
|
||||
flix,
|
||||
fortran,
|
||||
fsharp,
|
||||
gams,
|
||||
gauss,
|
||||
gcode,
|
||||
gherkin,
|
||||
glsl,
|
||||
gml,
|
||||
golo,
|
||||
gradle,
|
||||
groovy,
|
||||
haml,
|
||||
handlebars,
|
||||
haskell,
|
||||
haxe,
|
||||
hsp,
|
||||
http,
|
||||
hy,
|
||||
inform7,
|
||||
irpf90,
|
||||
isbl,
|
||||
'jboss-cli': jbossCli,
|
||||
julia,
|
||||
'julia-repl': juliaRepl,
|
||||
lasso,
|
||||
latex,
|
||||
ldif,
|
||||
leaf,
|
||||
lisp,
|
||||
livecodeserver,
|
||||
livescript,
|
||||
llvm,
|
||||
lsl,
|
||||
mathematica,
|
||||
matlab,
|
||||
maxima,
|
||||
mel,
|
||||
mercury,
|
||||
mipsasm,
|
||||
mizar,
|
||||
mojolicious,
|
||||
monkey,
|
||||
moonscript,
|
||||
n1ql,
|
||||
nestedtext,
|
||||
nginx,
|
||||
nim,
|
||||
nix,
|
||||
'node-repl': nodeRepl,
|
||||
nsis,
|
||||
ocaml,
|
||||
openscad,
|
||||
oxygene,
|
||||
parser3,
|
||||
pf,
|
||||
pgsql,
|
||||
pony,
|
||||
powershell,
|
||||
processing,
|
||||
profile,
|
||||
prolog,
|
||||
properties,
|
||||
protobuf,
|
||||
puppet,
|
||||
purebasic,
|
||||
q,
|
||||
qml,
|
||||
reasonml,
|
||||
rib,
|
||||
roboconf,
|
||||
routeros,
|
||||
rsl,
|
||||
ruleslanguage,
|
||||
sas,
|
||||
scala,
|
||||
scheme,
|
||||
scilab,
|
||||
smali,
|
||||
smalltalk,
|
||||
sml,
|
||||
sqf,
|
||||
stan,
|
||||
stata,
|
||||
step21,
|
||||
stylus,
|
||||
subunit,
|
||||
taggerscript,
|
||||
tap,
|
||||
tcl,
|
||||
thrift,
|
||||
tp,
|
||||
twig,
|
||||
vala,
|
||||
vbscript,
|
||||
'vbscript-html': vbscriptHtml,
|
||||
verilog,
|
||||
vhdl,
|
||||
vim,
|
||||
wren,
|
||||
x86asm,
|
||||
xl,
|
||||
xquery,
|
||||
zephir
|
||||
}
|
||||
8
node_modules/lowlight/lib/common.d.ts
generated
vendored
Normal file
8
node_modules/lowlight/lib/common.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Map of grammars.
|
||||
*
|
||||
* @type {Record<string, LanguageFn>}
|
||||
*/
|
||||
export const grammars: Record<string, LanguageFn>;
|
||||
import type { LanguageFn } from 'highlight.js';
|
||||
//# sourceMappingURL=common.d.ts.map
|
||||
1
node_modules/lowlight/lib/common.d.ts.map
generated
vendored
Normal file
1
node_modules/lowlight/lib/common.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["common.js"],"names":[],"mappings":"AA2CA;;;;GAIG;AACH,uBAFU,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAwCnC;gCArF4B,cAAc"}
|
||||
86
node_modules/lowlight/lib/common.js
generated
vendored
Normal file
86
node_modules/lowlight/lib/common.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* @import {LanguageFn} from 'highlight.js'
|
||||
*/
|
||||
|
||||
import arduino from 'highlight.js/lib/languages/arduino'
|
||||
import bash from 'highlight.js/lib/languages/bash'
|
||||
import c from 'highlight.js/lib/languages/c'
|
||||
import cpp from 'highlight.js/lib/languages/cpp'
|
||||
import csharp from 'highlight.js/lib/languages/csharp'
|
||||
import css from 'highlight.js/lib/languages/css'
|
||||
import diff from 'highlight.js/lib/languages/diff'
|
||||
import go from 'highlight.js/lib/languages/go'
|
||||
import graphql from 'highlight.js/lib/languages/graphql'
|
||||
import ini from 'highlight.js/lib/languages/ini'
|
||||
import java from 'highlight.js/lib/languages/java'
|
||||
import javascript from 'highlight.js/lib/languages/javascript'
|
||||
import json from 'highlight.js/lib/languages/json'
|
||||
import kotlin from 'highlight.js/lib/languages/kotlin'
|
||||
import less from 'highlight.js/lib/languages/less'
|
||||
import lua from 'highlight.js/lib/languages/lua'
|
||||
import makefile from 'highlight.js/lib/languages/makefile'
|
||||
import markdown from 'highlight.js/lib/languages/markdown'
|
||||
import objectivec from 'highlight.js/lib/languages/objectivec'
|
||||
import perl from 'highlight.js/lib/languages/perl'
|
||||
import php from 'highlight.js/lib/languages/php'
|
||||
import phpTemplate from 'highlight.js/lib/languages/php-template'
|
||||
import plaintext from 'highlight.js/lib/languages/plaintext'
|
||||
import python from 'highlight.js/lib/languages/python'
|
||||
import pythonRepl from 'highlight.js/lib/languages/python-repl'
|
||||
import r from 'highlight.js/lib/languages/r'
|
||||
import ruby from 'highlight.js/lib/languages/ruby'
|
||||
import rust from 'highlight.js/lib/languages/rust'
|
||||
import scss from 'highlight.js/lib/languages/scss'
|
||||
import shell from 'highlight.js/lib/languages/shell'
|
||||
import sql from 'highlight.js/lib/languages/sql'
|
||||
import swift from 'highlight.js/lib/languages/swift'
|
||||
import typescript from 'highlight.js/lib/languages/typescript'
|
||||
import vbnet from 'highlight.js/lib/languages/vbnet'
|
||||
import wasm from 'highlight.js/lib/languages/wasm'
|
||||
import xml from 'highlight.js/lib/languages/xml'
|
||||
import yaml from 'highlight.js/lib/languages/yaml'
|
||||
|
||||
/**
|
||||
* Map of grammars.
|
||||
*
|
||||
* @type {Record<string, LanguageFn>}
|
||||
*/
|
||||
export const grammars = {
|
||||
arduino,
|
||||
bash,
|
||||
c,
|
||||
cpp,
|
||||
csharp,
|
||||
css,
|
||||
diff,
|
||||
go,
|
||||
graphql,
|
||||
ini,
|
||||
java,
|
||||
javascript,
|
||||
json,
|
||||
kotlin,
|
||||
less,
|
||||
lua,
|
||||
makefile,
|
||||
markdown,
|
||||
objectivec,
|
||||
perl,
|
||||
php,
|
||||
'php-template': phpTemplate,
|
||||
plaintext,
|
||||
python,
|
||||
'python-repl': pythonRepl,
|
||||
r,
|
||||
ruby,
|
||||
rust,
|
||||
scss,
|
||||
shell,
|
||||
sql,
|
||||
swift,
|
||||
typescript,
|
||||
vbnet,
|
||||
wasm,
|
||||
xml,
|
||||
yaml
|
||||
}
|
||||
197
node_modules/lowlight/lib/index.d.ts
generated
vendored
Normal file
197
node_modules/lowlight/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
/**
|
||||
* Create a `lowlight` instance.
|
||||
*
|
||||
* @param {Readonly<Record<string, LanguageFn>> | null | undefined} [grammars]
|
||||
* Grammars to add (optional).
|
||||
* @returns
|
||||
* Lowlight.
|
||||
*/
|
||||
export function createLowlight(grammars?: Readonly<Record<string, LanguageFn>> | null | undefined): {
|
||||
highlight: (language: string, value: string, options?: Readonly<Options> | null | undefined) => Root;
|
||||
highlightAuto: (value: string, options?: Readonly<AutoOptions> | null | undefined) => Root;
|
||||
listLanguages: () => Array<string>;
|
||||
register: {
|
||||
/**
|
||||
* Register languages.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {createLowlight} from 'lowlight'
|
||||
* import xml from 'highlight.js/lib/languages/xml'
|
||||
*
|
||||
* const lowlight = createLowlight()
|
||||
*
|
||||
* lowlight.register({xml})
|
||||
*
|
||||
* // Note: `html` is an alias for `xml`.
|
||||
* console.log(lowlight.highlight('html', '<em>Emphasis</em>'))
|
||||
* ```
|
||||
*
|
||||
* Yields:
|
||||
*
|
||||
* ```js
|
||||
* {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
|
||||
* ```
|
||||
*
|
||||
* @overload
|
||||
* @param {Readonly<Record<string, LanguageFn>>} grammars
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} name
|
||||
* @param {LanguageFn} grammar
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @param {Readonly<Record<string, LanguageFn>> | string} grammarsOrName
|
||||
* Grammars or programming language name.
|
||||
* @param {LanguageFn | undefined} [grammar]
|
||||
* Grammar, if with name.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
(grammars: Readonly<Record<string, LanguageFn>>): undefined;
|
||||
/**
|
||||
* Register languages.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {createLowlight} from 'lowlight'
|
||||
* import xml from 'highlight.js/lib/languages/xml'
|
||||
*
|
||||
* const lowlight = createLowlight()
|
||||
*
|
||||
* lowlight.register({xml})
|
||||
*
|
||||
* // Note: `html` is an alias for `xml`.
|
||||
* console.log(lowlight.highlight('html', '<em>Emphasis</em>'))
|
||||
* ```
|
||||
*
|
||||
* Yields:
|
||||
*
|
||||
* ```js
|
||||
* {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
|
||||
* ```
|
||||
*
|
||||
* @overload
|
||||
* @param {Readonly<Record<string, LanguageFn>>} grammars
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} name
|
||||
* @param {LanguageFn} grammar
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @param {Readonly<Record<string, LanguageFn>> | string} grammarsOrName
|
||||
* Grammars or programming language name.
|
||||
* @param {LanguageFn | undefined} [grammar]
|
||||
* Grammar, if with name.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
(name: string, grammar: LanguageFn): undefined;
|
||||
};
|
||||
registerAlias: {
|
||||
/**
|
||||
* Register aliases.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {createLowlight} from 'lowlight'
|
||||
* import markdown from 'highlight.js/lib/languages/markdown'
|
||||
*
|
||||
* const lowlight = createLowlight()
|
||||
*
|
||||
* lowlight.register({markdown})
|
||||
*
|
||||
* // lowlight.highlight('mdown', '<em>Emphasis</em>')
|
||||
* // ^ would throw: Error: Unknown language: `mdown` is not registered
|
||||
*
|
||||
* lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
|
||||
* lowlight.highlight('mdown', '<em>Emphasis</em>')
|
||||
* // ^ Works!
|
||||
* ```
|
||||
*
|
||||
* @overload
|
||||
* @param {Readonly<Record<string, ReadonlyArray<string> | string>>} aliases
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} language
|
||||
* @param {ReadonlyArray<string> | string} alias
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @param {Readonly<Record<string, ReadonlyArray<string> | string>> | string} aliasesOrName
|
||||
* Map of programming language names to one or more aliases, or programming
|
||||
* language name.
|
||||
* @param {ReadonlyArray<string> | string | undefined} [alias]
|
||||
* One or more aliases for the programming language, if with `name`.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
(aliases: Readonly<Record<string, ReadonlyArray<string> | string>>): undefined;
|
||||
/**
|
||||
* Register aliases.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {createLowlight} from 'lowlight'
|
||||
* import markdown from 'highlight.js/lib/languages/markdown'
|
||||
*
|
||||
* const lowlight = createLowlight()
|
||||
*
|
||||
* lowlight.register({markdown})
|
||||
*
|
||||
* // lowlight.highlight('mdown', '<em>Emphasis</em>')
|
||||
* // ^ would throw: Error: Unknown language: `mdown` is not registered
|
||||
*
|
||||
* lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
|
||||
* lowlight.highlight('mdown', '<em>Emphasis</em>')
|
||||
* // ^ Works!
|
||||
* ```
|
||||
*
|
||||
* @overload
|
||||
* @param {Readonly<Record<string, ReadonlyArray<string> | string>>} aliases
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} language
|
||||
* @param {ReadonlyArray<string> | string} alias
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @param {Readonly<Record<string, ReadonlyArray<string> | string>> | string} aliasesOrName
|
||||
* Map of programming language names to one or more aliases, or programming
|
||||
* language name.
|
||||
* @param {ReadonlyArray<string> | string | undefined} [alias]
|
||||
* One or more aliases for the programming language, if with `name`.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
(language: string, alias: ReadonlyArray<string> | string): undefined;
|
||||
};
|
||||
registered: (aliasOrName: string) => boolean;
|
||||
};
|
||||
/**
|
||||
* Extra fields.
|
||||
*/
|
||||
export type ExtraOptions = {
|
||||
/**
|
||||
* List of allowed languages (default: all registered languages).
|
||||
*/
|
||||
subset?: ReadonlyArray<string> | null | undefined;
|
||||
};
|
||||
/**
|
||||
* Configuration for `highlight`.
|
||||
*/
|
||||
export type Options = {
|
||||
/**
|
||||
* Class prefix (default: `'hljs-'`).
|
||||
*/
|
||||
prefix?: string | null | undefined;
|
||||
};
|
||||
/**
|
||||
* Configuration for `highlightAuto`.
|
||||
*/
|
||||
export type AutoOptions = Options & ExtraOptions;
|
||||
import type { LanguageFn } from 'highlight.js';
|
||||
import type { Root } from 'hast';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/lowlight/lib/index.d.ts.map
generated
vendored
Normal file
1
node_modules/lowlight/lib/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA4BA;;;;;;;GAOG;AACH,0CALW,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS;0BAuCrD,MAAM,SAEN,MAAM,YAEN,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,KAElC,IAAI;2BA6DN,MAAM,YAEN,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,KAEtC,IAAI;yBA0DJ,KAAK,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA8Bf,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAClC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGX,MAAM,WACN,UAAU,GACR,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8CX,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,GACtD,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAGX,MAAM,SACN,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,GAC5B,SAAS;;8BAmDX,MAAM,KAEJ,OAAO;EAMrB;;;;;;;;aAlVa,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;;;;;;;;;aAKxC,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;0BAG1B,OAAO,GAAG,YAAY;gCAdgD,cAAc;0BADvC,MAAM"}
|
||||
482
node_modules/lowlight/lib/index.js
generated
vendored
Normal file
482
node_modules/lowlight/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,482 @@
|
||||
/**
|
||||
* @import {ElementContent, Element, RootData, Root} from 'hast'
|
||||
* @import {Emitter, HLJSOptions as HljsOptions, HighlightResult, LanguageFn} from 'highlight.js'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ExtraOptions
|
||||
* Extra fields.
|
||||
* @property {ReadonlyArray<string> | null | undefined} [subset]
|
||||
* List of allowed languages (default: all registered languages).
|
||||
*
|
||||
* @typedef Options
|
||||
* Configuration for `highlight`.
|
||||
* @property {string | null | undefined} [prefix='hljs-']
|
||||
* Class prefix (default: `'hljs-'`).
|
||||
*
|
||||
* @typedef {Options & ExtraOptions} AutoOptions
|
||||
* Configuration for `highlightAuto`.
|
||||
*/
|
||||
|
||||
import {ok as assert} from 'devlop'
|
||||
import HighlightJs from 'highlight.js/lib/core'
|
||||
|
||||
/** @type {AutoOptions} */
|
||||
const emptyOptions = {}
|
||||
|
||||
const defaultPrefix = 'hljs-'
|
||||
|
||||
/**
|
||||
* Create a `lowlight` instance.
|
||||
*
|
||||
* @param {Readonly<Record<string, LanguageFn>> | null | undefined} [grammars]
|
||||
* Grammars to add (optional).
|
||||
* @returns
|
||||
* Lowlight.
|
||||
*/
|
||||
export function createLowlight(grammars) {
|
||||
const high = HighlightJs.newInstance()
|
||||
|
||||
if (grammars) {
|
||||
register(grammars)
|
||||
}
|
||||
|
||||
return {
|
||||
highlight,
|
||||
highlightAuto,
|
||||
listLanguages,
|
||||
register,
|
||||
registerAlias,
|
||||
registered
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight `value` (code) as `language` (name).
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {common, createLowlight} from 'lowlight'
|
||||
*
|
||||
* const lowlight = createLowlight(common)
|
||||
*
|
||||
* console.log(lowlight.highlight('css', 'em { color: red }'))
|
||||
* ```
|
||||
*
|
||||
* Yields:
|
||||
*
|
||||
* ```js
|
||||
* {type: 'root', children: [Array], data: {language: 'css', relevance: 3}}
|
||||
* ```
|
||||
*
|
||||
* @param {string} language
|
||||
* Programming language name.
|
||||
* @param {string} value
|
||||
* Code to highlight.
|
||||
* @param {Readonly<Options> | null | undefined} [options={}]
|
||||
* Configuration (optional).
|
||||
* @returns {Root}
|
||||
* Tree; with the following `data` fields: `language` (`string`), detected
|
||||
* programming language name; `relevance` (`number`), how sure lowlight is
|
||||
* that the given code is in the language.
|
||||
*/
|
||||
function highlight(language, value, options) {
|
||||
assert(typeof language === 'string', 'expected `string` as `name`')
|
||||
assert(typeof value === 'string', 'expected `string` as `value`')
|
||||
const settings = options || emptyOptions
|
||||
const prefix =
|
||||
typeof settings.prefix === 'string' ? settings.prefix : defaultPrefix
|
||||
|
||||
if (!high.getLanguage(language)) {
|
||||
throw new Error('Unknown language: `' + language + '` is not registered')
|
||||
}
|
||||
|
||||
// See: <https://github.com/highlightjs/highlight.js/issues/3621#issuecomment-1528841888>
|
||||
high.configure({__emitter: HastEmitter, classPrefix: prefix})
|
||||
|
||||
const result = /** @type {HighlightResult & {_emitter: HastEmitter}} */ (
|
||||
high.highlight(value, {ignoreIllegals: true, language})
|
||||
)
|
||||
|
||||
// `highlight.js` seems to use this (currently) for broken grammars, so let’s
|
||||
// keep it in there just to be sure.
|
||||
/* c8 ignore next 5 */
|
||||
if (result.errorRaised) {
|
||||
throw new Error('Could not highlight with `Highlight.js`', {
|
||||
cause: result.errorRaised
|
||||
})
|
||||
}
|
||||
|
||||
const root = result._emitter.root
|
||||
|
||||
// Cast because it is always defined.
|
||||
const data = /** @type {RootData} */ (root.data)
|
||||
|
||||
data.language = result.language
|
||||
data.relevance = result.relevance
|
||||
|
||||
return root
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight `value` (code) and guess its programming language.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {common, createLowlight} from 'lowlight'
|
||||
*
|
||||
* const lowlight = createLowlight(common)
|
||||
*
|
||||
* console.log(lowlight.highlightAuto('"hello, " + name + "!"'))
|
||||
* ```
|
||||
*
|
||||
* Yields:
|
||||
*
|
||||
* ```js
|
||||
* {type: 'root', children: [Array], data: {language: 'arduino', relevance: 2}}
|
||||
* ```
|
||||
*
|
||||
* @param {string} value
|
||||
* Code to highlight.
|
||||
* @param {Readonly<AutoOptions> | null | undefined} [options={}]
|
||||
* Configuration (optional).
|
||||
* @returns {Root}
|
||||
* Tree; with the following `data` fields: `language` (`string`), detected
|
||||
* programming language name; `relevance` (`number`), how sure lowlight is
|
||||
* that the given code is in the language.
|
||||
*/
|
||||
function highlightAuto(value, options) {
|
||||
assert(typeof value === 'string', 'expected `string` as `value`')
|
||||
const settings = options || emptyOptions
|
||||
const subset = settings.subset || listLanguages()
|
||||
|
||||
let index = -1
|
||||
let relevance = 0
|
||||
/** @type {Root | undefined} */
|
||||
let result
|
||||
|
||||
while (++index < subset.length) {
|
||||
const name = subset[index]
|
||||
|
||||
if (!high.getLanguage(name)) continue
|
||||
|
||||
const current = highlight(name, value, options)
|
||||
|
||||
if (
|
||||
current.data &&
|
||||
current.data.relevance !== undefined &&
|
||||
current.data.relevance > relevance
|
||||
) {
|
||||
relevance = current.data.relevance
|
||||
result = current
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
result || {
|
||||
type: 'root',
|
||||
children: [],
|
||||
data: {language: undefined, relevance}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* List registered languages.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {createLowlight} from 'lowlight'
|
||||
* import markdown from 'highlight.js/lib/languages/markdown'
|
||||
*
|
||||
* const lowlight = createLowlight()
|
||||
*
|
||||
* console.log(lowlight.listLanguages()) // => []
|
||||
*
|
||||
* lowlight.register({markdown})
|
||||
*
|
||||
* console.log(lowlight.listLanguages()) // => ['markdown']
|
||||
* ```
|
||||
*
|
||||
* @returns {Array<string>}
|
||||
* Names of registered language.
|
||||
*/
|
||||
function listLanguages() {
|
||||
return high.listLanguages()
|
||||
}
|
||||
|
||||
/**
|
||||
* Register languages.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {createLowlight} from 'lowlight'
|
||||
* import xml from 'highlight.js/lib/languages/xml'
|
||||
*
|
||||
* const lowlight = createLowlight()
|
||||
*
|
||||
* lowlight.register({xml})
|
||||
*
|
||||
* // Note: `html` is an alias for `xml`.
|
||||
* console.log(lowlight.highlight('html', '<em>Emphasis</em>'))
|
||||
* ```
|
||||
*
|
||||
* Yields:
|
||||
*
|
||||
* ```js
|
||||
* {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
|
||||
* ```
|
||||
*
|
||||
* @overload
|
||||
* @param {Readonly<Record<string, LanguageFn>>} grammars
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} name
|
||||
* @param {LanguageFn} grammar
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @param {Readonly<Record<string, LanguageFn>> | string} grammarsOrName
|
||||
* Grammars or programming language name.
|
||||
* @param {LanguageFn | undefined} [grammar]
|
||||
* Grammar, if with name.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
function register(grammarsOrName, grammar) {
|
||||
if (typeof grammarsOrName === 'string') {
|
||||
assert(grammar !== undefined, 'expected `grammar`')
|
||||
high.registerLanguage(grammarsOrName, grammar)
|
||||
} else {
|
||||
/** @type {string} */
|
||||
let name
|
||||
|
||||
for (name in grammarsOrName) {
|
||||
if (Object.hasOwn(grammarsOrName, name)) {
|
||||
high.registerLanguage(name, grammarsOrName[name])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register aliases.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {createLowlight} from 'lowlight'
|
||||
* import markdown from 'highlight.js/lib/languages/markdown'
|
||||
*
|
||||
* const lowlight = createLowlight()
|
||||
*
|
||||
* lowlight.register({markdown})
|
||||
*
|
||||
* // lowlight.highlight('mdown', '<em>Emphasis</em>')
|
||||
* // ^ would throw: Error: Unknown language: `mdown` is not registered
|
||||
*
|
||||
* lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
|
||||
* lowlight.highlight('mdown', '<em>Emphasis</em>')
|
||||
* // ^ Works!
|
||||
* ```
|
||||
*
|
||||
* @overload
|
||||
* @param {Readonly<Record<string, ReadonlyArray<string> | string>>} aliases
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} language
|
||||
* @param {ReadonlyArray<string> | string} alias
|
||||
* @returns {undefined}
|
||||
*
|
||||
* @param {Readonly<Record<string, ReadonlyArray<string> | string>> | string} aliasesOrName
|
||||
* Map of programming language names to one or more aliases, or programming
|
||||
* language name.
|
||||
* @param {ReadonlyArray<string> | string | undefined} [alias]
|
||||
* One or more aliases for the programming language, if with `name`.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
function registerAlias(aliasesOrName, alias) {
|
||||
if (typeof aliasesOrName === 'string') {
|
||||
assert(alias !== undefined)
|
||||
high.registerAliases(
|
||||
// Note: copy needed because hljs doesn’t accept readonly arrays yet.
|
||||
typeof alias === 'string' ? alias : [...alias],
|
||||
{languageName: aliasesOrName}
|
||||
)
|
||||
} else {
|
||||
/** @type {string} */
|
||||
let key
|
||||
|
||||
for (key in aliasesOrName) {
|
||||
if (Object.hasOwn(aliasesOrName, key)) {
|
||||
const aliases = aliasesOrName[key]
|
||||
high.registerAliases(
|
||||
// Note: copy needed because hljs doesn’t accept readonly arrays yet.
|
||||
typeof aliases === 'string' ? aliases : [...aliases],
|
||||
{languageName: key}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether an alias or name is registered.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import {createLowlight} from 'lowlight'
|
||||
* import javascript from 'highlight.js/lib/languages/javascript'
|
||||
*
|
||||
* const lowlight = createLowlight({javascript})
|
||||
*
|
||||
* console.log(lowlight.registered('funkyscript')) // => `false`
|
||||
*
|
||||
* lowlight.registerAlias({javascript: 'funkyscript'})
|
||||
* console.log(lowlight.registered('funkyscript')) // => `true`
|
||||
* ```
|
||||
*
|
||||
* @param {string} aliasOrName
|
||||
* Name of a language or alias for one.
|
||||
* @returns {boolean}
|
||||
* Whether `aliasOrName` is registered.
|
||||
*/
|
||||
function registered(aliasOrName) {
|
||||
return Boolean(high.getLanguage(aliasOrName))
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {Emitter} */
|
||||
class HastEmitter {
|
||||
/**
|
||||
* @param {Readonly<HljsOptions>} options
|
||||
* Configuration.
|
||||
* @returns
|
||||
* Instance.
|
||||
*/
|
||||
constructor(options) {
|
||||
/** @type {HljsOptions} */
|
||||
this.options = options
|
||||
/** @type {Root} */
|
||||
this.root = {
|
||||
type: 'root',
|
||||
children: [],
|
||||
data: {language: undefined, relevance: 0}
|
||||
}
|
||||
/** @type {[Root, ...Array<Element>]} */
|
||||
this.stack = [this.root]
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* Text to add.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*
|
||||
*/
|
||||
addText(value) {
|
||||
if (value === '') return
|
||||
|
||||
const current = this.stack[this.stack.length - 1]
|
||||
const tail = current.children[current.children.length - 1]
|
||||
|
||||
if (tail && tail.type === 'text') {
|
||||
tail.value += value
|
||||
} else {
|
||||
current.children.push({type: 'text', value})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {unknown} rawName
|
||||
* Name to add.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
startScope(rawName) {
|
||||
this.openNode(String(rawName))
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
endScope() {
|
||||
this.closeNode()
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HastEmitter} other
|
||||
* Other emitter.
|
||||
* @param {string} name
|
||||
* Name of the sublanguage.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
__addSublanguage(other, name) {
|
||||
const current = this.stack[this.stack.length - 1]
|
||||
// Assume only element content.
|
||||
const results = /** @type {Array<ElementContent>} */ (other.root.children)
|
||||
|
||||
if (name) {
|
||||
current.children.push({
|
||||
type: 'element',
|
||||
tagName: 'span',
|
||||
properties: {className: [name]},
|
||||
children: results
|
||||
})
|
||||
} else {
|
||||
current.children.push(...results)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* Name to add.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
openNode(name) {
|
||||
const self = this
|
||||
// First “class” gets the prefix. Rest gets a repeated underscore suffix.
|
||||
// See: <https://github.com/highlightjs/highlight.js/commit/51806aa>
|
||||
// See: <https://github.com/wooorm/lowlight/issues/43>
|
||||
const className = name.split('.').map(function (d, i) {
|
||||
return i ? d + '_'.repeat(i) : self.options.classPrefix + d
|
||||
})
|
||||
const current = this.stack[this.stack.length - 1]
|
||||
/** @type {Element} */
|
||||
const child = {
|
||||
type: 'element',
|
||||
tagName: 'span',
|
||||
properties: {className},
|
||||
children: []
|
||||
}
|
||||
|
||||
current.children.push(child)
|
||||
this.stack.push(child)
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
closeNode() {
|
||||
this.stack.pop()
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
finalize() {}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
* Nothing.
|
||||
*/
|
||||
toHTML() {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user