diff --git a/packages/core/src/constructors/bundle-factory.ts b/packages/core/src/constructors/bundle-factory.ts index 509be9ff3..1a09bdb7a 100644 --- a/packages/core/src/constructors/bundle-factory.ts +++ b/packages/core/src/constructors/bundle-factory.ts @@ -1,25 +1,72 @@ import type { Root } from 'hast' -import type { BundledHighlighterOptions, CodeToHastOptions, CodeToTokensBaseOptions, CodeToTokensOptions, CodeToTokensWithThemesOptions, GrammarState, HighlighterCoreOptions, HighlighterGeneric, LanguageInput, RequireKeys, SpecialLanguage, SpecialTheme, ThemeInput, ThemedToken, ThemedTokenWithVariants, TokensResult } from '../types' +import type { Awaitable, BundledHighlighterOptions, CodeToHastOptions, CodeToTokensBaseOptions, CodeToTokensOptions, CodeToTokensWithThemesOptions, CreatedBundledHighlighterOptions, GrammarState, HighlighterCoreOptions, HighlighterGeneric, LanguageInput, RegexEngine, RequireKeys, SpecialLanguage, SpecialTheme, ThemeInput, ThemedToken, ThemedTokenWithVariants, TokensResult } from '../types' import { isSpecialLang, isSpecialTheme } from '../utils' import { ShikiError } from '../error' +import { createWasmOnigEngine } from '../engines/wasm' import { createHighlighterCore } from './highlighter' export type CreateHighlighterFactory = ( options: BundledHighlighterOptions ) => Promise> +/** + * Create a `createHighlighter` function with bundled themes, languages, and engine. + * + * @example + * ```ts + * const createHighlighter = createdBundledHighlighter({ + * langs: { + * typescript: () => import('shiki/langs/typescript.mjs'), + * // ... + * }, + * themes: { + * nord: () => import('shiki/themes/nord.mjs'), + * // ... + * }, + * engine: () => createWasmOnigEngine(), // or createJavaScriptRegexEngine() + * }) + * ``` + * + * @param options + */ +export function createdBundledHighlighter( + options: CreatedBundledHighlighterOptions +): CreateHighlighterFactory + /** * Create a `createHighlighter` function with bundled themes and languages. * - * @param bundledLanguages - * @param bundledThemes - * @param loadWasm + * @deprecated Use `createdBundledHighlighter({ langs, themes, engine })` signature instead. */ export function createdBundledHighlighter( bundledLanguages: Record, bundledThemes: Record, loadWasm: HighlighterCoreOptions['loadWasm'], +): CreateHighlighterFactory + +// Implementation +export function createdBundledHighlighter( + arg1: Record | CreatedBundledHighlighterOptions, + arg2?: Record, + arg3?: HighlighterCoreOptions['loadWasm'], ): CreateHighlighterFactory { + let bundledLanguages: Record + let bundledThemes: Record + let engine: () => Awaitable + + if (arg2) { + // TODO: next: console.warn('`createdBundledHighlighter` signature with `bundledLanguages` and `bundledThemes` is deprecated. Use the options object signature instead.') + bundledLanguages = arg1 as Record + bundledThemes = arg2 + engine = () => createWasmOnigEngine(arg3) + } + else { + const options = arg1 as CreatedBundledHighlighterOptions + bundledLanguages = options.langs + bundledThemes = options.themes + engine = options.engine + } + async function createHighlighter( options: BundledHighlighterOptions, ): Promise> { @@ -56,7 +103,7 @@ export function createdBundledHighlighter + +/** + * Options for creating a bundled highlighter. + */ +export interface CreatedBundledHighlighterOptions { + langs: Record + themes: Record + engine: () => Awaitable +} diff --git a/packages/shiki/src/bundle-full.ts b/packages/shiki/src/bundle-full.ts index 343d3e35b..6d14782a5 100644 --- a/packages/shiki/src/bundle-full.ts +++ b/packages/shiki/src/bundle-full.ts @@ -1,5 +1,5 @@ import type { CreateHighlighterFactory, HighlighterGeneric } from '@shikijs/core' -import { createSingletonShorthands, createdBundledHighlighter } from './core' +import { createSingletonShorthands, createWasmOnigEngine, createdBundledHighlighter } from './core' import type { BundledLanguage } from './assets/langs-bundle-full' import type { BundledTheme } from './themes' import { bundledLanguages } from './assets/langs-bundle-full' @@ -28,11 +28,11 @@ export type Highlighter = HighlighterGeneric export const createHighlighter = /* @__PURE__ */ createdBundledHighlighter< BundledLanguage, BundledTheme ->( - bundledLanguages, - bundledThemes, - getWasmInlined, -) +>({ + langs: bundledLanguages, + themes: bundledThemes, + engine: () => createWasmOnigEngine(getWasmInlined), +}) export const { codeToHtml, diff --git a/packages/shiki/src/bundle-web.ts b/packages/shiki/src/bundle-web.ts index d97744f22..fb0fab78c 100644 --- a/packages/shiki/src/bundle-web.ts +++ b/packages/shiki/src/bundle-web.ts @@ -1,5 +1,5 @@ import type { CreateHighlighterFactory, HighlighterGeneric } from '@shikijs/core' -import { createSingletonShorthands, createdBundledHighlighter } from './core' +import { createSingletonShorthands, createWasmOnigEngine, createdBundledHighlighter } from './core' import type { BundledLanguage } from './assets/langs-bundle-web' import type { BundledTheme } from './themes' import { bundledLanguages } from './assets/langs-bundle-web' @@ -28,11 +28,11 @@ export type Highlighter = HighlighterGeneric export const createHighlighter = /* @__PURE__ */ createdBundledHighlighter< BundledLanguage, BundledTheme ->( - bundledLanguages, - bundledThemes, - getWasmInlined, -) +>({ + langs: bundledLanguages, + themes: bundledThemes, + engine: () => createWasmOnigEngine(getWasmInlined), +}) export const { codeToHtml, diff --git a/packages/twoslash/test/out/classic/compiler_errors.html b/packages/twoslash/test/out/classic/compiler_errors.html index 450895c0f..a363767a3 100644 --- a/packages/twoslash/test/out/classic/compiler_errors.html +++ b/packages/twoslash/test/out/classic/compiler_errors.html @@ -5,7 +5,8 @@ .shiki { padding: 2em; }

