-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembedder.ts
More file actions
48 lines (43 loc) · 1.36 KB
/
embedder.ts
File metadata and controls
48 lines (43 loc) · 1.36 KB
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
#!/usr/bin/env -S deno run -A
import * as embedder from "@nfnitloop/deno-embedder"
import { ESBuild } from "@nfnitloop/deno-embedder/plugins/esbuild"
import { sassPlugin } from "npm:esbuild-sass-plugin@3.3.0"
const entrypointsDir = "src/entrypoints"
const entrypoints = [
...Deno.readDirSync(entrypointsDir)
.filter(it => it.isFile)
.filter(it => it.name.match(/[.]tsx?$/))
.map(it => `entrypoints/${it.name}`)
]
export const options = {
importMeta: import.meta,
mappings: [
{
sourceDir: "embed-src/static",
destDir: "generated/static",
},
{
sourceDir: "embed-src/styles",
destDir: "generated/styles",
plugin: new ESBuild({
entryPoints: ["style.scss"],
plugins: [
// @ts-expect-error: workaround for: https://github.com/glromeo/esbuild-sass-plugin/issues/191
sassPlugin()
],
// Work around: https://github.com/NfNitLoop/deno-embedder/issues/10
bundleRemoteSources: false,
})
},
{
sourceDir: "src",
destDir: "generated/js",
plugin: new ESBuild({
entryPoints: entrypoints
})
}
]
}
if (import.meta.main) {
await embedder.main({options})
}