This repository has been archived by the owner on Oct 2, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
index.html
358 lines (337 loc) · 11.5 KB
/
index.html
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!doctype html>
<html>
<title>jspm.io - Native ES Modules CDN</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Advent+Pro:300" rel="stylesheet">
<style type="text/css">
body {
margin: 20px;
margin-top: 50px;
padding: 0;
background-color: rgb(247, 247, 247);
}
.logobox {
background-image: url(jspm.png);
background-repeat: no-repeat;
background-size: 250px;
width: 200px;
height: 223px;
margin-bottom: -155px;
margin-left: auto;
margin-right: auto;
padding-left: 310px;
margin-top: 50px;
}
.content {
margin-top: 50px;
width: 750px;
margin-left: auto;
margin-right: auto;
margin-bottom: 150px;
}
h1.logo {
font-weight: 100;
font-family: 'Advent Pro', 'Myriad Pro', sans-serif;
color: rgb(165, 165, 165);
font-size: 80px;
margin: 0;
margin-bottom: 80px;
padding-left: 200px;
text-align: center;
}
h1.logo span {
color: rgb(214, 149, 64);
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Advent Pro', 'Myriad Pro', sans-serif;
font-weight: bold;
}
p, li, a {
font-family: 'Helvetica Neue', Helvetica, sans-serif;
}
h1 {
color: rgb(214, 149, 64);
text-align: center;
}
h2 {
font-size: 22px;
color: rgb(134, 134, 134);
text-align: left;
}
h3 {
font-size: 28px;
color: #444;
}
h4 {
font-size: 22px;
color: #666;
}
.content em {
text-shadow: 1px 1px 1px #fff;
}
.content strong {
color: #666;
}
.content p, .content li {
line-height: 26px;
color: #333;
}
.content a {
color: #333;
text-shadow: 1px 1px 1px #fff;
}
.content a:hover {
color: #C0781A;
}
.content a[id] {
display: block;
height: 20px;
}
.footer {
margin-bottom: 30px;
}
p strong {
color: #777;
}
.footer p {
font-family: 'Helvetica Neue', Helvetica, sans-serif;
font-size: 14px;
text-align: center;
font-style: italic;
line-height: 26px;
color: #333;
text-shadow: 1px 1px 1px #fff;
}
p a {
color: #333;
}
/* icons */
.cdn-icon, .cli-icon, .loader-icon {
background-image: url(icons.png);
width: 46px;
height: 46px;
margin-bottom: -64px;
}
.loader-icon {
background-position: 0 -107px;
}
.loader-icon + h4 {
margin-left: 55px;
}
.cdn-icon + h4 {
margin-left: 55px;
}
.cli-icon +h4 {
margin-left: 55px;
}
.cli-icon {
background-position: -18px -58px;
background-repeat: no-repeat;
margin-left: 16px;
}
.cdn-icon {
background-position: 0 -153px;
}
.loading {
margin-top: 80px;
text-align: center;
width: 28px;
height: 25px;
margin-left: auto;
margin-right: auto;
background-color: #E2E2E2;
border: 1px solid #aaa;
padding: 10px;
border-radius: 8px;
}
.cog {
width: 24px;
height: 30px;
background-image: url(cog.gif);
background-repeat: no-repeat;
margin-left: auto;
margin-right: auto;
}
/* toc */
.contents {
position: fixed;
top: 100px;
left: 0px;
}
.contents a {
height: 40px;
line-height: 40px;
padding-left: 20px;
padding-right: 20px;
font-size: 16px;
border-bottom: 1px dashed #999;
display: block;
color: #777;
text-decoration:none;
text-shadow: 1px 1px 1px #fff;
}
.contents a:active {
background-color: #ddd;
}
.contents a:hover {
background-color: #ddd;
}
/* code */
.content pre {
background-color: #fdfdfd;
padding: 20px;
margin-top: 30px;
margin-bottom: 30px;
font-size: 14px;
line-height: 18px;
border: 1px solid #e7e7e7;
border-radius: 7px;
color: #333;
}
code {
padding: 5px;
}
code.javascript, code.html {
font-size: 16px;
padding: 0px;
}
code .comment, code .comment .keyword {
color: #494;
font-weight: 100;
}
code .string, code .string .comment {
color: #BE1717;
}
code .keyword {
font-weight: bold;
color: #767;
}
code .number {
color: rgb(0, 116, 255);
}
@media screen and (max-width: 750px),
screen and (max-device-width: 750px) {
.logobox {
background-size: 150px;
width: 150px;
height: 150px;
margin-bottom: -130px;
padding-left: 230px;
}
h1.logo {
padding-left: 130px;
}
.content {
width: 100%;
}
.content pre {
overflow-x: scroll;
}
}
</style>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-40327700-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-40327700-1');
</script>
<body>
<a id="intro"></a>
<div class="logobox"></div>
<h1 class="logo"><span>jspm</span>.io</h1>
<p style="text-align:center;"><strong>Native ES Modules CDN</strong> • <a href="https://jspm.org">Package Manager</a></p>
<br />
<div class="content">
<!-- <div class="contents">
<a target=_blank href="#introduction">Introduction</a>
<a target=_blank href="#examples">Examples</a>
<a target=_blank href="#feedbackroadmap">Feedback & Roadmap</a>
</div> -->
<p style="text-align:center">Load npm packages in modern browsers with the native browser ES module loader:</p>
<code class="html"><pre>
<script type=module>
import React from 'https://dev.jspm.io/react';
</script></pre></code>
<p style="text-align:center">Or with the dynamic <code>import()</code> (<em>try it out in the console if using Chrome</em>):</p>
<code class="javascript"><pre>
import('https://dev.jspm.io/react').then(({ default: React }) => console.log(React));</pre></code>
<p>CommonJS modules only export a <code>default</code> export, to support the currently intended NodeJS interop with ES modules. This support will track whatever module interop NodeJS implements here.</p>
<p><br></p>
<a name="use-cases"></a>
<h1 id="use-cases">Easy Web Prototyping and Development</h1>
<p>As of 9 May 2018, <a target=_blank href="https://caniuse.com/#feat=es6-module">all modern browsers now support</a> loading ES modules via the <code><script type="module"></code> tag.
jspm.io enables development workflows to utilize this module loader to load existing npm packages as ES modules.</p>
<p>Being able to skip bundler and tooling setup to easily work with the npm package ecosystem provides a simple prototyping workflow for the web.</p>
<p>There is no need to lookup CDN URLs or work out how to get CDN scripts to work together as all modules share the same native registry in the browser while following the npm package ecosystem semantics you'd get with a bundler.</p>
<h2>Not for Production</h2>
<p>These workflows are intended for development only as serving 100's or even 1000's of modules is not suitable for production.</p>
<p>The server at <code>https://dev.jspm.io</code> serves modules unminified and with <code>process.env.NODE_ENV=dev</code>.</p>
<p>To load packages with <code>process.env.NODE_ENV=production</code>, you can use <code>https://unsafe-production.jspm.io</code>.</p>
<p>For future production workflows, the jspm package manager aims to provide workflows for bridging the gap between CDN delivery and offline package management through package import map generation while retaining the same semantics.</p>
</script>
<p><br/></p>
<a name="features"></a>
<h1 id="features">Features</h1>
<ul>
<li><p>Modules are all served as separate files over HTTP/2 with CDN edge caching.</p></li>
<li><p>Far-future expires are provided for exact package versions for fast reloads.</p></li>
<li><p>ES modules are supported as <code>.mjs</code> or when using <code>import</code> and <code>export</code> statements.</p></li>
<li><p>Packages are processed as they are requested - the first load of a new package may take a few moments, but after that it will be cached at the edge of the network.</p></li>
</ul>
<p><br></p>
<a name="examples"></a>
<h1 id="examples">Common Framework Examples</h1>
<p>The following are simple HTML examples of common frameworks on Plnkr using a single HTML page with a <code><script type=module></code> tag:
<ul>
<li><a target=_blank href="https://plnkr.co/edit/kUqQxhEFKF7jt2RGf61s?p=preview">Babel</a>
<li><a target=_blank href="https://plnkr.co/edit/vBESncXMXRb1x3OIzdz0?p=preview">BablylonJS</a>
<li><a target=_blank href="https://plnkr.co/edit/IiXSNG4Ng46H5EyLDAX0?p=preview">React Material-UI</a>
<li><a target=_blank href="https://plnkr.co/edit/Es5zeTPFwMak8n7VCj0r?p=preview">Tensorflow.js</a>
<li><a target=_blank href="https://plnkr.co/edit/mVGxlk18xlxNd2JTcBHY?p=preview">Vue</a>
</ul>
<p>If you'd like to share or update an example, please <a target=_blank href="https://github.com/jspm/jspm.io">post a website issue</a>.</p>
<a name="urls"></a>
<h1 id="urls">URL Formats</h1>
<p>The following URL formats are supported:</p>
<ul>
<li>Latest Version: <code>https://dev.jspm.io/<strong>package-name</strong><strong>(/path)?</strong></code></li>
<li>Version Range: <code>https://dev.jspm.io/<strong>package-name</strong>@<strong>versionOrRange</strong><strong>(/path)?</strong></code></li>
<li>Canonical Form: <code>https://dev.jspm.io/npm:<strong>package-name</strong>@<strong>exactVersion</strong><strong>(/path)?</strong></code></li>
</ul>
<p>Supported version ranges are <code>@X</code>, <code>@X.Y</code>, <code>@X.Y.Z</code> or the exact version. Semver symbols are not supported - instead of <code>@~1.2.3</code> use <code>@1.2</code> and instead of <code>@^1.2.3</code> use <code>@1</code> rather.</p>
<p>The canonical form is the URL at which the actual source will be provided, with version and name aliases working via redirects and modular redirects.</p>
<p><br/></p>
<a name="how-it-works"></a>
<h1 id="status">How it Works</h1>
<ul>
<li><p>CommonJS modules are converted into ES modules by using a code transform called a Deferred Execution Wrapper (dew transform).</p>
<li><p>This transform ensures the CommonJS execution semantics, while also providing a best-effort strict mode conversion where necessary.</p>
<li><p>Package dependency resolutions are inlined during this transform process to their version alias URLs.</p>
<li><p>In order to avoid the latency waterfall of module loading, deep dependencies are inlined as imports within alias modules.</p>
</ul>
<p><br/></p>
<a name="issues"></a>
<h1 id="issues">Reporting Issues</h1>
<p>If a package or module is not loading correctly, and it is expected to work through a bundler, please <a target=_blank href="https://github.com/jspm/project">post a project issue</a>.</p>
<p><em>Note that GitHub or other non-npm dependencies are not currently supported.</em></p>
<p><br></p>
</div>
<div class="footer">
<p>Logo design by <a target=_blank href="https://dribbble.com/luukdv">Luuk de Vlieger</a></p>
</div>
</div>
</body>
<script>
Array.prototype.forEach.call(document.querySelectorAll('code.javascript, code.html'), function(code) {
code.innerHTML = code.innerHTML
.replace(/^(\s*\/\/.*)/gm, '<span class="comment">$1</span>')
.replace(/('[^']*')/gm, '<span class="string">$1</span>')
.replace(/([^#\d\-a-z\:])(-?\d+)/gm, '$1<span class="number">$2</span>')
.replace(/([^\.])(for|function|new|await|throw|return|var|let|const|if|else|true|false|this|import|export class|export|from)\b/gm, '$1<span class="keyword">$2</span>');
});
</script>
</html>