diff --git a/package-lock.json b/package-lock.json index ad2568c5..36016a41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "hastscript": "^9.0.1", "lightningcss": "^1.30.1", "mdast-util-slice-markdown": "^2.0.1", - "mustache": "^4.2.0", "preact": "^10.26.9", "preact-render-to-string": "^6.5.13", "reading-time": "^1.5.0", @@ -7987,15 +7986,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, - "node_modules/mustache": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", - "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", - "license": "MIT", - "bin": { - "mustache": "bin/mustache" - } - }, "node_modules/nano-spawn": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nano-spawn/-/nano-spawn-1.0.2.tgz", diff --git a/package.json b/package.json index 4c648a68..6b694bb9 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "hastscript": "^9.0.1", "lightningcss": "^1.30.1", "mdast-util-slice-markdown": "^2.0.1", - "mustache": "^4.2.0", "preact": "^10.26.9", "preact-render-to-string": "^6.5.13", "reading-time": "^1.5.0", diff --git a/src/generators/web/template.html b/src/generators/web/template.html index 04329751..12f867c3 100644 --- a/src/generators/web/template.html +++ b/src/generators/web/template.html @@ -18,8 +18,7 @@ -
{{{dehydrated}}}
- +
{{dehydrated}}
+ - - \ No newline at end of file + diff --git a/src/generators/web/utils/processing.mjs b/src/generators/web/utils/processing.mjs index e2380f93..8a953828 100644 --- a/src/generators/web/utils/processing.mjs +++ b/src/generators/web/utils/processing.mjs @@ -1,6 +1,5 @@ import HTMLMinifier from '@minify-html/node'; import { toJs, jsx } from 'estree-util-to-js'; -import Mustache from 'mustache'; import bundleCode from './bundle.mjs'; @@ -72,12 +71,13 @@ export async function processJSXEntry( const clientCode = buildClientProgram(code); const clientBundle = await bundleCode(clientCode); - // TODO(@avivkeller): Don't depend on Mustache - const renderedHtml = Mustache.render(template, { - title: `${entry.data.heading.data.name} | Node.js v${version} Documentation`, - dehydrated, - javascript: clientBundle.js, - }); + const title = `${entry.data.heading.data.name} | Node.js v${version} Documentation`; + + // Replace template placeholders with actual content + const renderedHtml = template + .replace('{{title}}', title) + .replace('{{dehydrated}}', dehydrated ?? '') + .replace('{{clientBundleJs}}', () => clientBundle.js); // The input to `minify` must be a Buffer. const finalHTMLBuffer = HTMLMinifier.minify(Buffer.from(renderedHtml), {});