-function fn(s) {
Parameter 's' implicitly has an 'any' type.7006
Parameter 's' implicitly has an 'any' type. console.log(s.subtr(3)) +function fn(s) {
Parameter 's' implicitly has an 'any' type.7006
Parameter 's' implicitly has an 'any' type. console.log(s.subtr(3)) } fn(42)
\ No newline at end of file diff --git a/packages/twoslash/test/out/classic/console_log.html b/packages/twoslash/test/out/classic/console_log.html index 1ed780e47..fc9c75825 100644 --- a/packages/twoslash/test/out/classic/console_log.html +++ b/packages/twoslash/test/out/classic/console_log.html @@ -5,5 +5,6 @@ .shiki { padding: 2em; }
// Hello
-console.error("This is an error")
+console.error("This is an error")
 
This is an error
\ No newline at end of file diff --git a/packages/twoslash/test/out/completion-end-multifile-2.ts.html b/packages/twoslash/test/out/completion-end-multifile-2.ts.html index ccd31f6cb..519d5f9ce 100644 --- a/packages/twoslash/test/out/completion-end-multifile-2.ts.html +++ b/packages/twoslash/test/out/completion-end-multifile-2.ts.html @@ -1,4 +1,58 @@
import { const foo: "foo"foo } from './foo'
 
-var console: Consoleconsole.e
  • error
+var console: Console
The `console` module provides a simple debugging console that is similar to the +JavaScript console mechanism provided by web browsers. + +The module exports two specific components: + +* A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. +* A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and +[`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`. + +_**Warning**_: The global console object's methods are neither consistently +synchronous like the browser APIs they resemble, nor are they consistently +asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for +more information. + +Example using the global `console`: + +```js +console.log('hello world'); +// Prints: hello world, to stdout +console.log('hello %s', 'world'); +// Prints: hello world, to stdout +console.error(new Error('Whoops, something bad happened')); +// Prints error message and stack trace to stderr: +// Error: Whoops, something bad happened +// at [eval]:5:15 +// at Script.runInThisContext (node:vm:132:18) +// at Object.runInThisContext (node:vm:309:38) +// at node:internal/process/execution:77:19 +// at [eval]-wrapper:6:22 +// at evalScript (node:internal/process/execution:76:60) +// at node:internal/main/eval_string:23:3 + +const name = 'Will Robinson'; +console.warn(`Danger ${name}! Danger!`); +// Prints: Danger Will Robinson! Danger!, to stderr +``` + +Example using the `Console` class: + +```js +const out = getStreamSomehow(); +const err = getStreamSomehow(); +const myConsole = new console.Console(out, err); + +myConsole.log('hello world'); +// Prints: hello world, to out +myConsole.log('hello %s', 'world'); +// Prints: hello world, to out +myConsole.error(new Error('Whoops, something bad happened')); +// Prints: [Error: Whoops, something bad happened], to err + +const name = 'Will Robinson'; +myConsole.warn(`Danger ${name}! Danger!`); +// Prints: Danger Will Robinson! Danger!, to err +```
@see[source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)
console
.e
  • error
\ No newline at end of file diff --git a/packages/twoslash/test/out/completion-end-multifile-2.ts.json b/packages/twoslash/test/out/completion-end-multifile-2.ts.json index 0b4f7e50c..6aec9271e 100644 --- a/packages/twoslash/test/out/completion-end-multifile-2.ts.json +++ b/packages/twoslash/test/out/completion-end-multifile-2.ts.json @@ -357,6 +357,63 @@ ] } ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs" + }, + "children": [ + { + "type": "text", + "value": "The `console` module provides a simple debugging console that is similar to the\nJavaScript console mechanism provided by web browsers.\n\nThe module exports two specific components:\n\n* A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.\n* A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and\n[`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`.\n\n_**Warning**_: The global console object's methods are neither consistently\nsynchronous like the browser APIs they resemble, nor are they consistently\nasynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for\nmore information.\n\nExample using the global `console`:\n\n```js\nconsole.log('hello world');\n// Prints: hello world, to stdout\nconsole.log('hello %s', 'world');\n// Prints: hello world, to stdout\nconsole.error(new Error('Whoops, something bad happened'));\n// Prints error message and stack trace to stderr:\n// Error: Whoops, something bad happened\n// at [eval]:5:15\n// at Script.runInThisContext (node:vm:132:18)\n// at Object.runInThisContext (node:vm:309:38)\n// at node:internal/process/execution:77:19\n// at [eval]-wrapper:6:22\n// at evalScript (node:internal/process/execution:76:60)\n// at node:internal/main/eval_string:23:3\n\nconst name = 'Will Robinson';\nconsole.warn(`Danger ${name}! Danger!`);\n// Prints: Danger Will Robinson! Danger!, to stderr\n```\n\nExample using the `Console` class:\n\n```js\nconst out = getStreamSomehow();\nconst err = getStreamSomehow();\nconst myConsole = new console.Console(out, err);\n\nmyConsole.log('hello world');\n// Prints: hello world, to out\nmyConsole.log('hello %s', 'world');\n// Prints: hello world, to out\nmyConsole.error(new Error('Whoops, something bad happened'));\n// Prints: [Error: Whoops, something bad happened], to err\n\nconst name = 'Will Robinson';\nmyConsole.warn(`Danger ${name}! Danger!`);\n// Prints: Danger Will Robinson! Danger!, to err\n```" + } + ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs twoslash-popup-docs-tags" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-name" + }, + "children": [ + { + "type": "text", + "value": "@see" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-value" + }, + "children": [ + { + "type": "text", + "value": "[source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)" + } + ] + } + ] + } + ] } ] }, diff --git a/packages/twoslash/test/out/completion-end.ts.html b/packages/twoslash/test/out/completion-end.ts.html index bcf339146..57ab826c3 100644 --- a/packages/twoslash/test/out/completion-end.ts.html +++ b/packages/twoslash/test/out/completion-end.ts.html @@ -1,4 +1,58 @@ -
var console: Consoleconsole.e
  • error
+
var console: Console
The `console` module provides a simple debugging console that is similar to the +JavaScript console mechanism provided by web browsers. + +The module exports two specific components: + +* A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. +* A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and +[`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`. + +_**Warning**_: The global console object's methods are neither consistently +synchronous like the browser APIs they resemble, nor are they consistently +asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for +more information. + +Example using the global `console`: + +```js +console.log('hello world'); +// Prints: hello world, to stdout +console.log('hello %s', 'world'); +// Prints: hello world, to stdout +console.error(new Error('Whoops, something bad happened')); +// Prints error message and stack trace to stderr: +// Error: Whoops, something bad happened +// at [eval]:5:15 +// at Script.runInThisContext (node:vm:132:18) +// at Object.runInThisContext (node:vm:309:38) +// at node:internal/process/execution:77:19 +// at [eval]-wrapper:6:22 +// at evalScript (node:internal/process/execution:76:60) +// at node:internal/main/eval_string:23:3 + +const name = 'Will Robinson'; +console.warn(`Danger ${name}! Danger!`); +// Prints: Danger Will Robinson! Danger!, to stderr +``` + +Example using the `Console` class: + +```js +const out = getStreamSomehow(); +const err = getStreamSomehow(); +const myConsole = new console.Console(out, err); + +myConsole.log('hello world'); +// Prints: hello world, to out +myConsole.log('hello %s', 'world'); +// Prints: hello world, to out +myConsole.error(new Error('Whoops, something bad happened')); +// Prints: [Error: Whoops, something bad happened], to err + +const name = 'Will Robinson'; +myConsole.warn(`Danger ${name}! Danger!`); +// Prints: Danger Will Robinson! Danger!, to err +```
@see[source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)
console
.e
  • error
const
const a: {
diff --git a/packages/twoslash/test/out/completion-end.ts.json b/packages/twoslash/test/out/completion-end.ts.json
index 071071bd5..0e8690ac4 100644
--- a/packages/twoslash/test/out/completion-end.ts.json
+++ b/packages/twoslash/test/out/completion-end.ts.json
@@ -109,6 +109,63 @@
                                   ]
                                 }
                               ]
+                            },
+                            {
+                              "type": "element",
+                              "tagName": "div",
+                              "properties": {
+                                "class": "twoslash-popup-docs"
+                              },
+                              "children": [
+                                {
+                                  "type": "text",
+                                  "value": "The `console` module provides a simple debugging console that is similar to the\nJavaScript console mechanism provided by web browsers.\n\nThe module exports two specific components:\n\n* A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.\n* A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and\n[`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`.\n\n_**Warning**_: The global console object's methods are neither consistently\nsynchronous like the browser APIs they resemble, nor are they consistently\nasynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for\nmore information.\n\nExample using the global `console`:\n\n```js\nconsole.log('hello world');\n// Prints: hello world, to stdout\nconsole.log('hello %s', 'world');\n// Prints: hello world, to stdout\nconsole.error(new Error('Whoops, something bad happened'));\n// Prints error message and stack trace to stderr:\n//   Error: Whoops, something bad happened\n//     at [eval]:5:15\n//     at Script.runInThisContext (node:vm:132:18)\n//     at Object.runInThisContext (node:vm:309:38)\n//     at node:internal/process/execution:77:19\n//     at [eval]-wrapper:6:22\n//     at evalScript (node:internal/process/execution:76:60)\n//     at node:internal/main/eval_string:23:3\n\nconst name = 'Will Robinson';\nconsole.warn(`Danger ${name}! Danger!`);\n// Prints: Danger Will Robinson! Danger!, to stderr\n```\n\nExample using the `Console` class:\n\n```js\nconst out = getStreamSomehow();\nconst err = getStreamSomehow();\nconst myConsole = new console.Console(out, err);\n\nmyConsole.log('hello world');\n// Prints: hello world, to out\nmyConsole.log('hello %s', 'world');\n// Prints: hello world, to out\nmyConsole.error(new Error('Whoops, something bad happened'));\n// Prints: [Error: Whoops, something bad happened], to err\n\nconst name = 'Will Robinson';\nmyConsole.warn(`Danger ${name}! Danger!`);\n// Prints: Danger Will Robinson! Danger!, to err\n```"
+                                }
+                              ]
+                            },
+                            {
+                              "type": "element",
+                              "tagName": "div",
+                              "properties": {
+                                "class": "twoslash-popup-docs twoslash-popup-docs-tags"
+                              },
+                              "children": [
+                                {
+                                  "type": "element",
+                                  "tagName": "span",
+                                  "properties": {
+                                    "class": "twoslash-popup-docs-tag"
+                                  },
+                                  "children": [
+                                    {
+                                      "type": "element",
+                                      "tagName": "span",
+                                      "properties": {
+                                        "class": "twoslash-popup-docs-tag-name"
+                                      },
+                                      "children": [
+                                        {
+                                          "type": "text",
+                                          "value": "@see"
+                                        }
+                                      ]
+                                    },
+                                    {
+                                      "type": "element",
+                                      "tagName": "span",
+                                      "properties": {
+                                        "class": "twoslash-popup-docs-tag-value"
+                                      },
+                                      "children": [
+                                        {
+                                          "type": "text",
+                                          "value": "[source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)"
+                                        }
+                                      ]
+                                    }
+                                  ]
+                                }
+                              ]
                             }
                           ]
                         },
