-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdnt.deno.txt
111 lines (83 loc) · 5.79 KB
/
dnt.deno.txt
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
┏━━━━━━━━━┓
┃ DNT ┃
┗━━━━━━━━━┛
ALTERNATIVES ==> # - dnt (preferred): maintained by Deno
# - deno2node: fewer features
VERSION ==> #0.41.3
┌─────────────┐
│ GENERAL │
└─────────────┘
build(OPTS)->> #Transform Deno code to Node code:
# - transform imports
# - inject ponyfills
# - add package.json, including dependencies
# - run npm install
# - transpile TypeScript to ESM+CommonJS and *.d.ts
# - then run type checking
# - run Deno.test() but in Node
emptyDir(UPATH)->> #Like in std
OPTS.postBuild #FUNC()[->>] run at the end
┌───────────┐
│ FILES │
└───────────┘
OPTS.entryPoints #'PATH'|ENTRYPOINT[_ARR] to main files
ENTRYPOINT.path #'PATH'
ENTRYPOINT.kind #'export' (programmatic) or 'bin' (executable)
#With 'bin', #!/usr/bin/env node is also added
ENTRYPOINT.name #STR. package.json bin.* or export.* key
OPTS.outDir #'DIR'
OPTS.esModule #BOOL (def: true). Output ESM files
OPTS.scriptModule #BOOL (def: true, i.e. both), 'cjs' or 'umd'. Format output for CommonJS
┌─────────────┐
│ IMPORTS │
└─────────────┘
OPTS.importMap #'PATH' to IMPORTMAP
OPTS.mappings.IURL #'OURL'|OURL. Map imports. Also used to generate package.json dependencies
#By def, guessed
# - including URLs, bare specifiers, esm.sh
# - try to resolve to npm module name
# - if cannot, download them locally
#This can also be used to point to different files for Node.js, allowing Deno|Node-specific logic
OURL.name #'MODULE'
OURL.subPath #'/PATH'
OURL.version #'X.Y.Z'. If undefined, not added to package.json dependencies
OURL.peerDependency #BOOL (def: false)
┌───────────────┐
│ PONYFILLS │
└───────────────┘
OPTS.shims #SHIMS
SHIMS.* #Inject ponyfills
#Can be BOOL (def: false) or 'dev' (devDependencies)
#Can also use comment // dnt-shim-ignore
SHIMS.deno #Deno.* (@deno/shim-deno, see its doc)
SHIMS.timers #setTimeout|Interval() (@deno/shim-timers)
SHIMS.prompts #confirm|alert|prompt() (@deno/shim-prompts)
SHIMS.crypto #crypto (@deno/shim-crypto)
SHIMS.weakRef #WeakRef (@deno/shim-weakref)
SHIMS.blob #Blob (buffer package)
SHIMS.domException #DOMException (domexception package)
SHIMS.undici #fetch() (undici package)
SHIMS.webSocket #WebSocket (ws package)
SHIMS.custom[Dev] #OBJ_ARR. Custom shims [only in tests]
┌──────────────────┐
│ PACKAGE.JSON │
└──────────────────┘
OPTS.package #OBJ of properties to set in package.json
OPTS.skipNpmInstall #BOOL. If false (def), run `npm|yarn|pnpm install`
OPTS.packageManager #'npm|yarn|pnpm|PATH'
┌────────────────┐
│ TYPESCRIPT │
└────────────────┘
OPTS.declaration #BOOL or 'inline'. Create *.d.ts files
#If 'inline' (def), set as siblings
OPTS.compilerOptions #OBJ of TypeScript configuration
OPTS.skipSourceOutput #BOOL (def: false). Do not transpile
OPTS.typeCheck #BOOL (def: true) or 'both'. TypeScript type check on output
#Unless 'both', only for ESM, not also CommonJS
OPTS.filterDiagnostic #FUNC(DIAGNOSTIC)->BOOL. If false, ignore TypeScript type check error
┌───────────┐
│ TESTS │
└───────────┘
OPTS.test #BOOL (def: true). Run Deno.test() in Node output, using @deno/shim-deno-test
OPTS.rootTestDir #'DIR' to search for tests (def: '.')
OPTS.testPattern #'GLOB' of test files (def: like Deno.test)