From 0eb2229bea9c27ff74a0312ee19887b7ec7b5c8c Mon Sep 17 00:00:00 2001 From: stevejpurves Date: Mon, 26 Aug 2024 20:40:31 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8A=F0=9F=8F=BD=20bump=20thebe=20-=20c?= =?UTF-8?q?onsume=20passive=20manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 33 +++++++++++------------ package.json | 5 +--- packages/jupyter/package.json | 6 ++--- packages/jupyter/src/execute/actions.ts | 9 +++++-- packages/jupyter/src/execute/provider.tsx | 28 +++++++++---------- packages/jupyter/src/execute/types.ts | 13 ++++++--- packages/site/package.json | 2 +- 7 files changed, 48 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index aec163543..bb0200f8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,6 @@ "styles", "docs" ], - "dependencies": { - "thebe-core": "file:../../GitHub/thebe/thebe/packages/core/thebe-core-0.4.7.tgz" - }, "devDependencies": { "@changesets/cli": "^2.26.1", "@remix-run/node": "~1.17.0", @@ -36640,9 +36637,9 @@ "dev": true }, "node_modules/thebe-core": { - "version": "0.4.7", - "resolved": "file:../../GitHub/thebe/thebe/packages/core/thebe-core-0.4.7.tgz", - "integrity": "sha512-C1+6rEQ9He8nEO543MArUvKc872Fv9YqmbFiYtYJkDU2qV2FJJwGXRRpuAyKqG3gWyNy+gqgJUH+3pgj1ERd8Q==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/thebe-core/-/thebe-core-0.4.9.tgz", + "integrity": "sha512-vFPxBdLD2CwEjbGCjK/H8chITBDTQVAwF/A/wQaVsJ7fd+2r+IpuCZzbW7qb4Zf+aLIo3ILVfTHYE7WHnfvqxg==", "license": "MIT", "dependencies": { "@jupyter-widgets/base": "^6.0.6", @@ -36668,7 +36665,7 @@ "copy-thebe-assets": "bin/copy-thebe-assets.cjs" }, "peerDependencies": { - "thebe-lite": "^0.4.7" + "thebe-lite": "^0.4.9" } }, "node_modules/thebe-core/node_modules/nanoid": { @@ -36689,9 +36686,9 @@ } }, "node_modules/thebe-lite": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/thebe-lite/-/thebe-lite-0.4.7.tgz", - "integrity": "sha512-k5E/GIlwAHoHhEjLopms8nLSnZypDzwbDHSdqSDtzO2Q4Xoz/1mNZQsmhIRxyZUmT2Hh8nWIXuqRiWF46P+0OA==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/thebe-lite/-/thebe-lite-0.4.9.tgz", + "integrity": "sha512-UJv+vXCX+jaIejKxEEUCb5K/MCpT0gDC7eU6ZDJTrPyBhYXWHWW+6LTPkYZxLMFvJZ4RxxHSwpqbf//lcQQGlw==", "license": "MIT", "dependencies": { "@jupyterlab/coreutils": "^6.0.8", @@ -36703,15 +36700,15 @@ } }, "node_modules/thebe-react": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/thebe-react/-/thebe-react-0.4.7.tgz", - "integrity": "sha512-pL22DLZKwhspUoHNyQVKaSbOrqfIZMzzfW3cIUqBVAFHVWZsXHdtlQ3rogh1PEPtnftlkIYfmeroHeeIfP+nDg==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/thebe-react/-/thebe-react-0.4.9.tgz", + "integrity": "sha512-FYstHIFMfmXbS+bj0ZkvD1KCL+jmNUYJLPy1xKkiYneiQ1nfCbcP4X0jhiVCQaC1PIh9RqCYBhljKmCLJGTqyQ==", "license": "MIT", "dependencies": { "@jupyterlab/nbformat": "^3.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", - "thebe-core": "^0.4.7" + "thebe-core": "^0.4.9" } }, "node_modules/thebe-react/node_modules/@jupyterlab/nbformat": { @@ -39654,9 +39651,9 @@ "nbtx": "^0.2.3", "react-syntax-highlighter": "^15.5.0", "swr": "^2.1.5", - "thebe-core": "0.4.7", - "thebe-lite": "0.4.7", - "thebe-react": "0.4.7", + "thebe-core": "^0.4.9", + "thebe-lite": "^0.4.9", + "thebe-react": "^0.4.9", "unist-util-select": "^4.0.3" }, "engines": { @@ -39895,7 +39892,7 @@ "nbtx": "^0.2.3", "node-cache": "^5.1.2", "node-fetch": "^2.6.11", - "thebe-react": "0.4.7", + "thebe-react": "^0.4.9", "unist-util-select": "^4.0.1" }, "devDependencies": { diff --git a/package.json b/package.json index e1fdc3341..b94d33f6c 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,5 @@ "npm": ">=7.0.0", "node": ">=14.0.0" }, - "packageManager": "npm@8.10.0", - "dependencies": { - "thebe-core": "file:../../GitHub/thebe/thebe/packages/core/thebe-core-0.4.7.tgz" - } + "packageManager": "npm@8.10.0" } diff --git a/packages/jupyter/package.json b/packages/jupyter/package.json index 1b974197e..1760c674d 100644 --- a/packages/jupyter/package.json +++ b/packages/jupyter/package.json @@ -40,9 +40,9 @@ "nbtx": "^0.2.3", "react-syntax-highlighter": "^15.5.0", "swr": "^2.1.5", - "thebe-core": "0.4.7", - "thebe-lite": "0.4.7", - "thebe-react": "0.4.7", + "thebe-core": "^0.4.9", + "thebe-lite": "^0.4.9", + "thebe-react": "^0.4.9", "unist-util-select": "^4.0.3" }, "peerDependencies": { diff --git a/packages/jupyter/src/execute/actions.ts b/packages/jupyter/src/execute/actions.ts index 039634599..3848c36e7 100644 --- a/packages/jupyter/src/execute/actions.ts +++ b/packages/jupyter/src/execute/actions.ts @@ -1,6 +1,11 @@ import type { SourceFileKind, Dependency } from 'myst-spec-ext'; import type { BuildStatus, Computable } from './types.js'; -import type { IRenderMimeRegistry, ThebeNotebook, ThebeSession } from 'thebe-core'; +import type { + IRenderMimeRegistry, + ThebeNotebook, + ThebePassiveManager, + ThebeSession, +} from 'thebe-core'; import type { GenericParent } from 'myst-common'; export function isNavigatePayload(payload: unknown): payload is NavigatePayload { @@ -90,7 +95,7 @@ interface AddNotebookPayload { } interface AddPassivePayload { - manager: any; //TODO ThebePassiveManager + manager: ThebePassiveManager; rendermime: IRenderMimeRegistry; pageSlug: string; } diff --git a/packages/jupyter/src/execute/provider.tsx b/packages/jupyter/src/execute/provider.tsx index edaa1968a..3dc819531 100644 --- a/packages/jupyter/src/execute/provider.tsx +++ b/packages/jupyter/src/execute/provider.tsx @@ -13,8 +13,8 @@ import { } from './selectors.js'; import { MdastFetcher, NotebookBuilder, ServerMonitor, SessionStarter } from './leaf.js'; import type { GenericParent } from 'myst-common'; -import { WidgetsMetaData } from '../../../common/dist/types.js'; -import {useThebeLoader} from 'thebe-react'; +import type { WidgetsMetaData } from '@myst-theme/common'; +import { useThebeLoader } from 'thebe-react'; export interface ExecuteScopeType { canCompute: boolean; @@ -32,7 +32,7 @@ type ArticleContents = { mdast: GenericParent; location?: string; dependencies?: Dependency[]; - widgets?:WidgetsMetaData; + widgets?: WidgetsMetaData; }; function useScopeNavigate({ @@ -109,34 +109,30 @@ export function ExecuteScopeProvider({ children, enable, contents, -}: React.PropsWithChildren<{ enable: boolean; contents: ArticleContents ;}>) { +}: React.PropsWithChildren<{ enable: boolean; contents: ArticleContents }>) { // compute incoming for first render const computables: Computable[] = listComputables(contents.mdast); const fallbackLocation = contents.kind === SourceFileKind.Notebook ? '/fallback.ipynb' : '/'; - const { core } = useThebeLoader(); - const [isCoreLoaded, setIsCoreLoaded] = useState(false); - useEffect(() => { - if (core) { - setIsCoreLoaded(true); - } - }, [core]); useEffect(() => { - if (isCoreLoaded && core) { + if (core) { const rendermime = core.makeRenderMimeRegistry(); - const manager = new core.ThebePassiveManager(rendermime, contents?.widgets?.["application/vnd.jupyter.widget-state+json"]); + const manager = new core.ThebePassiveManager( + rendermime, + contents?.widgets?.['application/vnd.jupyter.widget-state+json'], + ); dispatch({ type: 'ADD_PASSIVE', payload: { rendermime, manager, - pageSlug:contents.slug + pageSlug: contents.slug, }, }); } - }, [isCoreLoaded, core, contents?.widgets]); + }, [core, contents?.widgets]); const initialState: ExecuteScopeState = { mdast: { @@ -152,7 +148,7 @@ export function ExecuteScopeProvider({ computables, ready: false, scopes: {}, - passive: undefined + passive: undefined, }, }, builds: {}, diff --git a/packages/jupyter/src/execute/types.ts b/packages/jupyter/src/execute/types.ts index f40a826b0..ab12276bb 100644 --- a/packages/jupyter/src/execute/types.ts +++ b/packages/jupyter/src/execute/types.ts @@ -1,6 +1,11 @@ import type { GenericParent } from 'myst-common'; import type { SourceFileKind, Dependency } from 'myst-spec-ext'; -import type { IRenderMimeRegistry, ThebeNotebook, ThebeSession, ThebePassiveManager } from 'thebe-core'; +import type { + IRenderMimeRegistry, + ThebeNotebook, + ThebeSession, + ThebePassiveManager, +} from 'thebe-core'; export type BuildStatus = | 'pending' @@ -33,10 +38,10 @@ export interface ExecuteScopeState { scopes: { [notebookSlug: string]: ExecutionScope; }; - passive? : { + passive?: { manager: ThebePassiveManager; - rendermime: IRenderMimeRegistry - } + rendermime: IRenderMimeRegistry; + }; }; }; builds: { diff --git a/packages/site/package.json b/packages/site/package.json index a9ded4192..09599fe72 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -37,7 +37,7 @@ "nbtx": "^0.2.3", "node-cache": "^5.1.2", "node-fetch": "^2.6.11", - "thebe-react": "0.4.7", + "thebe-react": "^0.4.9", "unist-util-select": "^4.0.1" }, "peerDependencies": {