diff --git a/packages/twoslash/test/out/highlights.ts.html b/packages/twoslash/test/out/highlights.ts.html
index 4b8f88f3b..155b4831a 100644
--- a/packages/twoslash/test/out/highlights.ts.html
+++ b/packages/twoslash/test/out/highlights.ts.html
@@ -4,5 +4,72 @@
 
 const const world: "OK"worlconst world: "OK"d = "OK"
 
-var console: Consoleconsole.Console.log(...data: any[]): void
[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
log
("OK")
+var console: Console
The `console` module provides a simple debugging console that is similar to the +JavaScript console mechanism provided by web browsers. + +The module exports two specific components: + +* A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. +* A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and +[`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`. + +_**Warning**_: The global console object's methods are neither consistently +synchronous like the browser APIs they resemble, nor are they consistently +asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for +more information. + +Example using the global `console`: + +```js +console.log('hello world'); +// Prints: hello world, to stdout +console.log('hello %s', 'world'); +// Prints: hello world, to stdout +console.error(new Error('Whoops, something bad happened')); +// Prints error message and stack trace to stderr: +// Error: Whoops, something bad happened +// at [eval]:5:15 +// at Script.runInThisContext (node:vm:132:18) +// at Object.runInThisContext (node:vm:309:38) +// at node:internal/process/execution:77:19 +// at [eval]-wrapper:6:22 +// at evalScript (node:internal/process/execution:76:60) +// at node:internal/main/eval_string:23:3 + +const name = 'Will Robinson'; +console.warn(`Danger ${name}! Danger!`); +// Prints: Danger Will Robinson! Danger!, to stderr +``` + +Example using the `Console` class: + +```js +const out = getStreamSomehow(); +const err = getStreamSomehow(); +const myConsole = new console.Console(out, err); + +myConsole.log('hello world'); +// Prints: hello world, to out +myConsole.log('hello %s', 'world'); +// Prints: hello world, to out +myConsole.error(new Error('Whoops, something bad happened')); +// Prints: [Error: Whoops, something bad happened], to err + +const name = 'Will Robinson'; +myConsole.warn(`Danger ${name}! Danger!`); +// Prints: Danger Will Robinson! Danger!, to err +```
@see[source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)
console
.Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)
Prints to `stdout` with newline. Multiple arguments can be passed, with the +first used as the primary message and all additional used as substitution +values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) +(the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). + +```js +const count = 5; +console.log('count: %d', count); +// Prints: count: 5, to stdout +console.log('count:', count); +// Prints: count: 5, to stdout +``` + +See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.
@sincev0.1.100
log
("OK")
\ No newline at end of file diff --git a/packages/twoslash/test/out/highlights.ts.json b/packages/twoslash/test/out/highlights.ts.json index d02ea874d..a82d66caa 100644 --- a/packages/twoslash/test/out/highlights.ts.json +++ b/packages/twoslash/test/out/highlights.ts.json @@ -1131,6 +1131,63 @@ ] } ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs" + }, + "children": [ + { + "type": "text", + "value": "The `console` module provides a simple debugging console that is similar to the\nJavaScript console mechanism provided by web browsers.\n\nThe module exports two specific components:\n\n* A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.\n* A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and\n[`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`.\n\n_**Warning**_: The global console object's methods are neither consistently\nsynchronous like the browser APIs they resemble, nor are they consistently\nasynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for\nmore information.\n\nExample using the global `console`:\n\n```js\nconsole.log('hello world');\n// Prints: hello world, to stdout\nconsole.log('hello %s', 'world');\n// Prints: hello world, to stdout\nconsole.error(new Error('Whoops, something bad happened'));\n// Prints error message and stack trace to stderr:\n// Error: Whoops, something bad happened\n// at [eval]:5:15\n// at Script.runInThisContext (node:vm:132:18)\n// at Object.runInThisContext (node:vm:309:38)\n// at node:internal/process/execution:77:19\n// at [eval]-wrapper:6:22\n// at evalScript (node:internal/process/execution:76:60)\n// at node:internal/main/eval_string:23:3\n\nconst name = 'Will Robinson';\nconsole.warn(`Danger ${name}! Danger!`);\n// Prints: Danger Will Robinson! Danger!, to stderr\n```\n\nExample using the `Console` class:\n\n```js\nconst out = getStreamSomehow();\nconst err = getStreamSomehow();\nconst myConsole = new console.Console(out, err);\n\nmyConsole.log('hello world');\n// Prints: hello world, to out\nmyConsole.log('hello %s', 'world');\n// Prints: hello world, to out\nmyConsole.error(new Error('Whoops, something bad happened'));\n// Prints: [Error: Whoops, something bad happened], to err\n\nconst name = 'Will Robinson';\nmyConsole.warn(`Danger ${name}! Danger!`);\n// Prints: Danger Will Robinson! Danger!, to err\n```" + } + ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs twoslash-popup-docs-tags" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-name" + }, + "children": [ + { + "type": "text", + "value": "@see" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-value" + }, + "children": [ + { + "type": "text", + "value": "[source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)" + } + ] + } + ] + } + ] } ] }, @@ -1232,7 +1289,33 @@ "children": [ { "type": "text", - "value": "(..." + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "message" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "?:" } ] }, @@ -1245,7 +1328,46 @@ "children": [ { "type": "text", - "value": "data" + "value": " any" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " ..." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "optionalParams" } ] }, @@ -1313,6 +1435,71 @@ "value": "void" } ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " (" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "+" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4C9A91" + }, + "children": [ + { + "type": "text", + "value": "1" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " overload" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ")" + } + ] } ] }, @@ -1325,7 +1512,51 @@ "children": [ { "type": "text", - "value": "[MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)" + "value": "Prints to `stdout` with newline. Multiple arguments can be passed, with the\nfirst used as the primary message and all additional used as substitution\nvalues similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)\n(the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)).\n\n```js\nconst count = 5;\nconsole.log('count: %d', count);\n// Prints: count: 5, to stdout\nconsole.log('count:', count);\n// Prints: count: 5, to stdout\n```\n\nSee [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information." + } + ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs twoslash-popup-docs-tags" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-name" + }, + "children": [ + { + "type": "text", + "value": "@since" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-value" + }, + "children": [ + { + "type": "text", + "value": "v0.1.100" + } + ] + } + ] } ] } diff --git a/packages/vitepress-twoslash/test/fixtures.test.ts b/packages/vitepress-twoslash/test/fixtures.test.ts index efb60b654..176c159d7 100644 --- a/packages/vitepress-twoslash/test/fixtures.test.ts +++ b/packages/vitepress-twoslash/test/fixtures.test.ts @@ -1,12 +1,15 @@ import { basename } from 'node:path' -import { codeToHast } from 'shiki' +import { codeToHast, getSingletonHighlighter } from 'shiki' import { transformerTwoslash } from '@shikijs/twoslash' import { describe, expect, it } from 'vitest' import { rendererFloatingVue } from '../src' const files = import.meta.glob('../../twoslash/test/fixtures/*.*', { as: 'raw', eager: true }) -describe('fixtures', () => { +describe('fixtures', async () => { + const shiki = await getSingletonHighlighter() + shiki.loadLanguage('js') + for (const file in files) { const name = basename(file) it(name, async () => { diff --git a/packages/vitepress-twoslash/test/out/completion-end-multifile-2.ts.json b/packages/vitepress-twoslash/test/out/completion-end-multifile-2.ts.json index 4c5fc590c..9d05a2d9a 100644 --- a/packages/vitepress-twoslash/test/out/completion-end-multifile-2.ts.json +++ b/packages/vitepress-twoslash/test/out/completion-end-multifile-2.ts.json @@ -403,6 +403,3425 @@ ] } ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs vp-doc" + }, + "children": [ + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 5, + "offset": 4 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 1, + "column": 5, + "offset": 4 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 5, + "offset": 4 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + }, + { + "type": "text", + "value": " module provides a simple debugging console that is similar to the\nJavaScript console mechanism provided by web browsers.", + "position": { + "start": { + "line": 1, + "column": 14, + "offset": 13 + }, + "end": { + "line": 2, + "column": 55, + "offset": 134 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 2, + "column": 55, + "offset": 134 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "The module exports two specific components:", + "position": { + "start": { + "line": 4, + "column": 1, + "offset": 136 + }, + "end": { + "line": 4, + "column": 44, + "offset": 179 + } + } + } + ], + "position": { + "start": { + "line": 4, + "column": 1, + "offset": 136 + }, + "end": { + "line": 4, + "column": 44, + "offset": 179 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "ul", + "properties": {}, + "children": [ + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "li", + "properties": {}, + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { + "line": 6, + "column": 3, + "offset": 183 + }, + "end": { + "line": 6, + "column": 5, + "offset": 185 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Console", + "position": { + "start": { + "line": 6, + "column": 5, + "offset": 185 + }, + "end": { + "line": 6, + "column": 14, + "offset": 194 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 5, + "offset": 185 + }, + "end": { + "line": 6, + "column": 14, + "offset": 194 + } + } + }, + { + "type": "text", + "value": " class with methods such as ", + "position": { + "start": { + "line": 6, + "column": 14, + "offset": 194 + }, + "end": { + "line": 6, + "column": 42, + "offset": 222 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.log()", + "position": { + "start": { + "line": 6, + "column": 42, + "offset": 222 + }, + "end": { + "line": 6, + "column": 57, + "offset": 237 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 42, + "offset": 222 + }, + "end": { + "line": 6, + "column": 57, + "offset": 237 + } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { + "line": 6, + "column": 57, + "offset": 237 + }, + "end": { + "line": 6, + "column": 59, + "offset": 239 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.error()", + "position": { + "start": { + "line": 6, + "column": 59, + "offset": 239 + }, + "end": { + "line": 6, + "column": 76, + "offset": 256 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 59, + "offset": 239 + }, + "end": { + "line": 6, + "column": 76, + "offset": 256 + } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { + "line": 6, + "column": 76, + "offset": 256 + }, + "end": { + "line": 6, + "column": 81, + "offset": 261 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.warn()", + "position": { + "start": { + "line": 6, + "column": 81, + "offset": 261 + }, + "end": { + "line": 6, + "column": 97, + "offset": 277 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 81, + "offset": 261 + }, + "end": { + "line": 6, + "column": 97, + "offset": 277 + } + } + }, + { + "type": "text", + "value": " that can be used to write to any Node.js stream.", + "position": { + "start": { + "line": 6, + "column": 97, + "offset": 277 + }, + "end": { + "line": 6, + "column": 146, + "offset": 326 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 1, + "offset": 181 + }, + "end": { + "line": 6, + "column": 146, + "offset": 326 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "li", + "properties": {}, + "children": [ + { + "type": "text", + "value": "A global ", + "position": { + "start": { + "line": 7, + "column": 3, + "offset": 329 + }, + "end": { + "line": 7, + "column": 12, + "offset": 338 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 7, + "column": 12, + "offset": 338 + }, + "end": { + "line": 7, + "column": 21, + "offset": 347 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 12, + "offset": 338 + }, + "end": { + "line": 7, + "column": 21, + "offset": 347 + } + } + }, + { + "type": "text", + "value": " instance configured to write to ", + "position": { + "start": { + "line": 7, + "column": 21, + "offset": 347 + }, + "end": { + "line": 7, + "column": 54, + "offset": 380 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "process.stdout", + "position": { + "start": { + "line": 7, + "column": 55, + "offset": 381 + }, + "end": { + "line": 7, + "column": 71, + "offset": 397 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 55, + "offset": 381 + }, + "end": { + "line": 7, + "column": 71, + "offset": 397 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 54, + "offset": 380 + }, + "end": { + "line": 7, + "column": 141, + "offset": 467 + } + } + }, + { + "type": "text", + "value": " and\n", + "position": { + "start": { + "line": 7, + "column": 141, + "offset": 467 + }, + "end": { + "line": 8, + "column": 1, + "offset": 472 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "process.stderr", + "position": { + "start": { + "line": 8, + "column": 2, + "offset": 473 + }, + "end": { + "line": 8, + "column": 18, + "offset": 489 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 2, + "offset": 473 + }, + "end": { + "line": 8, + "column": 18, + "offset": 489 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 1, + "offset": 472 + }, + "end": { + "line": 8, + "column": 88, + "offset": 559 + } + } + }, + { + "type": "text", + "value": ". The global ", + "position": { + "start": { + "line": 8, + "column": 88, + "offset": 559 + }, + "end": { + "line": 8, + "column": 101, + "offset": 572 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 8, + "column": 101, + "offset": 572 + }, + "end": { + "line": 8, + "column": 110, + "offset": 581 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 101, + "offset": 572 + }, + "end": { + "line": 8, + "column": 110, + "offset": 581 + } + } + }, + { + "type": "text", + "value": " can be used without calling ", + "position": { + "start": { + "line": 8, + "column": 110, + "offset": 581 + }, + "end": { + "line": 8, + "column": 139, + "offset": 610 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "require('console')", + "position": { + "start": { + "line": 8, + "column": 139, + "offset": 610 + }, + "end": { + "line": 8, + "column": 159, + "offset": 630 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 139, + "offset": 610 + }, + "end": { + "line": 8, + "column": 159, + "offset": 630 + } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { + "line": 8, + "column": 159, + "offset": 630 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 1, + "offset": 327 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + }, + { + "type": "text", + "value": "\n" + } + ], + "position": { + "start": { + "line": 6, + "column": 1, + "offset": 181 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "em", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "strong", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Warning", + "position": { + "start": { + "line": 10, + "column": 4, + "offset": 636 + }, + "end": { + "line": 10, + "column": 11, + "offset": 643 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 2, + "offset": 634 + }, + "end": { + "line": 10, + "column": 13, + "offset": 645 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 1, + "offset": 633 + }, + "end": { + "line": 10, + "column": 14, + "offset": 646 + } + } + }, + { + "type": "text", + "value": ": The global console object's methods are neither consistently\nsynchronous like the browser APIs they resemble, nor are they consistently\nasynchronous like all other Node.js streams. See the ", + "position": { + "start": { + "line": 10, + "column": 14, + "offset": 646 + }, + "end": { + "line": 12, + "column": 54, + "offset": 837 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "note on process I/O", + "position": { + "start": { + "line": 12, + "column": 55, + "offset": 838 + }, + "end": { + "line": 12, + "column": 76, + "offset": 859 + } + } + } + ], + "position": { + "start": { + "line": 12, + "column": 55, + "offset": 838 + }, + "end": { + "line": 12, + "column": 76, + "offset": 859 + } + } + } + ], + "position": { + "start": { + "line": 12, + "column": 54, + "offset": 837 + }, + "end": { + "line": 12, + "column": 153, + "offset": 936 + } + } + }, + { + "type": "text", + "value": " for\nmore information.", + "position": { + "start": { + "line": 12, + "column": 153, + "offset": 936 + }, + "end": { + "line": 13, + "column": 18, + "offset": 958 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 1, + "offset": 633 + }, + "end": { + "line": 13, + "column": 18, + "offset": 958 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Example using the global ", + "position": { + "start": { + "line": 15, + "column": 1, + "offset": 960 + }, + "end": { + "line": 15, + "column": 26, + "offset": 985 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 15, + "column": 26, + "offset": 985 + }, + "end": { + "line": 15, + "column": 35, + "offset": 994 + } + } + } + ], + "position": { + "start": { + "line": 15, + "column": 26, + "offset": 985 + }, + "end": { + "line": 15, + "column": 35, + "offset": 994 + } + } + }, + { + "type": "text", + "value": ":", + "position": { + "start": { + "line": 15, + "column": 35, + "offset": 994 + }, + "end": { + "line": 15, + "column": 36, + "offset": 995 + } + } + } + ], + "position": { + "start": { + "line": 15, + "column": 1, + "offset": 960 + }, + "end": { + "line": 15, + "column": 36, + "offset": 995 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "pre", + "properties": { + "class": "shiki vitesse-dark", + "style": "background-color:#121212;color:#dbd7caee", + "tabindex": "0" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to stdout" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello %s" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to stdout" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " Error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Whoops, something bad happened" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "));" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints error message and stack trace to stderr:" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Error: Whoops, something bad happened" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at [eval]:5:15" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at Script.runInThisContext (node:vm:132:18)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at Object.runInThisContext (node:vm:309:38)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at node:internal/process/execution:77:19" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at [eval]-wrapper:6:22" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at evalScript (node:internal/process/execution:76:60)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at node:internal/main/eval_string:23:3" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Will Robinson" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ";" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "warn" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Danger " + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "${" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "}" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "! Danger!" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: Danger Will Robinson! Danger!, to stderr" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Example using the ", + "position": { + "start": { + "line": 38, + "column": 1, + "offset": 1725 + }, + "end": { + "line": 38, + "column": 19, + "offset": 1743 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Console", + "position": { + "start": { + "line": 38, + "column": 19, + "offset": 1743 + }, + "end": { + "line": 38, + "column": 28, + "offset": 1752 + } + } + } + ], + "position": { + "start": { + "line": 38, + "column": 19, + "offset": 1743 + }, + "end": { + "line": 38, + "column": 28, + "offset": 1752 + } + } + }, + { + "type": "text", + "value": " class:", + "position": { + "start": { + "line": 38, + "column": 28, + "offset": 1752 + }, + "end": { + "line": 38, + "column": 35, + "offset": 1759 + } + } + } + ], + "position": { + "start": { + "line": 38, + "column": 1, + "offset": 1725 + }, + "end": { + "line": 38, + "column": 35, + "offset": 1759 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "pre", + "properties": { + "class": "shiki vitesse-dark", + "style": "background-color:#121212;color:#dbd7caee", + "tabindex": "0" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " out" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " getStreamSomehow" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "();" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " err" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " getStreamSomehow" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "();" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": " new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "Console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "out" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " err" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to out" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello %s" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to out" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " Error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Whoops, something bad happened" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "));" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: [Error: Whoops, something bad happened], to err" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Will Robinson" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ";" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "warn" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Danger " + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "${" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "}" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "! Danger!" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: Danger Will Robinson! Danger!, to err" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs twoslash-popup-docs-tags vp-doc" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-name" + }, + "children": [ + { + "type": "text", + "value": "@see" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-value" + }, + "children": [ + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://github.com/nodejs/node/blob/v22.x/lib/console.js" + }, + "children": [ + { + "type": "text", + "value": "source", + "position": { + "start": { + "line": 1, + "column": 2, + "offset": 1 + }, + "end": { + "line": 1, + "column": 8, + "offset": 7 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 67, + "offset": 66 + } + } + } + ] + } + ] + } + ] } ] } diff --git a/packages/vitepress-twoslash/test/out/completion-end.ts.json b/packages/vitepress-twoslash/test/out/completion-end.ts.json index 1e2076a8c..4b7b2cd01 100644 --- a/packages/vitepress-twoslash/test/out/completion-end.ts.json +++ b/packages/vitepress-twoslash/test/out/completion-end.ts.json @@ -132,6 +132,3425 @@ ] } ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs vp-doc" + }, + "children": [ + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 5, + "offset": 4 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 1, + "column": 5, + "offset": 4 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 5, + "offset": 4 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + }, + { + "type": "text", + "value": " module provides a simple debugging console that is similar to the\nJavaScript console mechanism provided by web browsers.", + "position": { + "start": { + "line": 1, + "column": 14, + "offset": 13 + }, + "end": { + "line": 2, + "column": 55, + "offset": 134 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 2, + "column": 55, + "offset": 134 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "The module exports two specific components:", + "position": { + "start": { + "line": 4, + "column": 1, + "offset": 136 + }, + "end": { + "line": 4, + "column": 44, + "offset": 179 + } + } + } + ], + "position": { + "start": { + "line": 4, + "column": 1, + "offset": 136 + }, + "end": { + "line": 4, + "column": 44, + "offset": 179 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "ul", + "properties": {}, + "children": [ + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "li", + "properties": {}, + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { + "line": 6, + "column": 3, + "offset": 183 + }, + "end": { + "line": 6, + "column": 5, + "offset": 185 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Console", + "position": { + "start": { + "line": 6, + "column": 5, + "offset": 185 + }, + "end": { + "line": 6, + "column": 14, + "offset": 194 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 5, + "offset": 185 + }, + "end": { + "line": 6, + "column": 14, + "offset": 194 + } + } + }, + { + "type": "text", + "value": " class with methods such as ", + "position": { + "start": { + "line": 6, + "column": 14, + "offset": 194 + }, + "end": { + "line": 6, + "column": 42, + "offset": 222 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.log()", + "position": { + "start": { + "line": 6, + "column": 42, + "offset": 222 + }, + "end": { + "line": 6, + "column": 57, + "offset": 237 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 42, + "offset": 222 + }, + "end": { + "line": 6, + "column": 57, + "offset": 237 + } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { + "line": 6, + "column": 57, + "offset": 237 + }, + "end": { + "line": 6, + "column": 59, + "offset": 239 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.error()", + "position": { + "start": { + "line": 6, + "column": 59, + "offset": 239 + }, + "end": { + "line": 6, + "column": 76, + "offset": 256 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 59, + "offset": 239 + }, + "end": { + "line": 6, + "column": 76, + "offset": 256 + } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { + "line": 6, + "column": 76, + "offset": 256 + }, + "end": { + "line": 6, + "column": 81, + "offset": 261 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.warn()", + "position": { + "start": { + "line": 6, + "column": 81, + "offset": 261 + }, + "end": { + "line": 6, + "column": 97, + "offset": 277 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 81, + "offset": 261 + }, + "end": { + "line": 6, + "column": 97, + "offset": 277 + } + } + }, + { + "type": "text", + "value": " that can be used to write to any Node.js stream.", + "position": { + "start": { + "line": 6, + "column": 97, + "offset": 277 + }, + "end": { + "line": 6, + "column": 146, + "offset": 326 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 1, + "offset": 181 + }, + "end": { + "line": 6, + "column": 146, + "offset": 326 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "li", + "properties": {}, + "children": [ + { + "type": "text", + "value": "A global ", + "position": { + "start": { + "line": 7, + "column": 3, + "offset": 329 + }, + "end": { + "line": 7, + "column": 12, + "offset": 338 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 7, + "column": 12, + "offset": 338 + }, + "end": { + "line": 7, + "column": 21, + "offset": 347 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 12, + "offset": 338 + }, + "end": { + "line": 7, + "column": 21, + "offset": 347 + } + } + }, + { + "type": "text", + "value": " instance configured to write to ", + "position": { + "start": { + "line": 7, + "column": 21, + "offset": 347 + }, + "end": { + "line": 7, + "column": 54, + "offset": 380 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "process.stdout", + "position": { + "start": { + "line": 7, + "column": 55, + "offset": 381 + }, + "end": { + "line": 7, + "column": 71, + "offset": 397 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 55, + "offset": 381 + }, + "end": { + "line": 7, + "column": 71, + "offset": 397 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 54, + "offset": 380 + }, + "end": { + "line": 7, + "column": 141, + "offset": 467 + } + } + }, + { + "type": "text", + "value": " and\n", + "position": { + "start": { + "line": 7, + "column": 141, + "offset": 467 + }, + "end": { + "line": 8, + "column": 1, + "offset": 472 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "process.stderr", + "position": { + "start": { + "line": 8, + "column": 2, + "offset": 473 + }, + "end": { + "line": 8, + "column": 18, + "offset": 489 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 2, + "offset": 473 + }, + "end": { + "line": 8, + "column": 18, + "offset": 489 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 1, + "offset": 472 + }, + "end": { + "line": 8, + "column": 88, + "offset": 559 + } + } + }, + { + "type": "text", + "value": ". The global ", + "position": { + "start": { + "line": 8, + "column": 88, + "offset": 559 + }, + "end": { + "line": 8, + "column": 101, + "offset": 572 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 8, + "column": 101, + "offset": 572 + }, + "end": { + "line": 8, + "column": 110, + "offset": 581 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 101, + "offset": 572 + }, + "end": { + "line": 8, + "column": 110, + "offset": 581 + } + } + }, + { + "type": "text", + "value": " can be used without calling ", + "position": { + "start": { + "line": 8, + "column": 110, + "offset": 581 + }, + "end": { + "line": 8, + "column": 139, + "offset": 610 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "require('console')", + "position": { + "start": { + "line": 8, + "column": 139, + "offset": 610 + }, + "end": { + "line": 8, + "column": 159, + "offset": 630 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 139, + "offset": 610 + }, + "end": { + "line": 8, + "column": 159, + "offset": 630 + } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { + "line": 8, + "column": 159, + "offset": 630 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 1, + "offset": 327 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + }, + { + "type": "text", + "value": "\n" + } + ], + "position": { + "start": { + "line": 6, + "column": 1, + "offset": 181 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "em", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "strong", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Warning", + "position": { + "start": { + "line": 10, + "column": 4, + "offset": 636 + }, + "end": { + "line": 10, + "column": 11, + "offset": 643 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 2, + "offset": 634 + }, + "end": { + "line": 10, + "column": 13, + "offset": 645 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 1, + "offset": 633 + }, + "end": { + "line": 10, + "column": 14, + "offset": 646 + } + } + }, + { + "type": "text", + "value": ": The global console object's methods are neither consistently\nsynchronous like the browser APIs they resemble, nor are they consistently\nasynchronous like all other Node.js streams. See the ", + "position": { + "start": { + "line": 10, + "column": 14, + "offset": 646 + }, + "end": { + "line": 12, + "column": 54, + "offset": 837 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "note on process I/O", + "position": { + "start": { + "line": 12, + "column": 55, + "offset": 838 + }, + "end": { + "line": 12, + "column": 76, + "offset": 859 + } + } + } + ], + "position": { + "start": { + "line": 12, + "column": 55, + "offset": 838 + }, + "end": { + "line": 12, + "column": 76, + "offset": 859 + } + } + } + ], + "position": { + "start": { + "line": 12, + "column": 54, + "offset": 837 + }, + "end": { + "line": 12, + "column": 153, + "offset": 936 + } + } + }, + { + "type": "text", + "value": " for\nmore information.", + "position": { + "start": { + "line": 12, + "column": 153, + "offset": 936 + }, + "end": { + "line": 13, + "column": 18, + "offset": 958 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 1, + "offset": 633 + }, + "end": { + "line": 13, + "column": 18, + "offset": 958 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Example using the global ", + "position": { + "start": { + "line": 15, + "column": 1, + "offset": 960 + }, + "end": { + "line": 15, + "column": 26, + "offset": 985 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 15, + "column": 26, + "offset": 985 + }, + "end": { + "line": 15, + "column": 35, + "offset": 994 + } + } + } + ], + "position": { + "start": { + "line": 15, + "column": 26, + "offset": 985 + }, + "end": { + "line": 15, + "column": 35, + "offset": 994 + } + } + }, + { + "type": "text", + "value": ":", + "position": { + "start": { + "line": 15, + "column": 35, + "offset": 994 + }, + "end": { + "line": 15, + "column": 36, + "offset": 995 + } + } + } + ], + "position": { + "start": { + "line": 15, + "column": 1, + "offset": 960 + }, + "end": { + "line": 15, + "column": 36, + "offset": 995 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "pre", + "properties": { + "class": "shiki vitesse-dark", + "style": "background-color:#121212;color:#dbd7caee", + "tabindex": "0" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to stdout" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello %s" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to stdout" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " Error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Whoops, something bad happened" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "));" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints error message and stack trace to stderr:" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Error: Whoops, something bad happened" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at [eval]:5:15" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at Script.runInThisContext (node:vm:132:18)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at Object.runInThisContext (node:vm:309:38)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at node:internal/process/execution:77:19" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at [eval]-wrapper:6:22" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at evalScript (node:internal/process/execution:76:60)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at node:internal/main/eval_string:23:3" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Will Robinson" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ";" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "warn" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Danger " + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "${" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "}" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "! Danger!" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: Danger Will Robinson! Danger!, to stderr" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Example using the ", + "position": { + "start": { + "line": 38, + "column": 1, + "offset": 1725 + }, + "end": { + "line": 38, + "column": 19, + "offset": 1743 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Console", + "position": { + "start": { + "line": 38, + "column": 19, + "offset": 1743 + }, + "end": { + "line": 38, + "column": 28, + "offset": 1752 + } + } + } + ], + "position": { + "start": { + "line": 38, + "column": 19, + "offset": 1743 + }, + "end": { + "line": 38, + "column": 28, + "offset": 1752 + } + } + }, + { + "type": "text", + "value": " class:", + "position": { + "start": { + "line": 38, + "column": 28, + "offset": 1752 + }, + "end": { + "line": 38, + "column": 35, + "offset": 1759 + } + } + } + ], + "position": { + "start": { + "line": 38, + "column": 1, + "offset": 1725 + }, + "end": { + "line": 38, + "column": 35, + "offset": 1759 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "pre", + "properties": { + "class": "shiki vitesse-dark", + "style": "background-color:#121212;color:#dbd7caee", + "tabindex": "0" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " out" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " getStreamSomehow" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "();" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " err" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " getStreamSomehow" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "();" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": " new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "Console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "out" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " err" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to out" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello %s" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to out" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " Error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Whoops, something bad happened" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "));" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: [Error: Whoops, something bad happened], to err" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Will Robinson" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ";" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "warn" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Danger " + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "${" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "}" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "! Danger!" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: Danger Will Robinson! Danger!, to err" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs twoslash-popup-docs-tags vp-doc" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-name" + }, + "children": [ + { + "type": "text", + "value": "@see" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-value" + }, + "children": [ + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://github.com/nodejs/node/blob/v22.x/lib/console.js" + }, + "children": [ + { + "type": "text", + "value": "source", + "position": { + "start": { + "line": 1, + "column": 2, + "offset": 1 + }, + "end": { + "line": 1, + "column": 8, + "offset": 7 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 67, + "offset": 66 + } + } + } + ] + } + ] + } + ] } ] } diff --git a/packages/vitepress-twoslash/test/out/highlights.ts.json b/packages/vitepress-twoslash/test/out/highlights.ts.json index 4a4e202df..ed651ae2c 100644 --- a/packages/vitepress-twoslash/test/out/highlights.ts.json +++ b/packages/vitepress-twoslash/test/out/highlights.ts.json @@ -1269,6 +1269,3425 @@ ] } ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs vp-doc" + }, + "children": [ + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 5, + "offset": 4 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 1, + "column": 5, + "offset": 4 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 5, + "offset": 4 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + }, + { + "type": "text", + "value": " module provides a simple debugging console that is similar to the\nJavaScript console mechanism provided by web browsers.", + "position": { + "start": { + "line": 1, + "column": 14, + "offset": 13 + }, + "end": { + "line": 2, + "column": 55, + "offset": 134 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 2, + "column": 55, + "offset": 134 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "The module exports two specific components:", + "position": { + "start": { + "line": 4, + "column": 1, + "offset": 136 + }, + "end": { + "line": 4, + "column": 44, + "offset": 179 + } + } + } + ], + "position": { + "start": { + "line": 4, + "column": 1, + "offset": 136 + }, + "end": { + "line": 4, + "column": 44, + "offset": 179 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "ul", + "properties": {}, + "children": [ + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "li", + "properties": {}, + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { + "line": 6, + "column": 3, + "offset": 183 + }, + "end": { + "line": 6, + "column": 5, + "offset": 185 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Console", + "position": { + "start": { + "line": 6, + "column": 5, + "offset": 185 + }, + "end": { + "line": 6, + "column": 14, + "offset": 194 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 5, + "offset": 185 + }, + "end": { + "line": 6, + "column": 14, + "offset": 194 + } + } + }, + { + "type": "text", + "value": " class with methods such as ", + "position": { + "start": { + "line": 6, + "column": 14, + "offset": 194 + }, + "end": { + "line": 6, + "column": 42, + "offset": 222 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.log()", + "position": { + "start": { + "line": 6, + "column": 42, + "offset": 222 + }, + "end": { + "line": 6, + "column": 57, + "offset": 237 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 42, + "offset": 222 + }, + "end": { + "line": 6, + "column": 57, + "offset": 237 + } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { + "line": 6, + "column": 57, + "offset": 237 + }, + "end": { + "line": 6, + "column": 59, + "offset": 239 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.error()", + "position": { + "start": { + "line": 6, + "column": 59, + "offset": 239 + }, + "end": { + "line": 6, + "column": 76, + "offset": 256 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 59, + "offset": 239 + }, + "end": { + "line": 6, + "column": 76, + "offset": 256 + } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { + "line": 6, + "column": 76, + "offset": 256 + }, + "end": { + "line": 6, + "column": 81, + "offset": 261 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console.warn()", + "position": { + "start": { + "line": 6, + "column": 81, + "offset": 261 + }, + "end": { + "line": 6, + "column": 97, + "offset": 277 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 81, + "offset": 261 + }, + "end": { + "line": 6, + "column": 97, + "offset": 277 + } + } + }, + { + "type": "text", + "value": " that can be used to write to any Node.js stream.", + "position": { + "start": { + "line": 6, + "column": 97, + "offset": 277 + }, + "end": { + "line": 6, + "column": 146, + "offset": 326 + } + } + } + ], + "position": { + "start": { + "line": 6, + "column": 1, + "offset": 181 + }, + "end": { + "line": 6, + "column": 146, + "offset": 326 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "li", + "properties": {}, + "children": [ + { + "type": "text", + "value": "A global ", + "position": { + "start": { + "line": 7, + "column": 3, + "offset": 329 + }, + "end": { + "line": 7, + "column": 12, + "offset": 338 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 7, + "column": 12, + "offset": 338 + }, + "end": { + "line": 7, + "column": 21, + "offset": 347 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 12, + "offset": 338 + }, + "end": { + "line": 7, + "column": 21, + "offset": 347 + } + } + }, + { + "type": "text", + "value": " instance configured to write to ", + "position": { + "start": { + "line": 7, + "column": 21, + "offset": 347 + }, + "end": { + "line": 7, + "column": 54, + "offset": 380 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "process.stdout", + "position": { + "start": { + "line": 7, + "column": 55, + "offset": 381 + }, + "end": { + "line": 7, + "column": 71, + "offset": 397 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 55, + "offset": 381 + }, + "end": { + "line": 7, + "column": 71, + "offset": 397 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 54, + "offset": 380 + }, + "end": { + "line": 7, + "column": 141, + "offset": 467 + } + } + }, + { + "type": "text", + "value": " and\n", + "position": { + "start": { + "line": 7, + "column": 141, + "offset": 467 + }, + "end": { + "line": 8, + "column": 1, + "offset": 472 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "process.stderr", + "position": { + "start": { + "line": 8, + "column": 2, + "offset": 473 + }, + "end": { + "line": 8, + "column": 18, + "offset": 489 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 2, + "offset": 473 + }, + "end": { + "line": 8, + "column": 18, + "offset": 489 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 1, + "offset": 472 + }, + "end": { + "line": 8, + "column": 88, + "offset": 559 + } + } + }, + { + "type": "text", + "value": ". The global ", + "position": { + "start": { + "line": 8, + "column": 88, + "offset": 559 + }, + "end": { + "line": 8, + "column": 101, + "offset": 572 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 8, + "column": 101, + "offset": 572 + }, + "end": { + "line": 8, + "column": 110, + "offset": 581 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 101, + "offset": 572 + }, + "end": { + "line": 8, + "column": 110, + "offset": 581 + } + } + }, + { + "type": "text", + "value": " can be used without calling ", + "position": { + "start": { + "line": 8, + "column": 110, + "offset": 581 + }, + "end": { + "line": 8, + "column": 139, + "offset": 610 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "require('console')", + "position": { + "start": { + "line": 8, + "column": 139, + "offset": 610 + }, + "end": { + "line": 8, + "column": 159, + "offset": 630 + } + } + } + ], + "position": { + "start": { + "line": 8, + "column": 139, + "offset": 610 + }, + "end": { + "line": 8, + "column": 159, + "offset": 630 + } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { + "line": 8, + "column": 159, + "offset": 630 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + } + ], + "position": { + "start": { + "line": 7, + "column": 1, + "offset": 327 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + }, + { + "type": "text", + "value": "\n" + } + ], + "position": { + "start": { + "line": 6, + "column": 1, + "offset": 181 + }, + "end": { + "line": 8, + "column": 160, + "offset": 631 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "em", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "strong", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Warning", + "position": { + "start": { + "line": 10, + "column": 4, + "offset": 636 + }, + "end": { + "line": 10, + "column": 11, + "offset": 643 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 2, + "offset": 634 + }, + "end": { + "line": 10, + "column": 13, + "offset": 645 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 1, + "offset": 633 + }, + "end": { + "line": 10, + "column": 14, + "offset": 646 + } + } + }, + { + "type": "text", + "value": ": The global console object's methods are neither consistently\nsynchronous like the browser APIs they resemble, nor are they consistently\nasynchronous like all other Node.js streams. See the ", + "position": { + "start": { + "line": 10, + "column": 14, + "offset": 646 + }, + "end": { + "line": 12, + "column": 54, + "offset": 837 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "note on process I/O", + "position": { + "start": { + "line": 12, + "column": 55, + "offset": 838 + }, + "end": { + "line": 12, + "column": 76, + "offset": 859 + } + } + } + ], + "position": { + "start": { + "line": 12, + "column": 55, + "offset": 838 + }, + "end": { + "line": 12, + "column": 76, + "offset": 859 + } + } + } + ], + "position": { + "start": { + "line": 12, + "column": 54, + "offset": 837 + }, + "end": { + "line": 12, + "column": 153, + "offset": 936 + } + } + }, + { + "type": "text", + "value": " for\nmore information.", + "position": { + "start": { + "line": 12, + "column": 153, + "offset": 936 + }, + "end": { + "line": 13, + "column": 18, + "offset": 958 + } + } + } + ], + "position": { + "start": { + "line": 10, + "column": 1, + "offset": 633 + }, + "end": { + "line": 13, + "column": 18, + "offset": 958 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Example using the global ", + "position": { + "start": { + "line": 15, + "column": 1, + "offset": 960 + }, + "end": { + "line": 15, + "column": 26, + "offset": 985 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "console", + "position": { + "start": { + "line": 15, + "column": 26, + "offset": 985 + }, + "end": { + "line": 15, + "column": 35, + "offset": 994 + } + } + } + ], + "position": { + "start": { + "line": 15, + "column": 26, + "offset": 985 + }, + "end": { + "line": 15, + "column": 35, + "offset": 994 + } + } + }, + { + "type": "text", + "value": ":", + "position": { + "start": { + "line": 15, + "column": 35, + "offset": 994 + }, + "end": { + "line": 15, + "column": 36, + "offset": 995 + } + } + } + ], + "position": { + "start": { + "line": 15, + "column": 1, + "offset": 960 + }, + "end": { + "line": 15, + "column": 36, + "offset": 995 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "pre", + "properties": { + "class": "shiki vitesse-dark", + "style": "background-color:#121212;color:#dbd7caee", + "tabindex": "0" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to stdout" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello %s" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to stdout" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " Error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Whoops, something bad happened" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "));" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints error message and stack trace to stderr:" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Error: Whoops, something bad happened" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at [eval]:5:15" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at Script.runInThisContext (node:vm:132:18)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at Object.runInThisContext (node:vm:309:38)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at node:internal/process/execution:77:19" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at [eval]-wrapper:6:22" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at evalScript (node:internal/process/execution:76:60)" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// at node:internal/main/eval_string:23:3" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Will Robinson" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ";" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "warn" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Danger " + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "${" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "}" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "! Danger!" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: Danger Will Robinson! Danger!, to stderr" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Example using the ", + "position": { + "start": { + "line": 38, + "column": 1, + "offset": 1725 + }, + "end": { + "line": 38, + "column": 19, + "offset": 1743 + } + } + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "Console", + "position": { + "start": { + "line": 38, + "column": 19, + "offset": 1743 + }, + "end": { + "line": 38, + "column": 28, + "offset": 1752 + } + } + } + ], + "position": { + "start": { + "line": 38, + "column": 19, + "offset": 1743 + }, + "end": { + "line": 38, + "column": 28, + "offset": 1752 + } + } + }, + { + "type": "text", + "value": " class:", + "position": { + "start": { + "line": 38, + "column": 28, + "offset": 1752 + }, + "end": { + "line": 38, + "column": 35, + "offset": 1759 + } + } + } + ], + "position": { + "start": { + "line": 38, + "column": 1, + "offset": 1725 + }, + "end": { + "line": 38, + "column": 35, + "offset": 1759 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "pre", + "properties": { + "class": "shiki vitesse-dark", + "style": "background-color:#121212;color:#dbd7caee", + "tabindex": "0" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " out" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " getStreamSomehow" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "();" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " err" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " getStreamSomehow" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "();" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": " new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "Console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "out" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " err" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to out" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "hello %s" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "world" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: hello world, to out" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "new" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": " Error" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Whoops, something bad happened" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "));" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: [Error: Whoops, something bad happened], to err" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": " '" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Will Robinson" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ";" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "myConsole" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "warn" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "Danger " + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "${" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "name" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4D9375" + }, + "children": [ + { + "type": "text", + "value": "}" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "! Danger!" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "`" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: Danger Will Robinson! Danger!, to err" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs twoslash-popup-docs-tags vp-doc" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-name" + }, + "children": [ + { + "type": "text", + "value": "@see" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-value" + }, + "children": [ + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://github.com/nodejs/node/blob/v22.x/lib/console.js" + }, + "children": [ + { + "type": "text", + "value": "source", + "position": { + "start": { + "line": 1, + "column": 2, + "offset": 1 + }, + "end": { + "line": 1, + "column": 8, + "offset": 7 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 67, + "offset": 66 + } + } + } + ] + } + ] + } + ] } ] } @@ -1354,7 +4773,137 @@ "children": [ { "type": "text", - "value": "Console" + "value": "Console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "message" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "?:" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " any" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " ..." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "optionalParams" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#DBD7CAEE" + }, + "children": [ + { + "type": "text", + "value": ": " } ] }, @@ -1362,12 +4911,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#666666" + "style": "color:#BD976A" }, "children": [ { "type": "text", - "value": "." + "value": "any" } ] }, @@ -1375,12 +4924,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#80A665" + "style": "color:#666666" }, "children": [ { "type": "text", - "value": "log" + "value": "[])" } ] }, @@ -1388,12 +4937,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#666666" + "style": "color:#DBD7CAEE" }, "children": [ { "type": "text", - "value": "(..." + "value": ": " } ] }, @@ -1401,12 +4950,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#BD976A" + "style": "color:#CB7676" }, "children": [ { "type": "text", - "value": "data" + "value": "void" } ] }, @@ -1414,12 +4963,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#DBD7CAEE" + "style": "color:#666666" }, "children": [ { "type": "text", - "value": ": " + "value": " (" } ] }, @@ -1427,12 +4976,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#BD976A" + "style": "color:#CB7676" }, "children": [ { "type": "text", - "value": "any" + "value": "+" } ] }, @@ -1440,12 +4989,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#666666" + "style": "color:#4C9A91" }, "children": [ { "type": "text", - "value": "[])" + "value": "1" } ] }, @@ -1453,12 +5002,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#DBD7CAEE" + "style": "color:#BD976A" }, "children": [ { "type": "text", - "value": ": " + "value": " overload" } ] }, @@ -1466,12 +5015,12 @@ "type": "element", "tagName": "span", "properties": { - "style": "color:#CB7676" + "style": "color:#666666" }, "children": [ { "type": "text", - "value": "void" + "value": ")" } ] } @@ -1489,26 +5038,40 @@ "tagName": "p", "properties": {}, "children": [ + { + "type": "text", + "value": "Prints to ", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 11, + "offset": 10 + } + } + }, { "type": "element", - "tagName": "a", - "properties": { - "href": "https://developer.mozilla.org/docs/Web/API/console/log_static" - }, + "tagName": "code", + "properties": {}, "children": [ { "type": "text", - "value": "MDN Reference", + "value": "stdout", "position": { "start": { "line": 1, - "column": 2, - "offset": 1 + "column": 11, + "offset": 10 }, "end": { "line": 1, - "column": 15, - "offset": 14 + "column": 19, + "offset": 18 } } } @@ -1516,13 +5079,173 @@ "position": { "start": { "line": 1, - "column": 1, - "offset": 0 + "column": 11, + "offset": 10 }, "end": { "line": 1, - "column": 79, - "offset": 78 + "column": 19, + "offset": 18 + } + } + }, + { + "type": "text", + "value": " with newline. Multiple arguments can be passed, with the\nfirst used as the primary message and all additional used as substitution\nvalues similar to ", + "position": { + "start": { + "line": 1, + "column": 19, + "offset": 18 + }, + "end": { + "line": 3, + "column": 19, + "offset": 168 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "http://man7.org/linux/man-pages/man3/printf.3.html" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "printf(3)", + "position": { + "start": { + "line": 3, + "column": 20, + "offset": 169 + }, + "end": { + "line": 3, + "column": 31, + "offset": 180 + } + } + } + ], + "position": { + "start": { + "line": 3, + "column": 20, + "offset": 169 + }, + "end": { + "line": 3, + "column": 31, + "offset": 180 + } + } + } + ], + "position": { + "start": { + "line": 3, + "column": 19, + "offset": 168 + }, + "end": { + "line": 3, + "column": 84, + "offset": 233 + } + } + }, + { + "type": "text", + "value": "\n(the arguments are all passed to ", + "position": { + "start": { + "line": 3, + "column": 84, + "offset": 233 + }, + "end": { + "line": 4, + "column": 34, + "offset": 267 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "util.format()", + "position": { + "start": { + "line": 4, + "column": 35, + "offset": 268 + }, + "end": { + "line": 4, + "column": 50, + "offset": 283 + } + } + } + ], + "position": { + "start": { + "line": 4, + "column": 35, + "offset": 268 + }, + "end": { + "line": 4, + "column": 50, + "offset": 283 + } + } + } + ], + "position": { + "start": { + "line": 4, + "column": 34, + "offset": 267 + }, + "end": { + "line": 4, + "column": 125, + "offset": 358 + } + } + }, + { + "type": "text", + "value": ").", + "position": { + "start": { + "line": 4, + "column": 125, + "offset": 358 + }, + "end": { + "line": 4, + "column": 127, + "offset": 360 } } } @@ -1534,13 +5257,621 @@ "offset": 0 }, "end": { - "line": 1, - "column": 79, - "offset": 78 + "line": 4, + "column": 127, + "offset": 360 + } + } + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "pre", + "properties": { + "class": "shiki vitesse-dark", + "style": "background-color:#121212;color:#dbd7caee", + "tabindex": "0" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#CB7676" + }, + "children": [ + { + "type": "text", + "value": "const" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " count" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": " =" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#4C9A91" + }, + "children": [ + { + "type": "text", + "value": " 5" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ";" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "count: %d" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " count" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: count: 5, to stdout" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": "console" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "." + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#80A665" + }, + "children": [ + { + "type": "text", + "value": "log" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "(" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D" + }, + "children": [ + { + "type": "text", + "value": "count:" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#C98A7D77" + }, + "children": [ + { + "type": "text", + "value": "'" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": "," + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#BD976A" + }, + "children": [ + { + "type": "text", + "value": " count" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#666666" + }, + "children": [ + { + "type": "text", + "value": ");" + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "line" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "style": "color:#758575DD" + }, + "children": [ + { + "type": "text", + "value": "// Prints: count: 5, to stdout" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "text", + "value": "\n" + }, + { + "type": "element", + "tagName": "p", + "properties": {}, + "children": [ + { + "type": "text", + "value": "See ", + "position": { + "start": { + "line": 14, + "column": 1, + "offset": 515 + }, + "end": { + "line": 14, + "column": 5, + "offset": 519 + } + } + }, + { + "type": "element", + "tagName": "a", + "properties": { + "href": "https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args" + }, + "children": [ + { + "type": "element", + "tagName": "code", + "properties": {}, + "children": [ + { + "type": "text", + "value": "util.format()", + "position": { + "start": { + "line": 14, + "column": 6, + "offset": 520 + }, + "end": { + "line": 14, + "column": 21, + "offset": 535 + } + } + } + ], + "position": { + "start": { + "line": 14, + "column": 6, + "offset": 520 + }, + "end": { + "line": 14, + "column": 21, + "offset": 535 + } + } + } + ], + "position": { + "start": { + "line": 14, + "column": 5, + "offset": 519 + }, + "end": { + "line": 14, + "column": 96, + "offset": 610 + } + } + }, + { + "type": "text", + "value": " for more information.", + "position": { + "start": { + "line": 14, + "column": 96, + "offset": 610 + }, + "end": { + "line": 14, + "column": 118, + "offset": 632 + } + } + } + ], + "position": { + "start": { + "line": 14, + "column": 1, + "offset": 515 + }, + "end": { + "line": 14, + "column": 118, + "offset": 632 } } } ] + }, + { + "type": "element", + "tagName": "div", + "properties": { + "class": "twoslash-popup-docs twoslash-popup-docs-tags vp-doc" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag" + }, + "children": [ + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-name" + }, + "children": [ + { + "type": "text", + "value": "@since" + } + ] + }, + { + "type": "element", + "tagName": "span", + "properties": { + "class": "twoslash-popup-docs-tag-value" + }, + "children": [ + { + "type": "text", + "value": "v0.1.100", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 9, + "offset": 8 + } + } + } + ] + } + ] + } + ] } ] }