deno.land / x / lume@v2.1.4 / tests / esbuild.test.ts

esbuild.test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { 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); },);
lume

Version Info

Tagged at
7 months ago