deno.land / x / lume@v2.1.4 / tests / esbuild.test.ts
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384import { assertSiteSnapshot, build, getSite } from "./utils.ts";import esbuild from "../plugins/esbuild.ts";import jsx from "../plugins/jsx.ts";
// Disable sanitizeOps & sanitizeResources because esbuild doesn't close themDeno.test( "esbuild plugin", { sanitizeOps: false, sanitizeResources: false }, async (t) => { const site = getSite({ src: "esbuild", });
// Test ignore with a function filter site.ignore((path) => path === "/modules" || path.startsWith("/modules/")); site.use(esbuild());
await build(site); await assertSiteSnapshot(t, site); },);
// Disable sanitizeOps & sanitizeResources because esbuild doesn't close themDeno.test( "esbuild plugin with splitting as true", { sanitizeOps: false, sanitizeResources: false }, async (t) => { const site = getSite({ src: "esbuild", });
// Test ignore with a function filter site.ignore((path) => path === "/modules" || path.startsWith("/modules/")); site.use(esbuild({ options: { splitting: true, outdir: "foo", }, }));
await build(site);
// Normalize chunk name for (const page of site.pages) { const url = page.data.url;
if (url.match(/chunk-[\w]{8}\.js/)) { page.data.url = url.replace(/chunk-[\w]{8}\.js/, "chunk.js"); page.data.basename = page.data.basename.replace( /chunk-[\w]{8}/, "chunk", ); } else { const content = page.content as string; page.content = content.replace(/chunk-[\w]{8}\.js/, "chunk.js"); } }
await assertSiteSnapshot(t, site); },);
// Disable sanitizeOps & sanitizeResources because esbuild doesn't close themDeno.test( "esbuild plugin with JSX", { sanitizeOps: false, sanitizeResources: false }, async (t) => { const site = getSite({ src: "esbuild_jsx", });
site.use(jsx({ pageSubExtension: ".page", }));
site.use(esbuild({ extensions: [".jsx", ".tsx"], }));
await build(site); await assertSiteSnapshot(t, site); },);
Version Info