-
Notifications
You must be signed in to change notification settings - Fork 22
/
deno.ts
77 lines (74 loc) · 1.54 KB
/
deno.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
import type { Preset } from "../types";
// https://docs.deno.com/runtime/manual/node/compatibility
// https://docs.deno.com/deploy/api/runtime-node
// Last checked: 2023-12-13
const denoNodeCompatModules = [
"assert",
"assert/strict",
"async_hooks",
"buffer",
"child_process",
"cluster",
"console",
"constants",
"crypto",
"dgram",
"diagnostics_channel",
"dns",
"dns/promises",
"domain",
"events",
"fs",
"fs/promises",
"http",
"http2",
"https",
"module",
"net",
"os",
"path",
"path/posix",
"path/win32",
"perf_hooks",
"process",
"punycode",
"querystring",
"readline",
"stream",
"stream/consumers",
"stream/promises",
"stream/web",
"string_decoder",
"sys",
"timers",
"timers/promises",
"tls",
"tty",
"url",
"util",
"util/types",
"v8",
"vm",
"worker_threads",
"zlib",
];
const denoPreset: Preset = {
alias: {
...Object.fromEntries(denoNodeCompatModules.map((p) => [p, `node:${p}`])),
...Object.fromEntries(
denoNodeCompatModules.map((p) => [`node:${p}`, `node:${p}`]),
),
},
// Deno's listed globals manually tested against [email protected]
// TODO: missing BroadcastChannel, PerformanceObserverEntryList, PerformanceResourceTiming
// TODO: global and process
inject: {
setImmediate: "node:timers",
clearImmediate: "node:timers",
Buffer: "node:buffer",
PerformanceObserver: "node:perf_hooks",
},
polyfill: ["unenv/runtime/polyfill/deno-env"],
external: denoNodeCompatModules.map((p) => `node:${p}`),
};
export default denoPreset;