Skip to content

Commit a64fee1

Browse files
choldgrafrowanc1
andauthored
Revert thebe (#2903)
Co-authored-by: Rowan Cockett <rowanc1@gmail.com>
1 parent f3d6c01 commit a64fee1

2 files changed

Lines changed: 11 additions & 21 deletions

File tree

‎.changeset/thin-chefs-glow.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"myst-cli": patch
3+
---
4+
5+
Revert stopping of thebe-copy for static build assets

‎packages/myst-cli/src/build/html/index.ts‎

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,6 @@ import type { LocalProjectPage } from '../../project/types.js';
2525

2626
const limitConnections = pLimit(5);
2727

28-
/**
29-
* Return true if any project in the current site has thebe configured.
30-
* `project: jupyter: ...` aliases to `project: thebe`.
31-
*/
32-
function siteUsesThebe(session: ISession): boolean {
33-
const state = session.store.getState();
34-
const siteConfig = selectors.selectCurrentSiteConfig(state);
35-
return (siteConfig?.projects ?? []).some(
36-
(proj) => !!proj.path && !!selectors.selectLocalProjectConfig(state, proj.path)?.thebe,
37-
);
38-
}
39-
4028
export async function currentSiteRoutes(
4129
session: ISession,
4230
host: string,
@@ -212,16 +200,13 @@ export async function buildHtml(session: ISession, opts: StartOptions) {
212200
);
213201
await appServer.stop();
214202

215-
// Copy files for the template used.
216-
217-
// Skip thebe JS chunks unless they are required.
203+
// Copy the files for the template used.
204+
//
205+
// This always includes the thebe JS chunks, even when no project enables
206+
// `thebe`/`jupyter`. The myst-theme uses thebe-core to render Jupyter cell
207+
// outputs, so these chunks are required for outputs to render at all.
218208
const templateBuildDir = path.join(template.templatePath, 'public');
219-
const hasThebe = siteUsesThebe(session);
220-
fs.copySync(templateBuildDir, htmlDir, {
221-
filter: (src) =>
222-
hasThebe ||
223-
!path.basename(src).match(/^(\d+\.)?(thebe-(core|lite)(\.min)?\.js|thebe-core.*\.css)$/),
224-
});
209+
fs.copySync(templateBuildDir, htmlDir);
225210

226211
// Copy all of the static assets
227212
fs.copySync(session.publicPath(), path.join(htmlDir, 'build'));

0 commit comments

Comments
 (0)