From 5dfc768210241849e4ebd234de2e44e07a4e808d Mon Sep 17 00:00:00 2001 From: Konnor Rogers Date: Mon, 27 Nov 2023 01:26:26 -0500 Subject: [PATCH] build TS types for releases --- .gitignore | 3 + components/prism-abap.js | 4 + components/prism-abnf.js | 4 + components/prism-actionscript.js | 4 + components/prism-ada.js | 4 + components/prism-agda.js | 4 + components/prism-al.js | 4 + components/prism-antlr4.js | 4 + components/prism-apacheconf.js | 4 + components/prism-apex.js | 4 + components/prism-apl.js | 4 + components/prism-applescript.js | 4 + components/prism-aql.js | 4 + components/prism-arduino.js | 4 + components/prism-arff.js | 4 + components/prism-armasm.js | 4 + components/prism-arturo.js | 12 +- components/prism-asciidoc.js | 4 + components/prism-asm6502.js | 4 + components/prism-asmatmel.js | 4 + components/prism-aspnet.js | 4 + components/prism-autohotkey.js | 4 + components/prism-autoit.js | 4 + components/prism-avisynth.js | 4 + components/prism-avro-idl.js | 4 + components/prism-awk.js | 4 + components/prism-bash.js | 9 +- components/prism-basic.js | 4 + components/prism-batch.js | 4 + components/prism-bbcode.js | 4 + components/prism-bbj.js | 4 + components/prism-bicep.js | 4 + components/prism-birb.js | 4 + components/prism-bison.js | 4 + components/prism-bnf.js | 4 + components/prism-bqn.js | 4 + components/prism-brainfuck.js | 4 + components/prism-brightscript.js | 4 + components/prism-bro.js | 4 + components/prism-bsl.js | 4 + components/prism-c.js | 4 + components/prism-cfscript.js | 4 + components/prism-chaiscript.js | 4 + components/prism-cil.js | 4 + components/prism-cilkc.js | 4 + components/prism-cilkcpp.js | 4 + components/prism-clike.js | 4 + components/prism-clojure.js | 4 + components/prism-cmake.js | 4 + components/prism-cobol.js | 4 + components/prism-coffeescript.js | 4 + components/prism-concurnas.js | 4 + components/prism-cooklang.js | 4 + components/prism-coq.js | 4 + components/prism-cpp.js | 4 + components/prism-crystal.js | 4 + components/prism-csharp.js | 4 + components/prism-cshtml.js | 4 + components/prism-csp.js | 4 + components/prism-css-extras.js | 4 + components/prism-css.js | 4 + components/prism-csv.js | 4 + components/prism-cue.js | 4 + components/prism-cypher.js | 4 + components/prism-d.js | 4 + components/prism-dart.js | 4 + components/prism-dataweave.js | 4 + components/prism-dax.js | 4 + components/prism-dhall.js | 4 + components/prism-diff.js | 4 + components/prism-django.js | 4 + components/prism-dns-zone-file.js | 4 + components/prism-docker.js | 4 + components/prism-dot.js | 6 +- components/prism-ebnf.js | 4 + components/prism-editorconfig.js | 4 + components/prism-eiffel.js | 4 + components/prism-ejs.js | 4 + components/prism-elixir.js | 4 + components/prism-elm.js | 4 + components/prism-erb.js | 4 + components/prism-erlang.js | 4 + components/prism-etlua.js | 4 + components/prism-excel-formula.js | 4 + components/prism-factor.js | 4 + components/prism-false.js | 4 + components/prism-firestore-security-rules.js | 4 + components/prism-flow.js | 4 + components/prism-fortran.js | 4 + components/prism-fsharp.js | 4 + components/prism-ftl.js | 4 + components/prism-gap.js | 4 + components/prism-gcode.js | 4 + components/prism-gdscript.js | 4 + components/prism-gedcom.js | 4 + components/prism-gettext.js | 4 + components/prism-gherkin.js | 4 + components/prism-git.js | 4 + components/prism-glsl.js | 4 + components/prism-gml.js | 4 + components/prism-gn.js | 4 + components/prism-go-module.js | 4 + components/prism-go.js | 4 + components/prism-gradle.js | 4 + components/prism-graphql.js | 6 +- components/prism-groovy.js | 4 + components/prism-haml.js | 6 +- components/prism-handlebars.js | 4 + components/prism-haskell.js | 4 + components/prism-haxe.js | 4 + components/prism-hcl.js | 4 + components/prism-hlsl.js | 4 + components/prism-hoon.js | 4 + components/prism-hpkp.js | 4 + components/prism-hsts.js | 4 + components/prism-http.js | 14 +- components/prism-ichigojam.js | 4 + components/prism-icon.js | 4 + components/prism-icu-message-format.js | 4 + components/prism-idris.js | 4 + components/prism-iecst.js | 4 + components/prism-ignore.js | 4 + components/prism-inform7.js | 4 + components/prism-ini.js | 4 + components/prism-io.js | 4 + components/prism-j.js | 4 + components/prism-java.js | 4 + components/prism-javadoc.js | 4 + components/prism-javadoclike.js | 8 +- components/prism-javascript.js | 4 + components/prism-javastacktrace.js | 4 + components/prism-jexl.js | 4 + components/prism-jolie.js | 4 + components/prism-jq.js | 4 + components/prism-js-extras.js | 4 + components/prism-js-templates.js | 22 ++- components/prism-jsdoc.js | 4 + components/prism-json.js | 4 + components/prism-json5.js | 4 + components/prism-jsonp.js | 4 + components/prism-jsstacktrace.js | 4 + components/prism-jsx.js | 4 + components/prism-julia.js | 4 + components/prism-keepalived.js | 4 + components/prism-keyman.js | 4 + components/prism-kotlin.js | 4 + components/prism-kumir.js | 4 + components/prism-kusto.js | 4 + components/prism-latex.js | 4 + components/prism-latte.js | 4 + components/prism-less.js | 4 + components/prism-lilypond.js | 4 + components/prism-linker-script.js | 4 + components/prism-liquid.js | 4 + components/prism-lisp.js | 4 + components/prism-livescript.js | 4 + components/prism-llvm.js | 4 + components/prism-log.js | 4 + components/prism-lolcode.js | 4 + components/prism-lua.js | 4 + components/prism-magma.js | 4 + components/prism-makefile.js | 4 + components/prism-markdown.js | 4 + components/prism-markup-templating.js | 4 + components/prism-markup.js | 4 + components/prism-mata.js | 4 + components/prism-matlab.js | 4 + components/prism-maxscript.js | 4 + components/prism-mel.js | 4 + components/prism-mermaid.js | 4 + components/prism-metafont.js | 4 + components/prism-mizar.js | 4 + components/prism-mongodb.js | 4 + components/prism-monkey.js | 4 + components/prism-moonscript.js | 4 + components/prism-n1ql.js | 4 + components/prism-n4js.js | 4 + components/prism-nand2tetris-hdl.js | 4 + components/prism-naniscript.js | 7 +- components/prism-nasm.js | 4 + components/prism-neon.js | 4 + components/prism-nevod.js | 4 + components/prism-nginx.js | 4 + components/prism-nim.js | 4 + components/prism-nix.js | 4 + components/prism-nsis.js | 4 + components/prism-objectivec.js | 4 + components/prism-ocaml.js | 4 + components/prism-odin.js | 4 + components/prism-opencl.js | 4 + components/prism-openqasm.js | 4 + components/prism-oz.js | 4 + components/prism-parigp.js | 8 +- components/prism-parser.js | 4 + components/prism-pascal.js | 4 + components/prism-pascaligo.js | 4 + components/prism-pcaxis.js | 4 + components/prism-peoplecode.js | 4 + components/prism-perl.js | 4 + components/prism-php-extras.js | 4 + components/prism-php.js | 4 + components/prism-phpdoc.js | 4 + components/prism-plant-uml.js | 4 + components/prism-plsql.js | 4 + components/prism-powerquery.js | 4 + components/prism-powershell.js | 4 + components/prism-processing.js | 4 + components/prism-prolog.js | 4 + components/prism-promql.js | 4 + components/prism-properties.js | 4 + components/prism-protobuf.js | 4 + components/prism-psl.js | 4 + components/prism-pug.js | 7 +- components/prism-puppet.js | 4 + components/prism-pure.js | 6 + components/prism-purebasic.js | 4 + components/prism-purescript.js | 4 + components/prism-python.js | 4 + components/prism-q.js | 4 + components/prism-qml.js | 4 + components/prism-qore.js | 4 + components/prism-qsharp.js | 4 + components/prism-r.js | 4 + components/prism-racket.js | 4 + components/prism-reason.js | 4 + components/prism-regex.js | 4 + components/prism-rego.js | 4 + components/prism-renpy.js | 4 + components/prism-rescript.js | 4 + components/prism-rest.js | 4 + components/prism-rip.js | 4 + components/prism-roboconf.js | 4 + components/prism-robotframework.js | 4 + components/prism-ruby.js | 4 + components/prism-rust.js | 4 + components/prism-sas.js | 4 + components/prism-sass.js | 4 + components/prism-scala.js | 4 + components/prism-scheme.js | 4 + components/prism-scss.js | 4 + components/prism-shell-session.js | 4 + components/prism-smali.js | 4 + components/prism-smalltalk.js | 4 + components/prism-smarty.js | 4 + components/prism-sml.js | 4 + components/prism-solidity.js | 4 + components/prism-solution-file.js | 4 + components/prism-soy.js | 4 + components/prism-sparql.js | 4 + components/prism-splunk-spl.js | 4 + components/prism-sqf.js | 4 + components/prism-sql.js | 4 + components/prism-squirrel.js | 4 + components/prism-stan.js | 4 + components/prism-stata.js | 4 + components/prism-stylus.js | 4 + components/prism-supercollider.js | 4 + components/prism-swift.js | 4 + components/prism-systemd.js | 4 + components/prism-t4-cs.js | 4 + components/prism-t4-templating.js | 4 + components/prism-t4-vb.js | 4 + components/prism-tap.js | 4 + components/prism-tcl.js | 4 + components/prism-textile.js | 4 + components/prism-toml.js | 4 + components/prism-tremor.js | 4 + components/prism-tsx.js | 4 + components/prism-tt2.js | 4 + components/prism-turtle.js | 4 + components/prism-twig.js | 4 + components/prism-typescript.js | 4 + components/prism-typoscript.js | 4 + components/prism-unrealscript.js | 4 + components/prism-uorazor.js | 4 + components/prism-uri.js | 4 + components/prism-v.js | 4 + components/prism-vala.js | 4 + components/prism-vbnet.js | 4 + components/prism-velocity.js | 4 + components/prism-verilog.js | 4 + components/prism-vhdl.js | 4 + components/prism-vim.js | 4 + components/prism-visual-basic.js | 4 + components/prism-warpscript.js | 4 + components/prism-wasm.js | 4 + components/prism-web-idl.js | 4 + components/prism-wgsl.js | 4 + components/prism-wiki.js | 4 + components/prism-wolfram.js | 4 + components/prism-wren.js | 4 + components/prism-xeora.js | 4 + components/prism-xml-doc.js | 4 + components/prism-xojo.js | 4 + components/prism-xquery.js | 4 + components/prism-yaml.js | 4 + components/prism-yang.js | 4 + components/prism-zig.js | 4 + package.json | 31 ++-- .../file-highlight/prism-file-highlight.d.ts | 1 + prism-core.js | 154 ++++++++++-------- prism.js | 26 ++- tests/helper/token-stream-transformer.d.ts | 17 ++ tests/helper/token-stream-transformer.js | 50 +++--- tsconfig.json | 21 +++ 305 files changed, 1426 insertions(+), 128 deletions(-) create mode 100644 plugins/file-highlight/prism-file-highlight.d.ts create mode 100644 tests/helper/token-stream-transformer.d.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index f3e4015150..2bf72aa0ff 100755 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ node_modules benchmark/remotes/ benchmark/downloads/ +components/*.d.ts +prism-core.d.ts +prism.d.ts \ No newline at end of file diff --git a/components/prism-abap.js b/components/prism-abap.js index 7c552a00c5..a8e4466a4f 100644 --- a/components/prism-abap.js +++ b/components/prism-abap.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['abap']) { diff --git a/components/prism-abnf.js b/components/prism-abnf.js index d063d2aed6..1545d1ab78 100644 --- a/components/prism-abnf.js +++ b/components/prism-abnf.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['abnf']) { diff --git a/components/prism-actionscript.js b/components/prism-actionscript.js index 98610d10c9..811b8b4101 100644 --- a/components/prism-actionscript.js +++ b/components/prism-actionscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-ada.js b/components/prism-ada.js index c4fa96d8e0..230b973092 100644 --- a/components/prism-ada.js +++ b/components/prism-ada.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['ada']) { diff --git a/components/prism-agda.js b/components/prism-agda.js index 87fb06c6e5..3aaaed4974 100644 --- a/components/prism-agda.js +++ b/components/prism-agda.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['agda']) { diff --git a/components/prism-al.js b/components/prism-al.js index 48e673936f..14edcc5d35 100644 --- a/components/prism-al.js +++ b/components/prism-al.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ // based on https://github.com/microsoft/AL/blob/master/grammar/alsyntax.tmlanguage export function loader (Prism, options) { diff --git a/components/prism-antlr4.js b/components/prism-antlr4.js index e232e2b2e4..7ac2bae863 100644 --- a/components/prism-antlr4.js +++ b/components/prism-antlr4.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['antlr4']) { diff --git a/components/prism-apacheconf.js b/components/prism-apacheconf.js index 77f41aee51..5113ecf7e2 100644 --- a/components/prism-apacheconf.js +++ b/components/prism-apacheconf.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['apacheconf']) { diff --git a/components/prism-apex.js b/components/prism-apex.js index 38d713468a..00decee19f 100644 --- a/components/prism-apex.js +++ b/components/prism-apex.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" import { loader as sqlLoader } from "./prism-sql.js" export function loader (Prism, options) { diff --git a/components/prism-apl.js b/components/prism-apl.js index 559979b139..001516edf2 100644 --- a/components/prism-apl.js +++ b/components/prism-apl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['apl']) { diff --git a/components/prism-applescript.js b/components/prism-applescript.js index 776fe805f3..a848bced46 100644 --- a/components/prism-applescript.js +++ b/components/prism-applescript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['applescript']) { diff --git a/components/prism-aql.js b/components/prism-aql.js index 5c8669bac1..eb41fdf105 100644 --- a/components/prism-aql.js +++ b/components/prism-aql.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['aql']) { diff --git a/components/prism-arduino.js b/components/prism-arduino.js index f516cc0010..d37c694016 100644 --- a/components/prism-arduino.js +++ b/components/prism-arduino.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cppLoader } from "./prism-cpp.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-arff.js b/components/prism-arff.js index 749b24d9d6..0004191d09 100644 --- a/components/prism-arff.js +++ b/components/prism-arff.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['arff']) { diff --git a/components/prism-armasm.js b/components/prism-armasm.js index 9698c07c21..198101fece 100644 --- a/components/prism-armasm.js +++ b/components/prism-armasm.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['armasm']) { diff --git a/components/prism-arturo.js b/components/prism-arturo.js index 6ddc98e54d..db8bb9c07b 100644 --- a/components/prism-arturo.js +++ b/components/prism-arturo.js @@ -1,9 +1,7 @@ -import { loader as bashLoader } from "./prism-bash.js" -import { loader as cssLoader } from "./prism-css.js" -import { loader as javascriptLoader } from "./prism-javascript.js" -import { loader as markupLoader } from "./prism-markup.js" -import { loader as markdownLoader } from "./prism-markdown.js" -import { loader as sqlLoader } from "./prism-sql.js" +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['arturo']) { @@ -12,7 +10,7 @@ export function loader (Prism, options) { /** * @param {string} lang - * @param {string} pattern + * @param {string} [pattern] */ var createLanguageString = function (lang, pattern) { return { diff --git a/components/prism-asciidoc.js b/components/prism-asciidoc.js index e2688872b1..dec0860fea 100644 --- a/components/prism-asciidoc.js +++ b/components/prism-asciidoc.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['asciidoc']) { diff --git a/components/prism-asm6502.js b/components/prism-asm6502.js index 67f829d3ce..932139d8f8 100644 --- a/components/prism-asm6502.js +++ b/components/prism-asm6502.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['asm6502']) { diff --git a/components/prism-asmatmel.js b/components/prism-asmatmel.js index 2a5a39a305..807a0a7c87 100644 --- a/components/prism-asmatmel.js +++ b/components/prism-asmatmel.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['asmatmel']) { diff --git a/components/prism-aspnet.js b/components/prism-aspnet.js index a785516674..3d252cacce 100644 --- a/components/prism-aspnet.js +++ b/components/prism-aspnet.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" import { loader as csharpLoader } from "./prism-csharp.js" import { loader as javascriptLoader } from "./prism-javascript.js" diff --git a/components/prism-autohotkey.js b/components/prism-autohotkey.js index e066f5814d..606c98dbdf 100644 --- a/components/prism-autohotkey.js +++ b/components/prism-autohotkey.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['autohotkey']) { diff --git a/components/prism-autoit.js b/components/prism-autoit.js index f3773eaf0d..d696d57e71 100644 --- a/components/prism-autoit.js +++ b/components/prism-autoit.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['autoit']) { diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index b6082efed3..6fc870f2f9 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ // http://avisynth.nl/index.php/The_full_AviSynth_grammar export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-avro-idl.js b/components/prism-avro-idl.js index 77a15a3466..b7fec09f85 100644 --- a/components/prism-avro-idl.js +++ b/components/prism-avro-idl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ // GitHub: https://github.com/apache/avro // Docs: https://avro.apache.org/docs/current/idl.html diff --git a/components/prism-awk.js b/components/prism-awk.js index cc0530755a..88817858ed 100644 --- a/components/prism-awk.js +++ b/components/prism-awk.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['awk']) { diff --git a/components/prism-bash.js b/components/prism-bash.js index 9fb1825b4d..461d1c151a 100644 --- a/components/prism-bash.js +++ b/components/prism-bash.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['bash']) { @@ -229,7 +233,10 @@ export function loader (Prism, options) { 'punctuation', 'number' ]; - var inside = insideString.variable[1].inside; + + + var inside = /** @type {any} */ (insideString.variable[1]).inside; + for (var i = 0; i < toBeCopied.length; i++) { inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]]; } diff --git a/components/prism-basic.js b/components/prism-basic.js index 2e2240b384..73176cc283 100644 --- a/components/prism-basic.js +++ b/components/prism-basic.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['basic']) { diff --git a/components/prism-batch.js b/components/prism-batch.js index d8edbf59b2..5793bc2f9f 100644 --- a/components/prism-batch.js +++ b/components/prism-batch.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['batch']) { diff --git a/components/prism-bbcode.js b/components/prism-bbcode.js index e73ea8e019..a46e56d736 100644 --- a/components/prism-bbcode.js +++ b/components/prism-bbcode.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['bbcode']) { diff --git a/components/prism-bbj.js b/components/prism-bbj.js index 2d86ee2d42..81a69d68df 100644 --- a/components/prism-bbj.js +++ b/components/prism-bbj.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['bbj']) { diff --git a/components/prism-bicep.js b/components/prism-bicep.js index d568789d71..cdb4de5d4b 100644 --- a/components/prism-bicep.js +++ b/components/prism-bicep.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['bicep']) { diff --git a/components/prism-birb.js b/components/prism-birb.js index 9a733361f5..73a953549a 100644 --- a/components/prism-birb.js +++ b/components/prism-birb.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-bison.js b/components/prism-bison.js index 01151840f6..7ec828c6fe 100644 --- a/components/prism-bison.js +++ b/components/prism-bison.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cLoader } from "./prism-c.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-bnf.js b/components/prism-bnf.js index 62003d4d57..05ee7dca10 100644 --- a/components/prism-bnf.js +++ b/components/prism-bnf.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['bnf']) { diff --git a/components/prism-bqn.js b/components/prism-bqn.js index a7f3469d26..ad8ccd9527 100644 --- a/components/prism-bqn.js +++ b/components/prism-bqn.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['bqn']) { diff --git a/components/prism-brainfuck.js b/components/prism-brainfuck.js index 5f097a0bb2..164dbfb620 100644 --- a/components/prism-brainfuck.js +++ b/components/prism-brainfuck.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['brainfuck']) { diff --git a/components/prism-brightscript.js b/components/prism-brightscript.js index 9f8e35b9ea..ae2524a388 100644 --- a/components/prism-brightscript.js +++ b/components/prism-brightscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['brightscript']) { diff --git a/components/prism-bro.js b/components/prism-bro.js index 37fab29ca2..017043cf2d 100644 --- a/components/prism-bro.js +++ b/components/prism-bro.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['bro']) { diff --git a/components/prism-bsl.js b/components/prism-bsl.js index 1759719ea3..d3cfd0edb4 100644 --- a/components/prism-bsl.js +++ b/components/prism-bsl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['bsl']) { diff --git a/components/prism-c.js b/components/prism-c.js index d2ce17921c..812ba53fad 100644 --- a/components/prism-c.js +++ b/components/prism-c.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-cfscript.js b/components/prism-cfscript.js index 021f93a066..b895899ac3 100644 --- a/components/prism-cfscript.js +++ b/components/prism-cfscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-chaiscript.js b/components/prism-chaiscript.js index cc12e656f7..3a9e5db0e5 100644 --- a/components/prism-chaiscript.js +++ b/components/prism-chaiscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" import { loader as cppLoader } from "./prism-cpp.js" export function loader (Prism, options) { diff --git a/components/prism-cil.js b/components/prism-cil.js index f2ab57a552..eef6e1b7c8 100644 --- a/components/prism-cil.js +++ b/components/prism-cil.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['cil']) { diff --git a/components/prism-cilkc.js b/components/prism-cilkc.js index c7a73b4941..d396747159 100644 --- a/components/prism-cilkc.js +++ b/components/prism-cilkc.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cLoader } from "./prism-c.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-cilkcpp.js b/components/prism-cilkcpp.js index 2cf393952a..00ada24c38 100644 --- a/components/prism-cilkcpp.js +++ b/components/prism-cilkcpp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cppLoader } from "./prism-cpp.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-clike.js b/components/prism-clike.js index 950d10ea05..4beff435db 100644 --- a/components/prism-clike.js +++ b/components/prism-clike.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['clike']) { diff --git a/components/prism-clojure.js b/components/prism-clojure.js index 3411f8a51c..08c6579b28 100644 --- a/components/prism-clojure.js +++ b/components/prism-clojure.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['clojure']) { diff --git a/components/prism-cmake.js b/components/prism-cmake.js index e899ea1ae6..aab1dfffd3 100644 --- a/components/prism-cmake.js +++ b/components/prism-cmake.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['cmake']) { diff --git a/components/prism-cobol.js b/components/prism-cobol.js index fa5f0074d3..62a61e70bf 100644 --- a/components/prism-cobol.js +++ b/components/prism-cobol.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['cobol']) { diff --git a/components/prism-coffeescript.js b/components/prism-coffeescript.js index bad63e3c8e..42eb25ea59 100644 --- a/components/prism-coffeescript.js +++ b/components/prism-coffeescript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-concurnas.js b/components/prism-concurnas.js index 902b66df9a..25c6abd414 100644 --- a/components/prism-concurnas.js +++ b/components/prism-concurnas.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['concurnas']) { diff --git a/components/prism-cooklang.js b/components/prism-cooklang.js index 38b7c3a17c..fa56d2f1e6 100644 --- a/components/prism-cooklang.js +++ b/components/prism-cooklang.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['cooklang']) { diff --git a/components/prism-coq.js b/components/prism-coq.js index 770f40d33b..7b2e51b7a1 100644 --- a/components/prism-coq.js +++ b/components/prism-coq.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['coq']) { diff --git a/components/prism-cpp.js b/components/prism-cpp.js index 78efbb4e02..69cd864162 100644 --- a/components/prism-cpp.js +++ b/components/prism-cpp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cLoader } from "./prism-c.js" export function loader (Prism, options) { diff --git a/components/prism-crystal.js b/components/prism-crystal.js index d6c128f14c..af376741f3 100644 --- a/components/prism-crystal.js +++ b/components/prism-crystal.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as rubyLoader } from "./prism-ruby.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-csharp.js b/components/prism-csharp.js index aac29d44c0..7bfffa5e8f 100644 --- a/components/prism-csharp.js +++ b/components/prism-csharp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-cshtml.js b/components/prism-cshtml.js index 70f5a0e254..5354d59907 100644 --- a/components/prism-cshtml.js +++ b/components/prism-cshtml.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" import { loader as csharpLoader } from "./prism-csharp.js" diff --git a/components/prism-csp.js b/components/prism-csp.js index b90be6a441..25c53a626f 100644 --- a/components/prism-csp.js +++ b/components/prism-csp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['csp']) { diff --git a/components/prism-css-extras.js b/components/prism-css-extras.js index 0275685d13..10ee94be84 100644 --- a/components/prism-css-extras.js +++ b/components/prism-css-extras.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cssLoader } from "./prism-css.js" export function loader (Prism, options) { diff --git a/components/prism-css.js b/components/prism-css.js index 161b9754a1..aa5a040ed1 100644 --- a/components/prism-css.js +++ b/components/prism-css.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { diff --git a/components/prism-csv.js b/components/prism-csv.js index 60c86c579e..af54077b26 100644 --- a/components/prism-csv.js +++ b/components/prism-csv.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['csv']) { diff --git a/components/prism-cue.js b/components/prism-cue.js index 320c1addc4..a390fe3d41 100644 --- a/components/prism-cue.js +++ b/components/prism-cue.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['cue']) { diff --git a/components/prism-cypher.js b/components/prism-cypher.js index e1a05b44a7..76d071e0ab 100644 --- a/components/prism-cypher.js +++ b/components/prism-cypher.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['cypher']) { diff --git a/components/prism-d.js b/components/prism-d.js index 7cc452ecaf..586d5976af 100644 --- a/components/prism-d.js +++ b/components/prism-d.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-dart.js b/components/prism-dart.js index c804548eec..4058526bc5 100644 --- a/components/prism-dart.js +++ b/components/prism-dart.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-dataweave.js b/components/prism-dataweave.js index 9269dd3261..1628532c7f 100644 --- a/components/prism-dataweave.js +++ b/components/prism-dataweave.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['dataweave']) { diff --git a/components/prism-dax.js b/components/prism-dax.js index 86ab11e49f..67903dce9f 100644 --- a/components/prism-dax.js +++ b/components/prism-dax.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['dax']) { diff --git a/components/prism-dhall.js b/components/prism-dhall.js index 9d2e4ee554..7b0a6a685f 100644 --- a/components/prism-dhall.js +++ b/components/prism-dhall.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['dhall']) { diff --git a/components/prism-diff.js b/components/prism-diff.js index 7984edfd65..24c7dd8a70 100644 --- a/components/prism-diff.js +++ b/components/prism-diff.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['diff']) { diff --git a/components/prism-django.js b/components/prism-django.js index a9c8875bb2..fbbe496626 100644 --- a/components/prism-django.js +++ b/components/prism-django.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-dns-zone-file.js b/components/prism-dns-zone-file.js index ea1733da31..b4864630fb 100644 --- a/components/prism-dns-zone-file.js +++ b/components/prism-dns-zone-file.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['dns-zone-file']) { diff --git a/components/prism-docker.js b/components/prism-docker.js index 988683c515..4febed0107 100644 --- a/components/prism-docker.js +++ b/components/prism-docker.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['docker']) { diff --git a/components/prism-dot.js b/components/prism-dot.js index 9c67e6e52f..ff03ba2abd 100644 --- a/components/prism-dot.js +++ b/components/prism-dot.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['dot']) { @@ -27,7 +31,7 @@ export function loader (Prism, options) { /** * @param {string} source - * @param {string} flags + * @param {string} [flags] * @returns {RegExp} */ function withID(source, flags) { diff --git a/components/prism-ebnf.js b/components/prism-ebnf.js index 084c7cf0af..ceabac98ff 100644 --- a/components/prism-ebnf.js +++ b/components/prism-ebnf.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['ebnf']) { diff --git a/components/prism-editorconfig.js b/components/prism-editorconfig.js index ead6ee079b..72a4f5b7a1 100644 --- a/components/prism-editorconfig.js +++ b/components/prism-editorconfig.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['editorconfig']) { diff --git a/components/prism-eiffel.js b/components/prism-eiffel.js index 3ae08ebf8c..ea7c825cef 100644 --- a/components/prism-eiffel.js +++ b/components/prism-eiffel.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['eiffel']) { diff --git a/components/prism-ejs.js b/components/prism-ejs.js index 368bde250b..0c2881ff80 100644 --- a/components/prism-ejs.js +++ b/components/prism-ejs.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-elixir.js b/components/prism-elixir.js index d9cb59534e..cfa0fd25a5 100644 --- a/components/prism-elixir.js +++ b/components/prism-elixir.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['elixir']) { diff --git a/components/prism-elm.js b/components/prism-elm.js index 4a0563c7b2..ae1216c86a 100644 --- a/components/prism-elm.js +++ b/components/prism-elm.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['elm']) { diff --git a/components/prism-erb.js b/components/prism-erb.js index c3fffa5435..64ae606354 100644 --- a/components/prism-erb.js +++ b/components/prism-erb.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as rubyLoader } from "./prism-ruby.js" import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" diff --git a/components/prism-erlang.js b/components/prism-erlang.js index 4a16a09269..00f6446f33 100644 --- a/components/prism-erlang.js +++ b/components/prism-erlang.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['erlang']) { diff --git a/components/prism-etlua.js b/components/prism-etlua.js index 4b9d25e97a..966cf18395 100644 --- a/components/prism-etlua.js +++ b/components/prism-etlua.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" import { loader as luaLoader } from "./prism-lua.js" export function loader (Prism, options) { diff --git a/components/prism-excel-formula.js b/components/prism-excel-formula.js index fd9e03a1ba..3043e6832e 100644 --- a/components/prism-excel-formula.js +++ b/components/prism-excel-formula.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['excel-formula']) { diff --git a/components/prism-factor.js b/components/prism-factor.js index 6590cf8284..89db37a29d 100644 --- a/components/prism-factor.js +++ b/components/prism-factor.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['factor']) { diff --git a/components/prism-false.js b/components/prism-false.js index 2c45d87d6a..58363ba2f9 100644 --- a/components/prism-false.js +++ b/components/prism-false.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['false']) { diff --git a/components/prism-firestore-security-rules.js b/components/prism-firestore-security-rules.js index 8d326bdd8e..9d65cc972e 100644 --- a/components/prism-firestore-security-rules.js +++ b/components/prism-firestore-security-rules.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-flow.js b/components/prism-flow.js index 7f726108a8..daf490223c 100644 --- a/components/prism-flow.js +++ b/components/prism-flow.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-fortran.js b/components/prism-fortran.js index 4583c835a0..9542f6dbdb 100644 --- a/components/prism-fortran.js +++ b/components/prism-fortran.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['fortran']) { diff --git a/components/prism-fsharp.js b/components/prism-fsharp.js index 998d4b4906..98c6910d28 100644 --- a/components/prism-fsharp.js +++ b/components/prism-fsharp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-ftl.js b/components/prism-ftl.js index 99123c7517..8f512b994d 100644 --- a/components/prism-ftl.js +++ b/components/prism-ftl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-gap.js b/components/prism-gap.js index 3cb3e29d79..97e65d79f7 100644 --- a/components/prism-gap.js +++ b/components/prism-gap.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['gap']) { diff --git a/components/prism-gcode.js b/components/prism-gcode.js index 5ef9a89eee..3e56d335ba 100644 --- a/components/prism-gcode.js +++ b/components/prism-gcode.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['gcode']) { diff --git a/components/prism-gdscript.js b/components/prism-gdscript.js index 7bb1d85e68..388d3d39ba 100644 --- a/components/prism-gdscript.js +++ b/components/prism-gdscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['gdscript']) { diff --git a/components/prism-gedcom.js b/components/prism-gedcom.js index 3efde3aadb..823fd734d4 100644 --- a/components/prism-gedcom.js +++ b/components/prism-gedcom.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['gedcom']) { diff --git a/components/prism-gettext.js b/components/prism-gettext.js index 08de113e92..a22b1c27d9 100644 --- a/components/prism-gettext.js +++ b/components/prism-gettext.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['gettext']) { diff --git a/components/prism-gherkin.js b/components/prism-gherkin.js index ecd7b2dc22..ea31f80c1f 100644 --- a/components/prism-gherkin.js +++ b/components/prism-gherkin.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['gherkin']) { diff --git a/components/prism-git.js b/components/prism-git.js index 71f441d10b..ace9f93484 100644 --- a/components/prism-git.js +++ b/components/prism-git.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['git']) { diff --git a/components/prism-glsl.js b/components/prism-glsl.js index 78e0db763a..65ffb509c4 100644 --- a/components/prism-glsl.js +++ b/components/prism-glsl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cLoader } from "./prism-c.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-gml.js b/components/prism-gml.js index f579776aa0..8080bee9d0 100644 --- a/components/prism-gml.js +++ b/components/prism-gml.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-gn.js b/components/prism-gn.js index e2c3645871..757d847dab 100644 --- a/components/prism-gn.js +++ b/components/prism-gn.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['gn']) { diff --git a/components/prism-go-module.js b/components/prism-go-module.js index b72b639716..1ccd14e504 100644 --- a/components/prism-go-module.js +++ b/components/prism-go-module.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['go-module']) { diff --git a/components/prism-go.js b/components/prism-go.js index 12025c297b..8ea91bca83 100644 --- a/components/prism-go.js +++ b/components/prism-go.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-gradle.js b/components/prism-gradle.js index 2f7b824fa1..ab27f8020b 100644 --- a/components/prism-gradle.js +++ b/components/prism-gradle.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-graphql.js b/components/prism-graphql.js index 65582845b0..02c987b2ca 100644 --- a/components/prism-graphql.js +++ b/components/prism-graphql.js @@ -1,5 +1,9 @@ // import { loader as markdownLoader } from "./prism-markdown.js" +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['graphql']) { @@ -79,7 +83,7 @@ export function loader (Prism, options) { /** * get the graphql token stream that we want to customize * - * @typedef {InstanceType} Token + * @typedef {InstanceType} Token * @type {Token[]} */ var validTokens = env.tokens.filter(function (token) { diff --git a/components/prism-groovy.js b/components/prism-groovy.js index 657b0c4704..b20dc8275b 100644 --- a/components/prism-groovy.js +++ b/components/prism-groovy.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-haml.js b/components/prism-haml.js index 98921d129e..647d61f9b1 100644 --- a/components/prism-haml.js +++ b/components/prism-haml.js @@ -1,5 +1,9 @@ import { loader as rubyLoader } from "./prism-ruby.js" +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['haml']) { @@ -133,7 +137,7 @@ export function loader (Prism, options) { filter = typeof filter === 'string' ? { filter: filter, language: filter } : filter; if (Prism.languages[filter.language]) { all_filters['filter-' + filter.filter] = { - pattern: RegExp(filter_pattern.replace('{{filter_name}}', function () { return filter.filter; })), + pattern: RegExp(filter_pattern.replace('{{filter_name}}', function () { return /** @type {any} */ (filter).filter; })), lookbehind: true, inside: { 'filter-name': { diff --git a/components/prism-handlebars.js b/components/prism-handlebars.js index c19fb62ca2..6824a38c9e 100644 --- a/components/prism-handlebars.js +++ b/components/prism-handlebars.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-haskell.js b/components/prism-haskell.js index 6fad3fc8b6..f12b5286f5 100644 --- a/components/prism-haskell.js +++ b/components/prism-haskell.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['haskell']) { diff --git a/components/prism-haxe.js b/components/prism-haxe.js index 835d9c9959..506c1ee316 100644 --- a/components/prism-haxe.js +++ b/components/prism-haxe.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-hcl.js b/components/prism-hcl.js index 9180d79ecf..b5699ee141 100644 --- a/components/prism-hcl.js +++ b/components/prism-hcl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['hcl']) { diff --git a/components/prism-hlsl.js b/components/prism-hlsl.js index 05c9270fe9..791948d670 100644 --- a/components/prism-hlsl.js +++ b/components/prism-hlsl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cLoader } from "./prism-c.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-hoon.js b/components/prism-hoon.js index 39c407ec66..71ca59c52c 100644 --- a/components/prism-hoon.js +++ b/components/prism-hoon.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['hoon']) { diff --git a/components/prism-hpkp.js b/components/prism-hpkp.js index 292297402b..243ea8f5a0 100644 --- a/components/prism-hpkp.js +++ b/components/prism-hpkp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['hpkp']) { diff --git a/components/prism-hsts.js b/components/prism-hsts.js index aa05083150..9a7a80372c 100644 --- a/components/prism-hsts.js +++ b/components/prism-hsts.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['hsts']) { diff --git a/components/prism-http.js b/components/prism-http.js index 219128432f..338f438aaf 100644 --- a/components/prism-http.js +++ b/components/prism-http.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['http']) { @@ -125,13 +129,13 @@ export function loader (Prism, options) { // Insert each content type parser that has its associated language // currently loaded. - var options; + var httpOptions; for (var contentType in httpLanguages) { if (httpLanguages[contentType]) { - options = options || {}; + httpOptions = httpOptions || {}; var pattern = suffixTypes[contentType] ? getSuffixPattern(contentType) : contentType; - options[contentType.replace(/\//g, '-')] = { + httpOptions[contentType.replace(/\//g, '-')] = { pattern: RegExp( '(' + /content-type:\s*/.source + pattern + /(?:(?:\r\n?|\n)[\w-].*)*(?:\r(?:\n|(?!\n))|\n)/.source + ')' + // This is a little interesting: @@ -147,7 +151,7 @@ export function loader (Prism, options) { }; } } - if (options) { - Prism.languages.insertBefore('http', 'header', options); + if (httpOptions) { + Prism.languages.insertBefore('http', 'header', httpOptions); } } \ No newline at end of file diff --git a/components/prism-ichigojam.js b/components/prism-ichigojam.js index 10cd64a56c..780f69b170 100644 --- a/components/prism-ichigojam.js +++ b/components/prism-ichigojam.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['ichigojam']) { diff --git a/components/prism-icon.js b/components/prism-icon.js index 654e7e2b69..d58af39c26 100644 --- a/components/prism-icon.js +++ b/components/prism-icon.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['icon']) { diff --git a/components/prism-icu-message-format.js b/components/prism-icu-message-format.js index c1a019a043..5d5acb1537 100644 --- a/components/prism-icu-message-format.js +++ b/components/prism-icu-message-format.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['icu-message-format']) { diff --git a/components/prism-idris.js b/components/prism-idris.js index b71988066f..42d4085eca 100644 --- a/components/prism-idris.js +++ b/components/prism-idris.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as haskellLoader } from "./prism-haskell.js" export function loader (Prism, options) { diff --git a/components/prism-iecst.js b/components/prism-iecst.js index c51071c01a..787a67305a 100644 --- a/components/prism-iecst.js +++ b/components/prism-iecst.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['iecst']) { diff --git a/components/prism-ignore.js b/components/prism-ignore.js index fd70c06929..343062d8b8 100644 --- a/components/prism-ignore.js +++ b/components/prism-ignore.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['ignore']) { diff --git a/components/prism-inform7.js b/components/prism-inform7.js index 6592d4d94c..60cad068f1 100644 --- a/components/prism-inform7.js +++ b/components/prism-inform7.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['inform7']) { diff --git a/components/prism-ini.js b/components/prism-ini.js index 2abdd98ed9..525c48e83b 100644 --- a/components/prism-ini.js +++ b/components/prism-ini.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['ini']) { diff --git a/components/prism-io.js b/components/prism-io.js index 03918966d1..04d1ffecdb 100644 --- a/components/prism-io.js +++ b/components/prism-io.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['io']) { diff --git a/components/prism-j.js b/components/prism-j.js index cc9a51355e..e7c629fe0c 100644 --- a/components/prism-j.js +++ b/components/prism-j.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['j']) { diff --git a/components/prism-java.js b/components/prism-java.js index ab40049bad..4b3b80152c 100644 --- a/components/prism-java.js +++ b/components/prism-java.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-javadoc.js b/components/prism-javadoc.js index 7aad1b5786..a8c82b972b 100644 --- a/components/prism-javadoc.js +++ b/components/prism-javadoc.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" import { loader as javaLoader } from "./prism-java.js" import { loader as javadoclikeLoader } from "./prism-javadoclike.js" diff --git a/components/prism-javadoclike.js b/components/prism-javadoclike.js index 575b6d19c5..21afb98d75 100644 --- a/components/prism-javadoclike.js +++ b/components/prism-javadoclike.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['javadoclike']) { @@ -22,7 +26,7 @@ export function loader (Prism, options) { * Adds doc comment support to the given language and calls a given callback on each doc comment pattern. * * @param {string} lang the language add doc comment support to. - * @param {(pattern: {inside: {rest: undefined}}) => void} callback the function called with each doc comment pattern as argument. + * @param {(pattern: {inside: {rest?: undefined}}) => void} callback the function called with each doc comment pattern as argument. */ function docCommentSupport(lang, callback) { var tokenName = 'doc-comment'; @@ -85,5 +89,5 @@ export function loader (Prism, options) { Object.defineProperty(javaDocLike, 'addSupport', { value: addSupport }); - javaDocLike.addSupport(['java', 'javascript', 'php'], javaDocLike); + addSupport(['java', 'javascript', 'php'], javaDocLike); } \ No newline at end of file diff --git a/components/prism-javascript.js b/components/prism-javascript.js index 61422bdf4a..070387faa2 100644 --- a/components/prism-javascript.js +++ b/components/prism-javascript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" import { loader as markupLoader } from "./prism-markup.js" diff --git a/components/prism-javastacktrace.js b/components/prism-javastacktrace.js index e8aae82351..0acdd3bab2 100644 --- a/components/prism-javastacktrace.js +++ b/components/prism-javastacktrace.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['javastacktrace']) { diff --git a/components/prism-jexl.js b/components/prism-jexl.js index de72bde695..797b26b1dd 100644 --- a/components/prism-jexl.js +++ b/components/prism-jexl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['jexl']) { diff --git a/components/prism-jolie.js b/components/prism-jolie.js index 5e978c1b19..357578f17d 100644 --- a/components/prism-jolie.js +++ b/components/prism-jolie.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-jq.js b/components/prism-jq.js index a7451d74a2..ca76e209fa 100644 --- a/components/prism-jq.js +++ b/components/prism-jq.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['jq']) { diff --git a/components/prism-js-extras.js b/components/prism-js-extras.js index e76243c2e9..a6b435a578 100644 --- a/components/prism-js-extras.js +++ b/components/prism-js-extras.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" export function loader (Prism, options) { diff --git a/components/prism-js-templates.js b/components/prism-js-templates.js index ee09bac0a3..948d34271b 100644 --- a/components/prism-js-templates.js +++ b/components/prism-js-templates.js @@ -1,5 +1,13 @@ import { loader as javascriptLoader } from './prism-javascript.js' +/** + * @typedef {import("../prism-core.js").Token} Token + */ + +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['js-templates']) { @@ -119,10 +127,12 @@ export function loader (Prism, options) { * @returns {Token} */ function tokenizeInterpolationExpression(expression) { + /** + * @type {import('../prism-core.js').Grammar} + */ var tempGrammar = {}; tempGrammar['interpolation-punctuation'] = interpolationPunctuationObject; - /** @type {Array} */ var tokens = Prism.tokenize(expression, tempGrammar); if (tokens.length === 3) { /** @@ -135,6 +145,7 @@ export function loader (Prism, options) { */ var args = [1, 1]; + // @ts-expect-error args.push.apply(args, tokenizeWithHooks(tokens[1], Prism.languages.javascript, 'javascript')); tokens.splice.apply(tokens, args); @@ -164,7 +175,6 @@ export function loader (Prism, options) { // 1. First filter out all interpolations // because they might be escaped, we need a lookbehind, so we use Prism - /** @type {(Token|string)[]} */ var _tokens = Prism.tokenize(code, { 'interpolation': { pattern: RegExp(interpolationPattern), @@ -184,6 +194,8 @@ export function loader (Prism, options) { var placeholder; while (code.indexOf(placeholder = getPlaceholder(placeholderCounter++, language)) !== -1) { /* noop */ } + + // @ts-expect-error placeholderMap[placeholder] = interpolationExpression; return placeholder; } @@ -237,6 +249,7 @@ export function loader (Prism, options) { } if (typeof token === 'string') { + // @ts-expect-error tokens.splice.apply(tokens, [i, 1].concat(replacement)); i += replacement.length - 1; } else { @@ -246,6 +259,7 @@ export function loader (Prism, options) { } else { var content = token.content; if (Array.isArray(content)) { + // @ts-expect-error walkTokens(content); } else { walkTokens([content]); @@ -317,8 +331,10 @@ export function loader (Prism, options) { var embedded = content[1]; if (content.length === 3 && typeof embedded !== 'string' && embedded.type === 'embedded-code') { // get string content + // @ts-expect-error var code = stringContent(embedded); + // @ts-expect-error var alias = embedded.alias; var language = Array.isArray(alias) ? alias[0] : alias; @@ -331,6 +347,7 @@ export function loader (Prism, options) { content[1] = tokenizeEmbedded(code, grammar, language); } } else { + // @ts-expect-error findTemplateStrings(content); } } @@ -352,6 +369,7 @@ export function loader (Prism, options) { } else if (Array.isArray(value)) { return value.map(stringContent).join(''); } else { + // @ts-expect-error return stringContent(value.content); } } diff --git a/components/prism-jsdoc.js b/components/prism-jsdoc.js index 9e03684257..5c871d6e3d 100644 --- a/components/prism-jsdoc.js +++ b/components/prism-jsdoc.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javadoclikeLoader } from "./prism-javadoclike.js" import { loader as javascriptLoader } from "./prism-javascript.js" import { loader as typescriptLoader } from "./prism-typescript.js" diff --git a/components/prism-json.js b/components/prism-json.js index f5663e20d6..727facf27f 100644 --- a/components/prism-json.js +++ b/components/prism-json.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['json']) { diff --git a/components/prism-json5.js b/components/prism-json5.js index 7a0f582771..cacdb4783d 100644 --- a/components/prism-json5.js +++ b/components/prism-json5.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as jsonLoader } from "./prism-json.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-jsonp.js b/components/prism-jsonp.js index a532a356e1..bfa18ba2bb 100644 --- a/components/prism-jsonp.js +++ b/components/prism-jsonp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as jsonLoader } from "./prism-json.js" export function loader (Prism, options) { diff --git a/components/prism-jsstacktrace.js b/components/prism-jsstacktrace.js index bd5ad6f7b4..e23117a744 100644 --- a/components/prism-jsstacktrace.js +++ b/components/prism-jsstacktrace.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['jsstacktrace']) { diff --git a/components/prism-jsx.js b/components/prism-jsx.js index a71a2a34dc..29495da688 100644 --- a/components/prism-jsx.js +++ b/components/prism-jsx.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from './prism-markup.js' import { loader as javascriptLoader } from './prism-javascript.js' diff --git a/components/prism-julia.js b/components/prism-julia.js index 2d906e73ab..2a8d502f13 100644 --- a/components/prism-julia.js +++ b/components/prism-julia.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['julia']) { diff --git a/components/prism-keepalived.js b/components/prism-keepalived.js index 7a4ef81aec..9481d65a68 100644 --- a/components/prism-keepalived.js +++ b/components/prism-keepalived.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['keepalived']) { diff --git a/components/prism-keyman.js b/components/prism-keyman.js index 34416f8ea3..2c2fa24fe8 100644 --- a/components/prism-keyman.js +++ b/components/prism-keyman.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['keyman']) { diff --git a/components/prism-kotlin.js b/components/prism-kotlin.js index 9b946afbae..66ff63f7bf 100644 --- a/components/prism-kotlin.js +++ b/components/prism-kotlin.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-kumir.js b/components/prism-kumir.js index a2926fcdde..5161ea95e4 100644 --- a/components/prism-kumir.js +++ b/components/prism-kumir.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['kumir']) { diff --git a/components/prism-kusto.js b/components/prism-kusto.js index 097a3232fd..572f47e67f 100644 --- a/components/prism-kusto.js +++ b/components/prism-kusto.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['kusto']) { diff --git a/components/prism-latex.js b/components/prism-latex.js index ac8076d7f1..1309a33d65 100644 --- a/components/prism-latex.js +++ b/components/prism-latex.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['latex']) { diff --git a/components/prism-latte.js b/components/prism-latte.js index ff0d107cda..e926fae022 100644 --- a/components/prism-latte.js +++ b/components/prism-latte.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" import { loader as phpLoader } from "./prism-php.js" diff --git a/components/prism-less.js b/components/prism-less.js index 6b5aa99ec2..917a07d01e 100644 --- a/components/prism-less.js +++ b/components/prism-less.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ // import { cssLoader } from './prism-css.js' export function loader (Prism, options) { diff --git a/components/prism-lilypond.js b/components/prism-lilypond.js index 51546af87b..1892368efb 100644 --- a/components/prism-lilypond.js +++ b/components/prism-lilypond.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as schemeLoader } from "./prism-scheme.js" export function loader (Prism, options) { diff --git a/components/prism-linker-script.js b/components/prism-linker-script.js index 138016fcba..1bdb1b65dc 100644 --- a/components/prism-linker-script.js +++ b/components/prism-linker-script.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['linker-script']) { diff --git a/components/prism-liquid.js b/components/prism-liquid.js index 720c9d82d7..2cf54d9a66 100644 --- a/components/prism-liquid.js +++ b/components/prism-liquid.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-lisp.js b/components/prism-lisp.js index 1abf819c21..7b3f51001b 100644 --- a/components/prism-lisp.js +++ b/components/prism-lisp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['lisp']) { diff --git a/components/prism-livescript.js b/components/prism-livescript.js index 22c2c10c0b..92b75d99ae 100644 --- a/components/prism-livescript.js +++ b/components/prism-livescript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['livescript']) { diff --git a/components/prism-llvm.js b/components/prism-llvm.js index 1900fffb2c..fe6faab880 100644 --- a/components/prism-llvm.js +++ b/components/prism-llvm.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['llvm']) { diff --git a/components/prism-log.js b/components/prism-log.js index 1b8579da7b..7437425ce9 100644 --- a/components/prism-log.js +++ b/components/prism-log.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['log']) { diff --git a/components/prism-lolcode.js b/components/prism-lolcode.js index 974708018f..eb28fc65b0 100644 --- a/components/prism-lolcode.js +++ b/components/prism-lolcode.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['lolcode']) { diff --git a/components/prism-lua.js b/components/prism-lua.js index ea65d2e977..80745cc51c 100644 --- a/components/prism-lua.js +++ b/components/prism-lua.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['lua']) { diff --git a/components/prism-magma.js b/components/prism-magma.js index deede25374..98862a436b 100644 --- a/components/prism-magma.js +++ b/components/prism-magma.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['magma']) { diff --git a/components/prism-makefile.js b/components/prism-makefile.js index 72cd236bf2..7f29a4c827 100644 --- a/components/prism-makefile.js +++ b/components/prism-makefile.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['makefile']) { diff --git a/components/prism-markdown.js b/components/prism-markdown.js index 4e3b216022..bfa4557665 100644 --- a/components/prism-markdown.js +++ b/components/prism-markdown.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { diff --git a/components/prism-markup-templating.js b/components/prism-markup-templating.js index d3371f609f..0840b62826 100644 --- a/components/prism-markup-templating.js +++ b/components/prism-markup-templating.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { diff --git a/components/prism-markup.js b/components/prism-markup.js index 8a2d00965c..d02667adba 100644 --- a/components/prism-markup.js +++ b/components/prism-markup.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['markup']) { diff --git a/components/prism-mata.js b/components/prism-mata.js index 19b9381a2b..dcbb56c87e 100644 --- a/components/prism-mata.js +++ b/components/prism-mata.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['mata']) { diff --git a/components/prism-matlab.js b/components/prism-matlab.js index 4feadd7745..61980fc553 100644 --- a/components/prism-matlab.js +++ b/components/prism-matlab.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['matlab']) { diff --git a/components/prism-maxscript.js b/components/prism-maxscript.js index 8226624c5e..3c24cfb8b8 100644 --- a/components/prism-maxscript.js +++ b/components/prism-maxscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['maxscript']) { diff --git a/components/prism-mel.js b/components/prism-mel.js index 0f0844605b..4a8d583a98 100644 --- a/components/prism-mel.js +++ b/components/prism-mel.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['mel']) { diff --git a/components/prism-mermaid.js b/components/prism-mermaid.js index a8afaeecfa..768b56738a 100644 --- a/components/prism-mermaid.js +++ b/components/prism-mermaid.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['mermaid']) { diff --git a/components/prism-metafont.js b/components/prism-metafont.js index f02601860d..3b8fe7b452 100644 --- a/components/prism-metafont.js +++ b/components/prism-metafont.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['metafont']) { diff --git a/components/prism-mizar.js b/components/prism-mizar.js index 9a1cc902f3..323a6cf2d0 100644 --- a/components/prism-mizar.js +++ b/components/prism-mizar.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['mizar']) { diff --git a/components/prism-mongodb.js b/components/prism-mongodb.js index 2caefdc342..c07027d176 100644 --- a/components/prism-mongodb.js +++ b/components/prism-mongodb.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-monkey.js b/components/prism-monkey.js index 01c38cfb31..8252b270de 100644 --- a/components/prism-monkey.js +++ b/components/prism-monkey.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['monkey']) { diff --git a/components/prism-moonscript.js b/components/prism-moonscript.js index de4c709e8a..3921729869 100644 --- a/components/prism-moonscript.js +++ b/components/prism-moonscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['moonscript']) { diff --git a/components/prism-n1ql.js b/components/prism-n1ql.js index 1e0b9b8261..5889c8e107 100644 --- a/components/prism-n1ql.js +++ b/components/prism-n1ql.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['n1ql']) { diff --git a/components/prism-n4js.js b/components/prism-n4js.js index 8181ba2950..e95585e3ee 100755 --- a/components/prism-n4js.js +++ b/components/prism-n4js.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-nand2tetris-hdl.js b/components/prism-nand2tetris-hdl.js index a835fabda8..ec7de48db2 100644 --- a/components/prism-nand2tetris-hdl.js +++ b/components/prism-nand2tetris-hdl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['nand2tetris-hdl']) { diff --git a/components/prism-naniscript.js b/components/prism-naniscript.js index 49843eac1c..82123d5b4f 100644 --- a/components/prism-naniscript.js +++ b/components/prism-naniscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['naniscript']) { @@ -115,7 +119,7 @@ export function loader (Prism, options) { }; Prism.languages.nani = Prism.languages['naniscript']; - /** @typedef {InstanceType} Token */ + /** @typedef {InstanceType} Token */ /** * This hook is used to validate generic-text tokens for balanced brackets. @@ -166,6 +170,7 @@ export function loader (Prism, options) { } else if (Array.isArray(token)) { return token.map(getTextContent).join(''); } else { + // @ts-expect-error return getTextContent(token.content); } } diff --git a/components/prism-nasm.js b/components/prism-nasm.js index 37edf0c699..eb4881c5b3 100644 --- a/components/prism-nasm.js +++ b/components/prism-nasm.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['nasm']) { diff --git a/components/prism-neon.js b/components/prism-neon.js index f343d5ae5a..fcff57b058 100644 --- a/components/prism-neon.js +++ b/components/prism-neon.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['neon']) { diff --git a/components/prism-nevod.js b/components/prism-nevod.js index c85b3a8fa2..f75e96aa75 100644 --- a/components/prism-nevod.js +++ b/components/prism-nevod.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['nevod']) { diff --git a/components/prism-nginx.js b/components/prism-nginx.js index b50ffcd905..4c4de85c0a 100644 --- a/components/prism-nginx.js +++ b/components/prism-nginx.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['nginx']) { diff --git a/components/prism-nim.js b/components/prism-nim.js index cd5e078463..4c43e3da4b 100644 --- a/components/prism-nim.js +++ b/components/prism-nim.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['nim']) { diff --git a/components/prism-nix.js b/components/prism-nix.js index 4da66a1585..2aa819a490 100644 --- a/components/prism-nix.js +++ b/components/prism-nix.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['nix']) { diff --git a/components/prism-nsis.js b/components/prism-nsis.js index 1f853e9d35..7a94abc1be 100644 --- a/components/prism-nsis.js +++ b/components/prism-nsis.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['nsis']) { diff --git a/components/prism-objectivec.js b/components/prism-objectivec.js index 1562e90d6d..bf68d965b0 100644 --- a/components/prism-objectivec.js +++ b/components/prism-objectivec.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cLoader } from "./prism-c.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-ocaml.js b/components/prism-ocaml.js index 4fb15d020b..b0c43d047d 100644 --- a/components/prism-ocaml.js +++ b/components/prism-ocaml.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['ocaml']) { diff --git a/components/prism-odin.js b/components/prism-odin.js index 43878f8faa..c0fa25c756 100644 --- a/components/prism-odin.js +++ b/components/prism-odin.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['odin']) { diff --git a/components/prism-opencl.js b/components/prism-opencl.js index a45699c26c..db9f7d6447 100644 --- a/components/prism-opencl.js +++ b/components/prism-opencl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cLoader } from "./prism-c.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-openqasm.js b/components/prism-openqasm.js index 4ac170ea08..6b6fc0408a 100644 --- a/components/prism-openqasm.js +++ b/components/prism-openqasm.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['openqasm']) { diff --git a/components/prism-oz.js b/components/prism-oz.js index c908c1b8ef..870d36b7f6 100644 --- a/components/prism-oz.js +++ b/components/prism-oz.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['oz']) { diff --git a/components/prism-parigp.js b/components/prism-parigp.js index 6f547f0f38..74377a2bc1 100644 --- a/components/prism-parigp.js +++ b/components/prism-parigp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['parigp']) { @@ -19,10 +23,10 @@ export function loader (Prism, options) { 'forstep', 'forsubgroup', 'forvec', 'for', 'iferr', 'if', 'local', 'my', 'next', 'return', 'until', 'while' ]; - keywords = keywords.map(function (keyword) { + const keywordString = keywords.map(function (keyword) { return keyword.split('').join(' *'); }).join('|'); - return RegExp('\\b(?:' + keywords + ')\\b'); + return RegExp('\\b(?:' + keywordString + ')\\b'); }()), 'function': /\b\w(?:[\w ]*\w)?(?= *\()/, 'number': { diff --git a/components/prism-parser.js b/components/prism-parser.js index 654f2bbc3b..dbad6db89d 100644 --- a/components/prism-parser.js +++ b/components/prism-parser.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { diff --git a/components/prism-pascal.js b/components/prism-pascal.js index ce0bb036a4..e75e13fe0d 100644 --- a/components/prism-pascal.js +++ b/components/prism-pascal.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['pascal']) { diff --git a/components/prism-pascaligo.js b/components/prism-pascaligo.js index fb35cc9aff..03a23361ff 100644 --- a/components/prism-pascaligo.js +++ b/components/prism-pascaligo.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['pascaligo']) { diff --git a/components/prism-pcaxis.js b/components/prism-pcaxis.js index d5900c3ee9..1dbb65c6d8 100644 --- a/components/prism-pcaxis.js +++ b/components/prism-pcaxis.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['pcaxis']) { diff --git a/components/prism-peoplecode.js b/components/prism-peoplecode.js index 0e8182ac02..678c0e38bd 100644 --- a/components/prism-peoplecode.js +++ b/components/prism-peoplecode.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['peoplecode']) { diff --git a/components/prism-perl.js b/components/prism-perl.js index 78bc165485..bf57ab768a 100644 --- a/components/prism-perl.js +++ b/components/prism-perl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['perl']) { diff --git a/components/prism-php-extras.js b/components/prism-php-extras.js index 6fccbd267d..11e9657179 100644 --- a/components/prism-php-extras.js +++ b/components/prism-php-extras.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as phpLoader } from "./prism-php.js" export function loader (Prism, options) { diff --git a/components/prism-php.js b/components/prism-php.js index d964087d7d..c477fc56df 100644 --- a/components/prism-php.js +++ b/components/prism-php.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-phpdoc.js b/components/prism-phpdoc.js index e72fda671d..3216ee2cf3 100644 --- a/components/prism-phpdoc.js +++ b/components/prism-phpdoc.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javadoclikeLoader } from "./prism-javadoclike.js" import { loader as phpLoader } from "./prism-php.js" diff --git a/components/prism-plant-uml.js b/components/prism-plant-uml.js index 10d8ffe8f1..8b05b840ca 100644 --- a/components/prism-plant-uml.js +++ b/components/prism-plant-uml.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['plant-uml']) { diff --git a/components/prism-plsql.js b/components/prism-plsql.js index 2999df954e..8a4b8d3e3c 100644 --- a/components/prism-plsql.js +++ b/components/prism-plsql.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as sqlLoader } from "./prism-sql.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-powerquery.js b/components/prism-powerquery.js index 713e8d23bc..7aa815a57c 100644 --- a/components/prism-powerquery.js +++ b/components/prism-powerquery.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['powerquery']) { diff --git a/components/prism-powershell.js b/components/prism-powershell.js index 1e583bf541..5707ef7ef8 100644 --- a/components/prism-powershell.js +++ b/components/prism-powershell.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['powershell']) { diff --git a/components/prism-processing.js b/components/prism-processing.js index 9fde6e8aca..6ce004667d 100644 --- a/components/prism-processing.js +++ b/components/prism-processing.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-prolog.js b/components/prism-prolog.js index 82b52c897a..0af46eea28 100644 --- a/components/prism-prolog.js +++ b/components/prism-prolog.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['prolog']) { diff --git a/components/prism-promql.js b/components/prism-promql.js index 60a06498d5..2542024c36 100644 --- a/components/prism-promql.js +++ b/components/prism-promql.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['promql']) { diff --git a/components/prism-properties.js b/components/prism-properties.js index 8e72566f1a..45d525ede3 100644 --- a/components/prism-properties.js +++ b/components/prism-properties.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['properties']) { diff --git a/components/prism-protobuf.js b/components/prism-protobuf.js index f4c1e0d2c9..29fb3494a0 100644 --- a/components/prism-protobuf.js +++ b/components/prism-protobuf.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-psl.js b/components/prism-psl.js index 0a0047ad50..6578120a8d 100644 --- a/components/prism-psl.js +++ b/components/prism-psl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['psl']) { diff --git a/components/prism-pug.js b/components/prism-pug.js index f8c78c776f..e7619e9f5e 100644 --- a/components/prism-pug.js +++ b/components/prism-pug.js @@ -1,5 +1,10 @@ import { loader as markupLoader } from "./prism-markup.js" import { loader as javascriptLoader } from "./prism-javascript.js" + +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['pug']) { @@ -176,7 +181,7 @@ export function loader (Prism, options) { filter = typeof filter === 'string' ? { filter: filter, language: filter } : filter; if (Prism.languages[filter.language]) { all_filters['filter-' + filter.filter] = { - pattern: RegExp(filter_pattern.replace('', function () { return filter.filter; }), 'm'), + pattern: RegExp(filter_pattern.replace('', function () { return /** @type {any} */ (filter).filter; }), 'm'), lookbehind: true, inside: { 'filter-name': { diff --git a/components/prism-puppet.js b/components/prism-puppet.js index 778f792960..ceaaaab428 100644 --- a/components/prism-puppet.js +++ b/components/prism-puppet.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['puppet']) { diff --git a/components/prism-pure.js b/components/prism-pure.js index 370c630981..719a1d4fde 100644 --- a/components/prism-pure.js +++ b/components/prism-pure.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['pure']) { @@ -67,12 +71,14 @@ export function loader (Prism, options) { alias = lang.alias; lang = lang.lang; } + // @ts-expect-error if (Prism.languages[alias]) { var o = {}; o['inline-lang-' + alias] = { pattern: RegExp(inlineLanguageRe.replace('', lang.replace(/([.+*?\/\\(){}\[\]])/g, '\\$1')), 'i'), inside: Prism.util.clone(Prism.languages.pure['inline-lang'].inside) }; + // @ts-expect-error o['inline-lang-' + alias].inside.rest = Prism.util.clone(Prism.languages[alias]); Prism.languages.insertBefore('pure', 'inline-lang', o); } diff --git a/components/prism-purebasic.js b/components/prism-purebasic.js index 055f7205a4..d483bed81a 100644 --- a/components/prism-purebasic.js +++ b/components/prism-purebasic.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-purescript.js b/components/prism-purescript.js index cb27768939..d1829b438b 100644 --- a/components/prism-purescript.js +++ b/components/prism-purescript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as haskellLoader } from "./prism-haskell.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-python.js b/components/prism-python.js index 2a3b6d0425..1101cec221 100644 --- a/components/prism-python.js +++ b/components/prism-python.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['python']) { diff --git a/components/prism-q.js b/components/prism-q.js index b362886fbb..6d027a188c 100644 --- a/components/prism-q.js +++ b/components/prism-q.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['q']) { diff --git a/components/prism-qml.js b/components/prism-qml.js index f2ac38e669..e86dcd30e7 100644 --- a/components/prism-qml.js +++ b/components/prism-qml.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" export function loader (Prism, options) { diff --git a/components/prism-qore.js b/components/prism-qore.js index 4d36de9a1c..518ba760b7 100644 --- a/components/prism-qore.js +++ b/components/prism-qore.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-qsharp.js b/components/prism-qsharp.js index e8f08d6153..549e63c61f 100644 --- a/components/prism-qsharp.js +++ b/components/prism-qsharp.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-r.js b/components/prism-r.js index f831a182e4..5fc3f0355c 100644 --- a/components/prism-r.js +++ b/components/prism-r.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['r']) { diff --git a/components/prism-racket.js b/components/prism-racket.js index b2f14f07d0..fd85f5a664 100644 --- a/components/prism-racket.js +++ b/components/prism-racket.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as schemeLoader } from "./prism-scheme.js" export function loader (Prism, options) { diff --git a/components/prism-reason.js b/components/prism-reason.js index caad415e62..bcd77a96dc 100644 --- a/components/prism-reason.js +++ b/components/prism-reason.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-regex.js b/components/prism-regex.js index 419f12b1df..5d07102f30 100644 --- a/components/prism-regex.js +++ b/components/prism-regex.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['regex']) { diff --git a/components/prism-rego.js b/components/prism-rego.js index edf25a97ed..6fa7bfc19a 100644 --- a/components/prism-rego.js +++ b/components/prism-rego.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['rego']) { diff --git a/components/prism-renpy.js b/components/prism-renpy.js index 5df9f4fc09..88f6959826 100644 --- a/components/prism-renpy.js +++ b/components/prism-renpy.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['renpy']) { diff --git a/components/prism-rescript.js b/components/prism-rescript.js index b560936cf1..0d295cd511 100644 --- a/components/prism-rescript.js +++ b/components/prism-rescript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['rescript']) { diff --git a/components/prism-rest.js b/components/prism-rest.js index 9ee9c6ce6d..05b40c8f61 100644 --- a/components/prism-rest.js +++ b/components/prism-rest.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['rest']) { diff --git a/components/prism-rip.js b/components/prism-rip.js index 0c7c1aa41e..395d2059fe 100644 --- a/components/prism-rip.js +++ b/components/prism-rip.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['rip']) { diff --git a/components/prism-roboconf.js b/components/prism-roboconf.js index f8613cc4df..2ab81c6c2f 100644 --- a/components/prism-roboconf.js +++ b/components/prism-roboconf.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['roboconf']) { diff --git a/components/prism-robotframework.js b/components/prism-robotframework.js index b33516abd4..8d89a15b03 100644 --- a/components/prism-robotframework.js +++ b/components/prism-robotframework.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['robotframework']) { diff --git a/components/prism-ruby.js b/components/prism-ruby.js index b7446b222b..211cb120d5 100644 --- a/components/prism-ruby.js +++ b/components/prism-ruby.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-rust.js b/components/prism-rust.js index a71c8e814d..0ff3811e6f 100644 --- a/components/prism-rust.js +++ b/components/prism-rust.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['rust']) { diff --git a/components/prism-sas.js b/components/prism-sas.js index ab8cee1e24..a729615e49 100644 --- a/components/prism-sas.js +++ b/components/prism-sas.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['sas']) { diff --git a/components/prism-sass.js b/components/prism-sass.js index 6fe149d4aa..8e189c7857 100644 --- a/components/prism-sass.js +++ b/components/prism-sass.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cssLoader } from "./prism-css.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-scala.js b/components/prism-scala.js index 35b8802b57..81e45dd4f8 100644 --- a/components/prism-scala.js +++ b/components/prism-scala.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javaLoader } from "./prism-java.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-scheme.js b/components/prism-scheme.js index b91e90035d..9449f11694 100644 --- a/components/prism-scheme.js +++ b/components/prism-scheme.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['scheme']) { diff --git a/components/prism-scss.js b/components/prism-scss.js index 553d2a6d15..44126c54e2 100644 --- a/components/prism-scss.js +++ b/components/prism-scss.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as cssLoader } from "./prism-css.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-shell-session.js b/components/prism-shell-session.js index 9a5f09ae75..11a0c80400 100644 --- a/components/prism-shell-session.js +++ b/components/prism-shell-session.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as bashLoader } from "./prism-bash.js" export function loader (Prism, options) { diff --git a/components/prism-smali.js b/components/prism-smali.js index 0c64e03260..e7d79e0be6 100644 --- a/components/prism-smali.js +++ b/components/prism-smali.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['smali']) { diff --git a/components/prism-smalltalk.js b/components/prism-smalltalk.js index db1881fa2d..e2d21e2aaa 100644 --- a/components/prism-smalltalk.js +++ b/components/prism-smalltalk.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['smalltalk']) { diff --git a/components/prism-smarty.js b/components/prism-smarty.js index 1b0908b353..0a3d74e2d8 100644 --- a/components/prism-smarty.js +++ b/components/prism-smarty.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-sml.js b/components/prism-sml.js index 34512894e2..d1dbf04414 100644 --- a/components/prism-sml.js +++ b/components/prism-sml.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['sml']) { diff --git a/components/prism-solidity.js b/components/prism-solidity.js index 4ee9ff35c2..0d98cff834 100644 --- a/components/prism-solidity.js +++ b/components/prism-solidity.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-solution-file.js b/components/prism-solution-file.js index 9298ed13cd..0589a16d0d 100644 --- a/components/prism-solution-file.js +++ b/components/prism-solution-file.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['solution-file']) { diff --git a/components/prism-soy.js b/components/prism-soy.js index cb2b401d3c..b106efcc68 100644 --- a/components/prism-soy.js +++ b/components/prism-soy.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-sparql.js b/components/prism-sparql.js index e6f3f53da3..1e75917742 100644 --- a/components/prism-sparql.js +++ b/components/prism-sparql.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as turtleLoader } from "./prism-turtle.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-splunk-spl.js b/components/prism-splunk-spl.js index 529950bb05..37b6a100db 100644 --- a/components/prism-splunk-spl.js +++ b/components/prism-splunk-spl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['splunk-spl']) { diff --git a/components/prism-sqf.js b/components/prism-sqf.js index f79277bbcf..b34aa185f3 100644 --- a/components/prism-sqf.js +++ b/components/prism-sqf.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-sql.js b/components/prism-sql.js index 3004d7cf7e..9417d0766e 100644 --- a/components/prism-sql.js +++ b/components/prism-sql.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['sql']) { diff --git a/components/prism-squirrel.js b/components/prism-squirrel.js index ef29be5158..922dcd9cd0 100644 --- a/components/prism-squirrel.js +++ b/components/prism-squirrel.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-stan.js b/components/prism-stan.js index df6482165e..f550f378eb 100644 --- a/components/prism-stan.js +++ b/components/prism-stan.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['stan']) { diff --git a/components/prism-stata.js b/components/prism-stata.js index 2eb9055c81..a6ad6ded0c 100644 --- a/components/prism-stata.js +++ b/components/prism-stata.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as pythonLoader } from "./prism-python.js" import { loader as javaLoader } from "./prism-java.js" import { loader as mataLoader } from "./prism-mata.js" diff --git a/components/prism-stylus.js b/components/prism-stylus.js index ddbfa7c984..8e37eded8a 100644 --- a/components/prism-stylus.js +++ b/components/prism-stylus.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['stylus']) { diff --git a/components/prism-supercollider.js b/components/prism-supercollider.js index f3f1dfa5e2..47f57b06b4 100644 --- a/components/prism-supercollider.js +++ b/components/prism-supercollider.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['supercollider']) { diff --git a/components/prism-swift.js b/components/prism-swift.js index 5cc6e02fa4..ccf09278e5 100644 --- a/components/prism-swift.js +++ b/components/prism-swift.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['swift']) { diff --git a/components/prism-systemd.js b/components/prism-systemd.js index b76a3993f6..00d167e7b0 100644 --- a/components/prism-systemd.js +++ b/components/prism-systemd.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['systemd']) { diff --git a/components/prism-t4-cs.js b/components/prism-t4-cs.js index c381521c2b..1fe99f4920 100644 --- a/components/prism-t4-cs.js +++ b/components/prism-t4-cs.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as csharpLoader } from "./prism-csharp.js" import { loader as t4TemplatingLoader } from "./prism-t4-templating.js" diff --git a/components/prism-t4-templating.js b/components/prism-t4-templating.js index 755da35f68..9aa34cc3ce 100644 --- a/components/prism-t4-templating.js +++ b/components/prism-t4-templating.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['t4-templating']) { diff --git a/components/prism-t4-vb.js b/components/prism-t4-vb.js index 6e1a2c3137..8c32410f7f 100644 --- a/components/prism-t4-vb.js +++ b/components/prism-t4-vb.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as vbnetLoader } from "./prism-vbnet.js" import { loader as t4TemplatingLoader } from "./prism-t4-templating.js" diff --git a/components/prism-tap.js b/components/prism-tap.js index be3c39103c..a905e72f96 100644 --- a/components/prism-tap.js +++ b/components/prism-tap.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as yamlLoader } from "./prism-yaml.js" export function loader (Prism, options) { diff --git a/components/prism-tcl.js b/components/prism-tcl.js index 40a60f1b2e..c46aa74d0f 100644 --- a/components/prism-tcl.js +++ b/components/prism-tcl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['tcl']) { diff --git a/components/prism-textile.js b/components/prism-textile.js index 45bf2c5e26..df8253896f 100644 --- a/components/prism-textile.js +++ b/components/prism-textile.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { diff --git a/components/prism-toml.js b/components/prism-toml.js index a2fd1823f7..0924eab223 100644 --- a/components/prism-toml.js +++ b/components/prism-toml.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['toml']) { diff --git a/components/prism-tremor.js b/components/prism-tremor.js index aa122fe565..efe465995a 100644 --- a/components/prism-tremor.js +++ b/components/prism-tremor.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['tremor']) { diff --git a/components/prism-tsx.js b/components/prism-tsx.js index 44fd3de0fa..6ae779130e 100644 --- a/components/prism-tsx.js +++ b/components/prism-tsx.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as jsxLoader } from "./prism-jsx.js" import { loader as typescriptLoader } from "./prism-typescript.js" diff --git a/components/prism-tt2.js b/components/prism-tt2.js index df11b99536..a6283fb889 100644 --- a/components/prism-tt2.js +++ b/components/prism-tt2.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" diff --git a/components/prism-turtle.js b/components/prism-turtle.js index 686a730164..6cb9291907 100644 --- a/components/prism-turtle.js +++ b/components/prism-turtle.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['turtle']) { diff --git a/components/prism-twig.js b/components/prism-twig.js index 025aa6d021..75909c0bd4 100644 --- a/components/prism-twig.js +++ b/components/prism-twig.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupTemplatingLoader } from "./prism-markup-templating.js" export function loader (Prism, options) { diff --git a/components/prism-typescript.js b/components/prism-typescript.js index 46374b6fad..45c0fcd58d 100644 --- a/components/prism-typescript.js +++ b/components/prism-typescript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as javascriptLoader } from "./prism-javascript.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-typoscript.js b/components/prism-typoscript.js index 05d88b49e7..2eace991ae 100644 --- a/components/prism-typoscript.js +++ b/components/prism-typoscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['typoscript']) { diff --git a/components/prism-unrealscript.js b/components/prism-unrealscript.js index 91576d4e3d..6028c5fc5e 100644 --- a/components/prism-unrealscript.js +++ b/components/prism-unrealscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['unrealscript']) { diff --git a/components/prism-uorazor.js b/components/prism-uorazor.js index ac3992ba6e..dda946d5d0 100644 --- a/components/prism-uorazor.js +++ b/components/prism-uorazor.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['uorazor']) { diff --git a/components/prism-uri.js b/components/prism-uri.js index 4eb6deb8b0..344deeae10 100644 --- a/components/prism-uri.js +++ b/components/prism-uri.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['uri']) { diff --git a/components/prism-v.js b/components/prism-v.js index 461cd40a9d..d3de949495 100644 --- a/components/prism-v.js +++ b/components/prism-v.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-vala.js b/components/prism-vala.js index 0db1a52722..09ded696c2 100644 --- a/components/prism-vala.js +++ b/components/prism-vala.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as clikeLoader } from "./prism-clike.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-vbnet.js b/components/prism-vbnet.js index 4b4e35fc1f..7de702ac38 100644 --- a/components/prism-vbnet.js +++ b/components/prism-vbnet.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as basicLoader } from "./prism-basic.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-velocity.js b/components/prism-velocity.js index 203617e703..86d9f92bf9 100644 --- a/components/prism-velocity.js +++ b/components/prism-velocity.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { diff --git a/components/prism-verilog.js b/components/prism-verilog.js index e7c4aa648e..6b963977e2 100644 --- a/components/prism-verilog.js +++ b/components/prism-verilog.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['verilog']) { diff --git a/components/prism-vhdl.js b/components/prism-vhdl.js index 6b9dc5203e..2213e6d3c5 100644 --- a/components/prism-vhdl.js +++ b/components/prism-vhdl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['vhdl']) { diff --git a/components/prism-vim.js b/components/prism-vim.js index 9cd0e4d6e7..298cfc9338 100644 --- a/components/prism-vim.js +++ b/components/prism-vim.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['vim']) { diff --git a/components/prism-visual-basic.js b/components/prism-visual-basic.js index 09e23a765c..c98d6746c9 100644 --- a/components/prism-visual-basic.js +++ b/components/prism-visual-basic.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['visual-basic']) { diff --git a/components/prism-warpscript.js b/components/prism-warpscript.js index 19425f220e..84b38926da 100644 --- a/components/prism-warpscript.js +++ b/components/prism-warpscript.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['warpscript']) { diff --git a/components/prism-wasm.js b/components/prism-wasm.js index b7f83fa1b6..11cb5a8410 100644 --- a/components/prism-wasm.js +++ b/components/prism-wasm.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['wasm']) { diff --git a/components/prism-web-idl.js b/components/prism-web-idl.js index 90c3134826..f1119aba58 100644 --- a/components/prism-web-idl.js +++ b/components/prism-web-idl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['web-idl']) { diff --git a/components/prism-wgsl.js b/components/prism-wgsl.js index 8a28a0e9dc..50b13fee6d 100644 --- a/components/prism-wgsl.js +++ b/components/prism-wgsl.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['wgsl']) { diff --git a/components/prism-wiki.js b/components/prism-wiki.js index 555a87d8be..ad677c06db 100644 --- a/components/prism-wiki.js +++ b/components/prism-wiki.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { diff --git a/components/prism-wolfram.js b/components/prism-wolfram.js index 556ff784bd..a9383344ae 100644 --- a/components/prism-wolfram.js +++ b/components/prism-wolfram.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['wolfram']) { diff --git a/components/prism-wren.js b/components/prism-wren.js index ac7cf1b3df..f8826c77ff 100644 --- a/components/prism-wren.js +++ b/components/prism-wren.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['wren']) { diff --git a/components/prism-xeora.js b/components/prism-xeora.js index 29cd907ab1..f046c9f3f4 100644 --- a/components/prism-xeora.js +++ b/components/prism-xeora.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-xml-doc.js b/components/prism-xml-doc.js index ce5a4cae0a..a7bdc22420 100644 --- a/components/prism-xml-doc.js +++ b/components/prism-xml-doc.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { diff --git a/components/prism-xojo.js b/components/prism-xojo.js index 8ea96cc21b..cc3a7ce4b9 100644 --- a/components/prism-xojo.js +++ b/components/prism-xojo.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['xojo']) { diff --git a/components/prism-xquery.js b/components/prism-xquery.js index 439f36b7de..dc22ac50d9 100644 --- a/components/prism-xquery.js +++ b/components/prism-xquery.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ import { loader as markupLoader } from "./prism-markup.js" export function loader (Prism, options) { if (typeof Prism === 'undefined') return diff --git a/components/prism-yaml.js b/components/prism-yaml.js index a9ef677f64..7828eed775 100644 --- a/components/prism-yaml.js +++ b/components/prism-yaml.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['yaml']) { diff --git a/components/prism-yang.js b/components/prism-yang.js index b388585f85..4b04503ed9 100644 --- a/components/prism-yang.js +++ b/components/prism-yang.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['yang']) { diff --git a/components/prism-zig.js b/components/prism-zig.js index fd6f5bce12..877e96acbc 100644 --- a/components/prism-zig.js +++ b/components/prism-zig.js @@ -1,3 +1,7 @@ +/** +* @param {import("../prism.js").Prism} Prism +* @param {import("../prism.js").LoaderOptions} [options] +*/ export function loader (Prism, options) { if (typeof Prism === 'undefined') return if (options?.force !== true && Prism.languages['zig']) { diff --git a/package.json b/package.json index fb83aa3870..789113677f 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,21 @@ }, "files": [ "components/**/*.js", - "plugins/**/*", + "components/**/*.d.ts", + "plugins/**/*.js", + "plugins/**/*.d.ts", "themes/*.css", "prism.js", - "prism-core.js" + "prism.d.ts", + "prism-core.js", + "prism-core.d.ts" ], "scripts": { "benchmark": "node benchmark/benchmark.js", "build": "gulp", + "clean": "rimraf prism-core.d.ts && rimraf prism.d.ts && rimraf -g \"./components/**/*.d.ts\"", + "build:types": "npm run clean && tsc", + "prepublishOnly": "npm run build:types", "start": "http-server -c-1", "lint": "eslint . --cache", "lint:fix": "npm run lint -- --fix", @@ -87,12 +94,16 @@ "registry": "jspm", "jspmPackage": true, "format": "esm", - "files": [ - "components/**/*.js", - "plugins/**/*", - "themes/*.css", - "prism.js", - "prism-core.js" - ] + "files": [ + "components/**/*.js", + "components/**/*.d.ts", + "plugins/**/*.js", + "plugins/**/*.d.ts", + "themes/*.css", + "prism.js", + "prism.d.ts", + "prism-core.js", + "prism-core.d.ts" + ] } -} +} \ No newline at end of file diff --git a/plugins/file-highlight/prism-file-highlight.d.ts b/plugins/file-highlight/prism-file-highlight.d.ts new file mode 100644 index 0000000000..66da326b35 --- /dev/null +++ b/plugins/file-highlight/prism-file-highlight.d.ts @@ -0,0 +1 @@ +export function Plugin(Prism: any): void; diff --git a/prism-core.js b/prism-core.js index 896d6d5bb3..6e4fc2e7b5 100644 --- a/prism-core.js +++ b/prism-core.js @@ -81,6 +81,7 @@ export class Prism { /** * This namespace contains all currently loaded languages and the some helper functions to create and modify languages. + * @type {{[key: string]: any}} */ this.languages = { /** @@ -351,6 +352,19 @@ export class Prism { } } + + // Get current script and highlight + const script = this.util.currentScript(); + + if (script) { + this.filename = script.src; + + if (script.hasAttribute('data-manual')) { + _.manual = true; + } + } + + if (!_.manual) { // If the document state is "loading", then we'll use DOMContentLoaded. // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the @@ -504,7 +518,7 @@ export class Prism { } if (async && _self.Worker) { - var worker = new Worker(_.filename); + var worker = new Worker(this.filename); worker.onmessage = function (evt) { insertHighlightedCode(evt.data); @@ -664,7 +678,7 @@ export class Token { if (Array.isArray(o)) { var s = ''; o.forEach(function (e) { - s += _.stringify(e, language, prism); + s += _.stringify(/** @type {string} */ (e), language, prism); }); return s; } @@ -717,16 +731,17 @@ class Util { constructor (prism) { this.prism = prism } + /** - * @template {Token | Token[] | string} T - * @param {T} tokens - * @return {T} + * @param {Token | Token[] | string} tokens + * @return {Token | Token[] | string} */ encode = (tokens) => { if (tokens instanceof Token) { - return new Token(tokens.type, this.encode(tokens.content), tokens.alias, this.prism); + const content = /** @type {string} */ (tokens.content) + return new Token(tokens.type, /** @type {string} */ (this.encode(content)), tokens.alias); } else if (Array.isArray(tokens)) { - return tokens.map(this.encode); + return tokens.map((token) => /** @type {Token} */ (this.encode(token))); } else { return tokens.replace(/&/g, '&').replace(/} [visited] * @returns {T} - * @template T */ - clone (o, visited) { + clone (o) { return structuredClone(o) - visited = visited || {}; - - let cloned - let id; - switch (this.type(o)) { - case 'Object': - id = this.objId(o); - if (visited[id]) { - return visited[id]; - } - cloned = /** @type {Record} */ ({}); - - visited[id] = cloned; - - for (var key in o) { - if (o.hasOwnProperty(key)) { - cloned[key] = this.clone(o[key], visited); - } - } - - return /** @type {any} */ (cloned); - - case 'Array': - id = this.objId(o); - if (visited[id]) { - return visited[id]; - } - cloned = []; - visited[id] = cloned; - - (/** @type {Array} */(/** @type {any} */(o))).forEach((v, i) => { - cloned[i] = this.clone(v, visited); - }); - - return /** @type {any} */ (cloned); - - default: - return o; - } } /** @@ -888,6 +863,48 @@ class Util { } return !!defaultActivation; } + + /** + * Returns the script element that is currently executing. + * + * This does __not__ work for line script element. + * + * @returns {HTMLScriptElement | null} + */ + currentScript () { + if (typeof document === 'undefined') { + return null; + } + if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) { + return /** @type {any} */ (document.currentScript); + } + + // IE11 workaround + // we'll get the src of the current script by parsing IE11's error stack trace + // this will not work for inline scripts + + try { + throw new Error(); + } catch (err) { + // Get file src url from stack. Specifically works with the format of stack traces in IE. + // A stack will look like this: + // + // Error + // at _.util.currentScript (http://localhost/components/prism-core.js:119:5) + // at Global code (http://localhost/components/prism-core.js:606:1) + + var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1]; + if (src) { + var scripts = document.getElementsByTagName('script'); + for (var i in scripts) { + if (scripts[i].src == src) { + return scripts[i]; + } + } + } + return null; + } + } } /** @@ -898,11 +915,6 @@ class Util { * @returns {RegExpExecArray | null} */ function matchPattern(pattern, pos, text, lookbehind) { - // TODO: this shouldn't be here, but fixes an issue with HTTP identifiers. - if (pattern === true) { - return null - } - pattern.lastIndex = pos; var match = pattern.exec(text); if (match && lookbehind && match[1]) { @@ -1077,13 +1089,13 @@ function matchGrammar(text, tokenList, grammar, startNode, startPos, prismInstan } /** - * @typedef LinkedListNode - * @property {T} value - * @property {LinkedListNode | null} prev The previous node. - * @property {LinkedListNode | null} next The next node. - * @template T - * @private - */ + * @template T + * @typedef LinkedListNode + * @property {T} value + * @property {LinkedListNode | null} prev The previous node. + * @property {LinkedListNode | null} next The next node. + * @private + */ /** * @template T @@ -1181,7 +1193,6 @@ function toArray(list) { * * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into * each another. - * @global * @public */ @@ -1189,7 +1200,6 @@ function toArray(list) { * @typedef Grammar * @type {Object>} * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar. - * @global * @public */ @@ -1199,7 +1209,6 @@ function toArray(list) { * @callback HighlightCallback * @param {Element} element The element successfully highlighted. * @returns {void} - * @global * @public */ @@ -1207,6 +1216,21 @@ function toArray(list) { * @callback HookCallback * @param {Object} env The environment variables of the hook. * @returns {void} - * @global * @public + */ + +/** + * Options for loading grammars in "./components/*.js" + * @typedef {object} LoaderOptions + * @property {boolean} [force] + */ + +/** + * @typedef {object} TokenStreamItem + * @property {string} type + * @property {string | Array} content + */ + +/** + * @typedef {Array} TokenStream */ \ No newline at end of file diff --git a/prism.js b/prism.js index 0ef301a9f9..e05e6aa6c3 100644 --- a/prism.js +++ b/prism.js @@ -1,11 +1,31 @@ -import { Prism as OGPrism, Token } from "./prism-core.js" +import { Prism as OGPrism } from "./prism-core.js" import { loader as markupLoader } from "./components/prism-markup.js" import { loader as cssLoader } from "./components/prism-css.js" import { loader as clikeLoader } from "./components/prism-clike.js" import { loader as javascriptLoader } from "./components/prism-javascript.js" import { Plugin as FileHighlightPlugin } from "./plugins/file-highlight/prism-file-highlight.js" +export { + environment, + Token, +} from "./prism-core.js" -class Prism extends OGPrism { +/** + * @typedef {import("./prism-core.js").GrammarToken} GrammarToken + * @typedef {import("./prism-core.js").Grammar} Grammar + * @typedef {import("./prism-core.js").TokenStream} TokenStream + * @typedef {import("./prism-core.js").HookCallback} HookCallback + * @typedef {import("./prism-core.js").PrismOptions} PrismOptions + * @typedef {import("./prism-core.js").HighlightCallback} HighlightCallback + * @typedef {import("./prism-core.js").LoaderOptions} LoaderOptions + */ + +/** + * The main entrypoint class + */ +export class Prism extends OGPrism { + /** + * @param {ConstructorParameters} args + */ constructor (...args) { super(...args) @@ -17,5 +37,3 @@ class Prism extends OGPrism { FileHighlightPlugin(this) } } - -export { Prism, Token } \ No newline at end of file diff --git a/tests/helper/token-stream-transformer.d.ts b/tests/helper/token-stream-transformer.d.ts new file mode 100644 index 0000000000..3999b07714 --- /dev/null +++ b/tests/helper/token-stream-transformer.d.ts @@ -0,0 +1,17 @@ +/** + * Simplifies the token stream to ease the matching with the expected token stream. + * + * * Strings are kept as-is + * * In arrays each value is transformed individually + * * Values that are empty (empty arrays or strings only containing whitespace) + * + * @param {TokenStream} tokenStream + * @returns {SimplifiedTokenStream} + */ +export function simplify(tokenStream: TokenStream): SimplifiedTokenStream; +/** + * @param {TokenStream} tokenStream + * @param {string} [indentation] + * @returns {string} + */ +export function prettyprint(tokenStream: TokenStream, indentation?: string): string; diff --git a/tests/helper/token-stream-transformer.js b/tests/helper/token-stream-transformer.js index c0919112a5..14e155d88a 100644 --- a/tests/helper/token-stream-transformer.js +++ b/tests/helper/token-stream-transformer.js @@ -1,9 +1,5 @@ +// @ts-check /** - * @typedef TokenStreamItem - * @property {string} type - * @property {string | Array} content - * - * @typedef {Array} TokenStream * * @typedef {Array} SimplifiedTokenStream * @@ -11,6 +7,10 @@ * @typedef {string | LineBreakItem | GlueItem | [string, string | Array]} PrettyTokenStreamItem */ +/** + * @typedef {import("../../prism-core.js").TokenStream} TokenStream + * @typedef {import("../../prism-core.js").TokenStreamItem} TokenStreamItem + */ /** * Simplifies the token stream to ease the matching with the expected token stream. @@ -53,25 +53,6 @@ export function prettyprint(tokenStream, indentation) { return printPrettyTokenStream(toPrettyTokenStream(tokenStream), undefined, indentation); } -/** - * This item indicates that one or multiple line breaks are present between the preceding and following items in the - * source token stream. - * - * Only if an item is enabled will it appear in the pretty-printed token stream. - */ -class LineBreakItem { - /** @param {number} sourceCount */ - constructor(sourceCount) { - this.sourceCount = sourceCount; - this.enabled = false; - } -} -/** - * This item indicates the the preceding and following items are to be printed on the same line in the pretty-printed - * token stream. - */ -class GlueItem { } - /** * @param {TokenStream} tokenStream * @param {number} [level] @@ -479,4 +460,23 @@ function isNested(item) { */ function isTriviallyNested(item) { return isNested(item) && item[1].length === 1 && typeof item[1][0] === 'string'; -} \ No newline at end of file +} + +/** + * This item indicates that one or multiple line breaks are present between the preceding and following items in the + * source token stream. + * + * Only if an item is enabled will it appear in the pretty-printed token stream. + */ +class LineBreakItem { + /** @param {number} sourceCount */ + constructor(sourceCount) { + this.sourceCount = sourceCount; + this.enabled = false; + } +} +/** + * This item indicates the the preceding and following items are to be printed on the same line in the pretty-printed + * token stream. + */ +class GlueItem { } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..06ae6c905d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "include": [ + "prism-core.js", + "components/**/*.js", + "prism.js" + ], + "compilerOptions": { + "strict": false, + "target": "ESNext", + "allowSyntheticDefaultImports": true, + "moduleResolution": "NodeNext", + "module": "NodeNext", + "lib": ["ESNext", "DOM", "WebWorker"], + "declaration": true, + "emitDeclarationOnly": true, + "allowJs": true, + "checkJs": true, + "verbatimModuleSyntax": true, + "skipLibCheck": true + } +} \ No newline at end of file