{"version":3,"file":"shiki-twoslash.cjs.development.js","sources":["../src/annotations.ts","../src/utils.ts","../src/renderers/plain.ts","../src/renderers/twoslash.ts","../src/renderers/shiki.ts","../src/tsconfig-oneliners.generated.ts","../src/renderers/tsconfig.ts","../src/index.ts"],"sourcesContent":["import { TwoslashError, TwoSlashReturn } from \"@typescript/twoslash\"\n\nexport const htmlForTags = (tags: TwoSlashReturn[\"tags\"]) => {\n let html = \"\"\n tags.forEach(t => {\n if (t.name === \"annotate\" && t.annotation) {\n const meta = t.annotation.split(\" - \")\n const text = meta.pop()\n const info = (meta[0] || \"\").trim()\n const flipped = info.includes(\"right\")\n let settings = {\n flipped,\n arrowRot: flipped ? \"90deg 20px 20px\" : \"90deg 20px 20px\",\n textDegree: \"0deg\",\n top: `${t.line}em`\n }\n \n \n if (info.includes(\"{\")) {\n const theInfo = \"{\" + info.split(\"{\")[1]\n try {\n const specificSettings = JSON.parse(theInfo)\n settings = {...settings, ...specificSettings }\n } catch (error) {\n throw new TwoslashError(\"Could not parse annotation\", `The annotation ${JSON.stringify(t)} could convert '${theInfo}' into JSON`, `Look at ${(error as any).message}.`)\n }\n }\n \n const arrowSVG = arrow(settings)\n\n html += `\n
\n ${arrowSVG}\n

${text}

\n
`\n }\n })\n\n return html\n}\n\nconst arrow = (style: { flipped: boolean; arrowRot: string, textDegree: string, top: string }) => {\n const leftInner = `M27 39C26.5 32.7511 21.9 17.5173 7.5 6.57333M16.5 4.04L0.999999 0.999998C3.16667 4.88444 7.5 13.16 7.5 15.1867`\n const rightInner = `M1 39C1.5 32.7511 6.1 17.5173 20.5 6.57333M11.5 4.04L27 0.999998C24.8333 4.88444 20.5 13.16 20.5 15.1867`\n const inner = style.flipped ? leftInner : rightInner\n const rot = style.arrowRot.split(\" \")\n return `\n \n`\n}\n","import type { parse } from \"fenceparser\"\n\nexport type Meta = NonNullable>\n\ntype Range = {\n begin: number\n end: number\n text?: string\n count?: number\n tooltip?: string[]\n classes?: string\n lsp?: string\n}\n\n/**\n * We're given the text which lives inside the token, and this function will\n * annotate it with twoslash metadata\n */\nexport function createHighlightedString(ranges: Range[], text: string, targetedWord: string = \"\") {\n // Why the weird chars? We need to make sure that generic syntax isn't\n // interpreted as html tags - to do that we need to switch out < to < - *but*\n // making that transition changes the indexes because it's gone from 1 char to 4 chars\n //\n // So, use an obscure character to indicate a real < for HTML, then switch it after\n const tag = (x: string) => `⇍${x}⇏`\n const makeTagFromRange = (r: Range, close?: true) => {\n switch (r.classes) {\n case \"lsp\":\n // The LSP response lives inside a dom attribute, which _can_ have < inside it, so switch them ahead of time.\n const lsp = htmlAttrReplacer(r.lsp || \"\")\n const underLineTargetedWord = r.lsp === targetedWord ? \"style=⇯border-bottom: solid 2px lightgrey;⇯\" : \"\"\n return close ? tag(\"/data-lsp\") : tag(`data-lsp lsp=¿${lsp}¿ ${underLineTargetedWord}`)\n case \"query\":\n return tag(`${close ? \"/\" : \"\"}data-highlight`)\n // handle both unknown and err variant as error-tag\n // case \"err\": is not required, just to be useful for others\n case \"err\":\n default:\n return tag(`${close ? \"/\" : \"\"}data-err`)\n }\n }\n\n ranges.sort((a, b) => {\n // Order of precedence\n // if two same offset meet, the lsp will be put as innermost than err and query\n const precedenceOf = (x?: string) => [\"err\", \"query\", \"lsp\"].indexOf(x ?? \"\")\n\n let cmp = 0\n // Can be desugared into,\n // 1. compare based on smaller begin, !(cmp) means if it's 0 then\n // 2. compare based on bigger end, ^ same thing again then\n // 3. compare based on higher precedence\n // && is so that if a step made cmp to something other than 0, it stops\n /***1*/ !(cmp = a.begin - b.begin) &&\n /*2*/ !(cmp = b.end - a.end) &&\n /*3*/ !(cmp = precedenceOf(a.classes) - precedenceOf(b.classes))\n return cmp\n }) // `Array.sort` works in place\n\n // Marks how much of the text has been put into the output/html\n let cursor = 0\n // should be maximum of O(n) where n is length of ranges\n const nest = (data: typeof ranges) => {\n let stack = \"\"\n const top = data.shift()! // I have made sure data can't be empty\n\n // parse from cursor to top.begin to make sure\n // strings on the way are parsed\n stack += text.substring(cursor, top.begin)\n cursor = top.begin\n\n // open tag\n stack += makeTagFromRange(top)\n\n // if the data still have an element that's in the top's range\n if (data.some(x => x.begin < top.end)) {\n stack += nest(data)\n } else {\n // othewise slice the text and set cursor\n stack += text.substring(top.begin, top.end)\n cursor = top.end\n }\n\n // close tag\n stack += makeTagFromRange(top, true)\n\n // if the tag is complete but still have some data left in the range\n if (data.length !== 0) {\n stack += nest(data)\n }\n\n return stack\n }\n\n // cloned because I don't feel comfortable modifying this as a side-effect from recursion\n const data = JSON.parse(JSON.stringify(ranges))\n const html = nest(data) + text.substring(cursor) // nested + leftover texts\n\n return htmlAttrUnReplacer(replaceTripleArrow(stripHTML(html)))\n}\n\n// HTML attributes have different rules,\nconst htmlAttrReplacer = (str: string) => str.replace(/\"/g, \"⃟\")\nconst htmlAttrUnReplacer = (str: string) => str.replace(/⃟/g, '\"')\n\n// Inline strings which are shown at HTML level\nexport const subTripleArrow = (str: string) => str.replace(//g, \"⇏\").replace(/'/g, \"⇯\")\nexport const replaceTripleArrow = (str: string) =>\n str.replace(/⇍/g, \"<\").replace(/⇏/g, \">\").replace(/⇯/g, \"'\").replace(/¿/g, \"'\")\nexport const replaceTripleArrowEncoded = (str: string) =>\n str.replace(/⇍/g, \"<\").replace(/⇏/g, \">\").replace(/⇯/g, \"'\")\n\nexport function stripHTML(text: string) {\n var table: any = {\n \"<\": \"lt\",\n '\"': \"quot\",\n \"'\": \"apos\",\n \"&\": \"amp\",\n \"\\r\": \"#13\",\n \"\\n\": \"#10\",\n }\n\n return text.toString().replace(/[<\"'\\r\\n&]/g, function (chr) {\n return \"&\" + table[chr] + \";\"\n })\n}\n\nexport function escapeHtml(html: string) {\n return html.replace(//g, \">\")\n}\n\n/** Does anything in the object imply that we should highlight any lines? */\nexport const shouldBeHighlightable = (highlight: any) => {\n return !!Object.keys(highlight || {}).find(key => {\n if (key.includes(\"-\")) return true\n if (!isNaN(parseInt(key))) return true\n return false\n })\n}\n\n/** Returns a func for figuring out if this line should be highlighted */\nexport const shouldHighlightLine = (highlight: any) => {\n const lines: number[] = []\n Object.keys(highlight || {}).find(key => {\n if (!isNaN(parseInt(key))) lines.push(parseInt(key))\n if (key.includes(\"-\")) {\n const [first, last] = key.split(\"-\")\n const lastIndex = parseInt(last) + 1\n for (let i = parseInt(first); i < lastIndex; i++) {\n lines.push(i)\n }\n }\n })\n\n return (line: number) => lines.includes(line)\n}\n","import { escapeHtml, Meta } from \"../utils\"\n\n// C&P'd from shiki\nexport interface HtmlRendererOptions {\n langId?: string\n fg?: string\n bg?: string\n themeName?: string\n}\n\n/** A func for setting a consistent
 */\nexport const preOpenerFromRenderingOptsWithExtras = (opts: HtmlRendererOptions, meta: Meta, classes?: string[]) => {\n  const bg = opts.bg || \"#fff\"\n  const fg = opts.fg || \"black\"\n  const theme = opts.themeName || \"\"\n\n  // shiki + `class` from fence + with-title if title exists + classes\n  const classList = [\"shiki\", theme, meta.class, meta.title ? \"with-title\" : \"\", ...(classes || [])]\n    .filter(Boolean)\n    .join(\" \")\n    .trim()\n\n  const attributes = Object.entries(meta)\n    .filter(entry => {\n      // exclude types other than string, number, boolean\n      // exclude keys class, twoslash\n      // exclude falsy booleans\n      return (\n        [\"string\", \"number\", \"boolean\"].includes(typeof entry[1]) &&\n        ![\"class\", \"twoslash\"].includes(entry[0]) &&\n        entry[1] !== false\n      )\n    })\n    .map(([key, value]) => `${key}=\"${value}\"`)\n    .join(\" \")\n    .trim()\n\n  // prettier-ignore\n  return `
`\n}\n\n/** You don't have a language which shiki twoslash can handle, make a DOM compatible version  */\nexport function plainTextRenderer(code: string, options: HtmlRendererOptions, meta: Meta) {\n  let html = \"\"\n\n  html += preOpenerFromRenderingOptsWithExtras(options, meta, [])\n  if (meta.title) {\n    html += `
${meta.title}
`\n }\n\n if (options.langId) {\n html += `
${options.langId}
`\n }\n\n html += `
`\n html += escapeHtml(code)\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
`\n return html\n}\n","type Lines = import(\"shiki\").IThemedToken[][]\ntype TwoSlash = import(\"@typescript/twoslash\").TwoSlashReturn\n\nimport { TwoslashShikiOptions } from \"..\"\nimport { htmlForTags } from \"../annotations\"\nimport {\n shouldBeHighlightable,\n shouldHighlightLine,\n createHighlightedString,\n subTripleArrow,\n replaceTripleArrowEncoded,\n escapeHtml,\n Meta,\n} from \"../utils\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\n// OK, so - this is just straight up complex code.\n\n// What we're trying to do is merge two sets of information into a single tree for HTML\n\n// 1: Syntax highlight info from shiki\n// 2: Twoslash metadata like errors, identifiers etc\n\n// Because shiki gives use a set of lines to work from, then the first thing which happens\n// is converting twoslash data into the same format.\n\n// Things which make it hard:\n//\n// - Twoslash results can be cut, so sometimes there is edge cases between twoslash results\n// - Twoslash results can be multi-file\n// - the DOM requires a flattened graph of html elements (e.g. spans can' be interspersed)\n//\n\nexport function twoslashRenderer(lines: Lines, options: HtmlRendererOptions & TwoslashShikiOptions, twoslash: TwoSlash, meta: Meta) {\n let html = \"\"\n\n const hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight)\n const hl = shouldHighlightLine(meta.highlight)\n\n if (twoslash.tags && twoslash.tags.length) html += \"
\"\n \n html += preOpenerFromRenderingOptsWithExtras(options, meta, [\"twoslash\", \"lsp\"])\n if (meta.title) {\n html += `
${meta.title}
`\n }\n\n if (options.langId) {\n html += `
${options.langId}
`\n }\n\n html += `
`\n\n const errorsGroupedByLine = groupBy(twoslash.errors, e => e.line) || new Map()\n const staticQuickInfosGroupedByLine = groupBy(twoslash.staticQuickInfos, q => q.line) || new Map()\n // A query is always about the line above it!\n const queriesGroupedByLine = groupBy(twoslash.queries, q => q.line - 1) || new Map()\n const tagsGroupedByLine = groupBy(twoslash.tags, q => q.line - 1) || new Map()\n\n /**\n * This is the index of the original twoslash code reference, it is not\n * related to the HTML output\n */\n let filePos = 0\n\n lines.forEach((l, i) => {\n const errors = errorsGroupedByLine.get(i) || []\n const lspValues = staticQuickInfosGroupedByLine.get(i) || []\n const queries = queriesGroupedByLine.get(i) || []\n const tags = tagsGroupedByLine.get(i) || []\n\n const hiClass = hasHighlight ? (hl(i + 1) ? \" highlight\" : \" dim\") : \"\"\n const prefix = `
`\n\n if (l.length === 0 && i === 0) {\n // Skip the first newline if it's blank\n filePos += 1\n } else if (l.length === 0) {\n const emptyLine = `${prefix} 
` \n html += emptyLine\n filePos += 1\n } else {\n html += prefix\n\n // Keep track of the position of the current token in a line so we can match it up to the\n // errors and lang serv identifiers\n let tokenPos = 0\n\n l.forEach(token => {\n let targetedQueryWord: typeof twoslash.staticQuickInfos[number] | undefined\n\n let tokenContent = \"\"\n // Underlining particular words\n const findTokenFunc = (start: number) => (e: any) =>\n start <= e.character && start + token.content.length >= e.character + e.length\n\n const findTokenDebug = (start: number) => (e: any) => {\n const result = start <= e.character && start + token.content.length >= e.character + e.length\n // prettier-ignore\n console.log(result, start, '<=', e.character, '&&', start + token.content.length, '>=', e.character + e.length)\n if (result) {\n console.log(\"Found:\", e)\n console.log(\"Inside:\", token)\n }\n return result\n }\n\n const errorsInToken = errors.filter(findTokenFunc(tokenPos))\n const lspResponsesInToken = lspValues.filter(findTokenFunc(tokenPos))\n const queriesInToken = queries.filter(findTokenFunc(tokenPos))\n\n // Does this line have a word targeted by a query?\n targetedQueryWord = targetedQueryWord || lspResponsesInToken.find(response => response.text === (queries.length && queries[0].text))!\n\n const allTokens = [...errorsInToken, ...lspResponsesInToken, ...queriesInToken]\n const allTokensByStart = allTokens.sort((l, r) => {\n return (l.start || 0) - (r.start || 0)\n })\n\n if (allTokensByStart.length) {\n const ranges = allTokensByStart.map(token => {\n const range: any = {\n begin: token.start! - filePos,\n end: token.start! + token.length! - filePos,\n }\n\n // prettier-ignore\n if (range.begin < 0 || range.end < 0) {\n // prettier-ignore\n // throw new Error(`The begin range of a token is at a minus location, filePos:${filePos} current token: ${JSON.stringify(token, null, ' ')}\\n result: ${JSON.stringify(range, null, ' ')}`)\n }\n\n if (\"renderedMessage\" in token) range.classes = \"err\"\n if (\"kind\" in token) range.classes = token.kind\n if (\"targetString\" in token) {\n range.classes = \"lsp\"\n const lspText = options.includeJSDocInHover && token.docs ? `${token.docs}\\n\\n${token.text}` : token.text\n range[\"lsp\"] = lspText\n }\n return range\n })\n\n tokenContent += createHighlightedString(ranges, token.content, targetedQueryWord?.text)\n } else {\n tokenContent += subTripleArrow(token.content)\n }\n\n html += `${tokenContent}`\n tokenPos += token.content.length\n filePos += token.content.length\n })\n\n html += `
`\n // This is the \\n which the
represents\n filePos += 1\n }\n\n // Adding error messages to the line after\n if (errors.length) {\n const messages = errors.map(e => escapeHtml(e.renderedMessage)).join(\"
\")\n const codes = errors.map(e => e.code).join(\"
\")\n html += `${messages}${codes}`\n html += `${messages}`\n }\n\n // Add queries to the next line\n if (queries.length) {\n queries.forEach(query => {\n // This is used to wrap popovers and completions to improve styling options for users.\n html += `
`\n\n switch (query.kind) {\n case \"query\": {\n const queryTextWithPrefix = escapeHtml(query.text!)\n const lspValues = staticQuickInfosGroupedByLine.get(i) || []\n const targetedWord = lspValues.find(response => response.text === (queries.length && queries[0].text))!\n const halfWayAcrossTheTargetedWord = ((targetedWord && targetedWord.character + targetedWord?.length / 2) - 1) || 0\n html +=\n `` +\n \" \".repeat(halfWayAcrossTheTargetedWord) +\n \"\" +\n `
${queryTextWithPrefix}
`\n break\n }\n\n case \"completions\": {\n if (!query.completions) {\n html += `${\"//\" + \"\".padStart(query.offset - 2) + \"^ - No completions found\"}`\n } else {\n const prefixed = query.completions.filter(c => c.name.startsWith(query.completionsPrefix || \"____\"))\n\n const lis = prefixed\n .sort((l, r) => l.name.localeCompare(r.name))\n .map(c => {\n const after = c.name.substr(query.completionsPrefix?.length || 0)\n const name = `${query.completionsPrefix || \"\"}${after}`\n const isDeprecated = c.kindModifiers?.split(\",\").includes(\"deprecated\")\n const liClass = isDeprecated ? \"deprecated\" : \"\"\n return `
  • ${name}
  • `\n })\n .join(\"\")\n html += `${\" \".repeat(query.offset)}`\n }\n }\n }\n html += \"
    \"\n })\n }\n\n // Any tags (currently that's warn/error/log)\n if (tags.length) {\n tags.forEach(tag => {\n if(![\"error\", \"warn\", \"log\"].includes(tag.name)) return\n\n // This is used to wrap popovers and completions to improve styling options for users.\n html += `
    `\n switch(tag.name) {\n case \"error\": html += `${errorSVG}${tag.annotation || \"N/A\"}`; break;\n case \"warn\": html += `${warningSVG}${tag.annotation || \"N/A\"}`; break;\n case \"log\": html += `${logSVG}${tag.annotation || \"N/A\"}`; break;\n }\n html += \"
    \"\n })\n }\n })\n html = replaceTripleArrowEncoded(html.replace(/\\n*$/, \"\")) // Get rid of final new lines\n\n if (options.addTryButton) {\n const playgroundLink = `Try`\n html += `
    ${playgroundLink}`\n } else {\n html += ``\n }\n\n html += `
    `\n\n // Attach annotations which live above of the code\n if (twoslash.tags && twoslash.tags.length) {\n html += htmlForTags(twoslash.tags)\n html += \"\"\n }\n\n return html\n}\n\n/** Returns a map where all the keys are the value in keyGetter */\nfunction groupBy(list: T[], keyGetter: (obj: any) => number) {\n const map = new Map()\n list.forEach(item => {\n const key = keyGetter(item)\n const collection = map.get(key)\n if (!collection) {\n map.set(key, [item])\n } else {\n collection.push(item)\n }\n })\n return map\n}\n\n\nconst errorSVG = ``\nconst warningSVG = ``\nconst logSVG = ``","import { shouldBeHighlightable, shouldHighlightLine, escapeHtml, Meta } from \"../utils\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\ntype Lines = import(\"shiki\").IThemedToken[][]\n\nexport function defaultShikiRenderer(lines: Lines, options: HtmlRendererOptions, meta: Meta) {\n let html = \"\"\n\n const hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight)\n const hl = shouldHighlightLine(meta.highlight)\n\n html += preOpenerFromRenderingOptsWithExtras(options, meta, [])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n lines.forEach((l, i) => {\n if (l.length === 0) {\n html += `
    `\n } else {\n const hiClass = hasHighlight ? (hl(i) ? \" highlight\" : \" dim\") : \"\"\n const prefix = `
    `\n html += prefix\n\n l.forEach(token => {\n html += `${escapeHtml(token.content)}`\n })\n html += `
    `\n }\n })\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","export const tsconfig = {\n compilerOptions: `The set of compiler options for your project`,\n allowJs: `Allow JavaScript files to be a part of your program. Use the \\`checkJS\\` option to get errors from these files.`,\n allowSyntheticDefaultImports: `Allow 'import x from y' when a module doesn't have a default export.`,\n allowUmdGlobalAccess: `Allow accessing UMD globals from modules.`,\n allowUnreachableCode: `Disable error reporting for unreachable code.`,\n allowUnusedLabels: `Disable error reporting for unused labels.`,\n alwaysStrict: `Ensure 'use strict' is always emitted.`,\n assumeChangesOnlyAffectDirectDependencies: `Have recompiles in projects that use [\\`incremental\\`](#incremental) and \\`watch\\` mode assume that changes within a file will only affect files directly depending on it.`,\n baseUrl: `Specify the base directory to resolve non-relative module names.`,\n charset: `No longer supported. In early versions, manually set the text encoding for reading files.`,\n checkJs: `Enable error reporting in type-checked JavaScript files.`,\n clean: `Delete the outputs of all projects.`,\n composite: `Enable constraints that allow a TypeScript project to be used with project references.`,\n declaration: `Generate .d.ts files from TypeScript and JavaScript files in your project.`,\n declarationDir: `Specify the output directory for generated declaration files.`,\n declarationMap: `Create sourcemaps for d.ts files.`,\n diagnostics: `Output compiler performance information after building.`,\n disableFilenameBasedTypeAcquisition: `Disables inference for type acquisition by looking at filenames in a project.`,\n disableReferencedProjectLoad: `Reduce the number of projects loaded automatically by TypeScript.`,\n disableSizeLimit: `Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.`,\n disableSolutionSearching: `Opt a project out of multi-project reference checking when editing.`,\n disableSourceOfProjectReferenceRedirect: `Disable preferring source files instead of declaration files when referencing composite projects.`,\n downlevelIteration: `Emit more compliant, but verbose and less performant JavaScript for iteration.`,\n emitBOM: `Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.`,\n emitDeclarationOnly: `Only output d.ts files and not JavaScript files.`,\n emitDecoratorMetadata: `Emit design-type metadata for decorated declarations in source files.`,\n enable: `Disable the type acquisition for JavaScript projects.`,\n esModuleInterop: `Emit additional JavaScript to ease support for importing CommonJS modules. This enables [\\`allowSyntheticDefaultImports\\`](#allowSyntheticDefaultImports) for type compatibility.`,\n exactOptionalPropertyTypes: `Interpret optional property types as written, rather than adding \\`undefined\\`.`,\n exclude: `Filters results from the [\\`include\\`](#include) option.`,\n excludeDirectories: `Remove a list of directories from the watch process.`,\n excludeFiles: `Remove a list of files from the watch mode's processing.`,\n experimentalDecorators: `Enable experimental support for TC39 stage 2 draft decorators.`,\n explainFiles: `Print files read during the compilation including why it was included.`,\n extendedDiagnostics: `Output more detailed compiler performance information after building.`,\n extends: `Specify one or more path or node module references to base configuration files from which settings are inherited.`,\n fallbackPolling: `Specify what approach the watcher should use if the system runs out of native file watchers.`,\n files: `Include a list of files. This does not support glob patterns, as opposed to [\\`include\\`](#include).`,\n force: `Build all projects, including those that appear to be up to date.`,\n forceConsistentCasingInFileNames: `Ensure that casing is correct in imports.`,\n generateCpuProfile: `Emit a v8 CPU profile of the compiler run for debugging.`,\n importHelpers: `Allow importing helper functions from tslib once per project, instead of including them per-file.`,\n importsNotUsedAsValues: `Specify emit/checking behavior for imports that are only used for types.`,\n include: `Specify a list of glob patterns that match files to be included in compilation.`,\n incremental: `Save .tsbuildinfo files to allow for incremental compilation of projects.`,\n inlineSourceMap: `Include sourcemap files inside the emitted JavaScript.`,\n inlineSources: `Include source code in the sourcemaps inside the emitted JavaScript.`,\n isolatedModules: `Ensure that each file can be safely transpiled without relying on other imports.`,\n jsx: `Specify what JSX code is generated.`,\n jsxFactory: `Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'.`,\n jsxFragmentFactory: `Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.`,\n jsxImportSource: `Specify module specifier used to import the JSX factory functions when using \\`jsx: react-jsx*\\`.`,\n keyofStringsOnly: `Make keyof only return strings instead of string, numbers or symbols. Legacy option.`,\n lib: `Specify a set of bundled library declaration files that describe the target runtime environment.`,\n listEmittedFiles: `Print the names of emitted files after a compilation.`,\n listFiles: `Print all of the files read during the compilation.`,\n locale: `Set the language of the messaging from TypeScript. This does not affect emit.`,\n mapRoot: `Specify the location where debugger should locate map files instead of generated locations.`,\n maxNodeModuleJsDepth: `Specify the maximum folder depth used for checking JavaScript files from \\`node_modules\\`. Only applicable with [\\`allowJs\\`](#allowJs).`,\n module: `Specify what module code is generated.`,\n moduleDetection: `Control what method is used to detect the whether a JS file is a module.`,\n moduleResolution: `Specify how TypeScript looks up a file from a given module specifier.`,\n moduleSuffixes: `List of file name suffixes to search when resolving a module.`,\n newLine: `Set the newline character for emitting files.`,\n noEmit: `Disable emitting files from a compilation.`,\n noEmitHelpers: `Disable generating custom helper functions like \\`__extends\\` in compiled output.`,\n noEmitOnError: `Disable emitting files if any type checking errors are reported.`,\n noErrorTruncation: `Disable truncating types in error messages.`,\n noFallthroughCasesInSwitch: `Enable error reporting for fallthrough cases in switch statements.`,\n noImplicitAny: `Enable error reporting for expressions and declarations with an implied \\`any\\` type.`,\n noImplicitOverride: `Ensure overriding members in derived classes are marked with an override modifier.`,\n noImplicitReturns: `Enable error reporting for codepaths that do not explicitly return in a function.`,\n noImplicitThis: `Enable error reporting when \\`this\\` is given the type \\`any\\`.`,\n noImplicitUseStrict: `Disable adding 'use strict' directives in emitted JavaScript files.`,\n noLib: `Disable including any library files, including the default lib.d.ts.`,\n noPropertyAccessFromIndexSignature: `Enforces using indexed accessors for keys declared using an indexed type.`,\n noResolve: `Disallow \\`import\\`s, \\`require\\`s or \\`\\`s from expanding the number of files TypeScript should add to a project.`,\n noStrictGenericChecks: `Disable strict checking of generic signatures in function types.`,\n noUncheckedIndexedAccess: `Add \\`undefined\\` to a type when accessed using an index.`,\n noUnusedLocals: `Enable error reporting when local variables aren't read.`,\n noUnusedParameters: `Raise an error when a function parameter isn't read.`,\n out: `Deprecated setting. Use [\\`outFile\\`](#outFile) instead.`,\n outDir: `Specify an output folder for all emitted files.`,\n outFile: `Specify a file that bundles all outputs into one JavaScript file. If [\\`declaration\\`](#declaration) is true, also designates a file that bundles all .d.ts output.`,\n paths: `Specify a set of entries that re-map imports to additional lookup locations.`,\n plugins: `Specify a list of language service plugins to include.`,\n preserveConstEnums: `Disable erasing \\`const enum\\` declarations in generated code.`,\n preserveSymlinks: `Disable resolving symlinks to their realpath. This correlates to the same flag in node.`,\n preserveValueImports: `Preserve unused imported values in the JavaScript output that would otherwise be removed.`,\n preserveWatchOutput: `Disable wiping the console in watch mode.`,\n pretty: `Enable color and formatting in TypeScript's output to make compiler errors easier to read.`,\n reactNamespace: `Specify the object invoked for \\`createElement\\`. This only applies when targeting \\`react\\` JSX emit.`,\n references: `Specify an array of objects that specify paths for projects. Used in project references.`,\n removeComments: `Disable emitting comments.`,\n resolveJsonModule: `Enable importing .json files.`,\n rootDir: `Specify the root folder within your source files.`,\n rootDirs: `Allow multiple folders to be treated as one when resolving modules.`,\n skipDefaultLibCheck: `Skip type checking .d.ts files that are included with TypeScript.`,\n skipLibCheck: `Skip type checking all .d.ts files.`,\n sourceMap: `Create source map files for emitted JavaScript files.`,\n sourceRoot: `Specify the root path for debuggers to find the reference source code.`,\n strict: `Enable all strict type-checking options.`,\n strictBindCallApply: `Check that the arguments for \\`bind\\`, \\`call\\`, and \\`apply\\` methods match the original function.`,\n strictFunctionTypes: `When assigning functions, check to ensure parameters and the return values are subtype-compatible.`,\n strictNullChecks: `When type checking, take into account \\`null\\` and \\`undefined\\`.`,\n strictPropertyInitialization: `Check for class properties that are declared but not set in the constructor.`,\n stripInternal: `Disable emitting declarations that have \\`@internal\\` in their JSDoc comments.`,\n suppressExcessPropertyErrors: `Disable reporting of excess property errors during the creation of object literals.`,\n suppressImplicitAnyIndexErrors: `Suppress [\\`noImplicitAny\\`](#noImplicitAny) errors when indexing objects that lack index signatures.`,\n synchronousWatchDirectory: `Synchronously call callbacks and update the state of directory watchers on platforms that don\\`t support recursive watching natively.`,\n target: `Set the JavaScript language version for emitted JavaScript and include compatible library declarations.`,\n traceResolution: `Log paths used during the [\\`moduleResolution\\`](#moduleResolution) process.`,\n tsBuildInfoFile: `Specify the folder for .tsbuildinfo incremental compilation files.`,\n typeAcquisition: `Specify options for automatic acquisition of declaration files.`,\n typeRoots: `Specify multiple folders that act like \\`./node_modules/@types\\`.`,\n types: `Specify type package names to be included without being referenced in a source file.`,\n useDefineForClassFields: `Emit ECMAScript-standard-compliant class fields.`,\n useUnknownInCatchVariables: `Default catch clause variables as \\`unknown\\` instead of \\`any\\`.`,\n verbose: `Enable verbose logging.`,\n watchDirectory: `Specify how directories are watched on systems that lack recursive file-watching functionality.`,\n watchFile: `Specify how the TypeScript watch mode works.`,\n};\n","type Lines = import(\"shiki\").IThemedToken[][]\n\nimport type { IThemedToken } from \"shiki\"\nimport { escapeHtml, Meta } from \"../utils\"\nimport { tsconfig } from \"../tsconfig-oneliners.generated\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\n/** Uses tmLanguage scopes to determine what the content of the token is */\nconst tokenIsJSONKey = (token: IThemedToken) => {\n if (!token.explanation) return false\n return token.explanation.find(e => e.scopes.find(s => s.scopeName.includes(\"support.type.property-name\")))\n}\n\n/** Can you look up the token in the tsconfig reference? */\nconst isKeyInTSConfig = (token: IThemedToken) => {\n if (token.content === '\"') return\n const name = token.content.slice(1, token.content.length - 1)\n return name in tsconfig\n}\n\n/**\n * Renders a TSConfig JSON object with additional LSP-ish information\n * @param lines the result of shiki highlighting\n * @param options shiki display options\n */\nexport function tsconfigJSONRenderer(lines: Lines, options: HtmlRendererOptions, meta: Meta) {\n let html = \"\"\n\n html += preOpenerFromRenderingOptsWithExtras(options, meta, [\"tsconfig\", \"lsp\"])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n lines.forEach(l => {\n if (l.length === 0) {\n html += `
    `\n } else {\n html += `
    `\n l.forEach(token => {\n // This means we're looking at a token which could be '\"module\"', '\"', '\"compilerOptions\"' etc\n if (tokenIsJSONKey(token) && isKeyInTSConfig(token)) {\n const key = token.content.slice(1, token.content.length - 1)\n const oneliner = (tsconfig as Record)[key]\n // prettier-ignore\n html += `\"\"`\n } else {\n html += `${escapeHtml(token.content)}`\n }\n })\n html += `
    `\n }\n })\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","import { getHighlighter, Highlighter, HighlighterOptions, IThemedToken } from \"shiki\"\nimport { twoslasher, TwoSlashOptions, TwoSlashReturn } from \"@typescript/twoslash\"\nimport { twoslashRenderer } from \"./renderers/twoslash\"\nimport { HtmlRendererOptions, plainTextRenderer } from \"./renderers/plain\"\nimport { defaultShikiRenderer } from \"./renderers/shiki\"\nimport { tsconfigJSONRenderer } from \"./renderers/tsconfig\"\nimport { Meta } from \"./utils\"\n\nexport interface TwoslashShikiOptions {\n /** A way to turn on the try buttons seen on the TS website */\n addTryButton?: true\n /** A way to disable implicit React imports on tsx/jsx language codeblocks */\n disableImplicitReactImport?: true\n /** A way to add a div wrapper for multi-theme outputs */\n wrapFragments?: true\n /** Include JSDoc comments in the hovers */\n includeJSDocInHover?: true\n /** Instead of showing twoslash exceptions inline, throw the entire process like it will on CI */\n alwayRaiseForTwoslashExceptions?: true\n /** Ignore transforming certain code blocks */\n ignoreCodeblocksWithCodefenceMeta?: string[]\n}\n\n/** The possible user config, a combination of all shiki, twoslash and twoslash-shiki options */\nexport type UserConfigSettings = HighlighterOptions & TwoSlashOptions & TwoslashShikiOptions\n\n/**\n * This gets filled in by the promise below, then should\n * hopefully be more or less synchronous access by each parse\n * of the highlighter\n */\nlet storedHighlighter: Highlighter = null as any\n\n/**\n * Creates a *cached singleton* Shiki highlighter, this is an async call because of the call to WASM to get\n * the regex parser set up.\n *\n * In other functions, passing a the result of this highlighter function is kind of optional but it's the author's\n * opinion that you should be in control of the highlighter, and not this library.\n *\n */\nexport const createShikiHighlighter = (options: HighlighterOptions) => {\n if (storedHighlighter) return Promise.resolve(storedHighlighter)\n\n return getHighlighter(options).then(newHighlighter => {\n storedHighlighter = newHighlighter\n return storedHighlighter\n })\n}\n\n/**\n * Renders a code sample to HTML, automatically taking into account:\n *\n * - rendering overrides for twoslash and tsconfig\n * - whether the language exists in shiki\n *\n * @param code the source code to render\n * @param lang the language to use in highlighting\n * @param info additional metadata which lives after the code-fence lang (e.g. `{ twoslash: true }`)\n * @param shikiOptions user settings\n * @param highlighter optional, but you should use it, highlighter\n * @param twoslash optional, but required when info contains 'twoslash' as a string\n */\nexport const renderCodeToHTML = (\n code: string,\n lang: string,\n meta: Meta,\n shikiOptions?: UserConfigSettings & { themeName: string },\n highlighter?: Highlighter,\n twoslash?: TwoSlashReturn\n) => {\n if (!highlighter && !storedHighlighter) {\n throw new Error(\"The highlighter object hasn't been initialised via `setupHighLighter` yet in shiki-twoslash\")\n }\n\n // Shiki does know the lang, so tokenize\n const renderHighlighter = highlighter || storedHighlighter\n\n const renderOpts: HtmlRendererOptions = {\n fg: renderHighlighter.getForegroundColor(),\n bg: renderHighlighter.getBackgroundColor(),\n ...shikiOptions,\n }\n\n let tokens: IThemedToken[][]\n try {\n // I'm a little unsure about why we need this, perhaps the jsx language\n // upstream in shiki is broken?\n const tmpLang = lang === \"jsx\" ? \"tsx\" : lang\n\n tokens = renderHighlighter.codeToThemedTokens(code, tmpLang as any)\n } catch (error) {\n // Shiki doesn't know this lang, so render it as plain text, but\n // also add a note at the end as a HTML comment\n const note = ``\n return plainTextRenderer(code, renderOpts, meta) + note\n }\n\n // Twoslash specific renderer\n if (lang && meta.twoslash && twoslash) {\n return twoslashRenderer(tokens, { ...renderOpts, langId: lang }, twoslash, meta)\n }\n\n // TSConfig renderer\n if (lang && lang.startsWith(\"json\") && meta.tsconfig) {\n return tsconfigJSONRenderer(tokens, renderOpts, meta)\n }\n\n // Otherwise just the normal shiki renderer\n return defaultShikiRenderer(tokens, { ...renderOpts, langId: lang }, meta)\n}\n\n/**\n * Runs Twoslash over the code passed in with a particular language as the default file.\n */\nexport const runTwoSlash = (input: string, lang: string, settings: UserConfigSettings = {}): TwoSlashReturn => {\n let code = input\n\n // Shiki doesn't handle a few filetype mappings, so do that ahead of time. Oddly enough, this also\n // gets re-done at remark-shiki level\n const replacer = {\n json5: \"json\",\n yml: \"yaml\",\n }\n\n // @ts-ignore\n if (replacer[lang]) lang = replacer[lang]\n\n const hasReactImport = /^import\\s+React(?:.*)\\s+from\\s+('|\")react\\1/gm\n\n // Add react import to code samples indicating they're needing react.\n if ([\"tsx\", \"jsx\"].includes(lang) && !settings.disableImplicitReactImport && !hasReactImport.test(code)) {\n const reactImport = \"import React from 'react'\\n\"\n const cutString = \"// ---cut---\\n\"\n // ^ cutString taken directly from\n // https://github.com/microsoft/TypeScript-Website/blob/0c8d98a69d520365c1909d536fa1323f03a8438c/packages/ts-twoslasher/src/index.ts#L694\n\n if (code.includes(cutString)) {\n code = code\n .split(cutString)\n .map((item, index) => (index == 0 ? reactImport.concat(item) : item))\n .join(cutString)\n } else {\n code = [reactImport, cutString, code].join(\"\")\n }\n }\n\n settings.customTags = [\"annotate\", \"log\", \"warn\", \"error\"]\n const results = twoslasher(code, lang, settings)\n return results\n}\n\n/** Set of renderers if you want to explicitly call one instead of using renderCodeToHTML */\nexport const renderers = {\n plainTextRenderer,\n defaultShikiRenderer,\n twoslashRenderer,\n tsconfigJSONRenderer,\n}\n"],"names":["htmlForTags","tags","html","forEach","t","name","annotation","meta","split","text","pop","info","trim","flipped","includes","settings","arrowRot","textDegree","top","line","theInfo","specificSettings","JSON","parse","error","TwoslashError","stringify","message","arrowSVG","arrow","style","leftInner","rightInner","inner","rot","createHighlightedString","ranges","targetedWord","tag","x","makeTagFromRange","r","close","classes","lsp","htmlAttrReplacer","underLineTargetedWord","sort","a","b","precedenceOf","indexOf","cmp","begin","end","cursor","nest","data","stack","shift","substring","some","length","htmlAttrUnReplacer","replaceTripleArrow","stripHTML","str","replace","subTripleArrow","replaceTripleArrowEncoded","table","toString","chr","escapeHtml","shouldBeHighlightable","highlight","Object","keys","find","key","isNaN","parseInt","shouldHighlightLine","lines","push","first","last","lastIndex","i","preOpenerFromRenderingOptsWithExtras","opts","bg","fg","theme","themeName","classList","title","filter","Boolean","join","attributes","entries","entry","map","value","plainTextRenderer","code","options","langId","twoslashRenderer","twoslash","hasHighlight","hl","errorsGroupedByLine","groupBy","errors","e","Map","staticQuickInfosGroupedByLine","staticQuickInfos","q","queriesGroupedByLine","queries","tagsGroupedByLine","filePos","l","get","lspValues","hiClass","prefix","emptyLine","tokenPos","token","targetedQueryWord","tokenContent","findTokenFunc","start","character","content","errorsInToken","lspResponsesInToken","queriesInToken","response","allTokens","allTokensByStart","range","kind","lspText","includeJSDocInHover","docs","color","messages","renderedMessage","codes","query","queryTextWithPrefix","halfWayAcrossTheTargetedWord","repeat","completions","padStart","offset","prefixed","c","startsWith","completionsPrefix","lis","localeCompare","after","substr","isDeprecated","kindModifiers","liClass","errorSVG","warningSVG","logSVG","addTryButton","playgroundLink","playgroundURL","list","keyGetter","item","collection","set","defaultShikiRenderer","tsconfig","compilerOptions","allowJs","allowSyntheticDefaultImports","allowUmdGlobalAccess","allowUnreachableCode","allowUnusedLabels","alwaysStrict","assumeChangesOnlyAffectDirectDependencies","baseUrl","charset","checkJs","clean","composite","declaration","declarationDir","declarationMap","diagnostics","disableFilenameBasedTypeAcquisition","disableReferencedProjectLoad","disableSizeLimit","disableSolutionSearching","disableSourceOfProjectReferenceRedirect","downlevelIteration","emitBOM","emitDeclarationOnly","emitDecoratorMetadata","enable","esModuleInterop","exactOptionalPropertyTypes","exclude","excludeDirectories","excludeFiles","experimentalDecorators","explainFiles","extendedDiagnostics","fallbackPolling","files","force","forceConsistentCasingInFileNames","generateCpuProfile","importHelpers","importsNotUsedAsValues","include","incremental","inlineSourceMap","inlineSources","isolatedModules","jsx","jsxFactory","jsxFragmentFactory","jsxImportSource","keyofStringsOnly","lib","listEmittedFiles","listFiles","locale","mapRoot","maxNodeModuleJsDepth","module","moduleDetection","moduleResolution","moduleSuffixes","newLine","noEmit","noEmitHelpers","noEmitOnError","noErrorTruncation","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noImplicitUseStrict","noLib","noPropertyAccessFromIndexSignature","noResolve","noStrictGenericChecks","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","out","outDir","outFile","paths","plugins","preserveConstEnums","preserveSymlinks","preserveValueImports","preserveWatchOutput","pretty","reactNamespace","references","removeComments","resolveJsonModule","rootDir","rootDirs","skipDefaultLibCheck","skipLibCheck","sourceMap","sourceRoot","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","stripInternal","suppressExcessPropertyErrors","suppressImplicitAnyIndexErrors","synchronousWatchDirectory","target","traceResolution","tsBuildInfoFile","typeAcquisition","typeRoots","types","useDefineForClassFields","useUnknownInCatchVariables","verbose","watchDirectory","watchFile","tokenIsJSONKey","explanation","scopes","s","scopeName","isKeyInTSConfig","slice","tsconfigJSONRenderer","oneliner","storedHighlighter","createShikiHighlighter","Promise","resolve","getHighlighter","then","newHighlighter","renderCodeToHTML","lang","shikiOptions","highlighter","Error","renderHighlighter","renderOpts","getForegroundColor","getBackgroundColor","tokens","tmpLang","codeToThemedTokens","note","runTwoSlash","input","replacer","json5","yml","hasReactImport","disableImplicitReactImport","test","reactImport","cutString","index","concat","customTags","results","twoslasher","renderers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,IAAD;AACzB,MAAIC,IAAI,GAAG,EAAX;AACAD,EAAAA,IAAI,CAACE,OAAL,CAAa,UAAAC,CAAC;AACZ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