forked from denoland/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.page.tsx
553 lines (535 loc) · 18.4 KB
/
index.page.tsx
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
export const layout = "raw.tsx";
export const url = "/";
export const sidebar = [
{
items: [
{
label: "Runtime Manual",
id: "/runtime/",
},
{
label: "Examples",
id: "/examples/",
},
{
label: "API reference",
id: "/api/deno",
},
{
label: "Deploy",
id: "/deploy/manual/",
},
{
label: "Subhosting",
id: "/subhosting/manual/",
},
{
label: "deno.com",
id: "https://deno.com",
},
],
},
];
export default function () {
return (
<main
id="content"
class="flex flex-col px-8 pt-6 md:pt-12 mt-4 md:items-center md:justify-center max-w-[1200px] mx-auto mb-48"
>
<div class="flex flex-col gap-4 md:gap-8 pb-16 align-middle md:pb-0">
{/* Hero section */}
<div class="grid grid-cols-1 md:grid-cols-3 mb-6 gap-4">
<div class="md:col-span-2">
<h1 class="text-4xl md:text-5xl mb-2 md:mb-6 font-bold">
Deno Docs
</h1>
<p class="text-md max-w-[600px] md:text-lg">
Deno, the open-source runtime for TypeScript and JavaScript.
Features built-in dev tools, powerful platform APIs, and native
support for TypeScript and JSX.
</p>
{/* CTA Group */}
<div class="flex flex-row gap-4 mt-8">
<DocsCTA
text="Get Started"
href="/runtime/"
product="runtime"
/>
<DocsCTA
text="Try Deno Deploy"
href="/deploy/manual"
product="deploy"
/>
</div>
</div>
<div class="hidden md:block md:col-span-1">
<img
class="w-full h-full"
src="/deno-looking-up.svg"
alt="Deno logo"
/>
</div>
</div>
{/* Main content */}
<div class="flex flex-col gap-8 md:gap-16">
{/* Temporary banner */}
<div class="flex flex-col gap-4 p-4 bg-runtime-background dark:bg-background-secondary border-l-4 text-runtime-foreground border-runtime-500">
<p class="text-lg">
<strong>Deno 2.0</strong> is out now! Learn about{" "}
<a
href="/runtime/reference/migration_guide"
class="runtime-link underline underline-offset-4"
>
what's changed
</a>{" "}
in the release.
</p>
</div>
{/* Runtime content */}
<div class="flex flex-col gap-8">
{/* Section Header */}
<div>
<h2 class="text-3xl md:text-4xl font-semibold underline underline-offset-8 decoration-runtime-500 mb-6">
Deno Runtime
</h2>
<p class="max-w-[75ch]">
Deno (/ˈdiːnoʊ/, pronounced dee-no) is an open source
JavaScript, TypeScript, and WebAssembly runtime with secure
defaults and a great developer experience. It's built on V8,
Rust, and Tokio.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-8 md:gap-24">
<ContentItem
title="Deno basics"
description="New to Deno? This is the place to start."
linktext="Get started"
link="/runtime/"
product="runtime"
/>
<ContentItem
title="Configuration"
description="Customizations for Deno’s built-in TypeScript compiler, formatter, and linter."
linktext="Deno config"
link="/runtime/fundamentals/configuration"
product="runtime"
/>
<ContentItem
title="Testing in Deno"
description="All about Deno’s built-in test runner for JavaScript or TypeScript code."
linktext="More about Testing"
link="/runtime/fundamentals/testing"
product="runtime"
/>
</div>
{/* Examples Section */}
<div class="flex flex-col">
<div class="mb-8">
<h3 class="text-xl md:text-2xl font-semibold underline underline-offset-8 decoration-runtime-500 mb-4">
Examples
</h3>
<p class="max-w-[75ch]">
A collection of annotated Deno examples, to be used as a
reference for how to build with Deno, or as a guide to learn
about many of Deno's features. Find more examples in the{" "}
<a
href="/examples/"
class="runtime-link underline underline-offset-4"
>
Examples
</a>{" "}
section.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-4 gap-8 md:gap-16">
<LinkList
title="Basics"
product="runtime"
links={[
{
text: "Importing modules from npm",
href: "/examples/npm",
},
{
text: "Hello World",
href: "/examples/hello-world",
},
{
text: "Using Node.js built-in modules",
href: "/examples/node",
},
{
text: "Manipulating & Parsing URLs",
href: "/examples/url-parsing",
},
]}
/>
<LinkList
title="Network"
product="runtime"
links={[
{
text: "HTTP Server: Hello World",
href: "/examples/http-server",
},
{
text: "HTTP Server: WebSockets",
href: "/examples/http-server-websocket",
},
{
text: "HTTP Server: Streaming",
href: "/examples/http-server-streaming",
},
{
text: "TCP Connector: Ping",
href: "/examples/tcp-connector",
},
]}
/>
<LinkList
title="System and CLI"
product="runtime"
links={[
{
text: "Command Line Arguments",
href: "/examples/command-line-arguments",
},
{
text: "Environment Variables",
href: "/examples/environment-variables",
},
{
text: "Reading Files",
href: "/examples/reading-files",
},
{
text: "Walking directories",
href: "/examples/walking-directories",
},
]}
/>
<LinkList
title="Deno Cloud Primitives"
product="runtime"
links={[
{
text: "KV",
href: "/examples/kv",
},
{
text: "Queues",
href: "/examples/queues",
},
{
text: "Cron",
href: "/examples/cron",
},
{
text: "KV Watch",
href: "/examples/kv-watch",
},
]}
/>
</div>
</div>
{/* Reference Section */}
<div class="flex flex-col">
<div class="mb-8">
<h3 class="text-xl md:text-2xl font-semibold underline underline-offset-8 decoration-runtime-500 mb-4">
API reference
</h3>
<p class="max-w-[75ch]">
Deno, Web, and Node API reference documentation, built for the
Deno experience. Explore the APIs available in Deno in the
{" "}
<a
href="/api/deno"
class="runtime-link underline underline-offset-4"
>
API reference
</a>{" "}
section.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-4 gap-8 md:gap-16">
<LinkList
title="Deno APIs"
product="runtime"
links={[
{
text: "Cloud",
href: "/api/deno/cloud",
},
{
text: "FFI",
href: "/api/deno/ffi",
},
{
text: "Network",
href: "/api/deno/network",
},
{
text: "Permissions",
href: "/api/deno/permissions",
},
{
text: "WebSockets",
href: "/api/deno/web-sockets",
},
{
text: "View all Deno APIs",
href: "/api/deno",
},
]}
/>
<LinkList
title="Web APIs"
product="runtime"
links={[
{
text: "Cache",
href: "/api/web/cache",
},
{
text: "Canvas",
href: "/api/web/canvas",
},
{
text: "Fetch",
href: "/api/web/fetch",
},
{
text: "Streams",
href: "/api/web/streams",
},
{
text: "URL",
href: "/api/web/url",
},
{
text: "View all Web APIs",
href: "/api/web",
},
]}
/>
<LinkList
title="Node APIs"
product="runtime"
links={[
{
text: "assert",
href: "/api/node/assert",
},
{
text: "buffer",
href: "/api/node/buffer",
},
{
text: "fs",
href: "/api/node/fs",
},
{
text: "path",
href: "/api/node/path",
},
{
text: "process",
href: "/api/node/process",
},
{
text: "View all Node APIs",
href: "/api/node",
},
]}
/>
</div>
</div>
</div>
<div class="flex flex-col gap-4 p-4 bg-deploy-50 dark:bg-background-secondary border-l-4 text-deploy-foreground border-deploy-500">
<p class="text-lg">
Run Deno Deploy on your own infrastructure with our self-hosted
solution running on AWS, GCP, or Azure.{" "}
<a
href="https://unf275cfh14.typeform.com/to/dIicJYSQ"
class="deploy-link underline underline-offset-4 external"
>
Learn more{" "}
<span aria-hidden="true" class="whitespace-pre">
->
</span>
</a>
</p>
</div>
{/* Deploy content */}
<div class="flex flex-col gap-8">
{/* Scection Header */}
<div>
<h2 class="text-3xl md:text-4xl font-semibold underline underline-offset-8 decoration-deploy-500 mb-8">
Deno Deploy
</h2>
<p class="max-w-[75ch]">
Serverless platform for deploying JavaScript code to a fast,
global edge network. Supports Deno APIs and Node.js / npm
modules
</p>
</div>
{/* Deploy features */}
<div class="grid grid-cols-1 mb-4 md:grid-cols-3 gap-8 md:gap-24">
<ContentItem
title="KV"
description="Key/value database built in to the Deno runtime. Simple API, works with zero configuration on Deno Deploy."
linktext="KV docs"
link="/deploy/kv/manual/"
product="deploy"
/>
<ContentItem
title="Cron"
description="Execute code on a configurable schedule at the edge in any time zone."
linktext="Cron docs"
link="/deploy/kv/manual/cron"
product="deploy"
/>
<ContentItem
title="Queues"
description="Deno’s queueing API for offloading larger workloads or scheduling tasks with guaranteed delivery."
linktext="Queues docs"
link="/deploy/kv/manual/queue_overview/"
product="deploy"
/>
</div>
{/* Subhosting content */}
<div class="flex flex-col">
<div class="mb-8">
<h3 class="text-xl md:text-2xl font-semibold underline underline-offset-8 decoration-deploy-500 mb-4">
Subhosting
</h3>
<p class="max-w-[66ch]">
Deno Subhosting is a robust platform designed to allow
Software as a Service (SaaS) providers to securely run code
written by their customers.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-8 md:gap-24">
<ContentItem
title="Quick Start"
description="Configure your subhosting account and you'll be hosting customer code in minutes."
linktext="Quick start"
link="/subhosting/manual/quick_start/"
product="deploy"
/>
<ContentItem
title="Subhosting architecture"
description="Manage key resources in your systems - handle data, manage deployments and their analytics. All while ensuring stability and efficiency."
linktext="Learn about subhosting"
link="/subhosting/api/"
product="deploy"
/>
<ContentItem
title="REST API"
description="Quickly provision new projects and make deployments through our REST API."
linktext="REST API"
link="/subhosting/manual/#rest-api-reference-and-openapi-spec"
product="deploy"
/>
</div>
</div>
</div>
{/* Help content */}
<div class="flex flex-col gap-8">
<div>
<h2 class="text-3xl md:text-4xl font-semibold underline underline-offset-8 decoration-purple-600 dark:decoration-purple-300 mb-8">
Help
</h2>
<p class="max-w-[75ch]">
Get help from the Deno team or connect with our community.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-8 md:gap-24">
<ContentItem
title="Connect with our community"
description="Get help from the Deno community"
linktext="Learn more"
link="/runtime/help"
product="help"
/>
<ContentItem
title="Enterprise support"
description="Explore Deno's enterprise support options"
linktext="Learn more"
link="https://deno.com/enterprise"
product="help"
/>
</div>
</div>
</div>
</div>
</main>
);
}
function DocsCTA(props: {
text: string;
href: string;
product: "deploy" | "runtime";
}) {
const productClass = props.product === "deploy"
? "deploy-cta"
: "runtime-cta";
return (
<a href={props.href} className={`docs-cta ${productClass}`}>
{props.text}{" "}
<span aria-hidden="true" class="whitespace-pre">
->
</span>
</a>
);
}
function ContentItem(props: {
title: string;
description: string;
linktext: string;
link: string;
product: string;
}) {
const productClass = props.product === "deploy"
? "deploy-link"
: props.product === "runtime"
? "runtime-link"
: "help-link"; // Default to "help-link" if product is "help"
return (
<div>
<h4 className="text-lg font-semibold mb-1">{props.title}</h4>
<p className="mb-3">{props.description}</p>
<a className={`homepage-link ${productClass}`} href={props.link}>
{props.linktext}{" "}
<span aria-hidden="true" class="whitespace-pre">
->
</span>
</a>
</div>
);
}
function LinkList(props: {
title: string;
product: string;
links: { text: string; href: string }[];
}) {
const productClass = props.product === "deploy"
? "deploy-link"
: props.product === "runtime"
? "runtime-link"
: "help-link";
return (
<div>
<h4 className="text-lg font-semibold mb-1">{props.title}</h4>
{props.links.map((link, index) => (
<a
key={index}
className={`homepage-link mb-1 ${productClass}`}
href={link.href}
>
{link.text}
</a>
))}
</div>
);
}