mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
Remove old website (#3194)
Move manual.md and style_guide.md into //std so they can be accessed from https://deno.land/std/manual.md Code for new website is https://github.com/denoland/deno_website2 Co-authored-by: Christian Moritz <chrmoritz@gmail.com>
This commit is contained in:
parent
f96aaa802b
commit
1d8f3cc896
26 changed files with 19 additions and 1704 deletions
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
|
@ -145,7 +145,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 -b gh-pages https://${DENOBOT_PAT}@github.com/denoland/deno.git gh-pages
|
git clone --depth 1 -b gh-pages https://${DENOBOT_PAT}@github.com/denoland/deno.git gh-pages
|
||||||
python ./tools/build_benchmark_jsons.py
|
python ./tools/build_benchmark_jsons.py
|
||||||
cp -r website/* gh-pages/
|
|
||||||
cd gh-pages
|
cd gh-pages
|
||||||
git config user.email "propelml@gmail.com"
|
git config user.email "propelml@gmail.com"
|
||||||
git config user.name "denobot"
|
git config user.name "denobot"
|
||||||
|
|
|
@ -54,7 +54,7 @@ testPerm({ read: true }, async function lstatSyncSuccess(): Promise<void> {
|
||||||
assert(!modulesInfo.isDirectory());
|
assert(!modulesInfo.isDirectory());
|
||||||
assert(modulesInfo.isSymlink());
|
assert(modulesInfo.isSymlink());
|
||||||
|
|
||||||
const i = Deno.lstatSync("website");
|
const i = Deno.lstatSync("core");
|
||||||
assert(i.isDirectory());
|
assert(i.isDirectory());
|
||||||
assert(!i.isSymlink());
|
assert(!i.isSymlink());
|
||||||
});
|
});
|
||||||
|
@ -138,7 +138,7 @@ testPerm({ read: true }, async function lstatSuccess(): Promise<void> {
|
||||||
assert(!modulesInfo.isDirectory());
|
assert(!modulesInfo.isDirectory());
|
||||||
assert(modulesInfo.isSymlink());
|
assert(modulesInfo.isSymlink());
|
||||||
|
|
||||||
const i = await Deno.lstat("website");
|
const i = await Deno.lstat("core");
|
||||||
assert(i.isDirectory());
|
assert(i.isDirectory());
|
||||||
assert(!i.isSymlink());
|
assert(!i.isSymlink());
|
||||||
});
|
});
|
||||||
|
|
|
@ -53,8 +53,6 @@ import "./performance_test.ts";
|
||||||
import "./permissions_test.ts";
|
import "./permissions_test.ts";
|
||||||
import "./version_test.ts";
|
import "./version_test.ts";
|
||||||
|
|
||||||
import "../../website/app_test.ts";
|
|
||||||
|
|
||||||
import { runIfMain } from "../../std/testing/mod.ts";
|
import { runIfMain } from "../../std/testing/mod.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
|
|
|
@ -5,15 +5,14 @@ from benchmark import read_json, write_json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
current_data_file = os.path.join(build_path(), "bench.json")
|
current_data_file = os.path.join(build_path(), "bench.json")
|
||||||
gh_pages_data_file = "gh-pages/data.json"
|
all_data_file = "gh-pages/data.json" # Includes all benchmark data.
|
||||||
all_data_file = "website/data.json" # Includes all benchmark data.
|
recent_data_file = "gh-pages/recent.json" # Includes recent 20 benchmark data.
|
||||||
recent_data_file = "website/recent.json" # Includes recent 20 benchmark data.
|
|
||||||
|
|
||||||
assert os.path.exists(current_data_file)
|
assert os.path.exists(current_data_file)
|
||||||
assert os.path.exists(gh_pages_data_file)
|
assert os.path.exists(all_data_file)
|
||||||
|
|
||||||
new_data = read_json(current_data_file)
|
new_data = read_json(current_data_file)
|
||||||
all_data = read_json(gh_pages_data_file)
|
all_data = read_json(all_data_file)
|
||||||
all_data.append(new_data)
|
all_data.append(new_data)
|
||||||
|
|
||||||
write_json(all_data_file, all_data)
|
write_json(all_data_file, all_data)
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
||||||
import os
|
|
||||||
from util import run, root_path, build_path
|
|
||||||
|
|
||||||
os.chdir(os.path.join(root_path, "website"))
|
|
||||||
deno_exe = os.path.join(build_path(), "deno")
|
|
||||||
run([deno_exe, "bundle", "app.ts", "app.bundle.js"])
|
|
|
@ -6,11 +6,6 @@ from util import run, root_path
|
||||||
|
|
||||||
target_path = os.path.join(root_path, "target/")
|
target_path = os.path.join(root_path, "target/")
|
||||||
|
|
||||||
os.chdir(root_path)
|
|
||||||
|
|
||||||
# Builds into target/doc
|
|
||||||
run(["cargo", "doc", "--all", "--no-deps", "-vv"])
|
|
||||||
|
|
||||||
# 'deno types' is stored in js/lib.deno_runtime.d.ts
|
# 'deno types' is stored in js/lib.deno_runtime.d.ts
|
||||||
# We want to run typedoc on that declaration file only.
|
# We want to run typedoc on that declaration file only.
|
||||||
os.chdir(os.path.join(root_path, "cli/js"))
|
os.chdir(os.path.join(root_path, "cli/js"))
|
||||||
|
|
13
tools/upload_docs.py
Executable file
13
tools/upload_docs.py
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from util import run, root_path
|
||||||
|
|
||||||
|
os.chdir(root_path)
|
||||||
|
run([sys.executable, "tools/docs.py"])
|
||||||
|
os.chdir("target")
|
||||||
|
run([
|
||||||
|
"aws", "s3", "sync", "--include=typedoc", "--exclude=debug/*",
|
||||||
|
"--exclude=release/*", ".", "s3://deno.land/"
|
||||||
|
])
|
|
@ -1,22 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
from util import run, root_path, build_path
|
|
||||||
|
|
||||||
# Probably run tools/docs.py first.
|
|
||||||
# AWS CLI must be installed separately.
|
|
||||||
|
|
||||||
os.chdir(os.path.join(root_path, "website"))
|
|
||||||
|
|
||||||
deno_exe = os.path.join(build_path(), "deno")
|
|
||||||
run([sys.executable, "../tools/build_website.py"])
|
|
||||||
|
|
||||||
# Invalidate the cache.
|
|
||||||
run([
|
|
||||||
"aws", "cloudfront", "create-invalidation", "--distribution-id",
|
|
||||||
"E2HNK8Z3X3JDVG", "--paths", "/*"
|
|
||||||
])
|
|
||||||
|
|
||||||
run(["aws", "s3", "sync", ".", "s3://deno.land/"])
|
|
480
website/app.ts
480
website/app.ts
|
@ -1,480 +0,0 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
||||||
|
|
||||||
// How much to multiply time values in order to process log graphs properly.
|
|
||||||
const TimeScaleFactor = 10000;
|
|
||||||
|
|
||||||
export interface BenchmarkExecTimeResult {
|
|
||||||
min?: number;
|
|
||||||
max?: number;
|
|
||||||
mean?: number;
|
|
||||||
stddev?: number;
|
|
||||||
system?: number;
|
|
||||||
user?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BenchmarkExecTimeResultSet {
|
|
||||||
[variant: string]: BenchmarkExecTimeResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BenchmarkVariantsResultSet {
|
|
||||||
[variant: string]: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BenchmarkRun {
|
|
||||||
created_at: string;
|
|
||||||
sha1: string;
|
|
||||||
benchmark: BenchmarkExecTimeResultSet;
|
|
||||||
binary_size?: BenchmarkVariantsResultSet | number;
|
|
||||||
max_memory?: BenchmarkVariantsResultSet | number;
|
|
||||||
bundle_size?: BenchmarkVariantsResultSet;
|
|
||||||
max_latency?: BenchmarkVariantsResultSet;
|
|
||||||
req_per_sec?: BenchmarkVariantsResultSet;
|
|
||||||
req_per_sec_proxy?: BenchmarkVariantsResultSet;
|
|
||||||
syscall_count?: BenchmarkVariantsResultSet;
|
|
||||||
thread_count?: BenchmarkVariantsResultSet;
|
|
||||||
throughput?: BenchmarkVariantsResultSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BenchmarkName = Exclude<keyof BenchmarkRun, "created_at" | "sha1">;
|
|
||||||
|
|
||||||
type Column = [string, ...Array<number | null>];
|
|
||||||
|
|
||||||
interface C3DataNode {
|
|
||||||
id: string;
|
|
||||||
index: number;
|
|
||||||
name: string;
|
|
||||||
value: number;
|
|
||||||
x: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
type C3OnClickCallback = (C3DataNode, unknown) => void;
|
|
||||||
type C3OnRenderedCallback = () => void;
|
|
||||||
type C3TickFormatter = (number) => number | string;
|
|
||||||
|
|
||||||
export async function getJson(path: string): Promise<unknown> {
|
|
||||||
return (await fetch(path)).json();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBenchmarkVarieties(
|
|
||||||
data: BenchmarkRun[],
|
|
||||||
benchmarkName: BenchmarkName
|
|
||||||
): string[] {
|
|
||||||
// Look at last sha hash.
|
|
||||||
const last = data[data.length - 1];
|
|
||||||
return Object.keys(last[benchmarkName]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createColumns(
|
|
||||||
data: BenchmarkRun[],
|
|
||||||
benchmarkName: BenchmarkName
|
|
||||||
): Column[] {
|
|
||||||
const varieties = getBenchmarkVarieties(data, benchmarkName);
|
|
||||||
return varieties.map(variety => [
|
|
||||||
variety,
|
|
||||||
...data.map(d => {
|
|
||||||
if (d[benchmarkName] != null) {
|
|
||||||
if (d[benchmarkName][variety] != null) {
|
|
||||||
const v = d[benchmarkName][variety];
|
|
||||||
if (benchmarkName == "benchmark") {
|
|
||||||
const meanValue = v ? v.mean : 0;
|
|
||||||
return meanValue || null;
|
|
||||||
} else {
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createNormalizedColumns(
|
|
||||||
data: BenchmarkRun[],
|
|
||||||
benchmarkName: BenchmarkName,
|
|
||||||
baselineBenchmark: BenchmarkName,
|
|
||||||
baselineVariety: string
|
|
||||||
): Column[] {
|
|
||||||
const varieties = getBenchmarkVarieties(data, benchmarkName);
|
|
||||||
return varieties.map(variety => [
|
|
||||||
variety,
|
|
||||||
...data.map(d => {
|
|
||||||
if (d[baselineBenchmark] != null) {
|
|
||||||
if (d[baselineBenchmark][baselineVariety] != null) {
|
|
||||||
const baseline = d[baselineBenchmark][baselineVariety];
|
|
||||||
if (d[benchmarkName] != null) {
|
|
||||||
if (d[benchmarkName][variety] != null && baseline != 0) {
|
|
||||||
const v = d[benchmarkName][variety];
|
|
||||||
if (benchmarkName == "benchmark") {
|
|
||||||
const meanValue = v ? v.mean : 0;
|
|
||||||
return meanValue || null;
|
|
||||||
} else {
|
|
||||||
return v / baseline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createExecTimeColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
return createColumns(data, "benchmark");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createThroughputColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
return createColumns(data, "throughput");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createProxyColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
return createColumns(data, "req_per_sec_proxy");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createNormalizedProxyColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
return createNormalizedColumns(
|
|
||||||
data,
|
|
||||||
"req_per_sec_proxy",
|
|
||||||
"req_per_sec",
|
|
||||||
"hyper"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createReqPerSecColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
return createColumns(data, "req_per_sec");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createNormalizedReqPerSecColumns(
|
|
||||||
data: BenchmarkRun[]
|
|
||||||
): Column[] {
|
|
||||||
return createNormalizedColumns(data, "req_per_sec", "req_per_sec", "hyper");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createMaxLatencyColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
return createColumns(data, "max_latency");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createMaxMemoryColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
return createColumns(data, "max_memory");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createBinarySizeColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
const propName = "binary_size";
|
|
||||||
const binarySizeNames = Object.keys(data[data.length - 1][propName]);
|
|
||||||
return binarySizeNames.map(name => [
|
|
||||||
name,
|
|
||||||
...data.map(d => {
|
|
||||||
const binarySizeData = d["binary_size"];
|
|
||||||
switch (typeof binarySizeData) {
|
|
||||||
case "number": // legacy implementation
|
|
||||||
return name === "deno" ? binarySizeData : 0;
|
|
||||||
default:
|
|
||||||
if (!binarySizeData) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return binarySizeData[name] || null;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createThreadCountColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
const propName = "thread_count";
|
|
||||||
const threadCountNames = Object.keys(data[data.length - 1][propName]);
|
|
||||||
return threadCountNames.map(name => [
|
|
||||||
name,
|
|
||||||
...data.map(d => {
|
|
||||||
const threadCountData = d[propName];
|
|
||||||
if (!threadCountData) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return threadCountData[name] || null;
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createSyscallCountColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
const propName = "syscall_count";
|
|
||||||
const syscallCountNames = Object.keys(data[data.length - 1][propName]);
|
|
||||||
return syscallCountNames.map(name => [
|
|
||||||
name,
|
|
||||||
...data.map(d => {
|
|
||||||
const syscallCountData = d[propName];
|
|
||||||
if (!syscallCountData) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return syscallCountData[name] || null;
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createBundleSizeColumns(data: BenchmarkRun[]): Column[] {
|
|
||||||
return createColumns(data, "bundle_size");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createSha1List(data: BenchmarkRun[]): string[] {
|
|
||||||
return data.map(d => d.sha1);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function formatKB(bytes: number): string {
|
|
||||||
return (bytes / 1024).toFixed(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function formatMB(bytes: number): string {
|
|
||||||
return (bytes / (1024 * 1024)).toFixed(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function formatReqSec(reqPerSec: number): string {
|
|
||||||
return (reqPerSec / 1000).toFixed(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function formatPercentage(decimal: number): string {
|
|
||||||
return (decimal * 100).toFixed(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} id The id of dom element
|
|
||||||
* @param {string[]} categories categories for x-axis values
|
|
||||||
* @param {any[][]} columns The columns data
|
|
||||||
* @param {function} onclick action on clicking nodes of chart
|
|
||||||
* @param {string} yLabel label of y axis
|
|
||||||
* @param {function} yTickFormat formatter of y axis ticks
|
|
||||||
* @param {boolean} zoomEnabled enables the zoom feature
|
|
||||||
*/
|
|
||||||
function generate(
|
|
||||||
id: string,
|
|
||||||
categories: string[],
|
|
||||||
columns: Column[],
|
|
||||||
onclick: C3OnClickCallback,
|
|
||||||
yLabel = "",
|
|
||||||
yTickFormat?: C3TickFormatter,
|
|
||||||
zoomEnabled = true,
|
|
||||||
onrendered?: C3OnRenderedCallback
|
|
||||||
): void {
|
|
||||||
const yAxis = {
|
|
||||||
padding: { bottom: 0 },
|
|
||||||
min: 0,
|
|
||||||
label: yLabel,
|
|
||||||
tick: null
|
|
||||||
};
|
|
||||||
if (yTickFormat) {
|
|
||||||
yAxis.tick = {
|
|
||||||
format: yTickFormat
|
|
||||||
};
|
|
||||||
if (yTickFormat == logScale) {
|
|
||||||
delete yAxis.min;
|
|
||||||
for (const col of columns) {
|
|
||||||
for (let i = 1; i < col.length; i++) {
|
|
||||||
if (col[i] == null || col[i] === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
col[i] = Math.log10((col[i] as number) * TimeScaleFactor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
c3.generate({
|
|
||||||
bindto: id,
|
|
||||||
onrendered,
|
|
||||||
data: {
|
|
||||||
columns,
|
|
||||||
onclick
|
|
||||||
},
|
|
||||||
axis: {
|
|
||||||
x: {
|
|
||||||
type: "category",
|
|
||||||
show: false,
|
|
||||||
categories
|
|
||||||
},
|
|
||||||
y: yAxis
|
|
||||||
},
|
|
||||||
zoom: {
|
|
||||||
enabled: zoomEnabled
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function logScale(t: number): string {
|
|
||||||
return (Math.pow(10, t) / TimeScaleFactor).toFixed(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param dataUrl The url of benchmark data json.
|
|
||||||
*/
|
|
||||||
export function drawCharts(dataUrl: string): Promise<void> {
|
|
||||||
// TODO Using window["location"]["hostname"] instead of
|
|
||||||
// window.location.hostname because when deno runs app_test.js it gets a type
|
|
||||||
// error here, not knowing about window.location. Ideally Deno would skip
|
|
||||||
// type check entirely on JS files.
|
|
||||||
if (window["location"]["hostname"] != "deno.github.io") {
|
|
||||||
dataUrl = "https://denoland.github.io/deno/" + dataUrl;
|
|
||||||
}
|
|
||||||
return drawChartsFromBenchmarkData(dataUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
const proxyFields: BenchmarkName[] = ["req_per_sec"];
|
|
||||||
function extractProxyFields(data: BenchmarkRun[]): void {
|
|
||||||
for (const row of data) {
|
|
||||||
for (const field of proxyFields) {
|
|
||||||
const d = row[field];
|
|
||||||
if (!d) continue;
|
|
||||||
const name = field + "_proxy";
|
|
||||||
const newField = {};
|
|
||||||
row[name] = newField;
|
|
||||||
for (const k of Object.getOwnPropertyNames(d)) {
|
|
||||||
if (k.includes("_proxy")) {
|
|
||||||
const v = d[k];
|
|
||||||
delete d[k];
|
|
||||||
newField[k] = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Draws the charts from the benchmark data stored in gh-pages branch.
|
|
||||||
*/
|
|
||||||
export async function drawChartsFromBenchmarkData(
|
|
||||||
dataUrl: string
|
|
||||||
): Promise<void> {
|
|
||||||
const data = (await getJson(dataUrl)) as BenchmarkRun[];
|
|
||||||
|
|
||||||
// hack to extract proxy fields from req/s fields
|
|
||||||
extractProxyFields(data);
|
|
||||||
|
|
||||||
const execTimeColumns = createExecTimeColumns(data);
|
|
||||||
const throughputColumns = createThroughputColumns(data);
|
|
||||||
const reqPerSecColumns = createReqPerSecColumns(data);
|
|
||||||
const normalizedReqPerSecColumns = createNormalizedReqPerSecColumns(data);
|
|
||||||
const proxyColumns = createProxyColumns(data);
|
|
||||||
const normalizedProxyColumns = createNormalizedProxyColumns(data);
|
|
||||||
const maxLatencyColumns = createMaxLatencyColumns(data);
|
|
||||||
const maxMemoryColumns = createMaxMemoryColumns(data);
|
|
||||||
const binarySizeColumns = createBinarySizeColumns(data);
|
|
||||||
const threadCountColumns = createThreadCountColumns(data);
|
|
||||||
const syscallCountColumns = createSyscallCountColumns(data);
|
|
||||||
const bundleSizeColumns = createBundleSizeColumns(data);
|
|
||||||
const sha1List = createSha1List(data);
|
|
||||||
const sha1ShortList = sha1List.map(sha1 => sha1.substring(0, 6));
|
|
||||||
|
|
||||||
function viewCommitOnClick(d: C3DataNode, _: unknown): void {
|
|
||||||
// @ts-ignore
|
|
||||||
window.open(`https://github.com/denoland/deno/commit/${sha1List[d.index]}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
function gen(
|
|
||||||
id: string,
|
|
||||||
columns: Column[],
|
|
||||||
yLabel = "",
|
|
||||||
yTickFormat?: C3TickFormatter,
|
|
||||||
onrendered?: C3OnRenderedCallback
|
|
||||||
): void {
|
|
||||||
generate(
|
|
||||||
id,
|
|
||||||
sha1ShortList,
|
|
||||||
columns,
|
|
||||||
viewCommitOnClick,
|
|
||||||
yLabel,
|
|
||||||
yTickFormat,
|
|
||||||
true,
|
|
||||||
onrendered
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
gen("#exec-time-chart", execTimeColumns, "seconds", logScale);
|
|
||||||
gen("#throughput-chart", throughputColumns, "seconds", logScale);
|
|
||||||
gen("#req-per-sec-chart", reqPerSecColumns, "1000 req/sec", formatReqSec);
|
|
||||||
gen(
|
|
||||||
"#normalized-req-per-sec-chart",
|
|
||||||
normalizedReqPerSecColumns,
|
|
||||||
"% of hyper througput",
|
|
||||||
formatPercentage,
|
|
||||||
hideOnRender("normalized-req-per-sec-chart")
|
|
||||||
);
|
|
||||||
gen("#proxy-req-per-sec-chart", proxyColumns, "req/sec");
|
|
||||||
gen(
|
|
||||||
"#normalized-proxy-req-per-sec-chart",
|
|
||||||
normalizedProxyColumns,
|
|
||||||
"% of hyper througput",
|
|
||||||
formatPercentage,
|
|
||||||
hideOnRender("normalized-proxy-req-per-sec-chart")
|
|
||||||
);
|
|
||||||
gen("#max-latency-chart", maxLatencyColumns, "milliseconds", logScale);
|
|
||||||
gen("#max-memory-chart", maxMemoryColumns, "megabytes", formatMB);
|
|
||||||
gen("#binary-size-chart", binarySizeColumns, "megabytes", formatMB);
|
|
||||||
gen("#thread-count-chart", threadCountColumns, "threads");
|
|
||||||
gen("#syscall-count-chart", syscallCountColumns, "syscalls");
|
|
||||||
gen("#bundle-size-chart", bundleSizeColumns, "kilobytes", formatKB);
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideOnRender(elementID: string): C3OnRenderedCallback {
|
|
||||||
return (): void => {
|
|
||||||
const chart = window["document"].getElementById(elementID);
|
|
||||||
if (!chart.getAttribute("data-inital-hide-done")) {
|
|
||||||
chart.setAttribute("data-inital-hide-done", "true");
|
|
||||||
chart.classList.add("hidden");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function registerNormalizedSwitcher(
|
|
||||||
checkboxID: string,
|
|
||||||
chartID: string,
|
|
||||||
normalizedChartID: string
|
|
||||||
): void {
|
|
||||||
const checkbox = window["document"].getElementById(checkboxID);
|
|
||||||
const regularChart = window["document"].getElementById(chartID);
|
|
||||||
const normalizedChart = window["document"].getElementById(normalizedChartID);
|
|
||||||
|
|
||||||
checkbox.addEventListener("change", _ => {
|
|
||||||
// If checked is true the normalized variant should be shown
|
|
||||||
// @ts-ignore
|
|
||||||
if (checkbox.checked) {
|
|
||||||
regularChart.classList.add("hidden");
|
|
||||||
normalizedChart.classList.remove("hidden");
|
|
||||||
} else {
|
|
||||||
normalizedChart.classList.add("hidden");
|
|
||||||
regularChart.classList.remove("hidden");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function main(): void {
|
|
||||||
window["chartWidth"] = 800;
|
|
||||||
const overlay = window["document"].getElementById("spinner-overlay");
|
|
||||||
|
|
||||||
function showSpinner(): void {
|
|
||||||
overlay.style.display = "block";
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideSpinner(): void {
|
|
||||||
overlay.style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateCharts(): void {
|
|
||||||
const u = window.location.hash.match("all") ? "./data.json" : "recent.json";
|
|
||||||
|
|
||||||
showSpinner();
|
|
||||||
|
|
||||||
drawCharts(u)
|
|
||||||
.then(hideSpinner)
|
|
||||||
.catch(hideSpinner);
|
|
||||||
}
|
|
||||||
updateCharts();
|
|
||||||
|
|
||||||
registerNormalizedSwitcher(
|
|
||||||
"req-per-sec-chart-show-normalized",
|
|
||||||
"req-per-sec-chart",
|
|
||||||
"normalized-req-per-sec-chart"
|
|
||||||
);
|
|
||||||
|
|
||||||
registerNormalizedSwitcher(
|
|
||||||
"proxy-req-per-sec-chart-show-normalized",
|
|
||||||
"proxy-req-per-sec-chart",
|
|
||||||
"normalized-proxy-req-per-sec-chart"
|
|
||||||
);
|
|
||||||
|
|
||||||
window["onhashchange"] = updateCharts;
|
|
||||||
}
|
|
|
@ -1,199 +0,0 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
||||||
|
|
||||||
import { test, assertEquals } from "../cli/js/test_util.ts";
|
|
||||||
import { runIfMain } from "../std/testing/mod.ts";
|
|
||||||
import {
|
|
||||||
BenchmarkRun,
|
|
||||||
createBinarySizeColumns,
|
|
||||||
createExecTimeColumns,
|
|
||||||
createThreadCountColumns,
|
|
||||||
createSyscallCountColumns,
|
|
||||||
createSha1List
|
|
||||||
} from "./app.ts";
|
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/camelcase */
|
|
||||||
const regularData: BenchmarkRun[] = [
|
|
||||||
{
|
|
||||||
created_at: "2018-01-01T01:00:00Z",
|
|
||||||
sha1: "abcdef",
|
|
||||||
binary_size: {
|
|
||||||
deno: 100000000,
|
|
||||||
"main.js": 90000000,
|
|
||||||
"main.js.map": 80000000,
|
|
||||||
"snapshot_deno.bin": 70000000
|
|
||||||
},
|
|
||||||
throughput: {
|
|
||||||
"100M_tcp": 3.6,
|
|
||||||
"100M_cat": 3.0,
|
|
||||||
"10M_tcp": 1.6,
|
|
||||||
"10M_cat": 1.0
|
|
||||||
},
|
|
||||||
req_per_sec: {
|
|
||||||
node: 16000,
|
|
||||||
deno: 1000
|
|
||||||
},
|
|
||||||
benchmark: {
|
|
||||||
hello: {
|
|
||||||
mean: 0.05
|
|
||||||
},
|
|
||||||
relative_import: {
|
|
||||||
mean: 0.06
|
|
||||||
},
|
|
||||||
cold_hello: {
|
|
||||||
mean: 0.05
|
|
||||||
},
|
|
||||||
cold_relative_import: {
|
|
||||||
mean: 0.06
|
|
||||||
}
|
|
||||||
},
|
|
||||||
thread_count: {
|
|
||||||
set_timeout: 4,
|
|
||||||
fetch_deps: 6
|
|
||||||
},
|
|
||||||
syscall_count: {
|
|
||||||
hello: 600,
|
|
||||||
fetch_deps: 700
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
created_at: "2018-01-02T01:00:00Z",
|
|
||||||
sha1: "012345",
|
|
||||||
binary_size: {
|
|
||||||
deno: 100000001,
|
|
||||||
"main.js": 90000001,
|
|
||||||
"main.js.map": 80000001,
|
|
||||||
"snapshot_deno.bin": 70000001
|
|
||||||
},
|
|
||||||
throughput: {
|
|
||||||
"100M_tcp": 3.6,
|
|
||||||
"100M_cat": 3.0,
|
|
||||||
"10M_tcp": 1.6,
|
|
||||||
"10M_cat": 1.0
|
|
||||||
},
|
|
||||||
req_per_sec: {
|
|
||||||
node: 1600,
|
|
||||||
deno: 3.0
|
|
||||||
},
|
|
||||||
benchmark: {
|
|
||||||
hello: {
|
|
||||||
mean: 0.055
|
|
||||||
},
|
|
||||||
relative_import: {
|
|
||||||
mean: 0.065
|
|
||||||
},
|
|
||||||
cold_hello: {
|
|
||||||
mean: 0.055
|
|
||||||
},
|
|
||||||
cold_relative_import: {
|
|
||||||
mean: 0.065
|
|
||||||
}
|
|
||||||
},
|
|
||||||
thread_count: {
|
|
||||||
set_timeout: 5,
|
|
||||||
fetch_deps: 7
|
|
||||||
},
|
|
||||||
syscall_count: {
|
|
||||||
hello: 700,
|
|
||||||
fetch_deps: 800
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const irregularData: BenchmarkRun[] = [
|
|
||||||
{
|
|
||||||
created_at: "2018-01-01T01:00:00Z",
|
|
||||||
sha1: "123",
|
|
||||||
benchmark: {},
|
|
||||||
throughput: {},
|
|
||||||
binary_size: {},
|
|
||||||
thread_count: {},
|
|
||||||
syscall_count: {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
created_at: "2018-02-01T01:00:00Z",
|
|
||||||
sha1: "456",
|
|
||||||
benchmark: {
|
|
||||||
hello: {},
|
|
||||||
relative_import: {},
|
|
||||||
cold_hello: {},
|
|
||||||
cold_relative_import: {}
|
|
||||||
},
|
|
||||||
throughput: {
|
|
||||||
"100M_tcp": 3.0
|
|
||||||
},
|
|
||||||
binary_size: {
|
|
||||||
deno: 1
|
|
||||||
},
|
|
||||||
thread_count: {
|
|
||||||
set_timeout: 5,
|
|
||||||
fetch_deps: 7
|
|
||||||
},
|
|
||||||
syscall_count: {
|
|
||||||
hello: 700,
|
|
||||||
fetch_deps: 800
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
/* eslint-enable @typescript-eslint/camelcase */
|
|
||||||
|
|
||||||
test(function createExecTimeColumnsRegularData() {
|
|
||||||
const columns = createExecTimeColumns(regularData);
|
|
||||||
assertEquals(columns, [
|
|
||||||
["hello", 0.05, 0.055],
|
|
||||||
["relative_import", 0.06, 0.065],
|
|
||||||
["cold_hello", 0.05, 0.055],
|
|
||||||
["cold_relative_import", 0.06, 0.065]
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(function createExecTimeColumnsIrregularData() {
|
|
||||||
const columns = createExecTimeColumns(irregularData);
|
|
||||||
assertEquals(columns, [
|
|
||||||
["hello", null, null],
|
|
||||||
["relative_import", null, null],
|
|
||||||
["cold_hello", null, null],
|
|
||||||
["cold_relative_import", null, null]
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(function createBinarySizeColumnsRegularData() {
|
|
||||||
const columns = createBinarySizeColumns(regularData);
|
|
||||||
assertEquals(columns, [
|
|
||||||
["deno", 100000000, 100000001],
|
|
||||||
["main.js", 90000000, 90000001],
|
|
||||||
["main.js.map", 80000000, 80000001],
|
|
||||||
["snapshot_deno.bin", 70000000, 70000001]
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(function createBinarySizeColumnsIrregularData() {
|
|
||||||
const columns = createBinarySizeColumns(irregularData);
|
|
||||||
assertEquals(columns, [["deno", null, 1]]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(function createThreadCountColumnsRegularData() {
|
|
||||||
const columns = createThreadCountColumns(regularData);
|
|
||||||
assertEquals(columns, [["set_timeout", 4, 5], ["fetch_deps", 6, 7]]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(function createThreadCountColumnsIrregularData() {
|
|
||||||
const columns = createThreadCountColumns(irregularData);
|
|
||||||
assertEquals(columns, [["set_timeout", null, 5], ["fetch_deps", null, 7]]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(function createSyscallCountColumnsRegularData() {
|
|
||||||
const columns = createSyscallCountColumns(regularData);
|
|
||||||
assertEquals(columns, [["hello", 600, 700], ["fetch_deps", 700, 800]]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(function createSyscallCountColumnsIrregularData() {
|
|
||||||
const columns = createSyscallCountColumns(irregularData);
|
|
||||||
assertEquals(columns, [["hello", null, 700], ["fetch_deps", null, 800]]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(function createSha1ListRegularData() {
|
|
||||||
const sha1List = createSha1List(regularData);
|
|
||||||
assertEquals(sha1List, ["abcdef", "012345"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
runIfMain(import.meta);
|
|
|
@ -1,273 +0,0 @@
|
||||||
<!-- Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -->
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Deno Benchmarks</title>
|
|
||||||
<link rel="shortcut icon" href="favicon.ico" />
|
|
||||||
<link rel="stylesheet" href="https://unpkg.com/c3@0.6.7/c3.min.css" />
|
|
||||||
<link rel="stylesheet" href="style.css" />
|
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="spinner-overlay">
|
|
||||||
<div class="spinner"></div>
|
|
||||||
`
|
|
||||||
</div>
|
|
||||||
<main>
|
|
||||||
<a href="/"><img src="images/deno_logo_4.gif" width="200"/></a>
|
|
||||||
<h1>Deno Continuous Benchmarks</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
These plots are updated on every commit to
|
|
||||||
<a href="https://github.com/denoland/deno">master branch</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Make sure your adblocker is disabled as some can block the chart
|
|
||||||
rendering.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p><a href="#recent">recent data</a></p>
|
|
||||||
<p><a href="#all">all data</a> (takes a moment to load)</p>
|
|
||||||
|
|
||||||
<h3 id="req-per-sec">Req/Sec <a href="#req-per-sec">#</a></h3>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Tests HTTP server performance. 10 keep-alive connections do as many
|
|
||||||
hello-world requests as possible. Bigger is better.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/deno_tcp.ts"
|
|
||||||
>deno_tcp</a
|
|
||||||
>
|
|
||||||
is a fake http server that doesn't parse HTTP. It is comparable to
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/node_tcp.js"
|
|
||||||
>node_tcp</a
|
|
||||||
>
|
|
||||||
.
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno_std/blob/master/http/http_bench.ts"
|
|
||||||
>deno_http</a
|
|
||||||
>
|
|
||||||
is a web server written in TypeScript. It is comparable to
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/node_http.js"
|
|
||||||
>node_http</a
|
|
||||||
>
|
|
||||||
.
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
deno_core_single and deno_core_multi are two versions of a minimal
|
|
||||||
fake HTTP server. It blindly reads and writes fixed HTTP packets. It
|
|
||||||
is comparable to deno_tcp and node_tcp. This is a standalone
|
|
||||||
executable that uses
|
|
||||||
<a href="https://crates.io/crates/deno">the deno rust crate</a>. The
|
|
||||||
code is in
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/core/examples/http_bench.rs"
|
|
||||||
>http_bench.rs</a
|
|
||||||
>
|
|
||||||
and
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/core/examples/http_bench.js"
|
|
||||||
>http_bench.js</a
|
|
||||||
>. single uses
|
|
||||||
<a
|
|
||||||
href="https://docs.rs/tokio/0.1.19/tokio/runtime/current_thread/index.html"
|
|
||||||
>tokio::runtime::current_thread</a
|
|
||||||
>
|
|
||||||
and multi uses
|
|
||||||
<a href="https://docs.rs/tokio/0.1.19/tokio/runtime/"
|
|
||||||
>tokio::runtime::threadpool</a
|
|
||||||
>.
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/hyper_hello.rs"
|
|
||||||
>
|
|
||||||
hyper
|
|
||||||
</a>
|
|
||||||
is a Rust HTTP server and represents an upper bound.
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="req-per-sec-chart"></div>
|
|
||||||
|
|
||||||
<div id="normalized-req-per-sec-chart"></div>
|
|
||||||
|
|
||||||
<input type="checkbox" id="req-per-sec-chart-show-normalized" />
|
|
||||||
<label for="req-per-sec-chart-show-normalized">Show Normalized</label>
|
|
||||||
|
|
||||||
<h3 id="proxy-req-per-sec">
|
|
||||||
Proxy Req/Sec <a href="#proxy-eq-per-sec">#</a>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Tests proxy performance. 10 keep-alive connections do as many
|
|
||||||
hello-world requests as possible. Bigger is better.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/deno_tcp_proxy.ts"
|
|
||||||
>deno_proxy_tcp</a
|
|
||||||
>
|
|
||||||
is a fake tcp proxy server that doesn't parse HTTP. It is comparable
|
|
||||||
to
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/node_tcp_proxy.js"
|
|
||||||
>node_proxy_tcp</a
|
|
||||||
>
|
|
||||||
.
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/deno_http_proxy.ts"
|
|
||||||
>deno_proxy</a
|
|
||||||
>
|
|
||||||
is an HTTP proxy server written in TypeScript. It is comparable to
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/node_http_proxy.js"
|
|
||||||
>node_proxy</a
|
|
||||||
>
|
|
||||||
.
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/hyper_hello.rs"
|
|
||||||
>
|
|
||||||
hyper
|
|
||||||
</a>
|
|
||||||
is a Rust HTTP server used as the origin for the proxy tests
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="proxy-req-per-sec-chart"></div>
|
|
||||||
|
|
||||||
<div id="normalized-proxy-req-per-sec-chart"></div>
|
|
||||||
|
|
||||||
<input type="checkbox" id="proxy-req-per-sec-chart-show-normalized" />
|
|
||||||
<label for="proxy-req-per-sec-chart-show-normalized"
|
|
||||||
>Show Normalized</label
|
|
||||||
>
|
|
||||||
|
|
||||||
<h3 id="max-latency">Max Latency <a href="#max-latency">#</a></h3>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Max latency during the same test used above for requests/second. Smaller
|
|
||||||
is better.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div id="max-latency-chart"></div>
|
|
||||||
|
|
||||||
<h3 id="exec-time">Execution time <a href="#exec-time">#</a></h3>
|
|
||||||
<p>
|
|
||||||
This shows how much time total it takes to run a few simple deno
|
|
||||||
programs:
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tests/002_hello.ts"
|
|
||||||
>
|
|
||||||
tests/002_hello.ts </a
|
|
||||||
>,
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tests/003_relative_import.ts"
|
|
||||||
>tests/003_relative_import.ts</a
|
|
||||||
>,
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/cli/tests/text_decoder_perf.js"
|
|
||||||
>cli/tests/text_decoder_perf.js</a
|
|
||||||
>,
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tests/workers_round_robin_bench.ts"
|
|
||||||
>tests/workers_round_robin_bench.ts</a
|
|
||||||
>, and
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tests/workers_startup_bench.ts"
|
|
||||||
>tests/workers_startup_bench.ts</a
|
|
||||||
>. For deno to execute typescript, it must first compile it to JS. A
|
|
||||||
warm startup is when deno has a cached JS output already, so it should
|
|
||||||
be fast because it bypasses the TS compiler. A cold startup is when deno
|
|
||||||
must compile from scratch.
|
|
||||||
</p>
|
|
||||||
<div id="exec-time-chart"></div>
|
|
||||||
|
|
||||||
<h3 id="throughput">Throughput <a href="#throughput">#</a></h3>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Time it takes to pipe a certain amount of data through Deno.
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="https://github.com/denoland/deno/blob/master/tests/echo_server.ts"
|
|
||||||
>
|
|
||||||
echo_server.ts
|
|
||||||
</a>
|
|
||||||
and
|
|
||||||
<a href="https://github.com/denoland/deno/blob/master/tests/cat.ts">
|
|
||||||
cat.ts </a
|
|
||||||
>. Smaller is better.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div id="throughput-chart"></div>
|
|
||||||
|
|
||||||
<h3 id="max-memory">Max Memory Usage <a href="#max-memory">#</a></h3>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Max memory usage during execution. Smaller is better.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div id="max-memory-chart"></div>
|
|
||||||
|
|
||||||
<h3 id="size">Executable size <a href="#size">#</a></h3>
|
|
||||||
<p>deno ships only a single binary. We track its size here.</p>
|
|
||||||
<div id="binary-size-chart"></div>
|
|
||||||
|
|
||||||
<h3 id="threads">Thread count <a href="#threads">#</a></h3>
|
|
||||||
<p>How many threads various programs use.</p>
|
|
||||||
<div id="thread-count-chart"></div>
|
|
||||||
|
|
||||||
<h3 id="bundles">Syscall count <a href="#bundles">#</a></h3>
|
|
||||||
<p>
|
|
||||||
How many total syscalls are performed when executing a given script.
|
|
||||||
</p>
|
|
||||||
<div id="syscall-count-chart"></div>
|
|
||||||
|
|
||||||
<h3 id="bundles">Bundle size <a href="#syscalls">#</a></h3>
|
|
||||||
<p>
|
|
||||||
Size of different bundled scripts.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="https://deno.land/std/http/file_server.ts">file_server</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<a href="https://deno.land/std/examples/gist.ts">gist</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="bundle-size-chart"></div>
|
|
||||||
</main>
|
|
||||||
<script src="https://unpkg.com/d3@5.7.0/dist/d3.min.js"></script>
|
|
||||||
<script src="https://unpkg.com/c3@0.6.7/c3.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Run "deno bundle app.ts app.bundle.js" to generate app.bundle.js -->
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
|
|
||||||
<script src="app.bundle.js"></script>
|
|
||||||
<script>
|
|
||||||
requirejs(["app"], app => app.main());
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
|
@ -1,92 +0,0 @@
|
||||||
<?xml version="1.0" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
|
||||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
|
||||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
|
||||||
width="1024.000000pt" height="1024.000000pt" viewBox="0 0 1024.000000 1024.000000"
|
|
||||||
preserveAspectRatio="xMidYMid meet">
|
|
||||||
<metadata>
|
|
||||||
Created by potrace 1.15, written by Peter Selinger 2001-2017
|
|
||||||
</metadata>
|
|
||||||
<g transform="translate(0.000000,1024.000000) scale(0.100000,-0.100000)"
|
|
||||||
fill="#222" stroke="none">
|
|
||||||
<path d="M4720 9174 c-19 -2 -80 -9 -135 -14 -782 -82 -1552 -413 -2180 -939
|
|
||||||
-116 -96 -380 -360 -476 -476 -520 -621 -824 -1318 -936 -2143 -25 -183 -25
|
|
||||||
-801 0 -984 112 -825 416 -1522 936 -2143 96 -116 360 -380 476 -476 621 -520
|
|
||||||
1318 -824 2143 -936 183 -25 801 -25 984 0 825 112 1522 416 2143 936 116 96
|
|
||||||
380 360 476 476 520 621 824 1318 936 2143 25 183 25 801 0 984 -112 825 -416
|
|
||||||
1522 -936 2143 -96 116 -360 380 -476 476 -619 518 -1323 826 -2137 935 -88
|
|
||||||
12 -216 17 -453 19 -181 2 -346 1 -365 -1z m50 -432 c0 -117 8 -371 19 -612 6
|
|
||||||
-118 13 -287 16 -375 11 -312 44 -1131 49 -1204 l5 -73 -45 5 c-25 2 -48 8
|
|
||||||
-52 11 -3 4 -10 73 -14 154 -18 356 -77 1737 -83 1939 l-6 222 28 4 c15 2 40
|
|
||||||
5 56 6 l27 1 0 -78z m957 24 c1 -1 4 -303 7 -671 4 -369 9 -700 12 -736 3 -37
|
|
||||||
2 -69 -3 -71 -4 -3 -29 -3 -54 0 l-46 4 -7 291 c-4 161 -9 339 -11 397 -8 177
|
|
||||||
-15 778 -9 793 4 11 15 12 57 5 29 -6 53 -11 54 -12z m-2313 -335 c6 -9 53
|
|
||||||
-560 111 -1281 19 -245 38 -469 41 -497 5 -51 4 -53 -28 -73 -18 -11 -36 -20
|
|
||||||
-40 -20 -3 0 -9 26 -12 58 -14 130 -68 758 -106 1212 -22 267 -42 506 -45 532
|
|
||||||
-5 44 -4 48 22 62 32 17 50 20 57 7z m2753 -201 c28 -10 31 -15 37 -72 10
|
|
||||||
-100 7 -578 -4 -578 -29 0 -89 34 -94 53 -3 12 -6 154 -6 315 0 325 -4 306 67
|
|
||||||
282z m-1847 -47 c0 -27 7 -176 15 -333 8 -157 17 -356 21 -442 7 -174 9 -168
|
|
||||||
-58 -172 -33 -1 -33 -1 -35 49 -2 28 -7 115 -13 195 -5 80 -17 253 -25 385 -8
|
|
||||||
132 -18 263 -21 291 -6 50 -5 52 22 62 16 6 44 11 62 11 32 1 32 1 32 -46z
|
|
||||||
m2774 -137 l34 -14 7 -134 c3 -73 5 -231 3 -350 l-3 -218 -42 21 -42 20 -3
|
|
||||||
332 c-2 183 -1 338 1 345 4 15 4 15 45 -2z m-1826 -131 c6 -6 20 -491 21 -737
|
|
||||||
l1 -148 -47 7 c-27 3 -49 6 -50 7 -3 2 -33 743 -33 815 l0 74 51 -6 c29 -4 54
|
|
||||||
-9 57 -12z m2303 -71 c12 -14 14 -233 17 -1441 3 -1387 3 -1423 -15 -1423 -11
|
|
||||||
0 -26 6 -35 13 -15 11 -17 132 -22 1317 -4 718 -9 1370 -12 1449 l-6 144 29
|
|
||||||
-21 c17 -12 36 -29 44 -38z m-897 -205 c5 -4 10 -61 11 -126 5 -221 6 -1576 1
|
|
||||||
-1580 -2 -2 -20 3 -40 11 l-36 15 0 851 0 850 28 -6 c15 -4 31 -10 36 -15z
|
|
||||||
m-2760 -56 c3 -27 8 -88 11 -138 3 -49 10 -161 16 -248 12 -176 10 -187 -47
|
|
||||||
-187 -30 0 -34 3 -38 33 -10 59 -45 551 -40 559 5 7 57 25 81 27 6 1 14 -20
|
|
||||||
17 -46z m-1654 -255 c11 -106 33 -328 49 -493 17 -165 31 -305 31 -311 0 -12
|
|
||||||
-77 -50 -85 -42 -5 5 -105 890 -105 930 0 24 77 125 87 114 3 -2 13 -91 23
|
|
||||||
-198z m3921 -105 l29 -17 1 -216 c1 -118 3 -250 3 -293 2 -90 -9 -105 -63 -86
|
|
||||||
l-31 11 0 86 c0 48 -3 187 -7 310 l-6 222 23 0 c12 0 35 -8 51 -17z m-3482
|
|
||||||
-388 c18 -192 47 -516 66 -720 l34 -370 -39 -39 -38 -39 -7 79 c-4 44 -24 248
|
|
||||||
-45 454 -21 206 -51 505 -66 664 l-28 288 39 36 c35 33 39 34 46 16 4 -10 21
|
|
||||||
-176 38 -369z m-749 -121 c22 -197 80 -721 130 -1164 50 -443 97 -870 106
|
|
||||||
-950 8 -80 22 -201 30 -270 14 -117 14 -125 -2 -137 -24 -18 -34 -16 -34 5 0
|
|
||||||
9 -9 85 -20 167 -18 137 -48 369 -115 890 -14 105 -41 314 -60 465 -20 151
|
|
||||||
-49 376 -65 500 -16 124 -43 336 -60 473 -18 136 -29 257 -26 270 7 27 66 121
|
|
||||||
72 115 2 -3 22 -166 44 -364z m-306 -431 c15 -120 43 -339 62 -488 19 -148 43
|
|
||||||
-333 54 -410 l19 -140 -21 -18 c-12 -10 -24 -14 -28 -10 -4 4 -12 44 -18 88
|
|
||||||
-6 44 -43 301 -83 570 l-71 490 23 68 c12 37 25 67 28 67 4 0 19 -98 35 -217z
|
|
||||||
m5490 131 c14 -14 16 -76 16 -535 l0 -519 -28 0 c-61 0 -60 -15 -64 553 l-3
|
|
||||||
517 32 0 c17 0 39 -7 47 -16z m-2189 -179 c226 -34 423 -97 618 -197 126 -65
|
|
||||||
186 -110 326 -244 208 -199 336 -373 456 -619 175 -358 243 -675 329 -1525 39
|
|
||||||
-381 90 -1072 101 -1355 3 -82 10 -217 16 -300 11 -176 24 -152 -131 -227
|
|
||||||
-215 -104 -422 -176 -695 -243 -334 -82 -550 -108 -880 -109 l-240 -1 2 115
|
|
||||||
c0 63 6 210 12 325 30 557 24 1260 -15 1650 -22 224 -65 496 -89 556 -5 13 18
|
|
||||||
24 117 58 181 63 338 142 362 181 43 74 -34 180 -132 180 -17 0 -68 -18 -115
|
|
||||||
-39 -224 -103 -673 -224 -932 -251 -179 -19 -457 -8 -650 27 -105 19 -293 90
|
|
||||||
-450 171 -181 94 -292 219 -325 367 -18 80 -13 240 10 330 25 99 95 243 159
|
|
||||||
327 285 375 873 700 1476 814 192 36 464 40 670 9z m3085 -31 c36 -15 40 -19
|
|
||||||
40 -53 2 -273 -4 -897 -9 -923 -1 -9 -53 -10 -75 -2 -14 5 -16 59 -16 500 0
|
|
||||||
316 4 494 10 494 5 0 28 -7 50 -16z m437 -549 l36 -15 -7 -828 c-8 -1055 -9
|
|
||||||
-1086 -47 -1177 -62 -149 -59 -179 -53 475 2 327 7 658 9 735 2 77 4 294 5
|
|
||||||
483 0 228 3 342 10 342 6 0 27 -7 47 -15z m-6014 -249 c6 -81 4 -89 -25 -153
|
|
||||||
l-32 -68 -12 100 c-19 160 -19 167 19 191 17 12 35 20 38 18 3 -2 9 -42 12
|
|
||||||
-88z m-618 -603 c9 -82 79 -626 115 -893 54 -413 58 -472 34 -447 -3 3 -26
|
|
||||||
142 -50 309 -156 1078 -155 1071 -142 1079 27 18 36 8 43 -48z m720 -458 c6
|
|
||||||
-25 35 -296 35 -329 0 -28 -36 -54 -52 -38 -5 5 -18 90 -28 188 -11 99 -22
|
|
||||||
202 -25 229 l-6 50 35 -40 c20 -22 38 -49 41 -60z m807 -377 c11 -10 18 -50
|
|
||||||
27 -158 15 -195 17 -180 -24 -180 -42 0 -41 -3 -55 173 -14 179 -14 177 13
|
|
||||||
177 13 0 30 -6 39 -12z m792 -15 c2 -10 7 -70 11 -133 3 -63 12 -205 20 -315
|
|
||||||
28 -404 29 -455 12 -455 -19 0 -21 15 -43 300 -8 118 -23 304 -33 413 -9 109
|
|
||||||
-15 200 -12 202 11 12 40 3 45 -12z m-1880 -192 c6 -9 44 -329 91 -766 14
|
|
||||||
-132 28 -259 31 -283 l5 -43 -25 16 c-19 13 -26 26 -26 49 0 63 -43 478 -76
|
|
||||||
732 -19 144 -34 271 -34 283 0 21 24 29 34 12z m5771 -418 l-7 -418 -25 -37
|
|
||||||
c-57 -84 -54 -100 -51 368 l2 429 37 38 c20 20 40 37 44 37 3 0 3 -188 0 -417z
|
|
||||||
m-925 -663 c5 -581 4 -626 -12 -644 -10 -11 -19 -18 -22 -15 -7 8 -17 1275 -9
|
|
||||||
1282 4 4 14 6 23 5 13 -3 16 -74 20 -628z m-3266 398 c7 -62 32 -359 42 -499
|
|
||||||
6 -94 6 -97 -16 -104 -12 -4 -26 -3 -30 2 -7 7 -29 229 -56 571 l-7 82 31 0
|
|
||||||
c29 0 31 -2 36 -52z m-786 -350 c7 -7 12 -32 12 -57 0 -26 12 -161 25 -301 38
|
|
||||||
-383 41 -435 24 -425 -26 15 -49 38 -44 44 2 4 -2 54 -10 111 -7 58 -16 152
|
|
||||||
-20 210 -4 58 -13 164 -21 235 -19 175 -18 195 4 195 10 0 23 -5 30 -12z m473
|
|
||||||
-673 c3 -22 9 -104 13 -182 7 -150 4 -161 -37 -130 -12 9 -20 47 -32 161 -21
|
|
||||||
206 -22 198 17 194 29 -3 33 -7 39 -43z"/>
|
|
||||||
<path d="M3184 5756 c-104 -45 -112 -186 -14 -236 71 -36 143 -19 180 43 70
|
|
||||||
114 -44 246 -166 193z"/>
|
|
||||||
<path d="M3862 5660 c-96 -59 -96 -201 0 -260 95 -57 218 18 218 132 0 110
|
|
||||||
-126 184 -218 128z"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 57 KiB |
|
@ -1,151 +0,0 @@
|
||||||
<!-- Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -->
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Deno</title>
|
|
||||||
<link rel="shortcut icon" href="favicon.ico">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/default.min.css">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/github-gist.min.css">
|
|
||||||
<link rel="stylesheet" media="(prefers-color-scheme: dark)" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/monokai-sublime.min.css">
|
|
||||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/highlight.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/languages/typescript.min.js"></script>
|
|
||||||
<link rel="stylesheet" href="style.css" />
|
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<header>
|
|
||||||
<img id="logo" src="images/deno_logo_3.svg" width=200>
|
|
||||||
<div>
|
|
||||||
<h1>Deno</h1>
|
|
||||||
A secure runtime for JavaScript and TypeScript built with V8, Rust, and Tokio
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Linux & Mac</th>
|
|
||||||
<th>Windows</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th><a href="https://github.com/denoland/deno">deno</a></th>
|
|
||||||
<td colspan="2">
|
|
||||||
<a class="badge" href="https://github.com/denoland/deno/actions">
|
|
||||||
<img src="https://github.com/denoland/deno/workflows/build/badge.svg" />
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<a href="https://github.com/denoland/deno_install">deno_install</a>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<a class="badge" href="https://travis-ci.com/denoland/deno_install">
|
|
||||||
<img
|
|
||||||
src="https://travis-ci.com/denoland/deno_install.svg?branch=master"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a
|
|
||||||
class="badge"
|
|
||||||
href="https://ci.appveyor.com/project/deno/deno-install"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="https://ci.appveyor.com/api/projects/status/gtekeaf7r60xa896?branch=master&svg=true"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th><a href="https://github.com/denoland/registry">registry</a></th>
|
|
||||||
<td colspan=2>
|
|
||||||
<a class="badge" href="https://travis-ci.com/denoland/registry">
|
|
||||||
<img
|
|
||||||
src="https://travis-ci.com/denoland/registry.svg?branch=master"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2 id="install">Install <a href="#install">#</a></h2>
|
|
||||||
|
|
||||||
<p>Using Shell:</p>
|
|
||||||
<pre>curl -fsSL <a
|
|
||||||
href="https://deno.land/x/install/install.sh">https://deno.land/x/install/install.sh</a> | sh</pre>
|
|
||||||
<p>Or using PowerShell:</p>
|
|
||||||
<pre>iwr <a
|
|
||||||
href="https://deno.land/x/install/install.ps1">https://deno.land/x/install/install.ps1</a> -useb | iex</pre>
|
|
||||||
<p>Using <a href="https://formulae.brew.sh/formula/deno">Homebrew</a> (mac):</p>
|
|
||||||
<pre>brew install deno</pre>
|
|
||||||
<p>Using <a href="https://scoop.sh/">Scoop</a> (windows):
|
|
||||||
<pre>scoop install deno</pre>
|
|
||||||
<p>Using <a href="https://crates.io/crates/deno_cli">Cargo</a>:
|
|
||||||
<pre>cargo install deno_cli</pre>
|
|
||||||
<p>See <a href="https://github.com/denoland/deno_install">deno_install</a> for more installation options.</p>
|
|
||||||
|
|
||||||
<h2 id="example">Example <a href="#example">#</a></h2>
|
|
||||||
|
|
||||||
<p>Try running a simple program:</p>
|
|
||||||
<pre>deno https://deno.land/welcome.ts</pre>
|
|
||||||
|
|
||||||
<p>Or a more complex one:</p>
|
|
||||||
|
|
||||||
<pre><code class="typescript language-typescript">import { serve } from "<a href="https://deno.land/std@v0.19.0/http/server.ts">https://deno.land/std@v0.19.0/http/server.ts</a>";
|
|
||||||
const body = new TextEncoder().encode("Hello World\n");
|
|
||||||
const s = serve(":8000");
|
|
||||||
window.onload = async () => {
|
|
||||||
console.log("http://localhost:8000/");
|
|
||||||
for await (const req of s) {
|
|
||||||
req.respond({ body });
|
|
||||||
}
|
|
||||||
};</code></pre>
|
|
||||||
|
|
||||||
<h2 id="dig-in">Dig in... <a href="#dig-in">#</a></h2>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b><a href="manual.html">Manual</a></b>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p><a href="https://deno.land/typedoc/">API Reference</a></p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a href="https://deno.land/std/">Standard Modules</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p><a href="style_guide.html">Style Guide</a></p>
|
|
||||||
|
|
||||||
<p><a href="https://deno.land/x/">Module repository</a></p>
|
|
||||||
|
|
||||||
<p><a href="https://twitter.com/deno_land">Twitter Account</a></p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a href="https://github.com/denoland/deno/blob/master/Releases.md"
|
|
||||||
>Release notes</a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p><a href="https://gitter.im/denolife/Lobby">Community chat room</a></p>
|
|
||||||
|
|
||||||
<p><a href="benchmarks.html">Benchmarks</a></p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a href="https://github.com/denolib/awesome-deno"
|
|
||||||
>A curated list of awesome Deno things</a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Disable automatic language detection
|
|
||||||
hljs.configure({
|
|
||||||
languages: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
hljs.initHighlighting();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,54 +0,0 @@
|
||||||
<!-- Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -->
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Deno Manual</title>
|
|
||||||
<link rel="shortcut icon" href="favicon.ico">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/default.min.css">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/github-gist.min.css">
|
|
||||||
<link rel="stylesheet" media="(prefers-color-scheme: dark)" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/monokai-sublime.min.css">
|
|
||||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/highlight.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/languages/typescript.min.js"></script>
|
|
||||||
<link rel="stylesheet" href="style.css" />
|
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<a href="/"><img src="https://denolib.github.io/animated-deno-logo/deno-circle-thunder.gif" width=200></a>
|
|
||||||
<div id="manual"></div>
|
|
||||||
|
|
||||||
<script src="https://unpkg.com/showdown@1.9.0/dist/showdown.js"></script>
|
|
||||||
<script src="showdown_toc.js"></script>
|
|
||||||
<script>
|
|
||||||
const url = "manual.md";
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const response = await fetch(url);
|
|
||||||
const content = await response.text();
|
|
||||||
|
|
||||||
let converter = new showdown.Converter({ extensions: ["toc"], tables: true });
|
|
||||||
let html = converter.makeHtml(content);
|
|
||||||
|
|
||||||
const manual = document.getElementById("manual");
|
|
||||||
manual.innerHTML = html;
|
|
||||||
|
|
||||||
// To make anchor links work properly, we have to manually scroll
|
|
||||||
// since the markdown is rendered dynamically.
|
|
||||||
if (window.location.hash) {
|
|
||||||
let el = document.getElementById(window.location.hash.slice(1));
|
|
||||||
window.scrollTo({ top: el.offsetTop });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable automatic language detection
|
|
||||||
hljs.configure({
|
|
||||||
languages: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
hljs.initHighlighting();
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
</script>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1 +0,0 @@
|
||||||
../target/doc/
|
|
|
@ -1,143 +0,0 @@
|
||||||
// Extension loading compatible with AMD and CommonJs
|
|
||||||
(function(extension) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
if (typeof showdown === "object") {
|
|
||||||
// global (browser or nodejs global)
|
|
||||||
showdown.extension("toc", extension());
|
|
||||||
} else if (typeof define === "function" && define.amd) {
|
|
||||||
// AMD
|
|
||||||
define("toc", extension());
|
|
||||||
} else if (typeof exports === "object") {
|
|
||||||
// Node, CommonJS-like
|
|
||||||
module.exports = extension();
|
|
||||||
} else {
|
|
||||||
// showdown was not found so we throw
|
|
||||||
throw Error("Could not find showdown library");
|
|
||||||
}
|
|
||||||
})(function() {
|
|
||||||
function getHeaderEntries(sourceHtml) {
|
|
||||||
if (typeof window === "undefined") {
|
|
||||||
return getHeaderEntriesInNodeJs(sourceHtml);
|
|
||||||
} else {
|
|
||||||
return getHeaderEntriesInBrowser(sourceHtml);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHeaderEntriesInNodeJs(sourceHtml) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
||||||
const cheerio = require("cheerio");
|
|
||||||
const $ = cheerio.load(sourceHtml);
|
|
||||||
const headers = $("h1, h2, h3, h4, h5, h6");
|
|
||||||
|
|
||||||
const headerList = [];
|
|
||||||
for (let i = 0; i < headers.length; i++) {
|
|
||||||
const el = headers[i];
|
|
||||||
headerList.push(new TocEntry(el.name, $(el).text(), $(el).attr("id")));
|
|
||||||
}
|
|
||||||
|
|
||||||
return headerList;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHeaderEntriesInBrowser(sourceHtml) {
|
|
||||||
// Generate dummy element
|
|
||||||
const source = document.createElement("div");
|
|
||||||
source.innerHTML = sourceHtml;
|
|
||||||
|
|
||||||
// Find headers
|
|
||||||
const headers = source.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
|
||||||
const headerList = [];
|
|
||||||
for (let i = 0; i < headers.length; i++) {
|
|
||||||
const el = headers[i];
|
|
||||||
headerList.push(new TocEntry(el.tagName, el.textContent, el.id));
|
|
||||||
}
|
|
||||||
|
|
||||||
return headerList;
|
|
||||||
}
|
|
||||||
|
|
||||||
function TocEntry(tagName, text, anchor) {
|
|
||||||
this.tagName = tagName;
|
|
||||||
this.text = text;
|
|
||||||
this.anchor = anchor;
|
|
||||||
this.children = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
TocEntry.prototype.childrenToString = function() {
|
|
||||||
if (this.children.length === 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
let result = "<ul>\n";
|
|
||||||
for (let i = 0; i < this.children.length; i++) {
|
|
||||||
result += this.children[i].toString();
|
|
||||||
}
|
|
||||||
result += "</ul>\n";
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
TocEntry.prototype.toString = function() {
|
|
||||||
let result = "<li>";
|
|
||||||
if (this.text) {
|
|
||||||
result += '<a href="#' + this.anchor + '">' + this.text + "</a>";
|
|
||||||
}
|
|
||||||
result += this.childrenToString();
|
|
||||||
result += "</li>\n";
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
function sortHeader(tocEntries, level) {
|
|
||||||
level = level || 1;
|
|
||||||
const tagName = "H" + level;
|
|
||||||
const result = [];
|
|
||||||
|
|
||||||
function push(tocEntry) {
|
|
||||||
if (tocEntry !== undefined) {
|
|
||||||
if (tocEntry.children.length > 0) {
|
|
||||||
tocEntry.children = sortHeader(tocEntry.children, level + 1);
|
|
||||||
}
|
|
||||||
result.push(tocEntry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let currentTocEntry;
|
|
||||||
for (let i = 0; i < tocEntries.length; i++) {
|
|
||||||
const tocEntry = tocEntries[i];
|
|
||||||
if (tocEntry.tagName.toUpperCase() !== tagName) {
|
|
||||||
if (currentTocEntry === undefined) {
|
|
||||||
currentTocEntry = new TocEntry();
|
|
||||||
}
|
|
||||||
currentTocEntry.children.push(tocEntry);
|
|
||||||
} else {
|
|
||||||
push(currentTocEntry);
|
|
||||||
currentTocEntry = tocEntry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
push(currentTocEntry);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
type: "output",
|
|
||||||
filter: function(sourceHtml) {
|
|
||||||
let headerList = getHeaderEntries(sourceHtml);
|
|
||||||
|
|
||||||
// No header found
|
|
||||||
if (headerList.length === 0) {
|
|
||||||
return sourceHtml;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort header
|
|
||||||
headerList = sortHeader(headerList);
|
|
||||||
|
|
||||||
// Skip the title.
|
|
||||||
if (headerList.length == 1) {
|
|
||||||
headerList = headerList[0].children;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build result and replace all [toc]
|
|
||||||
const result =
|
|
||||||
'<div class="toc">\n<ul>\n' + headerList.join("") + "</ul>\n</div>\n";
|
|
||||||
return sourceHtml.replace(/\[toc\]/gi, result);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -1,209 +0,0 @@
|
||||||
:root {
|
|
||||||
--text-color: #444;
|
|
||||||
--background-color: #f0f0f0;
|
|
||||||
--link-color: #106ad5;
|
|
||||||
--table-border: #bbb;
|
|
||||||
--pre-color: #161616;
|
|
||||||
--pre-link-color: #001631;
|
|
||||||
--pre-background: rgba(36, 126, 233, 0.1);
|
|
||||||
--code-color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--background-color: #444;
|
|
||||||
--text-color: #f0f0f0;
|
|
||||||
--link-color: #4498ff;
|
|
||||||
--pre-color: #e8e8e8;
|
|
||||||
--pre-link-color: #cee4ff;
|
|
||||||
--code-color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
#logo {
|
|
||||||
filter: invert();
|
|
||||||
}
|
|
||||||
|
|
||||||
.c3-tooltip th {
|
|
||||||
background: #6f6f6f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.c3-tooltip td {
|
|
||||||
background: var(--background-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.c3-axis g,
|
|
||||||
.c3-axis text,
|
|
||||||
.c3-legend-item text {
|
|
||||||
fill: var(--text-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.c3-axis line,
|
|
||||||
.c3-axis path.domain {
|
|
||||||
stroke: var(--text-color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
color: var(--text-color);
|
|
||||||
background: var(--background-color);
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
line-height: 1.5;
|
|
||||||
font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
|
|
||||||
|
|
||||||
margin: 5ex 10ex;
|
|
||||||
max-width: 80ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
#manual img {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 800px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1,
|
|
||||||
h2,
|
|
||||||
h3,
|
|
||||||
h4 {
|
|
||||||
font-weight: 500;
|
|
||||||
margin-top: 2em;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1:first-child,
|
|
||||||
h2:first-child,
|
|
||||||
h3:first-child,
|
|
||||||
h4:first-child {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1,
|
|
||||||
h2,
|
|
||||||
h3,
|
|
||||||
h4,
|
|
||||||
p,
|
|
||||||
table {
|
|
||||||
margin-left: 8px;
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
td,
|
|
||||||
th {
|
|
||||||
font-weight: normal;
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid var(--table-border);
|
|
||||||
padding: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (min-width: 768px) {
|
|
||||||
td,
|
|
||||||
th {
|
|
||||||
padding: 8px 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
svg {
|
|
||||||
margin: 0px;
|
|
||||||
width: 100%;
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: var(--link-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
pre a {
|
|
||||||
color: var(--pre-link-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 a,
|
|
||||||
h3 a {
|
|
||||||
display: none;
|
|
||||||
color: #3bace5;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2:hover a,
|
|
||||||
h3:hover a {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre {
|
|
||||||
/* background: rgba(36, 126, 233, 0.03); */
|
|
||||||
color: var(--pre-color);
|
|
||||||
background: var(--pre-background);
|
|
||||||
padding: 15px;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-break: break-all;
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin: 16px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
header > * {
|
|
||||||
margin: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
header h1 {
|
|
||||||
margin: 8px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-width: 480px) {
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
background: rgba(36, 126, 233, 0.1);
|
|
||||||
padding: 2px 5px;
|
|
||||||
color: var(--code-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#spinner-overlay {
|
|
||||||
display: none;
|
|
||||||
position: fixed;
|
|
||||||
top: 0px;
|
|
||||||
bottom: 0px;
|
|
||||||
left: 0px;
|
|
||||||
right: 0px;
|
|
||||||
background: rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spinner {
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner:before {
|
|
||||||
content: "";
|
|
||||||
box-sizing: border-box;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
width: 60px;
|
|
||||||
height: 60px;
|
|
||||||
margin-top: -30px;
|
|
||||||
margin-left: -30px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 2px solid #ccc;
|
|
||||||
border-top-color: #000;
|
|
||||||
animation: spinner 0.6s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
<!-- Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -->
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Deno Style Guide</title>
|
|
||||||
<link rel="shortcut icon" href="favicon.ico">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/default.min.css">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/github-gist.min.css">
|
|
||||||
<link rel="stylesheet" media="(prefers-color-scheme: dark)" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/styles/monokai-sublime.min.css">
|
|
||||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/highlight.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.14.2/build/languages/typescript.min.js"></script>
|
|
||||||
<link rel="stylesheet" href="style.css" />
|
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<a href="/"><img id="logo" src="images/deno_logo_3.svg" width=200></a>
|
|
||||||
|
|
||||||
<div id="manual"></div>
|
|
||||||
|
|
||||||
<script src="https://unpkg.com/showdown@1.9.0/dist/showdown.js"></script>
|
|
||||||
<script src="showdown_toc.js"></script>
|
|
||||||
<script>
|
|
||||||
const url = "style_guide.md";
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const response = await fetch(url);
|
|
||||||
const content = await response.text();
|
|
||||||
|
|
||||||
let converter = new showdown.Converter({ extensions: ["toc"] });
|
|
||||||
let html = converter.makeHtml(content);
|
|
||||||
|
|
||||||
const manual = document.getElementById("manual");
|
|
||||||
manual.innerHTML = html;
|
|
||||||
|
|
||||||
// To make anchor links work properly, we have to manually scroll
|
|
||||||
// since the markdown is rendered dynamically.
|
|
||||||
if (window.location.hash) {
|
|
||||||
let el = document.getElementById(window.location.hash.slice(1));
|
|
||||||
window.scrollTo({ top: el.offsetTop });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable automatic language detection
|
|
||||||
hljs.configure({
|
|
||||||
languages: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
hljs.initHighlighting();
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
</script>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1 +0,0 @@
|
||||||
../target/typedoc/
|
|
|
@ -1 +0,0 @@
|
||||||
console.log("Welcome to Deno 🦕");
|
|
Loading…
Reference in a new issue