🎥 Make videos programmatically with React
some more progress
Jonny Burgerff6e5d7312ad
diff --git a/packages/docusaurus-plugin/package.json b/packages/docusaurus-plugin/package.jsonindex a306fdfa54..d403bab93c 100644--- a/packages/docusaurus-plugin/package.json+++ b/packages/docusaurus-plugin/package.json@@ -19,8 +19,7 @@"fenceparser": "^2.2.0","shiki": "0.10.1","@typescript/twoslash": "3.2.1",- "@docusaurus/types": "3.4.0",- "@types/unist": "3.0.2"+ "@docusaurus/types": "3.4.0"},"private": true}diff --git a/packages/docusaurus-plugin/src/caching.ts b/packages/docusaurus-plugin/src/caching.tsindex 11c76f504d..ff2e69d947 100644--- a/packages/docusaurus-plugin/src/caching.ts+++ b/packages/docusaurus-plugin/src/caching.ts@@ -1,4 +1,6 @@-import {UserConfigSettings, runTwoSlash} from 'shiki-twoslash';+import type {TwoSlashReturn} from '@typescript/twoslash';+import type {UserConfigSettings} from 'shiki-twoslash';+import {runTwoSlash} from 'shiki-twoslash';/*** Keeps a cache of the JSON responses to a twoslash call in node_modules/.cache/twoslash@@ -9,7 +11,7 @@ export const cachedTwoslashCall = (code: string,lang: string,settings: UserConfigSettings,-) => {+): TwoSlashReturn => {const isWebWorker =typeof self !== 'undefined' &&// @ts-expect-errordiff --git a/packages/docusaurus-plugin/src/exceptionMessageDOM.ts b/packages/docusaurus-plugin/src/exceptionMessageDOM.tsindex e07a9ac73c..18c5b428ac 100644--- a/packages/docusaurus-plugin/src/exceptionMessageDOM.ts+++ b/packages/docusaurus-plugin/src/exceptionMessageDOM.ts@@ -145,8 +145,6 @@ export const setupNodeForTwoslashException = (<div class='twoslash-exception-message'>${body}${codeSample}</div>`;node.type = 'html';- // @ts-expect-errornode.value = "<div id='twoslash-error'>" + css + html + '</div>';- // @ts-expect-errornode.children = [];};diff --git a/packages/docusaurus-plugin/src/shiki.ts b/packages/docusaurus-plugin/src/shiki.tsindex 4c2b0a5cc9..82e812c523 100644--- a/packages/docusaurus-plugin/src/shiki.ts+++ b/packages/docusaurus-plugin/src/shiki.ts@@ -5,13 +5,13 @@ import type {Highlighter} from 'shiki';import {getHighlighter} from 'shiki';import type {UserConfigSettings} from 'shiki-twoslash';import {renderCodeToHTML} from 'shiki-twoslash';-import type {Node} from 'unist';import {visit} from 'unist-util-visit';import type {BuildVisitor, UnistNode} from 'unist-util-visit/lib';import {cachedTwoslashCall} from './caching';import {setupNodeForTwoslashException} from './exceptionMessageDOM';import {addIncludes, replaceIncludesInCode} from './includes';+import type {Node} from './unist-types';type OBJECT = Record<string, any>;@@ -168,7 +168,6 @@ const remarkVisitor =let fence;try {- // @ts-expect-errorfence = parseFence([node.lang, node.meta].filter(Boolean).join(' '));} catch (error) {const twoslashError = new TwoslashError(@@ -195,8 +194,7 @@ const remarkVisitor =try {// By allowing node.twoslash to already exist you can set it up yourself in a browsertwoslash =- // @ts-expect-error- node.twoslash || runTwoSlashOnNode(code, fence, twoslashSettings);+ node.twoslash || runTwoSlashOnNode(code.value, fence, twoslashSettings);} catch (error) {const shouldAlwaysRaise =process && process.env && Boolean(process.env.CI);@@ -216,7 +214,6 @@ const remarkVisitor =if (twoslash) {node.value = twoslash.code;node.lang = twoslash.extension;- // @ts-expect-errornode.twoslash = twoslash;}@@ -229,7 +226,6 @@ const remarkVisitor =);node.type = 'html';node.value = shikiHTML;- // @ts-expect-errornode.children = [];};diff --git a/packages/docusaurus-plugin/src/unist-types.ts b/packages/docusaurus-plugin/src/unist-types.tsindex 271b42cab7..04bd5e8c65 100644--- a/packages/docusaurus-plugin/src/unist-types.ts+++ b/packages/docusaurus-plugin/src/unist-types.ts@@ -1,5 +1,7 @@// ## Interfaces+import type {TwoSlashReturn} from '@typescript/twoslash';+/*** Info associated with nodes by the ecosystem.*@@ -70,7 +72,7 @@ export interface Literal extends Node {/*** Plain value.*/- value: unknown;+ value: string;}/**@@ -87,7 +89,7 @@ export interface Node {/*** Node type.*/- type: string;+ type: 'code' | 'html';/*** Info from the ecosystem.@@ -101,6 +103,11 @@ export interface Node {* have a position.*/position?: Position | undefined;+ value: string;+ lang: string;+ meta?: string;+ children?: Node[];+ twoslash?: TwoSlashReturn;}/**diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 7b455dede9..55e1b33304 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -613,9 +613,6 @@ importers:'@docusaurus/types':specifier: 3.4.0version: 3.4.0([email protected])([email protected])- '@types/unist':- specifier: 3.0.2- version: 3.0.2'@typescript/twoslash':specifier: 3.2.1version: 3.2.1