-
Notifications
You must be signed in to change notification settings - Fork 16
/
esm_sh.saas.txt
163 lines (106 loc) · 8.79 KB
/
esm_sh.saas.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
ESM_SH
ALTERNATIVES ==> # - esm.sh (prefer otherwise)
# - registry: npm or GitHub
# - bundle with esbuild, including tree-shaking
# - supports WASM, CSS-in-JS
# - include package.json `types` for Deno
# - deno.land (prefer if only in deno.land)
# - registry: deno.land
# - unpkg:
# - not maintained anymore
# - registry: npm
VERSION ==> #v133
INFRASTRUCTURE ==> #Cloudflare CDN
#Can be self-hosted
GOAL ==> #CDN serving npm modules or GitHub packages
#Can bundle with esbuild (including tree-shaking)
#Has good support for Deno, WASM, CSS-in-JS
/=+===============================+=\
/ : : \
)==: MAIN :==(
\ :_______________________________: /
\=+===============================+=/
https://esm.sh/MODULE[/PATH] #Return file contents
#If JavaScript (not TypeScript), bundled with esbuild
# - use a first file which points to the bundled esm.sh URL,
# to keep response small in case source code is loaded lazily
MODULE #Either:
# - NPM_MODULE[@VERSION_RANGE|NPM_TAG]
# - def TAG: latest
# - gh/USER/REPO[@GIT_TAG]
?... #Can be before the ending slash in IMPORT_MAP, i.e. IMPORT_MAP.imports.NAME '...?.../'
/=+===============================+=\
/ : : \
)==: BUNDLE :==(
\ :_______________________________: /
\=+===============================+=/
?bundle #Bundles all dependencies from package.json
?exports=VAR,... #Only include specific exports. Does tree-shaking
?cjs-exports=VAR,... #Specify CommonJS exports, when they cannot be guessed statistically
?deps=NPM_MODULE[@...],... #Overwrite package.json dependencies
?external=IURL,... #Add dependencies specified in IMPORT_MAP.imports.IURL
#NAME can be *
?alias=IURL:OURL #Maps IURL similar to an IMPORT_MAP
?dev #Set NODE_ENV to 'development'
#Use package.json CONDITION 'development', i.e. exports.development
?conditions=CONDITION,... #
?raw #Do not transform source file, keep as is
/=+===============================+=\
/ : : \
)==: MISC :==(
\ :_______________________________: /
\=+===============================+=/
?keep-names #Keep FUNC.name instead of minifying
?ignore-annotations #Ignore package.json sideEffects field
?worker #Returns as FUNC(['CODE'])->WORKER
#WORKER loads the code. Can add additional 'CODE'
?wasm #When importing *.wasm, wrap in new WebAssembly.Module('WASM_CODE')
?css #When imports CSS in JavaScript
?pin=ESM_SH_VERSION #Set esm.sh version, to pin it and prevent changes
/=+===============================+=\
/ : : \
)==: DENO :==(
\ :_______________________________: /
\=+===============================+=/
?target=TARGET #Among es2015-2022, esnext, deno[next]
#Def: guessed based on User-Agent [C]
NODE SHIMS ==> #Used when using Deno, use Node shims like Deno does on Node imports
?deno-std=X.Y.Z #Deno std used (def: latest)
?no-dts #Unless specified, if target is Deno, send package.json `types` as X-TypeScript-Types [S]
/=+===============================+=\
/ : : \
)==: CLI :==(
\ :_______________________________: /
\=+===============================+=/
deno run -A https://esm.sh COMMAND#CLI to add esm.sh URLs to an IMPORT_MAP
.../esm.sh init #Creates:
# - an empty import_map.json
# - a deno.json with tasks esm:add|update|remote calling .../esm.sh add|update|remove
.../esm.sh add MODULE[@...]... #Add to IMPORT_MAP:
# - imports.IURL[/] 'https://esm.sh/MODULE@...[/]', for package itself
# - scopes['https://esm.sh/'].DEP_MODULE 'https://esm.sh/DEP_MODULE@...', for dependencies
.../esm.sh update MODULE... #
.../esm.sh remove MODULE... #
/=+===============================+=\
/ : : \
)==: API :==(
\ :_______________________________: /
\=+===============================+=/
PROGRAMMATIC API ==> #Available. Not documented yet
/=+===============================+=\
/ : : \
)==: LOCAL :==(
\ :_______________________________: /
\=+===============================+=/
import
('https://esm.sh/vVERSION/server')#Exports `serve`
serve(FUNC(REQ)) #Run esm.sh server programmatically
deno run -A https://esm.sh/server #CLI
/=+===============================+=\
/ : : \
)==: UI :==(
\ :_______________________________: /
\=+===============================+=/
PLAYGROUND ==> #Code editor, with esm.sh bundle shown on the right